139 lines
3.2 KiB
ArmAsm
139 lines
3.2 KiB
ArmAsm
; c64view -- multicolor interlace viewer (self-contained)
|
|
;
|
|
; Shows two multicolor frames on alternating fields by flipping the VIC bank in a
|
|
; once-per-frame raster IRQ (no cycle-exact timing needed, so it is robust).
|
|
; Frame A lives in bank 0 (bitmap $2000, screen $0400); frame B in bank 1 (bitmap
|
|
; $6000, screen $4400). Both use $D018=$18; only the $DD00 bank bit toggles.
|
|
;
|
|
; Memory layout of appended data (loads from $2000):
|
|
; $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
|
|
;
|
|
; assembled by viewer/assemble.py via xa
|
|
|
|
; BASIC autostart, SYS 2061
|
|
* = $0801
|
|
.word basicend
|
|
.word 10
|
|
.byte $9e
|
|
.byte "2061"
|
|
.byte 0
|
|
basicend:
|
|
.word 0
|
|
|
|
SRC = $fb
|
|
DST = $fd
|
|
|
|
start:
|
|
sei
|
|
|
|
; 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 #$00
|
|
sta $d020 ; border black
|
|
lda $dd00
|
|
and #$fc
|
|
ora #$03
|
|
sta $dd00 ; start on VIC bank 0 (frame A)
|
|
lda #$18
|
|
sta $d018 ; screen $x400, bitmap $x000+$2000
|
|
lda #$d8
|
|
sta $d016 ; multicolor on
|
|
lda #$3b
|
|
sta $d011 ; bitmap mode, display on
|
|
|
|
; frame-flip raster IRQ near the bottom border
|
|
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
|
|
|
|
waitkey:
|
|
jsr $ffe4 ; GETIN (scanned via our IRQ -> $ea31)
|
|
beq waitkey
|
|
|
|
; restore text mode + KERNAL IRQ
|
|
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 #$1b
|
|
sta $d011
|
|
lda #$c8
|
|
sta $d016
|
|
lda #$15
|
|
sta $d018
|
|
lda $dd00
|
|
ora #$03
|
|
sta $dd00
|
|
asl $d019
|
|
cli
|
|
jsr $e544 ; clear screen
|
|
rts
|
|
|
|
; once per frame, flip bank 0 <-> bank 1, then let the KERNAL IRQ finish
|
|
irq:
|
|
lda $dd00
|
|
eor #$01
|
|
sta $dd00
|
|
asl $d019 ; ack raster IRQ
|
|
jmp $ea31 ; KERNAL housekeeping (keyboard) + RTI
|
|
|
|
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
|