; lenser -- Apple IIGS SHR slideshow, stage 1 boot sector (<=256 bytes). ; ; The Disk II boot ROM loads track 0 sector 0 to $0800 and JMPs $0801; every ROM ; sector read JMPs back to $0801, so this is the master read driver. It first ; reads stage 2 into $0900 (S2END-$09 sectors), then reads each 32K SHR image ; into bank-0 $2000-$9FFF and calls stage 2 (stash, $0900) to bank it; after the ; last image it JMPs the stage-2 cycle viewer ($0903). ; ; #defines from the wrapper -- NIMAGES, S2END (one past the last stage-2 page). * = $0800 .byte $01 ; ROM scratch (boot sector byte 0) entry: ; $0801, re-entered after every ROM read lda dpage cmp endpg bcc rdcont ; not at the current region's end yet lda phase bne imgdone ; stage 2 finished loading -> start reading images into $2000 inc phase lda #$20 sta dpage lda #$a0 sta endpg bne rdcont ; always (endpg = $a0) imgdone: jsr $0900 ; stash bank0 $2000 -> next bank inc imgcnt lda imgcnt cmp #NIMAGES bcs allloaded lda #$20 sta dpage ; reset for the next image bne rdcont ; always allloaded: jmp $0903 ; stage-2 cycle viewer (never returns) rdcont: lda psec cmp #$10 bcc readit jsr seeknext lda #$00 sta psec readit: lda psec sta $3d lda curtrk sta $41 lda #$00 sta $26 lda dpage sta $27 inc psec inc dpage ldx $2b jmp $c65c ; slot-6 ROM read; reads a sector then JMP $0801 ; advance the head one track (two half-steps), phase-overlap step (from iigs.s) seeknext: inc curtrk lda #$00 sta $0a jsr onestep jsr onestep lda halftrk and #$03 asl ora $2b tax lda $c080,x rts onestep: lda halftrk clc adc #$01 and #$03 asl ora $2b tax lda $c081,x ldx $0a lda ontable,x jsr wait lda halftrk and #$03 asl ora $2b tax lda $c080,x ldx $0a lda offtable,x jsr wait inc halftrk inc $0a rts ontable: .byte $13,$0a,$08,$06 offtable: .byte $46,$1a,$10,$0c wait: tay w1: ldx #$00 w2: dex bne w2 dey bne w1 rts phase: .byte 0 ; 0 = loading stage 2, 1 = loading images endpg: .byte S2END ; stage-2 ends one past this page imgcnt: .byte 0 psec: .byte $01 ; next physical sector (track 0 starts at 1) dpage: .byte $09 ; stage 2 loads from $0900 halftrk: .byte $00 curtrk: .byte $00