Frequently Asked Questions about Z80ASM

  1. What is Z80ASM?
  2. I didn't find 'phase' (relocate block) command in Z80ASM
  3. May I use multi-line comments in my sources?
  4. But I wants this and this and ...
  5. Where is you get sources for Z80 opcodes of NASM?
  6. As I can check size of certain portion of code?
  7. More question's?

What is Z80ASM?

Z80ASM is cross platform assembler for Z80 processor, based on ideas of The Netwide Assembler (NASM) for Intel x86 platform, therefore almost all features of this excellent assembler working in Z80ASM (of course, there are some differences between x86 and Speccy assemblers).
For more information about preprocessor syntax, please, read NASM manual.

If you want to download latest version of Z80ASM, click here.

Back to Contents

I didn't find 'phase' (relocate block) command in Z80ASM

Phase command brings some restrictions to format of object files, therefore no 'phase' analogue in Z80ASM. You may use this method

; main.asm
        org 100h
        ld hl,$ ; simple for test
        incbin "relocfile.bin"
        ld hl,$ ; simple for test
; end of main.asm

; relocfile.asm
        org 200h
        ld de,$ ; simple for test
; end of relocfile.asm

; make.bat
z80asm.exe relocfile.asm -o relocfile.bin
z80asm.exe main.asm
; end of make.bat

Also you may use makefile for same purpose:

main.bin: main.asm relocfile.bin
 z80asm.exe main.asm -o main.bin
relocfile.bin: relocfile.asm
z80asm.exe relocfile.asm -o relocfile.bin

In future versions Z80ASM will be support several output format's and this problem will be resolved.

Back to Contents

May I use multi-line comments in my sources?

Yes, but in comparison with other assemblers, Z80ASM use preprocessor for this issue

%if 0
Some comment text
...
%endif

You may also use %define command in same way as below

; Please, remove comment for appropriate target or use command line options
; %define DEBUG
; %define PRE_RELEASE
; %define RELEASE

%ifdef DEBUG
Some debug source lines
%elifdef PRE_RELEASE
Some prerelease source lines
%elifdef RELEASE
Some release source lines
%endif

Back to Contents

But I wants this and this and ...

Do it! The magic word is preprocessor. Define your commands and operands as you wish.
For example, please, consider this sample

%macro repeat 0
%push repeat
%$begin:
%endmacro

%macro until 1
        jp %1,%$begin
%pop
%endmacro

and this...

        repeat
        ld a,(hl)
        inc hl
        or a
        until nz

will be translated to

some_very_local_label:
        ld a,(hl)
        inc hl
        or a
        jp nz,some_very_local_label

Back to Contents

Where is you get sources for Z80 opcodes of NASM?

Nowhere. NASM is x86 based assembler and it algorithms for parsing and evaluate commands is generaly intended for x86 opcodes only! Therefore NO SOURCE FILES for Z80 opcodes, because, there are couple restrictions in NASM evaluator and parser.
For example, NASM evaluator 'eats' round brackets, which Speccy assemblers use for address reference and this is only one of many other problems!

Back to Contents

As I can check size of certain portion of code?

Look at this example:

        org 0x100
check_code_point:
        times 257 db 0 

%if     $-check_code_point > 256
 %error too large block!
%endif

More question's?

For more information about Z80ASM, ask your question in FIDONET echo ZX.SPECTRUM or email to author.

For bugs reports and some wishes, please, use this email only for plain text

Main Page | Contents

© Copyright 1997-2007, Ilya G. Aniskovets