News: 11 March 2016 - Forum Rules, Mobile Version
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia

Author Topic: Translations of early Famicom games  (Read 13549 times)

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6128
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Translations of early Famicom games
« Reply #160 on: September 23, 2017, 04:17:35 pm »
By soft reset, I mean reboot the game directly, without returning to the BIOS screen. (similar to how on a Wii, when you push Reset while running a GameCube game, it resets the GC game but doesn't drop you back at the system menu)

A "vector" is a 2-byte pointer to each of the three functions in the CPU's address space.

NMI is "non-maskable interrupt". An "interrupt" is a piece of code that is named because it makes the CPU interrupt whatever routine it was working on (needing a special instruction, RTI, to tell it to resume what it was doing previously to the interruption). "non-maskable" means there isn't a CPU instruction that can explicitly disable it (not affected by CLI, which I think is the relevant instruction). In this case of the NES the NMI is initiated by the PPU. (the CPU can write a command to tell the PPU to disable the NMI. However, it is NMI since the CPU cannot itself disable it.)
The PPU forces that routine to run once each frame, which is often how timing is done on the NES. Typically NMI will also run code to check for pending VRAM/palette write requests (ideally first since it's the most time-critical) as well as sound driver and controller input checks.

Reset is, as may have been implied, the start of the game code. Pushing Power or Reset sets the CPU to that instruction. Some Konami FDS games will call the Reset function of the FDS BIOS directly, as an antipiracy measure to effectively endlessly reboot the console if it detects the game has been hacked.

IRQ is a standard interrupt. I think it can be initiated by the BRK instruction but I've never seen it done intentionally (I've only seen it before because I recall it is opcode 00, making it a common thing to happen when debugging bad code.) The stock NES hardware doesn't use it but some of the more advanced mappers (such as MMC3) use it for some of the more advanced functions (like split-screen scrolling).

Oddly, the Master System uses NMI for the Pause button and makes Reset function like a gameplay button the game can ignore if it feels like it. Sounds like they should've been handled the opposite. :P
« Last Edit: September 23, 2017, 04:22:36 pm by KingMike »
Quote
Sir Howard Stringer, chief executive of Sony, on Christmas sales of the PS3:
"It's a little fortuitous that the Wii is running out of hardware."

Psyklax

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
    • Psyklax Translations
Re: Translations of early Famicom games
« Reply #161 on: September 23, 2017, 04:53:18 pm »
I knew what you meant regarding soft reset, I meant that FCEUX doesn't return to the BIOS when you do a soft reset, but I've no idea what a real FDS would do as I don't have one.

Interesting notes about those other things. I always assumed 00 (BRK) would just stop the game entirely. Still not sure I follow NMI or IRQ though, I'll need to read more about it, but in my hacking it's not something that's really been necessary to know. I did wonder how games would go into infinite loops (such as JMP to themselves, over and over) but still eventually continue the program counter. I guess it has something to do with the PPU saying "okay, next frame, get on with it". :)

Interesting mention of the SMS pause button too, didn't know it would actually freeze the game.

EDIT: since I first wrote this post, I've translated Breeder on the FDS. :D Literally all that there was was the "set side B" and "please wait" messages: everything else is in English. Credits, menus, everything. It's interesting to look on the disk, though. I mentioned that Knight Lore had files for each level which it loaded in to the 32KB RAM as required, but this game looks more like a ROM: side A has 32KB PRG and 8KB CHR files, side B the same, plus save data. Unsurprisingly, the side A file doesn't use anywhere near enough of that 32KB, so it's mostly empty. I added together all the files - without the empty space - and it came to 58KB. Why it's even double sided I'll never know. :D
« Last Edit: September 23, 2017, 06:11:16 pm by Psyklax »

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6128
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Translations of early Famicom games
« Reply #162 on: September 23, 2017, 08:05:17 pm »
Interesting notes about those other things. I always assumed 00 (BRK) would just stop the game entirely. Still not sure I follow NMI or IRQ though, I'll need to read more about it, but in my hacking it's not something that's really been necessary to know. I did wonder how games would go into infinite loops (such as JMP to themselves, over and over) but still eventually continue the program counter. I guess it has something to do with the PPU saying "okay, next frame, get on with it". :)

Supposedly the better way to detect Vblank (than directly checking $2002),
is to do something like
Code: [Select]
LDA #$00
STA Flag
Loop:
CMP #$00
BNE Loop

and then in the NMI route set Loop to a non-zero value.

One possible way of writing to VRAM is to format data in RAM (when it's time to write data to VRAM, you want the CPU to just blast it in there, not waste time calculating it).
Then set a flag that tells the NMI routine data is ready to be written. (the NMI routine would thus have code to read the formatted data and write it)
The weird thing about the NES PPU is that every time data is written to VRAM (even like tile data), the scroll registers need to be rewritten afterwards or the PPU freaks out, even if not scrolling the screen.
Quote
Sir Howard Stringer, chief executive of Sony, on Christmas sales of the PS3:
"It's a little fortuitous that the Wii is running out of hardware."

Eien Ni Hen

  • Hero Member
  • *****
  • Posts: 859
  • You entitled girlfriend!
    • View Profile
    • Desert Bus Translations
Re: Translations of early Famicom games
« Reply #163 on: October 02, 2017, 01:36:38 pm »
Please do! Here are the two blocks of Outlanders that I dumped with the work I've done so far.

I'm done with the Outlanders script. This is probably a dumb question, but where do I post it?
Soon the super karate monkey death car would park in my space. But Jimmy has fancy plans... and pants to match. The monkey clown horrible karate round and yummy like cute small baby chick would beat the donkey.

Psyklax

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
    • Psyklax Translations
Re: Translations of early Famicom games
« Reply #164 on: October 02, 2017, 05:03:11 pm »
I'm done with the Outlanders script. This is probably a dumb question, but where do I post it?

It's not a dumb question at all, but if you were amending Filler's script, I guess you could PM him. Of course I don't know who's going to hack the script into the game, but I could give it a try if nobody else has. Not that I have time for any hacking these days... :(