News:

11 March 2016 - Forum Rules

Main Menu

Question About TG16 rom pointers.

Started by Pikachumanson, October 24, 2012, 12:26:38 PM

Previous topic - Next topic

Pikachumanson

Just for the record I am working on translating Jaseiken(Wicked Holy Sword) Necromancer for the TG 16. I feel it is long overdue for that game to be played in english. How ever I'm kind of confused on the actual process of changing the pointer to increase the amount of text I put in a line.

Let's  say I find a block of text on offset 0002E750. Would the offset be the adress or page number? Or would it be the the first two bytes right before the block of text starts? Also would I needrom where text space is  to do anything with the end byte of that text block?

I've read the Zelda two example in the docs but I didn't really feel it pertained to my game since it has a lot less text than Necromancer and I think it was one of those games where you could change the text length without without too much worry of constraints. I just want to see how you guys handle this situation and what steps you take in changing the pointer around to add more text to a rom where text space is kind of limited.

Also to find the pointer table, am I looking at offsets or the first two bytes before the blocks of text for the address?

dshadoff

OK, first thing you need to know is that the memory is not 'flat', so the processor doesn't look up an address at such a large number.
In fact, the CPU only had a 16-bit address bus, so it can only address memory locations up to FFFF.

In order to make up for this, the NES uses a vareity of external circuitry called "mappers", but the PC Engine uses a single uniform system which is actually built into the CPU.

On a PC Engine, the memory map is divided into 8KB blocks (ie. 0000-1FFFF; 2000-3FFF; 4000-5FFF, etc.), and these memory areas are used as apertures into the larger ROM.  The CPU uses internal registers called "MMRs" which refer to which 8KB block of the ROM is "mapped" into that area of memory at that moment.

0000-1FFF = MMR0 (this is normally mapped to the hardware area of the memory map, value of FF)
2000-3FFF = MMR1 (this is normally mapped to the 'scratchpad RAM' area of the memory map, value of F8)
. . .
E000-FFFF = MMR7 (this is normally mapped to the first block of the cartridge or system card)


So, that is to say, your text at 0002E750 actually means:
- block 17 (hexadecimal) (since 17 hex * 8KB = 0002E000)
- offset 0750 into that block

And it is addressed in memory at one of the following locations (depending which block is looking at that ROM block):

0750, 2750, 4750, 6750, 8750, A750, C750, E750

...But since three of those possible locations are generally pointing elsewhere in the ROM (ie. not block 17), you can probably assume that the CPU has that area mapped in at one of these locations: 4750, 6750, 8750, A750, C750, and you can search for pointers containing those values (don't forget, least-sgnificant byte first).


See more detailed information here:
http://turbo.mindrec.com/tginternals/hw/

Klarth

Quote from: Pikachumanson on October 24, 2012, 12:26:38 PM
I just want to see how you guys handle this situation and what steps you take in changing the pointer around to add more text to a rom where text space is kind of limited.
I'd think the first-line technique would be to implement DTE.  Trying to find space in already-loaded banks or by swapping in new banks is, in my opinion, more difficult than DTE on average.  You can generally save 20% space with a small DTE table.

Judging from the description dshadoff gives, these pointers aren't supported for most text utilities, so check out Atlas if you haven't already.  The learning curve is worth it in the end.

Pikachumanson

Thank you very much for your replies dshadoff and Klarth. I'll be sure to try both of your suggestions out. I wish rom hacking for the TG 16 was documented more but I'm glad there are knowledgeable people like guys on this board that I can go to with questions on this subject.

Karatorian

Well, once you learn the ropes, you can always clean up your notes and post them to the database as docs.
Current ProjectsFinal Fantasy EngineSMB Special for NESStudio Karatorian
@loop: lda (src),y — sta (dst),y — iny — bne @loop — inc src+1 — inc dst+1 — dex — bne @loop

Pikachumanson

I totally intend to. You know, I used to be into the romhacking scene back in the nineties. Even did a half assed "translation" of transformers for the NES and messed around got kicked off Demi's board back when Neo Demiforce was in full swing. Something about me making him out to be a bigot. The situation was totally my fault as I was being a troll back before the term was even coined. I managed to bribe my way back into his forum by offering to contribute a hundred dollars toward getting getting Earthbound Zero. Never did part with the money though, so I was one of the ones he said said F** YOU to when he finally did get it. Shortly thereafter, I dropped out of the romhacking scene never really having done anything of note anyway.

But now, with my teen years long gone and a lot of life lessons later, I feel I want to contribute back to the scene I enjoyed so much for years. So hopefully, I can get through this project and make something worthwhile that future romhackers can use.