]> Shamusworld >> Repos - thunder/blobdiff - src/dis6809.cpp
Code cleanup.
[thunder] / src / dis6809.cpp
index d598e2cf7334763229b2684558eeffe36d2a9887..cfc6b519f4fa390f8b09964510389ad01a1af9cd 100644 (file)
@@ -1,9 +1,9 @@
 //
 // 6809 disassembler
 //
-// by James L. Hammons
+// by James Hammons
 //
-// (c) 2004 Underground Software
+// (c) 2004, 2014 Underground Software
 //
 
 #include "dis6809.h"
@@ -191,15 +191,15 @@ iregs[4][2] = {"X", "Y", "U", "S" };
 //
 // Display bytes in mem in hex
 //
-static void DisplayBytes(V6809REGS regs, uint16 src, uint32 dst)
+static void DisplayBytes(V6809REGS regs, uint16_t src, uint32_t dst)
 {
        WriteLog("%04X: ", src);
-       uint8 cnt = 0;                                                                          // Init counter...
+       uint8_t cnt = 0;                                                                                // Init counter...
 
        if (src > dst)
                dst += 0x10000;                                                                 // That should fix the FFFF bug...
 
-       for(uint32 i=src; i<dst; i++)
+       for(uint32_t i=src; i<dst; i++)
        {
                WriteLog("%02X ", regs.RdMem(i));
                cnt++;                                                                                  // Bump counter...
@@ -212,16 +212,16 @@ static void DisplayBytes(V6809REGS regs, uint16 src, uint32 dst)
 //
 // Decode a 6809 instruction at 'addr'
 //
-//int Decode6809(uint16 pc)
+//int Decode6809(uint16_t pc)
 int Decode6809(V6809REGS regs)
 {
        char outbuf[80], mnem[6], tmp[30];
-       uint8 opcode2, operand;
+       uint8_t opcode2, operand;
 
-       uint16 addr = regs.pc, offset;
+       uint16_t addr = regs.pc, offset;
 
-       uint8 opcode = regs.RdMem(addr++);                              // Get the opcode
-       uint8 admode = op_mat1[opcode];                                         // addressing mode
+       uint8_t opcode = regs.RdMem(addr++);                            // Get the opcode
+       uint8_t admode = op_mat1[opcode];                                               // addressing mode
        strcpy(mnem, mnemonics[opcode]);                                        // Copy page 1 opcode
 
        if (opcode == 0x10)                                                                     // Extended opcode?
@@ -253,14 +253,14 @@ int Decode6809(V6809REGS regs)
                break;
        case 3:                                                                                         // Relative
 //DISNOWOK--FIX
-//             sprintf(outbuf, "%s $%04X", mnem, ++addr + (int16)((int8)regs.RdMem(addr)));
-               offset = addr + 1 + (int16)(int8)regs.RdMem(addr);
+//             sprintf(outbuf, "%s $%04X", mnem, ++addr + (int16_t)((int8_t)regs.RdMem(addr)));
+               offset = addr + 1 + (int16_t)(int8_t)regs.RdMem(addr);
                addr++;
                sprintf(outbuf, "%s $%04X", mnem, offset);
                break;
        case 4:                                                                                         // Long Relative
-//             sprintf(outbuf, "%s $%04X", mnem, addr + (int16)((regs.RdMem(addr++) << 8) | regs.RdMem(addr++)) + 2);
-               offset = addr + (int16)((regs.RdMem(addr) << 8) | regs.RdMem(addr + 1)) + 2;
+//             sprintf(outbuf, "%s $%04X", mnem, addr + (int16_t)((regs.RdMem(addr++) << 8) | regs.RdMem(addr++)) + 2);
+               offset = addr + (int16_t)((regs.RdMem(addr) << 8) | regs.RdMem(addr + 1)) + 2;
                addr += 2;
                sprintf(outbuf, "%s $%04X", mnem, offset);
                break;
@@ -289,9 +289,9 @@ int Decode6809(V6809REGS regs)
        case 7:                                                                                         // Indexed (the tough one!)
        {
                operand = regs.RdMem(addr++);                           // Get IDX byte
-               uint8 reg = ((operand & 0x60) >> 5), idxind = ((operand & 0x10) >> 4),
+               uint8_t reg = ((operand & 0x60) >> 5), idxind = ((operand & 0x10) >> 4),
                        lo_nyb = (operand & 0x0F),  boff;
-               uint16 woff;
+               uint16_t woff;
 
                strcpy(tmp, "??");
                if (!(operand & 0x80))                                                  // Hi bit set? Then decode 4 bit offset