| Sprite/Block/HDMA/ASM Code Library |
|
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - Sprite/Block/HDMA/ASM Code Library |
|
Pages: 1 ... 4 5 6 7 8 9 10  |
Thread Closed |
|
|
| Posted on 2012-01-23 03:09:42 AM |
Link |
|
|
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?
|
|
| Posted on 2012-02-15 02:31:05 PM |
Link |
|
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.
CodeSubSideExit:
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
|
| Last edited on 2012-02-16 02:27:23 PM by andy_k_250. |
|
| Posted on 2012-03-27 10:21:27 PM |
Link |
|
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.
Codemacro WriteToWRAM(destaddr, destbank, srcaddr, srcbank, datasize)
PHP
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 ;
endmacro
Not sure how reading from RAM is handled... any help? Since $2180 handles both read/writes.
|
| Last edited on 2012-03-27 10:22:16 PM by Ladida. |
|
| Posted on 2012-03-28 08:41:11 AM |
Link |
|
|
IIRC setting bit 7 of $43x0 should work.
|
|
| Posted on 2012-06-10 03:15:15 PM |
Link |
|
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.
Code LDA #$FF
SEC : SBC $00 : LSR
STA $02
CLC : ADC $00
STA $03
LDA #$E0
SEC : SBC $01
AND #$FE
TAX
REP #$10
.loop
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.
|
|
| Posted on 2012-07-09 02:25:03 PM |
Link |
|
ExecutePtr macro I made:
CodeThis 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
.Label
endmacro
You can return from that one with a RTS.
CodeThis one is faster:
macro ExecutePtr(PointerTable)
STY $02 ; You can also preserve Y with the stack if you wish
REP #$30
AND #$00FF
ASL A
CLC
ADC #<PointerTable>
TAY
LDA $0000,y
STA $00
SEP #$30
LDY $02
JMP ($0000)
endmacro
You can return from that with a JMP.
|
| Last edited on 2012-07-09 02:35:43 PM by wiiqwertyuiop. |
|
|
|
| Posted on 2012-08-07 02:28:33 AM |
Link |
|
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.
|
|
| Posted on 2012-08-07 12:54:33 PM |
Link |
|
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.)
|
|
|
|
| Posted on 2012-09-16 07:34:06 PM |
Link |
|
|
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?
|
|
| Posted on 2012-09-17 12:52:37 AM |
Link |
|
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.
|
|
| Posted on 2012-09-23 02:11:53 PM |
Link |
|
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.
|
|
| Posted on 2012-10-19 04:36:50 AM |
Link |
|
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
|
| Last edited on 2012-10-20 05:55:35 PM by Ladida. |
|
| Posted on 2012-10-24 07:39:40 PM |
Link |
|
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.
|
|
| Posted on 2012-10-26 12:05:11 AM |
Link |
|
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:
here
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.
|
| Last edited on 2012-10-26 03:14:43 AM by Ladida. |
|
|
Pages: 1 ... 4 5 6 7 8 9 10  |
Thread Closed |
|
|
|
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - Sprite/Block/HDMA/ASM Code Library |