Author
|
Topic: Menu Compression. (Read 5 times)
|
ded302
Guest
|
|
« Reply #30 on: May 10, 2007, 02:15:04 pm » |
|
Alright thanks, Ill try it again when I get home from work.
|
|
|
|
ded302
Guest
|
|
« Reply #31 on: June 05, 2007, 10:24:06 pm » |
|
I have been working on an easy hack for "Sted - Starfield of memorable relics" and have been able to use a tracer and debugger to find the hp for the enemies, and the prices of items in shops. Since this is my first hack, would cutting the enemies hp and prices of items in half be a good idea for a first easy hack?
|
|
|
|
Nightcrawler
Guest
|
|
« Reply #32 on: June 06, 2007, 07:36:31 am » |
|
Sure. Why not? It would be a good exercise for you to write some new code that reduces all prices and hp amounts by 1/2 on load. Remember shifting right divides binary numbers by 2. That's a simple way to do even division.
|
|
|
|
ded302
Guest
|
|
« Reply #33 on: June 06, 2007, 10:20:13 am » |
|
If I was to do that, would I use an assembler to compile the shift code and disassemble the file to insert the compiled code in?
|
|
|
|
Nightcrawler
Guest
|
|
« Reply #34 on: June 06, 2007, 11:45:07 am » |
|
Yes. you can do that, but ideally, you'd want to use a cross assembler which would be able to assemble your code right into the ROM in one step. I haven't done any NES hacking in years though, so I can't recommend a specific tool to do this.
Remember though, if you're adding instructions, you'll need to find some free space in the ROM. For example, say you want to add a single shit instruction right after it loads the price value. It's not as simple as just 'adding' the instruction. You can't do that(unless you disassembled and reassembled the entire ROM which is unlikely).
Instead, you'd strategically replace an instruction or two and jump a new routine in a new spot in the ROM. There you'd do your shift, and take care fo the instructions you replaced earlier and return back to the original game code.
|
|
|
|
ded302
Guest
|
|
« Reply #35 on: June 06, 2007, 12:18:04 pm » |
|
Ill try using your methods to add an instruction, buy Ill have to study some 6502 asm docs before I can do that.
I have another question, how would I find an single instruction like lda ($26),y in a rom?
|
|
« Last Edit: June 11, 2007, 04:52:14 pm by ded302 »
|
|
|
|
UglyJoe
Guest
|
|
« Reply #36 on: June 11, 2007, 09:18:45 pm » |
|
You could always convert the instruction you're looking for into its opcode ( see here) and then search for it in a hex editor. For example, look at: Mnemonic Addressing Mode Opcode --------------------------------------- LDA #aa A9 LDA $aa A5 LDA $aa,X B5 LDA $aaaa AD LDA $aaaa,X BD LDA $aaaa,Y B9 LDA ($aa,X) A1 LDA ($aa),Y B1
lda ($26),y would be correspond to LDA ($aa),Y B1so, your command in hex would be "B1 26". Keep in mind that something like lda $1234 would be "AD 34 12" and not "AD 12 34". Hope that helps.
|
|
|
|
ded302
Guest
|
|
« Reply #37 on: June 11, 2007, 11:13:36 pm » |
|
Yeah, your advice helped. I was able to find that line of code in a hex editor.
When Im looking for free space in a rom, what lines of code represent free space. Is it a brk or nop instruction?
|
|
« Last Edit: June 13, 2007, 01:28:16 pm by ded302 »
|
|
|
|
KingMike
Guest
|
|
« Reply #38 on: June 13, 2007, 03:39:23 pm » |
|
Big chunks of 00s or FFs are likely candidates. But some games might also use junk data to hide free space. When I looked at STED (making a hack to show EXP on the data menu), there wasn't much free space. I vaguely remember seeing some text that looked like debug menu text near the end of the program ROM. If there's no way to access it, then I suppose that could be considered free space.
|
|
|
|
Spikeman
Guest
|
|
« Reply #39 on: June 13, 2007, 04:03:47 pm » |
|
Also you can look for gaps in the graphics to use as free space, some games like to space out the graphics so they start at convenient addresses. Use this to your advantage.
|
|
|
|
ded302
Guest
|
|
« Reply #40 on: June 14, 2007, 01:03:53 am » |
|
I was able to use your tips to find free space in the rom, and add some code in there to cut shop prices in half. The game crashed at the moment before the prices were listed. The LDA instruction that loads the price into memory was replaced by a jump to the free space with the instructions:lda load price into memory, logical shift right, and a jump back into the main code. Is there something I missed?
|
|
|
|
Spikeman
Guest
|
|
« Reply #41 on: June 14, 2007, 01:31:19 am » |
|
I'd say debug and make sure it's doing what you want it to do, if it is you probably overwrote something important.
|
|
|
|
Nightcrawler
Guest
|
|
« Reply #42 on: June 14, 2007, 07:39:02 am » |
|
Yep, you're going to want to use a debugger and look at your code being executed. It'll show you what's happening. It's most likely doing something you didn't intend or expect with the code you wrote.
|
|
|
|
ded302
Guest
|
|
« Reply #43 on: June 14, 2007, 11:58:57 am » |
|
I used my debugger to see what was going on with the code. In the trace log file, the rom halted at the jump. How do I get the address that goes in the jump instruction that points to that new code?
|
|
|
|
RedComet
Guest
|
|
« Reply #44 on: June 14, 2007, 12:52:35 pm » |
|
Care to post the last little bit of your log? It sounds like you're trying to jump from one bank into another bank without swapping it in.
|
|
|
|
|