// -----------------------------------------------------------------
h1 List File
listing
p zasm generates a list file, except if command line option -l0 is given.
p Option '-u' includes the generated opcode in the list file.
Option '-w' enables a labels listing at the end of the list file.
Option '-y' includes accumulated cpu cycles in the list file.
h5 Plain listing
pre 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
h5 Listing with object code
pre 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
h5 Listing with object code and cpu cycles
p Cpu cycles are accumulated from the last 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 example is taken from a file generated by sdcc, so don't mind the unusual syntax for immediate arguments and local labels.
pre 67A3: 00102$:
67A3: ;/Develop/Projects/zasm/lib/___fsgt.c:71: 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$
h5 Label listing
p This section lists the defined code and data segments and the global and all local labels (if any).
For each 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 example no code segment was defined and all labels reside in the default segment which is currently named "(DEFAULT)" which may look a little bit odd.
pre ; +++ segments +++
#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
h5 Errors
p Errors are marked with ***ERROR*** in the list file. The assembler will abort if too many errors occur.
p source file:
pre #target rom
#code ROM,*,1000
db foo
#end
p command line and output:
pre $> zasm zzz.asm
in file zzz.asm:
3: db foo
^ label "foo" not found
assemble: 6 lines
time: 0.0015 sec.
zasm: 1 error
$>
p list file:
pre #target rom
#code ROM,*,1000
db foo
^ ***ERROR*** label "foo" not found
#end
p 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.
p 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. If there really is a bug, send a bug report to Kio.