Skip to content

Commit 5979fa2

Browse files
Merge pull request #74 from zohassadar/playfield_graphic
feature: playfield graphic function
2 parents 0bfb6f7 + 76a9335 commit 5979fa2

File tree

1 file changed

+33
-26
lines changed

1 file changed

+33
-26
lines changed

src/playstate/preparenext.asm

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,36 +44,18 @@ playState_prepareNext:
4444
lda linecapState
4545
cmp #LINECAP_HALT
4646
bne @linecapHaltEnd
47-
lda #'G'
48-
sta playfield+$67
49-
sta playfield+$68
50-
lda #$28
51-
sta playfield+$6A
52-
lda #0
53-
sta vramRow
54-
jsr typeBEndingStuffEnd
55-
rts
47+
ldx #<haltEndingGraphic
48+
ldy #>haltEndingGraphic
49+
jmp copyGraphic
5650
@linecapHaltEnd:
57-
5851
jsr practisePrepareNext
5952
inc playState
6053
rts
61-
6254
typeBEndingStuff:
63-
; copy success graphic
64-
ldx #$5C
65-
ldy #$0
66-
@copySuccessGraphic:
67-
lda typebSuccessGraphic,y
68-
cmp #$80
69-
beq @graphicCopied
70-
sta playfield,x
71-
inx
72-
iny
73-
jmp @copySuccessGraphic
74-
@graphicCopied:
75-
lda #$00
76-
sta vramRow
55+
ldx #<typebSuccessGraphic
56+
ldy #>typebSuccessGraphic
57+
copyGraphic:
58+
jsr copyGraphicToPlayfield
7759

7860
typeBEndingStuffEnd:
7961
; play sfx
@@ -98,5 +80,30 @@ sleep_gameplay_nextSprite:
9880
bne @loop
9981
rts
10082

83+
copyGraphicToPlayfield:
84+
lda #$09 ; default row
85+
copyGraphicToPlayfieldAtCustomRow:
86+
stx generalCounter
87+
sty generalCounter2
88+
tax
89+
lda multBy10Table,x
90+
clc
91+
adc #$02 ; indent
92+
tax
93+
ldy #$00
94+
@copySuccessGraphic:
95+
lda (generalCounter),y
96+
beq @graphicCopied
97+
sta playfield,x
98+
inx
99+
iny
100+
bne @copySuccessGraphic
101+
@graphicCopied: ; 0 in accumulator
102+
sta vramRow
103+
rts
104+
105+
; $28 is ! in game tileset
106+
haltEndingGraphic:
107+
.byte $FF,"G","G",$FF,$28,$00
101108
typebSuccessGraphic:
102-
.byte $17,$12,$0C,$0E,$FF,$28,$80
109+
.byte "N","I","C","E",$FF,$28,$00

0 commit comments

Comments
 (0)