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
STA.w $0100 ; RAM_GameMode
RTL ; Return
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
CLC : ADC $00
SEC : SBC $01
I'm getting less and less sure anyone will actually have a use for this... oh well.
This one saves space:
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:
STY $02 ; You can also preserve Y with the stack if you wish
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
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
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.