During testing or for documentation a program listing would be very helpful. This can be created by simply keypress CTRL-F8 or via the Run menu and changed source will be recompiled automatically. To be more detailed, the function for generating a symbol file will be executed and after a program for creating the listing from the symbol file is started (LISTZ80.EXE) and the output is opened as a new tab in the IDE and saved to an output file <source>.lst. Everybody who wants to do more with this symbol file (which holds very detailed information about the assembling) should refer to the documentation on the flatassembler board:
http://flatassembler.net/docs/fas.zip
Lets take a look at the compiled source (ZX81DEMO.ASM):
Code: Select all
format binary as "p"
;LISTOFF
; hardware options to be set and change defaults in ZX81DEF.INC
MEMAVL EQU MEM_16K ; can be MEM_1K, MEM_2K, MEM_4K, MEM_8K, MEM_16K, MEM_32K, MEM_48K
; default value is MEM_16K
DFILETYPE EQU COLLAPSED ; COLLAPSED or EXPANDED
STARTUPMSG EQU 'CREATED WITH ZX81-IDE' ; any message will be shown on screen after loading, max. 32 chars
include 'SINCL-ZX\ZX81.INC' ; definitions of constants
;LISTON
AUTORUN:
REM 1,asmcode_st,asmcode_end
asmcode_st:
; ##################################################
; place own assembler code here
; ##################################################
LD BC,$55
RET
; ##################################################
; end of section for own assembler code
; ##################################################
asmcode_end:
db NEWLINE
LINE2: ; this is a static PRINT USR 16514 command
db 0,2,$0E,0,$F5,$D4
dbzx '16514'
db $7E,$8F,1,4,0,0,NEWLINE
;LISTOFF
include 'SINCL-ZX\ZX81POST.INC' ; include D_FILE and needed memory areas
assert ($-MEMST)<MEMAVL
; end of program
Code: Select all
;LISTON
;LISTOFF
Code: Select all
format binary as "p"
;LISTON
AUTORUN:
0074: [407D] 00 01 06 00 EA REM 1,asmcode_st,asmcode_end
asmcode_st:
; ##################################################
; place own assembler code here
; ##################################################
0079: [4082] 01 55 00 LD BC,$55
007C: [4085] C9 RET
; ##################################################
; end of section for own assembler code
; ##################################################
asmcode_end:
007D: [4086] 76 db NEWLINE
LINE2: ; this is a static PRINT USR 16514 command
007E: [4087] 00 02 0E 00 F5 D4 db 0,2,$0E,0,$F5,$D4
0084: [408D] 1D 22 21 1D 20 dbzx '16514'
0089: [4092] 7E 8F 01 04 00 00 76 db $7E,$8F,1,4,0,0,NEWLINE
The listing begins with offset $74, this is the BASIC section. The system variables are not shown due to a ;LISTOFF directive before. More important than the offset in the output file is the next column which has the target address or effective address. The code has to be loaded at this address before execution which is done through the LOAD command of the ZX81. The third column shows the generated code and the last column the source line. All addresses are shown hexadecimal. As everybody knows, the code in the first rem line is started with RAND USR 16514 or PRINT USR 16514 (there are still more variants). The decimal address 16514 is hexadecimal $4082 and you can find this address in the listing in the first assembler line "LD BC,$55".
You can simply see that the Z80 processors operates in Little-Endian Format with the least significant byte first.