Sharp 80: Z-80 Assembler

Overview

Sharp 80 comes with an assembler that uses a standard syntax for creating your own CMD files. You can use any opcodes in the entire Z-80 Instruction Set.

Example

Here's an example of a simple assembly program:

Important: the columns in the program must be separated with tabs, not spaces.


      
; fill screen with 'X's
ORG 6000H ; start here to avoid ROM and system areas
ENTRY DI ; don't let interrupts reset the system
LD HL, 3C00H ; beginning of video RAM
LD BC, 0400H ; 1K of characters on the screen
LOOP LD A, 'X'
LD (HL), A ; put the X on the screen
INC HL ; move to the next character
DEC BC
LD A, B
OR C
JR NZ, LOOP ; loop back if we haven't counted down to zero
HALT
END ENTRY

You can type this program into a text editor and save it with a filename that has an .asm extension, like 'myprog.asm'. You can then run it in Sharp 80 by:

  1. Start Sharp 80.
  2. Hit Alt+Y to invoke the assembler, and open the asm file.
  3. The program will automatically assemble, and you will go to the CMD file screen.
  4. Hit L to load the assembly file into memory.
  5. If you don't have the CPU internals view showing on the right, hit F5 to show it.
  6. You should then see your program in the disassembly section, starting at memory location 6000H.
  7. Hit R to run, and the screen should fill with 'X's.

To see a more complex assembly program, open the zexall.asm file that's included at C:\Users\<your windows username>\AppData\Roaming\Sharp80\ASM Files\zexall.asm. This program will thoroughly test the Z-80 processor.