Skip to content

Commit 5850530

Browse files
committed
numerous bugfixes
1 parent 55c7313 commit 5850530

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/playstate/updatestats.asm

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ testCrash:
469469
cmp #$0B
470470
lda #$00
471471
bcc @sub11
472-
lda #$02 ;97 cycles if row is above 11
472+
lda #$02 ;97 cycles if row is below 11; higher numbers are lower on the board
473473
clc
474474
@sub11: adc #$5F ;95 cycles
475475
adc cycleCount+1
@@ -483,8 +483,7 @@ testCrash:
483483

484484
@linesNotCleared:
485485
lda displayNextPiece
486-
and #BUTTON_SELECT
487-
beq @nextOff
486+
bne @nextOff
488487
lda #$8A ; add 394 cycles for nextbox
489488
adc cycleCount+1
490489
sta cycleCount+1
@@ -497,8 +496,8 @@ testCrash:
497496
bne @allegro
498497
lda #$95 ; 149 in decimal.
499498
clc
500-
ldx wasAllegro ; FF is no allegro. 00 is allegro.
501-
bne @addMusicCycles
499+
ldx wasAllegro ; FF is allegro. 00 is no allegro.
500+
beq @addMusicCycles
502501
adc #$26 ;add 38 cycles for disabling allegro
503502
@addMusicCycles:
504503
adc cycleCount+1
@@ -525,7 +524,7 @@ testCrash:
525524
adc #$00 ; add carry again
526525
sta cycleCount
527526
lda wasAllegro
528-
beq @linesCycles ; 00 is allegro
527+
bne @linesCycles ; FF is allegro
529528
lda #$29 ; add 41 cycles for changing to allegro
530529
adc cycleCount+1
531530
sta cycleCount+1
@@ -591,17 +590,17 @@ testCrash:
591590
lda completedLines
592591
cmp #$01
593592
bne @notsingle
594-
lda #$52 ; 53 for singles, carry is set
593+
lda #$34 ; 53 for singles, carry is set
595594
adc allegroIndex
596595
sta allegroIndex
597596
@notsingle:
598597
bcc @scoreCycles
599-
lda #$41 ; 42 for clears over a single, carry is set
598+
lda #$29 ; 42 for clears over a single, carry is set
600599
adc allegroIndex
601600
sta allegroIndex
602601
@scoreCycles:
603602
ldx completedLines
604-
beq @not0
603+
bne @not0
605604
inc cycleCount ; no cleared lines is +737, adding 256 twice and rest is covered by sumTable
606605
inc cycleCount
607606
@not0: lda sumTable, x ; constant amount of cycles added for each line clear
@@ -663,7 +662,7 @@ testCrash:
663662
inc allegroIndex
664663
@newBit0:
665664
lda nmiReturnAddr
666-
cmp <updateAudioWaitForNmiAndResetOamStaging+10
665+
cmp #<updateAudioWaitForNmiAndResetOamStaging+10
667666
beq @returnLate ; RNG for which instruction returned to
668667
lda #$03
669668
clc
@@ -676,34 +675,35 @@ testCrash:
676675
inc allegroIndex
677676
@noDMA:
678677
ldx #$08
679-
@loop: lda cycleCount ; adding stockpiled
678+
@loop: lda cycleCount+1 ; adding stockpiled
680679
clc
681680
adc allegroIndex
682681
sta cycleCount+1
683682
lda cycleCount
684683
adc #$00
685684
sta cycleCount
686-
;crash should occur on cycle count results 29734-29739, 29745-29763 = $7426-742B, $7431-7443
685+
;crash should occur on cycle count results 29739-29744, 29750-29768 = $742B-7430, $7436-7448
687686
cmp #$74 ;high byte of cycle count is already loaded
688687
bne @nextSwitch
689688
lda cycleCount+1
690-
cmp #$26 ; minimum crash
689+
cmp #$2B ; minimum crash
691690
bcc @nextSwitch
692-
cmp #$2C ; gap
691+
cmp #$31 ; gap
693692
bcs @continue
694-
lda #$FF
693+
lda #$F0
695694
sta crashFlag
696695
bne @allegroClear
697696
@continue:
698-
cmp #$31
697+
cmp #$36
699698
bcc @nextSwitch
700-
cmp #$44
699+
cmp #$49
701700
bcs @nextSwitch
702-
lda $FF
701+
lda #$F0
703702
sta crashFlag
703+
bne @allegroClear
704704

705705
@nextSwitch:
706-
lda switchTable-1,x ; adding cycles to advance to next switch routine
706+
lda switchTable-2,x ; adding cycles to advance to next switch routine
707707
sta allegroIndex
708708
dex
709709
bne @loop

0 commit comments

Comments
 (0)