|File Name:||X Dash|
|Description:||This zip includes the X Dash asm file, a pre patched bps, and a uberasm list file. |
This asm makes it so when pressing x, you spend a bonus star to dash forward killing enemies in your path.
Special thanks to Craz Xexe #4545 (mellonpizza) and kaizoman#1211 for the
code help on discord.
Please do not in include an uberasm list or bps file with the submission, the .asm by itself is the only necessary file.
As it currently stands, the code will only check and decrement the bonus stars for Mario ($0F48), and not Luigi ($0F49). A simple fix for this would be to load $0DB3 (address for which player is currently in play, Mario = #$00, Luigi = #$01) into X and apply that to the address:
LDX $0DB3 LDA $0F48,x
LDA $0F48 ;;check bonus stars CMP #$0 BEQ notPressed
Without a CMP preceding it, BNE will automatically branch if the value in the accumulator is zero. Similarly, BEQ will automatically branch if the value is equal to 1. As an example, the code above can be reduced to just:
LDA $0F48 ;;check bonus stars BNE notPressed
LDA $0076 CMP #$00 BEQ Left LDA $0076 CMP #$01 BEQ Right Right: LDA #$32 STA $7B RTL Left: LDA #$D3 STA $7B notPressed: RTL
The "Left" subroutine and branch are redundant, and can instead be set like so:
LDA $0076 BEQ Right LDA #$D3 ;;Left STA $7B RTL Right: LDA #$32 STA $7B notPressed: RTL
Basically, if the value at $76 is 0, the branch to "Right" will just be skipped over and the rest of the code below it will still continue to be read.
Also while not really a reason for rejection, setting up defines for the speed and how long the dash lasts for would also be nice.