don't click here

Z80 asm to hex guide

Discussion in 'Engineering & Reverse Engineering' started by Ravenfreak, Nov 22, 2010.

Thread Status:
Not open for further replies.
  1. Ravenfreak


    I dunno what I should put here. Tech Member
    O'Fallon Mo
    Hacking Sonic Drift, Writer at Sonic Cage Dome
    This guide should be useful for those who want to hack SMS/GG ROMS in a hex editor. This also goes for GB ROMs for the most part, though some instructions and registers are missing from the GB Z80 instruction set that are part of the Zilog Z80 instruction set. I obviously didn't add the binary data for each offset, but if you'd like me to, I can add that. This list isn't complete yet, and some things need to be edited.
    Hex z80 instruction description
    F3 di disable interrupts
    ED56 im interrupt mode (in this case 1, for the most part it seems all Sonic SMS games only use interrupt mode 1)
    DB in increment data
    3C inc
    FE cp compare
    FA jr jump relative
    C3 jp jump
    BF ld load
    87 add add
    3A a accumulator (3E while data is being stored here ex: ld (0bh),a)
    CD call call subroutine
    6E l register l
    F5 push push data onto stack pointer note: 10 is decresed each time a value is pushed to the stack in hex, so the next value of data to be pushed onto the stack would be E5 and so on.
    FD af accumulator/flag registers
    31 sp stack pointer
    00 nop no operation
    44 b register b
    65 h register h
    EE xor extended or
    CB iy register iy
    D3 out output to port
    DD ix register ix
    E6 and
    F0 bit bit set
    F6 or
    FD iy register iy
    21 z zero flag
    36 hl registers (only while registers are being stored at a offset. ex: ld (hl),00h)
    FB ei enable interrupts
    D6 sub subtract
    FF rst restart
    D9 reti return from interrupt
  2. Bgvanbur


    Tech Member
    a disassembly, some small Sega CD projects
    Your chart is not as useful as it could be since it lacks any meaningful sorting.

    For decoding from hex, it useful to have a chart that is sorted by the resulting hex values (for example this is a nice chart for decoding 68k M68kOpcodes-v2.3.pdf). And when encoding back to hex it would be nice to have a chart that is sorted by mnemonic. Your table has no apparent sorting.
  3. Sorry if I'm being rude, but how is this a guide? It's just a very incomplete table. Maybe you should add more information, explain to people how this information can be used, provide a few examples, and make the list complete enough to be useful, otherwise I fail to see how this could offer anything that Google searches for "Z80 instruction set" or "Z80 opcodes" can't.
  4. Ravenfreak


    I dunno what I should put here. Tech Member
    O'Fallon Mo
    Hacking Sonic Drift, Writer at Sonic Cage Dome
    Yeah, I was planning on sorting it, maybe I should add code tags to make it way more organized. (If that'll even work. I might just attach my .txt list.) I did sorted out while I was posting, but as you see everything got put together after the thread was posted, same thing happened on SSRG when I posted it on there too. :\ Right now, it looks like a huge mess sorry about that. Also sorry about not adding "incomplete" on the subject line, as I did that on SSRG and was tired when I posted it on here that I forgot. Also I got rid of the guide tag as it isn't a guide. :v: I'm also going to add example code instead of describing what each thing does (I seriously don't know why I didn't do that in the first place. :v:) And finally, I'll add the binary values too. So basically I just need to clean it up, correct? :v:
Thread Status:
Not open for further replies.