Click here to Skip to main content
Click here to Skip to main content

A Full-Featured Z80/8085 Assembler in C++

, 14 May 2014
Rate this:
Please Sign up or sign in to vote.
A full-featured Z80/8085 assembler in C++

Introduction

The task of assembling an assembly language source file into a machine readable output is at the basis of modern computing despite all the modern compilers and interpreted languages that are now built on top of the basic machine language. The Z80/8085 is a basic but complete instruction set that allows conceptual learning and thinking about the topics of assembler without going in depth into special processor features.

Coming soon: A Windows program with editor and dialog (requested in comments), basic simulator for CP/M.

Background

Familiarity with C++, assembly language, Z80/8085, Backus Naur Form (BNF), parsing, tokenizing, semantic and syntactic checking are preferable.

Using the Code

Using the class is as easy as passing in a readable assembler file for input with a writeable listing file and writeable hex format file for output (both in "w" text format).

Assemble(inputFile, listFile, hexFile, fileName);  

Points of Interest

Assertions are used for internal errors where execution can continue safely while blind throws are placed in for any critical internal errors generally representing a bug in the code as they should be impossible to reach if the design is correct. Thrown errors for syntactic and semantic errors are used.

Cycle checking is implemented using a form of depth first search algorithm through any symbol table expressions.

The Intel hex format is used. See: http://www.keil.com/support/docs/1584.htm. Opcodes and clock cycle information can be found at http://www.z80.info/z80code.htm and http://www.z80.info/zip/z80-documented.pdf.

Expressions are used extensively and due to the recursive use have allowed a greater set of possibilities in the assembler input than would ordinarily be seen.

History

  • Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Gregory Morse
Software Developer (Senior)
United States United States
No Biography provided

Comments and Discussions

 
QuestionGreat PinmemberManikandan1018-May-14 3:12 
Generalmy vote of 5 PinmemberSouthmountain15-May-14 6:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 14 May 2014
Article Copyright 2014 by Gregory Morse
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid