(shouting)

ASM: Request, help and general discussion

Anthrax 2 Multiply Themodynamics
Locked
Kil2
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by Kil2 »

raocow wrote:So - is it true that you can LevelASM away the hud? If so, may I please get the code?

If I can that + the feather kill thing to work together, and have all my music together, I think I'll be ready to test it for real, and adjust for gameplay and whatnot.
YCZ or someone might know the best way. I'm not sure off the top of my head.
KingTwelveSixteen wrote:Ok, I MIGHT have overreacted a little. I'm all calmed down now.

I'll give it another try to see if that new code thingy you just put in works.
Probably not. That address should only work in the base rom.
VideoGuy
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by VideoGuy »

I suppose I'll stick to the original SMW for now, although I'm nervous for when I have to test this to send it in.

[edit] Completely unrelated question. Is there a way to disable the time counter so that you can write to that part of the HUD with LevelASM? Or is that too hardcoded to change? (Setting the time to 0000 doesn't work).
Accepting any and all ASM requests for A2MT. Just send me a PM.
Note: If I accepted your ASM request and you never heard back from me, please let me know. I feel like I've forgotten a few of them.
Also the creator of the new A2MT CMS. PM me if you have any questions.
Youtube Channel
User avatar
AUS
Toni#4796
Posts: 483
Joined: 14 years ago
First name: Toni
Pronouns: they/them/their
Location: アース

Re: ASM Help Thread

Post by AUS »

Kil2 wrote:On the rom you sent me $938E00 worked after following the instructions in the first post.
Wait, you mean you have it working? :o
Image
"oh no my best friend was replaced by a evil demon shadow monster"
"argh i am the evil shadow monster demon shadow"
Vip is pronounced "Beep"
nostalgic realtime nitroid let's play playlist
User avatar
Chibikko
Posts: 0
Joined: 14 years ago
Location: La Mulana

Re: ASM Help Thread

Post by Chibikko »

Terry von Feleday wrote:Whee, I made my first working shooty explody thing!

Next question: Is there a way to have a shooter alter the behaviour of te sprite it shoots based on whether its extra bit is set? Say I have a shooter that shoots to the right but if I set the extra bit I want it to shoot left instead, or maybe behave entirely differently.

Code: Select all

LDA $7FAB10,X
AND #$04
BEQ NOT_SET
;;;EXTRA BIT IS 3
BRA CODE
NOT_SET
;;;EXTRA BIT IS 2
CODE
I am a cat. You cannot prove otherwise.
User avatar
yoshicookiezeus
Help! pawprint
Posts: 148
Joined: 15 years ago
Pronouns: he/him/his
Location: Sweden

Re: ASM Help Thread

Post by yoshicookiezeus »

raocow wrote:So - is it true that you can LevelASM away the hud? If so, may I please get the code?
I have an idea that may or may not work, depending on whether levelASM is run before or after the status bar uploading routine. If it is run after, you ought to be able to get away with simply uploading blank tiles over it; I'll do some experimenting with my layer 3 tile uploading routine and see what happens.
Kil2
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by Kil2 »

If not, you could always use the IRQ patch which allows you to more or less disable the HUD on a per level basis.
User avatar
Terry von Feleday
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by Terry von Feleday »

Okay, so what am I not understanding here.

Excerpt from Shooter code, right below the patch of code that sets the location for the spawned sprite:

Code: Select all

LDA $7FAB10,x	;\ Checks Extra Bit.
AND #$04		;| 
BEQ BitClear	;|
LDA #$01		;|
STA $1510,y		;| If Bit is set, set this address to 1
BRA BitSet		;|
			;| 
BitClear:		;|
LDA #$00
STA $1510,y		;/ If bit is clear, set it to 0 instead.
BitSet:
And here's a bit of the main routine of the spawned sprite:

Code: Select all

	LDA $1510,x	;\ If the sprite that spawns this one sets this address to 1,
	BEQ Right	;| it will move to the left.
	LDA #$C0	;|
	STA $B6,x	;|
	BRA Left	;|
	Right:		;| Otherwise, it will move rightwards.
	LDA #$40	;|
	STA $B6,x	;|
	Left:		;|
	JSL $01802A	;/
If I set the value of $1510 within the routine of the spawned sprite, it works just fine - but having the shooter set it doesn't; The sprite always moves rightwards regardless of the shooter's extra bit. What am I not seeing here?[/color]
Image
User avatar
Tails_155
May be dead.
Posts: 23
Joined: 14 years ago
First name: Kit/Tails
Pronouns: he/him/his
Location: The Moon or Something.

Re: ASM Help Thread

Post by Tails_155 »

AUS wrote:
Kil2 wrote:On the rom you sent me $938E00 worked after following the instructions in the first post.
Wait, you mean you have it working? :o
If he did, I'm stumped. I used the same value and got nothing.

The same position DOES work on a totally clean, expanded ROM, but not on my A2MT ROM.
I'm member number 499 (⬤)∀(⬤)
Kil2
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by Kil2 »

Yeah there's got to be a patch conflict somewhere. ps terry I don't know.
User avatar
Chibikko
Posts: 0
Joined: 14 years ago
Location: La Mulana

Re: ASM Help Thread

Post by Chibikko »

Terry von Feleday wrote:

Code: Select all

LDA $7FAB10,x	;\ Checks Extra Bit.
AND #$04		;| 
BEQ BitClear	;|
LDA #$01		;|
STA $1510,y		;| If Bit is set, set this address to 1
BRA BitSet		;|
			;| 
BitClear:		;|
LDA #$00
STA $1510,y		;/ If bit is clear, set it to 0 instead.
BitSet:
[/color]
Why do you index with Y?
I am a cat. You cannot prove otherwise.
User avatar
Terry von Feleday
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by Terry von Feleday »

Well, since the shooter indexes the sprite location with y...

Code: Select all

                    LDA $179B,x             ; \ set x position for new sprite
                    STA $00E4,y             ;  |
                    LDA $17A3,x             ;  |
                    STA $14E0,y             ; /
...I figured that the same would work for other sprite tables as well. Am I wrong with this?[/color]
Image
User avatar
Chibikko
Posts: 0
Joined: 14 years ago
Location: La Mulana

Re: ASM Help Thread

Post by Chibikko »

Terry von Feleday wrote:Well, since the shooter indexes the sprite location with y...

Code: Select all

                    LDA $179B,x             ; \ set x position for new sprite
                    STA $00E4,y             ;  |
                    LDA $17A3,x             ;  |
                    STA $14E0,y             ; /
...I figured that the same would work for other sprite tables as well. Am I wrong with this?[/color]
That should work, but I have to ask the obvious question. Has Y been set to the new sprite index before you used it? For example, this code will not work because the code is before Y is set to the correct index.

Code: Select all

LDA $7FAB10,x   ;\ Checks Extra Bit OF CURRENT SPRITE
AND #$04      ;|
BEQ BitClear   ;|
LDA #$01      ;|
STA $1510,y      ;| USES Y TOO EARLY
BRA BitSet      ;|
BitClear:      ;|
LDA #$00
STA $1510,y      ;/ USES Y TOO EARLY
BitSet:

JSL $02A9DE   ;Y IS THE INDEX OF A FREE SPRITE SLOT
;;;NOW Y CAN BE USED
Without seeing the code, this is the only thing I can think of that might be wrong.
I am a cat. You cannot prove otherwise.
User avatar
Terry von Feleday
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by Terry von Feleday »

Well here's the entire code minus smoke routine then.

Code: Select all

                    CUST_SPRITE_TO_GEN = $44
                    SOUND_TO_GEN = $09
                    NEW_SPRITE_NUM = $7FAB9E
					EXTRA_BITS = $7FAB10

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; sprite code JSL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                    
                    dcb "INIT"              
                    dcb "MAIN"                                    
                    PHB                     
                    PHK                     
                    PLB                     
                    JSR SPRITE_CODE_START   
                    PLB                     
                    RTL      

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; main bullet bill shooter code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;               
RETURN              RTS                     ; return
SPRITE_CODE_START			
					LDA $17AB,x             ; \ return if it's not time to generate
                    BNE RETURN              ; /
                    LDA #$30                ; \ set time till next generation = 30
                    STA $17AB,x             ; /
                    LDA $178B,x             ; \ don't generate if off screen vertically
                    CMP $1C                 ;  |
                    LDA $1793,x             ;  |
                    SBC $1D                 ;  |
                    BNE RETURN              ; /
                    LDA $179B,x             ; \ don't generate if off screen horizontally
                    CMP $1A                 ;  |
                    LDA $17A3,x             ;  |
                    SBC $1B                 ;  |
                    BNE RETURN              ; / 
                    LDA $179B,x             ; \ ?? something else related to x position of generator??
                    SEC                     ;  | 
                    SBC $1A                 ;  |
                    CLC                     ;  |
                    ADC #$10                ;  |
                    CMP #$10                ;  |
                    BCC RETURN              ; /
					
                    JSL $02A9DE             ; \ get an index to an unused sprite slot, return if all slots full
                    BMI RETURN	            ; / after: Y has index of sprite being generated

                    PHX                     ; \ before: X must have index of sprite being generated
                    TYX                     ; / routine clears *all* old sprite values...

GENERATE_SPRITE     LDA #SOUND_TO_GEN       ; \ play sound effect
                    STA $1DFC               ; /
                    LDA #$01                ; \ set sprite status for new sprite
                    STA $14C8,y             ; /
                    LDA #CUST_SPRITE_TO_GEN ; \ set sprite number for new sprite
                    STA NEW_SPRITE_NUM,x    ; /
					JSL $07F7D2		    	; reset sprite properties 
                    JSL $0187A7             ; get table values for custom sprite       
                    LDA #$88                ; mark as initialized
                    STA EXTRA_BITS,x
                    PLX                     ; call init routine on sprite
					
                    LDA $179B,x             ; \ set x position for new sprite
                    STA $00E4,y             ;  |
                    LDA $17A3,x             ;  |
                    STA $14E0,y             ; /
                    LDA $178B,x             ; \ set y position for new sprite
                    SEC                     ;  | (y position of generator - 1)
                    SBC #$01                ;  |
                    STA $00D8,y             ;  |
                    LDA $1793,x             ;  |
                    SBC #$00                ;  |
                    STA $14D4,y             ; /
					
					LDA $7FAB10,x	;\ Checks Extra Bit.
					AND #$04		;| 
					BEQ BitClear	;|
					LDA #$01		;|
					STA $1510,y		;| If Bit is set, set this address to 1
					BRA BitSet		;|
									;| 
					BitClear:		;|
					LDA #$00
					STA $1510,y		;/ If bit is clear, set it to 0 instead.
					BitSet:

                    JSR SUB_SMOKE           ; display smoke graphic
					RTS                     ; return
The JSL $02A9DE happens quite a ways before the extra bit check thing. Does this mean x indexes something else after that routine and that's why it doesn't work, or something?[/color]
Image
User avatar
Chibikko
Posts: 0
Joined: 14 years ago
Location: La Mulana

Re: ASM Help Thread

Post by Chibikko »

Terry von Feleday wrote:Well here's the entire code minus smoke routine then.

Code: Select all

                    CUST_SPRITE_TO_GEN = $44
                    SOUND_TO_GEN = $09
                    NEW_SPRITE_NUM = $7FAB9E
					EXTRA_BITS = $7FAB10

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; sprite code JSL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                    
                    dcb "INIT"              
                    dcb "MAIN"                                    
                    PHB                     
                    PHK                     
                    PLB                     
                    JSR SPRITE_CODE_START   
                    PLB                     
                    RTL      

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; main bullet bill shooter code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;               
RETURN              RTS                     ; return
SPRITE_CODE_START			
					LDA $17AB,x             ; \ return if it's not time to generate
                    BNE RETURN              ; /
                    LDA #$30                ; \ set time till next generation = 30
                    STA $17AB,x             ; /
                    LDA $178B,x             ; \ don't generate if off screen vertically
                    CMP $1C                 ;  |
                    LDA $1793,x             ;  |
                    SBC $1D                 ;  |
                    BNE RETURN              ; /
                    LDA $179B,x             ; \ don't generate if off screen horizontally
                    CMP $1A                 ;  |
                    LDA $17A3,x             ;  |
                    SBC $1B                 ;  |
                    BNE RETURN              ; / 
                    LDA $179B,x             ; \ ?? something else related to x position of generator??
                    SEC                     ;  | 
                    SBC $1A                 ;  |
                    CLC                     ;  |
                    ADC #$10                ;  |
                    CMP #$10                ;  |
                    BCC RETURN              ; /
					
                    JSL $02A9DE             ; \ get an index to an unused sprite slot, return if all slots full
                    BMI RETURN	            ; / after: Y has index of sprite being generated

                    PHX                     ; \ before: X must have index of sprite being generated
                    TYX                     ; / routine clears *all* old sprite values...

GENERATE_SPRITE     LDA #SOUND_TO_GEN       ; \ play sound effect
                    STA $1DFC               ; /
                    LDA #$01                ; \ set sprite status for new sprite
                    STA $14C8,y             ; /
                    LDA #CUST_SPRITE_TO_GEN ; \ set sprite number for new sprite
                    STA NEW_SPRITE_NUM,x    ; /
					JSL $07F7D2		    	; reset sprite properties 
                    JSL $0187A7             ; get table values for custom sprite       
                    LDA #$88                ; mark as initialized
                    STA EXTRA_BITS,x
                    PLX                     ; call init routine on sprite
					
                    LDA $179B,x             ; \ set x position for new sprite
                    STA $00E4,y             ;  |
                    LDA $17A3,x             ;  |
                    STA $14E0,y             ; /
                    LDA $178B,x             ; \ set y position for new sprite
                    SEC                     ;  | (y position of generator - 1)
                    SBC #$01                ;  |
                    STA $00D8,y             ;  |
                    LDA $1793,x             ;  |
                    SBC #$00                ;  |
                    STA $14D4,y             ; /
					
					LDA $7FAB10,x	;\ Checks Extra Bit.
					AND #$04		;| 
					BEQ BitClear	;|
					LDA #$01		;|
					STA $1510,y		;| If Bit is set, set this address to 1
					BRA BitSet		;|
									;| 
					BitClear:		;|
					LDA #$00
					STA $1510,y		;/ If bit is clear, set it to 0 instead.
					BitSet:

                    JSR SUB_SMOKE           ; display smoke graphic
					RTS                     ; return
The JSL $02A9DE happens quite a ways before the extra bit check thing. Does this mean x indexes something else after that routine and that's why it doesn't work, or something?[/color]
Everything looks good except "JSL $0187A7" which should break everything.

Code: Select all

;$0187A7
InitHammerBrother:  22 59 DA 02   JSL.L Return02DA59
; Do nothing at all (Might as well be NOPs) 
Return0187AB:       60            RTS                       ; Return 
Notice that it ends in RTS when you used JSL to get to the code. I do not know what was supposed to happen but that is definitely not right.
I am a cat. You cannot prove otherwise.
User avatar
Terry von Feleday
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by Terry von Feleday »

Huh, well that's curious. I'm not familiar with those kinds of address jumps, so how do I fix it? Do I just change it to JSR, do I need to alter that routine to RTL, or can I just remove that jump entirely because it doesn't look like it actually does anything?
Image
User avatar
yoshicookiezeus
Help! pawprint
Posts: 148
Joined: 15 years ago
Pronouns: he/him/his
Location: Sweden

Re: ASM Help Thread

Post by yoshicookiezeus »

Chibikko wrote:Everything looks good except "JSL $0187A7" which should break everything.
No, it actually doesn't. All shooters that generate custom sprites use it without problem; I would guess that Spritetool hijacks it. And it doesn't seem to mess with any of the registers either.
User avatar
Terry von Feleday
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by Terry von Feleday »

Okay, then now I'm just plain at a loss as to what's wrong. Could someone make a shooter and sprite that does what I want(Just a shooter that makes the sprite act differently depending on whether its extra bit is set) that works so I could use that as a base?

I guess I could take the easy way out and take an additional sprite and shooter instead, but I'd prefer not to hog up too many sprite slots...
Image
User avatar
Chibikko
Posts: 0
Joined: 14 years ago
Location: La Mulana

Re: ASM Help Thread

Post by Chibikko »

yoshicookiezeus wrote:
Chibikko wrote:Everything looks good except "JSL $0187A7" which should break everything.
No, it actually doesn't. All shooters that generate custom sprites use it without problem; I would guess that Spritetool hijacks it. And it doesn't seem to mess with any of the registers either.
According to the source code, you are correct. I do not know why I did not think of this: that spot is perfect for a hijack.
Terry von Feleday wrote:I guess I could take the easy way out and take an additional sprite and shooter instead, but I'd prefer not to hog up too many sprite slots...
It appears that shooters do not use the extra bit in the same way as sprites. There are a lot of shooter slots so just use two. If they set $1510,y to a different value, and the sprite tests for this, then only one sprite is needed.

Code: Select all

; SPRITE CODE INIT
		dcb "INIT"
		LDA $1510,x
		BEQ BIT_CLEAR
		;;; DO SOMETHING
		BRA END_BIT
BIT_CLEAR
		;;; DO SOMETHING ELSE
END_BIT
		RTL
I am a cat. You cannot prove otherwise.
User avatar
Chdata
Posts: 11
Joined: 14 years ago
Location: Computer Chair

Re: ASM Help Thread

Post by Chdata »

So - is it true that you can LevelASM away the hud? If so, may I please get the code?

Just change the Y pos of layer 3 using the register... 2112 or 2111 one of those.

I also have a code that's probably safer that gets rid of the HUD EXCEPT for the item box. Or we could make a loop of layer 3 upload although that's probably not the best way to go about it.
Image
Trouble with a capital COW.

<math>\tan{A}\sin{N}</math>
Kil2
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by Kil2 »

I already tried that. It doesn't get rid of the hud. By the time the levelasm is run, half of the hud has already been drawn, so it looks like it's being cutoff.
User avatar
Chdata
Posts: 11
Joined: 14 years ago
Location: Computer Chair

Re: ASM Help Thread

Post by Chdata »

Make a patch that hijacks the status bar. Infact I have a patch homing made for some random smwhacker on smwc.

Code: Select all

!MainCodeLocation	= $xxxxxx
!FLAG_RAM = $yyyyyy

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


LoRom
Header


org $008292

		JSL Trick_Disable		
		NOP	

org $008DAC	
		JML NO_StatusBar



!MAIN_CODE_SIZE		= END_OF_FILE-OW_TABLE_CODE

org !MainCodeLocation
			db "STAR"			
			dw !MAIN_CODE_SIZE-$01
			dw !MAIN_CODE_SIZE-$01^$FFFF


Trick_Disable:		LDY #$24		
			LDA !FLAG_RAM
			AND #$01
			BEQ If_Wanted
			LDY #$FF
If_Wanted:		LDA $4211
			RTL


NO_StatusBar:		LDA !FLAG_RAM
			AND #$02
			BEQ DrawStatus_ON
			JML $808DE6
DrawStatus_ON:		STZ $2115
			LDA #$42
			JML $808DB1



END_OF_FILE:
Image
Trouble with a capital COW.

<math>\tan{A}\sin{N}</math>
Kil2
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by Kil2 »

yeah you need to make an external patch or use the IRQ patch.
User avatar
Chdata
Posts: 11
Joined: 14 years ago
Location: Computer Chair

Re: ASM Help Thread

Post by Chdata »

I just posted an external patch...
(then again I've never tried it myself)

Code: Select all

Levelxx:
	LDX #$00
	LDA #$FC
.Loop
	CPX #$0C
	BEQ .NoEraser
	CPX #$0F
	BEQ .NoEraser
	CPX #$27
	BEQ .NoEraser
	CPX #$2A
	BEQ .NoEraser
	STA $0EF9,x
.NoEraser
	INX
	CPX #55
	BNE .Loop
	RTS
Image
Trouble with a capital COW.

<math>\tan{A}\sin{N}</math>
User avatar
Cheeseofdoom
Posts: 0
Joined: 14 years ago

Re: ASM Help Thread

Post by Cheeseofdoom »

I need to be able to have two music tracks for my level, one for when the o/off switch is in the on position, and one for when it's in the off position. Would anyone be willing to help with that?
User avatar
Tails_155
May be dead.
Posts: 23
Joined: 14 years ago
First name: Kit/Tails
Pronouns: he/him/his
Location: The Moon or Something.

Re: ASM Help Thread

Post by Tails_155 »

Kil2 wrote:The scrolling star code from my level should be drag & droppable into any level with layer 2 stars that doesn't have vertical scrolling. If you know how to patch levelasm you could try copying this to your level number

Code: Select all

;;;;; LEVEL ASM FOR LEVEL B0 THE CEMENT ELEMENTAL PLANE


!FREERAMB0 = $7FA100

	REP #$20
	LDA #$0F02

	STA $4330	

	LDA #$A100	
	STA $4332	
	LDY #$7F	
	STY $4334	
	SEP #$20	
	LDA #$08	
	TSB $0D9F

			
	LDA $13			
	STA !FREERAMB0+$1
	CLC
	ADC #$64
	STA !FREERAMB0+$13

	LDA $0661
	STA !FREERAMB0+$4
	LDA $0662
	STA !FREERAMB0+$7
	LDA $0663
	STA !FREERAMB0+$A
	LDA $0662
	STA !FREERAMB0+$D
	LDA $0661
	STA !FREERAMB0+$10

	LDA $13
	LSR
	BCS NoINC1B0
	INC $0661

NoINC1B0:
	LDA $13
	LSR
	BCS NoINC2B0
	LSR
	BCS NoINC2B0
	INC $0662

NoINC2B0:
	LDA $13
	LSR
	BCS ReturnB0
	LSR
	BCS ReturnB0
	LSR
	BCS ReturnB0
	INC $0663

ReturnB0:

	RTS
I tried this, it actually works fine for the level. Problem: The horizontal scroll warps in some odd way, I don't know where the repeat happens.
I'm member number 499 (⬤)∀(⬤)
Locked