Gilbert Francois Duivesteijn
The picture above shows the final result on a real MSX, running from cartridge. Follow the steps below and you have it running yourself in minutes.
Step 1: Watch the tutorial from ChibiAkumas to know what the code is doing:
Lesson H3 - Hello World on the MSX by ChibiAkumas
Step 2: Type in the code below and save to a file named helloworld.asm
. Link to GitHub
x ; org statement before the header
org $4000
; ROM header
db "AB"
dw Main
dw 0, 0, 0, 0, 0, 0
RomSize equ $4000
CHPUT equ $00A2
CHMOD equ $005f
FileStart:
Main:
; set VDP to screen 0
ld a, 0
call CHMOD
; print "Hello world" on screen
ld hl, helloWorld
call PrintStr
call NewLn
call Finished
PrintStr:
ld a, (hl)
cp 0
ret z
inc hl
call CHPUT
jr PrintStr
NewLn:
push af
ld a, 13
call CHPUT
ld a, 10
call CHPUT
pop af
ret
Finished:
di
halt
helloWorld:
db "Hello world!", 0
FileEnd:
ds $4000 + RomSize - FileEnd, 255
Step 3: Compile
with VASM
xxxxxxxxxx
$ vasmz80_oldstyle helloworld.asm -chklabels -nocase -Dvasm=1 -Fbin -L out.sym -o out.rom
or with Glass (you can choose)
xxxxxxxxxx
$ java -jar Glass.jar helloworld.asm -L out.sym out.rom
Step 4: run with openMSX
xxxxxxxxxx
$ <path to>/openmsx -machine C-BIOS_MSX1_EU -cart out.rom
Step 5: connect with openMSX Debugger
Connect
sym
button and add the file out.sym
.System
-> Reboot Emulator
Step 6: Flash a cartridge, the MegaFlashROM and run your program on a MSX like a pro:
Copy the file out.rom to a microSD card
Insert the microSD card in the MegaFlashRom, start your MSX.
In the Nextor (MSX-DOS alike) prompt, type:
xxxxxxxxxx
B:> opfxsd out.rom
Reboot the computer and.... congratulations with your first self created ROM on cartridge!
arrow up
key. In the recovery mode, choose F1 - Erase MegaFlashROM
. Now it is ready for your next program.