| 1 |
|
| 2 |
This document describes some properties of DASM's |
| 3 |
Fairchild F8 backend It does *not* describe how to |
| 4 |
program the F8. |
| 5 |
|
| 6 |
|
| 7 |
Processor selection |
| 8 |
------------------- |
| 9 |
|
| 10 |
With DASM, the target CPU is selected with the PROCESSOR |
| 11 |
directive inside the source file that should be assembled. |
| 12 |
The F8 CPU is selected like this: |
| 13 |
|
| 14 |
processor f8 |
| 15 |
processor F8 ; case insensitive |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
Expressions with parentheses |
| 21 |
---------------------------- |
| 22 |
|
| 23 |
Some of DASM's backends, for instance the one for the 6502, |
| 24 |
don't allow parentheses in expressions that are part of a |
| 25 |
mnemonic's operand, because parentheses are used in the |
| 26 |
6502's assembly language to denote indirect addressing. |
| 27 |
Instead, you have to use brackets. |
| 28 |
|
| 29 |
This is not the case with the F8 backend. Both parentheses |
| 30 |
and brackets can be used everywhere, so the following lines |
| 31 |
are parsed and assembled correctly: |
| 32 |
|
| 33 |
as (2+2)*2 ; Assembles to $c8 |
| 34 |
as [2+2]*2 ; Assembles to $c8 |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
Data definition directives |
| 40 |
-------------------------- |
| 41 |
|
| 42 |
Since DS is an F8 instruction (decrement scratchpad register), |
| 43 |
the DS directive isn't available anymore if DASM assembles |
| 44 |
F8 code. Instead, use the RES directive, which works just like |
| 45 |
the DS directive: |
| 46 |
|
| 47 |
ds.b 4,$33 ; Would assemble to $33 $33 $33 $33, |
| 48 |
; but isn't available in F8 mode |
| 49 |
res.b 4,$33 ; Assembles to $33 $33 $33 $33 |
| 50 |
|
| 51 |
Of course RES.W and RES.L do exist aswell. |
| 52 |
|
| 53 |
|
| 54 |
For source code compatibility with f8tool (another F8 assembler), some |
| 55 |
additional data definition directives are available : DB, DW and DD. |
| 56 |
These work just like DC.B, DC.W and DC.L: |
| 57 |
|
| 58 |
dc.b $f8 ; Assembles to $f8 |
| 59 |
db $f8 ; Assembles to $f8 |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
Special register names |
| 65 |
---------------------- |
| 66 |
|
| 67 |
For some of the special registers, multiple names are accepted: |
| 68 |
|
| 69 |
Register Accepted names |
| 70 |
------------------------------ |
| 71 |
DC0 DC, DC0 |
| 72 |
PC0 P0, PC0 |
| 73 |
PC1 P, PC1 |
| 74 |
J J, Any expression that evaluates to 9 |
| 75 |
(This may seem strange, but J is really |
| 76 |
just an alias for scratchpad register 9) |
| 77 |
|
| 78 |
The names DC, P0, P and J are standard syntax, the other forms |
| 79 |
have been introduced for compatibility with other assemblers. |
| 80 |
|
| 81 |
Thus, the following lines assemble all correctly: |
| 82 |
|
| 83 |
lr h,dc ; Assembles to $11 |
| 84 |
lr h,dc0 ; Assembles to $11 |
| 85 |
lr p0,q ; Assembles to $0d |
| 86 |
lr pc0,q ; Assembles to $0d |
| 87 |
lr p,q ; Assembles to $09 |
| 88 |
lr pc1,q ; Assembles to $09 |
| 89 |
lr w,j ; Assembles to $1d |
| 90 |
lr w,3*3 ; Assembles to $1d |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
Scratchpad register access |
| 96 |
-------------------------- |
| 97 |
|
| 98 |
There are several ways to access scratchpad registers: |
| 99 |
|
| 100 |
Access mode Accepted syntax |
| 101 |
--------------------------------------------------------------- |
| 102 |
Direct access to registers 0..11 Any expression that |
| 103 |
evaluates to 0..11 |
| 104 |
|
| 105 |
Access via ISAR S, (IS), any expression |
| 106 |
that evaluates to 12 |
| 107 |
|
| 108 |
Access via ISAR, ISAR incremented I, (IS)+, any expression |
| 109 |
that evaluates to 13 |
| 110 |
|
| 111 |
Access via ISAR, ISAR decremented D, (IS)-, any expression |
| 112 |
that evaluates to 14 |
| 113 |
|
| 114 |
The (IS), (IS)+ and (IS)- forms are not standard syntax and have |
| 115 |
been mainly introduced for compatibility with f8tool. |
| 116 |
|
| 117 |
|
| 118 |
For some of the directly accessible scratchpad registers aliases exist: |
| 119 |
|
| 120 |
Register Alias name |
| 121 |
-------------------------- |
| 122 |
9 J |
| 123 |
10 HU |
| 124 |
11 HL |
| 125 |
|
| 126 |
Originally, J was only used with the LR instruction when accessing the |
| 127 |
flags, but since J is just an alias for register 9, J can also be used |
| 128 |
in normal scratchpad register operations. |
| 129 |
|
| 130 |
The following lines assemble all correctly |
| 131 |
|
| 132 |
xs 2+2 ; Assembles to $e4 |
| 133 |
xs s ; Assembles to $ec |
| 134 |
xs (is) ; Assembles to $ec |
| 135 |
xs 12 ; Assembles to $ec |
| 136 |
xs i ; Assembles to $ed |
| 137 |
xs (is)+ ; Assembles to $ed |
| 138 |
xs 13 ; Assembles to $ed |
| 139 |
xs d ; Assembles to $ee |
| 140 |
xs (is)- ; Assembles to $ee |
| 141 |
xs 14 ; Assembles to $ee |
| 142 |
xs 9 ; Assembles to $e9 |
| 143 |
xs j ; Assembles to $e9 |
| 144 |
xs hu ; Assembles to $ea |
| 145 |
xs hl ; Assembles to $eb |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
No instruction optimizations are done |
| 151 |
------------------------------------- |
| 152 |
|
| 153 |
The assembler doesn't optimize instructions where a smaller |
| 154 |
instruction could be used. It won't optimize between |
| 155 |
OUT/OUTS, IN/INS and LI/LIS. |
| 156 |
|
| 157 |
For instance, the following line assembles to $20 $00, even |
| 158 |
though the LIS instruction could be used, which would need |
| 159 |
only one byte. |
| 160 |
|
| 161 |
li 0 ; Assembles to $20 $00 |