dos33fsprogs/fire/raster.s

129 lines
2.5 KiB
ArmAsm
Raw Normal View History

2019-01-12 20:50:34 +00:00
; Apple ][ Lo-res rasterbars, size-optimized
2019-01-09 05:33:15 +00:00
; by deater (Vince Weaver) <vince@deater.net>
; Zero Page
WNDTOP = $22
WNDBTM = $23
CV = $25
BASL = $28
BASH = $29
BAS2L = $2A
BAS2H = $2B
SEEDL = $4E
; Soft Switches
SET_GR = $C050 ; Enable graphics
MIXCLR = $C052 ; Full screen, no text at bottom
LORES = $C056 ; Enable LORES graphics
; Monitor ROM routines. Try to use well-known entry points as
; these did sometimes change with newer models
SCROLL = $FC70
VTAB = $FC22 ; takes row in CV, Result is in BASL:BASH ($28/$29)
VTABZ = $FC24 ; VTABZ variant takes row in Accumulator
2019-01-13 05:30:01 +00:00
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
2019-01-12 20:50:34 +00:00
raster_demo:
2019-01-09 05:33:15 +00:00
; Set lores graphics
bit SET_GR ; force graphics mode ; 3
; LORES and LOWSCR (lo-res page1)
; are set by the boot rom
bit MIXCLR ; want full-screen graphics w/o mixed ; 3
; text the boot process doesn't set this
; (it doesn't matter in text mode)
; and while IIe and emulators come up clear
; my Apple II+ doesn't
; Set window. This seems to be set properly at boot though
; lda #0
; sta WNDTOP
; lda #24
; sta WNDBTM
2019-01-12 20:50:34 +00:00
reset_scroll:
2019-01-13 05:30:01 +00:00
2019-01-12 20:50:34 +00:00
jsr random8
sta CV
2019-01-09 05:33:15 +00:00
scroll_loop:
2019-01-13 05:30:01 +00:00
lda #$80
jsr WAIT
2019-01-09 05:33:15 +00:00
jsr SCROLL ; scrolls screen up one row ; 3
;======================================
; re-draw bottom line (row 23) as white
; Y is left at 40 after SCROLL
; also BAS2L:BAS2H is left at $7d0
; this code over-writes $7F8 (the MSLOT screen hole value)
; but this should not matter for this demo
2019-01-12 20:50:34 +00:00
lda CV
and #7
tax
lda <color_progression,X
; lda #$ff ; top/bottom white ; 2
2019-01-09 05:33:15 +00:00
w_loop:
sta (BAS2L),Y ; hline 23 (46+47) ; 2
dey ; 1
bpl w_loop ; 2
;============
; 8
2019-01-12 20:50:34 +00:00
no_change:
dec CV ; 2
bpl reset_scroll ; 2
bmi scroll_loop ; 2
color_progression:
2019-01-14 04:37:49 +00:00
; .byte $04 ; black / d.green
; .byte $cf ; l.green / white
; .byte $c4 ; l.green / d.green
.byte $03 ; black / purple
.byte $bf ; pink / white
.byte $b3 ; pink / purple
2019-01-12 20:50:34 +00:00
.byte $00
.byte $00
2019-01-14 04:37:49 +00:00
.byte $02 ; black/ dblue
.byte $6f ; med blue / white
.byte $62 ; med blue / dblue
2019-01-12 20:50:34 +00:00
2019-01-09 05:33:15 +00:00
;=============================
; random8
;=============================
; 8-bit 6502 Random Number Generator
; Linear feedback shift register PRNG by White Flame
; http://codebase64.org/doku.php?id=base:small_fast_8-bit_prng
random8:
2019-01-12 20:50:34 +00:00
lda SEEDL ; 2
2019-01-09 05:33:15 +00:00
beq doEor ; 2
asl ; 1
beq noEor ; if the input was $80, skip the EOR ; 2
bcc noEor ; 2
doEor: eor #$1d ; 2
2019-01-12 20:50:34 +00:00
noEor: sta SEEDL ; 2
rts