File Name: | 1UP Every Certain Score |
Submitted: | 2017-01-23T18:47:22+01:00 by Mathos |
Authors: | Mathos |
Type: | |
Includes GFX: | No |
Includes Hijack: | No |
Featured: | No |
Description: | This simple code grants the player an extra life at certain checkpoints in the score. Use with game mode 14 (regular level gameplay).
Details in .asm file.
Requested by LucasRCD. |
- It's a cool concept, but the code is simply a really inefficient way to put it. I'm not even sure why you are doing a bitmasking and two loops, when you can do it all simply in one loop (see below).
Code LDA !Tracker ; \ make sure we don't go overboard
CMP !Entries ; |
BCC .nah ; |
LDA !Entries ; |
STA !Tracker ; /
can be shortened to:
Code LDA !Entries
CMP !Tracker
BCC .nah
STA !Tracker
----------------
Code DEY ; \ continue if needed
TYA ; |
BMI .loopend ; |
BRA .loopstart ; /
.loopend:
You can simply do
DEY : BPL .loopstart.
----------------
Code LDA ScoreTable,x ; \ get check in $01
AND $00 ; |
STA $02 ; /
LDA $01 ; \ compare
CMP $02 ; /
BEQ .loopnext ; if same, gotta check further
Can be shortened to:
Code LDA ScoreTable,x
AND $00
CMP $01
BEQ .loopnext
----------------
There is no need to store the maskbits to $00 then compare, as you can just do
AND AndTable,y.
----------------
Code BMI .superloopend
BRA .superloopstart
.superloopend:
BPL .superloopstart
----------------
Here is an improved code with serves the same function.
- Also not a removal reason, but you forgot the sa-1 tag while the code seems fully compatible.
Follow Us On