1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +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:
Christian Groessler 2013-07-03 11:38:28 +02:00
commit d3d7499faa
5 changed files with 34 additions and 87 deletions

View File

@ -19,7 +19,6 @@ SEGMENTS {
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
ZPSAVE: load = RAM, type = bss, define = yes;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;

View File

@ -28,13 +28,11 @@ MEMORY {
MAINHDR: file = %O, start = $0000, size = $0004;
RAM: file = %O, define = yes, start = %S +
__SAVEAREA_SIZE__ +
__LOWBUFS_SIZE__ +
__ZPSAVE_SIZE__, size = $D000 -
__LOWBUFS_SIZE__, size = $D000 -
__STACKSIZE__ -
%S -
__SAVEAREA_SIZE__ -
__LOWBUFS_SIZE__ -
__ZPSAVE_SIZE__;
__LOWBUFS_SIZE__;
# address of relocated character generator
CHARGEN: file = "", define = yes, start = $D800, size = $0400;
@ -55,7 +53,6 @@ SEGMENTS {
SRPREPHDR: load = SRPREPHDR, type = ro;
SAVEAREA: load = SRPREP, type = bss, define = yes; # shared btw. SRPREP and RAM
LOWBUFS: load = SRPREP, type = bss, define = yes;
ZPSAVE: load = SRPREP, type = bss, define = yes;
SRPREP: load = SRPREP, type = rw, define = yes;
SHADOW_RAM: load = SRPREP, run = RAM_BELOW_ROM, type = rw, define = yes, optional = yes;
SRPREPTRL: load = SRPREPTRL, type = ro;

View File

@ -13,19 +13,18 @@
.import initlib, donelib
.import callmain, zerobss
.import __STARTUP_LOAD__, __ZPSAVE_LOAD__, __BSS_LOAD__
.import __STARTUP_LOAD__, __BSS_LOAD__
.import __RESERVED_MEMORY__
.import __RAM_START__, __RAM_SIZE__
.import zpsave
.import sram_init
.import __RAM_START__, __RAM_SIZE__
.if .defined(__ATARIXL__)
.import scrdev
.import findfreeiocb
.import sram_init
.import scrdev
.import findfreeiocb
.include "save_area.inc"
.endif
.include "zeropage.inc"
.include "atari.inc"
.include "save_area.inc"
; ------------------------------------------------------------------------
; EXE header
@ -35,15 +34,11 @@
.word $FFFF
.if .defined(__ATARIXL__)
.segment "MAINHDR"
.segment "MAINHDR"
.endif
.word __STARTUP_LOAD__
.if .defined(__ATARIXL__)
.word __BSS_LOAD__ - 1
.else
.word __ZPSAVE_LOAD__ - 1
.endif
; ------------------------------------------------------------------------
; Actual code
@ -57,20 +52,8 @@
; Real entry point:
.if .not .defined(__ATARIXL__) ; already done in previous load chunk
; Save the zero page locations we need
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x
dex
bpl L1
.else
jsr sram_init
.if .defined(__ATARIXL__)
jsr sram_init
.endif
; Clear the BSS data
@ -87,9 +70,9 @@ L1: lda sp,x
; Report memory usage
lda APPMHI
sta appmsav ; remember old APPMHI value
sta APPMHI_save ; remember old APPMHI value
lda APPMHI+1
sta appmsav+1
sta APPMHI_save+1
sec
lda MEMTOP
@ -103,10 +86,10 @@ L1: lda sp,x
.else
lda #<(__RAM_START__ + __RAM_SIZE__ - 1)
sta sp
lda #>(__RAM_START__ + __RAM_SIZE__ - 1)
sta sp+1
lda #<(__RAM_START__ + __RAM_SIZE__ - 1)
sta sp
lda #>(__RAM_START__ + __RAM_SIZE__ - 1)
sta sp+1
.endif
@ -155,36 +138,30 @@ _exit: jsr donelib ; Run module destructors
lda old_shflok
sta SHFLOK
.if .not .defined(__ATARIXL__)
; Restore APPMHI
lda appmsav
lda APPMHI_save
sta APPMHI
lda appmsav+1
lda APPMHI_save+1
sta APPMHI+1
.else
.if .defined(__ATARIXL__)
; Atari XL target stuff...
lda PORTB_save
sta PORTB
lda RAMTOP_save
sta RAMTOP
lda MEMTOP_save
sta MEMTOP
lda MEMTOP_save+1
sta MEMTOP+1
lda APPMHI_save
sta APPMHI
lda APPMHI_save+1
sta APPMHI+1
lda PORTB_save
sta PORTB
lda RAMTOP_save
sta RAMTOP
lda MEMTOP_save
sta MEMTOP
lda MEMTOP_save+1
sta MEMTOP+1
; ... issue a GRAPHICS 0 call (copied'n'pasted from TGI drivers)
jsr findfreeiocb
jsr findfreeiocb
; Reopen it in Graphics 0
lda #OPEN
@ -209,18 +186,9 @@ _exit: jsr donelib ; Run module destructors
.endif
; Copy back the zero page stuff
ldx #zpspace-1
L2: lda zpsave,x
sta sp,x
dex
bpl L2
; Turn on cursor
inx
ldx #0
stx CRSINH
; Back to DOS
@ -237,10 +205,11 @@ spsave: .res 1
old_shflok: .res 1
old_lmargin: .res 1
.if .not .defined(__ATARIXL__)
appmsav: .res 1
APPMHI_save: .res 2
.endif
.segment "AUTOSTRT"
.word RUNAD ; defined in atari.h
.segment "AUTOSTRT"
.word RUNAD ; defined in atari.inc
.word RUNAD+1
.word __STARTUP_LOAD__ + 1

View File

@ -19,7 +19,6 @@ DEBUG = 1
.import __SHADOW_RAM_RUN__
.import __CHARGEN_START__, __CHARGEN_SIZE__
.import __SAVEAREA_LOAD__
.import zpsave
.include "zeropage.inc"
.include "atari.inc"
@ -154,14 +153,6 @@ scrok: ; now close it again -- we don't need it anymore
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
.ifdef DEBUG

View File

@ -1,9 +0,0 @@
.export zpsave
.include "zeropage.inc"
.segment "ZPSAVE"
zpsave: .res zpspace
; ------------------------------------------------------------------------