1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-11 11:30:13 +00:00

cleanup and document CHARGEN_RELOC change

This commit is contained in:
Christian Groessler 2013-09-20 00:10:34 +02:00
parent fe75788015
commit 37ed72bc89

View File

@ -3,6 +3,19 @@
; ;
; Christian Groessler, chris@groessler.org, 19-Sep-2013 ; Christian Groessler, chris@groessler.org, 19-Sep-2013
; ;
;
; Defines which modify the operation of the macros:
;
; CHARGEN_RELOC: If defined, CHBAS and CHBASE are updated when
; enabling or disabling the ROM.
; If the ROM is enabled, $E0 is written to CHBAS
; and CHBASE.
; If the ROM is disabled, the upper byte of
; __CHARGEN_START__ is written to CHBAS and CHBASE.
; USEWSYNC: If defined, the code waits for horizontal retrace
; before switching the ROM and updating CHBAS and
; CHBASE. This define only has effect if CHAGEN_RELOC
; is also defined.
.ifdef __ATARIXL__ .ifdef __ATARIXL__
@ -10,68 +23,76 @@
USEWSYNC = 1 USEWSYNC = 1
CHARGEN_RELOC = 1 CHARGEN_RELOC = 1
.ifdef CHARGEN_RELOC
.macro set_chbase val
lda #val
sta CHBAS
sta CHBASE
.endmacro
.else
.macro set_chbase val
.endmacro
.endif ; .ifdef CHARGEN_RELOC
.if .defined(USEWSYNC) .and .defined(CHARGEN_RELOC) .if .defined(USEWSYNC) .and .defined(CHARGEN_RELOC)
.macro wsync .macro wsync
sta WSYNC sta WSYNC
.endmacro .endmacro
.else
.else ; above
.macro wsync .macro wsync
.endmacro .endmacro
.endif .endif
; "disable ROM" macros
.macro disable_rom .macro disable_rom
lda PORTB lda PORTB
and #$fe and #$fe
wsync wsync
sta PORTB sta PORTB
.ifdef CHARGEN_RELOC set_chbase >__CHARGEN_START__
lda #>__CHARGEN_START__
sta CHBAS
sta CHBASE
.endif
.endmacro .endmacro
.macro disable_rom_quick .macro disable_rom_quick
lda PORTB lda PORTB
and #$fe and #$fe
sta PORTB sta PORTB
.ifdef CHARGEN_RELOC set_chbase >__CHARGEN_START__
lda #>__CHARGEN_START__
sta CHBAS
sta CHBASE
.endif
.endmacro .endmacro
.macro disable_rom_val val .macro disable_rom_val val
lda val lda val
wsync wsync
sta PORTB sta PORTB
.ifdef CHARGEN_RELOC set_chbase >__CHARGEN_START__
lda #>__CHARGEN_START__
sta CHBAS
sta CHBASE
.endif
.endmacro .endmacro
; "enable ROM" macros
.macro enable_rom .macro enable_rom
lda PORTB lda PORTB
ora #1 ora #1
wsync wsync
sta PORTB sta PORTB
.ifdef CHARGEN_RELOC set_chbase $E0
lda #$E0
sta CHBAS
sta CHBASE
.endif
.endmacro .endmacro
.macro enable_rom_quick .macro enable_rom_quick
lda PORTB lda PORTB
ora #1 ora #1
sta PORTB sta PORTB
.ifdef CHARGEN_RELOC set_chbase $E0
lda #$E0
sta CHBAS
sta CHBASE
.endif
.endmacro .endmacro
.else ; above __ATARIXL__, below not .else ; above __ATARIXL__, below not