Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,480,906
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-25-24 08:39 AM
Guest: Register | Login

0 users currently in ROM Hacking | 2 guests

Main - ROM Hacking - How do you assign graphics to numbers? New thread | New reply


RetroRain
Posted on 06-04-12 01:05 AM Link | Quote | ID: 151217


Fuzz Ball
Level: 66

Posts: 593/994
EXP: 2437968
Next: 23883

Since: 09-30-07

Last post: 1934 days
Last view: 956 days
Let's say you program a new routine for a game, and you use a free RAM address. Now you want display the number of that RAM address using the graphics for the numbers in the game. How would you go about doing that? It is something I always wondered about, since I never wound up doing that before. Now obviously with the NES it is going to involve the PPU. I know how to write graphics using the PPU, but I don't know how I would have the number in RAM be converted to graphics.

____________________
My YouTube Channel

infidelity
Posted on 06-04-12 03:39 PM Link | Quote | ID: 151227


Fuzz Ball
Level: 66

Posts: 226/968
EXP: 2367844
Next: 94007

Since: 05-24-07

Last post: 957 days
Last view: 813 days
Is this about what chr bank you want to be displayed in your ppu?

RetroRain
Posted on 06-04-12 10:36 PM Link | Quote | ID: 151231


Fuzz Ball
Level: 66

Posts: 594/994
EXP: 2437968
Next: 23883

Since: 09-30-07

Last post: 1934 days
Last view: 956 days
No. For instance, you know how you programmed in Zelda, for arrows to have their own RAM address? How do you make the game display the number for the arrows? In other words, how do you make the game use the font for numbers and display it?

It would be impractical and I assume it wouldn't work to have a compare for each number.

If Arrows = 1, then LDA #$56 (Tile $56, lets say it is the number 0)
STA $2007
LDA #$57 (Tile $57, lets say it is the number 1)
STA $2007

So, if Arrows = 1, then it will show the graphics "01".

Do you get what I'm saying? How do you display the contents of the RAM address visually?

____________________
My YouTube Channel

infidelity
Posted on 06-05-12 01:30 AM Link | Quote | ID: 151233


Fuzz Ball
Level: 66

Posts: 228/968
EXP: 2367844
Next: 94007

Since: 05-24-07

Last post: 957 days
Last view: 813 days
Example. A921 8D062O A900 8D0620 after that, either A5xx or ADxxxx 8D0720 60. I know another method, but you need to know where in ram the vram engine is.

RetroRain
Posted on 06-05-12 03:35 PM Link | Quote | ID: 151241


Fuzz Ball
Level: 66

Posts: 595/994
EXP: 2437968
Next: 23883

Since: 09-30-07

Last post: 1934 days
Last view: 956 days
Wait, so you're telling me you can simply call the RAM address, and write it to $2007 itself, without writing an actual tile? And writing the RAM address will automatically translate that into the graphics from the PPU?

____________________
My YouTube Channel

Mattrizzle
Posted on 06-11-12 11:26 PM (rev. 2 of 06-11-12 11:43 PM) Link | Quote | ID: 151322


Red Cheep-cheep
Level: 33

Posts: 194/202
EXP: 226318
Next: 2861

Since: 04-21-07
From: United States

Last post: 2419 days
Last view: 2380 days
I'm not entirely sure if this will work, as I've never programmed anything for the NES (This was adapted from SNES code). Perhaps it will at least lead you in the right direction:


...
LDA #$VramHigh
STA $2006
LDA #$VramLow
STA $2006
LDA Arrows //Arrow quantity address: #$01 in your example
AND #$F0 //Mask to get the tens digit (0)
LSR #4 //Right shift four times to move the tens digit into the ones digit
CLC
ADC #$NumTileStart //#$56 in your example; #$00 + #$56 = #$56
STA $2007
LDA Arrows
AND #$0F //Mask to get the ones digit (1)
CLC
ADC #$NumTileStart //#$01 + #$56 = #$57
STA $2007
...



This example assumes that the value is stored in decimal, and that the numeric tile graphics are in order from 0 to 9.

____________________

Main - ROM Hacking - How do you assign graphics to numbers? New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.021 seconds. (341KB of memory used)
MySQL - queries: 62, rows: 87/88, time: 0.016 seconds.