aboutsummaryrefslogtreecommitdiff
path: root/emu.c
diff options
context:
space:
mode:
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;
}