mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
Remove saving and restoring of zeropage variables.
Merge remote-tracking branch 'upstream/master' Conflicts: cfg/atarixl.cfg libsrc/atari/crt0.s
This commit is contained in:
commit
d3d7499faa
@ -19,7 +19,6 @@ SEGMENTS {
|
|||||||
CODE: load = RAM, type = ro, define = yes;
|
CODE: load = RAM, type = ro, define = yes;
|
||||||
RODATA: load = RAM, type = ro;
|
RODATA: load = RAM, type = ro;
|
||||||
DATA: load = RAM, type = rw;
|
DATA: load = RAM, type = rw;
|
||||||
ZPSAVE: load = RAM, type = bss, define = yes;
|
|
||||||
BSS: load = RAM, type = bss, define = yes;
|
BSS: load = RAM, type = bss, define = yes;
|
||||||
ZEROPAGE: load = ZP, type = zp;
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
EXTZP: load = ZP, type = zp, optional = yes;
|
EXTZP: load = ZP, type = zp, optional = yes;
|
||||||
|
@ -28,13 +28,11 @@ MEMORY {
|
|||||||
MAINHDR: file = %O, start = $0000, size = $0004;
|
MAINHDR: file = %O, start = $0000, size = $0004;
|
||||||
RAM: file = %O, define = yes, start = %S +
|
RAM: file = %O, define = yes, start = %S +
|
||||||
__SAVEAREA_SIZE__ +
|
__SAVEAREA_SIZE__ +
|
||||||
__LOWBUFS_SIZE__ +
|
__LOWBUFS_SIZE__, size = $D000 -
|
||||||
__ZPSAVE_SIZE__, size = $D000 -
|
|
||||||
__STACKSIZE__ -
|
__STACKSIZE__ -
|
||||||
%S -
|
%S -
|
||||||
__SAVEAREA_SIZE__ -
|
__SAVEAREA_SIZE__ -
|
||||||
__LOWBUFS_SIZE__ -
|
__LOWBUFS_SIZE__;
|
||||||
__ZPSAVE_SIZE__;
|
|
||||||
|
|
||||||
# address of relocated character generator
|
# address of relocated character generator
|
||||||
CHARGEN: file = "", define = yes, start = $D800, size = $0400;
|
CHARGEN: file = "", define = yes, start = $D800, size = $0400;
|
||||||
@ -55,7 +53,6 @@ SEGMENTS {
|
|||||||
SRPREPHDR: load = SRPREPHDR, type = ro;
|
SRPREPHDR: load = SRPREPHDR, type = ro;
|
||||||
SAVEAREA: load = SRPREP, type = bss, define = yes; # shared btw. SRPREP and RAM
|
SAVEAREA: load = SRPREP, type = bss, define = yes; # shared btw. SRPREP and RAM
|
||||||
LOWBUFS: load = SRPREP, type = bss, define = yes;
|
LOWBUFS: load = SRPREP, type = bss, define = yes;
|
||||||
ZPSAVE: load = SRPREP, type = bss, define = yes;
|
|
||||||
SRPREP: load = SRPREP, type = rw, define = yes;
|
SRPREP: load = SRPREP, type = rw, define = yes;
|
||||||
SHADOW_RAM: load = SRPREP, run = RAM_BELOW_ROM, type = rw, define = yes, optional = yes;
|
SHADOW_RAM: load = SRPREP, run = RAM_BELOW_ROM, type = rw, define = yes, optional = yes;
|
||||||
SRPREPTRL: load = SRPREPTRL, type = ro;
|
SRPREPTRL: load = SRPREPTRL, type = ro;
|
||||||
|
@ -13,19 +13,18 @@
|
|||||||
|
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import callmain, zerobss
|
.import callmain, zerobss
|
||||||
.import __STARTUP_LOAD__, __ZPSAVE_LOAD__, __BSS_LOAD__
|
.import __STARTUP_LOAD__, __BSS_LOAD__
|
||||||
.import __RESERVED_MEMORY__
|
.import __RESERVED_MEMORY__
|
||||||
.import __RAM_START__, __RAM_SIZE__
|
.import __RAM_START__, __RAM_SIZE__
|
||||||
.import zpsave
|
|
||||||
.import sram_init
|
|
||||||
.if .defined(__ATARIXL__)
|
.if .defined(__ATARIXL__)
|
||||||
.import scrdev
|
.import sram_init
|
||||||
.import findfreeiocb
|
.import scrdev
|
||||||
|
.import findfreeiocb
|
||||||
|
.include "save_area.inc"
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.include "save_area.inc"
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; EXE header
|
; EXE header
|
||||||
@ -35,15 +34,11 @@
|
|||||||
.word $FFFF
|
.word $FFFF
|
||||||
|
|
||||||
.if .defined(__ATARIXL__)
|
.if .defined(__ATARIXL__)
|
||||||
.segment "MAINHDR"
|
.segment "MAINHDR"
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.word __STARTUP_LOAD__
|
.word __STARTUP_LOAD__
|
||||||
.if .defined(__ATARIXL__)
|
|
||||||
.word __BSS_LOAD__ - 1
|
.word __BSS_LOAD__ - 1
|
||||||
.else
|
|
||||||
.word __ZPSAVE_LOAD__ - 1
|
|
||||||
.endif
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Actual code
|
; Actual code
|
||||||
@ -57,20 +52,8 @@
|
|||||||
|
|
||||||
; Real entry point:
|
; Real entry point:
|
||||||
|
|
||||||
.if .not .defined(__ATARIXL__) ; already done in previous load chunk
|
.if .defined(__ATARIXL__)
|
||||||
|
jsr sram_init
|
||||||
; Save the zero page locations we need
|
|
||||||
|
|
||||||
ldx #zpspace-1
|
|
||||||
L1: lda sp,x
|
|
||||||
sta zpsave,x
|
|
||||||
dex
|
|
||||||
bpl L1
|
|
||||||
|
|
||||||
.else
|
|
||||||
|
|
||||||
jsr sram_init
|
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
; Clear the BSS data
|
; Clear the BSS data
|
||||||
@ -87,9 +70,9 @@ L1: lda sp,x
|
|||||||
; Report memory usage
|
; Report memory usage
|
||||||
|
|
||||||
lda APPMHI
|
lda APPMHI
|
||||||
sta appmsav ; remember old APPMHI value
|
sta APPMHI_save ; remember old APPMHI value
|
||||||
lda APPMHI+1
|
lda APPMHI+1
|
||||||
sta appmsav+1
|
sta APPMHI_save+1
|
||||||
|
|
||||||
sec
|
sec
|
||||||
lda MEMTOP
|
lda MEMTOP
|
||||||
@ -103,10 +86,10 @@ L1: lda sp,x
|
|||||||
|
|
||||||
.else
|
.else
|
||||||
|
|
||||||
lda #<(__RAM_START__ + __RAM_SIZE__ - 1)
|
lda #<(__RAM_START__ + __RAM_SIZE__ - 1)
|
||||||
sta sp
|
sta sp
|
||||||
lda #>(__RAM_START__ + __RAM_SIZE__ - 1)
|
lda #>(__RAM_START__ + __RAM_SIZE__ - 1)
|
||||||
sta sp+1
|
sta sp+1
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
@ -155,36 +138,30 @@ _exit: jsr donelib ; Run module destructors
|
|||||||
lda old_shflok
|
lda old_shflok
|
||||||
sta SHFLOK
|
sta SHFLOK
|
||||||
|
|
||||||
.if .not .defined(__ATARIXL__)
|
|
||||||
|
|
||||||
; Restore APPMHI
|
; Restore APPMHI
|
||||||
|
|
||||||
lda appmsav
|
lda APPMHI_save
|
||||||
sta APPMHI
|
sta APPMHI
|
||||||
lda appmsav+1
|
lda APPMHI_save+1
|
||||||
sta APPMHI+1
|
sta APPMHI+1
|
||||||
|
|
||||||
.else
|
.if .defined(__ATARIXL__)
|
||||||
|
|
||||||
; Atari XL target stuff...
|
; Atari XL target stuff...
|
||||||
|
|
||||||
lda PORTB_save
|
lda PORTB_save
|
||||||
sta PORTB
|
sta PORTB
|
||||||
lda RAMTOP_save
|
lda RAMTOP_save
|
||||||
sta RAMTOP
|
sta RAMTOP
|
||||||
lda MEMTOP_save
|
lda MEMTOP_save
|
||||||
sta MEMTOP
|
sta MEMTOP
|
||||||
lda MEMTOP_save+1
|
lda MEMTOP_save+1
|
||||||
sta MEMTOP+1
|
sta MEMTOP+1
|
||||||
lda APPMHI_save
|
|
||||||
sta APPMHI
|
|
||||||
lda APPMHI_save+1
|
|
||||||
sta APPMHI+1
|
|
||||||
|
|
||||||
|
|
||||||
; ... issue a GRAPHICS 0 call (copied'n'pasted from TGI drivers)
|
; ... issue a GRAPHICS 0 call (copied'n'pasted from TGI drivers)
|
||||||
|
|
||||||
jsr findfreeiocb
|
jsr findfreeiocb
|
||||||
|
|
||||||
; Reopen it in Graphics 0
|
; Reopen it in Graphics 0
|
||||||
lda #OPEN
|
lda #OPEN
|
||||||
@ -209,18 +186,9 @@ _exit: jsr donelib ; Run module destructors
|
|||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
|
||||||
; Copy back the zero page stuff
|
|
||||||
|
|
||||||
ldx #zpspace-1
|
|
||||||
L2: lda zpsave,x
|
|
||||||
sta sp,x
|
|
||||||
dex
|
|
||||||
bpl L2
|
|
||||||
|
|
||||||
; Turn on cursor
|
; Turn on cursor
|
||||||
|
|
||||||
inx
|
ldx #0
|
||||||
stx CRSINH
|
stx CRSINH
|
||||||
|
|
||||||
; Back to DOS
|
; Back to DOS
|
||||||
@ -237,10 +205,11 @@ spsave: .res 1
|
|||||||
old_shflok: .res 1
|
old_shflok: .res 1
|
||||||
old_lmargin: .res 1
|
old_lmargin: .res 1
|
||||||
.if .not .defined(__ATARIXL__)
|
.if .not .defined(__ATARIXL__)
|
||||||
appmsav: .res 1
|
APPMHI_save: .res 2
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.segment "AUTOSTRT"
|
|
||||||
.word RUNAD ; defined in atari.h
|
.segment "AUTOSTRT"
|
||||||
|
.word RUNAD ; defined in atari.inc
|
||||||
.word RUNAD+1
|
.word RUNAD+1
|
||||||
.word __STARTUP_LOAD__ + 1
|
.word __STARTUP_LOAD__ + 1
|
||||||
|
@ -19,7 +19,6 @@ DEBUG = 1
|
|||||||
.import __SHADOW_RAM_RUN__
|
.import __SHADOW_RAM_RUN__
|
||||||
.import __CHARGEN_START__, __CHARGEN_SIZE__
|
.import __CHARGEN_START__, __CHARGEN_SIZE__
|
||||||
.import __SAVEAREA_LOAD__
|
.import __SAVEAREA_LOAD__
|
||||||
.import zpsave
|
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
@ -154,14 +153,6 @@ scrok: ; now close it again -- we don't need it anymore
|
|||||||
jsr CIOV_org
|
jsr CIOV_org
|
||||||
|
|
||||||
|
|
||||||
; Save the zero page locations we need
|
|
||||||
|
|
||||||
ldx #zpspace-1
|
|
||||||
L1: lda sp,x
|
|
||||||
sta zpsave,x
|
|
||||||
dex
|
|
||||||
bpl L1
|
|
||||||
|
|
||||||
; copy chargen to low memory
|
; copy chargen to low memory
|
||||||
|
|
||||||
.ifdef DEBUG
|
.ifdef DEBUG
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
.export zpsave
|
|
||||||
.include "zeropage.inc"
|
|
||||||
|
|
||||||
.segment "ZPSAVE"
|
|
||||||
|
|
||||||
zpsave: .res zpspace
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user