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

# zasm - Z80 Assembler – Version 4.4

# 8080 Assembler

[<prev] [next>]

    $> 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, endif if it is started with Differences from v3 to v4: Command line options Command Line Options Command Line Options: Command line options command 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 Z80 Z80 source handling. It Run test code and test your expectations: .expect register Run test code and test your expectations: .expect cc expects 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, endif if you also define '--reqcolon'. All identifiers (mnenonics, register names and directives) and Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labels label 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 Z80 Z80 syntax. zasm can assemble Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80 Z80 source files restricted to the 8080 instruction Pseudo instructions: defl, set and '=' Labels: SET set and registers Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endif if started with Differences from v3 to v4: Command line options Command Line Options Command Line Options: Command line options command line option '--8080'. ##### 8080 code example
    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 Pseudo instructions 8080 Assembler: 8080 pseudo instructions pseudo 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, endif if Differences from v3 to v4: Command line options Command Line Options Command Line Options: Command line options command line option '--reqcolon' is used. zasm knows the following 8080 assembler Pseudo instructions 8080 Assembler: 8080 pseudo instructions pseudo instructions: ##### ORG <nnnn> Pseudo instructions: defl, set and '=' Labels: SET Set the logical origin (code address) for the following code.
        ORG 0C000h
##### END Define the logical Pseudo instructions: end, .end 8080 pseudo instructions: END end of your source. Pseudo instructions: end, .end 8080 pseudo instructions: END END is optional. ##### IF .. ENDIF Conditionally include a range of source source lines. Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endif IF and Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endif ENDIF 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
##### DB Insert bytes. Pseudo instructions: defb, db, .db and .byte 8080 pseudo instructions: DB DB is handled like 'defb' or 'defm' in Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80 Z80 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
##### DW Insert words. Like 'defw' in Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80 Z80 assembler.
        Pseudo instructions: defw, dw, .dw, .word
    8080 pseudo instructions: DWDW  foo, bar*2, stuff+33, 0xFFFF
##### DS Insert space. Like 'defs' in Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80 Z80 assembler.
        Pseudo instructions: defs, ds, .ds, .block, .blkb and data
    8080 pseudo instructions: DSDS  66h - $
##### MACRO Define a Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACRO macro which can be invocated later like a 8080 instruction. The Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACRO macro definition is terminated by the Pseudo instructions: macro, .macro, endm and .endm Pseudo instructions: rept, .rept, endm and .endm ENDM instruction. Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACRO Macros 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
##### REPT 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
#### Labels ##### EQU Assign a value to a Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labels label. Behaves like 'Pseudo instructions: equ Types of labels: Named values Labels: EQU equ' for the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80 Z80 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 Z80 Z80 assembler, Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labels label names are not case sensitive! Register names can be used as Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labels label 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: Labels label names. Types of labels: Program labels Types of labels: Program labels Program labels must start in column 1 and may be followed by a colon ':' (optional), except Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endif if 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:    ...
##### SET Define a redefinable Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labels label. Most useful Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endif if used with Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACRO macros
    foo     Pseudo instructions: defl, set and '='
    Labels: SETset 1
            ...
    foo     Pseudo instructions: defl, set and '='
    Labels: SETset foo+1
#### Expressions Basically all possibilities of the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80 Z80 assembler are allowed, because the Expressions 8080 Assembler: Expressions expression parser of the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80 Z80 assembler is used. #### Convert 8080 to Z80 assembler syntax Since version 4.3.0: Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endif If zasm is started with Differences from v3 to v4: Command line options Command Line Options Command Line Options: Command line options command line option '--convert8080', it will convert the supplied source file to Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80 Z80 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 Z80 Z80 source is assembled with option '--Command Line Options: --casefold, .casefold Commands for command line options: --casefold, .casefold Label definition: --casefold casefold'. 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, endif if 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, endif If no output filename is given, then zasm derives the filename for the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80 Z80 source by appending "_Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80 z80" to the file's basename. After creating the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80 Z80 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, endif If 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 Z80 Z80 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 options command line option '--Command Line Options: --casefold, .casefold Commands for command line options: --casefold, .casefold Label definition: --casefold casefold', because Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labels label 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 Z80 Z80 source. Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endif If 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: --casefold casefold'. |

[<prev] [top] [next>]