home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
405.lha
/
Z8_CrossAsm
/
z8ca.doc
< prev
next >
Wrap
Text File
|
1990-06-05
|
6KB
|
209 lines
;
; z8ca.doc
;
; Brief Documentation for operation of the z8 Cross Assembler.
;
; Copyright (C) 1990 R.Bush. All rights reserved.
;
; This program is freely distributable as long as this copyright notice
; is retained. It intended for personal, non-commercial use.
;
; Version 1.2
;
; Updates from original 1989 release:
;
; The following enhancements/fixes incorporated into this version:
;
1) allow symbols to be case sensitive.
2) allow math operations on defs.
3) fixed bug in Intel Hex file output.
4) added sorted symbol table option.
5) enabled 'DS' (define storage) pseudo op.
6) Bug fixed in 'DB' evaluation which prevented spaces after
pseudo op.
Invoking the assembler:
-----------------------
z8ca [filename] <opt1> <opt2> <opt3>
-- [filename]
Required. automatically supplies .asm
extension and creates .hex file as output.
-- <opt1>
-i -- Creates Intel format .hex output file.
-m -- Creates Motorola format .hex output file. (Default)
-z -- Creates special z8 format .hex output file
the use of which is explained later..
If none of the above options are specified the
assembler defaults to Motorola .hex output.
-- <opt2>
-l -- Enable the generation of program listing.
-- <opt3>
-s -- Enable sorted symbol table listing.
Examples:
z8ca serial
-- assembles the file serial.asm. Note: do not
supply the '.asm' extension as the assembler
will do it for you. The file 'serial.hex'
is created in the default Motorola hex format.
z8ca serial -i -l -s
-- assembles the file serial.asm. The file 'serial.hex'
is created in the Intel hex format. The listing of the
assembled program appears on the default output (terminal)
along with a listing of the sorted symbol table.
Labels, radix specifiers, etc..
-------------------------------
Source code may be in upper or lower case.
Any comment lines should start with a semi-colon.
e.g.
;This is a comment..
All labels must start with an alpha character and end with a colon. No
limit on the length of a label. Labels must start in the first column of
text..
e.g. TEST01: EQU $0a
Note: Remember that the assembler is case sensitive for labels.
'TEST' and 'test' are recognized as two seperate labels.
The following radix specifiers are allowed:
$ = hex
% = binary
0 thru 9 = decimal
' = ascii literal
e.g. ld r1,#$0a ;the '#' means literal (immediate) data
ld r1,#123
ld r1,#%01101010
ld r1,#'a' ;ascii literal..
Simple math and logical operators allowed. (no parentheses please!!)
Evaluation occurs in order of appearance only.. No spaces are allowed
between operators and operands.
+,-,*,/
& -- logical and
| -- logical or
e.g.
test: equ $0a
ld r1,#test+2*5/3
ld r1,#test|$80
z8 notes:
---------
All address modes supported.
# --- Specifies immediate data.
e.g. ld r1,#10
rx --- Specifies working register where 'x' in the range 0 thru 15.
e.g. ld r1,r12
r:xxx - Specifies an absolute register where 'x' in the range 0 thru
255. The colon operator is used to specify an absolute register.
e.g. ld r1,r:242
ld r2,r:$30
rr -- Specifies register pair.
e.g. incw rr2 ;working register pair
decw rr:2 ;absolute register pair
@r -- Specifies indirect register.
e.g. ld r1,@r2 ;working indirect register
ld r1,@r:48 ;absolute indirect register
@rr -- Specifies indirect register pair.
e.g ldc r1,@rr2 ;working indirect register pair
call @rr:2 ;absolute indirect register pair
!x --- Specifies hi or low portion of 16 bit operand where 'x' = 'h'
for hi-order bits and 'x' = 'l' for low order bits. This is
normally used to load register pairs with an address.
e.g. ld r2,message!h
ld r3,message!l ;loads reg. pair r2,r3 with address of
;message..
message: db 'Hello World!!'
() --- Indexed addressing for ld instruction.
In the following example assume r5 = 1, r2 = 255.
e.g. ld r:40(r5),r2 ;load register 40+r5 (reg 41) with 255.
ld r2,r:40(r5) ;load r2 with content of r:41
Note: The base register for indirect addressing must be an
absolute register (r:40 in the examples). The remaining
registers used in forming the instruction (r2 and r5 in the
examples) must be working registers.
------------------------------------------------------------------------------
Pseudo-ops.
-----------
Six Pseudo-ops are supported: ORG, EQU, DEF, DB, DW, and DS.
ORG --- Set program counter (origin).
e.g.
org $0800
Sets program to originate at 0800 hex.
EQU --- Allows a label to be equated to a value.
e.g.
test: equ $0a
Equates the label 'test' to the value 0a hex.
DEF --- Define. Similar to the 'C' language #define statement. This
will do a text substitution for the defined text.
e.g.
def rp r:253
push rp
pop rp
Substitutes 'r:253' for the text 'rp'. This is normally used
to allow the use of an ascii name for a special z8 register.
DB --- Define byte.
e.g.
test: db 'text',$0a,$0d,00,%00010001
DW --- Define word (16 bit).
e.g.
rest: dw test,$1faf,0,$0100
DS --- Define Storage
e.g.
buffer: ds 32
Note: DS only reserves memory. The net effect is of the above
example is to advance the program counter 32 bytes.
Error Messages:
---------------
I have made an attempt to supply meaningful error messages. Any error
should terminate the assembly and list the line number in error. If the
error message doesn't make much sense, well.., I said I made an ATTEMPT..
z8 .hex format output
----------------------
This is a special format file suitable for use with the supplied program
'download.bas'. It allows the user to load programs created by this
assembler to a z8-Basic controller via an RS-232 link and a user supplied
terminal program.
See the file 'amiga.doc' for a more detailed explanation..
******** End of file ********