(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
03-28-24 11:25 AM
0 users currently in SMW Hacking.
Acmlm's Board - I3 Archive - SMW Hacking - CPU usage meter!
  
User name:
Password:
Reply:
 
Options: - -
Quik-Attach:
Preview for more options

Max size 1.00 MB, types: png, gif, jpg, txt, zip, rar, tar, gz, 7z, ace, mp3, ogg, mid, ips, bz2, lzh, psd

UserPost
MathOnNapkins
Posts: 868/1106
Ah... figured it was something like that. I was only weirded out b/c I thought you included your own data for the star's graphical data, etc. But since it used existing graphical data I'm not all that surprised. Trying to think if this would be easy to put into LTTP... probably. I've got enough room.
BMF54123
Posts: 695/876
It really wasn't that complicated.

My routine hooks a JSR right before the idle loop. All it does is write #$0B to the brightness register and set up a single sprite in OAM. The sprite's attributes are fixed, aside from the vertical position, which is obtained by reading the V-counter from $213D. Although the sprite has a delay of 1 frame (due to the way OAM is handled), the brightness change takes effect immediately.

All in all, the code performs two reads and five writes, which fits nicely into 36 bytes.

JSR $9322 ; "master index" handler
BRA #$00 ; used to disable/enable code
LDA #$0B
STA $2100 ; brightness register
LDA $2137 ; latch V-counter
LDA $213D ; read V-counter (lower 8 bits)
STA $02ED ; sprite Y
LDA #$EF ; star graphic
STA $02EE
LDA #$34 ; palette, priority
STA $02EF
STZ $02EC ; sprite X
STZ $045B ; sprite size
RTS
MathOnNapkins
Posts: 867/1106
I haven't sat down and disassembled this patch yet, but simply want to know whether this restores existing code in the ROM, or adds in the functionality itself. It seems quite a lot to accomplish in just $24 bytes from scratch.
Sukasa
Posts: 1835/2068
Whoa... I am so downloading that when I get home
Raccoon Sam
Posts: 804/1040
Hey! The Super Metroid has a similiar option in the debug mode!
I always wondered what the rising and falling dark thing was. Thanks.
Smallhacker
Posts: 740/832
wtf

















...brilliant!
3.14159265358979323846
Posts: 38/61
It's an interesing yet useful patch. Everybody(especially SSM and me)will find this very useful. Good work, BMF

*download as soon as I see this thread*
Kiwisauce
Posts: 24/41
Wow! Thanks! This is sure to come in handy.
rubixcuber
Posts: 201/356
Ooh, nifty! I haven't had much problem with slowdown, but this will be fun to mess with. I was about to ask what method you used to dim the screen, but I'll just disassemble it. I like figuring things out for myself.
Kailieann
Posts: 487/808
Snazzy. I can definately see this being useful.
BMF54123
Posts: 693/876


cpumeter.ips

(WARNING: open your ROM and make sure that $819C-$81BF is empty (all FFs) before applying this patch!)

What this patch does is add some visual indicators of how many CPU cycles your hack is using per frame, which quickly tells you how many sprites and/or custom blocks you can have in an area before slowdown will occur. Similar systems have been used in many commercial games during development, for the same purpose (ex: StarTropics, Gunstar Heroes beta, Super Mario 64).

By default, the patch will show a yellow star and dim the screen at the point where the CPU enters its main wait loop (when there's nothing left to do before the frame is drawn). The lower the line, the more work the CPU has done in that particular frame. If the line hits the bottom of the screen, it means there is no more time to process the current frame, and the previous frame is displayed again (which causes slowdown). If slowdown is severe enough, the star may wrap back to the top of the screen and the brightness may flicker. This is particularly noticeable during the palette fade after you pass the goal point (it's a really long, slow process!).

This patch is easy to disable, and can be permanently left in your ROM with no ill effects (unless some future hack overwrites the space it occupies). To disable it, simply change $81A0 to 1E. If you just want to eliminate the screen-dimming effect, change the same address to 05 instead.

Enjoy!
Acmlm's Board - I3 Archive - SMW Hacking - CPU usage meter!


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.011 seconds; used 351.74 kB (max 398.35 kB)