1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

* Moved the BASIC stub that calls the compiled program into it's own segment

named EXEHDR.
* Renamed BASICHDR to EXEHDR for the PET-II machines.
* Moved the call to CHRCH in front of the code that saves the zero page, since
  open files are sometimes remembered in the zero page, so we need to close
  them before we grab a copy.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4507 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2009-12-09 12:42:24 +00:00
parent 1fae13274e
commit 60bc009991
17 changed files with 98 additions and 71 deletions

View File

@ -18,17 +18,13 @@
; ------------------------------------------------------------------------
; Constants
IRQInd = $2FD ; JMP $0000 - used as indirect IRQ vector
IRQInd = $2FD ; JMP $0000 - used as indirect IRQ vector
; ------------------------------------------------------------------------
; Place the startup code in a special segment to cope with the quirks of
; c128 banking.
.segment "STARTUP"
; BASIC header with a SYS call
.org $1BFF
.segment "EXEHDR"
.word Head ; Load address
Head: .word @Next
.word .version ; Line number
@ -39,14 +35,17 @@ Head: .word @Next
.byte <(((Start / 1) .mod 10) + $30)
.byte $00 ; End of BASIC line
@Next: .word 0 ; BASIC end marker
.reloc
; ------------------------------------------------------------------------
; Actual code
; Startup code
.segment "STARTUP"
Start:
; Close open files
Start: jsr CLRCH
jsr CLRCH
; Switch to the second charset

View File

@ -17,12 +17,10 @@
; ------------------------------------------------------------------------
; Place the startup code in a special segment.
.segment "STARTUP"
; BASIC header with a SYS call
.segment "EXEHDR"
.word Head ; Load address
Head: .word @Next
.word .version ; Line number
@ -35,18 +33,24 @@ Head: .word @Next
@Next: .word 0 ; BASIC end marker
; ------------------------------------------------------------------------
; Actual code
; Startup code
Start: ldx #zpspace-1
L1: lda sp,x
sta zpsave,x ; save the zero page locations we need
dex
bpl L1
.segment "STARTUP"
Start:
; Close open files
jsr CLRCH
; Save the zero page locations we need
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x
dex
bpl L1
; Switch to second charset
lda #14

View File

@ -16,12 +16,10 @@
; ------------------------------------------------------------------------
; Place the startup code in a special segment.
.segment "STARTUP"
; BASIC header with a SYS call
.segment "EXEHDR"
.word Head ; Load address
Head: .word @Next
.word .version ; Line number
@ -34,18 +32,24 @@ Head: .word @Next
@Next: .word 0 ; BASIC end marker
; ------------------------------------------------------------------------
; Actual code
; Startup code
Start: ldx #zpspace-1
L1: lda sp,x
sta zpsave,x ; Save the zero page locations we need
dex
bpl L1
.segment "STARTUP"
Start:
; Close open files
jsr CLRCH
; Save the zero page locations we need
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x
dex
bpl L1
; Switch to second charset
lda #14

View File

@ -46,7 +46,7 @@
; that is overwritten later.
;
.segment "BASICHDR"
.segment "EXEHDR"
.byte $03,$00,$11,$00,$0a,$00,$81,$20,$49,$b2,$30,$20,$a4,$20,$34,$00
.byte $19,$00,$14,$00,$87,$20,$4a,$00,$27,$00,$1e,$00,$97,$20,$32,$35

View File

@ -45,7 +45,7 @@
; that is overwritten later.
;
.segment "BASICHDR"
.segment "EXEHDR"
.byte $03,$00,$11,$00,$0a,$00,$81,$20,$49,$b2,$30,$20,$a4,$20,$34,$00
.byte $19,$00,$14,$00,$87,$20,$4a,$00,$27,$00,$1e,$00,$97,$20,$32,$35

View File

@ -15,12 +15,10 @@
.include "../cbm/cbm.inc"
; ------------------------------------------------------------------------
; Place the startup code in a special segment.
.segment "STARTUP"
; BASIC header with a SYS call
.segment "EXEHDR"
.word Head ; Load address
Head: .word @Next
.word .version ; Line number
@ -33,18 +31,24 @@ Head: .word @Next
@Next: .word 0 ; BASIC end marker
; ------------------------------------------------------------------------
; Actual code
; Startup code
Start: ldx #zpspace-1
L1: lda sp,x
sta zpsave,x ; Save the zero page locations we need
dex
bpl L1
.segment "STARTUP"
Start:
; Close open files
jsr CLRCH
; Save the zero page locations we need
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x
dex
bpl L1
; Switch to second charset. The routine that is called by BSOUT to switch the
; character set will use FNLEN as temporary storage - YUCK! Since the
; initmainargs routine, which parses the command line for arguments needs this

View File

@ -20,10 +20,9 @@
IRQInd = $500 ; JMP $0000 - used as indirect IRQ vector
; ------------------------------------------------------------------------
; Place the startup code in a special segment to cope with the quirks of
; plus/4 banking.
; BASIC header with a SYS call
.segment "STARTUP"
.segment "EXEHDR"
.word Head ; Load address
Head: .word @Next
@ -37,22 +36,28 @@ Head: .word @Next
@Next: .word 0 ; BASIC end marker
; ------------------------------------------------------------------------
; Actual code
; Startup code
Start: sei ; No interrupts since we're banking out the ROM
sta ENABLE_RAM
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x ; save the zero page locations we need
dex
bpl L1
sta ENABLE_ROM
cli
.segment "STARTUP"
Start:
; Close open files
jsr $FFCC ; CLRCH
; Save the zero page locations we need
sei ; No interrupts since we're banking out the ROM
sta ENABLE_RAM
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x
dex
bpl L1
sta ENABLE_ROM
cli
; Switch to second charset
lda #14

View File

@ -15,12 +15,10 @@
.include "vic20.inc"
; ------------------------------------------------------------------------
; Place the startup code in a special segment.
.segment "STARTUP"
; BASIC header with a SYS call
.segment "EXEHDR"
.word Head ; Load address
Head: .word @Next
.word .version ; Line number
@ -33,18 +31,24 @@ Head: .word @Next
@Next: .word 0 ; BASIC end marker
; ------------------------------------------------------------------------
; Actual code
; Startup code
Start: ldx #zpspace-1
L1: lda sp,x
sta zpsave,x ; Save the zero page locations we need
dex
bpl L1
.segment "STARTUP"
Start:
; Close open files
jsr CLRCH
; Save the zero page locations we need
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x
dex
bpl L1
; Switch to second charset
lda #14

View File

@ -1,8 +1,9 @@
MEMORY {
ZP: start = $0002, size = $001A, type = rw, define = yes;
RAM: start = $1Bff, size = $A401, file = %O, define = yes;
RAM: start = $1BFF, size = $A401, file = %O, define = yes;
}
SEGMENTS {
EXEHDR: load = RAM, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;

View File

@ -3,6 +3,7 @@ MEMORY {
RAM: start = $0FFF, size = $7001, file = %O;
}
SEGMENTS {
EXEHDR: load = RAM, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;

View File

@ -3,6 +3,7 @@ MEMORY {
RAM: start = $07FF, size = $C801, file = %O, define = yes;
}
SEGMENTS {
EXEHDR: load = RAM, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;

View File

@ -1,5 +1,5 @@
MEMORY {
BASICHDR: start = $0001, size = $0050, fill = yes, fillval = 0, type = rw, file = %O;
HEADER: start = $0001, size = $0050, fill = yes, fillval = 0, type = rw, file = %O;
ZP: start = $0051, size = $00AD, fill = yes, fillval = 0, type = rw, file = %O, define = yes;
STARTUP: start = $00FE, size = $0102, fill = yes, fillval = 0, file = %O;
PAGE2: start = $0200, size = $0100, fill = yes, fillval = 0, file = %O;
@ -9,7 +9,7 @@ MEMORY {
VIDRAM: start = $F000, size = $0400, define = yes, file = "";
}
SEGMENTS {
BASICHDR: load = BASICHDR, type = rw;
EXEHDR: load = HEADER, type = rw;
STARTUP: load = STARTUP, type = rw;
PAGE2: load = PAGE2, type = rw;
PAGE3: load = PAGE3, type = rw;

View File

@ -1,13 +1,13 @@
MEMORY {
BASICHDR: start = $0001, size = $0050, type = rw, fill = yes, fillval = 0, file = %O;
HEADER: start = $0001, size = $0050, type = rw, fill = yes, fillval = 0, file = %O;
ZP: start = $0051, size = $00AD, type = rw, define = yes, fill = yes, fillval = 0, file = %O;
STARTUP: start = $00FE, size = $0102, fill = yes, fillval = 0, file = %O;
PAGE2: start = $0200, size = $0100, fill = yes, fillval = 0, file = %O;
PAGE3: start = $0300, size = $0100, fill = yes, fillval = 0, file = %O;
RAM: start = $0400, size = $FAAE, file = %O;
}
}
SEGMENTS {
BASICHDR: load = BASICHDR, type = rw;
EXEHDR: load = HEADER, type = rw;
STARTUP: load = STARTUP, type = rw;
PAGE2: load = PAGE2, type = rw;
PAGE3: load = PAGE3, type = rw;

View File

@ -3,6 +3,7 @@ MEMORY {
RAM: start = $03FF, size = $7BFF, file = %O;
}
SEGMENTS {
EXEHDR: load = RAM, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;

View File

@ -3,6 +3,7 @@ MEMORY {
RAM: start = $0FFF, size = $ED01, file = %O;
}
SEGMENTS {
EXEHDR: load = RAM, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;

View File

@ -5,6 +5,7 @@ MEMORY {
RAM: start = $11FF, size = $6E01, define = yes, file = %O;
}
SEGMENTS {
EXEHDR: load = RAM, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;

View File

@ -3,6 +3,7 @@ MEMORY {
RAM: start = $0FFF, size = $0E01, define = yes, file = %O;
}
SEGMENTS {
EXEHDR: load = RAM, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;