GSCats/macros.s

173 lines
1.7 KiB
ArmAsm
Raw Normal View History

2017-07-29 21:47:17 +00:00
.macro OP8
.i8
.a8
.endmacro
.macro OP16
.i16
.a16
.endmacro
.macro BITS8
sep #%00110000
OP8
.endmacro
.macro BITS16
rep #%00110000
OP16
.endmacro
.macro DBR bankNum
BITS8
lda bankNum
pha
plb
BITS16
.endmacro
.macro SYNCDBR
phk
plb
.endmacro
2017-07-28 22:11:25 +00:00
.macro EMULATION
sec ; Enable 8-bit mode
xce
2017-07-29 21:47:17 +00:00
OP8
2017-07-28 22:11:25 +00:00
.endmacro
.macro NATIVE
clc ; Enable 16-bit mode
xce
2017-07-29 21:47:17 +00:00
BITS16
2017-07-28 22:11:25 +00:00
.endmacro
2017-07-29 21:47:17 +00:00
2017-07-28 22:11:25 +00:00
.macro SHRVIDEO
2017-07-29 21:47:17 +00:00
BITS8
2017-07-28 22:11:25 +00:00
lda NEWVIDEO
ora #%11000001
sta NEWVIDEO
2017-07-29 21:47:17 +00:00
BITS16
2017-07-28 22:11:25 +00:00
.endmacro
2017-07-29 21:47:17 +00:00
2017-07-28 22:11:25 +00:00
.macro CLASSICVIDEO
2017-07-29 21:47:17 +00:00
BITS8
2017-07-28 22:11:25 +00:00
lda NEWVIDEO
and #%00111111
sta NEWVIDEO
2017-07-29 21:47:17 +00:00
BITS16
.endmacro
.macro FASTGRAPHICS
sei
sep #%00100000 ; 16-bit A only, to preserve X/Y
.a8
lda SHADOW
sta shadowRegister
lda #0
sta SHADOW
lda STACKCTL
sta stackRegister
ora #$30
sta STACKCTL
rep #%00100000
2017-07-28 22:11:25 +00:00
.a16
2017-07-29 21:47:17 +00:00
tsc
sta stackPtr
2017-07-28 22:11:25 +00:00
.endmacro
2017-07-29 21:47:17 +00:00
.macro SLOWGRAPHICS
sep #%00100000 ; 16-bit A only, to preserve X/Y
.a8
lda shadowRegister
sta SHADOW
lda stackRegister
sta STACKCTL
rep #%00100000
.a16
lda stackPtr
tcs
cli
.endmacro
2017-07-28 22:11:25 +00:00
.macro LOADPARAM24 bankNumDoubled,addr16
lda #bankNumDoubled
sta PARAM24+1
lda #addr16
sta PARAM24
.endmacro
2017-07-28 22:11:25 +00:00
;;;;;;;;;;
; Stack Macros
.macro SAVE_AXY ; Saves all registers
pha
phx
phy
.endmacro
.macro RESTORE_AXY ; Restores all registers
ply
plx
pla
.endmacro
.macro SAVE_AY ; Saves accumulator and Y index
pha
phy
.endmacro
.macro RESTORE_AY ; Restores accumulator and Y index
ply
pla
.endmacro
.macro SAVE_AX ; Saves accumulator and X index
pha
phx
.endmacro
.macro RESTORE_AX ; Restores accumulator and X index
plx
pla
.endmacro
.macro SAVE_XY ; Saves X and Y index
phx
phy
.endmacro
.macro RESTORE_XY ; Restores X and Y index
ply
plx
.endmacro