1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-24 14:28:06 +11:00

zasm: invert emulator io_write() handling

This facilitates debugging. To know the value of `A` at any point,
you can do `out (0), a`. The number of bytes in the output will be the
value of `A`.
This commit is contained in:
Virgil Dupras 2019-04-17 10:34:30 -04:00
parent 9b556c8883
commit 279f6e0ad8
2 changed files with 3 additions and 2 deletions

View File

@ -18,7 +18,8 @@ init:
call USER_CODE
; signal the emulator we're done
; BC contains the number of written bytes
ld a, b
ld a, c
ld c, b
out (c), a
halt

View File

@ -32,7 +32,7 @@ static uint8_t io_read(int unused, uint16_t addr)
static void io_write(int unused, uint16_t addr, uint8_t val)
{
written = (val << 8) + (addr & 0xff);
written = ((addr & 0xff) << 8) + (val & 0xff);
running = 0;
}