Sonic and Sega Retro Message Board: Z80 asm to hex guide - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

Z80 asm to hex guide Incomplete, not all instructions are here yet, etc. :\

#1 User is offline Ravenfreak 

Posted 22 November 2010 - 03:41 AM

  • It's a bird, it's a plane, nope it's a ring!
  • Posts: 2289
  • Joined: 24-November 08
  • Gender:Male
  • Location:O'Fallon Mo
  • Project:Mighty No. 9 Universe,various hacking projects
  • Wiki edits:112
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
This post has been edited by Ravenfreak: 22 November 2010 - 05:30 PM

#2 User is offline Bgvanbur 

Posted 22 November 2010 - 09:27 AM

  • Posts: 128
  • Joined: 02-November 10
  • Gender:Male
  • Location:USA
  • Project: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 User is offline tokumaru 

Posted 22 November 2010 - 10:47 AM

  • Posts: 592
  • Joined: 17-June 07
  • Gender:Male
  • Location:Rio de Janeiro
  • Project:Platformer for the NES
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 User is offline Ravenfreak 

Posted 23 November 2010 - 02:56 AM

  • It's a bird, it's a plane, nope it's a ring!
  • Posts: 2289
  • Joined: 24-November 08
  • Gender:Male
  • Location:O'Fallon Mo
  • Project:Mighty No. 9 Universe,various hacking projects
  • Wiki edits:112
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.png 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.png) And finally, I'll add the binary values too. So basically I just need to clean it up, correct? v.png

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users