2019-05-28 01:52:00 +00:00
|
|
|
|
2019-05-29 01:05:19 +00:00
|
|
|
.include "astrocade.inc"
|
2019-05-28 01:52:00 +00:00
|
|
|
|
|
|
|
;;; C functions
|
|
|
|
|
2019-06-03 14:08:29 +00:00
|
|
|
.area _CODE_ACBIOS
|
2019-05-28 01:52:00 +00:00
|
|
|
|
|
|
|
; activate interrupts
|
|
|
|
.globl _activate_interrupts
|
|
|
|
_activate_interrupts:
|
|
|
|
SYSTEM ACTINT
|
|
|
|
; set INMOD
|
|
|
|
ld a,#0x8
|
|
|
|
out (INMOD),a
|
|
|
|
ret
|
|
|
|
|
|
|
|
; wait for next interrupt
|
2019-05-29 01:05:19 +00:00
|
|
|
.globl _sleep
|
|
|
|
_sleep:
|
|
|
|
ld b,l
|
|
|
|
SYSTEM PAWS
|
|
|
|
ret
|
|
|
|
|
2019-06-02 02:09:45 +00:00
|
|
|
.globl _fast_vsync
|
|
|
|
_fast_vsync:
|
|
|
|
ld hl,#TMR60
|
|
|
|
ld c,(hl)
|
|
|
|
.lvsync:
|
|
|
|
ld a,(hl)
|
|
|
|
sub c
|
|
|
|
jp z,.lvsync
|
|
|
|
ret
|
|
|
|
|
2019-05-29 01:05:19 +00:00
|
|
|
; load 5 bytes from stack into registers
|
|
|
|
load5_edca_hl:
|
|
|
|
ld ix,#4
|
|
|
|
add ix,sp
|
|
|
|
ld e,0(ix) ; x
|
|
|
|
ld d,1(ix) ; y
|
|
|
|
ld c,2(ix) ; options
|
|
|
|
ld b,c
|
|
|
|
ld a,c
|
|
|
|
ld l,3(ix) ; addr lo
|
|
|
|
ld h,4(ix) ; addr hi
|
|
|
|
ret
|
2019-05-28 01:52:00 +00:00
|
|
|
|
2019-05-29 01:05:19 +00:00
|
|
|
; STRDIR x y options string-addr
|
2019-05-29 00:50:06 +00:00
|
|
|
.globl _display_string
|
|
|
|
_display_string:
|
2019-05-29 01:05:19 +00:00
|
|
|
call load5_edca_hl
|
2019-05-28 01:52:00 +00:00
|
|
|
ld ix,#0x20d ; alternate font desc.
|
2019-05-29 01:05:19 +00:00
|
|
|
SYSTEM STRDIS
|
|
|
|
ret
|
2019-05-29 00:50:06 +00:00
|
|
|
|
2019-05-28 01:52:00 +00:00
|
|
|
; RECTAN x y w h colormask
|
2019-05-29 00:50:06 +00:00
|
|
|
.globl _paint_rectangle
|
|
|
|
_paint_rectangle:
|
2019-05-29 01:05:19 +00:00
|
|
|
call load5_edca_hl
|
|
|
|
ld b,l
|
2019-06-08 16:01:22 +00:00
|
|
|
ld a,h
|
2019-05-29 01:05:19 +00:00
|
|
|
SYSTEM RECTAN
|
|
|
|
ret
|
2019-05-28 01:52:00 +00:00
|
|
|
|
2019-05-29 01:05:19 +00:00
|
|
|
; WRITR x y magic pattern-addr
|
2019-05-29 00:50:06 +00:00
|
|
|
.globl _write_relative
|
|
|
|
_write_relative:
|
2019-05-29 01:05:19 +00:00
|
|
|
call load5_edca_hl
|
|
|
|
SYSTEM WRITR
|
|
|
|
ret
|
|
|
|
|
|
|
|
; WRITP x y magic pattern-addr
|
|
|
|
.globl _write_pattern
|
|
|
|
_write_pattern:
|
|
|
|
call load5_edca_hl
|
|
|
|
SYSTEM WRITP
|
|
|
|
ret
|
|
|
|
|
|
|
|
; DISNUM x y options number-addr
|
|
|
|
.globl _display_bcd_number
|
|
|
|
_display_bcd_number:
|
|
|
|
call load5_edca_hl
|
|
|
|
ld b,5(ix) ; addr hi
|
|
|
|
ld ix,#0x20d ; alternate font desc.
|
|
|
|
SYSTEM DISNUM
|
|
|
|
ret
|
|
|
|
|
|
|
|
; BCDADD arg1 size arg2
|
|
|
|
.globl _bcdn_add
|
|
|
|
_bcdn_add:
|
|
|
|
call load5_edca_hl
|
|
|
|
ld b,c
|
|
|
|
SYSTEM BCDADD
|
|
|
|
ret
|
|
|
|
|
2019-05-31 22:15:30 +00:00
|
|
|
; RANGED n
|
|
|
|
.globl _ranged_random
|
|
|
|
_ranged_random:
|
|
|
|
ld a,l
|
|
|
|
SYSTEM RANGED
|
2019-05-29 01:05:19 +00:00
|
|
|
ret
|
|
|
|
|
2019-06-03 14:08:29 +00:00
|
|
|
; KCTASC n
|
|
|
|
.globl _keycode_to_ascii
|
|
|
|
_keycode_to_ascii:
|
|
|
|
ld a,l
|
|
|
|
SYSTEM KCTASC
|
|
|
|
ret
|
|
|
|
|
2019-05-29 01:05:19 +00:00
|
|
|
; BLANK w h data video-addr
|
|
|
|
.globl _blank_area
|
|
|
|
_blank_area:
|
|
|
|
call load5_edca_hl
|
|
|
|
SYSTEM BLANK
|
|
|
|
ret
|
2019-05-28 01:52:00 +00:00
|
|
|
|
2019-06-02 02:09:45 +00:00
|
|
|
; SENTRY mask-addr
|
|
|
|
.globl _sense_transition
|
|
|
|
_sense_transition:
|
|
|
|
ld l,e
|
|
|
|
ld h,d
|
|
|
|
SYSTEM SENTRY
|
|
|
|
ld l,a
|
|
|
|
ld h,b
|
|
|
|
ret
|
|
|
|
|
2019-06-03 14:08:29 +00:00
|
|
|
; DOIT table-addr
|
|
|
|
.globl _respond_to_input
|
|
|
|
_respond_to_input:
|
|
|
|
call load5_edca_hl
|
|
|
|
SYSTEM DOIT
|
|
|
|
ret
|
|
|
|
|
|
|
|
; DOITB table-addr
|
|
|
|
.globl _respond_to_input_b
|
|
|
|
_respond_to_input_b:
|
|
|
|
call load5_edca_hl
|
|
|
|
SYSTEM DOIT
|
|
|
|
ret
|
|
|
|
|
2019-06-02 02:09:45 +00:00
|
|
|
; BMUSIC stack-addr voices score-addr
|
|
|
|
.globl _begin_music
|
|
|
|
_begin_music:
|
|
|
|
call load5_edca_hl
|
|
|
|
push de
|
|
|
|
pop ix
|
|
|
|
SYSTEM BMUSIC
|
|
|
|
ret
|
|
|
|
|