mirror of
https://github.com/cc65/cc65.git
synced 2025-01-22 06:30:38 +00:00
Enable "system check" load chunk for non-XL Atari target.
This commit is contained in:
parent
be82b141c7
commit
700fd4f187
@ -4,44 +4,62 @@ FEATURES {
|
|||||||
SYMBOLS {
|
SYMBOLS {
|
||||||
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||||
__OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay
|
__OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay
|
||||||
|
__STARTADDRESS__: type = export, value = %S;
|
||||||
__RESERVED_MEMORY__: type = weak, value = $0000;
|
__RESERVED_MEMORY__: type = weak, value = $0000;
|
||||||
|
syschk: type = import; # force inclusion of SYSCHK
|
||||||
}
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: file = "", define = yes, start = $0082, size = $007E;
|
ZP: file = "", define = yes, start = $0082, size = $007E;
|
||||||
HEADER: file = %O, start = $0000, size = $0006;
|
|
||||||
RAM: file = %O, start = %S + __OVERLAYSIZE__, size = $BC20 - __STACKSIZE__ - __OVERLAYSIZE__ - %S;
|
# file header, just $FFFF
|
||||||
TRAILER: file = %O, start = $0000, size = $0006;
|
HEADER: file = %O, start = $0000, size = $0002;
|
||||||
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
|
|
||||||
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
|
# "system check" load chunk
|
||||||
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
|
SYSCHKHDR: file = %O, start = $0000, size = $0004;
|
||||||
OVL4: file = "%O.4", start = %S, size = __OVERLAYSIZE__;
|
SYSCHKCHNK: file = %O, start = $2E00, size = $0300;
|
||||||
OVL5: file = "%O.5", start = %S, size = __OVERLAYSIZE__;
|
SYSCHKTRL: file = %O, start = $0000, size = $0006;
|
||||||
OVL6: file = "%O.6", start = %S, size = __OVERLAYSIZE__;
|
|
||||||
OVL7: file = "%O.7", start = %S, size = __OVERLAYSIZE__;
|
# "main program" load chunk
|
||||||
OVL8: file = "%O.8", start = %S, size = __OVERLAYSIZE__;
|
MAINHDR: file = %O, start = $0000, size = $0004;
|
||||||
OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__;
|
RAM: file = %O, define = yes, start = %S + __OVERLAYSIZE__,
|
||||||
|
size = $BC20 - __OVERLAYSIZE__ - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;
|
||||||
|
TRAILER: file = %O, start = $0000, size = $0006;
|
||||||
|
|
||||||
|
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
|
||||||
|
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
|
||||||
|
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
|
||||||
|
OVL4: file = "%O.4", start = %S, size = __OVERLAYSIZE__;
|
||||||
|
OVL5: file = "%O.5", start = %S, size = __OVERLAYSIZE__;
|
||||||
|
OVL6: file = "%O.6", start = %S, size = __OVERLAYSIZE__;
|
||||||
|
OVL7: file = "%O.7", start = %S, size = __OVERLAYSIZE__;
|
||||||
|
OVL8: file = "%O.8", start = %S, size = __OVERLAYSIZE__;
|
||||||
|
OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__;
|
||||||
}
|
}
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
EXEHDR: load = HEADER, type = ro;
|
EXEHDR: load = HEADER, type = ro;
|
||||||
STARTUP: load = RAM, type = ro, define = yes;
|
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
|
||||||
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
|
SYSCHK: load = SYSCHKCHNK, type = rw, define = yes, optional = yes;
|
||||||
INIT: load = RAM, type = ro, optional = yes;
|
SYSCHKTRL: load = SYSCHKTRL, type = ro, optional = yes;
|
||||||
CODE: load = RAM, type = ro, define = yes;
|
MAINHDR: load = MAINHDR, type = ro;
|
||||||
RODATA: load = RAM, type = ro;
|
STARTUP: load = RAM, type = ro, define = yes;
|
||||||
DATA: load = RAM, type = rw;
|
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
|
||||||
BSS: load = RAM, type = bss, define = yes;
|
INIT: load = RAM, type = ro, optional = yes;
|
||||||
ZEROPAGE: load = ZP, type = zp;
|
CODE: load = RAM, type = ro, define = yes;
|
||||||
EXTZP: load = ZP, type = zp, optional = yes;
|
RODATA: load = RAM, type = ro;
|
||||||
AUTOSTRT: load = TRAILER, type = ro;
|
DATA: load = RAM, type = rw;
|
||||||
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
|
BSS: load = RAM, type = bss, define = yes;
|
||||||
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes;
|
EXTZP: load = ZP, type = zp, optional = yes;
|
||||||
OVERLAY4: load = OVL4, type = ro, define = yes, optional = yes;
|
AUTOSTRT: load = TRAILER, type = ro;
|
||||||
OVERLAY5: load = OVL5, type = ro, define = yes, optional = yes;
|
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
|
||||||
OVERLAY6: load = OVL6, type = ro, define = yes, optional = yes;
|
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
|
||||||
OVERLAY7: load = OVL7, type = ro, define = yes, optional = yes;
|
OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes;
|
||||||
OVERLAY8: load = OVL8, type = ro, define = yes, optional = yes;
|
OVERLAY4: load = OVL4, type = ro, define = yes, optional = yes;
|
||||||
OVERLAY9: load = OVL9, type = ro, define = yes, optional = yes;
|
OVERLAY5: load = OVL5, type = ro, define = yes, optional = yes;
|
||||||
|
OVERLAY6: load = OVL6, type = ro, define = yes, optional = yes;
|
||||||
|
OVERLAY7: load = OVL7, type = ro, define = yes, optional = yes;
|
||||||
|
OVERLAY8: load = OVL8, type = ro, define = yes, optional = yes;
|
||||||
|
OVERLAY9: load = OVL9, type = ro, define = yes, optional = yes;
|
||||||
}
|
}
|
||||||
FEATURES {
|
FEATURES {
|
||||||
CONDES: type = constructor,
|
CONDES: type = constructor,
|
||||||
|
@ -3,26 +3,42 @@ FEATURES {
|
|||||||
}
|
}
|
||||||
SYMBOLS {
|
SYMBOLS {
|
||||||
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||||
|
__STARTADDRESS__: type = export, value = %S;
|
||||||
__RESERVED_MEMORY__: type = weak, value = $0000;
|
__RESERVED_MEMORY__: type = weak, value = $0000;
|
||||||
|
syschk: type = import; # force inclusion of SYSCHK
|
||||||
}
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: file = "", define = yes, start = $0082, size = $007E;
|
ZP: file = "", define = yes, start = $0082, size = $007E;
|
||||||
HEADER: file = %O, start = $0000, size = $0006;
|
|
||||||
RAM: file = %O, start = %S, size = $BC20 - __STACKSIZE__ - %S;
|
# file header, just $FFFF
|
||||||
TRAILER: file = %O, start = $0000, size = $0006;
|
HEADER: file = %O, start = $0000, size = $0002;
|
||||||
|
|
||||||
|
# "system check" load chunk
|
||||||
|
SYSCHKHDR: file = %O, start = $0000, size = $0004;
|
||||||
|
SYSCHKCHNK: file = %O, start = $2E00, size = $0300;
|
||||||
|
SYSCHKTRL: file = %O, start = $0000, size = $0006;
|
||||||
|
|
||||||
|
# "main program" load chunk
|
||||||
|
MAINHDR: file = %O, start = $0000, size = $0004;
|
||||||
|
RAM: file = %O, define = yes, start = %S, size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;
|
||||||
|
TRAILER: file = %O, start = $0000, size = $0006;
|
||||||
}
|
}
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
EXEHDR: load = HEADER, type = ro;
|
EXEHDR: load = HEADER, type = ro;
|
||||||
STARTUP: load = RAM, type = ro, define = yes;
|
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
|
||||||
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
|
SYSCHK: load = SYSCHKCHNK, type = rw, define = yes, optional = yes;
|
||||||
INIT: load = RAM, type = ro, optional = yes;
|
SYSCHKTRL: load = SYSCHKTRL, type = ro, optional = yes;
|
||||||
CODE: load = RAM, type = ro, define = yes;
|
MAINHDR: load = MAINHDR, type = ro;
|
||||||
RODATA: load = RAM, type = ro;
|
STARTUP: load = RAM, type = ro, define = yes;
|
||||||
DATA: load = RAM, type = rw;
|
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
|
||||||
BSS: load = RAM, type = bss, define = yes;
|
INIT: load = RAM, type = ro, optional = yes;
|
||||||
ZEROPAGE: load = ZP, type = zp;
|
CODE: load = RAM, type = ro, define = yes;
|
||||||
EXTZP: load = ZP, type = zp, optional = yes;
|
RODATA: load = RAM, type = ro;
|
||||||
AUTOSTRT: load = TRAILER, type = ro;
|
DATA: load = RAM, type = rw;
|
||||||
|
BSS: load = RAM, type = bss, define = yes;
|
||||||
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
|
EXTZP: load = ZP, type = zp, optional = yes;
|
||||||
|
AUTOSTRT: load = TRAILER, type = ro;
|
||||||
}
|
}
|
||||||
FEATURES {
|
FEATURES {
|
||||||
CONDES: type = constructor,
|
CONDES: type = constructor,
|
||||||
|
@ -34,9 +34,7 @@
|
|||||||
|
|
||||||
.word $FFFF
|
.word $FFFF
|
||||||
|
|
||||||
.ifdef __ATARIXL__
|
|
||||||
.segment "MAINHDR"
|
.segment "MAINHDR"
|
||||||
.endif
|
|
||||||
|
|
||||||
.word __STARTUP_LOAD__
|
.word __STARTUP_LOAD__
|
||||||
.word __BSS_LOAD__ - 1
|
.word __BSS_LOAD__ - 1
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
;
|
;
|
||||||
; Atari XL startup system check
|
; Atari startup system check
|
||||||
;
|
;
|
||||||
; This routine gets loaded prior to the main part of the executable
|
; This routine gets loaded prior to the main part of the executable
|
||||||
; and checks if the system is compatible to run the program.
|
; and checks if the system is compatible to run the program.
|
||||||
; It checks whether the system is an XL type one and that enough
|
; For the XL target it checks whether the system is an XL type one
|
||||||
; memory is installed (which isn't the case for a 600XL).
|
; and that enough memory is installed (which isn't the case for a 600XL).
|
||||||
; If the system doesn't qualify, the loading of the main program
|
; For the non-XL target it checks whether there is enough memory
|
||||||
|
; installed to run the program.
|
||||||
|
; For both target it checks that the program won't load below MEMLO.
|
||||||
|
; If one of the checks fails the loading of the main program
|
||||||
; is aborted by jumping to DOSVEC.
|
; is aborted by jumping to DOSVEC.
|
||||||
;
|
;
|
||||||
; Christian Groessler, chris@groessler.org, 2013
|
; Christian Groessler, chris@groessler.org, 2013
|
||||||
@ -13,11 +16,14 @@
|
|||||||
|
|
||||||
;DEBUG = 1
|
;DEBUG = 1
|
||||||
|
|
||||||
.ifdef __ATARIXL__
|
|
||||||
|
|
||||||
.export syschk
|
.export syschk
|
||||||
.import __SYSCHK_LOAD__
|
.import __SYSCHK_LOAD__
|
||||||
.import __STARTADDRESS__ ; needed by xlmemchk.inc
|
.import __STARTADDRESS__
|
||||||
|
|
||||||
|
; the following imports are only needed for the 'atari' target version
|
||||||
|
.import __BSS_SIZE__, __BSS_RUN__
|
||||||
|
.import __STACKSIZE__
|
||||||
|
.import __RESERVED_MEMORY__
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
@ -59,25 +65,26 @@ cont: ldx #0 ; channel 0
|
|||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Chunk header
|
; code
|
||||||
|
|
||||||
.segment "SYSCHKHDR"
|
|
||||||
|
|
||||||
.word __SYSCHK_LOAD__
|
|
||||||
.word end - 1
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
|
||||||
; Actual code
|
|
||||||
|
|
||||||
.segment "SYSCHK"
|
.segment "SYSCHK"
|
||||||
|
|
||||||
|
.ifdef __ATARIXL__
|
||||||
|
|
||||||
|
lmemerrxl_txt:
|
||||||
|
.byte "Not enough memory to move screen", ATEOL
|
||||||
|
.byte "memory to low memory. Consider using", ATEOL
|
||||||
|
.byte "a higher load address.", ATEOL
|
||||||
|
lmemerrxl_txt_len = * - lmemerrxl_txt
|
||||||
|
|
||||||
; no XL machine
|
; no XL machine
|
||||||
no_xl: print_string "This program needs an XL machine."
|
no_xl: print_string "This program needs an XL machine."
|
||||||
jmp fail
|
jmp fail
|
||||||
|
|
||||||
; entry point
|
|
||||||
syschk:
|
; ***** entry point (atarixl) *****
|
||||||
lda $fcd8 ; from ostype.s
|
|
||||||
|
syschk: lda $fcd8 ; from ostype.s
|
||||||
cmp #$a2
|
cmp #$a2
|
||||||
beq no_xl
|
beq no_xl
|
||||||
|
|
||||||
@ -86,11 +93,7 @@ syschk:
|
|||||||
cmp #$80
|
cmp #$80
|
||||||
bcs sys_ok
|
bcs sys_ok
|
||||||
|
|
||||||
; not enough memory
|
jmp mem_err
|
||||||
print_string "Not enough memory."
|
|
||||||
fail: jsr delay
|
|
||||||
jmp (DOSVEC)
|
|
||||||
|
|
||||||
|
|
||||||
sys_ok:
|
sys_ok:
|
||||||
.include "xlmemchk.inc" ; calculate lowest address we will use when we move the screen buffer down
|
.include "xlmemchk.inc" ; calculate lowest address we will use when we move the screen buffer down
|
||||||
@ -102,11 +105,63 @@ sys_ok:
|
|||||||
sbc lowadr+1
|
sbc lowadr+1
|
||||||
bcc memlo_ok
|
bcc memlo_ok
|
||||||
|
|
||||||
|
; load address was too low
|
||||||
|
print_string2 lmemerrxl_txt, lmemerrxl_txt_len
|
||||||
|
jsr delay ; long text takes longer to read, give user additional time
|
||||||
|
jmp fail
|
||||||
|
|
||||||
|
.else ; above 'atarixl', below 'atari'
|
||||||
|
|
||||||
|
.define CIOV_org CIOV ; the print_string macros use CIOV_org, map this to CIOV
|
||||||
|
|
||||||
|
lmemerr_txt:
|
||||||
|
.byte "Program would load below MEMLO.", ATEOL
|
||||||
|
.byte "Consider using a higher load address.", ATEOL
|
||||||
|
lmemerr_txt_len = * - lmemerr_txt
|
||||||
|
|
||||||
|
|
||||||
|
; ***** entry point (atari) *****
|
||||||
|
|
||||||
|
syschk:
|
||||||
|
sec
|
||||||
|
lda MEMTOP
|
||||||
|
sbc #<__RESERVED_MEMORY__
|
||||||
|
sta tmp
|
||||||
|
lda MEMTOP+1
|
||||||
|
sbc #>__RESERVED_MEMORY__
|
||||||
|
sta tmp+1
|
||||||
|
lda tmp
|
||||||
|
sec
|
||||||
|
sbc #<__STACKSIZE__
|
||||||
|
sta tmp
|
||||||
|
lda tmp+1
|
||||||
|
sbc #>__STACKSIZE__
|
||||||
|
sta tmp+1
|
||||||
|
|
||||||
|
;tmp contains address which must be above .bss's end
|
||||||
|
|
||||||
|
sec
|
||||||
|
lda tmp
|
||||||
|
sbc #<(__BSS_RUN__ + __BSS_SIZE__)
|
||||||
|
lda tmp+1
|
||||||
|
sbc #>(__BSS_RUN__ + __BSS_SIZE__)
|
||||||
|
|
||||||
|
bcc mem_err ; program doesn't fit into memory
|
||||||
|
|
||||||
|
sec
|
||||||
|
lda MEMLO
|
||||||
|
sbc #<__STARTADDRESS__
|
||||||
|
lda MEMLO+1
|
||||||
|
sbc #>__STARTADDRESS__
|
||||||
|
bcc memlo_ok
|
||||||
|
|
||||||
; load address was too low
|
; load address was too low
|
||||||
print_string2 lmemerr_txt, lmemerr_txt_len
|
print_string2 lmemerr_txt, lmemerr_txt_len
|
||||||
jsr delay ; long text takes longer to read, give user additional time
|
jsr delay ; long text takes longer to read, give user additional time
|
||||||
jmp fail
|
jmp fail
|
||||||
|
|
||||||
|
.endif
|
||||||
|
|
||||||
; all is well(tm), launch the application
|
; all is well(tm), launch the application
|
||||||
memlo_ok:
|
memlo_ok:
|
||||||
.ifdef DEBUG
|
.ifdef DEBUG
|
||||||
@ -115,36 +170,45 @@ memlo_ok:
|
|||||||
.endif
|
.endif
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
; not enough memory
|
||||||
lmemerr_txt:
|
mem_err:print_string "Not enough memory."
|
||||||
.byte "Not enough memory to move screen", ATEOL
|
fail: jsr delay
|
||||||
.byte "memory to low memory. Consider using", ATEOL
|
jmp (DOSVEC)
|
||||||
.byte "a higher load address.", ATEOL
|
|
||||||
lmemerr_txt_len = * - lmemerr_txt
|
|
||||||
|
|
||||||
|
|
||||||
; short delay
|
; short delay
|
||||||
.proc delay
|
.proc delay
|
||||||
|
|
||||||
lda #10
|
lda #10
|
||||||
l: jsr delay1
|
@loop: jsr delay1
|
||||||
clc
|
clc
|
||||||
sbc #0
|
sbc #0
|
||||||
bne l
|
bne @loop
|
||||||
rts
|
rts
|
||||||
|
|
||||||
delay1: ldx #0
|
delay1: ldx #0
|
||||||
ldy #0
|
ldy #0
|
||||||
loop: dey
|
@loop: dey
|
||||||
bne loop
|
bne @loop
|
||||||
dex
|
dex
|
||||||
bne loop
|
bne @loop
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
||||||
|
.ifndef __ATARIXL__
|
||||||
|
tmp: ; outside of the load chunk, some kind of poor man's .bss
|
||||||
|
.endif
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
; Chunk header
|
||||||
|
|
||||||
|
.segment "SYSCHKHDR"
|
||||||
|
|
||||||
|
.word __SYSCHK_LOAD__
|
||||||
|
.word end - 1
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Chunk "trailer" - sets INITAD
|
; Chunk "trailer" - sets INITAD
|
||||||
|
|
||||||
@ -153,5 +217,3 @@ end:
|
|||||||
.word INITAD
|
.word INITAD
|
||||||
.word INITAD+1
|
.word INITAD+1
|
||||||
.word syschk
|
.word syschk
|
||||||
|
|
||||||
.endif ; .ifdef __ATARIXL__
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user