<--  back   Last regenerated: 2017-03-05 16:56:38 kio

zasm - Z80 Assembler – Version 4.0

List File

zasm generates a list file, 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 -l0 is given.

Option '-u' includes the generated opcode in the list file.
Option '-w' enables a labels listing at the Pseudo instructions: end, .end
8080 pseudo instructions: END
end of the list file.
Option '-y' includes accumulated cpu cycles in the list file.

Plain listing
NMI:    push af
        push hl
        ld   hl,($5cb0)

        LD   A,H                ;falls HL=0, dann Kaltstart
        OR   L
        JR   NZ,M0070           ;sonst passiert nichts
        JP   (HL)
M0070:  POP  HL
        POP  AF
        RETN

NEXZEI: LD   HL,(CHADD)         ;Programmzeiger erhoehen
M0077:       INC HL
M0078:       LD (CHADD),HL      ;Adr. des naechsten zu
                                ;interpret. Zeichens
        LD   A,(HL)             ;neues Zeichen laden
        RET
Listing with object code
0131: 110100    calcspeed:  ld   de,1       ; pre-adjust
0134: 210040                ld   hl,tickercell
0137: 76                    halt
0138: 7E                    ld   a,(hl)
0139: 0605      cs1         ld   b,5        ; 7
013B: 05        cs2         dec  b          ; 5*4
013C: C23B01                jp   nz,cs2     ; 5*10
013F: 13                    inc  de         ; 6
0140: BE                    cp   a,(hl)     ; 7
0141: CA3901                jp   z,cs1      ; 12
0144: EB                    ex   hl,de
0145:           ; this took hl*100 ticks for 1/60 sec
0145:           ;  = hl*6,000 ticks for 1 sec
0145: 110600                ld   de,6
0148: CDB000                call mult
014B:           ;  = hl*1,000 ticks for 1 sec
014B: 11E803                ld   de,1000
014E: CDC900                call divide
0151:           ;  = hl*1,000,000 + de*1,000 ticks
0151: C9                    ret
Listing with object code and cpu cycles

Cpu cycles are accumulated from the last Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label position. Branching opcodes are given with their run-through time and the branching time. Opcodes like LDIR also show the time for a loop.
This #insert: Examples:
#assert: Example:
incbin: Examples:
example is taken from a file generated by sdcc, so don't mind the unusual syntax for immediate arguments and local Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
labels.

67A3:                   00102$:
67A3:                   ;/Develop/Projects/zasm/lib/___fsgt.c:71: Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
if (fl1.l<0 && fl2.l<0) { 67A3: 210400 [10] ld hl,#0x0004 67A6: 39 [21] add hl,sp 67A7: 56 [28] ld d,(hl) 67A8: 23 [34] inc hl 67A9: 5E [41] ld e,(hl) 67AA: 23 [47] inc hl 67AB: 4E [54] ld c,(hl) 67AC: 23 [60] inc hl 67AD: 66 [67] ld h,(hl) 67AE: CB7C [75] bit 7, h 67B0: 2849 [82|87] jr Z,00106$ 67B2: 210000 [92] ld hl,#0x0000 67B5: 39 [103] add hl,sp 67B6: 56 [110] ld d,(hl) 67B7: 23 [116] inc hl 67B8: 5E [123] ld e,(hl) 67B9: 23 [129] inc hl 67BA: 4E [136] ld c,(hl) 67BB: 23 [142] inc hl 67BC: 66 [149] ld h,(hl) 67BD: CB7C [157] bit 7, h 67BF: 283A [164|169] jr Z,00106$
Label listing

This section lists the defined code and data segments and the global and all local Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
labels (Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
if any).
For each Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label zasm lists the value or whether it is invalid (not defined), the segment it is defined in, the source file it is defined in and the source line and whether it is unused.
In this #insert: Examples:
#assert: Example:
incbin: Examples:
example no code segment was defined and all Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
labels reside in the default segment which is currently named "(DEFAULT)" which may look a little bit odd.

; +++ segments +++
 
Assembler directives: #code
Including C Source Files: #code
#CODE (DEFAULT): start=0 len=1684   ; +++ global symbols +++   hd64180 = $0001 = 1 (DEFAULT) :1 (unused) loop2 = $0249 = 585 (DEFAULT) test-opcodes.asm:636 n = $0040 = 64 (DEFAULT) test-opcodes.asm:593 n1 = $0001 = 1 (DEFAULT) test-opcodes.asm:1357 n16 = $0010 = 16 (DEFAULT) test-opcodes.asm:1358 n6 = $0006 = 6 (DEFAULT) test-opcodes.asm:1356 nn = $4142 = 16706 (DEFAULT) test-opcodes.asm:592 test_addressing_modes = $0001 = 1 (DEFAULT) test-opcodes.asm:14 test_compound_opcodes = $0001 = 1 (DEFAULT) test-opcodes.asm:15 test_expressions = $0001 = 1 (DEFAULT) test-opcodes.asm:13 test_fails = $0001 = 1 (DEFAULT) test-opcodes.asm:16   ; +++ local symbols +++   anton = $0014 = 20 (DEFAULT) test-opcodes.asm:41 (unused) n20 = $0014 = 20 (DEFAULT) test-opcodes.asm:37 n5 = $0005 = 5 (DEFAULT) test-opcodes.asm:36   ; +++ local symbols +++   (DEFAULT)$1 = $0055 = 85 (DEFAULT) test-opcodes.asm:229 n6 = $0006 = 6 (DEFAULT) test-opcodes.asm:262 nn = $0040 = 64 (DEFAULT) test-opcodes.asm:261
Errors

Errors are marked with ***ERROR*** in the list file. The assembler will abort Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
if too many errors occur.

source file:

#target rom
Assembler directives: #code
Including C Source Files: #code
#code ROM,*,1000 Pseudo instructions: defb, db, .db and .byte
8080 pseudo instructions: DB
db foo #end

command line and output:

$> zasm zzz.asm
 
in file zzz.asm:
3:  Pseudo instructions: defb, db, .db and .byte
8080 pseudo instructions: DB
db foo ^ Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label "foo" not found assemble: 6 lines time: 0.0015 sec.   zasm: 1 error   $>

list file:

#target rom
Assembler directives: #code
Including C Source Files: #code
#code ROM,*,1000 Pseudo instructions: defb, db, .db and .byte
8080 pseudo instructions: DB
db foo ^ ***ERROR*** Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label "foo" not found #end

Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
If you have only a single source file and you encounter only a few errors and you didn't enable additional fields in the list file then you can move the source into the trash, rename the list file and work on it as your new source file. You can easily find all the ***ERROR***s and correct them, then start over again. But be careful that the list file is not truncated before actually deleting it.

Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
If you suspect the assembler is generating wrong object code, you can include the object code in the listing. Then you can easily verify the generated code. Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
If there really is a bug, send a bug report to Kio.

Valid HTML   Valid CSS