8bitlenser/lenser/viewer/slideshow_interlace.s
2026-07-03 19:35:35 -07:00

204 lines
4.4 KiB
ArmAsm

; lenser -- interlace (IFLI) slideshow viewer
;
; Steps through NIMAGES interlace pictures named "00".."NN", each a PRG that
; KERNAL-loads to $2000 with the layout from interlace.s --
; $2000 bitmap A 8000
; $3F40 screen A 1000 (copied to $0400)
; $4400 screen B 1000 (in place, bank 1 video matrix)
; $6000 bitmap B 8000
; $8000 colour RAM 1000 (copied to $D800)
; $83E8 background 1
; A once-per-frame raster IRQ flips VIC bank 0<->1 to blend the two fields; it
; chains to the KERNAL IRQ ($ea31) so GETIN and the jiffy clock work, letting
; wait.i advance on key / seconds / both. All slides are interlace (uniform).
;
; assembled by viewer/assemble.py via xa; NIMAGES / LOOPFLAG / WAITMODE etc. are
; #defined by the generated wrapper.
; BASIC autostart, SYS 2061
* = $0801
.word basicend
.word 10
.byte $9e
.byte "2061"
.byte 0
basicend:
.word 0
SRC = $fb
DST = $fd
start:
lda #$00
sta $9d ; suppress KERNAL LOAD messages
sta ss_idx
sta $d020 ; border black, once
mainloop:
jsr ss_name_build
lda #$0b
sta $d011 ; blank while loading the next field pair
jsr ss_load ; LOAD "NN",8,1 -> $2000 (KERNAL IRQ active)
; ---- interlace setup ----
sei
lda #$ff
sta $cc ; cursor off (so blink can't corrupt $D800)
; screen A $3F40 -> $0400
lda #$40
sta SRC
lda #$3f
sta SRC+1
lda #$00
sta DST
lda #$04
sta DST+1
jsr copy1024
; colour RAM $8000 -> $D800
lda #$00
sta SRC
lda #$80
sta SRC+1
lda #$00
sta DST
lda #$d8
sta DST+1
jsr copy1024
lda $83e8
sta $d021 ; background
lda $dd00
and #$fc
ora #$03
sta $dd00 ; start on VIC bank 0 (frame A)
lda #$18
sta $d018
lda #$d8
sta $d016 ; multicolor on
lda #$3b
sta $d011 ; bitmap mode, display on
lda #<irq
sta $0314
lda #>irq
sta $0315
lda #$7f
sta $dc0d
sta $dd0d
lda $dc0d
lda $dd0d
lda #$01
sta $d01a
lda #$fa
sta $d012 ; line 250
lda $d011
and #$7f
sta $d011
asl $d019
cli
#include "wait.i"
; ---- stop the engine (KERNAL IRQ back on for the next LOAD) ----
sei
lda #$00
sta $d01a ; disable raster IRQ
lda #$81
sta $dc0d ; re-enable CIA timer IRQ
lda #$31
sta $0314
lda #$ea
sta $0315
lda $dd00
ora #$03
sta $dd00 ; back to bank 0
asl $d019
cli
; ---- advance ----
inc ss_idx
lda ss_idx
cmp #NIMAGES
bcc ssgo
#if LOOPFLAG == 1
lda #$00
sta ss_idx
ssgo:
jmp mainloop
#else
jmp ssend
ssgo:
jmp mainloop
ssend:
#endif
; ---- final restore to BASIC ----
lda #$1b
sta $d011
lda #$c8
sta $d016
lda #$15
sta $d018
lda #$0e
sta $d020
lda #$06
sta $d021
lda #$00
sta $cc
jsr $e544
rts
; once per frame, flip bank 0 <-> bank 1, then let the KERNAL IRQ finish
irq:
lda $dd00
eor #$01
sta $dd00
asl $d019
jmp $ea31
ss_load:
lda #2
ldx #<ss_name
ldy #>ss_name
jsr $ffbd ; SETNAM
lda #1
ldx #8
ldy #1
jsr $ffba ; SETLFS (secondary 1 = file's own address)
lda #0
jsr $ffd5 ; LOAD
rts
ss_name_build:
lda ss_idx
ldx #$2f
sec
ssten:
inx
sbc #10
bcs ssten
adc #10
ora #$30
sta ss_name+1
txa
sta ss_name
rts
copy1024:
ldx #4
ldy #0
cploop:
lda (SRC),y
sta (DST),y
iny
bne cploop
inc SRC+1
inc DST+1
dex
bne cploop
rts
ss_idx: .byte 0
ss_name: .byte $30,$30