text: move: have things moving

too big
This commit is contained in:
Vince Weaver 2021-04-21 00:35:48 -04:00
parent fad5af7ac2
commit a93f95f54e
1 changed files with 78 additions and 7 deletions

View File

@ -1,7 +1,13 @@
CH = $24
CV = $25
BASL = $28
BASH = $29
SEEDL = $4E
DRAW_PAGE = $FF
PAGE0 = $C054
HGR = $F3E2
SETTXT = $FB39
@ -10,6 +16,7 @@ STORADV = $FBF0 ; store A at (BASL),CH, advancing CH, trash Y
MON_VTAB = $FC22 ; VTAB to CV
VTABZ = $FC24 ; VTAB to value in A
HOME = $FC58
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
COUT = $FDED
COUT1 = $FDF0
@ -20,6 +27,9 @@ xpos = $2100
move:
jsr HGR
sta DRAW_PAGE
jsr SETTXT
@ -30,14 +40,16 @@ next_text:
bne not_new
new_text:
lda #30
jsr random8
and #$1f
adc #$4
sta xpos,X
txa
jsr random8
and #$f
sta ypos,X
not_new:
lda xpos,X
sta CH
@ -46,19 +58,27 @@ not_new:
jsr MON_VTAB
lda BASH
clc
adc DRAW_PAGE
sta BASH
txa
pha
ldx #0
big_loop:
print_loop:
lda text,X
bmi big_done
php
ora #$80
jsr STORADV
inx
bne big_loop
plp
bpl print_loop
big_done:
@ -71,10 +91,61 @@ big_done:
cpx #20
bne next_text
jsr HOME
flip_pages:
ldx #0
lda DRAW_PAGE
beq done_page
inx
done_page:
ldy PAGE0,X ; set display page to PAGE1 or PAGE2
eor #$4 ; flip draw page between $400/$800
sta DRAW_PAGE
clc
adc #$4
sta BASH
lda #$0
sta BASL
clear_screen_outer:
ldy #$f8
clear_screen_inner:
lda #$A0 ; space char
sta (BASL),Y ; 100 101 110 111
dey
cpy #$FF
bne clear_screen_inner
inc BASH
lda BASH
and #$3
bne clear_screen_outer
lda #$50
jsr WAIT
jmp next_frame
;=============================
; 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:
lda SEEDL ; 2
beq doEor ; 2
asl ; 1
beq noEor ; if the input was $80, skip the EOR ; 2
bcc noEor ; 2
doEor: eor #$1d ; 2
noEor: sta SEEDL ; 2
rts
text:
.byte "HELL",'O'|$80