-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCONVERSION_C166.TXT
171 lines (105 loc) · 4.26 KB
/
CONVERSION_C166.TXT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Things to consider when moving an existing code to tpasm:
1.
Change '$SEGMENTED' to 'SEGMENTED' and '$ASSUME' to 'ASSUME'.
Add 'INCLUDE "REG_cputype.INC"' and all other header files needed.
Also remove any dollarsigns /$/ that are placed inside numbers.
If you get a lot of errors complaining about illegal addressing
modes make sure that 'SEGMENTED' is followed by the needed
'ASSUME'-s. A good start may be
ASSUME DPP0:0x0000
ASSUME DPP1:0x4000
ASSUME DPP2:0x8000
ASSUME DPP3:0xC000
This is the same as the default after a hardware reset. It
corresponds to a real initialisation of
MOV DPP0,#0h
MOV DPP1,#1h
MOV DPP2,#2h
MOV DPP3,#3h
2.
Try to sort out how 'DGROUP' and 'CGROUP' are used (if present).
You may leave them in place as they are ignored but take whatever
countermeasures that may be necessary.
3.
Change
named SECTION DATA
to
SEG named
named
and
namec SECTION CODE
to
SEG namec
namec
This makes it possible to use 'namec' and 'named' in 'ASSIGN DPPn:named'.
Note that the start of a segment is normally done through an
ORG startofsomething
and that is only done in one place. The above examples will become
SEG named
named ORG RAM
and
SEG namec
mamec ORG FLASH
tpasm has a predefined segment called 'code' ment for placing code in.
Lines looking like
label PROC xxx yyy ..
can be left in place but 'label' will be ignored
'PUBLIC', 'GLOBAL', 'NAME', REGDEF' 'ENDP' and 'SSKDEF' are also ignored
by tpasm. They are (among other things) there to help the assembler to
look after you as if you don't know what you are doing :-)
Comment out or remove all 'ENDS'-s as they are in conflict with tpasms own
'ends' that closes a switch directive.
4.
Remove all "types" appended to same variables. That is 'variable:type'
becomes just 'variable'. Consider the effect of doing so. It may affect
the memory used. Also check if 'JMP' and 'CALL' are used. They must be
replaced by 'JMPA'/'JMPR' and 'CALLA'/'CALLR' respectively. tpasm does
not (yet) decide for you!
5.
Change string delimiters in 'DB' statements from single quotes /'/ to
double quotes /"/. See the file MANUAL.TXT for a complete description
of the formats used.
6.
Make sure that there is no label called 'SYSTEM' or 'NOTHING'. These
words are reserved and defined in 'REG_cputype.INC' .
7.
Make sure that in all places where a DPPn *register* ( not a prefix )
is to be loaded with a page number the name of the page is prefixed
by '#PAG'. ( Else the register will be loaded with the segment offset! )
'ASSUME' operands are always taken as memory addresses and the 'PAG'
operator is implied and must not be used.
If you want to give a real page number use the form
ASSUME DPPn: value<<14
8.
Verify that all 'EXTRN' and 'EXTERNAL' references make sense when all
modules are assembled together via 'INCLUDE's. Remove all 'EXTRN' and
'EXTERNAL' if you like. They are ignored by tpasm.
9.
Consider changing 'LIT' to 'EQU' everywhere a label that may be used in
an 'ASSUME', 'ORG' or other directive is defined. This may be a major
problem in converting to tpasm. tpasm does not do literal substitution
on anything but operands of ordinary instructions and that only once.
This limits the ways of writing header files since you can't nest sub-
stitutions. A typical example is the definitions of bits in registers:
PSW EQU 0xFF10 ; We can't use LIT here
IEN LIT PSW.11 ; if we want this to work
BSET IEN ; when we come here
Notice that 'LIT' is the same as 'ALIAS' to tpasm. The only difference
is that 'ALIAS' takes double quotes around strings and 'LIT' expects
single quotes if used at all.
10.
'DB' cant't take expressions containing the operators 'PAG', 'POF', 'SEG'
and 'SOF'.
Replace 'SEG op' with 'op>>16' and 'SOF op' with 'op&0xFFFF'
Replace 'PAG op' with 'op>>14' and 'POF op' with 'op&0x3FFF'
11.
Take a look at how negative values are used. This differs between other
assemblers! For example
MOV R0,#-4
may be ok but with tpasm you will have to make it
MOV R0,#( -4&0xFFFF )
since -4 is internally stored as 0xFFFFFFFC and that does not fit into
sixteen bits. Values are signed 32 bit integers when evaluated but they are
currently not downsized to signed values. In case of DW the value is simply
'anded' with 0xFFFF. Instructions taking immediate operands accept only
the range 0 - 0xFFFF.