annotate doc/lwasm.txt @ 426:652eee8f0c82

Fixed lw_expr_destroy() to not crash on NULL
author lost@l-w.ca
date Sun, 19 Sep 2010 10:40:37 -0600
parents ed3553296580
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
331
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
1 LWASM 2.0
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
2 =========
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
3
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
4 LWASM is a cross-assembler for the MC6809 and HD6309 CPUs. It should
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
5 assemble most reasonable EDTASM compatible source code. This document is not
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
6 intended to teach assembly language for these CPUs but rather to document
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
7 the behaviour of LWASM.
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
8
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
9
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
10 TARGETS
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
11 -------
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
12
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
13 LWASM supports several targets for assembly. These are decb, raw, and obj.
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
14
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
15 The raw target generates a raw binary output. This is useful for building
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
16 ROMs and other items that are not intended to be loaded by any kind of
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
17 loader. In this mode, the ORG directive is merely advisory and does not
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
18 affect the output except for the addresses symbols are defined to have.
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
19
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
20 The decb target generates output that can be loaded with the CLOADM or LOADM
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
21 commands in Color Basic. There will be approximately one segment in the
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
22 output file for every ORG statement after which any code is emitted. (That
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
23 is, two ORG statements in a row will not generate two output segments.)
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
24 This is approximately equivalent to running A/AO in EDTASM.
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
25
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
26 The obj target generates output that is intended to be linked later with
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
27 LWLINK. This target disallows the use of ORG for defining anything other
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
28 than constants. In this target, source files consist of a number of sections
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
29 (SECTION/ENDSECTION). Nothing outside of a section is permitted to cause any
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
30 output at all. Use of an ORG statement within a section is an error. This
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
31 target also permits tagging symbols for export (EXPORT) and marking a symbol
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
32 as externally defined (IMPORT/EXTERN). The linker will resolve any external
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
33 references at link time. Additionally, any inter-section references will be
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
34 resolved by the linker. All code in each section is assembled with an
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
35 implicit origin of 0. SETDP has no effect because the assembler has no idea
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
36 what address the linker will assign to the code when it is linked. Any
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
37 direct addressing modes will default to extended to allow for the linker to
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
38 perform relocations. Intersegment references and external references will
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
39 use 16 bit relative addressing but intrasegment internal references may use
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
40 8 bit relative addressing. Forced 8 bit direct modes are probably an error
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
41 but are permitted on the theory that the programmer might know something the
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
42 assembler doesn't.
ed3553296580 Port manual forward with corrections from Jason Law
lost
parents:
diff changeset
43