gr: scroll: random bot fits

This commit is contained in:
Vince Weaver 2022-05-03 00:36:58 -04:00
parent ab46040837
commit 0d9db2963f
4 changed files with 115 additions and 61 deletions

View File

@ -22,7 +22,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
OVAL.BAS OVAL_HGR.BAS MOVING.BAS THICK_SINE.BAS TURKEY.BAS \ OVAL.BAS OVAL_HGR.BAS MOVING.BAS THICK_SINE.BAS TURKEY.BAS \
FLAME_HGR.BAS RECT.BAS SNOWY.BAS EDGAR.BAS OOPS4.BAS OOPS3.BAS \ FLAME_HGR.BAS RECT.BAS SNOWY.BAS EDGAR.BAS OOPS4.BAS OOPS3.BAS \
HORROR.BAS DIAMOND.BAS LEMM.BAS OOPS.BAS SPLIT.BAS PARTICLE.BAS \ HORROR.BAS DIAMOND.BAS LEMM.BAS OOPS.BAS SPLIT.BAS PARTICLE.BAS \
PARTICLE_HGR.BAS DIAMOND_SCROLL.BAS PARTICLE_HGR.BAS DIAMOND_SCROLL.BAS RANDOM_SCROLL.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
@ -120,6 +120,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
$(DOS33) -y appleiibot.dsk SAVE A PARTICLE.BAS $(DOS33) -y appleiibot.dsk SAVE A PARTICLE.BAS
$(DOS33) -y appleiibot.dsk SAVE A PARTICLE_HGR.BAS $(DOS33) -y appleiibot.dsk SAVE A PARTICLE_HGR.BAS
$(DOS33) -y appleiibot.dsk SAVE A DIAMOND_SCROLL.BAS $(DOS33) -y appleiibot.dsk SAVE A DIAMOND_SCROLL.BAS
$(DOS33) -y appleiibot.dsk SAVE A RANDOM_SCROLL.BAS
#### ####
@ -678,5 +679,11 @@ DIAMOND_SCROLL.BAS: diamond_scroll.bas
#### ####
RANDOM_SCROLL.BAS: random_scroll.bas
$(TOKENIZE) < random_scroll.bas > RANDOM_SCROLL.BAS
####
clean: clean:
rm -f *~ *.o *.lst convert_to convert_from convert_qkumba convert_vmw make_boxes convert_back convert_tgreene LOAD *.BAS make_hgr_boxes rm -f *~ *.o *.lst convert_to convert_from convert_qkumba convert_vmw make_boxes convert_back convert_tgreene LOAD *.BAS make_hgr_boxes

View File

@ -0,0 +1,2 @@
1FORI=0TO140:POKE875+I,4*PEEK(2125+I)-204+(PEEK(2266+I/3)-35)/4^(I-INT(I/3)*3):NEXT
2&"/fo<HcPqTh35I3Tq]e;]rXPY22]b3oWrU7p9OQ3I4=-ST/8\qMSTrWeKrOq=+ehP2U8Dq8M@N;\h35E;T0X6Uk3D]3Ei3Ek3Q2]iU<I4ma6h_Q3Rp]bHcD3F@0rfpqdhr$oTKWZQr37J3S+4M4(#/P$$#`4Z6'$98FQ/'<M@VX)YY;JS5aL#(b8X_b2_

View File

@ -18,8 +18,7 @@ scroller.dsk: $(DOS33) HELLO DIAMOND DIAMOND_BOT RANDOM RANDOM_BOT
$(DOS33) -y scroller.dsk BSAVE -a 0xc00 DIAMOND $(DOS33) -y scroller.dsk BSAVE -a 0xc00 DIAMOND
$(DOS33) -y scroller.dsk BSAVE -a 0x36B DIAMOND_BOT $(DOS33) -y scroller.dsk BSAVE -a 0x36B DIAMOND_BOT
$(DOS33) -y scroller.dsk BSAVE -a 0xc00 RANDOM $(DOS33) -y scroller.dsk BSAVE -a 0xc00 RANDOM
# $(DOS33) -y scroller.dsk BSAVE -a 0x36B RANDOM_BOT $(DOS33) -y scroller.dsk BSAVE -a 0x36B RANDOM_BOT
$(DOS33) -y scroller.dsk BSAVE -a 0xc00 RANDOM_BOT
### ###
@ -54,8 +53,7 @@ random.o: random.s
RANDOM_BOT: random_bot.o RANDOM_BOT: random_bot.o
# ld65 -o RANDOM_BOT random_bot.o -C $(LINKERSCRIPTS)/apple2_36b.inc ld65 -o RANDOM_BOT random_bot.o -C $(LINKERSCRIPTS)/apple2_36b.inc
ld65 -o RANDOM_BOT random_bot.o -C $(LINKERSCRIPTS)/apple2_c00.inc
random_bot.o: random_bot.s random_bot.o: random_bot.s
ca65 -o random_bot.o random_bot.s -l random_bot.lst ca65 -o random_bot.o random_bot.s -l random_bot.lst

View File

@ -1,7 +1,15 @@
; random scroll bot ; random scroll bot
; 126 bytes ; 162 bytes -- working code
; 124 bytes (optimize PAGE load) ; 158 bytes -- play with bitmap
; 156 bytes -- use HGR2 to init screen (and A)
; 155 bytes -- remove use of LINE count
; 155 bytes -- use ZP for output
; 153 bytes -- count X backwards
; 150 bytes -- use $28 to center Y trick
; 146 bytes -- inline update scroll, makes it scroll right rather than up
; 144 bytes -- share common sta OUTH
; 141 bytes -- more wrapping loop stuff
; ***** ***** ; ***** *****
; ***** ***** ; ***** *****
@ -19,6 +27,7 @@ PAGE1 = $C054
PAGE2 = $C055 PAGE2 = $C055
LORES = $C056 ; Enable LORES graphics LORES = $C056 ; Enable LORES graphics
HGR2 = $F3D8
PLOT = $F800 ; PLOT AT Y,A (A colors output, Y preserved) PLOT = $F800 ; PLOT AT Y,A (A colors output, Y preserved)
GBASCALC = $F847 ; Y in A, put addr in GBASL/GBASH GBASCALC = $F847 ; Y in A, put addr in GBASL/GBASH
SETGR = $FB40 SETGR = $FB40
@ -27,8 +36,8 @@ WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
GBASL = $26 GBASL = $26
GBASH = $27 GBASH = $27
B1 = $FC OUTL = $FC
B2 = $FD OUTH = $FD
PAGE = $FE PAGE = $FE
LINE = $FF LINE = $FF
@ -37,57 +46,83 @@ pattern1 = $f000 ; location in memory
random: random:
jsr SETGR ; set LORES jsr HGR2 ; set HIRES, FULLSCREEN
bit FULLGR ; display FULLSCREEN bit LORES ; set LORES
lda #$0 ; reset to beginning ; A is 0 from HGR2
sta PAGE sta OUTL
random_loop: ; lda #$4
main_loop:
sta PAGE ; start at page 1
asl ; make OUTH $4 or $8 depending on value in PAGE
; which we have in A above or at end of loop
asl ; C is 0
adc #4
sta OUTH
lda #200
jsr WAIT
lda #8 ; lines to count (*3=24)
sta LINE
;============================ ;============================
; draw an interleaved line ; draw an interleaved line
line_loop: line_loop:
ldx #119 ldy #119
screen_loop: screen_loop:
txa ; extrapolate Y from X tya ; extrapolate Y from X
and #$7 and #$7
tay tax
pattern_smc: pattern_smc:
lda pattern1,Y lda pattern1,X
inner_loop_smc: inner_loop_smc:
sta $400,X
dex sta (OUTL),Y
dey
bpl screen_loop bpl screen_loop
;================================= ;=================================
; move to next pattern ; move to next pattern
; assume we are in same 256 byte page (so high byte never change)
jsr scroll_pattern ; jsr scroll_pattern
scroll_pattern:
clc
lda pattern_smc+1
adc #8
and #$1f
sta pattern_smc+1
; rts
; move to next line ; move to next line
clc clc
lda inner_loop_smc+1 lda OUTL
adc #$80 adc #$80
sta inner_loop_smc+1 ; FIXME just inc if carry set sta OUTL
bcc noflo
inc inner_loop_smc+2
noflo:
dec LINE bcc line_loop
; A is $00 if we get here
adc OUTH
sta OUTH
and #$3
bne line_loop bne line_loop
done_bg:
;======================================= ;=======================================
; done drawing frame ; done drawing frame
;======================================= ;=======================================
@ -96,38 +131,39 @@ noflo:
;====================== ;======================
; draw bitmap ; draw bitmap
ldx #0 ldx #7
boxloop: boxloop:
txa txa
clc jsr GBASCALC ; calc address of X
adc #8 ; note we center to middle of screen
jsr GBASCALC ; by noting the middle 8 lines
; are offset by $28 from first 8 lines
; GBASL is in A at this point ; GBASL is in A at this point
clc clc
adc #12 adc #12+$28
sta GBASL sta GBASL ; center x-coord and y-coord at same time
lda PAGE
lda PAGE ; want to add 0 or 4 (not 0 or 1)
asl asl
asl asl ; this sets C to 0
; clc
adc GBASH adc GBASH
sta GBASH sta GBASH
lda bitmap,X
sta B1
lda bitmap2,X
sta B2
ldy #15 ldy #15
draw_line_loop: draw_line_loop:
lda #$00 lda bitmap2,X ; get low bit of bitmap2 into carry
ror B1 lsr
ror B2
lda #$00 ; black is default color
ror bitmap,X ; 16-bit rotate (in memory)
ror bitmap2,X
bcc its_black bcc its_black
lda #$ff lda #$ff
@ -137,15 +173,18 @@ its_black:
dey dey
bpl draw_line_loop bpl draw_line_loop
inx dex
cpx #8 bpl boxloop
bne boxloop
;========================= ;=========================
; scroll one line ; scroll one line
jsr scroll_pattern ; jsr scroll_pattern
; to scroll up need to add 8?
inc pattern_smc+1
; switch page ; switch page
lda PAGE lda PAGE
@ -154,24 +193,28 @@ its_black:
ldy PAGE1,X ; flip page ldy PAGE1,X ; flip page
eor #$1 eor #$1
sta PAGE ; is 4 or 8 ; sta PAGE ; is 0 or 1
; reset page smc ; reset page smc
asl ; OUTH is either C00 or 800
asl ; want C00 to go to 400 and 800 to stay the same
; clc
adc #4
sta inner_loop_smc+2
lda #200 ; asl
jsr WAIT ; asl ; C is 0
; adc #4
; sta OUTH
; lda #200
; jsr WAIT
; A is 0 after ; A is 0 after
beq random_loop jmp main_loop ; bra
.if 0
scroll_pattern: scroll_pattern:
clc clc
lda pattern_smc+1 lda pattern_smc+1
@ -180,6 +223,8 @@ scroll_pattern:
sta pattern_smc+1 sta pattern_smc+1
rts rts
.endif
;01234567|01234567 ;01234567|01234567
; ;
; @@@@ @@@@ ; @@@@ @@@@
@ -213,6 +258,8 @@ bitmap2:
; want this at $3F5 ; want this at $3F5
; we are 141 bytes long, so 36b
jmp random jmp random