Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Commit aaddf38

Browse files
author
demon
committed
devices stub
1 parent c66de7c commit aaddf38

File tree

3 files changed

+57
-3
lines changed

3 files changed

+57
-3
lines changed

Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# $Id: Makefile,v 1.8 2012/04/27 04:27:36 demon Exp $
1+
# $Id: Makefile,v 1.9 2012/05/09 00:03:40 demon Exp $
22

33
PROG= dcpu
4-
SRCS= gramar.y lexer.l emu.c main.c tui.c gui.c y.tab.h
4+
SRCS= gramar.y lexer.l emu.c main.c tui.c gui.c y.tab.h \
5+
lem1802.c keyboard.c clock.c
56
NOMAN=
67
CFLAGS+=`sdl-config --cflags`
78
LDADD+= `sdl-config --libs` -lcurses -lSDL_image

clock.c

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* $Id: clock.c,v 1.1 2012/05/09 00:03:40 demon Exp $ */
2+
/*
3+
* Copyright (c) 2012 Dimitri Sokolyuk <[email protected]>
4+
*
5+
* Permission to use, copy, modify, and distribute this software for any
6+
* purpose with or without fee is hereby granted, provided that the above
7+
* copyright notice and this permission notice appear in all copies.
8+
*
9+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
* WHATSOEVER RESULTING FROM LOSS OF USE, dATA OR PROFITS, WHETHER IN AN
14+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16+
*/
17+
18+
#include <stdio.h>
19+
#include "dcpu16.h"
20+
21+
enum { CLK_ON,
22+
CLK_STORE,
23+
CLK_INTR,
24+
};
25+
26+
void
27+
clk(struct context *c)
28+
{
29+
switch (c->reg[A]) {
30+
case CLK_ON:
31+
break;
32+
case CLK_STORE:
33+
break;
34+
case CLK_INTR:
35+
break;
36+
default:
37+
break;
38+
}
39+
}
40+
41+
void
42+
register_clk(struct context *c)
43+
{
44+
struct device *d = &c->dev[++c->ndev];
45+
46+
d->id = 0x12d0b402;
47+
d->version = 0x1;
48+
d->manu = 0;
49+
d->cb = clk;
50+
}

dcpu16.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: dcpu16.h,v 1.15 2012/05/09 00:03:40 demon Exp $ */
1+
/* $Id: dcpu16.h,v 1.16 2012/05/09 00:04:17 demon Exp $ */
22
/*
33
* Copyright (c) 2012 Dimitri Sokolyuk <[email protected]>
44
*
@@ -63,5 +63,8 @@ int step(struct context *);
6363
void tuiemu(struct context *);
6464
void guiemu(struct context *);
6565
void dumpcode(struct context *);
66+
void register_lem(struct context *);
67+
void register_keyb(struct context *);
68+
void register_clk(struct context *);
6669

6770
#endif

0 commit comments

Comments
 (0)