Skip to content

Commit 0082a70

Browse files
committed
Added some comments and removed a bit of redundant code regarding the calculations for allegro cycles in the crash.
1 parent a63b92c commit 0082a70

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/playstate/updatestats.asm

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ testCrash:
489489
sta cycleCount
490490

491491
@nextOff:
492-
lda allegroIndex
492+
lda allegroIndex ;the allegro checking routine uses offsets of 50-59 [0x32-0x3B], meaning even when the first block triggers allegro, the bne will work properly.
493493
bne @allegro
494494
lda #$95 ; 149 in decimal.
495495
clc
@@ -505,16 +505,11 @@ testCrash:
505505
bne @linesCycles
506506
@allegro:
507507
sec
508-
sbc #$32 ; subtract 50, allegro index already loaded
508+
sbc #$32 ; subtract 50 from the index, as the offset is from the start of board data.
509509
asl
510510
asl
511511
asl
512-
asl ;multiply by 16 cycles per cell checked
513-
tax ; save low byte result
514-
lda cycleCount
515-
adc #$00 ; add high byte carry
516-
sta cycleCount
517-
txa
512+
asl ;multiply by 16 cycles per cell checked. 0-indexed.
518513
adc cycleCount+1
519514
sta cycleCount+1
520515
lda cycleCount

src/playstate/util.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ updatePlayfield:
7979

8080
updateMusicSpeed:
8181
ldx #$05
82-
lda multBy10Table,x
82+
lda multBy10Table,x ;this piece of code is parameterized for no reason but the crash checking code relies on the index being 50-59 so if you ever optimize this part out of the code please also adjust the crash test, specifically the part which handles cycles for allegro.
8383
tay
8484
ldx #$0A
8585
@checkForBlockInRow:

0 commit comments

Comments
 (0)