Author
|
Topic: How does one figure out which assembly language games are written in? (Read 2 times)
|
McKnight
Guest
|
 |
« on: March 29, 2008, 08:11:37 am » |
|
Does anyone here know how to figure out what assembly language games for undocumented consoles are written in? There is a mini-list of consoles and their respective assembly languages in The Definitive Guide to ROM Hacking for Beginners, but it doesn't have certain consoles such as the PC-FX. Furthermore, even with the consoles listed there, the assembly languages for each of them was unknown at one time, and it was up to anyone with the right skills to figure out the respective assembly language. So, how does one figure out which assembly language games are written in for any given console? Even if it's not the PC-FX?
|
|
|
|
KaioShin
Guest
|
 |
« Reply #1 on: March 29, 2008, 08:52:37 am » |
|
Afaik, there aren't any 'Back Box' systems around (maybe aside from some really obscure arcade boards) where it isn't even known which CPU is working inside. If you know the CPU, then you know the assembly language. There aren't any ARM CPUs which use 8080 assembly 
|
|
|
|
McKnight
Guest
|
 |
« Reply #2 on: March 29, 2008, 09:21:58 am » |
|
Afaik, there aren't any 'Back Box' systems around (maybe aside from some really obscure arcade boards) where it isn't even known which CPU is working inside. If you know the CPU, then you know the assembly language. There aren't any ARM CPUs which use 8080 assembly  So, since the PC-FX's CPU is called the NEC V810 (according to Wikipedia), that means that the respective assembly language is called either 810 or V810. Right?
|
|
|
|
Nightcrawler
Guest
|
 |
« Reply #3 on: March 29, 2008, 10:30:53 am » |
|
Right. Assembly language is not per system. It is per CPU. If you know what the CPU is, you can look up the instruction set for that processor. The assembly language isn't called anything. It's just the instruction set for that particular CPU. You just look up datasheets for that CPU. NEC V810 datasheet with instruction set informationChapter 5 is the instruction set. There you go. 
|
|
|
|
Tauwasser
Guest
|
 |
« Reply #4 on: March 29, 2008, 10:34:06 am » |
|
http://www.goliathindustries.com/vb/download/cpu/U10082EJ1V0UM00.pdfSpecification sheet. Google's your best friend. Features a quick introduction to the registers and has a full opcode listing. Now you need to know whether the PC-FX uses a derivative processor (the gameboy for instance uses a z80 variant that has some instructions added and others left out) or just this standard processor. It might be useful to google for additional opcode listings that specify them in a simpler way, though. cYa, Tauwasser
|
|
|
|
McKnight
Guest
|
 |
« Reply #5 on: March 29, 2008, 12:56:29 pm » |
|
Thanks, everyone, for helping me out here.
Next, I'd like to ask about assembly tools. If I understand correctly, they're supposed to be used to translate game code into assembly language. Am I right?
I do understand that it's still complicated, partially since one needs to know the assembly language in question in order to use it. Are there other complications involved?
|
|
|
|
Ryusui
Guest
|
 |
« Reply #6 on: March 29, 2008, 01:05:20 pm » |
|
Well, there's the matter of actually getting code into the ROM.
Some assemblers like xkas expedite the process by letting you compile code directly into a ROM. But if you're working with anything other than the SNES, you'll probably have to insert your compiled code manually via a hex editor. There's also the issue of actually fitting it into the ROM: on occasion you can simply overwrite an old routine with a new one (if the new one's code is smaller), but other times you'll have to find some way to wedge it into blank space, and on systems that employ bank swapping, this isn't always easy. Platforms which use a file system add the wrinkle of fitting your code into memory: I had to resort to a bit of trickery in order to add a code hack to Death Note: The Kira Game.
And assuming you do have to find some place to fit your code, it still won't exactly execute itself. You need to hijack the game's code so it jumps to your routine. Sometimes this is as easy as finding the jump for the routine you want to replace and changing it so that it points to your code instead; other times, you'll have to reposition pieces of the original code in order to insert the jump.
|
|
|
|
McKnight
Guest
|
 |
« Reply #7 on: March 29, 2008, 03:08:00 pm » |
|
Ryusui, thanks for the explanation.
I'm pretty sure that the complications you explained would definitely apply to really complicated stuff, such as new levels, characters, enemies, moves, etc. But what about just changing content such as character sprites or voice clips? Some examples including:
Makeruna! Makendou Z (PC-FX): Translation and voice dub.
Sonic 3 & Knuckles (Genesis): Amy, Cream, and Rouge, instead of the three default playable characters.
Knuckles Chaotix (Sega 32X): Tiara Boobowski (a scrapped character) instead of Mighty the Armadillo.
From my experiences, these things are only accessible through decompression, which requires the use of an assembly tool. But since I wouldn't be changing any of the games' physics by doing these things, will I still run into any of the aforementioned problems?
|
|
|
|
Spikeman
Guest
|
 |
« Reply #8 on: March 29, 2008, 06:21:49 pm » |
|
From my experiences, these things are only accessible through decompression, which requires the use of an assembly tool. But since I wouldn't be changing any of the games' physics by doing these things, will I still run into any of the aforementioned problems?
Most likely yes. In my experience I have to do a bit of code relocation in all but the most minuscule hacks (such as changing the hard-coded width of a sprite). Once you've done it a few times it will be easy as cake. My general technique is this: 1) Find some free space in the ROM. Say I found some at 1234 that is big enough to fit my code. 2) Change an instruction of the original routine to JMP 1234. 3) At the end of my routine at 1234 it will jump back.
|
|
|
|
Ryusui
Guest
|
 |
« Reply #9 on: March 29, 2008, 07:18:27 pm » |
|
From my experiences, these things are only accessible through decompression, which requires the use of an assembly tool. But since I wouldn't be changing any of the games' physics by doing these things, will I still run into any of the aforementioned problems?
Most likely yes. In my experience I have to do a bit of code relocation in all but the most minuscule hacks (such as changing the hard-coded width of a sprite). Once you've done it a few times it will be easy as cake. My general technique is this: 1) Find some free space in the ROM. Say I found some at 1234 that is big enough to fit my code. 2) Change an instruction of the original routine to JMP 1234. 3) At the end of my routine at 1234 it will jump back. More simply, you can use JSR/JSL to jump, and RTS/RTL to return. That way you can run the same code from multiple locations, since the return isn't tied to the original code location (though this may not always be an option).
|
|
|
|
McKnight
Guest
|
 |
« Reply #10 on: March 29, 2008, 07:48:48 pm » |
|
Thanks guys.
Hopefully, I'll be able to figure out sprite hacking on my own when I get around to learning the V810 assembly language. But here's one more thing I'd like to ask:
Does anyone here know how to convert home-made voice clips into hexadecimal? For instance, if I wanted to overwrite the audio line "Urusaiwane!" with "Fussy, aren't you!" I'm assuming that once it's converted from an audio file into hexadecimal, I might be able to use it to overwrite the original line in a hex editor, but I don't know how to even convert it to hex, let alone port it. Could someone fill me in on that, please?
Also, am I correct to assume that the music, sound effects, and dialogue in FMVs are all stored in separate bytes? If that's true, then hopefully, I'll be able to overwrite the original dialogue without tampering with anything else within any given FMV. Right?
|
|
|
|
Ryusui
Guest
|
 |
« Reply #11 on: March 29, 2008, 09:27:43 pm » |
|
It depends. Hopefully the sound and video are stored in common formats which have been documented and are convertible to and from easily editable WAVs and AVIs and the like. If not, you'll have to learn how to write your own tools, which will require quite a bit of expertise (or help from someone who knows what he's doing).
|
|
|
|
UglyJoe
Guest
|
 |
« Reply #12 on: March 29, 2008, 10:07:19 pm » |
|
Does anyone here know how to convert home-made voice clips into hexadecimal? For instance, if I wanted to overwrite the audio line "Urusaiwane!" with "Fussy, aren't you!" I'm assuming that once it's converted from an audio file into hexadecimal, I might be able to use it to overwrite the original line in a hex editor, but I don't know how to even convert it to hex, let alone port it. Could someone fill me in on that, please?
Strictly speaking, any binary file (or any file at all, really) is already in hexadecimal. Hex editors are used to view the numerical value of each byte in a given file. This is as opposed to standard file editors (like Notepad) which will convert each byte into its ASCII value and display that instead (or convert groups of bytes into their Unicode values, etc). What you really need to know is (a) what audio format the game is using, (b) how do you convert your existing audio file into that format, and (c) how do you replace the old audio data with the new audio data.
|
|
|
|
creaothceann
Guest
|
 |
« Reply #13 on: March 30, 2008, 07:23:06 am » |
|
Does anyone here know how to convert home-made voice clips into hexadecimal? For instance, if I wanted to overwrite the audio line "Urusaiwane!" with "Fussy, aren't you!" I'm assuming that once it's converted from an audio file into hexadecimal, I might be able to use it to overwrite the original line in a hex editor, but I don't know how to even convert it to hex, let alone port it. Could someone fill me in on that, please?
Strictly speaking, any binary file (or any file at all, really) is already in hexadecimal. Hex editors are used to view the numerical value of each byte in a given file. This is as opposed to standard file editors (like Notepad) which will convert each byte into its ASCII value and display that instead (or convert groups of bytes into their Unicode values, etc). Exactly. The data is usually treated as bytes (groups of 8 bit). These bytes can be text data (byte values < 32 are control / formatting codes, the rest are the characters), or binary data. The values can be displayed in various formats, for example decimal, hexadecimal, octal or binary. Hex editors are called like that because they use hexadecimal digits.
|
|
|
|
McKnight
Guest
|
 |
« Reply #14 on: March 30, 2008, 12:12:36 pm » |
|
Two more things...
If a game's graphics, script or whatever else is compressed, I understand that an assembly tool is required to decompress whatever I might be trying to change. What steps are involved in decompressing the data in question before the game becomes compatible with a graphics editor, script dumper, etc.? Or does compressed graphics/scripts/etc. mean that I'll have to modify data manually?
Also, when I go into the Utilities section of this site, there are no tools that are exclusive to the PC-FX, although there are tools that say "Multiple" or "NA" in the "Platform" column. What's the difference between "Multiple" and "NA"? Will anything labeled as either be compatible with games for undocumented consoles such as the PC-FX?
|
|
« Last Edit: March 30, 2008, 12:18:18 pm by McKnight »
|
|
|
|
|