Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // by NataliaPC (@ishwin74)
- void basic_play(void *params) __naked __sdcccall(1)
- {
- params;
- __asm
- push hl ; Store the Param 'params'
- ld hl, #.play_call ; Copy routine to _heap_top
- ld de, (_heap_top) ; _heap_top must be >= 0x8000
- ld bc, #.play_call_end - .play_call
- ldir
- pop hl ; Copy the PLAY sentence from 'params'
- push de ; Store the start of PLAY sentence
- ld bc, #80 ; Max length of PLAY sentence
- ldir
- ld ix, (_heap_top)
- jp (ix)
- .play_call:
- pop hl ; Recover the start of PLAY sentence
- di ; Store current slot configuration
- in a,(0xa8)
- push af
- and #0b11110000 ; Set ROMs pagination
- ei
- out (0xa8),a // TODO: take care of subslots
- // TODO: hardcoded. Read (0x39AE) to get the PLAY address
- call 0x73e5 ; HL = parameters for PLAY as Asciiz
- .wait_loop:
- ld hl, #VCBA
- ld a, (hl)
- inc hl
- or (hl)
- ld hl, #VCBB
- or (hl)
- inc hl
- or (hl)
- ld hl, #VCBC
- or (hl)
- inc hl
- or (hl)
- jr nz, .wait_loop
- pop af
- di
- ei
- out (0xa8),a // TODO: take care of subslots
- ret
- .play_call_end:
- .play_sentence:
- __endasm;
- }
Advertisement
Add Comment
Please, Sign In to add comment