Language…
17 users online: asterkafton, ClaireChan, crocodileman94, DanMario24YT, Gamet2004, h4shcat, Hayashi Neru, Jaiden, LightAligns, MorrieTheMagpie, Rhubarb44230,  Segment1Zone2, ShadowMistressYuko, signature_steve, simon.caio,  Tahixham,  zuccha - Guests: 264 - Bots: 347
Users: 64,795 (2,378 active)
Latest user: mathew

X Dash by ComradeKirby

File Name: X Dash
Submitted: by ComradeKirby
Authors: ComradeKirby
Type: Game Mode
Includes GFX: No
Includes Hijack: Yes
Featured: No
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.
Screenshots:

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:

Code
	LDX $0DB3
	LDA $0F48,x

Code
	DEC $0F48,x



Code
	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:
Code
	LDA $0F48 ;;check bonus stars
	BNE notPressed



Code
	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:
Code
	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.
Originally posted by Meirdent
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.

Other way around - without a CMP, BEQ is "branch if zero" and BNE is "branch if nonzero."