; Commodore 128 VDC (8563) slideshow viewer -- 640x200 high-colour mode. ; ; Steps through NIMAGES VDC images named "00".."NN" on the disk, each a 16K VDC ; RAM image (codes/attributes/font, the same body the single hicolor/mono viewer ; copies). For each slide it KERNAL-loads the file into RAM bank 0 at $4000, ; copies the 16K verbatim into the VDC's own RAM, sets the global background ; (R26) from the per-image ss_fgbg table, then waits (key / seconds / both) ; before advancing. Boots via RUN"PIC" -> the BASIC stub SYSes here. ; ; #defines from the build wrapper -- ; WAITMODE 1 key / 2 seconds / 3 both WAITSECS timeout seconds ; JIFFYPS 50 PAL / 60 NTSC NIMAGES image count ; LOOPFLAG 1 wrap at end, 0 stop ; ss_fgbg (one byte per image, VDC R26 background) is appended by the wrapper. * = $1C20 src = $fb adlo = $fd adhi = $fe cntl = $02 cnth = $03 start: lda #$0e sta $ff00 ; KERNAL + I/O + RAM $4000-$BFFF all visible lda #$00 sta $9d ; suppress KERNAL LOAD messages sta ssidx mainloop: jsr namebuild ; ---- C128 LOAD "NN",8,1 into RAM bank 0 at $4000 ---- lda #$00 ldx #$00 jsr $ff68 ; SETBNK (load bank 0, name bank 0) lda #2 ldx #ssname jsr $ffbd ; SETNAM lda #1 ldx #8 ldy #1 jsr $ffba ; SETLFS (secondary 1 = file's own address) lda #0 jsr $ffd5 ; LOAD ; ---- copy 16384 bytes from $4000 -> VDC $0000 ---- lda #$00 sta src lda #$40 sta src+1 lda #$00 sta adlo sta adhi sta cntl lda #$40 sta cnth jsr copyblk ; ---- per-image global background (R26) + cursor off (R10) ---- ldx ssidx lda ss_fgbg,x ldx #26 jsr vdcw ldx #10 lda #$20 jsr vdcw ; ---- wait for the slide's dwell ---- jsr ss_wait ; ---- advance ---- inc ssidx lda ssidx cmp #NIMAGES bcc mainloop #if LOOPFLAG == 1 lda #$00 sta ssidx jmp mainloop #else rts #endif ; --------------------------------------------------------------------------- ; ; wait -- key / seconds / both, KERNAL GETIN + jiffy clock ($a0-$a2, $a2 = LSB) ; (reuses $fb-$fe as 16-bit scratch now the copy is done) cv_t0 = $fb cv_el = $fd ss_wait: #if WAITMODE == 1 ss_drain: jsr $ffe4 bne ss_drain ; flush leftover keys ss_k: jsr $ffe4 beq ss_k rts #endif #if WAITMODE == 2 lda $a2 sta cv_t0 lda $a1 sta cv_t0+1 ss_s: sec lda $a2 sbc cv_t0 sta cv_el lda $a1 sbc cv_t0+1 sta cv_el+1 lda cv_el+1 cmp #>(WAITSECS*JIFFYPS) bcc ss_s bne ss_sd lda cv_el cmp #<(WAITSECS*JIFFYPS) bcc ss_s ss_sd: rts #endif #if WAITMODE == 3 ss_drain: jsr $ffe4 bne ss_drain lda $a2 sta cv_t0 lda $a1 sta cv_t0+1 ss_b: jsr $ffe4 bne ss_bd ; any key ends the slide sec lda $a2 sbc cv_t0 sta cv_el lda $a1 sbc cv_t0+1 sta cv_el+1 lda cv_el+1 cmp #>(WAITSECS*JIFFYPS) bcc ss_b bne ss_bd lda cv_el cmp #<(WAITSECS*JIFFYPS) bcc ss_b ss_bd: rts #endif ; build the 2-char filename "NN" (PETSCII) from ssidx (0..99) namebuild: lda ssidx ldx #$2f sec nb_ten: inx sbc #10 bcs nb_ten adc #10 ora #$30 sta ssname+1 txa sta ssname rts ; copy cnth/cntl bytes from (src) to VDC RAM starting at adhi/adlo copyblk: ldx #18 lda adhi jsr vdcw ldx #19 lda adlo jsr vdcw ldx #31 ldy #$00 lda (src),y jsr vdcw inc src bne cb1 inc src+1 cb1: inc adlo bne cb2 inc adhi cb2: lda cntl bne cb3 dec cnth cb3: dec cntl lda cntl ora cnth bne copyblk rts vdcw: stx $d600 vw: bit $d600 bpl vw sta $d601 rts ssidx: .byte 0 ssname: .byte $30,$30 ; ss_fgbg table (one byte per image) appended by the build wrapper