Sergei Basharov
Sergei Basharov

Reputation: 53850

Communicate with a NES game running in an emulator

I am thinking of creating an arcade machine for fun. Something like this one. I wonder if it's possible to get events from some game, e.g.Super Mario. Assume I finish a level and I want to get that event, with the score and some other data and perform some actions with that data. I am thinking of running the emulator in Windows. Did anybody work on something like this? Are there not too difficult ways to get events and data from old NES games? May be I should run not Windows, but some Linux for that? Well, please share your thoughts about how to do the software part of it.

Upvotes: 4

Views: 1718

Answers (3)

Davyx86
Davyx86

Reputation: 1

IRQ...Go for Interrupt_requests..they triger a interrupt...I have read / and seen the code about it somewhere...even x86 also uses IRQs for communciation with various device a simple exmaple:keyboard when a key is pressed a call is made ti PIC and an IRQ is generated and system knows which key is pressed and the same mech is used in NES

Upvotes: 0

Martin
Martin

Reputation: 38289

Modern emulators such as FCEUX make it possible to interact with the running ROM through Lua scripts (see example video). Using this API you could write a Lua script to:

  1. monitor a certain memory location
  2. wait for it to hold some special value (such as level_just_finished)
  3. read out the current score from memory
  4. do something with the score

In order to know which memory locations to check, you will either need to disassemble the ROM or run it through a debugger, or both. As for Super Mario Bros, there's already a commented disassembly available. The FCEUX emulator also has a built-in debugger/disassembler that you can use.

All of this takes a lot of effort and you would need to know Lua, 6502 assembly, and the inner workings of an NES. For your arcade machine, you might be better off just using an emulator such as UberNES, which automatically can track your highscore for many popular titles.

Upvotes: 6

TreDubZedd
TreDubZedd

Reputation: 2556

Class NES games don't have standard hooks for achievement reporting. The only options I can think of are the following:

  • Rebuild the ROMs in question, with your own hooks (which a custom emulator could handle).
  • Watch the ROM memory footprint directly, and parse the state continually, triggering when you observe some known state.

Both options require that you really understand the internals of a NES ROM.

Upvotes: 2

Related Questions