; Macros shared by the suite's tests (included before them). ; ; GO_FAST / GO_SLOW: timed code runs from the FastROM mirror (bank $80, ; MEMSEL = 1), as undisbeliever's tests do; GO_SLOW comes back to bank $00. ; DP4200 / DP0: D for `z:` access to $42xx. NOPS k: k NOPs (12 master clocks ; each in FastROM). DELAY n: n master clocks of FastROM code from nop (12), ; rep #0 (18), bit a:$0000 (26, WRAM), sta f:WRAM (32), sty a:WRAM (34, ; 16-bit index). AJ_SCRATCH = $1E80 ; WRAM byte the DELAY stores hit .macro GO_FAST .local next lda #$01 sta MEMSEL .byte $5C ; jml to the FastROM mirror of the next line .faraddr next + $800000 next: .endmacro .macro GO_SLOW .local next .byte $5C ; jml back to bank $00 .faraddr next next: stz MEMSEL .endmacro .macro DP4200 pea $4200 pld .endmacro .macro DP0 pea $0000 pld .endmacro .macro NOPS k .repeat k nop .endrepeat .endmacro ; n master clocks of FastROM code, n even, 0 or >= 12 (52 when n mod 12 = 4). .macro DELAY n .if (n) = 0 .elseif (n) .mod 12 = 0 NOPS (n) / 12 .elseif (n) .mod 12 = 6 rep #$00 NOPS ((n) - 18) / 12 .elseif (n) .mod 12 = 2 bit a:$0000 NOPS ((n) - 26) / 12 .elseif (n) .mod 12 = 8 sta f:$7E0000 + AJ_SCRATCH NOPS ((n) - 32) / 12 .elseif (n) .mod 12 = 10 sty a:AJ_SCRATCH NOPS ((n) - 34) / 12 .else .assert (n) >= 52, error, "DELAY: n mod 12 = 4 needs n >= 52" bit a:$0000 bit a:$0000 NOPS ((n) - 52) / 12 .endif .endmacro