2019-05-09 14:09:40 -04: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
|
|
|
|
jp upcase
|
|
|
|
jp unsetZ
|
|
|
|
jp intoDE
|
|
|
|
|
|
|
|
init:
|
|
|
|
di
|
|
|
|
ld hl, RAMEND
|
|
|
|
ld sp, hl
|
2019-05-09 15:36:03 -04:00
|
|
|
ld hl, emulGetC
|
|
|
|
ld de, emulPutC
|
2019-05-09 14:09:40 -04:00
|
|
|
call USER_CODE
|
|
|
|
; signal the emulator we're done
|
|
|
|
halt
|
|
|
|
|
2019-05-09 15:36:03 -04:00
|
|
|
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-09 14:09:40 -04:00
|
|
|
#include "core.asm"
|