text: sine demo

This commit is contained in:
Vince Weaver 2021-04-26 00:22:06 -04:00
parent 37421f4283
commit 6992ced9e5
5 changed files with 376 additions and 2 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 \
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 \
XOR_ZOOM.BAS MOD9_HGR.BAS SIER_HGR.BAS MOVE.BAS
XOR_ZOOM.BAS MOD9_HGR.BAS SIER_HGR.BAS MOVE.BAS SINE.BAS
# cp $(EMPTY_DISK)/empty.dsk appleiibot.dsk
cp empty.dsk appleiibot.dsk
$(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD
@ -77,6 +77,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
$(DOS33) -y appleiibot.dsk SAVE A MOD9_HGR.BAS
$(DOS33) -y appleiibot.dsk SAVE A SIER_HGR.BAS
$(DOS33) -y appleiibot.dsk SAVE A MOVE.BAS
$(DOS33) -y appleiibot.dsk SAVE A SINE.BAS
####
@ -200,6 +201,11 @@ MOVE.BAS: move.bas
####
SINE.BAS: sine.bas
$(TOKENIZE) < sine.bas > SINE.BAS
####
XMAS.BAS: xmas.bas
$(TOKENIZE) < xmas.bas > XMAS.BAS

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&"V/QaU9N5Ia73U]g,Y^h06BnSP/^e/SL.R73ZQ`0.OW(/b1ejVol0j_A_B$NoP4R+]nX:6BnQ:X06Wo^3kZb8RmifAM,7@DDC=7GF8=;DA850%.0/00000+/0!-0-0110P0PCI04^5Y760@@@O0X4C/0$3WEW(@$+5$CE6#4&<UR)#7a3$#1

View File

@ -7,12 +7,14 @@ EMPTYDISK = ../../empty_disk/empty.dsk
all: textscroll.dsk
textscroll.dsk: HELLO MOVE COMET MOVE_BOT
textscroll.dsk: HELLO MOVE COMET MOVE_BOT SINE SINE_BOT
cp $(EMPTYDISK) textscroll.dsk
$(DOS33) -y textscroll.dsk SAVE A HELLO
$(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
$(DOS33) -y textscroll.dsk BSAVE -a 0xC00 SINE
$(DOS33) -y textscroll.dsk BSAVE -a 0x372 SINE_BOT
###
@ -37,6 +39,23 @@ move_bot.o: move_bot.s
###
SINE: sine.o
ld65 -o SINE sine.o -C $(LINKERSCRIPTS)/apple2_c00.inc
sine.o: sine.s
ca65 -o sine.o sine.s -l sine.lst
###
SINE_BOT: sine_bot.o
ld65 -o SINE_BOT sine_bot.o -C ./apple2_372.inc
sine_bot.o: sine_bot.s
ca65 -o sine_bot.o sine_bot.s -l sine_bot.lst
###
COMET: comet.o
ld65 -o COMET comet.o -C $(LINKERSCRIPTS)/apple2_c00.inc

185
textmode/textscroll/sine.s Normal file
View File

@ -0,0 +1,185 @@
; 134 bytes -- start
; 127 bytes -- merge ypos into one lookup
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
SET_GR = $C050
SET_TEXT = $C051
PAGE0 = $C054
GETCHAR = $D72C ; loads (FAC),Y and increments FAC
TOKEN = $D734
HGR = $F3E2
COSTBL = $F5BA
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 #0
sta DRAW_PAGE
next_frame:
ldy #39
text_loop:
tya ; get YY to print at
clc
adc FRAME
and #$f
tax
lda cosine,X ; get cosine (need to rol*3 into BASL/BASH)
sta BASL
asl BASL
rol
asl BASL
rol
asl BASL
rol
; asl BASL
; rol
and #$0f
clc
adc DRAW_PAGE
sta BASH
; tay
; lda gr_offsetsh,Y
; clc
; adc DRAW_PAGE
; sta smc+2
; lda gr_offsetsl,Y
; sta smc+1
;
tya
and #$f
taX
lda apple,X
ora #$80
;smc:
; sta $400,X
sta (BASL),Y
dey
bpl text_loop
flip_pages:
; Y is $FF at this point
; ldy #0
iny
lda DRAW_PAGE
beq done_page
iny
done_page:
ldx PAGE0,Y ; 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 #200
jsr WAIT
inc FRAME
; bmi grmode
; bit SET_TEXT
; jmp next_frame
;grmode:
; bit SET_GR
jmp next_frame
apple:
; .byte "][ ELPPA"
.byte " APPLE ][ 4EVER "
cosine:
; .byte 3,3,3,2,2,1,0,0,0,0,0,1,1,2,3,3
; .byte $7d,$7d,$7d,$75,$75,$6d,$65,$65,$65,$65,$65,$6d,$6d,$75,$7d,$7d
.byte $fa,$fa,$fa,$ea,$ea,$da,$ca,$ca,$ca,$ca,$ca,$da,$da,$ea,$fa,$fa
; 0111 1101 0111 0101 0110 0101 0110 1101
;gr_offsetsh:
; .byte $4,$4,$5,$5
;gr_offsetsl:
; .byte $00,$80,$00,$80
;gr_offsetsh:
; .byte $6,$6,$7,$7
;gr_offsetsl:
; .byte $50,$d0,$50,$d0
blah:
; want this to be at $3F5, is at $383
jmp move

View File

@ -0,0 +1,162 @@
; 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
SET_GR = $C050
SET_TEXT = $C051
PAGE0 = $C054
GETCHAR = $D72C ; loads (FAC),Y and increments FAC
TOKEN = $D734
HGR = $F3E2
COSTBL = $F5BA
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 #0
sta DRAW_PAGE
; jsr SETTXT ; set lo-res text mode
; jsr HOME
next_frame:
ldx #39
text_loop:
txa
clc
adc FRAME
and #$f
tay
lda cosine,Y
tay
lda gr_offsetsh,Y
clc
adc DRAW_PAGE
sta smc+2
lda gr_offsetsl,Y
sta smc+1
txa
and #$f
tay
lda apple,Y
ora #$80
smc:
sta $400,X
dex
bpl text_loop
flip_pages:
; X is $FF at this point
; ldx #0
inx
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
;===============
; 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 #200
jsr WAIT
inc FRAME
; bmi grmode
; bit SET_TEXT
; jmp next_frame
;grmode:
; bit SET_GR
jmp next_frame
apple:
; .byte "][ ELPPA"
.byte " APPLE ][ 4EVER "
cosine:
.byte 3,3,3,2,2,1,0,0,0,0,0,1,1,2,3,3
gr_offsetsh:
.byte $4,$4,$5,$5
gr_offsetsl:
.byte $00,$80,$00,$80
blah:
; want this to be at $3F5, is at $383
; so load at $372
jmp move