rotate: add sound

This commit is contained in:
Vince Weaver 2022-01-25 22:20:22 -05:00
parent b317bb7d8e
commit ab9d7040b8
4 changed files with 148 additions and 40 deletions

View File

@ -20,7 +20,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
STAROOPS.BAS HGRSTARFIELD.BAS COOL_BOT.BAS WEB.BAS ORB.BAS \
FIREWORKS.BAS THINKING.BAS ARCS.BAS WIRE_HGR.BAS STATIC.BAS \
OVAL.BAS OVAL_HGR.BAS MOVING.BAS THICK_SINE.BAS TURKEY.BAS \
FLAME_HGR.BAS RECT.BAS SNOWY.BAS EDGAR.BAS
FLAME_HGR.BAS RECT.BAS SNOWY.BAS EDGAR.BAS OOPS4.BAS OOPS3.BAS
# cp $(EMPTY_DISK)/empty.dsk appleiibot.dsk
cp empty.dsk appleiibot.dsk
$(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD
@ -108,6 +108,8 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
$(DOS33) -y appleiibot.dsk SAVE A RECT.BAS
$(DOS33) -y appleiibot.dsk SAVE A SNOWY.BAS
$(DOS33) -y appleiibot.dsk SAVE A EDGAR.BAS
$(DOS33) -y appleiibot.dsk SAVE A OOPS4.BAS
$(DOS33) -y appleiibot.dsk SAVE A OOPS3.BAS
####
@ -598,6 +600,17 @@ EDGAR.BAS: edgar.bas
####
OOPS4.BAS: oops4.bas
$(TOKENIZE) < oops4.bas > OOPS4.BAS
####
OOPS3.BAS: oops3.bas
$(TOKENIZE) < oops3.bas > OOPS3.BAS
####
FIREWORKS.BAS: fireworks.bas
$(TOKENIZE) < fireworks.bas > FIREWORKS.BAS

View File

@ -0,0 +1,2 @@
1FORI=0TO68:POKE1013+I,4*PEEK(2125+I)-204+(PEEK(2194+I/3)-35)/4^(I-INT(I/3)*3):NEXT
2&"/foT5aXnEDMKYS3TNEn@M2Y[2XW]3eYll5kmapU9rO&BrPk\e:B\aO3[38Hpap\kmgbljSAJ)$46''$U+Q/Y4Z'#/Q#S

View File

@ -0,0 +1,2 @@
1FORI=0TO68:POKE1013+I,4*PEEK(2125+I)-204+(PEEK(2194+I/3)-35)/4^(I-INT(I/3)*3):NEXT
2&"/foT5aXnEDYS2XOBrAI2YW2XV]3ceom7l_irI9rI2EqTlUq=>\aK2MK[38Hpap\kmginjSAJ)'043'+$[U;*@63#/Q#5

View File

@ -1,5 +1,9 @@
; rotate
; 117 bytes -- original
; 114 bytes -- optimize FRAME init
; 108 bytes -- optimize page flip
; zero page
sinetable=$70
HGR_X = $E0
@ -28,8 +32,7 @@ WAIT = $FCA8
;================================
thick_sine:
jsr HGR
; jsr HGR2 ; set hi-res 140x192, page2, fullscreen
jsr HGR ; set hi-res 140x192, page1
; A and Y both 0 at end
; try to get sine table from ROM
@ -66,50 +69,142 @@ force_zero:
beq force_zero
bpl sinetable_loop
;======================================
; draw log #1
;======================================
; x is FF at this point
inx
stx FRAME
stx HGR_COLOR ; set color to white
jsr draw_sine
inx ; X must be 0
jsr draw_log
; X is 0 here
;======================================
; draw log #1
;======================================
jsr HGR2 ; set hi-res 140x192, page2, fullscreen
; A and Y both 0 at end
sty FRAME
inc invert_smc+1
jsr draw_sine
inc invert_smc+1 ; draw the opposite pattern
jsr draw_log ; X must be 0
;======================================
; flip pages, forever
;======================================
; X is 0 entering
flip_loop:
; flip draw page $20/$40
lda HGR_PAGE
eor #$60
sta HGR_PAGE
; flip pages
; flip page
; have $20/$40 want to map to C054/C055
page_smc:
bit PAGE1
asl
asl ; $20 -> C=1 $00
asl ; $40 -> C=0 $00
rol
tax
sta PAGE1,X
lda #255
jsr WAIT
; lda #255
; jsr WAIT
; based on code from here
; http://eightbitsoundandfury.ld8.org/programming.html
; A,X,Y trashed
; duration also trashed
NOTE_C3 = 255
NOTE_CSHARP3 = 241
NOTE_D3 = 227
NOTE_DSHARP3 = 214
NOTE_E3 = 202
NOTE_F3 = 191
NOTE_FSHARP3 = 180
NOTE_G3 = 170
NOTE_GSHARP3 = 161
NOTE_A3 = 152
NOTE_ASHARP3 = 143
NOTE_B3 = 135
NOTE_C4 = 128
NOTE_CSHARP4 = 121
NOTE_D4 = 114
NOTE_DSHARP4 = 108
NOTE_E4 = 102
NOTE_F4 = 96
NOTE_FSHARP4 = 91
NOTE_G4 = 85
NOTE_GSHARP4 = 81
NOTE_A4 = 76
NOTE_ASHARP4 = 72
NOTE_B4 = 68
NOTE_C5 = 64
NOTE_CSHARP5 = 60
NOTE_D5 = 57
NOTE_DSHARP5 = 54
NOTE_E5 = 51
NOTE_F5 = 48
NOTE_FSHARP5 = 45
NOTE_G5 = 43
NOTE_GSHARP5 = 40
NOTE_A5 = 38
NOTE_ASHARP5 = 36
NOTE_B5 = 34
lda #NOTE_C3
sta speaker_frequency
lda #200
sta speaker_duration
speaker_beep:
ldy #20
speaker_tone:
lda $C030 ; click speaker
speaker_loop:
dey ; y never set?
bne slabel1 ; duration roughly 256*?
dec speaker_duration ; (Duration)
beq done_tone
slabel1:
dex
bne speaker_loop
ldx speaker_frequency ; (Frequency)
jmp speaker_tone
done_tone:
lda page_smc+1
eor #$1
sta page_smc+1
jmp flip_loop
;============================
; main loop
;============================
; draw log
;============================
;============================
draw_sine:
draw_log:
stx FRAME
draw_sine_loop:
; X is 0 here, either from above, or from end of loop
ldx #0 ; HGR_X
@ -120,18 +215,13 @@ draw_sine:
; X is zero here
; 10 bytes to flip color (was 14)
; txa
lda #$FF
bit FRAME
bvc color_white
bvc not_done
rts
rts ; done
not_done:
; eor #$FF
color_white:
sta HGR_COLOR
circle_loop:
@ -152,10 +242,7 @@ skip_invert:
tay
lda sinetable,Y
; multiply by 2 and center on screen $60 is midscreen
; asl
; clc
; center on screen $60 is midscreen
adc #$60
@ -170,6 +257,10 @@ skip_invert:
bne circle_loop
beq draw_sine
beq draw_sine_loop
speaker_duration:
.res 1
speaker_frequency:
.res 1