; Christian Groessler, chris@groessler.org, 2013
;
-DEBUG = 1
+;DEBUG = 1
-.if .defined(__ATARIXL__)
+.ifdef __ATARIXL__
.export sramprep
+
.import __SRPREP_LOAD__, __SRPREPCHNK_LAST__
.import __SHADOW_RAM_LOAD__, __SHADOW_RAM_SIZE__, __SHADOW_RAM_RUN__
.import __SHADOW_RAM2_LOAD__, __SHADOW_RAM2_SIZE__, __SHADOW_RAM2_RUN__
.segment "SRPREP"
+; ***** entry point *****
+
sramprep:
.ifdef DEBUG
print_string "entering stage #2"
lda lodadr+1
sta RAMTOP
- ; set APPMHI to MEMLO (+ 1 for sanity)
+ ; set APPMHI to MEMLO (+ 1 for sanity)
lda MEMLO
clc
adc #1
jsr findfreeiocb
-.ifdef DEBUG ; only check in debug version, this shouldn't really happen(tm)
+.ifdef DEBUG ; only check in debug version, this shouldn't really happen(tm)
beq iocbok
print_string "Internal error, no free IOCB!"
jsr delay
iocbok:
.endif
- ; Reopen it in Graphics 0
+ ; reopen it in Graphics 0
lda #OPEN
sta ICCOM,x
lda #OPNIN | OPNOT
; switch to temporary chargen
- sta CHBASE
- sta CHBAS
+ sta CHBASE
+ sta CHBAS
; copy shadow RAM contents to their destination (segment SHADOW_RAM)
lda #<__SHADOW_RAM2_SIZE__
bne do_copy2
lda #>__SHADOW_RAM2_SIZE__
- beq no_copy2 ; we have no shadow RAM contents
+ beq no_copy2 ; we have no shadow RAM #2 contents
; ptr1 - src; ptr2 - dest; tmp1, tmp2 - len
do_copy2:
sta APPMHI+1
rts
-
-.ifdef DEBUG
-
-.byte "HERE ****************** HERE ***************>>>>>>"
-
-sramsize:
- .word __SHADOW_RAM_SIZE__
-
; short delay
.proc delay
lda #10
-l: jsr delay1
+@loop: jsr delay1
clc
sbc #0
- bne l
+ bne @loop
rts
delay1: ldx #0
ldy #0
-loop: dey
- bne loop
+@loop: dey
+ bne @loop
dex
- bne loop
+ bne @loop
rts
.endproc
+.ifdef DEBUG
+
+.byte "HERE ****************** HERE ***************>>>>>>"
+
+sramsize:
+ .word __SHADOW_RAM_SIZE__
+
.endif ; .ifdef DEBUG
screen_device: .byte "S:",0
.word INITAD+1
.word sramprep
-.endif ; .if .defined(__ATARIXL__)
+.endif ; .ifdef __ATARIXL__