Views: 808,231,585
21 users online: AnasMario130, bacon_67_,  BeeKaaaay,  Deeke, Dippy,  ECS.98, edgar, Enderdavid_HD, Hiro-sofT, JamesD28, Mega, MegaNerd14, MORC, Mr. MS, Puduhge, Shiny Ninetales, SomeGuy712x, StayAtHomeStegosaurus, Teows, Vhack, VLSkoot - Guests: 101 - Bots: 211 Users: 42,442 (2,000 active)
Latest: 00_marvelouschester_00
Tip: Do not set the music bypass to 00 in a level with a P-switch/star; the music will endlessly loop.Not logged in.
Sprite/Block/HDMA/ASM Code Library
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Sprite/Block/HDMA/ASM Code Library
Pages: « 1 2 3 4 5 6 7 8 9 10 » Thread Closed


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

Advertising Space

After running the code in LevelASM itself, I'm not surprised that it works in that. Just what routines do LevelASM call that LevelASMTool doesn't anyway?

Here's a bit of code that might be useful for anyone using RPG Hacker's VWF Dialogues Patch in their hack -- this will close the VWF dialogue and exit to the overworld (using the same code that the Side Exit sprite activates). This could easily be modified for any other situations where the dialogue needs to be closed manually while running other code.

	LDA #$0A	; exit from...
	STA $702000	; ...VWF mode *

; * get this address from the output data
; generated after patching vwfdialogues.asm

	STZ.w $0109
	LDA.b #$00
	STA.w $0DD5
	LDA.b #$0B
	STA.w $0100	; RAM_GameMode
	RTL		; Return


[?] Miscellaneous Helpful Hints
If I moderated your hack, there was apparently a 90 percent chance it was rejected.
I had this lying around. It's a DMA code for ROM->RAM transfers (according to regs.txt, you can't do RAM<->RAM). I put it in imamelia's format for usability.

macro WriteToWRAM(destaddr, destbank, srcaddr, srcbank, datasize)
REP #$20			; 16-bit A
SEP #$10			; 8-bit XY
LDA <destaddr>		;
STA $2181			;
LDY.b <destbank>	;
STY $2183			;
LDA #$8000		;
STA $4320			; 1 reg write (read) once, $2180
LDA <srcaddr>		;
STA $4322			; set the lower two bytes of the destination address
LDY.b <srcbank>	;
STY $4324			;
LDA <datasize>		; number of bytes to transfer
STA $4325			;
LDY #$04			; DMA channel 2
STY $420B			;
PLP				;

Not sure how reading from RAM is handled... any help? Since $2180 handles both read/writes.
Here's a piece of code I wrote today and don't mind sharing.

If you're attempting to create rectangular boxes using windowing HDMA (think SMW's message boxes), this might help you set up the table. All you need to do is tell it the box size values (store the width to $00 and the height to $01), and the routine will write to $04A0 so that a box of the specified size is shown in the middle of the screen. Especially useful (or rather, only useful) when you want the box to vary in size (to create an "appearing" effect similar to SMW's).

You might need to give Ersanio's windowing tutorial a read to properly show the window on-screen. Just copy and use the code from the first box, the others are irrelevant as the code I'm posting here handles all that.

	SEC : SBC $00 : LSR
	STA $02
	CLC : ADC $00
	STA $03
	LDA #$E0
	SEC : SBC $01

	REP #$10
	LDA $02
	STA $04A0,x
	LDA $03
	STA $04A1,x
	INX #2
	DEC $01
	LDA $01
	BNE .loop

	SEP #$10

I'm getting less and less sure anyone will actually have a use for this... oh well.


ExecutePtr macro I made:

This one saves space:

macro ExecutePtr(PointerTable)
STY $02                ; Preserve Y
REP #$30               ; A, X, Y = 16-bit
AND #$00FF             ; only get the low byte of A
ASL A                  ; * 2
CLC                    ;\ Get pointer location
ADC #<PointerTable>    ;/
TAY                    ; A -> Y
LDA $0000,y            ; Load pointer
STA $00                ;
SEP #$30               ;
LDY $02                ; Restore Y
PEA .Label-1           ; Where to return
JMP ($0000)            ; Execute pointer

You can return from that one with a RTS.

This one is faster:

macro ExecutePtr(PointerTable)
STY $02                ; You can also preserve Y with the stack if you wish
REP #$30
AND #$00FF
ADC #<PointerTable>
LDA $0000,y
STA $00
SEP #$30
LDY $02
JMP ($0000)

You can return from that with a JMP.
This thread should be in the OP ;p

I own a community of TF2 servers!

ASMT - A new revolutionary ASM system, aka 65c816 ASseMbly Thing
SMWCP - SMW Central Presents a Product- tion long name

Question: Is there anyway to make it so the HDMA is always the gradient it's suppose to be?

Because when I load a level, the background's either its original color, or an entirely different gradient.

Super Mario World's Smaller Sequel:
Super Steppe 1 finished, Super Steppe 2 in progress
Not the place to ask. Try this thread, or make your own.

(Yes, there is a way, as it should be that way by default. You must be doing something wrong.)


I think this isn't the thread for asking stuff.

This should be the thread :3

osu! | Super Mario World Nyaa :3 | Brother

Former known as MetalJo
I need the sprite numbers for all 4 (Green, Red, Blue, and Yellow) Yoshi's to make them spawn from a block. Can someone help me out?
Green is 35.
The others are 35 with $15F6,x (and maybe one or two others?) changed. How hard changing that is depends on what you're using to spawn them.
But I think the question blocks spawn some special case of 2C. I'm not sure about the details.

Oh, and this isn't really the right thread for this. The official hex/asm/etc thread is a better place.

<blm> zsnes users are the flatearthers of emulation
translucent color window

This was hell to make. Windows are hell to make.

By default it's some red box. You can change the color and the scanlines/window positions easily.

a nontranslucent one is provided in the latest asm workshop log, by wiiqwertyuiop.
loldouble post

I made some unorthodox unoptimized layer scrolling macros

say you want to have layer 3 scroll 1.33 times faster than layer 1? how the heck do you do that? with these macros, you just have to do this:

%LayerScroll($1A, #$0000, $22, faster, 1_33)

scrolling slower will also work. only 1.25, 1.33, 1.5, 1.66, and 1.75 work, though others could be easily added. that #$0000 is so you can offset the y position in case you want to mess with y position, though it works with x too. Just add the whole file to the very top of levelasm, since all macros are needed

edit: added 1.125, 1.375, 1.625, and 1.875
triple post ?_?

inverse colors

this cool little code will inverse the colors on the screen except for the status bar, great for when you don't feel like messing with the palette. With some code copying from my previous post on translucent color window, you can have an inverse-color window (SSBB Negative Zone, anyone?).

This messes up sprite priorities, and message boxes, so beware.
i swear im not doing this on purpose

I never understood SMW's circle routine, and most custom sprites seem to use it, which annoyed me. So I tried making my own:


make sure to read the notes at the top. The funny thing is: I was trying to do it differently from SMW, but the table ended up being the exact same. Looks like I was thinking like the SMW devs, rofl.

edit: optimized the code a bit. Now sin and cos use the same table, and said table has been cut in half.
Pages: « 1 2 3 4 5 6 7 8 9 10 » Thread Closed
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Sprite/Block/HDMA/ASM Code Library

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

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

Total queries: 7


Follow Us On

  • YouTube
  • Twitch
  • Twitter


  • Super Mario Bros. X Community
  • Mario Fan Games Galaxy