|
$> zasm --asm8080 mysource.asm
zasm can assemble source which is in the historic 8080 assembler format Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifif it is started with Differences from v3 to v4: Command line options Command Line Options Command Line Options: Command line optionscommand line option '--asm8080'.
zasm supports most of a typical 8080 assembler source files, but only as an addition to it's standard Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 source handling. It Run test code and test your expectations: .expect register Run test code and test your expectations: .expect ccexpects one instruction per line, comments start with a semicolon ";" and label definitions should start in column 1 except Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifif you also define '--reqcolon'.
All identifiers (mnenonics, register names and directives) and Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel names are not case sensitive!
The 8080 assembler is provided to assemble existing source. New programs should be written in the much better readable Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 syntax. zasm can assemble Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 source files restricted to the 8080 instruction Pseudo instructions: defl, set and '=' Labels: SETset and registers Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifif started with Differences from v3 to v4: Command line options Command Line Options Command Line Options: Command line optionscommand line option '--8080'.
inpl2: LXI H,IBUFF ;Input buffer addr
SHLD IBUFP
MVI C,0 ;Init count to zero
inpli: CALL intt ;Get char from console
CPI ' ' ;Control char?
JC inplc ;Yes
CPI DEL ;Delete char?
JZ inplb ;Yes
CPI 'Z'+1 ;Upper case?
JC inpl3 ;Yes
ANI 5Fh ;No - so make upper case
inpl3: MOV M,A ;Into buffer
MVI A,IBL ;Buffer size
CMP C ;Full?
JZ inpli ;Yes, loop
MOV A,M ;Get char from buffer
INX H ;Incr pointer
INR C ; and count
inple: CALL OUTT ;Show char
JMP inpli ;Next char
8080 Pseudo instructions 8080 Assembler: 8080 pseudo instructionspseudo instructions occure at the position of a real 8080 opcode and must normally be preceded with some spaces, except Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifif Differences from v3 to v4: Command line options Command Line Options Command Line Options: Command line optionscommand line option '--reqcolon' is used.
zasm knows the following 8080 assembler Pseudo instructions 8080 Assembler: 8080 pseudo instructionspseudo instructions:
Pseudo instructions: defl, set and '=' Labels: SETSet the logical origin (code address) for the following code.
ORG 0C000h
Define the logical Pseudo instructions: end, .end 8080 pseudo instructions: ENDend of your source. Pseudo instructions: end, .end 8080 pseudo instructions: ENDEND is optional.
Conditionally include a range of source source lines. Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIF and Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifENDIF are just an alias to #IF and #ENDIF and therefore may be used interchangeable with #IF, #ELIF, #ELSE and #ENDIF. This may change.
Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIF option_foo=1
Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIF option_bar
; <-- some code -->
Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifENDIF
Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifendif
Insert bytes. Pseudo instructions: defb, db, .db and .byte 8080 pseudo instructions: DBDB is handled like 'defb' or 'defm' in Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 assembler: You can put in strings here which may be enclosed in ' or ".
Pseudo instructions: defb, db, .db and .byte 8080 pseudo instructions: DBDB lf,cr,'Hello You: ',0
Insert words. Like 'defw' in Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 assembler.
Pseudo instructions: defw, dw, .dw, .word 8080 pseudo instructions: DWDW foo, bar*2, stuff+33, 0xFFFF
Insert space. Like 'defs' in Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 assembler.
Pseudo instructions: defs, ds, .ds, .block, .blkb and data 8080 pseudo instructions: DSDS 66h - $
Define a Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACROmacro which can be invocated later like a 8080 instruction. The Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACROmacro definition is terminated by the Pseudo instructions: macro, .macro, endm and .endm Pseudo instructions: rept, .rept, endm and .endmENDM instruction. Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACROMacros may have arguments.
foo Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACROMACRO ARG1, ARG2
mov a,&ARG1
jmp &ARG2
Pseudo instructions: macro, .macro, endm and .endm Pseudo instructions: rept, .rept, endm and .endmENDM
...
foo 42,$0008 ; use Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACROmacro
Define a range of source lines which shall be repeated multiple time.
Pseudo instructions: rept, .rept, endm and .endm 8080 pseudo instructions: REPTREPT $2000 - $
Pseudo instructions: defb, db, .db and .byte 8080 pseudo instructions: DBDB 0
Pseudo instructions: macro, .macro, endm and .endm Pseudo instructions: rept, .rept, endm and .endmENDM
Assign a value to a Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel. Behaves like 'Pseudo instructions: equ Types of labels: Named values Labels: EQUequ' for the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 assembler.
foobar Pseudo instructions: equ Types of labels: Named values Labels: EQUequ 5
foo Pseudo instructions: equ Types of labels: Named values Labels: EQUequ 2
bar Pseudo instructions: equ Types of labels: Named values Labels: EQUequ foobar - FOO
In contrast to the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 assembler, Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel names are not case sensitive!
Register names can be used as Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel names. (but, really really, shouldn't.) The names for the 8080 assembler directives are not allowed for Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel names.
Types of labels: Program labels Types of labels: Program labelsProgram labels must start in column 1 and may be followed by a colon ':' (optional), except Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifif option '--reqcolon' was used. Then they may start in any column and the colon is required. (sic!)
start: CALL fii
CPI 'Z'
JC in3
...
in3: ...
Define a redefinable Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel. Most useful Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifif used with Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACROmacros
foo Pseudo instructions: defl, set and '=' Labels: SETset 1
...
foo Pseudo instructions: defl, set and '=' Labels: SETset foo+1
Basically all possibilities of the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 assembler are allowed, because the Expressions 8080 Assembler: Expressionsexpression parser of the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 assembler is used.
Since version 4.3.0: Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIf zasm is started with Differences from v3 to v4: Command line options Command Line Options Command Line Options: Command line optionscommand line option '--convert8080', it will convert the supplied source file to Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 syntax, which is much better readable. zasm converts the source and writes it to the output file or a file with a derived name. Then it assembles the original source and the converted source and compares the outputs. The Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 source is assembled with option '--Command Line Options: --casefold, .casefold Commands for command line options: --casefold, .casefold Label definition: --casefoldcasefold'. Flags required to assemble the 8080 source – e.g. '--reqcolon' – must also be used for the conversion. The source is converted independently of any successive errors.
Output file: Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifif no output is specified, the output file is written to the same folder as the input file. Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIf no output filename is given, then zasm derives the filename for the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 source by appending "_Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80z80" to the file's basename.
After creating the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 source file, zasm assembles both files. The binary file goes to the temp folder which is, by default, the same as the output folder. Only one binary file for the 8080 source is created in this directory, the second binary is compared to this file directly. (actually, a temp file is created in /tmp/zasm/.) Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIf list files are enabled (the default), then list files are created for both assemblies. You can disable listfiles with option '-l0'.
Only source files for the i8080 can be converted. The 8080 mnemonics for the additional Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 opcodes are not supported.
The generated source should be assembled with Differences from v3 to v4: Command line options Command Line Options Command Line Options: Command line optionscommand line option '--Command Line Options: --casefold, .casefold Commands for command line options: --casefold, .casefold Label definition: --casefoldcasefold', because Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel names for 8080 assemblers were typically case-insensitive. Additionally, any other options like '--reqcolon', which were required for the 8080 source, are also required for the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80 source.
Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIf the source starts with a shebang, zasm also modifies assembler options found in the first line. Specifically, it removes '--asm8080', '--convert8080' and adds '--Command Line Options: --casefold, .casefold Commands for command line options: --casefold, .casefold Label definition: --casefoldcasefold'.
| |