fireworks: letter moving works

This commit is contained in:
Vince Weaver 2018-09-12 14:43:01 -04:00
parent a85175c436
commit 4314aca189
2 changed files with 113 additions and 47 deletions

View File

@ -85,9 +85,9 @@ init_letters:
sta LETTERH
lda #39
sta LETTERX
lda #24
lda #22
sta LETTERY
lda #30
lda #28
sta LETTERD
@ -205,21 +205,24 @@ display_loop:
; 152 * 65 = 9880
; -12 for HIRES/PAGE0 at top
; -5 for LORES+ldy+br fallthrough at bottom
; 9863
; -121 for move_letters
; 9742
bit HIRES ; 4
bit PAGE0 ; 4
bit FULLGR ; 4
;===========
; 12
; Try X=22 Y=85 cycles=9861 R2
jsr move_letters ; 6+110
; Try X=9 Y=191 cycles=9742
; lda DRAW_PAGE ; nop ; 3
nop ; 2
; nop ; 2
ldy #85 ; 2
hgloop1:ldx #22 ; 2
ldy #191 ; 2
hgloop1:ldx #9 ; 2
hgloop2:dex ; 2
bne hgloop2 ; 2nt/3
dey ; 2

View File

@ -1,32 +1,64 @@
;===============================================
; Move Letters
;===============================================
; Normal =10+25+38+9 = 82 need 28 (28)
; End of line =10+25+38+37 = 110
; Next line =10+5+12+34 = 61 need 49 (28+21)
; done entirely =10+5+9 = 24 need 86 (28+21+37)
; Normal P0 =13+2+22+41+37 = 115
; Normal P1 =13+2+22+41+37 = 115
; End of line =13+2+22+41+9+(28) = 115
; done entirely =13+5+(6+37+26+28) = 115
; Next line =13+5+9+34+(26+28) = 115
; all forced to be 109
; all forced to be 115
move_letters:
; load letter from pointer, save into LETTER
ldy #0 ; 2
lda (LETTERL),Y ; 5
sta LETTER ; 3
; if high bit set, is special case
bmi letter_special ; 3
;==========
; 10
bmi letter_special
; 2
lda LETTERY ; 3
asl ; 2
; 13
; just regular letter
;-1
lda LETTERY ; get letter Y ; 3
bmi letter_page1
;==========
; 2
letter_page0: ; -1
asl ; map to memory address ; 2
tay ; 2
lda gr_offsets,Y ; lookup low-res memory address ; 4
sta BASL ; store out low byte of addy ; 3
lda gr_offsets+1,Y ; look up high byte ; 4
sta BASH ; 3
lda #0 ; cycle-killer ; 2
jmp letter_erase ; 3
;==========
; 25
; 22
letter_page1:
asl ; map to memory address ; 2
tay ; 2
lda gr_offsets,Y ; lookup low-res memory address ; 4
sta BASL ; store out low byte of addy ; 3
lda gr_offsets+1,Y ; look up high byte ; 4
clc ; 2
adc #$4 ; adjust to page1 ; 2
sta BASH ; 3
;==========
; 22
;============================
letter_erase:
ldy #0 ; erase old char with space ; 2
lda #' '|$80 ; 2
ldy LETTERX ; 3
@ -39,65 +71,65 @@ move_letters:
ldy LETTERX ; 3
sta (BASL),Y ; 6
lda LETTERX ; 3
lda LETTERX ; see if we are at destination ; 3
cmp LETTERD ; 3
beq letter_next ; 3
;===========
; 38
beq letter_next
; 2
; 41
;-1
lda #0 ; 2
lda #0 ; 2
jmp waste_28 ; 3
;==========
; 9
letter_next:
; 3
clc ; 2
clc ; 16-bit inc letter pointer ; 2
lda LETTERL ; 3
adc #1 ; 2
sta LETTERL ; 3
lda LETTERH ; 3
adc #0 ; 2
sta LETTERH ; 3
inc LETTERD ; 5
lda #39 ; 2
inc LETTERD ; inc destination X ; 5
lda #39 ; start at right of screen ; 2
sta LETTERX ; 3
rts ; 6
;===========
; 37
letter_special:
; 3
cmp #$ff ; 2
cmp #$ff ; handle FF, we're done ; 2
beq letter_done ; 3
;==========
; 5
beq letter_done
; 2
ldy #1 ; 2
lda (LETTERL),Y ; 5
; -1
ldy #1 ; otherwise, Y,X pair ; 2
lda (LETTERL),Y ; get Y, put in LETTERY ; 5
sta LETTERY ; 3
;===========
; 12
; 9
iny ; 2
iny ; get dest ; 2
lda (LETTERL),Y ; 5
sta LETTERD ; 3
sta LETTERD ; put in LETTERD ; 3
clc ; 2
lda LETTERL ; 3
clc ; skip 3 bytes to begin of letters ; 2
lda LETTERL ; 16-bit add ; 3
adc #3 ; 2
sta LETTERL ; 3
lda LETTERH ; 3
adc #0 ; 2
sta LETTERH ; 3
lda LETTERH ; waste ; 3
jmp waste_21 ; 3
jmp waste_26 ; 3
;===========
; 34
letter_done:
; 3
lda LETTERH ; 3
lda LETTERH ; 3
@ -110,13 +142,14 @@ waste_37:
inc BLARGH ; 5
inc BLARGH ; 5
inc BLARGH ; 5
waste_21:
waste_26:
ldx #0 ; 2
ldx #0 ; 2
ldx #0 ; 2
inc BLARGH ; 5
inc BLARGH ; 5
inc BLARGH ; 5
inc BLARGH ; 5
waste_28:
ldx #0 ; 2
@ -127,11 +160,41 @@ waste_28:
rts ; 6
letters:
;.byte 22,30,
.byte "CODE BY",128
.byte 23,30,"DEATER",128
.byte 22,30,"FIREWORKS",128
.byte 23,30,"FOZZTEXX",128
.byte 22,30,"A VMW",128
.byte 23,30,"PRODUCTION",128
; .byte 22,28,
.byte " ",128
.byte 22+128,28," ",128
.byte 23,28, " ",128
.byte 23+128,28," ",128
.byte 22,28, "CODE BY",128
.byte 22+128,28,"CODE BY",128
.byte 23,28, "DEATER",128
.byte 23+128,28,"DEATER",128
.byte 22,28, " ",128
.byte 22+128,28," ",128
.byte 23,28, " ",128
.byte 23+128,28," ",128
.byte 22,28, "FIREWORKS",128
.byte 22+128,28,"FIREWORKS",128
.byte 23,28, "FOZZTEXX",128
.byte 23+128,28,"FOZZTEXX",128
.byte 22,28, " ",128
.byte 22+128,28," ",128
.byte 23,28, " ",128
.byte 23+128,28," ",128
.byte 22,28,"A VMW",128
.byte 22+128,28,"A VMW",128
.byte 23,28,"PRODUCTION",128
.byte 23+128,28,"PRODUCTION"
.byte 255