ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/mon/src/mon_z80.cpp
(Generate patch)

Comparing mon/src/mon_z80.cpp (file contents):
Revision 1.5 by cebix, 2003-09-27T20:33:06Z vs.
Revision 1.7 by cebix, 2007-01-14T14:01:09Z

# Line 1 | Line 1
1   /*
2   *  mon_z80.cpp - Z80 disassembler
3   *
4 < *  cxmon (C) 1997-2003 Christian Bauer, Marc Hellwig
4 > *  cxmon (C) 1997-2007 Christian Bauer, Marc Hellwig
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 208 | Line 208 | static void operand(SFILE *f, char mode,
208                          break;
209  
210                  case A_REL:
211 <                        mon_sprintf(f, "$%04x", (adr + 2 + (int8)mon_read_byte(adr)) & 0xffff); adr++;
211 >                        mon_sprintf(f, "$%04x", (adr + 1 + (int8)mon_read_byte(adr)) & 0xffff); adr++;
212                          break;
213  
214                  case A_A:
# Line 229 | Line 229 | static void operand(SFILE *f, char mode,
229                          if (reg == 6) {
230                                  if (ix || iy) {
231                                          mon_sprintf(f, "(%s+$%02x)", ix ? "ix" : "iy", mon_read_byte(adr)); adr++;
232 <                                } else
232 >                                } else {
233                                          mon_sprintf(f, "(hl)");
234 <                        } else if (mode == A_REG1)
234 >                                }
235 >                        } else if (mode == A_REG1) {
236                                  mon_sprintf(f, "%s", ix ? reg_name_ix[reg] : (iy ? reg_name_iy[reg] : reg_name[reg]));
237 <                        else
237 >                        } else {
238                                  mon_sprintf(f, "%s", reg_name[reg]);
239 +                        }
240                          break;
241                  }
242  
# Line 244 | Line 246 | static void operand(SFILE *f, char mode,
246                          if (reg == 6) {
247                                  if (ix || iy) {
248                                          mon_sprintf(f, "(%s+$%02x)", ix ? "ix" : "iy", mon_read_byte(adr)); adr++;
249 <                                } else
249 >                                } else {
250                                          mon_sprintf(f, "(hl)");
251 <                        } else if (mode == A_REG2)
251 >                                }
252 >                        } else if (mode == A_REG2) {
253                                  mon_sprintf(f, "%s", ix ? reg_name_ix[reg] : (iy ? reg_name_iy[reg] : reg_name[reg]));
254 <                        else
254 >                        } else {
255                                  mon_sprintf(f, "%s", reg_name[reg]);
256 +                        }
257                          break;
258                  }
259  
260 <                case A_REG3:
261 <                        mon_sprintf(f, reg_name_16[(op >> 4) & 3]);
260 >                case A_REG3: {
261 >                        int reg = (op >> 4) & 3;
262 >                        if (reg == 2 && (ix || iy)) {
263 >                                mon_sprintf(f, ix ? "ix" : "iy");
264 >                        } else {
265 >                                mon_sprintf(f, reg_name_16[reg]);
266 >                        }
267                          break;
268 +                }
269  
270 <                case A_REG4:
271 <                        mon_sprintf(f, reg_name_16_2[(op >> 4) & 3]);
270 >                case A_REG4: {
271 >                        int reg = (op >> 4) & 3;
272 >                        if (reg == 2 && (ix || iy)) {
273 >                                mon_sprintf(f, ix ? "ix" : "iy");
274 >                        } else {
275 >                                mon_sprintf(f, reg_name_16_2[reg]);
276 >                        }
277                          break;
278 +                }
279  
280                  case A_COND:
281                          mon_sprintf(f, cond_name[(op >> 3) & 7]);
# Line 275 | Line 291 | static void operand(SFILE *f, char mode,
291  
292                  case A_BIT_REG1: { // undoc
293                          int reg = op & 7;
294 <                        if (reg == 6)
294 >                        if (reg == 6) {
295                                  mon_sprintf(f, "%d", (op >> 3) & 7);
296 <                        else
296 >                        } else {
297                                  mon_sprintf(f, "%d,%s", (op >> 3) & 7, reg_name[reg]);
298 +                        }
299                          break;
300                  }
301  
# Line 362 | Line 379 | static int disass_cb(SFILE *f, uint32 ad
379                                  case 3: mnem = M_RR; break;
380                                  case 4: mnem = M_SLA; break;
381                                  case 5: mnem = M_SRA; break;
382 <                                case 6: mnem = M_SL1; break;
382 >                                case 6: mnem = M_SL1; break; // undoc
383                                  case 7: mnem = M_SRL; break;
384                          }
385                          break;
# Line 415 | Line 432 | static int disass_ed(SFILE *f, uint32 ad
432                  case 0x60:
433                  case 0x68:
434                  case 0x78:
435 <                        mon_sprintf(f, "in  %s,(c)", reg_name[(op >> 3) & 7]);
435 >                        mon_sprintf(f, "in   %s,(c)", reg_name[(op >> 3) & 7]);
436                          return 1;
437                  case 0x70:
438 <                        mon_sprintf(f, "in  (c)");
438 >                        mon_sprintf(f, "in   (c)");
439                          return 1;
440  
441                  case 0x41:
# Line 428 | Line 445 | static int disass_ed(SFILE *f, uint32 ad
445                  case 0x61:
446                  case 0x69:
447                  case 0x79:
448 <                        mon_sprintf(f, "out (c),%s", reg_name[(op >> 3) & 7]);
448 >                        mon_sprintf(f, "out  (c),%s", reg_name[(op >> 3) & 7]);
449                          return 1;
450                  case 0x71:      // undoc
451 <                        mon_sprintf(f, "out (c),0");
451 >                        mon_sprintf(f, "out  (c),0");
452                          return 1;
453  
454                  case 0x42:
# Line 500 | Line 517 | static int disass_ed(SFILE *f, uint32 ad
517                          break;
518  
519                  case 0x47:
520 <                        mon_sprintf(f, "ld  i,a");
520 >                        mon_sprintf(f, "ld   i,a");
521                          return 1;
522                  case 0x4f:
523 <                        mon_sprintf(f, "ld  r,a");
523 >                        mon_sprintf(f, "ld   r,a");
524                          return 1;
525                  case 0x57:
526 <                        mon_sprintf(f, "ld  a,i");
526 >                        mon_sprintf(f, "ld   a,i");
527                          return 1;
528                  case 0x5f:
529 <                        mon_sprintf(f, "ld  a,r");
529 >                        mon_sprintf(f, "ld   a,r");
530                          return 1;
531  
532                  case 0x67: mnem = M_RRD; break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines