| |||
Views: 88,491,388 |
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search | 04-27-24 06:15 AM |
|
Guest: Register | Login |
0 users currently in ROM Hacking | 3 guests | 1 bot |
Main - ROM Hacking - CHR-RAM Writing/Swapping Thread | New thread | New reply |
RetroRain |
| ||
Fuzz Ball Level: 66 Posts: 600/994 EXP: 2438351 Next: 23500 Since: 09-30-07 Last post: 1936 days Last view: 958 days |
I had a painful day yesterday. I spent literally the whole day trying to figure out how to deal with CHR-RAM. I have had tons of trouble with CHR-RAM in the past, really getting turned off with games that have it, and not CHR-ROM, since CHR-ROM is easier to deal with. But after all of my trouble yesterday, I finally figured out how to deal with CHR-RAM. A couple of years of mystery has now been unveiled. And yes, it has been a couple of years, but bear in mind, that I haven't hacked in a long time. So, it simply was a question that I never got an answer to, until yesterday when I was finally determined to get to the bottom of this once and for all.
Now, why am I making this thread? Very simple. Through ALL of the searching I have done on the Internet, and you can search too if you want, there is not one decent document that covers how to deal with CHR-RAM, AT ALL. Which is bullshit considering how long the ROM hacking scene has been around. So, I will unveil the mystery, and post it here, for anyone who needs to deal with CHR-RAM, but doesn't know how to. So, here it goes: 1. Put the wait for Vblank code: wait_vblank: LDA $2002 BPL wait_vblank 2. Set $2006 to where you want to write to. So if tile $00 on the left side of the PPU, then LDA #$00 STA $2006 STA $2006 If $00 on the right side of the PPU, then LDA #$10 STA $2006 LDA #$00 STA $2006 You have to write to $2006 twice. If it is tile $20 on the right side, you want to write to, it's: LDA #$12 STA $2006 LDA #$00 STA $2006 The numbers are different when it comes to PPU tiles, because of the size. 3. Run a loop 16 times, since 16 bytes make up one 8x8 tile. During that loop, write your tiles from a table close-by, to $2007. That's it! See below. So, whenever you need to write one tile to the PPU for a game that uses CHR-RAM, you can copy this code, and use it for your own purposes. For multiple tiles, just use another loop for multiple cycles. Note: I was able to write $90 bytes without problems. If you try to write too much, this will create problems in the PPU and on the screen. I believe it is because you are trying to write too much during vblank. It can only take so much. I believe the way around that, is to wait for vblank, then shut the screen off, write everything you need to write, and then turn the screen back on. I haven't tested that yet, but I will soon. If anyone can confirm that this works, feel free to reply. ____________________ My YouTube Channel |
Hamtaro126 |
| ||
Cheep-cheep Level: 33 Posts: 158/194 EXP: 212852 Next: 16327 Since: 05-02-07 From: Shelton, WA Last post: 2473 days Last view: 2316 days |
Here is another, Better to read one, Using your base code:
____________________ Mah boi, romhacking is what all true warriors strive for! I wonder what's for dinner? |
Main - ROM Hacking - CHR-RAM Writing/Swapping Thread | New thread | New reply |
© 2005-2023 Acmlm, blackhole89, Xkeeper et al. |
MySQL - queries: 42, rows: 64/64, time: 0.015 seconds. |