0

I have recently got my hands on a Z80 system and have been writing a dissasmbler for a debugger (pushing in instructions that are pulled from the memory of the Z80y). I can get the instruction however the problem arises when assembling the ASM, I am finding that most assemblers either don't understand the full set of instructions properly or get some instructions confused meaning it is impossible to convert back to ASM correctly. What I ask from you guys today is if you have one that actually works (the source would be even better). I would also like for it to have a single pass option because it makes this impossible otherwise (well nearly).

One final thing would be to know if anyone has a complete set on instructions for testing as at the moment I only have an 8080 list which means I can't test the extended instructions.

Thanks a lot for any link/files, Andy A

Andy A
  • 137
  • 1
  • 11
  • 2
    You are trying to use an 8080 assembler. Use Z80 tools for a Z80. http://www.z80.info/z80sdt.htm – stark Jan 06 '13 at 02:15
  • 1
    For a complete set of instructions, check out http://clrhome.org/table/. The instructions shown in red are (or perhaps, were) unofficially undocumented. – Jim Mischel Jan 06 '13 at 04:39
  • sdcc has an open source assembler. – old_timer Jan 06 '13 at 05:00
  • The last time I used SDCC, its assembler lacked support for macros, which I saw as a major drawback though it might not matter for your purposes. This was a year or two ago, so things might have changed since. WLA-DX has worked well for me and is open source, though it's not single-pass IIRC. – Michael Apr 16 '13 at 09:10
  • 1
    Actually you could just use Zilog Developer Studio II and just not use any of the new eZ80 instructions. http://store.zilog.com/index.php?option=com_ixxocart&Itemid=1&p=product&id=29&parent=5 – Stefan Paul Noack Apr 27 '13 at 08:34

3 Answers3

2

The Z88 development kit also contains an assembler (z80asm), as well as a C compiler.

It's a two-pass assembler, though. I don't think that a single pass approach would be useful. How would you assemble a JP to a label defined later in a single pass?!

The z88dk toolchain seems to be very portable. I am currently trying to port it to my Zilog eZ80 based platform itself.

Stefan Paul Noack
  • 3,654
  • 1
  • 27
  • 38
  • One-pass assemblers are technically straightforward; I used to build these back in the 70s. A forward reference (load,store,jmp) is handled by emitting a dummy placeholder, recording the placeholder in to-be-resolved-list, and generating a patch with the "fixed up" instruction when the forward referenced information becomes available. In practice the to-be-resolved list never gets very big. You can even do this with forward references to EQUs and or arbitrary expressions. From a functionality point of view, one-vs-two pass makes little difference, and assembly speed doesn't matter much now. – Ira Baxter Apr 16 '13 at 09:27
  • Well, when this is your definition of a single pass assembler, then z80asm is one. I thought that the patching of the adresses counts as a second pass. – Stefan Paul Noack Apr 16 '13 at 10:06
  • "A pass" in assembly is generally interpreted as "reading the assembly source code". If your assembler only reads that source code once, then it is technically a one-pass assembler; if it reads the source code twice to collect symbols in the first pass and produce code in the second, it is two pass. One clever assembler produced by a cohort read the source once and tokenized it to a buffer during the first pass, and then reprocessed the tokens in pass two, making it arguably one-pass. It was much faster than a corresponding real two pass assembler. Would not be practical in a small machine. – Ira Baxter Apr 16 '13 at 10:19
1

The assembler I use for my Z-80 programming projects is zmac.

I've built my own version for Windows with some extensions:

http://members.shaw.ca/gp2000/zmac.html

A Google search for "z80 zmac" can help you locate the original source code.

It's not a single pass assembler, but I think it will suffice.

George Phillips
  • 4,564
  • 27
  • 25
1

Here is the official up-to-date Z80 manual: http://www.zilog.com/manage_directlink.php?filepath=docs/z80/um0080 .

It includes full description of instruction set architecture.

lvd
  • 793
  • 3
  • 12
  • Very useful manual that I never managed to find, unfortunately this project has been dead for a while and it doesn't look like I will be picking it up any time soon. Despite that thank you for the documentation for other that may stumble upon this thread. – Andy A Jan 31 '15 at 12:16
  • But still BEWARE of typos in that doc! :) Particularly, there are still typos in binary codes for ``XOR s`` commands. – lvd Feb 03 '15 at 18:47