2017-07-29 21:47:17 +00:00
|
|
|
.macro OP8
|
|
|
|
.i8
|
|
|
|
.a8
|
|
|
|
.endmacro
|
|
|
|
|
|
|
|
|
|
|
|
.macro OP16
|
|
|
|
.i16
|
|
|
|
.a16
|
|
|
|
.endmacro
|
|
|
|
|
|
|
|
|
2017-10-08 23:46:35 +00:00
|
|
|
.macro BITS8A
|
|
|
|
sep #%00100000
|
|
|
|
.a8
|
|
|
|
.endmacro
|
|
|
|
|
|
|
|
|
2017-07-29 21:47:17 +00:00
|
|
|
.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
|
|
|
|
|
|
|
|
|
2017-10-06 19:28:18 +00:00
|
|
|
.macro SHADOWMEMORY
|
2017-09-30 00:53:05 +00:00
|
|
|
sep #%00100000 ; 3 16-bit A only, to preserve X/Y
|
2017-07-29 21:47:17 +00:00
|
|
|
.a8
|
2017-09-30 00:53:05 +00:00
|
|
|
lda SHADOW ;5
|
2017-10-01 22:40:29 +00:00
|
|
|
sta SHADOWREGISTER ;4
|
2017-09-30 00:53:05 +00:00
|
|
|
lda #0 ;2
|
|
|
|
sta SHADOW ;5
|
2017-10-06 19:28:18 +00:00
|
|
|
rep #%00100000 ;3
|
|
|
|
.a16
|
|
|
|
.endmacro
|
|
|
|
|
|
|
|
|
|
|
|
.macro NORMALMEMORY
|
|
|
|
sep #%00100000 ; 3 16-bit A only, to preserve X/Y
|
|
|
|
.a8
|
|
|
|
lda SHADOWREGISTER ;4
|
|
|
|
sta SHADOW ;5
|
|
|
|
rep #%00100000 ;3
|
|
|
|
.a16
|
|
|
|
.endmacro
|
|
|
|
|
|
|
|
|
|
|
|
.macro FASTGRAPHICS ;34 cycles, 12 bytes
|
|
|
|
sei ;2
|
|
|
|
phd ;4
|
|
|
|
sep #%00100000 ; 3 16-bit A only, to preserve X/Y
|
|
|
|
.a8
|
2017-07-29 21:47:17 +00:00
|
|
|
|
2017-09-30 00:53:05 +00:00
|
|
|
lda STACKCTL ;5
|
2017-10-01 22:40:29 +00:00
|
|
|
sta STACKREGISTER ;4
|
2017-09-30 00:53:05 +00:00
|
|
|
ora #$30 ;2
|
|
|
|
sta STACKCTL ;5
|
2017-07-29 21:47:17 +00:00
|
|
|
|
2017-09-30 00:53:05 +00:00
|
|
|
rep #%00100000 ;3
|
2017-07-28 22:11:25 +00:00
|
|
|
.a16
|
2017-09-30 00:53:05 +00:00
|
|
|
tsc ;2
|
2017-10-01 22:40:29 +00:00
|
|
|
sta STACKPTR ;4
|
2017-07-28 22:11:25 +00:00
|
|
|
.endmacro
|
|
|
|
|
|
|
|
|
2017-10-06 19:28:18 +00:00
|
|
|
.macro SLOWGRAPHICS ;28 cycles, 12 bytes
|
2017-09-30 00:53:05 +00:00
|
|
|
sep #%00100000 ; 3 16-bit A only, to preserve X/Y
|
2017-07-29 21:47:17 +00:00
|
|
|
.a8
|
|
|
|
|
2017-10-01 22:40:29 +00:00
|
|
|
lda STACKREGISTER ;4
|
2017-09-30 00:53:05 +00:00
|
|
|
sta STACKCTL ;5
|
2017-07-29 21:47:17 +00:00
|
|
|
|
2017-09-30 00:53:05 +00:00
|
|
|
rep #%00100000 ;3
|
2017-07-29 21:47:17 +00:00
|
|
|
.a16
|
2017-10-01 22:40:29 +00:00
|
|
|
lda STACKPTR ;4
|
2017-09-30 00:53:05 +00:00
|
|
|
tcs ;2
|
|
|
|
pld ;5
|
|
|
|
cli ;2
|
2017-07-29 21:47:17 +00:00
|
|
|
.endmacro
|
|
|
|
|
2017-07-28 22:11:25 +00:00
|
|
|
|
2017-07-30 18:54:37 +00:00
|
|
|
.macro LOADPARAM24 bankNumDoubled,addr16
|
|
|
|
lda #bankNumDoubled
|
|
|
|
sta PARAM24+1
|
|
|
|
lda #addr16
|
|
|
|
sta PARAM24
|
|
|
|
.endmacro
|
2017-07-28 22:11:25 +00:00
|
|
|
|
2017-08-10 02:33:52 +00:00
|
|
|
|
2017-08-13 21:54:18 +00:00
|
|
|
.macro pstring Arg
|
|
|
|
.byte .strlen(Arg), Arg
|
|
|
|
.endmacro
|
|
|
|
|
|
|
|
|
|
|
|
.macro qbyte Arg
|
|
|
|
.dbyt Arg>>16,Arg&$0000ffff
|
|
|
|
.endmacro
|
|
|
|
|
2017-10-23 19:40:44 +00:00
|
|
|
.macro qbytei Arg
|
|
|
|
.dbyt ~(Arg>>16),~(Arg&$0000ffff)
|
|
|
|
.endmacro
|
|
|
|
|
|
|
|
.macro qbyte7 Arg
|
|
|
|
.dbyt (Arg>>16)&$7777,Arg&$00007777
|
|
|
|
.endmacro
|
|
|
|
|
2017-08-31 19:55:02 +00:00
|
|
|
.macro BREAK
|
|
|
|
pha
|
|
|
|
lda breakpoint
|
|
|
|
beq nobrk
|
2017-09-30 00:53:05 +00:00
|
|
|
lda #1
|
|
|
|
sta $e1c029
|
2017-08-31 19:55:02 +00:00
|
|
|
pla
|
|
|
|
brk
|
|
|
|
nobrk:
|
|
|
|
pla
|
|
|
|
.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
|
|
|
|
|
2017-08-15 19:40:14 +00:00
|
|
|
|
|
|
|
.macro SAVE_P0 ; Saves PARAML0
|
|
|
|
lda PARAML0
|
|
|
|
pha
|
|
|
|
.endmacro
|
|
|
|
|
|
|
|
|
|
|
|
.macro RESTORE_P0 ; Restores PARAML0
|
|
|
|
pla
|
|
|
|
sta PARAML0
|
|
|
|
.endmacro
|