2 ; Atari XL startup system check
4 ; This routine gets loaded prior to the main part of the executable
5 ; and checks if the system is compatible to run the program.
6 ; It checks whether the system is an XL type one and that enough
7 ; memory is installed (which isn't the case for a 600XL).
8 ; If the system doesn't qualify, the loading of the main program
9 ; is aborted by jumping to DOSVEC.
11 ; Christian Groessler, chris@groessler.org, 2013
14 .if .defined(__ATARIXL__)
17 .import __SYSCHK_LOAD__
18 .import __SAVEAREA_LOAD__
20 .include "zeropage.inc"
24 .macro print_string text
27 start: .byte text, ATEOL
28 cont: ldx #0 ; channel 0
41 .macro print_string2 addr, len
59 ; ------------------------------------------------------------------------
67 ; ------------------------------------------------------------------------
73 lda $fcd8 ; from ostype.s
78 print_string "This program needs an XL machine."
81 ; we have an XL machine, now check memory
87 print_string "Not enough memory."
91 lowadr: .res 2 ; lowest address we need in order to move screen memory down, depending on start address of program
94 ; system is basically supported, check if there is enough space btw. MEMLO and our start address
95 ; to move screen memory there
97 CMPVAL = 64+255+992 ; you may ask, why these values... @@@ document
99 sys_ok: lda #<__SAVEAREA_LOAD__
103 lda #>__SAVEAREA_LOAD__
114 ; load address was too low
115 print_string2 lmemerr_txt, lmemerr_txt_len
116 jsr delay ; long text takes longer to read, give user additional time
119 ; all is well(tm), launch the application
125 .byte "Not enough memory to move screen", ATEOL
126 .byte "memory to low memory. Consider using", ATEOL
127 .byte "a higher load address.", ATEOL
128 lmemerr_txt_len = * - lmemerr_txt
151 ; ------------------------------------------------------------------------
152 ; Chunk "trailer" - sets INITAD
157 .word __SYSCHK_LOAD__
159 .endif ; .if .defined(__ATARIXL__)