1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 12:08:07 +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 call USER_CODE
; signal the emulator we're done ; signal the emulator we're done
; BC contains the number of written bytes ; BC contains the number of written bytes
ld a, b ld a, c
ld c, b
out (c), a out (c), a
halt 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) 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; running = 0;
} }