diff options
author | Juan J. MartÃnez <jjm@usebox.net> | 2022-09-16 11:08:35 +0000 |
---|---|---|
committer | Juan J. MartÃnez <jjm@usebox.net> | 2022-09-16 11:08:35 +0000 |
commit | de06bed752f82eb5fad659f9945261fbff185241 (patch) | |
tree | 23d7fdb24453a3a1378f81d021567616492bbdbd /game/src/crt0.z80 | |
parent | 290c74b70661bcde314f73fde2be888e5aed47e0 (diff) | |
parent | 1ef0d697a62eff28115d6642c850ba4d01ef6a89 (diff) | |
download | ubox-msx-lib-de06bed752f82eb5fad659f9945261fbff185241.tar.gz ubox-msx-lib-de06bed752f82eb5fad659f9945261fbff185241.zip |
Merge branch 'cas-support' into 'main'
Added CAS support to the example game
See merge request reidrac/ubox-msx-lib!32
Diffstat (limited to 'game/src/crt0.z80')
-rw-r--r-- | game/src/crt0.z80 | 115 |
1 files changed, 60 insertions, 55 deletions
diff --git a/game/src/crt0.z80 b/game/src/crt0.z80 index 81763d0..c8bd167 100644 --- a/game/src/crt0.z80 +++ b/game/src/crt0.z80 @@ -1,82 +1,87 @@ .module crt0 -.globl _main -.area _HOME -.area _CODE -.area _INITIALIZER +.globl _main + +.area _HOME +.area _CODE +.area _INITIALIZER .area _GSINIT .area _GSFINAL -.area _DATA -.area _INITIALIZED -.area _BSEG +.area _DATA +.area _INITIALIZED +.area _BSEG .area _BSS .area _HEAP -.area _CODE - ENASLT = 0x0024 RSLREG = 0x0138 CLIKSW = 0xf3db - ; ROM header - .str "AB" - .dw _main_init - .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +.area _CODE + ; ROM header + .str "AB" + .dw _main_init + .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + ; entry point skipping the init code that is used + ; when starting from cassette + jp _cas_main _main_init:: - ; init the stack - di - ld sp, #0xf380 - ei + ; init the stack + di + ld sp, #0xf380 + ei - ; setup memory - ; ref: https://www.msx.org/forum/msx-talk/development/memory-pages-again + ; setup memory + ; ref: https://www.msx.org/forum/msx-talk/development/memory-pages-again - call RSLREG - rrca - rrca - and #3 - ld c, a - add a, #0xc1 - ld l, a - ld h, #0xfc - ld a, (hl) - and #0x80 - or c - ld c, a - inc l - inc l - inc l - inc l - ld a, (hl) - and #0x0c - or c - ld h, #0x80 - call ENASLT + call RSLREG + rrca + rrca + and #3 + ld c, a + add a, #0xc1 + ld l, a + ld h, #0xfc + ld a, (hl) + and #0x80 + or c + ld c, a + inc l + inc l + inc l + inc l + ld a, (hl) + and #0x0c + or c + ld h, #0x80 + call ENASLT - ; disable key click sound - xor a - ld (CLIKSW), a +_cas_main:: + ; disable key click sound + xor a + ld (CLIKSW), a - call gsinit - call _main + call gsinit + call _main halt0: - halt - jr halt0 + halt + jr halt0 .area _GSINIT gsinit:: - ld bc, #l__INITIALIZER - ld a, b - or a, c - jr Z, gsinit_next - ld de, #s__INITIALIZED - ld hl, #s__INITIALIZER - ldir + ld bc, #l__INITIALIZER + ld a, b + or a, c + jr Z, gsinit_next + ld de, #s__INITIALIZED + ld hl, #s__INITIALIZER + ldir gsinit_next: .area _GSFINAL - ret + ret |