]> git.sur5r.net Git - cc65/commitdiff
move macros to enable and disable the ROM into a separate include file
authorChristian Groessler <chris@groessler.org>
Thu, 19 Sep 2013 21:21:09 +0000 (23:21 +0200)
committerChristian Groessler <chris@groessler.org>
Thu, 19 Sep 2013 21:21:09 +0000 (23:21 +0200)
libsrc/atari/crt0.s
libsrc/atari/ostype.s
libsrc/atari/romswitch.inc [new file with mode: 0644]
libsrc/atari/shadow_ram_handlers.s

index f2843980217d203da85b6ec43d8423f0f3b7eb6d..f1cadd9920e64c894fa9b13eeb70e27d4db6ea3f 100644 (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
index 4fbeaaf7099befbeb56930c953eafe5b1849dda1..d2bf8888eecb8e5fdf31c3d548340eef37d50bfc 100644 (file)
 
         .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
         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
diff --git a/libsrc/atari/romswitch.inc b/libsrc/atari/romswitch.inc
new file mode 100644 (file)
index 0000000..58e0904
--- /dev/null
@@ -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
index 9714644adbce2c6242268260f3d4f9a89d24eb27..ddc7b0842223e3be601aec901b3197deaff781e4 100644 (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