]>
Commit | Line | Data |
---|---|---|
9c15f366 L |
1 | ; 8080 Interpreter. |
2 | ; This is part of the Z80-CP/M emulator written by Sprite_tm. | |
3 | ; | |
4 | ||
5 | ; Copyright (C) 2010 Sprite_tm | |
6 | ; Copyright (C) 2010 Leo C. | |
7 | ; Copyright (C) 2010 Horst S. | |
8 | ||
9 | ; This file is part of avrcpm. | |
10 | ; | |
11 | ; avrcpm is free software: you can redistribute it and/or modify it | |
12 | ; under the terms of the GNU General Public License as published by | |
13 | ; the Free Software Foundation, either version 3 of the License, or | |
14 | ; (at your option) any later version. | |
15 | ; | |
16 | ; avrcpm is distributed in the hope that it will be useful, | |
17 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ; GNU General Public License for more details. | |
20 | ; | |
21 | ; You should have received a copy of the GNU General Public License | |
22 | ; along with avrcpm. If not, see <http://www.gnu.org/licenses/>. | |
23 | ; | |
24 | ; $Id$ | |
25 | ; | |
26 | ||
27 | ;-------------------------------------------------- | |
28 | ; Generate a table entry for one instruction | |
29 | ; | |
30 | ; instr fetch, op, store | |
31 | ; | |
32 | .macro instr | |
f24b3c79 | 33 | .db low(@2), low(do_@1), high(do_@1), low(@0) |
9c15f366 L |
34 | .endm |
35 | ||
36 | ||
37 | .dseg | |
38 | ||
39 | z_b: .byte 1 | |
40 | z_c: .byte 1 | |
41 | z_d: .byte 1 | |
42 | z_e: .byte 1 | |
43 | z_h: .byte 1 | |
44 | z_l: .byte 1 | |
45 | ||
9c15f366 L |
46 | .cseg |
47 | ||
48 | ;Init z80 | |
49 | z80_init: | |
50 | ldi z_pcl,low (IPLADDR) | |
51 | ldi z_pch,high(IPLADDR) | |
52 | ||
53 | cbi flags,trace | |
54 | printnewline | |
55 | printstring "Ok, CPU is live!" | |
56 | printnewline | |
57 | ||
58 | ;---------------------------------------------------------- | |
59 | ; 1 2 3 4 | |
60 | ;.db (low)do_store (low)do_op (hihg)do_op (low)do_fetch | |
61 | ; | |
62 | ;das kommt auf den stapel | |
63 | ; main da solls zum schluss weitergehen | |
64 | ;do_store wohin damit beenden mit RET | |
65 | ;do_op was tun beenden mit RET | |
66 | ; | |
67 | ;das wird direkt angesprungen | |
68 | ;do_fetch woher beenden mit RET | |
69 | ; | |
70 | ; | |
71 | main: | |
72 | .if INS_DEBUG | |
73 | cbi flags,trace | |
74 | cpi z_pch,DBG_TRACE_BOTTOM | |
75 | brlo notraceon | |
76 | cpi z_pch,DBG_TRACE_TOP | |
77 | brsh notraceon | |
78 | sbi flags,trace | |
79 | notraceon: | |
80 | .endif | |
81 | ||
9c15f366 L |
82 | .if PRINT_PC |
83 | cpi z_pch,DBG_TRACE_BOTTOM | |
84 | brlo noprintpc | |
85 | cpi z_pch,DBG_TRACE_TOP | |
86 | brsh noprintpc | |
87 | ||
88 | printnewline | |
89 | printstring "PC=" | |
90 | movw temp,z_pcl | |
91 | rcall printhexw | |
92 | printstring " " | |
93 | noprintpc: | |
94 | .endif | |
95 | ||
96 | .if INS_DEBUG | |
97 | sbic flags,trace | |
98 | rcall printregs | |
99 | .endif | |
100 | ||
101 | ;hier kommt die Interruptbehandlung rein | |
102 | ||
103 | ldi zl,low(main) ;da will ich wieder hin. | |
104 | ldi zh,high(main) ; | |
105 | push zl ; | |
106 | push zh ; | |
107 | mem_read_s z_pc ;temp=memReadByte(z_pc) | |
108 | adiw z_pcl,1 ;++z_pc | |
109 | ldi zl,low(todo_table*2) ;zhl=todo_table | |
110 | ldi zh,high(todo_table*2) ; | |
111 | ldi temp2,4 ;1 | |
112 | mul temp,temp2 ;2 | |
113 | add zl,r0 ;1 | |
114 | adc zh,r1 ;1 | |
115 | ldi temp2,high(store_ops) ; | |
116 | lpm temp,Z+ ;do_store | |
117 | push temp ; low | |
118 | push temp2 ; high | |
119 | ||
120 | lpm temp,Z+ ;do_op | |
121 | push temp ; low | |
122 | lpm temp,Z+ ; high | |
123 | push temp ; | |
124 | ||
125 | lpm zl,Z ;do_fetch | |
126 | ||
127 | ;mov zh,temp2 ; | |
128 | ldi zh,high(fetch_ops) | |
129 | ijmp ;direkt | |
130 | ||
131 | ||
132 | ||
133 | ; ------------ Fetch phase stuff ----------------- | |
134 | ||
135 | .org (PC+255) & 0xff00 ; wichtig !!!fetch und store muessen in einer page liegen | |
136 | fetch_ops: | |
f24b3c79 | 137 | do_fetch_nop: |
9c15f366 L |
138 | ret |
139 | ||
140 | do_fetch_a: | |
141 | mov opl,z_a | |
142 | ret | |
143 | ||
144 | do_fetch_b: | |
145 | lds opl,z_b | |
146 | ret | |
147 | ||
148 | do_fetch_c: | |
149 | lds opl,z_c | |
150 | ret | |
151 | ||
152 | do_fetch_d: | |
153 | lds opl,z_d | |
154 | ret | |
155 | ||
156 | do_fetch_e: | |
157 | lds opl,z_e | |
158 | ret | |
159 | ||
160 | do_fetch_h: | |
161 | lds opl,z_h | |
162 | ret | |
163 | ||
164 | do_fetch_l: | |
165 | lds opl,z_l | |
166 | ret | |
167 | ||
168 | do_fetch_af: | |
169 | mov opl,z_flags | |
170 | mov oph,z_a | |
171 | ret | |
172 | ||
173 | do_fetch_bc: | |
174 | lds opl,z_c | |
175 | lds oph,z_b | |
176 | ret | |
177 | ||
178 | do_fetch_de: | |
179 | lds opl,z_e | |
180 | lds oph,z_d | |
181 | ret | |
182 | ||
183 | do_fetch_hl: | |
184 | lds opl,z_l | |
185 | lds oph,z_h | |
186 | ret | |
187 | ||
188 | do_fetch_sp: | |
189 | movw opl,z_spl | |
190 | ret | |
191 | ||
192 | do_fetch_mbc: | |
193 | lds xh,z_b | |
194 | lds xl,z_c | |
f24b3c79 | 195 | mem_read_d z_a |
9c15f366 L |
196 | ret |
197 | ||
198 | do_fetch_mde: | |
199 | lds xh,z_d | |
200 | lds xl,z_e | |
f24b3c79 | 201 | mem_read_d z_a |
9c15f366 L |
202 | ret |
203 | ||
204 | do_fetch_mhl: | |
205 | lds xh,z_h | |
206 | lds xl,z_l | |
207 | mem_read_d opl | |
208 | ret | |
209 | ||
210 | do_fetch_msp: | |
211 | movw x,z_spl | |
212 | mem_read_d opl | |
213 | adiw x,1 | |
214 | mem_read_d oph | |
215 | ret | |
216 | ||
217 | do_fetch_dir8: | |
218 | mem_read_ds opl, z_pc | |
219 | adiw z_pcl,1 | |
220 | ret | |
221 | ||
222 | do_fetch_dir16: | |
223 | mem_read_ds opl, z_pc | |
224 | adiw z_pcl,1 | |
225 | mem_read_ds oph, z_pc | |
226 | adiw z_pcl,1 | |
227 | ret | |
228 | ||
229 | do_fetch_rst: | |
230 | movw x,z_pcl | |
231 | sbiw x,1 | |
232 | mem_read_d opl | |
233 | andi opl,0x38 | |
234 | ldi oph,0 | |
235 | ret | |
236 | ||
237 | ; ------------ Store phase stuff ----------------- | |
238 | ||
239 | .org (PC+255) & 0xff00 ; wichtig !!!fetch und store muessen in einer page liegen | |
240 | store_ops: | |
f24b3c79 | 241 | do_store_nop: |
9c15f366 L |
242 | ret |
243 | ||
244 | do_store_a: | |
245 | mov z_a,opl | |
246 | ret | |
247 | ||
248 | do_store_b: | |
249 | sts z_b,opl | |
250 | ret | |
251 | ||
252 | do_store_c: | |
253 | sts z_c,opl | |
254 | ret | |
255 | ||
256 | do_store_d: | |
257 | sts z_d,opl | |
258 | ret | |
259 | ||
260 | do_store_e: | |
261 | sts z_e,opl | |
262 | ret | |
263 | ||
264 | do_store_h: | |
265 | sts z_h,opl | |
266 | ret | |
267 | ||
268 | do_store_l: | |
269 | sts z_l,opl | |
270 | ret | |
271 | ||
272 | do_store_af: | |
273 | mov z_a,oph | |
274 | mov z_flags,opl | |
275 | ret | |
276 | ||
277 | do_store_bc: | |
278 | sts z_b,oph | |
279 | sts z_c,opl | |
280 | ret | |
281 | ||
282 | do_store_de: | |
283 | sts z_d,oph | |
284 | sts z_e,opl | |
285 | ret | |
286 | ||
287 | do_store_hl: | |
288 | sts z_h,oph | |
289 | sts z_l,opl | |
290 | ret | |
291 | ||
292 | do_store_mbc: | |
293 | lds xh,z_b | |
294 | lds xl,z_c | |
f24b3c79 | 295 | mem_write_s z_a |
9c15f366 L |
296 | ret |
297 | ||
298 | do_store_mde: | |
299 | lds xh,z_d | |
300 | lds xl,z_e | |
f24b3c79 | 301 | mem_write_s z_a |
9c15f366 L |
302 | ret |
303 | ||
304 | do_store_mhl: | |
305 | lds xh,z_h | |
306 | lds xl,z_l | |
307 | mem_write_s opl | |
308 | ret | |
309 | ||
310 | do_store_msp: | |
311 | movw xl,z_spl | |
312 | mem_write_s opl | |
313 | adiw xl,1 | |
314 | mem_write_s oph | |
315 | ret | |
316 | ||
317 | do_store_sp: | |
318 | movw z_spl,opl | |
319 | ret | |
320 | ||
321 | do_store_pc: | |
322 | movw z_pcl,opl | |
323 | ret | |
324 | ||
325 | do_store_ret: | |
326 | movw x,z_spl | |
327 | mem_read_d z_pcl | |
328 | adiw x,1 | |
329 | mem_read_d z_pch | |
330 | adiw x,1 | |
331 | movw z_spl,x | |
332 | ||
333 | .if STACK_DBG | |
334 | printnewline | |
335 | printstring "Stack pop " | |
336 | movw temp,z_pcl | |
337 | rcall printhexw | |
338 | printstring ", SP is now " | |
339 | movw temp,z_spl | |
340 | rcall printhexw | |
341 | printstring ". " | |
342 | .endif | |
343 | ret | |
344 | ||
345 | do_store_call: | |
346 | movw xl,z_spl | |
347 | sbiw x,1 | |
348 | mem_write_s z_pch | |
349 | sbiw x,1 | |
350 | mem_write_s z_pcl | |
351 | movw z_spl,xl | |
352 | ||
353 | .if STACK_DBG | |
354 | printnewline | |
355 | printstring "Stack push " | |
356 | movw temp,z_pcl | |
357 | rcall printhexw | |
358 | printstring ", SP is now " | |
359 | movw temp,z_spl | |
360 | rcall printhexw | |
361 | printstring ". " | |
362 | .endif | |
363 | movw z_pcl,opl | |
364 | ret | |
365 | ||
366 | ||
367 | do_store_am: | |
368 | mem_write_ds op, z_a | |
369 | ret | |
370 | ||
9c15f366 | 371 | |
f24b3c79 L |
372 | ; ------------ Operation phase stuff ----------------- |
373 | ||
9c15f366 L |
374 | ;---------------------------------------------------------------- |
375 | ;| | | |
376 | ;| Zilog | | |
377 | ;| | | |
378 | ;| ZZZZZZZ 88888 000 | | |
379 | ;| Z 8 8 0 0 | | |
380 | ;| Z 8 8 0 0 0 | | |
381 | ;| Z 88888 0 0 0 | | |
382 | ;| Z 8 8 0 0 0 | | |
383 | ;| Z 8 8 0 0 | | |
384 | ;| ZZZZZZZ 88888 000 | | |
385 | ;| | | |
386 | ;| Z80 MICROPROCESSOR Instruction Set Summary | | |
387 | ;| | | |
388 | ;---------------------------------------------------------------- | |
389 | ;---------------------------------------------------------------- | |
390 | ;|Mnemonic |SZHPNC|Description |Notes | | |
391 | ;|----------+------+---------------------+----------------------| | |
392 | ;|ADC A,s |***V0*|Add with Carry |A=A+s+CY | | |
393 | ;|ADC HL,ss |**?V0*|Add with Carry |HL=HL+ss+CY | | |
394 | ;|ADD A,s |***V0*|Add |A=A+s | | |
395 | ;|ADD HL,ss |--?-0*|Add |HL=HL+ss | | |
396 | ;|ADD IX,pp |--?-0*|Add |IX=IX+pp | | |
397 | ;|ADD IY,rr |--?-0*|Add |IY=IY+rr | | |
398 | ;|AND s |**1P00|Logical AND |A=A&s | | |
399 | ;|BIT b,m |?*1?0-|Test Bit |m&{2^b} | | |
400 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
401 | ;|CALL nn |------|Unconditional Call |-[SP]=PC,PC=nn | | |
402 | ;|CCF |--?-0*|Complement Carry Flag|CY=~CY | | |
403 | ;|CP s |***V1*|Compare |A-s | | |
404 | ;|CPD |****1-|Compare and Decrement|A-[HL],HL=HL-1,BC=BC-1| | |
405 | ;|CPDR |****1-|Compare, Dec., Repeat|CPD till A=[HL]or BC=0| | |
406 | ;|CPI |****1-|Compare and Increment|A-[HL],HL=HL+1,BC=BC-1| | |
407 | ;|CPIR |****1-|Compare, Inc., Repeat|CPI till A=[HL]or BC=0| | |
408 | ;|CPL |--1-1-|Complement |A=~A | | |
409 | ;|DAA |***P-*|Decimal Adjust Acc. |A=BCD format | | |
410 | ;|DEC s |***V1-|Decrement |s=s-1 | | |
411 | ;|DEC xx |------|Decrement |xx=xx-1 | | |
412 | ;|DEC ss |------|Decrement |ss=ss-1 | | |
413 | ;|DI |------|Disable Interrupts | | | |
414 | ;|DJNZ e |------|Dec., Jump Non-Zero |B=B-1 till B=0 | | |
415 | ;|EI |------|Enable Interrupts | | | |
416 | ;|EX [SP],HL|------|Exchange |[SP]<->HL | | |
417 | ;|EX [SP],xx|------|Exchange |[SP]<->xx | | |
418 | ;|EX AF,AF' |------|Exchange |AF<->AF' | | |
419 | ;|EX DE,HL |------|Exchange |DE<->HL | | |
420 | ;|EXX |------|Exchange |qq<->qq' (except AF)| | |
421 | ;|HALT |------|Halt | | | |
422 | ;|IM n |------|Interrupt Mode | (n=0,1,2)| | |
423 | ;|IN A,[n] |------|Input |A=[n] | | |
424 | ;|IN r,[C] |***P0-|Input |r=[C] | | |
425 | ;|INC r |***V0-|Increment |r=r+1 | | |
426 | ;|INC [HL] |***V0-|Increment |[HL]=[HL]+1 | | |
427 | ;|INC xx |------|Increment |xx=xx+1 | | |
428 | ;|INC [xx+d]|***V0-|Increment |[xx+d]=[xx+d]+1 | | |
429 | ;|INC ss |------|Increment |ss=ss+1 | | |
430 | ;|IND |?*??1-|Input and Decrement |[HL]=[C],HL=HL-1,B=B-1| | |
431 | ;|INDR |?1??1-|Input, Dec., Repeat |IND till B=0 | | |
432 | ;|INI |?*??1-|Input and Increment |[HL]=[C],HL=HL+1,B=B-1| | |
433 | ;|INIR |?1??1-|Input, Inc., Repeat |INI till B=0 | | |
434 | ;|JP [HL] |------|Unconditional Jump |PC=[HL] | | |
435 | ;|JP [xx] |------|Unconditional Jump |PC=[xx] | | |
436 | ;|JP nn |------|Unconditional Jump |PC=nn | | |
437 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
438 | ;|JR e |------|Unconditional Jump |PC=PC+e | | |
439 | ;|JR cc,e |------|Conditional Jump |If cc JR(cc=C,NC,NZ,Z)| | |
440 | ;|LD dst,src|------|Load |dst=src | | |
441 | ;|LD A,i |**0*0-|Load |A=i (i=I,R)| | |
442 | ;|LDD |--0*0-|Load and Decrement |[DE]=[HL],HL=HL-1,# | | |
443 | ;|LDDR |--000-|Load, Dec., Repeat |LDD till BC=0 | | |
444 | ;|LDI |--0*0-|Load and Increment |[DE]=[HL],HL=HL+1,# | | |
445 | ;|LDIR |--000-|Load, Inc., Repeat |LDI till BC=0 | | |
446 | ;|NEG |***V1*|Negate |A=-A | | |
447 | ;|NOP |------|No Operation | | | |
448 | ;|OR s |**0P00|Logical inclusive OR |A=Avs | | |
449 | ;|OTDR |?1??1-|Output, Dec., Repeat |OUTD till B=0 | | |
450 | ;|OTIR |?1??1-|Output, Inc., Repeat |OUTI till B=0 | | |
451 | ;|OUT [C],r |------|Output |[C]=r | | |
452 | ;|OUT [n],A |------|Output |[n]=A | | |
453 | ;|OUTD |?*??1-|Output and Decrement |[C]=[HL],HL=HL-1,B=B-1| | |
454 | ;|OUTI |?*??1-|Output and Increment |[C]=[HL],HL=HL+1,B=B-1| | |
455 | ;|POP xx |------|Pop |xx=[SP]+ | | |
456 | ;|POP qq |------|Pop |qq=[SP]+ | | |
457 | ;|PUSH xx |------|Push |-[SP]=xx | | |
458 | ;|PUSH qq |------|Push |-[SP]=qq | | |
459 | ;|RES b,m |------|Reset bit |m=m&{~2^b} | | |
460 | ;|RET |------|Return |PC=[SP]+ | | |
461 | ;|RET cc |------|Conditional Return |If cc RET | | |
462 | ;|RETI |------|Return from Interrupt|PC=[SP]+ | | |
463 | ;|RETN |------|Return from NMI |PC=[SP]+ | | |
464 | ;|RL m |**0P0*|Rotate Left |m={CY,m}<- | | |
465 | ;|RLA |--0-0*|Rotate Left Acc. |A={CY,A}<- | | |
466 | ;|RLC m |**0P0*|Rotate Left Circular |m=m<- | | |
467 | ;|RLCA |--0-0*|Rotate Left Circular |A=A<- | | |
468 | ;|RLD |**0P0-|Rotate Left 4 bits |{A,[HL]}={A,[HL]}<- ##| | |
469 | ;|RR m |**0P0*|Rotate Right |m=->{CY,m} | | |
470 | ;|RRA |--0-0*|Rotate Right Acc. |A=->{CY,A} | | |
471 | ;|RRC m |**0P0*|Rotate Right Circular|m=->m | | |
472 | ;|RRCA |--0-0*|Rotate Right Circular|A=->A | | |
473 | ;|RRD |**0P0-|Rotate Right 4 bits |{A,[HL]}=->{A,[HL]} ##| | |
474 | ;|RST p |------|Restart | (p=0H,8H,10H,...,38H)| | |
475 | ;|SBC A,s |***V1*|Subtract with Carry |A=A-s-CY | | |
476 | ;|SBC HL,ss |**?V1*|Subtract with Carry |HL=HL-ss-CY | | |
477 | ;|SCF |--0-01|Set Carry Flag |CY=1 | | |
478 | ;|SET b,m |------|Set bit |m=mv{2^b} | | |
479 | ;|SLA m |**0P0*|Shift Left Arithmetic|m=m*2 | | |
480 | ;|SRA m |**0P0*|Shift Right Arith. |m=m/2 | | |
481 | ;|SRL m |**0P0*|Shift Right Logical |m=->{0,m,CY} | | |
482 | ;|SUB s |***V1*|Subtract |A=A-s | | |
483 | ;|XOR s |**0P00|Logical Exclusive OR |A=Axs | | |
484 | ;|----------+------+--------------------------------------------| | |
485 | ;| F |-*01? |Flag unaffected/affected/reset/set/unknown | | |
486 | ;| S |S |Sign flag (Bit 7) | | |
487 | ;| Z | Z |Zero flag (Bit 6) | | |
488 | ;| HC | H |Half Carry flag (Bit 4) | | |
489 | ;| P/V | P |Parity/Overflow flag (Bit 2, V=overflow) | | |
490 | ;| N | N |Add/Subtract flag (Bit 1) | | |
491 | ;| CY | C|Carry flag (Bit 0) | | |
492 | ;|-----------------+--------------------------------------------| | |
493 | ;| n |Immediate addressing | | |
494 | ;| nn |Immediate extended addressing | | |
495 | ;| e |Relative addressing (PC=PC+2+offset) | | |
496 | ;| [nn] |Extended addressing | | |
497 | ;| [xx+d] |Indexed addressing | | |
498 | ;| r |Register addressing | | |
499 | ;| [rr] |Register indirect addressing | | |
500 | ;| |Implied addressing | | |
501 | ;| b |Bit addressing | | |
502 | ;| p |Modified page zero addressing (see RST) | | |
503 | ;|-----------------+--------------------------------------------| | |
504 | ;|DEFB n(,...) |Define Byte(s) | | |
505 | ;|DEFB 'str'(,...) |Define Byte ASCII string(s) | | |
506 | ;|DEFS nn |Define Storage Block | | |
507 | ;|DEFW nn(,...) |Define Word(s) | | |
508 | ;|-----------------+--------------------------------------------| | |
509 | ;| A B C D E |Registers (8-bit) | | |
510 | ;| AF BC DE HL |Register pairs (16-bit) | | |
511 | ;| F |Flag register (8-bit) | | |
512 | ;| I |Interrupt page address register (8-bit) | | |
513 | ;| IX IY |Index registers (16-bit) | | |
514 | ;| PC |Program Counter register (16-bit) | | |
515 | ;| R |Memory Refresh register | | |
516 | ;| SP |Stack Pointer register (16-bit) | | |
517 | ;|-----------------+--------------------------------------------| | |
518 | ;| b |One bit (0 to 7) | | |
519 | ;| cc |Condition (C,M,NC,NZ,P,PE,PO,Z) | | |
520 | ;| d |One-byte expression (-128 to +127) | | |
521 | ;| dst |Destination s, ss, [BC], [DE], [HL], [nn] | | |
522 | ;| e |One-byte expression (-126 to +129) | | |
523 | ;| m |Any register r, [HL] or [xx+d] | | |
524 | ;| n |One-byte expression (0 to 255) | | |
525 | ;| nn |Two-byte expression (0 to 65535) | | |
526 | ;| pp |Register pair BC, DE, IX or SP | | |
527 | ;| qq |Register pair AF, BC, DE or HL | | |
528 | ;| qq' |Alternative register pair AF, BC, DE or HL | | |
529 | ;| r |Register A, B, C, D, E, H or L | | |
530 | ;| rr |Register pair BC, DE, IY or SP | | |
531 | ;| s |Any register r, value n, [HL] or [xx+d] | | |
532 | ;| src |Source s, ss, [BC], [DE], [HL], nn, [nn] | | |
533 | ;| ss |Register pair BC, DE, HL or SP | | |
534 | ;| xx |Index register IX or IY | | |
535 | ;|-----------------+--------------------------------------------| | |
536 | ;| + - * / ^ |Add/subtract/multiply/divide/exponent | | |
537 | ;| & ~ v x |Logical AND/NOT/inclusive OR/exclusive OR | | |
538 | ;| <- -> |Rotate left/right | | |
539 | ;| [ ] |Indirect addressing | | |
540 | ;| [ ]+ -[ ] |Indirect addressing auto-increment/decrement| | |
541 | ;| { } |Combination of operands | | |
542 | ;| # |Also BC=BC-1,DE=DE-1 | | |
543 | ;| ## |Only lower 4 bits of accumulator A used | | |
544 | ;---------------------------------------------------------------- | |
545 | ||
546 | ;How the flags are supposed to work: | |
547 | ;7 ZFL_S - Sign flag (=MSBit of result) | |
548 | ;6 ZFL_Z - Zero flag. Is 1 when the result is 0 | |
549 | ;4 ZFL_H - Half-carry (carry from bit 3 to 4) | |
550 | ;2 ZFL_P - Parity/2-complement Overflow | |
551 | ;1 ZFL_N - Subtract - set if last op was a subtract | |
552 | ;0 ZFL_C - Carry | |
553 | ; | |
554 | ;I sure hope I got the mapping between flags and instructions correct... | |
555 | ||
556 | .equ ZFL_S = 7 | |
557 | .equ ZFL_Z = 6 | |
558 | .equ ZFL_H = 4 | |
559 | .equ ZFL_P = 2 | |
560 | .equ ZFL_N = 1 | |
561 | .equ ZFL_C = 0 | |
562 | ||
563 | .equ AVR_T = SREG_T | |
564 | .equ AVR_H = SREG_H | |
565 | .equ AVR_S = SREG_S | |
566 | .equ AVR_V = SREG_V | |
567 | .equ AVR_N = SREG_N | |
568 | .equ AVR_Z = SREG_Z | |
569 | .equ AVR_C = SREG_C | |
570 | ||
571 | ;------------------------------------------------; | |
572 | ; Load table value from flash indexed by source reg. | |
573 | ; | |
574 | ;ldpmx dstreg,tablebase,indexreg | |
575 | ; | |
576 | ; (6 words, 8 cycles) | |
577 | ||
578 | .macro ldpmx | |
579 | ldi zh,high(@1*2) ; table must be page aligned | |
580 | mov zl,@2 | |
581 | lpm @0,z | |
582 | .endm | |
583 | ||
f24b3c79 | 584 | .macro do_z80_flags_V |
9c15f366 L |
585 | #if EM_Z80 |
586 | bmov z_flags, ZFL_P, temp, AVR_V | |
9c15f366 L |
587 | #endif |
588 | .endm | |
589 | ||
590 | .macro do_z80_flags_set_N | |
591 | #if EM_Z80 | |
592 | ori z_flags, (1<<ZFL_N) ; Negation auf 1 | |
593 | #endif | |
594 | .endm | |
595 | ||
596 | .macro do_z80_flags_set_HN | |
597 | #if EM_Z80 | |
598 | ori z_flags,(1<<ZFL_N)|(1<<ZFL_H) | |
599 | #endif | |
600 | .endm | |
601 | ||
602 | .macro do_z80_flags_clear_N | |
603 | #if EM_Z80 | |
604 | andi z_flags,~(1<<ZFL_N) | |
605 | #endif | |
606 | .endm | |
607 | ||
f24b3c79 L |
608 | .macro do_z80_flags_clear_HN |
609 | #if EM_Z80 | |
610 | andi z_flags,~((1<<ZFL_H)|(1<<ZFL_N)) | |
611 | #endif | |
612 | .endm | |
613 | ||
614 | ||
615 | .macro do_z80_flags_copy_HC | |
616 | #if EM_Z80 | |
617 | bmov z_flags, ZFL_H, z_flags, ZFL_H | |
618 | #endif | |
619 | .endm | |
620 | ||
9c15f366 L |
621 | .macro do_z80_flags_op_rotate |
622 | ; must not change avr carry flag! | |
623 | #if EM_Z80 | |
624 | andi z_flags, ~( (1<<ZFL_H) | (1<<ZFL_N) | (1<<ZFL_C) ) | |
625 | #else | |
626 | andi z_flags, ~( (1<<ZFL_C) ) | |
627 | #endif | |
628 | .endm | |
629 | ||
630 | .macro do_z80_flags_op_and | |
631 | #if EM_Z80 | |
632 | ori z_flags,(1<<ZFL_H) | |
9c15f366 L |
633 | #endif |
634 | .endm | |
635 | ||
636 | .macro do_z80_flags_op_or | |
637 | #if EM_Z80 | |
f24b3c79 | 638 | ;nothing to do |
9c15f366 L |
639 | #endif |
640 | .endm | |
641 | ||
642 | ||
643 | ;---------------------------------------------------------------- | |
644 | ||
645 | do_op_inv: | |
f24b3c79 L |
646 | sbiw z_pcl,1 |
647 | lcall printregs | |
648 | printstring "Invalid opcode! " | |
9c15f366 L |
649 | |
650 | haltinv: | |
651 | rjmp haltinv | |
652 | ||
f24b3c79 L |
653 | do_op_nop: |
654 | ret | |
655 | ||
9c15f366 L |
656 | ;---------------------------------------------------------------- |
657 | ;|Mnemonic |SZHPNC|Description |Notes | | |
658 | ;---------------------------------------------------------------- | |
659 | ;|OUT [n],A |------|Output |[n]=A | | |
660 | ; | |
661 | ; | |
662 | ;Interface with peripherials goes here :) | |
663 | do_op_outa: ; out (opl),a | |
664 | .if PORT_DEBUG | |
665 | printnewline | |
666 | printstring "Port write: " | |
667 | mov temp,z_a | |
668 | rcall printhex | |
669 | printstring " -> (" | |
670 | mov temp,opl | |
671 | rcall printhex | |
672 | printstring ") " | |
673 | .endif | |
674 | mov temp,z_a | |
675 | mov temp2,opl | |
f24b3c79 | 676 | lcall portWrite |
9c15f366 L |
677 | ret |
678 | ||
679 | ;---------------------------------------------------------------- | |
680 | ;|Mnemonic |SZHPNC|Description |Notes | | |
681 | ;---------------------------------------------------------------- | |
682 | ;|IN A,[n] |------|Input |A=[n] | | |
683 | ; | |
684 | ; | |
685 | do_op_in: ; in a,(opl) | |
686 | .if PORT_DEBUG | |
687 | printnewline | |
688 | printstring "Port read: (" | |
689 | mov temp,opl | |
690 | rcall printhex | |
691 | printstring ") -> " | |
692 | .endif | |
693 | ||
694 | mov temp2,opl | |
f24b3c79 | 695 | lcall portRead |
9c15f366 L |
696 | mov opl,temp |
697 | ||
698 | .if PORT_DEBUG | |
699 | rcall printhex | |
700 | printstring " " | |
701 | .endif | |
702 | ret | |
703 | ||
704 | ;---------------------------------------------------------------- | |
705 | ;|Mnemonic |SZHPNC|Description |Notes | | |
706 | ;---------------------------------------------------------------- | |
707 | ;|INC r |***V0-|Increment |r=r+1 | | |
708 | ;|INC [HL] |***V0-|Increment |[HL]=[HL]+1 | | |
709 | ;|INC [xx+d]|***V0-|Increment |[xx+d]=[xx+d]+1 | | |
710 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
711 | ;|INC r |**-P0-|Increment |r=r+1 | | |
712 | ;|INC [HL] |**-P0-|Increment |[HL]=[HL]+1 | | |
713 | ; | |
714 | ; | |
715 | do_op_inc: | |
f24b3c79 L |
716 | ldi temp,1 |
717 | add opl,temp | |
9c15f366 | 718 | in temp, sreg |
f24b3c79 | 719 | andi z_flags,(1<<ZFL_C) ; preserve C-flag |
9c15f366 L |
720 | ldpmx temp2, sz53p_tab, opl |
721 | or z_flags,temp2 ; | |
f24b3c79 L |
722 | bmov z_flags, ZFL_H, temp, AVR_H |
723 | do_z80_flags_V | |
9c15f366 L |
724 | ret |
725 | ||
726 | do_op_inca: | |
f24b3c79 L |
727 | ldi temp,1 |
728 | add z_a,temp | |
9c15f366 | 729 | in temp, sreg |
f24b3c79 | 730 | andi z_flags,(1<<ZFL_C) ; preserve C-flag |
9c15f366 L |
731 | ldpmx temp2, sz53p_tab, z_a |
732 | or z_flags,temp2 ; | |
f24b3c79 L |
733 | bmov z_flags, ZFL_H, temp, AVR_H |
734 | do_z80_flags_V | |
9c15f366 L |
735 | ret |
736 | ||
737 | ;---------------------------------------------------------------- | |
738 | ;|Mnemonic |SZHPNC|Description |Notes | | |
739 | ;---------------------------------------------------------------- | |
740 | ;|DEC r |***V1-|Decrement |s=s-1 | | |
741 | ;|INC [HL] |***V0-|Increment |[HL]=[HL]+1 | | |
742 | ;|INC [xx+d]|***V0-|Increment |[xx+d]=[xx+d]+1 | | |
743 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
744 | ;|DEC r |**-P -|Increment |r=r+1 | | |
745 | ;|DEC [HL] |**-P -|Increment |[HL]=[HL]+1 | | |
746 | ; | |
747 | ; | |
748 | do_op_dec: | |
f24b3c79 | 749 | subi opl,1 |
9c15f366 | 750 | in temp, sreg |
f24b3c79 | 751 | andi z_flags,(1<<ZFL_C) ; preserve C-flag |
9c15f366 L |
752 | ldpmx temp2, sz53p_tab, opl |
753 | or z_flags,temp2 ; | |
f24b3c79 L |
754 | bmov z_flags, ZFL_H, temp, AVR_H |
755 | do_z80_flags_V | |
9c15f366 L |
756 | do_z80_flags_set_N |
757 | ret | |
758 | ||
759 | do_op_deca: | |
f24b3c79 L |
760 | ldi opl,1 |
761 | sub z_a,opl | |
9c15f366 | 762 | in temp, sreg |
f24b3c79 | 763 | andi z_flags,(1<<ZFL_C) ; preserve C-flag |
9c15f366 L |
764 | ldpmx temp2, sz53p_tab, z_a |
765 | or z_flags,temp2 ; | |
f24b3c79 L |
766 | bmov z_flags, ZFL_H, temp, AVR_H |
767 | do_z80_flags_V | |
9c15f366 L |
768 | do_z80_flags_set_N |
769 | ret | |
770 | ||
771 | ;---------------------------------------------------------------- | |
772 | ;|Mnemonic |SZHPNC|Description |Notes | | |
773 | ;---------------------------------------------------------------- | |
774 | ;|INC xx |------|Increment |xx=xx+1 | | |
775 | ;|INC ss |------|Increment |ss=ss+1 | | |
776 | ; | |
777 | ; | |
778 | do_op_inc16: | |
779 | subi opl,low(-1) | |
780 | sbci oph,high(-1) | |
781 | ret | |
782 | ||
783 | ;---------------------------------------------------------------- | |
784 | ;|Mnemonic |SZHPNC|Description |Notes | | |
785 | ;---------------------------------------------------------------- | |
786 | ;|DEC xx |------|Decrement |xx=xx-1 | | |
787 | ;|DEC ss |------|Decrement |ss=ss-1 | | |
788 | ; | |
789 | ; | |
790 | do_op_dec16: | |
791 | subi opl, 1 | |
792 | sbci oph, 0 | |
793 | ret | |
794 | ||
795 | ;---------------------------------------------------------------- | |
796 | ;|Mnemonic |SZHPNC|Description |Notes | | |
797 | ;---------------------------------------------------------------- | |
798 | ;|RLCA |--0-0*|Rotate Left Circular |A=A<- | | |
799 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
800 | ;|RLCA |---- *|Rotate Left Circular |A=A<- | | |
801 | ; | |
802 | ; | |
f24b3c79 | 803 | do_op_rlca: |
9c15f366 L |
804 | ;Rotate Left Cyclical. All bits move 1 to the |
805 | ;left, the msb becomes c and lsb. | |
806 | do_z80_flags_op_rotate | |
f24b3c79 | 807 | lsl z_a |
9c15f366 | 808 | brcc do_op_rlc_noc |
f24b3c79 L |
809 | ldi temp,1 |
810 | or z_a,temp | |
9c15f366 L |
811 | ori z_flags, (1<<ZFL_C) |
812 | do_op_rlc_noc: | |
813 | ret | |
814 | ||
815 | ;---------------------------------------------------------------- | |
816 | ;|Mnemonic |SZHPNC|Description |Notes | | |
817 | ;---------------------------------------------------------------- | |
818 | ;|RRCA |--0-0*|Rotate Right Circular|A=->A | | |
819 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
820 | ;|RRCA |---- *|Rotate Right Circular|A=->A | | |
821 | ; | |
822 | ; | |
f24b3c79 | 823 | do_op_rrca: |
9c15f366 L |
824 | ;Rotate Right Cyclical. All bits move 1 to the |
825 | ;right, the lsb becomes c and msb. | |
826 | do_z80_flags_op_rotate | |
f24b3c79 | 827 | lsr z_a |
9c15f366 | 828 | brcc do_op_rrc_noc |
f24b3c79 L |
829 | ldi temp,0x80 |
830 | or z_a,temp | |
9c15f366 L |
831 | ori z_flags, (1<<ZFL_C) |
832 | do_op_rrc_noc: | |
833 | ret | |
834 | ||
835 | ;---------------------------------------------------------------- | |
836 | ;|Mnemonic |SZHPNC|Description |Notes | | |
837 | ;---------------------------------------------------------------- | |
838 | ;|RRA |--0-0*|Rotate Right Acc. |A=->{CY,A} | | |
839 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
840 | ;|RRA |---- *|Rotate Right Acc. |A=->{CY,A} | | |
841 | ; | |
842 | ; | |
f24b3c79 | 843 | do_op_rra: |
9c15f366 L |
844 | ;Rotate Right. All bits move 1 to the right, the lsb |
845 | ;becomes c, c becomes msb. | |
846 | clc ; get z80 carry to avr carry | |
847 | sbrc z_flags,ZFL_C | |
848 | sec | |
849 | do_z80_flags_op_rotate ; (clear ZFL_C, doesn't change AVR_C) | |
f24b3c79 L |
850 | bmov z_flags,ZFL_C, z_a,0 ; Bit 0 --> CY |
851 | ror z_a | |
9c15f366 L |
852 | ret |
853 | ||
854 | ;---------------------------------------------------------------- | |
855 | ;|Mnemonic |SZHPNC|Description |Notes | | |
856 | ;---------------------------------------------------------------- | |
857 | ;|RLA |--0-0*|Rotate Left Acc. |A={CY,A}<- | | |
858 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
859 | ;|RLA |---- *|Rotate Left Acc. |A={CY,A}<- | | |
860 | ; | |
861 | ; | |
f24b3c79 | 862 | do_op_rla: |
9c15f366 L |
863 | ;Rotate Left. All bits move 1 to the left, the msb |
864 | ;becomes c, c becomes lsb. | |
865 | clc | |
866 | sbrc z_flags,ZFL_C | |
867 | sec | |
868 | do_z80_flags_op_rotate ; (clear ZFL_C, doesn't change AVR_C) | |
f24b3c79 L |
869 | bmov z_flags,ZFL_C, z_a,7 ; Bit 7 --> CY |
870 | rol z_a | |
9c15f366 L |
871 | ret |
872 | ||
873 | ;---------------------------------------------------------------- | |
874 | ;|Mnemonic |SZHPNC|Description |Notes | | |
875 | ;---------------------------------------------------------------- | |
876 | ;|ADD A,s |***V0*|Add |A=A+s | | |
877 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
878 | ;|ADD A,s |***P *|Add |A=A+s | | |
879 | ; | |
880 | ; | |
881 | do_op_adda: | |
882 | add z_a,opl | |
883 | in temp,sreg | |
884 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,P flag | |
885 | bmov z_flags,ZFL_C, temp,AVR_C | |
f24b3c79 L |
886 | bmov z_flags,ZFL_H, temp,AVR_H |
887 | do_z80_flags_V | |
9c15f366 L |
888 | ret |
889 | ||
890 | ;---------------------------------------------------------------- | |
891 | ;|Mnemonic |SZHPNC|Description |Notes | | |
892 | ;---------------------------------------------------------------- | |
893 | ;|ADC A,s |***V0*|Add with Carry |A=A+s+CY | | |
894 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
895 | ;|ADC A,s |***P *|Add with Carry |A=A+s+CY | | |
896 | ; | |
897 | ; | |
898 | do_op_adca: | |
899 | clc | |
900 | sbrc z_flags,ZFL_C | |
901 | sec | |
902 | adc z_a,opl | |
903 | in temp,sreg | |
904 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,P | |
905 | bmov z_flags,ZFL_C, temp,AVR_C | |
f24b3c79 L |
906 | bmov z_flags,ZFL_H, temp,AVR_H |
907 | do_z80_flags_V | |
9c15f366 L |
908 | ret |
909 | ||
910 | ;---------------------------------------------------------------- | |
911 | ;|Mnemonic |SZHPNC|Description |Notes | | |
912 | ;---------------------------------------------------------------- | |
913 | ;|SUB s |***V1*|Subtract |A=A-s | | |
914 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
915 | ;|SUB s |***P *|Subtract |A=A-s | | |
916 | ||
917 | ; | |
918 | do_op_subfa: | |
919 | sub z_a,opl | |
920 | in temp,sreg | |
921 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,P | |
922 | bmov z_flags,ZFL_C, temp,AVR_C | |
f24b3c79 L |
923 | bmov z_flags,ZFL_H, temp,AVR_H |
924 | do_z80_flags_V | |
9c15f366 L |
925 | do_z80_flags_set_N |
926 | ret | |
927 | ||
928 | ;---------------------------------------------------------------- | |
929 | ;|Mnemonic |SZHPNC|Description |Notes | | |
930 | ;---------------------------------------------------------------- | |
931 | ;|CP s |***V1*|Compare |A-s | | |
932 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
933 | ;|CP s |***P *|Compare |A-s | | |
934 | ||
935 | ; | |
936 | do_op_cpfa: | |
f24b3c79 L |
937 | mov temp2,z_a |
938 | sub temp2,opl | |
9c15f366 | 939 | in temp,sreg |
f24b3c79 | 940 | ldpmx z_flags,sz53p_tab,temp2 ;S,Z,P |
9c15f366 | 941 | bmov z_flags,ZFL_C, temp,AVR_C |
f24b3c79 L |
942 | bmov z_flags,ZFL_H, temp,AVR_H |
943 | do_z80_flags_V | |
9c15f366 L |
944 | do_z80_flags_set_N |
945 | ret | |
946 | ||
947 | ;---------------------------------------------------------------- | |
948 | ;|Mnemonic |SZHPNC|Description |Notes | | |
949 | ;---------------------------------------------------------------- | |
950 | ;|SBC A,s |***V1*|Subtract with Carry |A=A-s-CY | | |
951 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
952 | ;|SBC A,s |***P *|Subtract with Carry |A=A-s-CY | | |
953 | ; | |
954 | ; | |
955 | do_op_sbcfa: | |
956 | clc | |
957 | sbrc z_flags,ZFL_C | |
958 | sec | |
959 | sbc z_a,opl | |
960 | in temp,sreg | |
961 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,P | |
962 | bmov z_flags,ZFL_C, temp,AVR_C | |
f24b3c79 L |
963 | bmov z_flags,ZFL_H, temp,AVR_H |
964 | do_z80_flags_V | |
9c15f366 L |
965 | do_z80_flags_set_N |
966 | ret | |
967 | ||
968 | ;---------------------------------------------------------------- | |
969 | ;|Mnemonic |SZHPNC|Description |Notes | | |
970 | ;---------------------------------------------------------------- | |
971 | ;|AND s |**1P00|Logical AND |A=A&s | | |
972 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
973 | ;|AND s |**-P 0|Logical AND |A=A&s | | |
974 | ; | |
f24b3c79 | 975 | ; |
9c15f366 L |
976 | do_op_anda: |
977 | and z_a,opl ; | |
978 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,P,N,C | |
979 | do_z80_flags_op_and | |
980 | ret | |
981 | ||
982 | ||
983 | ;---------------------------------------------------------------- | |
984 | ;|Mnemonic |SZHPNC|Description |Notes | | |
985 | ;---------------------------------------------------------------- | |
986 | ;|OR s |**0P00|Logical inclusive OR |A=Avs | | |
987 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
988 | ;|OR s |**-P00|Logical inclusive OR |A=Avs | | |
989 | ; | |
f24b3c79 | 990 | ; |
9c15f366 L |
991 | do_op_ora: |
992 | or z_a,opl | |
993 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N,C | |
994 | do_z80_flags_op_or | |
995 | ret | |
996 | ||
997 | ;---------------------------------------------------------------- | |
998 | ;|Mnemonic |SZHPNC|Description |Notes | | |
999 | ;---------------------------------------------------------------- | |
1000 | ;|XOR s |**0P00|Logical Exclusive OR |A=Axs | | |
1001 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1002 | ;|XOR s |**-P 0|Logical Exclusive OR |A=Axs | | |
1003 | ; | |
f24b3c79 | 1004 | ; |
9c15f366 L |
1005 | do_op_xora: |
1006 | eor z_a,opl | |
1007 | ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N,C | |
1008 | do_z80_flags_op_or | |
1009 | ret | |
1010 | ||
1011 | ;---------------------------------------------------------------- | |
1012 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1013 | ;---------------------------------------------------------------- | |
1014 | ;|ADD HL,ss |--?-0*|Add |HL=HL+ss | | |
1015 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1016 | ;|ADD HL,ss |---- *|Add |HL=HL+ss | | |
1017 | ; | |
1018 | ; | |
1019 | do_op_addhl: | |
1020 | lds temp,z_l | |
1021 | lds temp2,z_h | |
1022 | add opl,temp | |
1023 | adc oph,temp2 | |
1024 | in temp,sreg | |
1025 | bmov z_flags,ZFL_H, temp,AVR_H | |
1026 | bmov z_flags,ZFL_C, temp,AVR_C | |
1027 | do_z80_flags_clear_N | |
1028 | ret | |
1029 | ||
1030 | ;---------------------------------------------------------------- | |
1031 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1032 | ;---------------------------------------------------------------- | |
1033 | ;|LD dst,src|------|Load |dst=src | | |
1034 | ; | |
1035 | ; | |
1036 | do_op_sthl: ;store hl to mem loc in opl:h | |
1037 | movw xl,opl | |
1038 | lds temp,z_l | |
1039 | mem_write | |
1040 | adiw xl,1 | |
1041 | lds temp,z_h | |
1042 | mem_write | |
1043 | ret | |
1044 | ||
1045 | ;---------------------------------------------------------------- | |
1046 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1047 | ;---------------------------------------------------------------- | |
1048 | ;|LD dst,src|------|Load |dst=src | | |
1049 | ; | |
1050 | ; | |
1051 | do_op_rmem16: | |
1052 | movw xl,opl | |
1053 | mem_read_d opl | |
1054 | adiw x,1 | |
1055 | mem_read_d oph | |
1056 | ret | |
1057 | ||
1058 | ;---------------------------------------------------------------- | |
1059 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1060 | ;---------------------------------------------------------------- | |
1061 | ;|LD dst,src|------|Load |dst=src | | |
1062 | ; | |
1063 | ; | |
1064 | do_op_rmem8: | |
1065 | mem_read_ds opl, op | |
1066 | ret | |
1067 | ||
1068 | ;---------------------------------------------------------------- | |
1069 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1070 | ;---------------------------------------------------------------- | |
1071 | ;|DAA |***P-*|Decimal Adjust Acc. | | | |
1072 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1073 | ; | |
1074 | ; Not yet checked | |
1075 | ||
1076 | ; Description (http://www.z80.info/z80syntx.htm#DAA): | |
1077 | ; This instruction conditionally adjusts the accumulator for BCD addition | |
1078 | ; and subtraction operations. For addition (ADD, ADC, INC) or subtraction | |
1079 | ; (SUB, SBC, DEC, NEC), the following table indicates the operation performed: | |
1080 | ; | |
f24b3c79 L |
1081 | ; ------------------------------------------------------------------- |
1082 | ; | |C Flag |HEX value in|H Flag |HEX val in | Number |C flag | | |
1083 | ; | Oper |Before |upper digit |Before |lower digit| added |After | | |
1084 | ; | |DAA |(bit 7-4) |DAA |(bit 3-0) | to A |DAA | | |
1085 | ; |-------+-------+------------+-------+-----------+--------+-------| | |
9c15f366 L |
1086 | ; | | 0 | 0-9 | 0 | 0-9 | 00 | 0 | |
1087 | ; | ADD | 0 | 0-8 | 0 | A-F | 06 | 0 | | |
1088 | ; | | 0 | 0-9 | 1 | 0-3 | 06 | 0 | | |
1089 | ; | ADC | 0 | A-F | 0 | 0-9 | 60 | 1 | | |
1090 | ; | | 0 | 9-F | 0 | A-F | 66 | 1 | | |
1091 | ; | INC | 0 | A-F | 1 | 0-3 | 66 | 1 | | |
1092 | ; | | 1 | 0-2 | 0 | 0-9 | 60 | 1 | | |
1093 | ; | | 1 | 0-2 | 0 | A-F | 66 | 1 | | |
1094 | ; | | 1 | 0-3 | 1 | 0-3 | 66 | 1 | | |
f24b3c79 | 1095 | ; |-------+-------+------------+-------+-----------+--------+-------| |
9c15f366 L |
1096 | ; | SUB | 0 | 0-9 | 0 | 0-9 | 00 | 0 | |
1097 | ; | SBC | 0 | 0-8 | 1 | 6-F | FA | 0 | | |
1098 | ; | DEC | 1 | 7-F | 0 | 0-9 | A0 | 1 | | |
1099 | ; | NEG | 1 | 6-F | 1 | 6-F | 9A | 1 | | |
f24b3c79 L |
1100 | ; ------------------------------------------------------------------- |
1101 | ; | |
1102 | ; The H flag is affected as follows: | |
1103 | ; | |
1104 | ; --------------------- | |
1105 | ; | N | H | low |H' | | |
1106 | ; | | |nibble | | | |
1107 | ; |---+---+-------+---| | |
1108 | ; | 0 | * | 0-9 | 0 | | |
1109 | ; | 0 | * | a-f | 1 | | |
1110 | ; | 1 | 0 | * | 0 | | |
1111 | ; | 1 | 1 | 6-f | 0 | | |
1112 | ; | 1 | 1 | 0-5 | 1 | | |
1113 | ; --------------------- | |
1114 | ; | |
1115 | ; Ohter flags: | |
9c15f366 L |
1116 | ; N: Unaffected. |
1117 | ; P/V: Set if Acc. is even parity after operation, reset otherwise. | |
9c15f366 L |
1118 | ; Z: Set if Acc. is Zero after operation, reset otherwise. |
1119 | ; S: Set if most significant bit of Acc. is 1 after operation, reset otherwise. | |
1120 | ||
f1deeee3 L |
1121 | #if 1 |
1122 | ||
1123 | do_op_da: | |
1124 | ||
1125 | #if EM_Z80 | |
1126 | sbrc z_flags,ZFL_N ;if add-op | |
1127 | rjmp op_da_sub ;then | |
1128 | #endif | |
1129 | ||
1130 | op_da_add: | |
1131 | ldi temp2,0 ; new C and H flag | |
1132 | sbrc z_flags,ZFL_H ; | | |
1133 | rjmp op_da_a01 ; if (H flag ... | |
1134 | mov temp,opl ; | | |
1135 | andi temp,0x0f ; | | |
1136 | cpi temp,0x0a ; or (lower nibble >= 0x0A)) | |
1137 | brlo op_da_a10 ; | | |
1138 | op_da_a01: ; then | |
1139 | ldi oph,0x06 ; add 6 to lower nibble | |
1140 | add opl,oph ; | |
1141 | brhc op_da_02 ; if | |
1142 | ori temp2,(1<<ZFL_H) ; set new H flag | |
1143 | op_da_02: ; | |
1144 | brcc op_da_a10 ; if | |
1145 | ori temp2,(1<<ZFL_C) ; set new H flag | |
1146 | op_da_a10: ; endif | |
1147 | sbrc z_flags,ZFL_C ; | | |
1148 | rjmp op_da_a12 ; if (C flag ... | |
1149 | cpi opl,0xA0 ; |... or upper nibble >= 0xA0) | |
1150 | brlo op_da_a13 ; | |
1151 | op_da_a12: ; | |
1152 | ldi oph,0x60 ; add 6 to lower nibble | |
1153 | add opl,oph ; | |
1154 | ori temp2,(1<<ZFL_C) ; set new C flag | |
1155 | op_da_a13: ; | |
1156 | ldpmx z_flags, sz53p_tab, opl ; get S,Z,P flag | |
1157 | or z_flags,temp2 ; merge new C and H flag | |
1158 | ret | |
1159 | ||
1160 | #if EM_Z80 | |
1161 | ||
1162 | op_da_sub: ;else (sub-op) | |
1163 | rcall do_op_inv ; TODO: ! | |
1164 | ret ;endif | |
1165 | #endif | |
1166 | ||
1167 | #else | |
9c15f366 | 1168 | |
9c15f366 | 1169 | do_op_da: |
f24b3c79 L |
1170 | ldi temp2,0 ;new C and H flag |
1171 | ldi oph,0 ;oph: what to add | |
1172 | ||
1173 | sbrc z_flags,ZFL_N ;if add-op | |
1174 | rjmp op_da_sub ;then | |
1175 | op_da_add: | |
1176 | mov temp,opl ; | | |
1177 | andi temp,0x0f ; | | |
1178 | cpi temp,0x0a ; if (lower nibble >= 0x0A) | |
1179 | brlo op_da_a10 ; | | |
1180 | ori oph,0x06 ; add 6 | |
1181 | ori temp2,(1<<ZFL_H) ; set new H flag | |
1182 | ||
1183 | sbrc z_flags,ZFL_C ; | | |
1184 | rjmp op_da_a02 ; if (C flag ... | |
1185 | cpi opl,0x90 ; |... or upper nibble >= 0x90) | |
1186 | brlo op_da_a03 ; | | |
1187 | op_da_a02: | |
1188 | ori oph,0x60 ; add 0x60 | |
1189 | ori temp2,(1<<ZFL_C) ; set new C flag | |
1190 | op_da_a03: ; endif | |
1191 | rjmp op_da_ae | |
1192 | op_da_a10: ; else (lower nibble is 0x09 or lower) | |
1193 | sbrc z_flags,ZFL_C ; | | |
1194 | rjmp op_da_a12 ; if (C flag ... | |
1195 | cpi opl,0xA0 ; |... or upper nibble >= 0xA0) | |
1196 | brlo op_da_a13 ; | |
1197 | op_da_a12: | |
1198 | ori oph,0x60 ; add 0x60 | |
1199 | ori temp2,(1<<ZFL_C) ; set new C flag | |
1200 | op_da_a13: | |
1201 | sbrs z_flags,ZFL_H ; if (H flag) | |
1202 | rjmp op_da_ae ; | | |
1203 | ori oph,0x06 ; add 0x06 | |
1204 | mov temp,opl ; | | |
1205 | andi temp,0x0f ; | | |
1206 | cpi temp,0x06 ; if (lower nibble >= 0x0A) | |
1207 | brsh op_da_ae ; | | |
1208 | ori temp2,(1<<ZFL_H) ; set new H flag | |
1209 | ; endif | |
1210 | ; endif | |
1211 | op_da_ae: | |
9c15f366 | 1212 | add opl,oph |
f24b3c79 L |
1213 | ldpmx z_flags, sz53p_tab, opl ; get S,Z,P flag |
1214 | or z_flags,temp2 ; merge new C and H flag | |
9c15f366 L |
1215 | ret |
1216 | ||
f24b3c79 L |
1217 | op_da_sub: ;else (sub-op) |
1218 | rcall do_op_inv ; TODO: ! | |
1219 | ret ;endif | |
f1deeee3 | 1220 | #endif |
f24b3c79 | 1221 | |
9c15f366 L |
1222 | |
1223 | ;---------------------------------------------------------------- | |
1224 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1225 | ;---------------------------------------------------------------- | |
1226 | ;|SCF |--0-01|Set Carry Flag |CY=1 | | |
1227 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1228 | ; | |
1229 | ; | |
1230 | do_op_scf: | |
f24b3c79 | 1231 | do_z80_flags_clear_HN |
9c15f366 L |
1232 | ori z_flags,(1<<ZFL_C) |
1233 | ret | |
1234 | ||
1235 | ;---------------------------------------------------------------- | |
1236 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1237 | ;---------------------------------------------------------------- | |
f24b3c79 | 1238 | ;|CCF |--?-0*|Complement Carry Flag|CY=~CY, HC=previous CY| |
9c15f366 | 1239 | ;|----------|SZHP C|---------- 8080 ----------------------------| |
f24b3c79 | 1240 | ;|CCF |---- 1|Set Carry Flag |CY=1 | |
9c15f366 | 1241 | ; |
9c15f366 L |
1242 | do_op_ccf: |
1243 | do_z80_flags_clear_N | |
f24b3c79 | 1244 | do_z80_flags_copy_HC |
9c15f366 L |
1245 | ldi temp,(1<<ZFL_C) |
1246 | eor z_flags,temp | |
1247 | ret | |
1248 | ||
1249 | ;---------------------------------------------------------------- | |
1250 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1251 | ;---------------------------------------------------------------- | |
1252 | ;|CPL |--1-1-|Complement |A=~A | | |
1253 | ;|----------|SZHP C|---------- 8080 ----------------------------| | |
1254 | ;|CPL |---- -|Complement |A=~A | | |
1255 | ; | |
1256 | ; | |
1257 | do_op_cpl: | |
1258 | com z_a | |
1259 | do_z80_flags_set_HN | |
1260 | ret | |
1261 | ||
1262 | ||
1263 | ;---------------------------------------------------------------- | |
1264 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1265 | ;---------------------------------------------------------------- | |
1266 | ;|PUSH xx |------|Push |-[SP]=xx | | |
1267 | ;|PUSH qq |------|Push |-[SP]=qq | | |
1268 | ; | |
1269 | ; | |
1270 | do_op_push16: | |
1271 | movw xl,z_spl | |
1272 | sbiw x,1 | |
1273 | mem_write_s oph | |
1274 | sbiw x,1 | |
1275 | mem_write_s opl | |
1276 | movw z_spl,xl | |
1277 | ||
1278 | .if STACK_DBG | |
1279 | printnewline | |
1280 | printstring "Stack push " | |
1281 | movw temp,opl | |
1282 | rcall printhexw | |
1283 | printstring ", SP is now " | |
1284 | movw temp,z_spl | |
1285 | rcall printhexw | |
1286 | printstring ". " | |
1287 | .endif | |
1288 | ||
1289 | ret | |
1290 | ||
1291 | ;---------------------------------------------------------------- | |
1292 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1293 | ;---------------------------------------------------------------- | |
1294 | ;|POP xx |------|Pop |xx=[SP]+ | | |
1295 | ;|POP qq |------|Pop |qq=[SP]+ | | |
1296 | ; | |
1297 | ; | |
1298 | do_op_pop16: | |
1299 | movw x,z_spl | |
1300 | mem_read_d opl | |
1301 | adiw x,1 | |
1302 | mem_read_d oph | |
1303 | adiw x,1 | |
1304 | movw z_spl,x | |
1305 | ||
1306 | .if STACK_DBG | |
1307 | printnewline | |
1308 | printstring "Stack pop " | |
1309 | movw temp,opl | |
1310 | rcall printhexw | |
1311 | printstring ", SP is now " | |
1312 | movw temp,z_spl | |
1313 | rcall printhexw | |
1314 | printstring ". " | |
1315 | .endif | |
1316 | ret | |
1317 | ||
1318 | ;---------------------------------------------------------------- | |
1319 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1320 | ;---------------------------------------------------------------- | |
1321 | ;|EX [SP],HL|------|Exchange |[SP]<->HL | | |
1322 | ;|EX DE,HL |------|Exchange |DE<->HL | | |
1323 | ;-----------------------------Z80-------------------------------- | |
1324 | ; | |
1325 | do_op_exhl: | |
1326 | lds temp,z_l | |
1327 | lds temp2,z_h | |
1328 | sts z_l,opl | |
1329 | sts z_h,oph | |
1330 | movw opl,temp | |
1331 | ret | |
1332 | ||
1333 | ;---------------------------------------------------------------- | |
1334 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1335 | ;---------------------------------------------------------------- | |
1336 | ; | |
1337 | ; TODO: Implement IFF1, IFF2 | |
1338 | do_op_di: | |
1339 | ret | |
1340 | ||
1341 | ;---------------------------------------------------------------- | |
1342 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1343 | ;---------------------------------------------------------------- | |
1344 | ; | |
1345 | ; TODO: Implement IFF1, IFF2 | |
1346 | do_op_ei: | |
1347 | ret | |
1348 | ||
1349 | ;---------------------------------------------------------------- | |
1350 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1351 | ;---------------------------------------------------------------- | |
1352 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1353 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1354 | ;|RET cc |------|Conditional Return |If cc RET | | |
1355 | ; | |
1356 | ; | |
1357 | do_op_ifnz: | |
1358 | sbrs z_flags, ZFL_Z | |
1359 | ret | |
1360 | pop temp ; nix tun | |
1361 | pop temp ; direkt zuruech zu main | |
1362 | ret | |
1363 | ||
1364 | ;---------------------------------------------------------------- | |
1365 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1366 | ;---------------------------------------------------------------- | |
1367 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1368 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1369 | ;|RET cc |------|Conditional Return |If cc RET | | |
1370 | ; | |
1371 | ; | |
1372 | do_op_ifz: | |
1373 | sbrc z_flags, ZFL_Z | |
1374 | ret | |
1375 | pop temp ; nix tun | |
1376 | pop temp ; direkt zuruech zu main | |
1377 | ret | |
1378 | ||
1379 | ;---------------------------------------------------------------- | |
1380 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1381 | ;---------------------------------------------------------------- | |
1382 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1383 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1384 | ;|RET cc |------|Conditional Return |If cc RET | | |
1385 | ; | |
1386 | ; | |
1387 | do_op_ifnc: | |
1388 | sbrs z_flags, ZFL_C | |
1389 | ret | |
1390 | pop temp ; nix tun | |
1391 | pop temp ; direkt zuruech zu main | |
1392 | ret | |
1393 | ||
1394 | ;---------------------------------------------------------------- | |
1395 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1396 | ;---------------------------------------------------------------- | |
1397 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1398 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1399 | ;|RET cc |------|Conditional Return |If cc RET | | |
1400 | ; | |
1401 | ; | |
1402 | do_op_ifc: | |
1403 | sbrc z_flags, ZFL_C | |
1404 | ret | |
1405 | pop temp ; nix tun | |
1406 | pop temp ; direkt zuruech zu main | |
1407 | ret | |
1408 | ||
1409 | ;---------------------------------------------------------------- | |
1410 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1411 | ;---------------------------------------------------------------- | |
1412 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1413 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1414 | ;|RET cc |------|Conditional Return |If cc RET | | |
1415 | ; | |
1416 | ; | |
1417 | do_op_ifpo: | |
1418 | sbrs z_flags, ZFL_P | |
1419 | ret | |
1420 | pop temp ; nix tun | |
1421 | pop temp ; direkt zuruech zu main | |
1422 | ret | |
1423 | ||
1424 | ;---------------------------------------------------------------- | |
1425 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1426 | ;---------------------------------------------------------------- | |
1427 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1428 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1429 | ;|RET cc |------|Conditional Return |If cc RET | | |
1430 | ; | |
1431 | ; | |
1432 | do_op_ifpe: | |
1433 | sbrc z_flags, ZFL_P | |
1434 | ret | |
1435 | pop temp ; nix tun | |
1436 | pop temp ; direkt zuruech zu main | |
1437 | ret | |
1438 | ||
1439 | ;---------------------------------------------------------------- | |
1440 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1441 | ;---------------------------------------------------------------- | |
1442 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1443 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1444 | ;|RET cc |------|Conditional Return |If cc RET | | |
1445 | ; | |
1446 | ; | |
1447 | do_op_ifp: ;sign positive, aka s=0 | |
1448 | sbrs z_flags, ZFL_S | |
1449 | ret | |
1450 | pop temp ; nix tun | |
1451 | pop temp ; direkt zuruech zu main | |
1452 | ret | |
1453 | ||
1454 | ;---------------------------------------------------------------- | |
1455 | ;|Mnemonic |SZHPNC|Description |Notes | | |
1456 | ;---------------------------------------------------------------- | |
1457 | ;|CALL cc,nn|------|Conditional Call |If cc CALL | | |
1458 | ;|JP cc,nn |------|Conditional Jump |If cc JP | | |
1459 | ;|RET cc |------|Conditional Return |If cc RET | | |
1460 | ; | |
1461 | ; | |
1462 | do_op_ifm: ;sign negative, aka s=1 | |
1463 | sbrc z_flags, ZFL_S | |
1464 | ret | |
1465 | pop temp ; nix tun | |
1466 | pop temp ; direkt zuruech zu main | |
1467 | ret | |
1468 | ||
1469 | ||
1470 | ; ----------------------- Opcode decoding ------------------------- | |
1471 | ||
1472 | ; Lookup table for Z80 opcodes. Translates the first byte of the instruction word into three | |
1473 | ; operations: fetch, do something, store. | |
1474 | ; The table is made of 256 words. | |
1475 | ||
1476 | ;.org (PC+255) & 0xff00 | |
1477 | todo_table: | |
f24b3c79 L |
1478 | instr do_fetch_nop, op_nop, do_store_nop ;00 ;NOP |
1479 | instr do_fetch_DIR16, op_nop, do_store_BC ;01 nn nn ;LD BC,nn | |
1480 | instr do_fetch_nop, op_nop, do_store_MBC ;02 ;LD (BC),A | |
1481 | instr do_fetch_BC, op_INC16, do_store_BC ;03 ;INC BC | |
1482 | instr do_fetch_B, op_INC, do_store_B ;04 ;INC B | |
1483 | instr do_fetch_B, op_DEC, do_store_B ;05 ;DEC B | |
1484 | instr do_fetch_DIR8, op_nop, do_store_B ;06 ;LD B,n | |
1485 | instr do_fetch_nop, op_RLCA, do_store_nop ;07 ;RLCA | |
1486 | instr do_fetch_nop, op_INV, do_store_nop ;08 ;EX AF,AF' | |
1487 | instr do_fetch_BC, op_ADDHL, do_store_HL ;09 ;ADD HL,BC | |
1488 | instr do_fetch_MBC, op_nop, do_store_nop ;0A ;LD A,(BC) | |
1489 | instr do_fetch_BC, op_DEC16, do_store_BC ;0B ;DEC BC | |
1490 | instr do_fetch_C, op_INC, do_store_C ;0C ;INC C | |
1491 | instr do_fetch_C, op_DEC, do_store_C ;0D ;DEC C | |
1492 | instr do_fetch_DIR8, op_nop, do_store_C ;0E nn ;LD C,n | |
1493 | instr do_fetch_nop, op_RRCA, do_store_nop ;0F ;RRCA | |
1494 | instr do_fetch_nop, op_INV, do_store_nop ;10 oo ;DJNZ o | |
1495 | instr do_fetch_DIR16, op_nop, do_store_DE ;11 nn nn ;LD DE,nn | |
1496 | instr do_fetch_nop, op_nop, do_store_MDE ;12 ;LD (DE),A | |
1497 | instr do_fetch_DE, op_INC16, do_store_DE ;13 ;INC DE | |
1498 | instr do_fetch_D, op_INC, do_store_D ;14 ;INC D | |
1499 | instr do_fetch_D, op_DEC, do_store_D ;15 ;DEC D | |
1500 | instr do_fetch_DIR8, op_nop, do_store_D ;16 nn ;LD D,n | |
1501 | instr do_fetch_nop, op_RLA, do_store_nop ;17 ;RLA | |
1502 | instr do_fetch_nop, op_INV, do_store_nop ;18 oo ;JR o | |
1503 | instr do_fetch_DE, op_ADDHL, do_store_HL ;19 ;ADD HL,DE | |
1504 | instr do_fetch_MDE, op_nop, do_store_nop ;1A ;LD A,(DE) | |
1505 | instr do_fetch_DE, op_DEC16, do_store_DE ;1B ;DEC DE | |
1506 | instr do_fetch_E, op_INC, do_store_E ;1C ;INC E | |
1507 | instr do_fetch_E, op_DEC, do_store_E ;1D ;DEC E | |
1508 | instr do_fetch_DIR8, op_nop, do_store_E ;1E nn ;LD E,n | |
1509 | instr do_fetch_nop, op_RRA, do_store_nop ;1F ;RRA | |
1510 | instr do_fetch_nop, op_INV, do_store_nop ;20 oo ;JR NZ,o | |
1511 | instr do_fetch_DIR16, op_nop, do_store_HL ;21 nn nn ;LD HL,nn | |
1512 | instr do_fetch_DIR16, op_STHL, do_store_nop ;22 nn nn ;LD (nn),HL | |
1513 | instr do_fetch_HL, op_INC16, do_store_HL ;23 ;INC HL | |
1514 | instr do_fetch_H, op_INC, do_store_H ;24 ;INC H | |
1515 | instr do_fetch_H, op_DEC, do_store_H ;25 ;DEC H | |
1516 | instr do_fetch_DIR8, op_nop, do_store_H ;26 nn ;LD H,n | |
1517 | instr do_fetch_A, op_DA, do_store_A ;27 ;DAA | |
1518 | instr do_fetch_nop, op_INV, do_store_nop ;28 oo ;JR Z,o | |
1519 | instr do_fetch_HL, op_ADDHL, do_store_HL ;29 ;ADD HL,HL | |
1520 | instr do_fetch_DIR16, op_RMEM16, do_store_HL ;2A nn nn ;LD HL,(nn) | |
1521 | instr do_fetch_HL, op_DEC16, do_store_HL ;2B ;DEC HL | |
1522 | instr do_fetch_L, op_INC, do_store_L ;2C ;INC L | |
1523 | instr do_fetch_L, op_DEC, do_store_L ;2D ;DEC L | |
1524 | instr do_fetch_DIR8, op_nop, do_store_L ;2E nn ;LD L,n | |
1525 | instr do_fetch_nop, op_CPL, do_store_nop ;2F ;CPL | |
1526 | instr do_fetch_nop, op_INV, do_store_nop ;30 oo ;JR NC,o | |
1527 | instr do_fetch_DIR16, op_nop, do_store_SP ;31 nn nn ;LD SP,nn | |
1528 | instr do_fetch_DIR16, op_nop, do_store_AM ;32 nn nn ;LD (nn),A | |
1529 | instr do_fetch_SP, op_INC16, do_store_SP ;33 ;INC SP | |
1530 | instr do_fetch_MHL, op_INC, do_store_MHL ;34 ;INC (HL) | |
1531 | instr do_fetch_MHL, op_DEC, do_store_MHL ;35 ;DEC (HL) | |
1532 | instr do_fetch_DIR8, op_nop, do_store_MHL ;36 nn ;LD (HL),n | |
1533 | instr do_fetch_nop, op_SCF, do_store_nop ;37 ;SCF | |
1534 | instr do_fetch_nop, op_INV, do_store_nop ;38 oo ;JR C,o | |
1535 | instr do_fetch_SP, op_ADDHL, do_store_HL ;39 ;ADD HL,SP | |
1536 | instr do_fetch_DIR16, op_RMEM8, do_store_A ;3A nn nn ;LD A,(nn) | |
1537 | instr do_fetch_SP, op_DEC16, do_store_SP ;3B ;DEC SP | |
1538 | instr do_fetch_nop, op_INCA, do_store_nop ;3C ;INC A | |
1539 | instr do_fetch_nop, op_DECA, do_store_nop ;3D ;DEC A | |
1540 | instr do_fetch_DIR8, op_nop, do_store_A ;3E nn ;LD A,n | |
1541 | instr do_fetch_nop, op_CCF, do_store_nop ;3F ;CCF (Complement Carry Flag, gvd) | |
1542 | instr do_fetch_nop, op_nop, do_store_nop ;40 ;LD B,B | |
1543 | instr do_fetch_C, op_nop, do_store_B ;41 ;LD B,C | |
1544 | instr do_fetch_D, op_nop, do_store_B ;42 ;LD B,D | |
1545 | instr do_fetch_E, op_nop, do_store_B ;43 ;LD B,E | |
1546 | instr do_fetch_H, op_nop, do_store_B ;44 ;LD B,H | |
1547 | instr do_fetch_L, op_nop, do_store_B ;45 ;LD B,L | |
1548 | instr do_fetch_MHL, op_nop, do_store_B ;46 ;LD B,(HL) | |
1549 | instr do_fetch_A, op_nop, do_store_B ;47 ;LD B,A | |
1550 | instr do_fetch_B, op_nop, do_store_C ;48 ;LD C,B | |
1551 | instr do_fetch_nop, op_nop, do_store_nop ;49 ;LD C,C | |
1552 | instr do_fetch_D, op_nop, do_store_C ;4A ;LD C,D | |
1553 | instr do_fetch_E, op_nop, do_store_C ;4B ;LD C,E | |
1554 | instr do_fetch_H, op_nop, do_store_C ;4C ;LD C,H | |
1555 | instr do_fetch_L, op_nop, do_store_C ;4D ;LD C,L | |
1556 | instr do_fetch_MHL, op_nop, do_store_C ;4E ;LD C,(HL) | |
1557 | instr do_fetch_A, op_nop, do_store_C ;4F ;LD C,A | |
1558 | instr do_fetch_B, op_nop, do_store_D ;50 ;LD D,B | |
1559 | instr do_fetch_C, op_nop, do_store_D ;51 ;LD D,C | |
1560 | instr do_fetch_nop, op_nop, do_store_nop ;52 ;LD D,D | |
1561 | instr do_fetch_E, op_nop, do_store_D ;53 ;LD D,E | |
1562 | instr do_fetch_H, op_nop, do_store_D ;54 ;LD D,H | |
1563 | instr do_fetch_L, op_nop, do_store_D ;55 ;LD D,L | |
1564 | instr do_fetch_MHL, op_nop, do_store_D ;56 ;LD D,(HL) | |
1565 | instr do_fetch_A, op_nop, do_store_D ;57 ;LD D,A | |
1566 | instr do_fetch_B, op_nop, do_store_E ;58 ;LD E,B | |
1567 | instr do_fetch_C, op_nop, do_store_E ;59 ;LD E,C | |
1568 | instr do_fetch_D, op_nop, do_store_E ;5A ;LD E,D | |
1569 | instr do_fetch_nop, op_nop, do_store_nop ;5B ;LD E,E | |
1570 | instr do_fetch_H, op_nop, do_store_E ;5C ;LD E,H | |
1571 | instr do_fetch_L, op_nop, do_store_E ;5D ;LD E,L | |
1572 | instr do_fetch_MHL, op_nop, do_store_E ;5E ;LD E,(HL) | |
1573 | instr do_fetch_A, op_nop, do_store_E ;5F ;LD E,A | |
1574 | instr do_fetch_B, op_nop, do_store_H ;60 ;LD H,B | |
1575 | instr do_fetch_C, op_nop, do_store_H ;61 ;LD H,C | |
1576 | instr do_fetch_D, op_nop, do_store_H ;62 ;LD H,D | |
1577 | instr do_fetch_E, op_nop, do_store_H ;63 ;LD H,E | |
1578 | instr do_fetch_nop, op_nop, do_store_nop ;64 ;LD H,H | |
1579 | instr do_fetch_L, op_nop, do_store_H ;65 ;LD H,L | |
1580 | instr do_fetch_MHL, op_nop, do_store_H ;66 ;LD H,(HL) | |
1581 | instr do_fetch_A, op_nop, do_store_H ;67 ;LD H,A | |
1582 | instr do_fetch_B, op_nop, do_store_L ;68 ;LD L,B | |
1583 | instr do_fetch_C, op_nop, do_store_L ;69 ;LD L,C | |
1584 | instr do_fetch_D, op_nop, do_store_L ;6A ;LD L,D | |
1585 | instr do_fetch_E, op_nop, do_store_L ;6B ;LD L,E | |
1586 | instr do_fetch_H, op_nop, do_store_L ;6C ;LD L,H | |
1587 | instr do_fetch_nop, op_nop, do_store_nop ;6D ;LD L,L | |
1588 | instr do_fetch_MHL, op_nop, do_store_L ;6E ;LD L,(HL) | |
1589 | instr do_fetch_A, op_nop, do_store_L ;6F ;LD L,A | |
1590 | instr do_fetch_B, op_nop, do_store_MHL ;70 ;LD (HL),B | |
1591 | instr do_fetch_C, op_nop, do_store_MHL ;71 ;LD (HL),C | |
1592 | instr do_fetch_D, op_nop, do_store_MHL ;72 ;LD (HL),D | |
1593 | instr do_fetch_E, op_nop, do_store_MHL ;73 ;LD (HL),E | |
1594 | instr do_fetch_H, op_nop, do_store_MHL ;74 ;LD (HL),H | |
1595 | instr do_fetch_L, op_nop, do_store_MHL ;75 ;LD (HL),L | |
1596 | instr do_fetch_nop, op_INV, do_store_nop ;76 ;HALT | |
1597 | instr do_fetch_A, op_nop, do_store_MHL ;77 ;LD (HL),A | |
1598 | instr do_fetch_B, op_nop, do_store_A ;78 ;LD A,B | |
1599 | instr do_fetch_C, op_nop, do_store_A ;79 ;LD A,C | |
1600 | instr do_fetch_D, op_nop, do_store_A ;7A ;LD A,D | |
1601 | instr do_fetch_E, op_nop, do_store_A ;7B ;LD A,E | |
1602 | instr do_fetch_H, op_nop, do_store_A ;7C ;LD A,H | |
1603 | instr do_fetch_L, op_nop, do_store_A ;7D ;LD A,L | |
1604 | instr do_fetch_MHL, op_nop, do_store_A ;7E ;LD A,(HL) | |
1605 | instr do_fetch_nop, op_nop, do_store_nop ;7F ;LD A,A | |
1606 | instr do_fetch_B, op_ADDA, do_store_nop ;80 ;ADD A,B | |
1607 | instr do_fetch_C, op_ADDA, do_store_nop ;81 ;ADD A,C | |
1608 | instr do_fetch_D, op_ADDA, do_store_nop ;82 ;ADD A,D | |
1609 | instr do_fetch_E, op_ADDA, do_store_nop ;83 ;ADD A,E | |
1610 | instr do_fetch_H, op_ADDA, do_store_nop ;84 ;ADD A,H | |
1611 | instr do_fetch_L, op_ADDA, do_store_nop ;85 ;ADD A,L | |
1612 | instr do_fetch_MHL, op_ADDA, do_store_nop ;86 ;ADD A,(HL) | |
1613 | instr do_fetch_A, op_ADDA, do_store_nop ;87 ;ADD A,A | |
1614 | instr do_fetch_B, op_ADCA, do_store_nop ;88 ;ADC A,B | |
1615 | instr do_fetch_C, op_ADCA, do_store_nop ;89 ;ADC A,C | |
1616 | instr do_fetch_D, op_ADCA, do_store_nop ;8A ;ADC A,D | |
1617 | instr do_fetch_E, op_ADCA, do_store_nop ;8B ;ADC A,E | |
1618 | instr do_fetch_H, op_ADCA, do_store_nop ;8C ;ADC A,H | |
1619 | instr do_fetch_L, op_ADCA, do_store_nop ;8D ;ADC A,L | |
1620 | instr do_fetch_MHL, op_ADCA, do_store_nop ;8E ;ADC A,(HL) | |
1621 | instr do_fetch_A, op_ADCA, do_store_nop ;8F ;ADC A,A | |
1622 | instr do_fetch_B, op_SUBFA, do_store_nop ;90 ;SUB A,B | |
1623 | instr do_fetch_C, op_SUBFA, do_store_nop ;91 ;SUB A,C | |
1624 | instr do_fetch_D, op_SUBFA, do_store_nop ;92 ;SUB A,D | |
1625 | instr do_fetch_E, op_SUBFA, do_store_nop ;93 ;SUB A,E | |
1626 | instr do_fetch_H, op_SUBFA, do_store_nop ;94 ;SUB A,H | |
1627 | instr do_fetch_L, op_SUBFA, do_store_nop ;95 ;SUB A,L | |
1628 | instr do_fetch_MHL, op_SUBFA, do_store_nop ;96 ;SUB A,(HL) | |
1629 | instr do_fetch_A, op_SUBFA, do_store_nop ;97 ;SUB A,A | |
1630 | instr do_fetch_B, op_SBCFA, do_store_nop ;98 ;SBC A,B | |
1631 | instr do_fetch_C, op_SBCFA, do_store_nop ;99 ;SBC A,C | |
1632 | instr do_fetch_D, op_SBCFA, do_store_nop ;9A ;SBC A,D | |
1633 | instr do_fetch_E, op_SBCFA, do_store_nop ;9B ;SBC A,E | |
1634 | instr do_fetch_H, op_SBCFA, do_store_nop ;9C ;SBC A,H | |
1635 | instr do_fetch_L, op_SBCFA, do_store_nop ;9D ;SBC A,L | |
1636 | instr do_fetch_MHL, op_SBCFA, do_store_nop ;9E ;SBC A,(HL) | |
1637 | instr do_fetch_A, op_SBCFA, do_store_nop ;9F ;SBC A,A | |
1638 | instr do_fetch_B, op_ANDA, do_store_nop ;A0 ;AND A,B | |
1639 | instr do_fetch_C, op_ANDA, do_store_nop ;A1 ;AND A,C | |
1640 | instr do_fetch_D, op_ANDA, do_store_nop ;A2 ;AND A,D | |
1641 | instr do_fetch_E, op_ANDA, do_store_nop ;A3 ;AND A,E | |
1642 | instr do_fetch_H, op_ANDA, do_store_nop ;A4 ;AND A,H | |
1643 | instr do_fetch_L, op_ANDA, do_store_nop ;A5 ;AND A,L | |
1644 | instr do_fetch_MHL, op_ANDA, do_store_nop ;A6 ;AND A,(HL) | |
1645 | instr do_fetch_A, op_ANDA, do_store_nop ;A7 ;AND A,A | |
1646 | instr do_fetch_B, op_XORA, do_store_nop ;A8 ;XOR A,B | |
1647 | instr do_fetch_C, op_XORA, do_store_nop ;A9 ;XOR A,C | |
1648 | instr do_fetch_D, op_XORA, do_store_nop ;AA ;XOR A,D | |
1649 | instr do_fetch_E, op_XORA, do_store_nop ;AB ;XOR A,E | |
1650 | instr do_fetch_H, op_XORA, do_store_nop ;AC ;XOR A,H | |
1651 | instr do_fetch_L, op_XORA, do_store_nop ;AD ;XOR A,L | |
1652 | instr do_fetch_MHL, op_XORA, do_store_nop ;AE ;XOR A,(HL) | |
1653 | instr do_fetch_A, op_XORA, do_store_nop ;AF ;XOR A,A | |
1654 | instr do_fetch_B, op_ORA, do_store_nop ;B0 ;OR A,B | |
1655 | instr do_fetch_C, op_ORA, do_store_nop ;B1 ;OR A,C | |
1656 | instr do_fetch_D, op_ORA, do_store_nop ;B2 ;OR A,D | |
1657 | instr do_fetch_E, op_ORA, do_store_nop ;B3 ;OR A,E | |
1658 | instr do_fetch_H, op_ORA, do_store_nop ;B4 ;OR A,H | |
1659 | instr do_fetch_L, op_ORA, do_store_nop ;B5 ;OR A,L | |
1660 | instr do_fetch_MHL, op_ORA, do_store_nop ;B6 ;OR A,(HL) | |
1661 | instr do_fetch_A, op_ORA, do_store_nop ;B7 ;OR A,A | |
1662 | instr do_fetch_B, op_CPFA, do_store_nop ;B8 ;CP A,B | |
1663 | instr do_fetch_C, op_CPFA, do_store_nop ;B9 ;CP A,C | |
1664 | instr do_fetch_D, op_CPFA, do_store_nop ;BA ;CP A,D | |
1665 | instr do_fetch_E, op_CPFA, do_store_nop ;BB ;CP A,E | |
1666 | instr do_fetch_H, op_CPFA, do_store_nop ;BC ;CP A,H | |
1667 | instr do_fetch_L, op_CPFA, do_store_nop ;BD ;CP A,L | |
1668 | instr do_fetch_MHL, op_CPFA, do_store_nop ;BE ;CP A,(HL) | |
1669 | instr do_fetch_A, op_CPFA, do_store_nop ;BF ;CP A,A | |
1670 | instr do_fetch_nop, op_IFNZ, do_store_RET ;C0 ;RET NZ | |
1671 | instr do_fetch_nop, op_POP16, do_store_BC ;C1 ;POP BC | |
1672 | instr do_fetch_DIR16, op_IFNZ, do_store_PC ;C2 nn nn ;JP NZ,nn | |
1673 | instr do_fetch_DIR16, op_nop, do_store_PC ;C3 nn nn ;JP nn | |
1674 | instr do_fetch_DIR16, op_IFNZ, do_store_CALL ;C4 nn nn ;CALL NZ,nn | |
1675 | instr do_fetch_BC, op_PUSH16, do_store_nop ;C5 ;PUSH BC | |
1676 | instr do_fetch_DIR8, op_ADDA, do_store_nop ;C6 nn ;ADD A,n | |
1677 | instr do_fetch_RST, op_nop, do_store_CALL ;C7 ;RST 0 | |
1678 | instr do_fetch_nop, op_IFZ, do_store_RET ;C8 ;RET Z | |
1679 | instr do_fetch_nop, op_nop, do_store_RET ;C9 ;RET | |
1680 | instr do_fetch_DIR16, op_IFZ, do_store_PC ;CA nn nn ;JP Z,nn | |
1681 | instr do_fetch_nop, op_INV, do_store_nop ;CB ;(Z80 specific) | |
1682 | instr do_fetch_DIR16, op_IFZ, do_store_CALL ;CC nn nn ;CALL Z,nn | |
1683 | instr do_fetch_DIR16, op_nop, do_store_CALL ;CD nn nn ;CALL nn | |
1684 | instr do_fetch_DIR8, op_ADCA, do_store_nop ;CE nn ;ADC A,n | |
1685 | instr do_fetch_RST, op_nop, do_store_CALL ;CF ;RST 8H | |
1686 | instr do_fetch_nop, op_IFNC, do_store_RET ;D0 ;RET NC | |
1687 | instr do_fetch_nop, op_POP16, do_store_DE ;D1 ;POP DE | |
1688 | instr do_fetch_DIR16, op_IFNC, do_store_PC ;D2 nn nn ;JP NC,nn | |
1689 | instr do_fetch_DIR8, op_OUTA, do_store_nop ;D3 nn ;OUT (n),A | |
1690 | instr do_fetch_DIR16, op_IFNC, do_store_CALL ;D4 nn nn ;CALL NC,nn | |
1691 | instr do_fetch_DE, op_PUSH16, do_store_nop ;D5 ;PUSH DE | |
1692 | instr do_fetch_DIR8, op_SUBFA, do_store_nop ;D6 nn ;SUB n | |
1693 | instr do_fetch_RST, op_nop, do_store_CALL ;D7 ;RST 10H | |
1694 | instr do_fetch_nop, op_IFC, do_store_RET ;D8 ;RET C | |
1695 | instr do_fetch_nop, op_nop, do_store_nop ;D9 ;EXX | |
1696 | instr do_fetch_DIR16, op_IFC, do_store_PC ;DA nn nn ;JP C,nn | |
1697 | instr do_fetch_DIR8, op_IN, do_store_A ;DB nn ;IN A,(n) | |
1698 | instr do_fetch_DIR16, op_IFC, do_store_CALL ;DC nn nn ;CALL C,nn | |
1699 | instr do_fetch_nop, op_INV, do_store_nop ;DD ;(Z80 specific) | |
1700 | instr do_fetch_DIR8, op_SBCFA, do_store_nop ;DE nn ;SBC A,n | |
1701 | instr do_fetch_RST, op_nop, do_store_CALL ;DF ;RST 18H | |
1702 | instr do_fetch_nop, op_IFPO, do_store_RET ;E0 ;RET PO | |
1703 | instr do_fetch_nop, op_POP16, do_store_HL ;E1 ;POP HL | |
1704 | instr do_fetch_DIR16, op_IFPO, do_store_PC ;E2 nn nn ;JP PO,nn | |
1705 | instr do_fetch_MSP, op_EXHL, do_store_MSP ;E3 ;EX (SP),HL | |
1706 | instr do_fetch_DIR16, op_IFPO, do_store_CALL ;E4 nn nn ;CALL PO,nn | |
1707 | instr do_fetch_HL, op_PUSH16, do_store_nop ;E5 ;PUSH HL | |
1708 | instr do_fetch_DIR8, op_ANDA, do_store_nop ;E6 nn ;AND n | |
1709 | instr do_fetch_RST, op_nop, do_store_CALL ;E7 ;RST 20H | |
1710 | instr do_fetch_nop, op_IFPE, do_store_RET ;E8 ;RET PE | |
1711 | instr do_fetch_HL, op_nop, do_store_PC ;E9 ;JP HL | |
1712 | instr do_fetch_DIR16, op_IFPE, do_store_PC ;EA nn nn ;JP PE,nn | |
1713 | instr do_fetch_DE, op_EXHL, do_store_DE ;EB ;EX DE,HL | |
1714 | instr do_fetch_DIR16, op_IFPE, do_store_CALL ;EC nn nn ;CALL PE,nn | |
1715 | instr do_fetch_nop, op_INV, do_store_nop ;ED ;(Z80 specific) | |
1716 | instr do_fetch_DIR8, op_XORA, do_store_nop ;EE nn ;XOR n | |
1717 | instr do_fetch_RST, op_nop, do_store_CALL ;EF ;RST 28H | |
1718 | instr do_fetch_nop, op_IFP, do_store_RET ;F0 ;RET P | |
1719 | instr do_fetch_nop, op_POP16, do_store_AF ;F1 ;POP AF | |
1720 | instr do_fetch_DIR16, op_IFP, do_store_PC ;F2 nn nn ;JP P,nn | |
1721 | instr do_fetch_nop, op_DI, do_store_nop ;F3 ;DI | |
1722 | instr do_fetch_DIR16, op_IFP, do_store_CALL ;F4 nn nn ;CALL P,nn | |
1723 | instr do_fetch_AF, op_PUSH16, do_store_nop ;F5 ;PUSH AF | |
1724 | instr do_fetch_DIR8, op_ORA, do_store_nop ;F6 nn ;OR n | |
1725 | instr do_fetch_RST, op_nop, do_store_CALL ;F7 ;RST 30H | |
1726 | instr do_fetch_nop, op_IFM, do_store_RET ;F8 ;RET M | |
1727 | instr do_fetch_HL, op_nop, do_store_SP ;F9 ;LD SP,HL | |
1728 | instr do_fetch_DIR16, op_IFM, do_store_PC ;FA nn nn ;JP M,nn | |
1729 | instr do_fetch_nop, op_EI, do_store_nop ;FB ;EI | |
1730 | instr do_fetch_DIR16, op_IFM, do_store_CALL ;FC nn nn ;CALL M,nn | |
1731 | instr do_fetch_nop, op_INV, do_store_nop ;FD ;(Z80 specific) | |
1732 | instr do_fetch_DIR8, op_CPFA, do_store_nop ;FE nn ;CP n | |
1733 | instr do_fetch_RST, op_nop, do_store_CALL ;FF ;RST 38H | |
1734 | ||
9c15f366 L |
1735 | |
1736 | ;---------------------------------------------------------------- | |
1737 | ; Lookup table, stolen from z80ex, Z80 emulation library. | |
1738 | ; http://z80ex.sourceforge.net/ | |
1739 | ||
1740 | ; The S, Z, 5 and 3 bits and the parity of the lookup value | |
1741 | ||
1742 | .org (PC+255) & 0xff00 | |
1743 | sz53p_tab: | |
1744 | .db 0x44,0x00,0x00,0x04,0x00,0x04,0x04,0x00 | |
1745 | .db 0x08,0x0c,0x0c,0x08,0x0c,0x08,0x08,0x0c | |
1746 | .db 0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04 | |
1747 | .db 0x0c,0x08,0x08,0x0c,0x08,0x0c,0x0c,0x08 | |
1748 | .db 0x20,0x24,0x24,0x20,0x24,0x20,0x20,0x24 | |
1749 | .db 0x2c,0x28,0x28,0x2c,0x28,0x2c,0x2c,0x28 | |
1750 | .db 0x24,0x20,0x20,0x24,0x20,0x24,0x24,0x20 | |
1751 | .db 0x28,0x2c,0x2c,0x28,0x2c,0x28,0x28,0x2c | |
1752 | .db 0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04 | |
1753 | .db 0x0c,0x08,0x08,0x0c,0x08,0x0c,0x0c,0x08 | |
1754 | .db 0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00 | |
1755 | .db 0x08,0x0c,0x0c,0x08,0x0c,0x08,0x08,0x0c | |
1756 | .db 0x24,0x20,0x20,0x24,0x20,0x24,0x24,0x20 | |
1757 | .db 0x28,0x2c,0x2c,0x28,0x2c,0x28,0x28,0x2c | |
1758 | .db 0x20,0x24,0x24,0x20,0x24,0x20,0x20,0x24 | |
1759 | .db 0x2c,0x28,0x28,0x2c,0x28,0x2c,0x2c,0x28 | |
1760 | .db 0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84 | |
1761 | .db 0x8c,0x88,0x88,0x8c,0x88,0x8c,0x8c,0x88 | |
1762 | .db 0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80 | |
1763 | .db 0x88,0x8c,0x8c,0x88,0x8c,0x88,0x88,0x8c | |
1764 | .db 0xa4,0xa0,0xa0,0xa4,0xa0,0xa4,0xa4,0xa0 | |
1765 | .db 0xa8,0xac,0xac,0xa8,0xac,0xa8,0xa8,0xac | |
1766 | .db 0xa0,0xa4,0xa4,0xa0,0xa4,0xa0,0xa0,0xa4 | |
1767 | .db 0xac,0xa8,0xa8,0xac,0xa8,0xac,0xac,0xa8 | |
1768 | .db 0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80 | |
1769 | .db 0x88,0x8c,0x8c,0x88,0x8c,0x88,0x88,0x8c | |
1770 | .db 0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84 | |
1771 | .db 0x8c,0x88,0x88,0x8c,0x88,0x8c,0x8c,0x88 | |
1772 | .db 0xa0,0xa4,0xa4,0xa0,0xa4,0xa0,0xa0,0xa4 | |
1773 | .db 0xac,0xa8,0xa8,0xac,0xa8,0xac,0xac,0xa8 | |
1774 | .db 0xa4,0xa0,0xa0,0xa4,0xa0,0xa4,0xa4,0xa0 | |
1775 | .db 0xa8,0xac,0xac,0xa8,0xac,0xa8,0xa8,0xac | |
1776 | ||
1777 | ; vim:set ts=8 noet nowrap | |
1778 |