collapseos/tools/emul/zasm_glue.asm

42 lines
522 B
NASM
Raw Normal View History

2019-05-10 04:09:40 +10:00
; Glue code for the emulated environment
.equ USER_CODE 0x4000
.equ RAMEND 0xffff
.equ STDIO_PORT 0x00
jr init ; 2 bytes
; *** JUMP TABLE ***
jp strncmp
jp addDE
2019-05-10 11:21:08 +10:00
jp addHL
2019-05-10 04:09:40 +10:00
jp upcase
jp unsetZ
jp intoDE
2019-05-10 11:21:08 +10:00
jp findchar
2019-05-10 12:14:11 +10:00
jp parseHexPair
2019-05-10 04:09:40 +10:00
init:
di
ld hl, RAMEND
ld sp, hl
ld hl, emulGetC
ld de, emulPutC
2019-05-10 04:09:40 +10:00
call USER_CODE
; signal the emulator we're done
halt
emulGetC:
in a, (STDIO_PORT)
or a ; cp 0
jr z, .eof
cp a ; ensure z
ret
.eof:
call unsetZ
ret
emulPutC:
out (STDIO_PORT), a
ret
2019-05-10 04:09:40 +10:00
#include "core.asm"