love_duck: back in size

This commit is contained in:
Vince Weaver 2023-02-08 22:51:58 -05:00
parent 123f76aa70
commit 9d1231184f
6 changed files with 108 additions and 124 deletions

View File

@ -7,7 +7,7 @@ PICTUREDSK = ~/research/picturedsk.git/picturedsk
LINKER_SCRIPTS = ../../../linker_scripts/
ZX02 = ~/research/6502_compression/zx02.git/build/zx02
all: love_duck.dsk love_duck.woz love_duck_raw.dsk
all: love_duck.dsk love_duck.woz
###
@ -71,7 +71,7 @@ love_duck.zip: LOVE_DUCK love_duck.dsk
LOVE_DUCK: love_duck.o
ld65 -o LOVE_DUCK love_duck.o -C $(LINKER_SCRIPTS)/apple2_1000.inc
love_duck.o: love_duck.s speaker_beeps.s dsr_lores.s
love_duck.o: love_duck.s speaker_beeps.s dsr_lores.s dsr_extra.s
ca65 -o love_duck.o love_duck.s -l love_duck.lst

View File

@ -13,8 +13,8 @@ dsr_rotate:
jsr HGR ; clear PAGE1
; A,Y are 0?
sta FRAME
sta FRAMEH
; sta FRAME
; sta FRAMEH
bit FULLGR ; full screen
@ -54,14 +54,13 @@ init_gr_loop:
sta gr_lookup_l,X
lda GBASH
sta gr_lookup_h,X
lda #0
sta $F0,X ; clear vars to 0
dex
bpl init_gr_loop
big_loop:
;=====================================
@ -108,9 +107,9 @@ lsier_outer:
sta GBASL
lda gr_lookup_h,X
clc
draw_page_smc:
adc #$0
adc DRAW_PAGE
sta GBASH
lda YY
@ -181,18 +180,7 @@ done_line:
end:
;=================
; page flip
ldx #0
lda draw_page_smc+1 ; DRAW_PAGE
beq done_page
inx
done_page:
ldy PAGE1,X ; set display page to PAGE1 or PAGE2
eor #$4 ; flip draw page between $400/$800
sta draw_page_smc+1 ; DRAW_PAGE
jsr flip_page
@ -221,10 +209,6 @@ done_page:
jmp big_loop
done_this:
rts
shape_dsr:
.byte $2d,$36,$ff,$3f
.byte $24,$ad,$22,$24,$94,$21,$2c,$4d
.byte $91,$3f,$36,$00
end_it:

View File

@ -1,10 +0,0 @@
gr_offsets_l:
.byte $00,$80,$00,$80,$00,$80,$00,$80
.byte $28,$a8,$28,$a8,$28,$a8,$28,$a8
.byte $50,$d0,$50,$d0,$50,$d0,$50,$d0
gr_offsets_h:
.byte $4,$4,$5,$5,$6,$6,$7,$7
.byte $4,$4,$5,$5,$6,$6,$7,$7
.byte $4,$4,$5,$5,$6,$6,$7,$7

View File

@ -7,7 +7,7 @@
ld_start:
.byte 2 ; number of sectors to load
.byte 2 ; number of sectors to load
lda $C088,X ; turn off drive motor
ldy #0

View File

@ -47,6 +47,7 @@ HGR_SCALE = $E7
YPOS = $F0
XPOS = $F1
DRAW_PAGE = $F2
ROTATION = $FA
FRAME = $FB
FRAMEH = $FC
@ -58,11 +59,13 @@ XX = $FF
love_duck:
; jsr dsr_rotate
.include "dsr_lores.s"
; bit SET_GR ; switch to lo-res mode
; bit FULLGR ; set full screen
bit SET_GR ; switch to lo-res mode
bit FULLGR ; set full screen
; inc FRAME ; want frame #0
; maybe not necessary
main_loop:
@ -71,25 +74,52 @@ main_loop:
; flip page
;======================
page_smc:
lda #0 ; 0 or 1
jsr flip_page
tax
ldy PAGE1,X ; flip page
;===============
; handle duck
;===============
eor #$1 ; invert (leaving in A)
lda FRAME
and #$7f
bne check_beep
sta page_smc+1 ; save PAGE value (PAGE in A here)
ldx #NOTE_D3
ldy #50
jsr speaker_xy
ldx #NOTE_E3
ldy #50
jsr speaker_xy
asl ; make OUTH $4 or $8 depending on value in PAGE
; which we have in A above or at end of loop
asl ; (this also sets C to 0)
adc #4
ldx #10
long_wait:
lda #200
jsr WAIT
dex
bne long_wait
sta GBASH
; beq no_beep
;===================
; handle click
;===================
check_beep:
and #$3
bne no_beep
; every 4th cycle beep
ldx #NOTE_C4
ldy #10
jsr speaker_xy
; Y zero here?
no_beep:
;=====================
; handle color cycle
;=====================
inc FRAME ; increment frame #
lda FRAME
and #$1f ; cycle colors ever 32 frames
bne no_color_cycle
@ -98,25 +128,22 @@ page_smc:
no_color_cycle:
lda FRAME
and #$3
bne no_beep
; every 4th cycle beep
lda #NOTE_C3
sta speaker_frequency
lda #10
sta speaker_duration
jsr speaker_tone
; Y zero here?
no_beep:
lda #100 ; pause a bit
jsr WAIT
sta GBASL ; A is 0
; increment frame
inc FRAME ; increment frame #
bne frame_noflo
inc FRAMEH
frame_noflo:
; 0000 -> 0100
; 0100 -> 1000
;=================================
; clear lo-res screen, page1/page2
@ -126,6 +153,11 @@ no_beep:
; assume GBASL/GBASH already points to proper $400 or $800
ldx #4 ; lores is 1k, so 4 pages
txa
clc
adc DRAW_PAGE
sta GBASH
full_loop:
ldy #$00 ; clear whole page
bg_smc:
@ -167,11 +199,11 @@ draw_heart:
lda bounce,X
sta YPOS
lda #<heart_bitmap
sta sprite_smc+1
ldx #<heart_bitmap
; stx sprite_smc+1
lda #$11 ; red
sta color_smc+1
ldy #$11 ; red
; sty color_smc+1
jsr draw_sprite
@ -190,31 +222,29 @@ draw_heart:
;===============
; draw duck
lda FRAME
and #$7f
bne no_duck
lda #32
sta XPOS
lda #1
sta YPOS
lda #$44 ; green
sta color_smc+1
lda #<duck_bitmap_left
sta sprite_smc+1
ldx #<duck_bitmap_left
ldy #$44 ; green
jsr draw_sprite
lda #24
sta XPOS
lda #$99 ; orange
sta color_smc+1
lda #<duck_bitmap_left_beak
sta sprite_smc+1
ldx #<duck_bitmap_left_beak
ldy #$99 ; orange
jsr draw_sprite
no_duck:
jmp main_loop
; bmi main_loop ; bra
@ -224,8 +254,11 @@ draw_heart:
;===========================
; draw_sprite
;===========================
; x is low byte of bitmap
; y is color
draw_sprite:
stx sprite_smc+1
sty color_smc+1
ldx #7 ; draw 7 lines
boxloop:
@ -243,10 +276,8 @@ boxloop:
; adjust for proper page
lda page_smc+1 ; want to add 0 or 4 (not 0 or 1)
asl
asl ; this sets C to 0
adc GBASH
lda GBASH ;carry still set from above
adc DRAW_PAGE
sta GBASH
;=================
@ -264,7 +295,7 @@ draw_line_loop:
bcc its_transparent
color_smc:
lda #$11 ; red
lda #$11 ; redg
sta (GBASL),Y ; draw on screen
its_transparent:
@ -280,36 +311,6 @@ its_transparent:
;=================
; star bitmap
;=================
;012|456|
; @ ;
; @@ ;
; @@@@@ ;
;@@@@@@@ ;
; @@@@@ ;
; @@@@@ ;
; @@ @@ ;
;@@ @@ ;
;bitmap:
; .byte $10
; .byte $18
; .byte $1f
; .byte $fe
; .byte $7c
; .byte $3e
; .byte $66
; .byte $C3
;012|456|
; @ @@ ;
;@@@ @@@@ ;
@ -379,4 +380,4 @@ bounce:
.include "speaker_beeps.s"
.include "dsr_lores.s"
.include "dsr_extra.s"

View File

@ -44,20 +44,29 @@ NOTE_ASHARP5 = 36
NOTE_B5 = 34
; need 20
speaker_xy:
stx speaker_frequency
sty speaker_duration
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
dex ; 2
jsr delay_12_cycles
bne speaker_loop ; 2/3
ldx speaker_frequency ; (Frequency) ; 4
jmp speaker_tone ; 3
done_tone:
delay_12_cycles:
rts
speaker_duration: