101 lines
2.4 KiB
ArmAsm
101 lines
2.4 KiB
ArmAsm
; lenser -- multicolor (Koala) bitmap viewer (self-contained)
|
|
;
|
|
; The picture data is appended to this program by the exporter and loads in one
|
|
; pass, so no second disk access is needed. Fixed memory layout after load:
|
|
; $0801 this program (BASIC stub + ML, padded up to $2000)
|
|
; $2000 bitmap 8000 (VIC reads here directly)
|
|
; $3F40 screen 1000 (copied to $0400)
|
|
; $4328 colram 1000 (copied to $D800)
|
|
; $4710 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 ; ML begins at $080D
|
|
|
|
SRC = $fb
|
|
DST = $fd
|
|
|
|
start:
|
|
#include "loaddata.i"
|
|
lda #$0b
|
|
sta $d011 ; blank screen during setup
|
|
|
|
; copy screen RAM $3F40 -> $0400
|
|
lda #$40
|
|
sta SRC
|
|
lda #$3f
|
|
sta SRC+1
|
|
lda #$00
|
|
sta DST
|
|
lda #$04
|
|
sta DST+1
|
|
jsr copy1024
|
|
|
|
; copy colour RAM $4328 -> $D800
|
|
lda #$28
|
|
sta SRC
|
|
lda #$43
|
|
sta SRC+1
|
|
lda #$00
|
|
sta DST
|
|
lda #$d8
|
|
sta DST+1
|
|
jsr copy1024
|
|
|
|
; program the VIC-II
|
|
lda $dd00
|
|
ora #$03
|
|
sta $dd00 ; VIC bank 0 ($0000-$3FFF)
|
|
lda $4710
|
|
sta $d021 ; background colour
|
|
lda #$00
|
|
sta $d020 ; border black
|
|
lda #$18
|
|
sta $d018 ; screen $0400, bitmap $2000
|
|
lda #$d8
|
|
sta $d016 ; multicolor mode on
|
|
lda #$3b
|
|
sta $d011 ; bitmap mode, display on
|
|
lda #$ff
|
|
sta $cc ; disable cursor blink
|
|
|
|
#include "wait.i"
|
|
|
|
; restore text mode and return to BASIC
|
|
lda #$1b
|
|
sta $d011
|
|
lda #$c8
|
|
sta $d016
|
|
lda #$15
|
|
sta $d018
|
|
lda #$0e
|
|
sta $d020 ; restore default border (light blue)
|
|
lda #$06
|
|
sta $d021 ; and background (blue) for a clean BASIC screen
|
|
lda #$00
|
|
sta $cc
|
|
jsr $e544 ; clear screen
|
|
rts
|
|
|
|
; copy 1024 bytes from (SRC) to (DST)
|
|
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
|