<--  back   Last regenerated: 2022-04-20 17:31:36 kio

zasm - Z80 Assembler – Version 4.4

Targets

#target .P, .81 and .P81

this format is not yet well tested. Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
If there are problems please send an email to Kio.

This creates a tape file for use with a ZX81 emulator. The tape file will be loaded to the ram start + 9 at address $4009.

"p" can be used instead of "81". This will create a target file with extension "p" or "81" respectively, which are fully identical. ".p81" files also include the program name which must be written using the ZX81 character Pseudo instructions: defl, set and '='
Labels: SET
set.

Code may be stored in one or more Assembler directives: #code
Including C Source Files: #code
#code segments. However, the first segment must be at least 0x403B - 0x4009 bytes long and contain the system variables. (except for the first 9 bytes which are not saved.)

Assembler directives: #target
Including C Source Files: #target
#target 81 #charset ZX81 Assembler directives: #code
Including C Source Files: #code
#code <name>,<start>,<len> ...

or:

Assembler directives: #target
Including C Source Files: #target
#target p81 #charset ZX81 Assembler directives: #code
Including C Source Files: #code
#code _PROGNAME dm "progname" | $80 ; zasm converts the characters to charset ZX81! Assembler directives: #code
Including C Source Files: #code
#code _RAM, 0x4009, _ram_end - 0x4009 ...

See the ZX81 .p template file: template_p.asm

The tape data is always loaded to $4009, so this is the only choice for the <start> address in the Assembler directives: #code
Including C Source Files: #code
#code directive. The <size> may be any value up to a maximum of $C000 minus $09, but most ZX81 had at most 16 kB ram Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
if extended with an external memory expansion, only 1 kB Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
if none. (The TS1000 had whoopy 2k!)

The ram starts with system variables from $4009 to $403C, which must be Pseudo instructions: defl, set and '='
Labels: SET
set to proper values. The variable E_LINE at the address $4014, which contains the Pseudo instructions: end, .end
8080 pseudo instructions: END
end of ram address, is checked by the assembler.

This file also contains the screen file, which basically means, that the video memory must contain 25 HALT opcodes Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
if the file was saved in SLOW mode.

Here are few important variables:
$4014   defines the Pseudo instructions: end, .end
8080 pseudo instructions: END
end address (used to calculate the file length) $4029 points to the next executed (autostarted) BASIC line $403B bit 6 indicates Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
if program runs in SLOW or FAST mode $403C++ may be misused for whatever purpose

zasm has a convenient assembler directive to translate from the ascii (or utf-8) characters in your source file to the non-ascii character Pseudo instructions: defl, set and '='
Labels: SET
set of the ZX81:

#charset ZX81

You can include c sources in your assembler file, but there are two pitfalls:

You can use the character Pseudo instructions: defl, set and '='
Labels: SET
set translation of zasm to translate strings in your c source as well. But unluckily character literals are not exported as character literals by the c compiler sdcc but as their ascii code and zasm has no chance to detect this. So character literals in your c source are not translated.

Second, character 0x00 is used in c sources as a string Pseudo instructions: end, .end
8080 pseudo instructions: END
end indicator, but it is also a valid character for the ZX81: the space. So you'll have to think of a way to work around this problem.

Valid HTML   Valid CSS