Banner
Views: 785,375,889
Time:
16 users online:  Aja, Darolac,  E-man38, Flippn'Fences, Green Jerry,  KKevinM,  Major Flare, Marcneton, Minco,  S.N.N.,  Shiny Ninetales, Strawb,  Tahixham, TheMorganah, Wariuzzo, yogui - Guests: 51 - Bots: 195 Users: 41,063 (1,544 active)
Latest: Marcneton
Tip: Coins and Dragon Coins guide your player through the level and mark progress. Don't forget to place them!Not logged in.
Official Hex/ASM/Etc. Help Thread
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Official Hex/ASM/Etc. Help Thread
Pages: « 1 2211 212 213 214 215410 411 »
Come on, help me now :(
I'm trying to make a shatter and replace block, but when I test it out, the game freezes when I touch the block.

Code:

JMP MAIN : JMP MAIN : JMP MAIN : JMP RETURN : JMP RETURN : JMP RETURN : JMP RETURN :

;Table;
!Map16Number = $331

MAIN:
PHY ;Shatter code starts
PHB
LDA #$02
PHA
PLB
LDA #$00
JSL $028663
PLB
LDA #$02
STA $9C
PLY ;Shatter code ends
BRA Replace


Replace:
LDX #!Map16Number
JSR 1988

PrematureEnd:
PLX
PLY
PLB
PLP
RTS
ChangeMap16:
PHP
SEP #$20
PHB
PHY
LDA #$00
PHA
PLB
REP #$30
PHX
LDA $9A
STA $0C
LDA $98
STA $0E
LDA #$0000
SEP #$20
LDA $5B
STA $09
LDA $1933
BEQ SkipShift
LSR $09
SkipShift:
LDY $0E
LDA $09
AND #$01
BEQ LeaveXY
LDA $9B
STA $00
LDA $99
STA $9B
LDA $00
STA $99
LDY $0C
LeaveXY:
CPY #$0200
BCS PrematureEnd
LDA $1933
ASL A
TAX
LDA $BEA8,x
STA $65
LDA $BEA9,x
STA $66
STZ $67
LDA $1925
ASL A
TAY
LDA [$65],y
STA $04
INY
LDA [$65],y
STA $05
STZ $06
LDA $9B
STA $07
ASL A
CLC
ADC $07
TAY
LDA [$04],y
STA $6B
STA $6E
INY
LDA [$04],y
STA $6C
STA $6F
LDA #$7E
STA $6D
INC A
STA $70
LDA $09
AND #$01
BEQ SwitchXY
LDA $99
LSR A
LDA $9B
AND #$01
BRA CurrentXY
SwitchXY:
LDA $9B
LSR A
LDA $99
CurrentXY:
ROL A
ASL A
ASL A
ORA #$20
STA $04
CPX #$0000
BEQ NoAdd
CLC
ADC #$10
STA $04
NoAdd:
LDA $98
AND #$F0
CLC
ASL A
ROL A
STA $05
ROL A
AND #$03
ORA $04
STA $06
LDA $9A
AND #$F0
REP 3 : LSR A
STA $04
LDA $05
AND #$C0
ORA $04
STA $07
REP #$20
LDA $09
AND #$0001
BNE LayerSwitch
LDA $1A
SEC
SBC #$0080
TAX
LDY $1C
LDA $1933
BEQ CurrentLayer
LDX $1E
LDA $20
SEC
SBC #$0080
TAY
BRA CurrentLayer
LayerSwitch:
LDX $1A
LDA $1C
SEC
SBC #$0080
TAY
LDA $1933
BEQ CurrentLayer
LDA $1E
SEC
SBC #$0080
TAX
LDY $20
CurrentLayer:
STX $08
STY $0A
LDA $98
AND #$01F0
STA $04
LDA $9A
REP 4 : LSR A
AND #$000F
ORA $04
TAY
PLA
SEP #$20
STA [$6B],y
XBA
STA [$6E],y
XBA
REP #$20
ASL A
TAY
PHK
PER $0006
PEA $804C
JML $00C0FB
PLY
PLB
PLP
RTS
RETURN: RTL


What am I doing wrong?
Originally posted by Noobish Noobsicle
I don't think it'll show the end-level scorecard, though...

No problem I'm just looking for the level to end =P

Anyways the game crashed when I reached screen 2. Anyways thanks for the help, if your still interested then maybe you can fix that code... Just don't want you to feel like you have to or anything. I'll try and figure out how the code works in a while.

The only opcode I'm not familiar with is BPL. And... Wait-What the hell is INC a?? I've heard of INC and all, but what about the a.
you know the other INCs right? for example, INC $0DBF, INC $19.
INC A basically Increases the Value in A
example:
Code
LDA #$01
INC A
INC A
STA $19
STA $0DBF

that would Load 01 into A then it would INC it 2 times so it now becomes #$03, then i store it into $19 & $0DBF

Edit: Almost forgot, BPL will branch if the range of the value is in #$00-#$7F. example:
Code
LDA $0DBE
BPL Solid
RTL
Solid:
LDA #$30
STA $1693
LDY #$01
RTL

that would make it so if mario has lives in the range of 00-127 (127 is 7F), it would branch and be solid. There's also BMI which is the opposite of BPL, it would branch if the value was in a range of #$80-#$FF
I change my layout every 4-5 months
Ohhh, ok. Thanks for the answer; Ramp. (Why is it that I seem to see you everywhere?)

Tho, I've still got the the goal end to deal with <_<

Read the notes I made; I guess. See what you can gather.
Code
LDA $95
CMP #$02
BNE Return4

LDA $0DD5	;The secret exit/normal exit. Not entirely sure.
BEQ Next1	
BPL $19		;If Mario's power status is within the range #$00-#$7F I'm just confused about this  :/

Next1: 
LDA #$80	;Mario's Y position... Wut. I think I get this; you have to save Mario's Y position when level ends?
BRA Branch1	;Hmph, didn't know you could have a label right underneath
Branch1:

LDA #$01	;Turn off Midway flag\
STA $13CE	;Midway              /
STA $0DD5	;This again (line 1)
INC $1DE9	;Quote RAM: "Overworld::Ending enemy presentation screen (Count to 0x0C)" No idea. 
LDA #$0B	;Fade into overworld\
STA $0100	;Random address     /
RTL		;Maybe its just me, but how do you know when to stop and put in RTL?

LDA $0DD5	;The following lines are pretty much the first part of the code in a different order... Why. Why dose asm have to be so damn werid.
BEQ Next2
BPL $19

Next2:
LDA #$80
BRA Branch2
Branch2:

LDA #$01
INC a
STA $13CE
STA $0DD5
INC $1DE9
LDA #$0B
STA $0100

Return4:
RTS

For newcomers I'm trying to create LevelASM that makes the level end.

Extras



I should have something witty to put here (even if it's just to update dated info), shouldn't I?

Advertising Space

Me again, but here's another simple one.

Code
LDA $94		;mario's low x position 
CLC 
ADC #$01	;add 1 (customizable in hex, speed of the conveyor belt)
STA $94 	;store back to mario's low x position 
LDA $95 	; mario's high x position 
ADC #$00	; add 1 if overflow (if $94 went from FF->00) 
STA $95 	; store back to mario's high x position
RTL


This is all from Kaijyuu's Conveyor Block, which moves Mario to the right (description says left, but still). However, what I want him to do is move to the left but I don't know what I need to edit/add without screwing everything up.

Code
LDA $94		;mario's low x position 
SEC
SBC #$01	;add 1 (customizable in hex, speed of the conveyor belt)
STA $94 	;store back to mario's low x position 
LDA $95 	; mario's high x position 
SBC #$00	; add 1 if overflow (if $94 went from FF->00) 
STA $95 	; store back to mario's high x position
RTL


This should work.
Hmm I really don't know what you are doing there to end your level.

How about

Code
		LDA $95		; Load Marios High X Position
		CMP #$02	; If at screen 2
		BEQ CheckEnding	; Jump to check if level is being ended
		RTL		; Not at screen 2, just return

CheckEnding:	LDA $1493	; Load the level end timer
		BNE EndLevel	; Timer is zero, we didn't end the level yet
		RTL		; We started the ending sequence, do nothing

EndLevel:	;INC $13C6	; Uncomment this to make Mario not walk his winning walk
		LDA #$FF	; Setting the endlevel timer to #$FF ends the level
		STA $1493	; using a goal sphere
		LDA #$0B	; Load the right music
		STA $1DFB	; And start playing it
		RTL


This is not tested, im not sure if the level end timer is 0 by default normally, but i guess it should be. :P
No, that code won't work for the same reason mine didn't work: He's most likely running his code out of LevelASM, and our codes use RTL rather than RTS.

So just change all the RTL's to RTS's and you should be good.

Oh, and BPL $19 just means branch hex 19 bytes ahead if value in A is positive. It has nothing to do with Mario's powerup status.

--------------------
Now with extra girl and extra hacker
Originally posted by Kickchon
Code
		LDA $95		; Load Marios High X Position
		CMP #$02	; If at screen 2
		BEQ CheckEnding	; Jump to check if level is being ended
		RTL		; Not at screen 2, just return

CheckEnding:	LDA $1493	; Load the level end timer
		BNE EndLevel	; Timer is zero, we didn't end the level yet
		RTL		; We started the ending sequence, do nothing

EndLevel:	;INC $13C6	; Uncomment this to make Mario not walk his winning walk
		LDA #$FF	; Setting the endlevel timer to #$FF ends the level
		STA $1493	; using a goal sphere
		LDA #$0B	; Load the right music
		STA $1DFB	; And start playing it
		RTL

Game doesn't crash, but it doesn't do anything either. Try testing it yourself maybe?
Code
	LDA $95		;\ If player is at a screen
	CMP #$02		;| other than 02
	BNE Return	;/ Return
	LDA $1493		;\ If End Level timer is 01-FF, Return
	BNE Return	;/
	;DEC $13C6	; Uncomment for the player to not walk
	LDA #$FF		;\ End the level
	STA $1493		;/
	LDA #$0B		;\ Set music to play End Music
	STA $1DFB		;/
Return:
	RTS

Tested this and it works
I change my layout every 4-5 months
Sorry if this problem has already been solved in the past but... Whenever Mario (Or any other sprite) touches the block, the game freezes and the screen changes depending on the side the block was touched. Even the most basic code I know doesn't work...

LDA #$01
STA $19
RTS

(I got it from a tutorial) Am I leaving something out in my codes? I use Blocktool Super Deluxe.
RTL, not RTS.

--------------------
Now with extra girl and extra hacker
It does the same thing. Oh yeah, something that might help but... It doesn't freeze when Mario hits it from bellow. When he does, it works perfectly. If he hits it from the side or from above the game freezes.
You need BTSD jump tables

Try this

Code
JMP Main : JMP Main : JMP Main : JMP return : JMP return : JMP return : JMP return

Main:
LDA #$01
STA $19
return:
RTL
Works great! Thanks for the help. Now I gotta go learn about tables.
Yea, it worked... Thanks, I'll try figure out how you did that in a little bit...

Anyways I have 1 other question. How do I get rid of Mario's gravity (LevelASM).

The only way I see of doing it is, by editing Mario's Y speed, tho that didn't appear to do it.
I'm trying to understand something about BPL and BMI. I've sometimes seen them used instead of BCC and BCS. At first, I thought they were different because it was "greater than" and "less than or equal to" instead of "greater than or equal to" and "less than", but a quick processor flag analysis disproved that. Then I thought that with BPL and BMI, it didn't matter what sign the number had - checking if something is greater than 10 would be the same as checking if it is greater than F0. But that's not true, either. So...for one thing, wouldn't the order of comparison matter with BPL and BMI? For example, LDA #$F1 CMP #$10 BPL Label wouldn't produce the same result as LDA #$10 CMP #$F1 BPL Label...but the same would be true for BCC and BCS! Why do people sometimes use BPL and BMI in place of BCC and BCS? The thing that immediately comes to mind is that the former eventually comes to a point where the branch command will branch no matter what the value of A is (for example, LDA $00 CMP #$10 BMI Label will always branch for any number higher than 8F), but that doesn't seem like a good enough reason to do it. I do notice that whatever value you plug in after the CMP, the branch command will work on a specific set of 0x80 values, from the value after the CMP to that value + 7F.

So...what exactly is the purpose of using BPL and BMI after a CMP? I mean, having half the possible values trigger a branch and the other half not trigger it doesn't sound like it would work unless you're comparing to 40 or C0. If, for example, I write "LDA $7D CMP #$10 BMI SpriteWins", then the player wins if his/her speed is 10-8F. That doesn't really seem to make sense...
Yea, it doesn't seem to make sense to me either, but you have the BPL/BMI wrong when using the last example. It's very weird to me still but it seem when you're using BPL/BMI after a CMP, it switch's it so in this example. LDA $0DBF CMP #$14 BMI Kill. it would actually not compare if it's from 14-93 but instead 94-FF,00-14. same thing goes with BPL, it would check 14-93 instead of 94-FF,00-14. i still wonder what the purpose of it is after it's used with a CMP but to me, it's seems completely useless but people may find a good use of it in the future
I change my layout every 4-5 months
Originally posted by Ramp202
you have the BPL/BMI wrong when using the last example.


Well, I did say the player wins, which would mean that the BMI does not branch.
Pages: « 1 2211 212 213 214 215410 411 »
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Official Hex/ASM/Etc. Help Thread

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2019 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 7

Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • ROMhacking.net
  • MFGG
  • Gaming Reinvented