keenectl/PRG/MACRO.LST

404 lines
18 KiB
Text
Raw Normal View History

2014-06-26 07:38:06 +00:00
<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>MACRO.ASM ʢȺ<CAA2><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾 2.86 ҳ<><D2B3>1
1 0000 ;*******************************************************************************
2 0000 ;*
3 0000 ;* (c) Copyright 2004, Holtek Semiconductor Inc.
4 0000 ;*
5 0000 ;******************************************************************************/
6 0000 ;*******************************************************************************
7 0000 ;MODULE: main.asm
8 0000
9 0000 ;INITIAL: 11/12/2004
10 0000
11 0000 ;AUTHOR: C351 Ansonku.
12 0000
13 0000 ;NOTE: HT48RB4 16 bit operation
14 0000
15 0000 ;REVISION: First issue
16 0000 ;*******************************************************************************
17 0000 ;*******************************************************************************
18 0000 ; 16 bit ADD with signed
19 0000 ; use ADD16 XH,XL,YH,YL,ZH,ZL
20 0000 ; operation
21 0000 ; XH XL
22 0000 ; +YH YL
23 0000 ; --------------
24 0000 ; ZH ZL
25 0000 ;*******************************************************************************
26 0000 ADD16 MACRO XH,XL,YH,YL,ZH,ZL
27 0000 MOV A,XL
28 0000 ADD A,YL
29 0000 MOV ZL,A
30 0000 MOV A,XH
31 0000 ADC A,YH
32 0000 MOV ZH,A
33 0000 ENDM
34 0000 ;*******************************************************************************
35 0000 ; 16 bit ADD with unsigned
36 0000 ; use ADD16 XH,XL,YL,ZH,ZL
37 0000 ; operation
38 0000 ; XH XL
39 0000 ; + YL
40 0000 ; --------------
41 0000 ; ZH ZL
42 0000 ;*******************************************************************************
43 0000 ADD16U MACRO XH,XL,YL,ZH,ZL
44 0000 mov a,xh
45 0000 mov zh,a
46 0000 MOV A,XL
47 0000 ADD A,YL
48 0000 SZ C
49 0000 INC ZH
50 0000 MOV ZL,A
51 0000 ENDM
52 0000
53 0000
54 0000 ;*******************************************************************************
55 0000 ; 16 bit sub with signed
56 0000 ; use SUB16 XH,XL,YH,YL,ZH,ZL
57 0000 ; operation
58 0000 ; XH XL
59 0000 ; -YH YL
<0C>ļ<EFBFBD><C4BC><EFBFBD>MACRO.ASM ʢȺ<CAA2><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾 2.86 ҳ<><D2B3>2
60 0000 ; --------------
61 0000 ; ZH ZL
62 0000 ;*******************************************************************************
63 0000 SUB16 MACRO XH,XL,YH,YL,ZH,ZL
64 0000 MOV A,XL
65 0000 CLR C
66 0000 SUB A,YL
67 0000 MOV ZL,A
68 0000 MOV A,XH
69 0000 SBC A,YH
70 0000 MOV ZH,A
71 0000
72 0000 ENDM
73 0000
74 0000
75 0000 ;*******************************************************************************
76 0000 ; 16 bit shift right with signed
77 0000 ; use RR16 XH,XL,ZH,ZL
78 0000 ; operation
79 0000 ;*******************************************************************************
80 0000 RR16 MACRO XH,XL,ZH,ZL
81 0000 CLR C
82 0000 MOV A,XH
83 0000 AND A,80H
84 0000 SNZ Z
85 0000 SET C
86 0000 RRCA XH
87 0000 MOV ZH,A
88 0000 RRCA XL
89 0000 MOV ZL,A
90 0000 ENDM
91 0000 ;*******************************************************************************
92 0000 ; 16 bit shift left with signed
93 0000 ; use RL16 XH,XL,ZH,ZL
94 0000 ; operation
95 0000 ;*******************************************************************************
96 0000 RL16 MACRO XH,XL,ZH,ZL
97 0000 CLR C
98 0000 SZ XL.7
99 0000 SET C
100 0000
101 0000 RLCA XH
102 0000 MOV ZH,A
103 0000 CLR C
104 0000 RLCA XL
105 0000 MOV ZL,A
106 0000 ENDM
107 0000 ;*******************************************************************************
108 0000 ; 16 bit shift left with signed
109 0000 ; use RL16N XH,XL,ZH,ZL
110 0000 ; operation
111 0000 ;*******************************************************************************
112 0000 RL16N MACRO XH,XL,ZH,ZL,N
113 0000 ;MOV A,8
114 0000 ;SUB A,N
115 0000 ;mov a,Xl SHR A
116 0000 ;mov zh,a
117 0000 ;mov a,xh SHL N
118 0000 ;orm a,zh
119 0000 ENDM
<0C>ļ<EFBFBD><C4BC><EFBFBD>MACRO.ASM ʢȺ<CAA2><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾 2.86 ҳ<><D2B3>3
120 0000 ;*******************************************************************************
121 0000 ; 8 bit multiply with signed
122 0000 ; use mul8 X,Y,ZH,ZL
123 0000 ; operation
124 0000 ;*******************************************************************************
125 0000 Mul8 MACRO X,Y,ZH,ZL
126 0000 Local Mul8_End
127 0000 CLR operator1H ;sum
128 0000 CLR operator1L
129 0000 CLR operator2H ;multiply
130 0000 CLR operator3H ;operator
131 0000 CLR operator3L
132 0000 mov A,Y
133 0000 mov operator2L,A
134 0000
135 0000 SZ X.7
136 0000 SET operator2H
137 0000 Mul16_doloop:
138 0000 MOV A,6
139 0000 MOV Counter3,A
140 0000 SDZ Counter3
141 0000 JMP Mul8_End
142 0000 SNZ X.Counter3
143 0000 jmp Mul18_Next_Bit
144 0000 RL16 operator2H,operator2L,operator3H,operator3L
145 0000 ADD16 operator3H,operator3L,operator1H,operaotr1L,operator1H,operator1L
146 0000
147 0000
148 0000 Mul18_Next_Bit:
149 0000 JMP Mul16_doloop
150 0000
151 0000
152 0000 Mul8_End:
153 0000
154 0000
155 0000 ENDM
156 0000
157 0000 ;*******************************************************************************
158 0000 ; 8 bit macro
159 0000 ;*******************************************************************************
160 0000 ;*******************************************************************************
161 0000 ; 16 bit ADD with signed
162 0000 ; use ADD16 X,Y,Z
163 0000 ; operation
164 0000 ; X
165 0000 ; +Y
166 0000 ; --------------
167 0000 ; Z
168 0000 ;*******************************************************************************
169 0000 ADD8 MACRO X1,Y1,Z1
170 0000 MOV A,X1
171 0000 ADD A,Y1
172 0000 MOV Z1,A
173 0000 ENDM
174 0000
175 0000 ;*******************************************************************************
176 0000 ; 16 bit sub with signed
177 0000 ; use SUB16 X,Y,Z
178 0000 ; operation
179 0000 ; X
<0C>ļ<EFBFBD><C4BC><EFBFBD>MACRO.ASM ʢȺ<CAA2><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾 2.86 ҳ<><D2B3>4
180 0000 ; -Y
181 0000 ; --------------
182 0000 ; Z
183 0000 ;*******************************************************************************
184 0000 SUB8 MACRO X1,Y1,Z1
185 0000 MOV A,X1
186 0000 SUB A,Y1
187 0000 MOV Z1,A
188 0000 ENDM
189 0000
190 0000 ;*******************************************************************************
191 0000 ; 8 bit shift right with signed
192 0000 ; use RR8 X,Z
193 0000 ; operation
194 0000 ;*******************************************************************************
195 0000 RR8 MACRO X,Y
196 0000 Local RR8_End,RR8_Modify_FF,RR8_Modify_FF_End
197 0000 mov a,X
198 0000 inc acc
199 0000 SZ Z
200 0000 jmp RR8_Modify_FF
201 0000 jmp RR8_Modify_FF_End
202 0000 RR8_Modify_FF:
203 0000 clr Y
204 0000 jmp RR8_End
205 0000
206 0000 RR8_Modify_FF_End:
207 0000 CLR C
208 0000 MOV A,X
209 0000 AND A,80H
210 0000 SNZ Z
211 0000 SET C
212 0000 RRCA X
213 0000 MOV Y,A
214 0000
215 0000
216 0000
217 0000 RR8_End:
218 0000 ENDM
219 0000 ;*******************************************************************************
220 0000 ; 8 bit shift left with signed
221 0000 ; use RL16 X,Z
222 0000 ; operation
223 0000 ;*******************************************************************************
224 0000 RL8 MACRO X,Y
225 0000 CLR C
226 0000 RLCA X
227 0000 MOV Y,A
228 0000 ENDM
229 0000
230 0000 ;*******************************************************************************
231 0000 ; 8 bit abs
232 0000 ; use ABS8 X,Y
233 0000 ; operation
234 0000 ;*******************************************************************************
235 0000 ABS8 MACRO X,Y
236 0000 Local ABS8_End
237 0000
238 0000 kmov y,x
239 0000 mov a,x
<0C>ļ<EFBFBD><C4BC><EFBFBD>MACRO.ASM ʢȺ<CAA2><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾 2.86 ҳ<><D2B3>5
240 0000 and a,80H
241 0000 SZ Z
242 0000 jmp ABS8_End
243 0000 CPL y
244 0000 INC y
245 0000
246 0000 ABS8_End:
247 0000
248 0000 ENDM
249 0000
250 0000
251 0000
252 0000
253 0000
254 0000
255 0000 ;*******************************************************************************
256 0000 ; kmov
257 0000 ; use kmov destination,source
258 0000 ; operation
259 0000 ;*******************************************************************************
260 0000 KMOV MACRO mem1,mem2
261 0000 mov a,mem2
262 0000 mov mem1,a
263 0000 ENDM
264 0000
265 0000 KOR MACRO mem1,mem2
266 0000 mov a,mem2
267 0000 orm a,mem1
268 0000 ENDM
269 0000
270 0000
271 0000
272 0000 ;*******************************************************************************
273 0000 ; make oled column address
274 0000 ; use oled_make_col_add source,MSB,LSB
275 0000 ;
276 0000 ;*******************************************************************************
277 0000 oled_make_col_add macro mem1,mem2,mem3
278 0000 mov a,0FH
279 0000 AND a,mem1
280 0000 mov mem3,a
281 0000 mov a,70H
282 0000 and a,mem1
283 0000 mov mem2,a
284 0000 clr c
285 0000 rrc mem2
286 0000 clr c
287 0000 rrc mem2
288 0000 clr c
289 0000 rrc mem2
290 0000 clr c
291 0000 rrc mem2
292 0000 set mem2.4
293 0000
294 0000 endm
295 0000
296 0000
297 0000
298 0000 ;***************************************
299 0000
<0C>ļ<EFBFBD><C4BC><EFBFBD>MACRO.ASM ʢȺ<CAA2><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾 2.86 ҳ<><D2B3>6
300 0000 XMOV MACRO mem2,mem1
301 0000 mov a,mem1
302 0000 mov mem2,a
303 0000 ENDM
304 0000 ;-------------------------------------
305 0000 ;;Move ARG2->ARG1(move by bit)
306 0000 xmov1 MACRO ARG1,ARG2
307 0000 LOCAL xmov1_1,xmov1_end
308 0000 sz ARG2
309 0000 jmp xmov1_1
310 0000 clr ARG1
311 0000 jmp xmov1_end
312 0000 xmov1_1:
313 0000 set ARG1
314 0000 xmov1_end:
315 0000 ENDM
316 0000 ;-------------------------------------
317 0000 ;;if MEM2=MEM1 =>Skip Next Instruction
318 0000 EQUJMP MACRO MEM2,MEM1
319 0000 MOV A,MEM1
320 0000 XOR A,MEM2
321 0000 SNZ Z
322 0000 ENDM
323 0000 ;;------------------------
324 0000
325 0000 ;;if MEM2!=MEM1 =>Skip Next Instruction
326 0000 NEJMP MACRO MEM2,MEM1
327 0000 MOV A,MEM1
328 0000 XOR A,MEM2
329 0000 SZ Z
330 0000 ENDM
331 0000 ;;------------------------
332 0000 ;;if (REG1==REG2) goto REG3
333 0000 JLER MACRO REG1,REG2,REG3
334 0000 mov a,REG1
335 0000 sub a,REG2
336 0000 sz z
337 0000 jmp REG3
338 0000 ENDM
339 0000 ;**********************************************
340 0000 ;MACRO: JLNR
341 0000 ;PURPOSE: REG1 != REG2 goto REG3
342 0000 ;**********************************************
343 0000 JLNR MACRO REG1,REG2,REG3
344 0000 mov a,REG1
345 0000 sub a,REG2
346 0000 snz z
347 0000 jmp REG3
348 0000 ENDM
349 0000 ;;------------------------
350 0000 ;;if MEM2>MEM1 =>Skip Next Instruction
351 0000 LBRJ MACRO MEM2,MEM1
352 0000 MOV A,MEM1
353 0000 SUB A,MEM2
354 0000 SZ C
355 0000 ENDM
356 0000 ;;------------------------
357 0000
358 0000 ;;if MEM2<=MEM1 =>Skip Next Instruction
359 0000 LSERJ MACRO MEM2,MEM1
<0C>ļ<EFBFBD><C4BC><EFBFBD>MACRO.ASM ʢȺ<CAA2><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾 2.86 ҳ<><D2B3>7
360 0000 MOV A,MEM1
361 0000 SUB A,MEM2
362 0000 SNZ C
363 0000 ENDM
364 0000 ;;------------------------
365 0000
366 0000 ;;if MEM2<MEM1 =>Skip Next Instruction
367 0000 LSRJ MACRO MEM2,MEM1
368 0000 MOV A,MEM2
369 0000 SUB A,MEM1
370 0000 SZ C
371 0000 ENDM
372 0000 ;;------------------------
373 0000
374 0000 ;;if MEM2>=MEM1 =>Skip Next Instruction
375 0000 LBERJ MACRO MEM2,MEM1
376 0000 MOV A,MEM2
377 0000 SUB A,MEM1
378 0000 SNZ C
379 0000 ENDM
380 0000 ;;------------------------
381 0000
382 0000 SWAPWORD MACRO DA
383 0000 EQU (DA>>8)+(DA<<8)
384 0000 ENDM
385 0000 ;;------------------------
386 0000
0 Errors