Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Gameboy ROM architecture

  1. #1

    Default

    Hey!
    Long-time lurker, first-time poster. Hehe.. I was wondering if anyone knows of the structure of the Gameboy ROM (*.gb) files. I already know the opcodes take up 1 byte but what if it needs a parameter? Would that be the closest following byte?
    I hope my question was clear, if not just ask!

    NOTE: I didn't know really where to post this (Nintendo forum, or the Web & Technology forum), so I apologize if it's totally out of place

    Cheers!
    /Dead Zed
    Zed's dead, baby.

  2. #2

    Default

    Try the Pan docs www.work.de/nocash/pandocs.txt. it's an overview of the whole gameboy (I have a html version, but I couldn't find it on the net now).

    For more detailed specification of the opcodes, search Google for "gbcpuman.pdf"

    These two documents are what I used when I tried to write my own gb emulator

  3. #3
    Jet Set Willy
    Guest

    Default

    A Gameboy ROM doesn't have an architecture. It's just a header followed by program instructions and data.

  4. #4

    Default

    What I meant was the 'form' of the opcodes.I knew the opcodes took 1 byte(00-FF) but what if they needed a parameter(Such as instruction 3E, LD A,parameter) If that was the closest following byte after the opcode. Anyway, I found a GB disassembler and verified my suspicions that way. Thanks anyway!

    Denopqrihg: Now thats a comprehensive document!Thanks!

    Edit:Also, while I'm on the subjet: What is the point of opcodes 7F,6D,64,5B,52,49 and 40? They are all 'LD' instructions but the parameters makes no sense! They all load from A to A or B to B and so forth. Allegedly, no flags are set either, or am I missing something?
    Zed's dead, baby.

  5. #5

    Default

    Perhaps they can be used as NOPs?

  6. #6
    Jet Set Willy
    Guest

    Default

    They do have a use - all of those operations will still affect the flags.

  7. #7
    Jet Set Willy
    Guest

    Default

    Originally posted by Dead Zed@Oct 29 2004, 11:54 AM
    Hey!
    Long-time lurker, first-time poster. Hehe.. I was wondering if anyone knows of the structure of the Gameboy ROM (*.gb) files. I already know the opcodes take up 1 byte but what if it needs a parameter? Would that be the closest following byte?
    I hope my question was clear, if not just ask!

    NOTE: I didn't know really where to post this (Nintendo forum, or the Web & Technology forum), so I apologize if it's totally out of place

    Cheers!
    /Dead Zed
    When I wrote my VERY minimal GB emulator (never released, it was just a personal experiment) I used a pre-made Z80 core to get everything working, and then replaced it with my own later on. It's a good way to get quick results, and make sure that all emulated hardware is working before you get stuck in with the CPU stuff. Also, when you are programming your own core, you get visual and audible results when there's a bug in your CPU code.

  8. #8

    Default

    I see.. I guess the Z-flag would be set if the contents of a register was zero when one of those instructions were executed..*Point noted*

    I haven't yet gotten to actually programming the thing. I am still gathering data about it, but thanks for the tip!
    Zed's dead, baby.

  9. #9
    Jet Set Willy
    Guest

    Default

    Well, have fun with it :-)

    And please post your results, even halfway points. And if you get stuck, come post here. I'd love to help, or even experience frustration with the same problem.

    Another handy tip: if the CPU documentation puzzles you, try using NO$GB in step mode. You can then view the instructions being run, and see exactly how they affect RAM and registers.

  10. #10

    Default

    I don't think mov affects the flags.

    GBCPUMan and the Pandocs don't say anything about that, and mov on a normal computer doesn't affect flags either.

    Anyway, in which language are you writing the emulator?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •