1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-28 22:30:12 +00:00

move macros to enable and disable the ROM into a separate include file

This commit is contained in:
Christian Groessler 2013-09-19 23:21:09 +02:00
parent 47a6390753
commit 60e97f4d96
4 changed files with 97 additions and 85 deletions

View File

@ -222,7 +222,7 @@ _exit: jsr donelib ; Run module destructors
.bss
SP_save: .res 1
SHFLOK_save .res 1
SHFLOK_save: .res 1
LMARGN_save: .res 1
.ifndef __ATARIXL__
APPMHI_save: .res 2

View File

@ -40,40 +40,38 @@
.export _get_ostype
.include "atari.inc"
.include "romswitch.inc"
.ifdef __ATARIXL__
.include "atari.inc"
.import __CHARGEN_START__
.segment "LOWCODE"
.macro disable_rom
.macro disable_rom_save_a
pha
lda PORTB
and #$fe
sta PORTB
lda #>__CHARGEN_START__
sta CHBAS
sta CHBASE
pla
.endmacro
.macro enable_rom
lda PORTB
ora #1
sta PORTB
lda #$E0
sta CHBAS
sta CHBASE
disable_rom
pla
.endmacro
.else ; above atarixl, below atari
.macro disable_rom
.endmacro
.macro enable_rom
.macro disable_rom_save_a
.endmacro
.endif
.endif ; .ifdef __ATARIXL__
.proc _get_ostype
; unknown ROM
_unknown:
lda #0
tax
disable_rom_save_a
rts
_get_ostype:
enable_rom
lda $fcd8
@ -97,15 +95,7 @@
and #%00111000
ora #%11
_fin: ldx #0
disable_rom
rts
; unknown ROM
_unknown:
lda #0
tax
disable_rom
disable_rom_save_a
rts
; 1200XL ROM
@ -184,5 +174,3 @@ _400800_3:
lda #%00010001
bne _fin
.endproc

View File

@ -0,0 +1,73 @@
;
; Macros to disable and enable the ROM on Atari XL systems.
;
; Christian Groessler, chris@groessler.org, 19-Sep-2013
;
.ifdef __ATARIXL__
USEWSYNC= 1
.if USEWSYNC
.macro wsync
sta WSYNC
.endmacro
.else
.macro wsync
.endmacro
.endif
.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
lda #>__CHARGEN_START__
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
lda #$E0
sta CHBAS
sta CHBASE
.endmacro
.else ; above __ATARIXL__, below not
.macro disable_rom
.endmacro
.macro enable_rom
.endmacro
.endif

View File

@ -5,7 +5,6 @@
;
DEBUG = 1
USEWSYNC= 1
CHKBUF = 1 ; check if bounce buffering is needed (bounce buffering is always done if set to 0)
.ifdef __ATARIXL__
@ -14,6 +13,8 @@ CHKBUF = 1 ; check if bounce buffering is needed (bounce buffering is always don
.include "atari.inc"
.include "save_area.inc"
.include "zeropage.inc"
.include "romswitch.inc"
.import __CHARGEN_START__
.export sram_init
@ -25,56 +26,6 @@ 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
lda #>__CHARGEN_START__
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
lda #$E0
sta CHBAS
sta CHBASE
.endmacro
.segment "INIT"
; Turn off ROMs, install system and interrupt wrappers, set new chargen pointer