+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Nadia for Genesis stuff.
Pages: [1]
Author Topic: Nadia for Genesis stuff.  (Read 2 times)
KingMike
Guest
« on: July 28, 2009, 11:52:47 pm »

I need some help figuring out why this isn't working. Well, it seems to work in Kega Fusion, but not GensTracer, so I suppose I should check if it's my code (though I hear Kega's the more accurate one).
The game was 1MB, expanded to 1.5MB. (I just remembered to change the ROM size in the header, but that didn't fix it.)
The game originally had the text pointers embedded in the event code. So I took the easy but not very elegant solution.
I made a copy of the script, replacing the beginning of each string with an ID.
I use that ID to look up the string in an English pointer table I created.
It works for the first scene in the game (some issues like text going outside the window, but that's something to work on later).
But in the second scene, it freezes, and I have determined it's because it doesn't seem to be reading the pointer right.
Now, as I understand, $1004ED should be ROM, and checking the ROM file, it equals $003D, which is a valid string ID, and not $FF00, as it gets read here.

Code:
11:5080  30 39  MOVE.w  ($00A10000),D0           D0=00000001
11:5086  02 40  ANDI.W  #$00C0,D0                D0=00000020
11:508A  0C 40  CMPI.W  #$0080,D0                D0=00000000
11:508E  67 00  BEQ     #$001E [11:50AE]         
;region checking. Unneeded, but simple enough, so why not? Yes, I'm testing my English hacks in Japanese to avoid resetting the region every time.
11:5092  70 00  MOVEQ   #$00,D0                  D0=00000000 D2=000C04ED
11:5094  2F 08  MOVE.l  A0,-(A7)                 A0=00FF8F0C A7=00FFEFF8
;preserve old A0 contents
11:5096  06 82  ADDI.L  #$00040000,D2            D2=000C04ED
;D2 already had the pointer to the original string. This adjusts it to my duplicate script area.
11:509C  20 42  MOVE.l  D2,A0                    A0=00FF8F0C D2=001004ED
11:509E  30 10  MOVE.w  (A0),D0                  A0=001004ED D0=00000000
;read the string ID
11:50A0  E5 80  ASL.L   #2,D0                    D0=0000FF00
;multiply by 4 for 32-bit pointers
11:50A2  06 80  ADDI.L  #$00120000,D0            D0=0003FC00
;for index into English pointer table
11:50A8  20 40  MOVE.l  D0,A0                    A0=001004ED D0=0015FC00
11:50AA  24 10  MOVE.l  (A0),D2                  A0=0015FC00 D2=001004ED
;read pointer table
11:50AC  20 5F  MOVE.l  (A7)+,A0                 A0=0015FC00 A7=00FFEFF4
;restore old A0 so the game can do whatever
11:50AE  23 C2  MOVE.l  D2,($00FF8E28)           D2=FFFFFFFF
;store pointer to RAM (original instruction)
11:50B4  4E F9  JMP     ($00001C64)             
Kagemusha
Guest
« Reply #1 on: July 29, 2009, 11:16:07 am »

If no one responds, you could try M.I.J.E.T.'s board. He'd probably be willing to help you out. Although he's usually online about once every 3 months.
DarknessSavior
Guest
« Reply #2 on: July 29, 2009, 01:30:33 pm »

Also, RedComet is our resident Genesis expert. He did translate Bare Knuckle III and all.

~DS
tomaitheous
Guest
« Reply #3 on: August 08, 2009, 03:28:04 am »

Have you tried Regen's debugger? I had problems with Gens kmod debugger (or whatever it was). If you verified $1004ED = $003d, then check to see what's at address $0004ed. It's possible for some reason that the emu is wrapping at the 8megabit address ($fffff) on this particular occasion. Other than that, and the emu having some strange behavior/bug, double check to make sure no interrupt routines are reserving any specific registers (i.e. not saving them for speed reasons).
castfiler
Guest
« Reply #4 on: August 08, 2009, 03:01:15 pm »

You're not allowed to read 16-bit words from -odd- addresses (causes a crash on real hardware). Only byte + byte will work for that memory alignment.
KingMike
Guest
« Reply #5 on: August 08, 2009, 09:12:57 pm »

I heard about that before, but I forgot. Thanks!
I'll try changing to read the two bytes separately.
tomaitheous
Guest
« Reply #6 on: August 09, 2009, 12:22:51 am »

Quote from: castfiler on August 08, 2009, 03:01:15 pm
You're not allowed to read 16-bit words from -odd- addresses (causes a crash on real hardware). Only byte + byte will work for that memory alignment.

 Ohh nice catch. Regen is the only Genesis/MD emulator that I know that will actually generate the expection (vector jump) for this (if you enable it in the ini file).
KingMike
Guest
« Reply #7 on: September 29, 2009, 11:51:47 pm »

I've been looking at this again. Expanded the dialog box. I'll have to look at the menus later.

Any particular reason
Label:
...
dbne D3,Label
doesn't seem to work (using Gens Tracer to examine, it seems to just continue with the next instruction even if the low word (I believe the instruction assumes word access) of D3 != 0), but

Label:
...
subq.w #1,D3
bne Label
does. Isn't that functionally identical?
smkd
Guest
« Reply #8 on: September 30, 2009, 01:15:18 am »

I hope I remember my 68k correctly..

for that question,  those two aren't even close.

DBNE has to pass two tests in order to loop again.  If Z flag = 0 then it terminates immediately, the condition you give to the DBxx instruction is what makes it terminate if true.  this isn't related to the decrement it does on D3.  if that test doesn't terminate the loop, it then decrements D3 in your code and branches to your label if the result didn't underflow to FFFF.

SUBQ / BNE will loop if D3 != 0 after decrementing.

edit: I should have mentioned DBRA which sounds like what you want.  There is no initial condition to test, it just terminates if D3 underflows to FFFF.  It won't be the same as SUBQ / BNE though, that terminates if the result = 0000, DBRA terminates if the result = FFFF.
« Last Edit: September 30, 2009, 01:22:32 am by smkd »
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC