text: moving text

didn't really work out as I was hoping
This commit is contained in:
Vince Weaver 2021-04-23 20:44:06 -04:00
parent 8345d74e3e
commit ea240f158e
7 changed files with 351 additions and 97 deletions

View File

@ -15,7 +15,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
FASTAR2.BAS BIN.BAS FALLING.BAS SNOW.BAS XMAS.BAS AN3.BAS PLASMA.BAS \ FASTAR2.BAS BIN.BAS FALLING.BAS SNOW.BAS XMAS.BAS AN3.BAS PLASMA.BAS \
C64.BAS SIERPINSKI.BAS FAKES.BAS SIER.BAS DROPS.BAS RR.BAS RR_HGR.BAS \ C64.BAS SIERPINSKI.BAS FAKES.BAS SIER.BAS DROPS.BAS RR.BAS RR_HGR.BAS \
COMBO.BAS WIRES.BAS PATTERN.BAS BALL.BAS LINES.BAS MOD9.BAS \ COMBO.BAS WIRES.BAS PATTERN.BAS BALL.BAS LINES.BAS MOD9.BAS \
XOR_ZOOM.BAS MOD9_HGR.BAS SIER_HGR.BAS XOR_ZOOM.BAS MOD9_HGR.BAS SIER_HGR.BAS MOVE.BAS
# cp $(EMPTY_DISK)/empty.dsk appleiibot.dsk # cp $(EMPTY_DISK)/empty.dsk appleiibot.dsk
cp empty.dsk appleiibot.dsk cp empty.dsk appleiibot.dsk
$(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD $(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD
@ -76,6 +76,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
$(DOS33) -y appleiibot.dsk SAVE A XOR_ZOOM.BAS $(DOS33) -y appleiibot.dsk SAVE A XOR_ZOOM.BAS
$(DOS33) -y appleiibot.dsk SAVE A MOD9_HGR.BAS $(DOS33) -y appleiibot.dsk SAVE A MOD9_HGR.BAS
$(DOS33) -y appleiibot.dsk SAVE A SIER_HGR.BAS $(DOS33) -y appleiibot.dsk SAVE A SIER_HGR.BAS
$(DOS33) -y appleiibot.dsk SAVE A MOVE.BAS
#### ####
@ -194,6 +195,11 @@ SNOW.BAS: snow.bas
#### ####
MOVE.BAS: move.bas
$(TOKENIZE) < move.bas > MOVE.BAS
####
XMAS.BAS: xmas.bas XMAS.BAS: xmas.bas
$(TOKENIZE) < xmas.bas > XMAS.BAS $(TOKENIZE) < xmas.bas > XMAS.BAS

View File

@ -14,8 +14,8 @@
int main(int argc, char **argv) { int main(int argc, char **argv) {
// int mode=END_AT_3F5; int mode=END_AT_3F5;
int mode=BEGIN_AT_3F5; // int mode=BEGIN_AT_3F5;
int i = 0; int i = 0;
int e = 0,filesize; int e = 0,filesize;
int val,pv,final; int val,pv,final;

View File

@ -0,0 +1,2 @@
1FORI=0TO133:POKE882+I,4*PEEK(2125+I)-192+(PEEK(2259+I/3)-35)/4^(I-INT(I/3)*3):NEXT
2&"SkQQYdK<Z/QWN=8akQjPQ+;nT/_/8d27i#73F1W/88b/:2W047i/2PW09_08+]n[/8M8_(7Qd\QoC=cYoHVnc/8jh4b_CK/bOc1JJC]0QoY9L8i6Xo?WCc/2l1T+A7OCH00CI0@:<*0A:W5'5Z4'@*3*$$W44CN#.]5#+A4#0$D3GG#9,#1

View File

@ -7,10 +7,12 @@ EMPTYDISK = ../../empty_disk/empty.dsk
all: textscroll.dsk all: textscroll.dsk
textscroll.dsk: HELLO MOVE textscroll.dsk: HELLO MOVE COMET MOVE_BOT
cp $(EMPTYDISK) textscroll.dsk cp $(EMPTYDISK) textscroll.dsk
$(DOS33) -y textscroll.dsk SAVE A HELLO $(DOS33) -y textscroll.dsk SAVE A HELLO
$(DOS33) -y textscroll.dsk BSAVE -a 0xC00 MOVE $(DOS33) -y textscroll.dsk BSAVE -a 0xC00 MOVE
$(DOS33) -y textscroll.dsk BSAVE -a 0x372 MOVE_BOT
$(DOS33) -y textscroll.dsk BSAVE -a 0xC00 COMET
### ###
@ -25,6 +27,23 @@ MOVE: move.o
move.o: move.s move.o: move.s
ca65 -o move.o move.s -l move.lst ca65 -o move.o move.s -l move.lst
###
MOVE_BOT: move_bot.o
ld65 -o MOVE_BOT move_bot.o -C ./apple2_372.inc
move_bot.o: move_bot.s
ca65 -o move_bot.o move_bot.s -l move_bot.lst
###
COMET: comet.o
ld65 -o COMET comet.o -C $(LINKERSCRIPTS)/apple2_c00.inc
comet.o: comet.s
ca65 -o comet.o comet.s -l comet.lst
#### ####
clean: clean:

View File

@ -0,0 +1,12 @@
MEMORY {
ZP: start = $00, size = $1A, type = rw;
RAM: start = $372, size = $8E00, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = ro, align = $1;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}

View File

@ -1,24 +1,39 @@
; TOKEN D734
; OUTDO (print char in A), calls COUT
; COUT calls ($0036)
CH = $24 CH = $24
CV = $25 CV = $25
BASL = $28 BASL = $28
BASH = $29 BASH = $29
CSWL = $36
SEEDL = $4E SEEDL = $4E
FORPTR = $85
LOWTR = $9B
FACL = $9D FACL = $9D
FACH = $9E FACH = $9E
FRAME = $FA
XSAVE = $FB
STACKSAVE = $FC
YSAV = $FD
COUNT = $FE COUNT = $FE
DRAW_PAGE = $FF DRAW_PAGE = $FF
PAGE0 = $C054 PAGE0 = $C054
GETCHAR = $D72C ; loads (FAC),Y and increments FAC GETCHAR = $D72C ; loads (FAC),Y and increments FAC
TOKEN = $D734
HGR = $F3E2 HGR = $F3E2
SETTXT = $FB39 SETTXT = $FB39
TABV = $FB5B ; store A in CV and call MON_VTAB TABV = $FB5B ; store A in CV and call MON_VTAB
BASCALC = $FBC1
STORADV = $FBF0 ; store A at (BASL),CH, advancing CH, trash Y STORADV = $FBF0 ; store A at (BASL),CH, advancing CH, trash Y
MON_VTAB = $FC22 ; VTAB to CV MON_VTAB = $FC22 ; VTAB to CV
VTABZ = $FC24 ; VTAB to value in A VTABZ = $FC24 ; VTAB to value in A
HOME = $FC58 HOME = $FC58
CLREOL = $FC9C ; clear (BASL),CH to end of line
CLREOLZ = $FC9E ; clear (BASL),Y to end of line
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
COUT = $FDED COUT = $FDED
@ -29,143 +44,137 @@ ypos = $2000
xpos = $2100 xpos = $2100
textl = $2200 textl = $2200
texth = $2300 texth = $2300
which = $2400
move: move:
jsr HGR lda #<lowtr_fake
sta LOWTR
lda #<our_cout
sta CSWL
lda #>lowtr_fake
; lda #>our_cout ; should be same
sta LOWTR+1
sta CSWL+1
jsr HGR ; clear $2000 to 0
; A=0 at end
sta DRAW_PAGE sta DRAW_PAGE
sta FORPTR ; used to trick LIST
jsr SETTXT jsr SETTXT ; set lo-res text mode
next_frame: next_frame:
ldx #0 ldx #0
next_text: next_text:
lda xpos,X lda xpos,X ; load next text xpos
bne not_new bne not_new ; if not zero, continue
new_text: new_text:
jsr random8
and #$1f
adc #$4
sta xpos,X
jsr random8 jsr random8
and #$f and #$f
sta ypos,X adc #$8
sta xpos,X ; get random X value 4...35
jsr random8 jsr random8
and #$7f and #$f
sta COUNT sta ypos,X ; get random Y 0..15
lda #$d0 ; token table at $D0D0 jsr random8
sta FACL ora #$80
sta FACH sta which,X ; random token
ldy #0
find_token_loop:
dec COUNT
bmi found_token
find_token_inner:
inc FACL
bne blargh
inc FACH
blargh:
lda (FACL),Y
bpl find_token_inner
bmi find_token_loop
found_token:
inc FACL
lda FACL
sta textl,X
lda FACH
sta texth,X
not_new: not_new:
lda ypos,X
jsr BASCALC ; (basl) is now right
lda xpos,X lda xpos,X
sta CH sta CH
lda ypos,X
sta CV
jsr MON_VTAB
lda BASH lda BASH
clc clc
adc DRAW_PAGE adc DRAW_PAGE
sta BASH sta BASH
lda textl,X lda which,X
sta text_smc+1
lda texth,X
sta text_smc+2
txa stx XSAVE ; save X
pha
ldx #0 tsx
print_loop: stx STACKSAVE ; save stack
text_smc: jmp TOKEN ; call ROM token code
lda $dddd,X
php after_token:
ora #$80 ldx STACKSAVE ; restore stack
jsr STORADV ; trashes Y :( txs
inx ldx XSAVE ; restore X
plp dec xpos,X ; move left
bpl print_loop inx ; move to next one
cpx #16
big_done:
pla
tax
dec xpos,X
inx
cpx #32
bne next_text bne next_text
; X is 16 here
flip_pages: flip_pages:
ldx #0 ; ldx #0
lda DRAW_PAGE lda DRAW_PAGE
beq done_page beq done_page
inx inx
done_page: done_page:
ldy PAGE0,X ; set display page to PAGE1 or PAGE2 ldy PAGE0-16,X ; set display page to PAGE1 or PAGE2
eor #$4 ; flip draw page between $400/$800 eor #$4 ; flip draw page between $400/$800
sta DRAW_PAGE sta DRAW_PAGE
clc ;===============
adc #$4 ; clear screen
sta BASH
lda #$0
sta BASL
clear_screen_outer: ldx #24
ldy #$f8 clear_screen_loop:
clear_screen_inner: txa
lda #$A0 ; space char jsr BASCALC ; A is BASL at end
sta (BASL),Y ; 100 101 110 111
dey
cpy #$FF
bne clear_screen_inner
inc BASH
lda BASH lda BASH
and #$3 clc
bne clear_screen_outer adc DRAW_PAGE
sta BASH
lda #200 ldy #0
jsr WAIT jsr CLREOLZ
dex
bpl clear_screen_loop
jmp next_frame
; pause
; lda #100
; jsr WAIT
bmi next_frame
our_cout:
cmp #$8d ; list thinks end of line
bne regular_print
pla ; fake rts
pla
jmp after_token
regular_print:
sty YSAV
ldy CH
sta (BASL),Y
inc BASL
ldy YSAV
rts
;============================= ;=============================
@ -176,15 +185,17 @@ clear_screen_inner:
; http://codebase64.org/doku.php?id=base:small_fast_8-bit_prng ; http://codebase64.org/doku.php?id=base:small_fast_8-bit_prng
random8: random8:
lda SEEDL ; 2 lda SEEDL ; 2
beq doEor ; 2 beq doEor ; 2
asl ; 1 asl ; 1
beq noEor ; if the input was $80, skip the EOR ; 2 beq noEor ; if the input was $80, skip the EOR ; 2
bcc noEor ; 2 bcc noEor ; 2
doEor: eor #$1d ; 2 doEor: eor #$1d ; 2
noEor: sta SEEDL ; 2 noEor: sta SEEDL ; 2
rts rts
lowtr_fake:
.byte $00,$00 ; fake end to BASIC program
jmp move

View File

@ -0,0 +1,204 @@
; TOKEN D734
; OUTDO (print char in A), calls COUT
; COUT calls ($0036)
CH = $24
CV = $25
BASL = $28
BASH = $29
CSWL = $36
SEEDL = $4E
FORPTR = $85
LOWTR = $9B
FACL = $9D
FACH = $9E
FRAME = $FA
XSAVE = $FB
STACKSAVE = $FC
YSAV = $FD
COUNT = $FE
DRAW_PAGE = $FF
PAGE0 = $C054
GETCHAR = $D72C ; loads (FAC),Y and increments FAC
TOKEN = $D734
HGR = $F3E2
SETTXT = $FB39
TABV = $FB5B ; store A in CV and call MON_VTAB
BASCALC = $FBC1
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
CLREOL = $FC9C ; clear (BASL),CH to end of line
CLREOLZ = $FC9E ; clear (BASL),Y to end of line
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
COUT = $FDED
COUT1 = $FDF0
COUTZ = $FDF6 ; cout but ignore inverse flag
ypos = $2000
xpos = $2100
textl = $2200
texth = $2300
which = $2400
move:
lda #<lowtr_fake
sta LOWTR
lda #<our_cout
sta CSWL
lda #>lowtr_fake
; lda #>our_cout ; should be same
sta LOWTR+1
sta CSWL+1
jsr HGR ; clear $2000 to 0
; A=0 at end
sta DRAW_PAGE
sta FORPTR ; used to trick LIST
jsr SETTXT ; set lo-res text mode
next_frame:
ldx #0
next_text:
lda xpos,X ; load next text xpos
bne not_new ; if not zero, continue
new_text:
jsr random8
and #$f
adc #$8
sta xpos,X ; get random X value 4...35
jsr random8
and #$f
sta ypos,X ; get random Y 0..15
jsr random8
ora #$80
sta which,X ; random token
not_new:
lda ypos,X
jsr BASCALC ; (basl) is now right
lda xpos,X
sta CH
; lda BASH
; clc
; adc DRAW_PAGE
; sta BASH
lda which,X
stx XSAVE ; save X
tsx
stx STACKSAVE ; save stack
jmp TOKEN ; call ROM token code
after_token:
ldx STACKSAVE ; restore stack
txs
ldx XSAVE ; restore X
dec xpos,X ; move left
inx ; move to next one
cpx #16
bne next_text
; X is 16 here
flip_pages:
; ldx #0
; lda DRAW_PAGE
; beq done_page
; inx
;done_page:
; ldy PAGE0-16,X ; set display page to PAGE1 or PAGE2
; eor #$4 ; flip draw page between $400/$800
; sta DRAW_PAGE
;===============
; clear screen
; ldx #24
clear_screen_loop:
; txa
; jsr BASCALC ; A is BASL at end
; lda BASH
; clc
; adc DRAW_PAGE
; sta BASH
; ldy #0
; jsr CLREOLZ
; dex
; bpl clear_screen_loop
; pause
; lda #100
; jsr WAIT
jmp next_frame
our_cout:
cmp #$8d ; list thinks end of line
bne regular_print
pla ; fake rts
pla
jmp after_token
regular_print:
sty YSAV
ldy CH
sta (BASL),Y
inc BASL
ldy YSAV
rts
;=============================
; 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
lowtr_fake:
.byte $00,$00 ; fake end to BASIC program
; want jump to live at $3F5
; currently at $383
; so want to load at $372
blah:
jmp move