From: Christian Groessler Date: Wed, 11 Sep 2013 21:59:24 +0000 (+0200) Subject: Reduce flicker by waiting for horizontal retrace before switching ROM and X-Git-Tag: V2.15~223^2~35 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5a1dcbbe4c1b32eb42db7c622747954582a4ee0c;p=cc65 Reduce flicker by waiting for horizontal retrace before switching ROM and CHARGEN. Can be disabled by setting USEWSYNC to 0. --- diff --git a/libsrc/atari/shadow_ram_handlers.s b/libsrc/atari/shadow_ram_handlers.s index adf9085b1..e9b682cf1 100644 --- a/libsrc/atari/shadow_ram_handlers.s +++ b/libsrc/atari/shadow_ram_handlers.s @@ -5,6 +5,7 @@ ; DEBUG = 1 +USEWSYNC= 1 CHKBUF = 1 ; check if bounce buffering is needed (bounce buffering is always done if set to 0) .if .defined(__ATARIXL__) @@ -24,7 +25,22 @@ CHKBUF = 1 ; check if bounce buffering is needed (bounce buffering is always don BUFSZ = 128 ; bounce buffer size BUFSZ_SIO = 256 +.macro wsync +.if USEWSYNC + sta WSYNC +.endif +.endmacro + .macro disable_rom + lda PORTB + and #$fe + wsync + sta PORTB + lda #>__CHARGEN_START__ + sta CHBAS + sta CHBASE +.endmacro +.macro disable_rom_quick lda PORTB and #$fe sta PORTB @@ -32,7 +48,25 @@ BUFSZ_SIO = 256 sta CHBAS sta CHBASE .endmacro +.macro disable_rom_val val + lda val + wsync + sta PORTB + lda #>__CHARGEN_START__ + sta CHBAS + sta CHBASE +.endmacro + .macro enable_rom + lda PORTB + ora #1 + wsync + sta PORTB + lda #$E0 + sta CHBAS + sta CHBASE +.endmacro +.macro enable_rom_quick lda PORTB ora #1 sta PORTB @@ -48,9 +82,9 @@ BUFSZ_SIO = 256 sram_init: ; disable all interrupts - sei ldx #0 stx NMIEN ; disable NMI + sei ; disable ROMs disable_rom @@ -72,9 +106,9 @@ sram_init: sta $fffb ; enable interrupts + cli lda #$40 sta NMIEN - cli rts @@ -104,14 +138,14 @@ bounce_buffer: .res BUFSZ_SIO .macro int_wrap orgvec .local ret pha - enable_rom + enable_rom_quick lda #>ret pha lda #