aboutsummaryrefslogtreecommitdiff
path: root/emu.c
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2012-05-09 00:04:17 +0000
committerDimitri Sokolyuk <demon@dim13.org>2012-05-09 00:04:17 +0000
commitd94d595fd7c7817dae2887285a3c3d47fba6a765 (patch)
tree87b0255579990af689ab8199b18a528f186c8f39 /emu.c
parent11129399de73cd03a914ee7ddc2dd641feb83f21 (diff)
devices stub
Diffstat (limited to 'emu.c')
-rw-r--r--emu.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/emu.c b/emu.c
index 1f1df17..c1e29e1 100644
--- a/emu.c
+++ b/emu.c
@@ -94,20 +94,36 @@ void
hwn(struct context *c, unsigned short *a)
{
/* TODO */
+ *a = c->ndev;
cycle += 2;
}
void
hwq(struct context *c, unsigned short *a)
{
- /* TODO */
+ struct device *d = &c->dev[*a];
+
+ c->reg[A] = d->id;
+ c->reg[B] = d->id >> 16;
+ c->reg[C] = d->version;
+ c->reg[X] = d->manu;
+ c->reg[Y] = d->manu >> 16;
+
cycle += 4;
}
void
hwi(struct context *c, unsigned short *a)
{
- /* TODO */
+ struct device *d = &c->dev[*a];
+
+ if (d->cb) {
+ d->cb(c);
+ } else {
+ warnx("invalid device %d", *a);
+ errors++;
+ }
+
cycle += 4;
}