Fix tape header output. Add version info in the header. By Stefan Haubenthal.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4984 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
c7528d6e3e
commit
ccd1f5fcd7
2 changed files with 43 additions and 42 deletions
|
@ -5,45 +5,48 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _exit
|
.export _exit
|
||||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import callmain, zerobss
|
.import callmain, zerobss
|
||||||
.import __RAM_START__, __RAM_SIZE__
|
.import __RAM_START__, __RAM_SIZE__
|
||||||
.import __BSS_LOAD__, __STACKSIZE__
|
.import __BSS_LOAD__, __STACKSIZE__
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "atmos.inc"
|
.include "atmos.inc"
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Oric tape header
|
; Oric tape header
|
||||||
|
|
||||||
.segment "TAPEHDR"
|
.segment "TAPEHDR"
|
||||||
|
|
||||||
.byte $16, $16, $16 ; Sync bytes
|
.byte $16, $16, $16 ; Sync bytes
|
||||||
.byte $24 ; End of header marker
|
.byte $24 ; End of header marker
|
||||||
|
|
||||||
.byte $00 ; $2B0
|
.byte $00 ; $2B0
|
||||||
.byte $00 ; $2AF
|
.byte $00 ; $2AF
|
||||||
.byte $80 ; $2AE Machine code flag
|
.byte $80 ; $2AE Machine code flag
|
||||||
.byte $C7 ; $2AD Autoload flag
|
.byte $C7 ; $2AD Autoload flag
|
||||||
.dbyt __BSS_LOAD__ ; $2AB
|
.dbyt __BSS_LOAD__ ; $2AB
|
||||||
.dbyt __RAM_START__ ; $2A9
|
.dbyt __RAM_START__ ; $2A9
|
||||||
.byte $00 ; $2A8
|
.byte $00 ; $2A8
|
||||||
.byte $00 ; Zero terminated name
|
.byte ((.VERSION >> 8) & $0F) + '0'
|
||||||
|
.byte ((.VERSION >> 4) & $0F) + '0'
|
||||||
|
.byte (.VERSION & $0F) + '0'
|
||||||
|
.byte $00 ; Zero terminated compiler version
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Place the startup code in a special segment.
|
; Place the startup code in a special segment.
|
||||||
|
|
||||||
.segment "STARTUP"
|
.segment "STARTUP"
|
||||||
|
|
||||||
; Save the zero page area we're about to use
|
; Save the zero page area we're about to use
|
||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
L1: lda sp,x
|
L1: lda sp,x
|
||||||
sta zpsave,x ; Save the zero page locations we need
|
sta zpsave,x ; Save the zero page locations we need
|
||||||
dex
|
dex
|
||||||
bpl L1
|
bpl L1
|
||||||
|
|
||||||
; Clear the BSS data
|
; Clear the BSS data
|
||||||
|
|
||||||
|
@ -51,20 +54,20 @@ L1: lda sp,x
|
||||||
|
|
||||||
; Unprotect columns 0 and 1
|
; Unprotect columns 0 and 1
|
||||||
|
|
||||||
lda STATUS
|
lda STATUS
|
||||||
sta stsave
|
sta stsave
|
||||||
and #%11011111
|
and #%11011111
|
||||||
sta STATUS
|
sta STATUS
|
||||||
|
|
||||||
; Save system stuff and setup the stack
|
; Save system stuff and setup the stack
|
||||||
|
|
||||||
tsx
|
tsx
|
||||||
stx spsave ; save system stk ptr
|
stx spsave ; Save system stk ptr
|
||||||
|
|
||||||
lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||||
sta sp
|
sta sp
|
||||||
lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||||
sta sp+1 ; Set argument stack ptr
|
sta sp+1 ; Set argument stack ptr
|
||||||
|
|
||||||
; Call module constructors
|
; Call module constructors
|
||||||
|
|
||||||
|
@ -72,7 +75,7 @@ L1: lda sp,x
|
||||||
|
|
||||||
; Push arguments and call main()
|
; Push arguments and call main()
|
||||||
|
|
||||||
jsr callmain
|
jsr callmain
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
|
|
||||||
|
@ -82,16 +85,16 @@ _exit: jsr donelib ; Run module destructors
|
||||||
|
|
||||||
ldx spsave
|
ldx spsave
|
||||||
txs
|
txs
|
||||||
lda stsave
|
lda stsave
|
||||||
sta STATUS
|
sta STATUS
|
||||||
|
|
||||||
; Copy back the zero page stuff
|
; Copy back the zero page stuff
|
||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
L2: lda zpsave,x
|
L2: lda zpsave,x
|
||||||
sta sp,x
|
sta sp,x
|
||||||
dex
|
dex
|
||||||
bpl L2
|
bpl L2
|
||||||
|
|
||||||
; Back to BASIC
|
; Back to BASIC
|
||||||
|
|
||||||
|
@ -100,12 +103,10 @@ L2: lda zpsave,x
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Data
|
; Data
|
||||||
|
|
||||||
.segment "ZPSAVE"
|
.segment "ZPSAVE"
|
||||||
|
|
||||||
zpsave: .res zpspace
|
zpsave: .res zpspace
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
spsave: .res 1
|
spsave: .res 1
|
||||||
stsave: .res 1
|
stsave: .res 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ SYMBOLS {
|
||||||
}
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: file = "", define = yes, start = $00E2, size = $001A;
|
ZP: file = "", define = yes, start = $00E2, size = $001A;
|
||||||
TAPEHDR: file = %O, type = ro, start = $0000, size = $000E;
|
TAPEHDR: file = %O, type = ro, start = $0000, size = $0011;
|
||||||
RAM: file = %O, define = yes, start = $0500, size = $9300 - __STACKSIZE__;
|
RAM: file = %O, define = yes, start = $0500, size = $9300 - __STACKSIZE__;
|
||||||
}
|
}
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
|
@ -14,8 +14,8 @@ SEGMENTS {
|
||||||
CODE: load = RAM, type = ro;
|
CODE: load = RAM, type = ro;
|
||||||
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;
|
|
||||||
BSS: load = RAM, type = bss, define = yes;
|
BSS: load = RAM, type = bss, define = yes;
|
||||||
|
ZPSAVE: load = RAM, type = bss;
|
||||||
ZEROPAGE: load = ZP, type = zp;
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
}
|
}
|
||||||
FEATURES {
|
FEATURES {
|
||||||
|
|
Loading…
Add table
Reference in a new issue