;
; Cassette boot file header
;
-; Christian Groessler, chris@groessler.org, 2013
+; Christian Groessler, chris@groessler.org, 2014
;
-.ifndef __ATARIXL__
+;DEBUG = 1
- .include "atari.inc"
+.ifndef __ATARIXL__
- .import __BSS_RUN__, __STARTADDRESS__, start
- .export _cas_init
+ .include "atari.inc"
-.segment "CASHDR"
+ .import __BSS_RUN__, __STARTADDRESS__, _cas_init
+ .export _cas_hdr
- .byte 0 ; ignored
- .byte <((__BSS_RUN__ - __STARTADDRESS__ + 127 + 6) / 128)
- .word __STARTADDRESS__
- .word _cas_init
+.assert ((__BSS_RUN__ - __STARTADDRESS__ + 127) / 128) < $101, error, "File to big to load from cassette"
-.segment "CASINIT"
- lda #33
- ldy #80
- sta (SAVMSC),y
- clc
- rts
+; for a description of the cassette header, see De Re Atari, appendix C
-_cas_init:
- lda #34
- ldy #81
- sta (SAVMSC),y
-
- lda #<start
- sta DOSVEC
- lda #>start
- sta DOSVEC+1
- rts
+.segment "CASHDR"
-.endif ; .ifdef __ATARIXL__
+_cas_hdr:
+ .byte 0 ; ignored
+ .byte <((__BSS_RUN__ - __STARTADDRESS__ + 127) / 128) ; # of 128-byte records to read
+ .word __STARTADDRESS__ ; load address
+ .word _cas_init ; init address
+
+.ifdef DEBUG
+ lda #33
+ ldy #80
+ sta (SAVMSC),y
+.endif
+ clc
+ rts
+
+.endif ; .ifdef __ATARIXL__