I used to know Z80-assembly and I thought well, after about 20 years I should be able to do it again. For fun. However, my brains have not aged well, it seems.
I managed to construct a tasks.json for VS Code which runs a cmd-file which compiles using Glass and then executes the resulting ROM-file using OpenMSX. So far, so good.
It even says "Hello world!" on screen. 
But then I want to go to MSX BASIC after a keypress. CHGET is easy enough. However, after a keypress the RET instruction starts the ROM again. A second keypress does result in MSX-BASIC.
Obviously, it's my fault. But I don't get it. It's not the CHGET, as replacing it by RET also runs the ROM twice.
; Hello world! for MSX
; MSX bios calls
CHPUT: equ 0A2H
CHGET: equ 09FH
CHGMOD: equ 05FH
org 4000H ; start at 4000H
ROM_PAGE: ds 4000H ; 16 kB
SECTION ROM_PAGE ; use full PAGE
db "AB" ; expansion ROM header
dw execute ; start of the init code, 0 if no initcode
dw 0 ; pointer to CALL statement handler, 0 if no such handler
dw 0 ; pointer to expansion device handler, 0 if no such handler
dw 0 ; pointer to the start of a tokenized basicprogram, 0 if no basicprogram
ds 6, 0 ; room reserved for future extensions
execute:
xor a ; A = 0
call CHGMOD ; Select screen mode 0
ld hl, text ; HL = Character Message Address
call print ; print text
call CHGET ; wait for keypress
ret ; return to MSX-BASIC
print:
ld a, (hl) ; A = Character
or a ; A |= A
ret z ; IF (Character == Zero) return
call CHPUT ; CALL System Routine To Display A Character To The Screen
inc hl ; Character Message Address++
jr print ; Continue Printing
text: db "Hello, World!", 13, 10, 0
ENDS
Aangemeld of registreer om reacties te plaatsen

