JAMSI // Z80 ASM

The Z80 Assembler

JAMSI ships a Maxam 1.5 / compatible Z80 assembler inside the Debugger. It assembles directly into emulator RAM, writes BIN files, and reads/writes source and binary files from the virtual HDDs and DSK floppy drives.

Open the emulator →

1 · Introduction

2 · Source syntax

Use ORG &4000 or ORG #4000 to set the origin. $ is the current address.

Labels are a word (letters, digits, underscore) optionally starting with .. A label may stand alone on its line or before an instruction: start: LD A,1 or start LD A,1. .local labels are allowed.

Assign values with LABEL EQU value or LABEL = value. LET LABEL = value redefines a symbol.

3 · Directives

Data: DB/DEFB/BYTE/DM emit bytes; DW/DEFW/WORD emit words; DS/DEFS/RMEM reserve space (fill); STR emits a string with the last character high-bit set.

Control: ORG, ALIGN boundary[,fill], END, LIST/NOLIST, CODE/NOCODE, PRINT, NOHEADER.

Conditional: IF/ELSEIF/ELSE/ENDIF, IFDEF/IFNDEF/IFNOT.

Loops: REPEAT nREND and WHILE condWEND.

4 · Expressions

Maxam

Expressions are evaluated left to right with NO operator precedence (Maxam behaviour). Use parentheses to group.

Operators: + - * / MOD AND OR XOR SHL SHR NOT, unary minus. Hex: &4000, #4000, 4000H, 0x4000. Binary: %1010. Char: 'A'. Current address: $.

2 * 4 + x is (2*4)+x; x + 2 * 4 is (x+2)*4.

5 · Files, HDDs & floppies

Drive letters address the storage: a:/b: are the DSK floppies, c:-f: are HDDs 1–4.

READ "c:/app/lib.asm" includes a source file from HDD1. INCBIN "c:/data.bin" embeds binary data; an AMSDOS header is stripped automatically.

Relative paths resolve against the including file's directory: a READ "graphics.asm" inside c:/app/lib.asm loads c:/app/graphics.asm. DSK floppies have no folders; HDDs do.

The VFS button in the assembler lists files on the active HDD; Include adds a READ "…" line.

6 · Macros & conditional assembly

Define a macro with NAME MACRO p1,p2MEND, then call NAME arg1,arg2. Parameters are substituted (case-insensitive); @label inside a macro becomes a local label.

The assembler also expands REPEAT/REND and WHILE/WEND loops, which may contain local @ labels.

7 · Writing output

WRITE DIRECT "a:MYFILE.BIN" writes the assembled bytes as a file into the mounted DSK of drive A (or b:). It gets an AMSDOS header with load/exec = ORG and length = the full assembled size. Use NOHEADER before it to save without a header.

WRITE "c:/app/out.bin" writes the assembled bytes into a HDD. Writing to a drive you do not have (e.g. e: with only 2 HDDs) is an error.

Multi-ORG

If the program contains several ORG regions at different addresses (including from included files), each region is written as its own file. The first region keeps the name (PROG.BIN), later ones get a numbered extension: PROG.BI1, PROG.BI2 … Each file gets its region's ORG as the AMSDOS load address.

Example

ORG &4000
NOHEADER
WRITE DIRECT "a:myfile.bin"
LD A,&80
RET

8 · Editor & local files

Tabs

You can open multiple source files in tabs. The plus button (+) adds a new tab, the ✕ closes one. Each tab keeps its own source text and its own assembly result.

The SOURCE FILE row lets you load (Load) and save (Save ASM) a source file. Paths such as c:/app/my.asm address the HDD, a:MY.ASM/b:MY.ASM a floppy (headerless). Loaded files open in a new tab.

Local

Open Local… opens a folder from your PC (Chrome/Edge) and loads every .asm/.txt/.z80 file in it as a tab.

Relative includes resolve from that local folder: if myfile.asm contains READ "my2ndfile.asm" and the file is in the same folder, it is found automatically. WRITE directives still target the HDD/disk.

← Back to the user guide · Open the emulator