diff --git a/src/emucore/M6502.ins b/src/emucore/M6502.ins
index 5df6c0d4f..4274d4745 100644
--- a/src/emucore/M6502.ins
+++ b/src/emucore/M6502.ins
@@ -285,13 +285,13 @@ case 0x69:
 {
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -322,13 +322,13 @@ case 0x65:
 {
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -361,13 +361,13 @@ case 0x75:
 {
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -393,19 +393,19 @@ break;
 case 0x6d:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -430,9 +430,9 @@ break;
 
 case 0x7d:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + X);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + X);
   if((low + X) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -447,13 +447,13 @@ case 0x7d:
 {
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -478,9 +478,9 @@ break;
 
 case 0x79:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -495,13 +495,13 @@ case 0x79:
 {
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -530,19 +530,19 @@ case 0x61:
   peek(pointer, DISASM_NONE);
   pointer += X;
   intermediateAddress = peek(pointer++, DISASM_DATA);
-  intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -568,9 +568,9 @@ break;
 case 0x71:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -585,13 +585,13 @@ case 0x71:
 {
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -690,7 +690,7 @@ break;
 case 0x2d:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
@@ -702,9 +702,9 @@ break;
 
 case 0x3d:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + X);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + X);
   if((low + X) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -725,9 +725,9 @@ break;
 
 case 0x39:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -752,7 +752,7 @@ case 0x21:
   peek(pointer, DISASM_NONE);
   pointer += X;
   intermediateAddress = peek(pointer++, DISASM_DATA);
-  intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
@@ -765,9 +765,9 @@ break;
 case 0x31:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -825,7 +825,7 @@ case 0x6b:
   }
   else
   {
-    uInt8 value = A & operand;
+    const uInt8 value = A & operand;
 
     A = ((value >> 1) & 0x7f) | (C ? 0x80 : 0x00);
     N = C;
@@ -908,7 +908,7 @@ break;
 case 0x0e:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
@@ -926,9 +926,9 @@ break;
 
 case 0x1e:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -962,7 +962,7 @@ break;
 case 0x2C:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
@@ -982,7 +982,7 @@ case 0x90:
   if(!C)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -999,7 +999,7 @@ case 0xb0:
   if(C)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -1016,7 +1016,7 @@ case 0xf0:
   if(!notZ)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -1033,7 +1033,7 @@ case 0x30:
   if(N)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -1050,7 +1050,7 @@ case 0xD0:
   if(notZ)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -1067,7 +1067,7 @@ case 0x10:
   if(!N)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -1084,7 +1084,7 @@ case 0x50:
   if(!V)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -1101,7 +1101,7 @@ case 0x70:
   if(V)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -1124,7 +1124,7 @@ case 0x00:
   I = true;
 
   PC = peek(0xfffe, DISASM_DATA);
-  PC |= (uInt16(peek(0xffff, DISASM_DATA)) << 8);
+  PC |= (static_cast<uInt16>(peek(0xffff, DISASM_DATA)) << 8);
 }
 break;
 
@@ -1179,7 +1179,7 @@ case 0xc9:
   operand = peek(PC++, DISASM_CODE);
 }
 {
-  uInt16 value = uInt16(A) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(A) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1193,7 +1193,7 @@ case 0xc5:
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
-  uInt16 value = uInt16(A) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(A) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1209,7 +1209,7 @@ case 0xd5:
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
-  uInt16 value = uInt16(A) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(A) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1220,11 +1220,11 @@ break;
 case 0xcd:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
-  uInt16 value = uInt16(A) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(A) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1234,9 +1234,9 @@ break;
 
 case 0xdd:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + X);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + X);
   if((low + X) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -1249,7 +1249,7 @@ case 0xdd:
   }
 }
 {
-  uInt16 value = uInt16(A) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(A) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1259,9 +1259,9 @@ break;
 
 case 0xd9:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -1274,7 +1274,7 @@ case 0xd9:
   }
 }
 {
-  uInt16 value = uInt16(A) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(A) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1288,11 +1288,11 @@ case 0xc1:
   peek(pointer, DISASM_NONE);
   pointer += X;
   intermediateAddress = peek(pointer++, DISASM_DATA);
-  intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
-  uInt16 value = uInt16(A) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(A) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1303,9 +1303,9 @@ break;
 case 0xd1:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -1318,7 +1318,7 @@ case 0xd1:
   }
 }
 {
-  uInt16 value = uInt16(A) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(A) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1333,7 +1333,7 @@ case 0xe0:
   operand = peek(PC++, DISASM_CODE);
 }
 {
-  uInt16 value = uInt16(X) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(X) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1347,7 +1347,7 @@ case 0xe4:
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
-  uInt16 value = uInt16(X) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(X) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1358,11 +1358,11 @@ break;
 case 0xec:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
-  uInt16 value = uInt16(X) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(X) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1377,7 +1377,7 @@ case 0xc0:
   operand = peek(PC++, DISASM_CODE);
 }
 {
-  uInt16 value = uInt16(Y) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(Y) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1391,7 +1391,7 @@ case 0xc4:
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
-  uInt16 value = uInt16(Y) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(Y) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1402,11 +1402,11 @@ break;
 case 0xcc:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
-  uInt16 value = uInt16(Y) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(Y) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -1419,15 +1419,15 @@ break;
 case 0xcf:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
-  uInt16 value2 = uInt16(A) - uInt16(value);
+  const uInt16 value2 = static_cast<uInt16>(A) - static_cast<uInt16>(value);
   notZ = value2;
   N = value2 & 0x0080;
   C = !(value2 & 0x0100);
@@ -1436,18 +1436,18 @@ break;
 
 case 0xdf:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
-  uInt16 value2 = uInt16(A) - uInt16(value);
+  const uInt16 value2 = static_cast<uInt16>(A) - static_cast<uInt16>(value);
   notZ = value2;
   N = value2 & 0x0080;
   C = !(value2 & 0x0100);
@@ -1456,18 +1456,18 @@ break;
 
 case 0xdb:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
-  uInt16 value2 = uInt16(A) - uInt16(value);
+  const uInt16 value2 = static_cast<uInt16>(A) - static_cast<uInt16>(value);
   notZ = value2;
   N = value2 & 0x0080;
   C = !(value2 & 0x0100);
@@ -1481,10 +1481,10 @@ case 0xc7:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
-  uInt16 value2 = uInt16(A) - uInt16(value);
+  const uInt16 value2 = static_cast<uInt16>(A) - static_cast<uInt16>(value);
   notZ = value2;
   N = value2 & 0x0080;
   C = !(value2 & 0x0100);
@@ -1500,10 +1500,10 @@ case 0xd7:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
-  uInt16 value2 = uInt16(A) - uInt16(value);
+  const uInt16 value2 = static_cast<uInt16>(A) - static_cast<uInt16>(value);
   notZ = value2;
   N = value2 & 0x0080;
   C = !(value2 & 0x0100);
@@ -1516,15 +1516,15 @@ case 0xc3:
   peek(pointer, DISASM_NONE);
   pointer += X;
   operandAddress = peek(pointer++, DISASM_DATA);
-  operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
-  uInt16 value2 = uInt16(A) - uInt16(value);
+  const uInt16 value2 = static_cast<uInt16>(A) - static_cast<uInt16>(value);
   notZ = value2;
   N = value2 & 0x0080;
   C = !(value2 & 0x0100);
@@ -1534,18 +1534,18 @@ break;
 case 0xd3:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
-  uInt16 value2 = uInt16(A) - uInt16(value);
+  const uInt16 value2 = static_cast<uInt16>(A) - static_cast<uInt16>(value);
   notZ = value2;
   N = value2 & 0x0080;
   C = !(value2 & 0x0100);
@@ -1561,7 +1561,7 @@ case 0xc6:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
   notZ = value;
@@ -1578,7 +1578,7 @@ case 0xd6:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
   notZ = value;
@@ -1589,12 +1589,12 @@ break;
 case 0xce:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
   notZ = value;
@@ -1604,15 +1604,15 @@ break;
 
 case 0xde:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
   notZ = value;
@@ -1690,7 +1690,7 @@ break;
 case 0x4d:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
@@ -1702,9 +1702,9 @@ break;
 
 case 0x5d:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + X);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + X);
   if((low + X) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -1725,9 +1725,9 @@ break;
 
 case 0x59:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -1752,7 +1752,7 @@ case 0x41:
   peek(pointer, DISASM_NONE);
   pointer += X;
   intermediateAddress = peek(pointer++, DISASM_DATA);
-  intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
@@ -1765,9 +1765,9 @@ break;
 case 0x51:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -1795,7 +1795,7 @@ case 0xe6:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand + 1;
+  const uInt8 value = operand + 1;
   poke(operandAddress, value, DISASM_WRITE);
 
   notZ = value;
@@ -1812,7 +1812,7 @@ case 0xf6:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand + 1;
+  const uInt8 value = operand + 1;
   poke(operandAddress, value, DISASM_WRITE);
 
   notZ = value;
@@ -1823,12 +1823,12 @@ break;
 case 0xee:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand + 1;
+  const uInt8 value = operand + 1;
   poke(operandAddress, value, DISASM_WRITE);
 
   notZ = value;
@@ -1838,15 +1838,15 @@ break;
 
 case 0xfe:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = operand + 1;
+  const uInt8 value = operand + 1;
   poke(operandAddress, value, DISASM_WRITE);
 
   notZ = value;
@@ -1885,7 +1885,7 @@ break;
 case 0xef:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
@@ -1894,14 +1894,14 @@ case 0xef:
   poke(operandAddress, operand, DISASM_WRITE);
 
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -1923,9 +1923,9 @@ break;
 
 case 0xff:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -1935,14 +1935,14 @@ case 0xff:
   poke(operandAddress, operand, DISASM_WRITE);
 
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -1964,9 +1964,9 @@ break;
 
 case 0xfb:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -1976,14 +1976,14 @@ case 0xfb:
   poke(operandAddress, operand, DISASM_WRITE);
 
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -2014,14 +2014,14 @@ case 0xe7:
   poke(operandAddress, operand, DISASM_WRITE);
 
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -2054,14 +2054,14 @@ case 0xf7:
   poke(operandAddress, operand, DISASM_WRITE);
 
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -2087,7 +2087,7 @@ case 0xe3:
   peek(pointer, DISASM_NONE);
   pointer += X;
   operandAddress = peek(pointer++, DISASM_DATA);
-  operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
@@ -2096,14 +2096,14 @@ case 0xe3:
   poke(operandAddress, operand, DISASM_WRITE);
 
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -2126,9 +2126,9 @@ break;
 case 0xf3:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -2138,14 +2138,14 @@ case 0xf3:
   poke(operandAddress, operand, DISASM_WRITE);
 
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -2170,7 +2170,7 @@ break;
 case 0x4c:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
 }
 {
   PC = operandAddress;
@@ -2180,13 +2180,13 @@ break;
 case 0x6c:
 {
   uInt16 addr = peek(PC++, DISASM_CODE);
-  addr |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  addr |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
 
   // Simulate the error in the indirect addressing mode!
-  uInt16 high = NOTSAMEPAGE(addr, addr + 1) ? (addr & 0xff00) : (addr + 1);
+  const uInt16 high = NOTSAMEPAGE(addr, addr + 1) ? (addr & 0xff00) : (addr + 1);
 
   operandAddress = peek(addr, DISASM_DATA);
-  operandAddress |= (uInt16(peek(high, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(high, DISASM_DATA)) << 8);
 }
 {
   PC = operandAddress;
@@ -2197,7 +2197,7 @@ break;
 // JSR
 case 0x20:
 {
-  uInt8 low = peek(PC++, DISASM_CODE);
+  const uInt8 low = peek(PC++, DISASM_CODE);
   peek(0x0100 + SP, DISASM_NONE);
 
   // It seems that the 650x does not push the address of the next instruction
@@ -2206,7 +2206,7 @@ case 0x20:
   poke(0x0100 + SP--, PC >> 8, DISASM_WRITE);
   poke(0x0100 + SP--, PC & 0xff, DISASM_WRITE);
 
-  PC = (low | (uInt16(peek(PC, DISASM_CODE)) << 8));
+  PC = (low | (static_cast<uInt16>(peek(PC, DISASM_CODE)) << 8));
 }
 break;
 
@@ -2214,9 +2214,9 @@ break;
 // LAS
 case 0xbb:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -2241,7 +2241,7 @@ break;
 case 0xaf:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
@@ -2256,9 +2256,9 @@ break;
 
 case 0xbf:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -2318,7 +2318,7 @@ case 0xa3:
   peek(pointer, DISASM_NONE);
   pointer += X;
   intermediateAddress = peek(pointer++, DISASM_DATA);
-  intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
@@ -2334,9 +2334,9 @@ break;
 case 0xb3:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -2405,7 +2405,7 @@ break;
 case 0xad:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
@@ -2418,9 +2418,9 @@ break;
 
 case 0xbd:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + X);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + X);
   if((low + X) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -2442,9 +2442,9 @@ break;
 
 case 0xb9:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -2470,7 +2470,7 @@ case 0xa1:
   peek(pointer, DISASM_NONE);
   pointer += X;
   intermediateAddress = peek(pointer++, DISASM_DATA);
-  intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
@@ -2484,9 +2484,9 @@ break;
 case 0xb1:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -2553,7 +2553,7 @@ break;
 case 0xae:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 SET_LAST_PEEK(myLastSrcAddressX, intermediateAddress)
@@ -2566,9 +2566,9 @@ break;
 
 case 0xbe:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -2635,7 +2635,7 @@ break;
 case 0xac:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 SET_LAST_PEEK(myLastSrcAddressY, intermediateAddress)
@@ -2648,9 +2648,9 @@ break;
 
 case 0xbc:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + X);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + X);
   if((low + X) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -2730,7 +2730,7 @@ break;
 case 0x4e:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
@@ -2748,9 +2748,9 @@ break;
 
 case 0x5e:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -2841,7 +2841,7 @@ break;
 case 0x0c:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   peek(intermediateAddress, DISASM_DATA);
 }
 {
@@ -2855,9 +2855,9 @@ case 0x7c:
 case 0xdc:
 case 0xfc:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + X);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + X);
   if((low + X) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -2919,7 +2919,7 @@ break;
 case 0x0d:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
@@ -2932,9 +2932,9 @@ break;
 
 case 0x1d:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + X);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + X);
   if((low + X) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -2956,9 +2956,9 @@ break;
 
 case 0x19:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -2984,7 +2984,7 @@ case 0x01:
   peek(pointer, DISASM_NONE);
   pointer += X;
   intermediateAddress = peek(pointer++, DISASM_DATA);
-  intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
@@ -2998,9 +2998,9 @@ break;
 case 0x11:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -3078,12 +3078,12 @@ break;
 case 0x2f:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = (operand << 1) | (C ? 1 : 0);
+  const uInt8 value = (operand << 1) | (C ? 1 : 0);
   poke(operandAddress, value, DISASM_WRITE);
 
   A &= value;
@@ -3095,15 +3095,15 @@ break;
 
 case 0x3f:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = (operand << 1) | (C ? 1 : 0);
+  const uInt8 value = (operand << 1) | (C ? 1 : 0);
   poke(operandAddress, value, DISASM_WRITE);
 
   A &= value;
@@ -3115,15 +3115,15 @@ break;
 
 case 0x3b:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = (operand << 1) | (C ? 1 : 0);
+  const uInt8 value = (operand << 1) | (C ? 1 : 0);
   poke(operandAddress, value, DISASM_WRITE);
 
   A &= value;
@@ -3140,7 +3140,7 @@ case 0x27:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = (operand << 1) | (C ? 1 : 0);
+  const uInt8 value = (operand << 1) | (C ? 1 : 0);
   poke(operandAddress, value, DISASM_WRITE);
 
   A &= value;
@@ -3159,7 +3159,7 @@ case 0x37:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = (operand << 1) | (C ? 1 : 0);
+  const uInt8 value = (operand << 1) | (C ? 1 : 0);
   poke(operandAddress, value, DISASM_WRITE);
 
   A &= value;
@@ -3175,12 +3175,12 @@ case 0x23:
   peek(pointer, DISASM_NONE);
   pointer += X;
   operandAddress = peek(pointer++, DISASM_DATA);
-  operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = (operand << 1) | (C ? 1 : 0);
+  const uInt8 value = (operand << 1) | (C ? 1 : 0);
   poke(operandAddress, value, DISASM_WRITE);
 
   A &= value;
@@ -3193,15 +3193,15 @@ break;
 case 0x33:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  uInt8 value = (operand << 1) | (C ? 1 : 0);
+  const uInt8 value = (operand << 1) | (C ? 1 : 0);
   poke(operandAddress, value, DISASM_WRITE);
 
   A &= value;
@@ -3218,7 +3218,7 @@ case 0x2a:
   peek(PC, DISASM_NONE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the left-most bit
   C = A & 0x80;
@@ -3237,7 +3237,7 @@ case 0x26:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the left-most bit in operand
   C = operand & 0x80;
@@ -3259,7 +3259,7 @@ case 0x36:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the left-most bit in operand
   C = operand & 0x80;
@@ -3275,12 +3275,12 @@ break;
 case 0x2e:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the left-most bit in operand
   C = operand & 0x80;
@@ -3295,15 +3295,15 @@ break;
 
 case 0x3e:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the left-most bit in operand
   C = operand & 0x80;
@@ -3323,7 +3323,7 @@ case 0x6a:
   peek(PC, DISASM_NONE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = A & 0x01;
@@ -3342,7 +3342,7 @@ case 0x66:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -3364,7 +3364,7 @@ case 0x76:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -3380,12 +3380,12 @@ break;
 case 0x6e:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -3400,15 +3400,15 @@ break;
 
 case 0x7e:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -3426,12 +3426,12 @@ break;
 case 0x6f:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -3441,13 +3441,13 @@ case 0x6f:
 
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -3472,15 +3472,15 @@ break;
 
 case 0x7f:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -3490,13 +3490,13 @@ case 0x7f:
 
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -3521,15 +3521,15 @@ break;
 
 case 0x7b:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -3539,13 +3539,13 @@ case 0x7b:
 
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -3575,7 +3575,7 @@ case 0x67:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -3585,13 +3585,13 @@ case 0x67:
 
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -3623,7 +3623,7 @@ case 0x77:
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -3633,13 +3633,13 @@ case 0x77:
 
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -3668,12 +3668,12 @@ case 0x63:
   peek(pointer, DISASM_NONE);
   pointer += X;
   operandAddress = peek(pointer++, DISASM_DATA);
-  operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -3683,13 +3683,13 @@ case 0x63:
 
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -3715,15 +3715,15 @@ break;
 case 0x73:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
 {
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -3733,13 +3733,13 @@ case 0x73:
 
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -3772,7 +3772,7 @@ case 0x40:
   peek(0x0100 + SP++, DISASM_NONE);
   PS(peek(0x0100 + SP++, DISASM_DATA));
   PC = peek(0x0100 + SP++, DISASM_DATA);
-  PC |= (uInt16(peek(0x0100 + SP, DISASM_DATA)) << 8);
+  PC |= (static_cast<uInt16>(peek(0x0100 + SP, DISASM_DATA)) << 8);
 }
 break;
 
@@ -3785,7 +3785,7 @@ case 0x60:
 {
   peek(0x0100 + SP++, DISASM_NONE);
   PC = peek(0x0100 + SP++, DISASM_DATA);
-  PC |= (uInt16(peek(0x0100 + SP, DISASM_DATA)) << 8);
+  PC |= (static_cast<uInt16>(peek(0x0100 + SP, DISASM_DATA)) << 8);
   peek(PC++, DISASM_NONE);
 }
 break;
@@ -3795,7 +3795,7 @@ break;
 case 0x8f:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
 }
 {
   poke(operandAddress, A & X, DISASM_WRITE);
@@ -3828,7 +3828,7 @@ case 0x83:
   peek(pointer, DISASM_NONE);
   pointer += X;
   operandAddress = peek(pointer++, DISASM_DATA);
-  operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
 }
 {
   poke(operandAddress, A & X, DISASM_WRITE);
@@ -3844,14 +3844,14 @@ case 0xeb:
 }
 {
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -3878,14 +3878,14 @@ case 0xe5:
 }
 {
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -3914,14 +3914,14 @@ case 0xf5:
 }
 {
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -3944,19 +3944,19 @@ break;
 case 0xed:
 {
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -3978,9 +3978,9 @@ break;
 
 case 0xfd:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + X);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + X);
   if((low + X) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -3994,14 +3994,14 @@ case 0xfd:
 }
 {
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -4023,9 +4023,9 @@ break;
 
 case 0xf9:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -4039,14 +4039,14 @@ case 0xf9:
 }
 {
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -4072,19 +4072,19 @@ case 0xe1:
   peek(pointer, DISASM_NONE);
   pointer += X;
   intermediateAddress = peek(pointer++, DISASM_DATA);
-  intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }
 {
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -4107,9 +4107,9 @@ break;
 case 0xf1:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -4123,14 +4123,14 @@ case 0xf1:
 }
 {
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -4157,7 +4157,7 @@ case 0xcb:
   operand = peek(PC++, DISASM_CODE);
 }
 {
-  uInt16 value = uInt16(X & A) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(X & A) - static_cast<uInt16>(operand);
   X = (value & 0xff);
 
   notZ = X;
@@ -4203,9 +4203,9 @@ break;
 // SHA
 case 0x9f:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
 }
 {
@@ -4218,9 +4218,9 @@ break;
 case 0x93:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
 }
 {
@@ -4234,9 +4234,9 @@ break;
 // SHS
 case 0x9b:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
 }
 {
@@ -4251,9 +4251,9 @@ break;
 // SHX
 case 0x9e:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
 }
 {
@@ -4267,9 +4267,9 @@ break;
 // SHY
 case 0x9c:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
 }
 {
@@ -4284,7 +4284,7 @@ break;
 case 0x0f:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
@@ -4303,9 +4303,9 @@ break;
 
 case 0x1f:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -4325,9 +4325,9 @@ break;
 
 case 0x1b:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -4391,7 +4391,7 @@ case 0x03:
   peek(pointer, DISASM_NONE);
   pointer += X;
   operandAddress = peek(pointer++, DISASM_DATA);
-  operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
@@ -4411,9 +4411,9 @@ break;
 case 0x13:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -4436,7 +4436,7 @@ break;
 case 0x4f:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
@@ -4455,9 +4455,9 @@ break;
 
 case 0x5f:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -4477,9 +4477,9 @@ break;
 
 case 0x5b:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -4543,7 +4543,7 @@ case 0x43:
   peek(pointer, DISASM_NONE);
   pointer += X;
   operandAddress = peek(pointer++, DISASM_DATA);
-  operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }
@@ -4563,9 +4563,9 @@ break;
 case 0x53:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -4610,7 +4610,7 @@ break;
 case 0x8d:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
 }
 SET_LAST_POKE(myLastSrcAddressA)
 {
@@ -4620,9 +4620,9 @@ break;
 
 case 0x9d:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
 }
 {
@@ -4632,9 +4632,9 @@ break;
 
 case 0x99:
 {
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
 }
 {
@@ -4648,7 +4648,7 @@ case 0x81:
   peek(pointer, DISASM_NONE);
   pointer += X;
   operandAddress = peek(pointer++, DISASM_DATA);
-  operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
 }
 {
   poke(operandAddress, A, DISASM_WRITE);
@@ -4658,9 +4658,9 @@ break;
 case 0x91:
 {
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
 }
 {
@@ -4696,7 +4696,7 @@ break;
 case 0x8e:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
 }
 SET_LAST_POKE(myLastSrcAddressX)
 {
@@ -4732,7 +4732,7 @@ break;
 case 0x8c:
 {
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
 }
 SET_LAST_POKE(myLastSrcAddressY)
 {
diff --git a/src/emucore/M6502.m4 b/src/emucore/M6502.m4
index f193fe178..81f92f49b 100644
--- a/src/emucore/M6502.m4
+++ b/src/emucore/M6502.m4
@@ -67,32 +67,32 @@ define(M6502_IMMEDIATE_READ_DISCARD_OPERAND, `{
 
 define(M6502_ABSOLUTE_READ, `{
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }')
 
 define(M6502_ABSOLUTE_READ_DISCARD_OPERAND, `{
   intermediateAddress = peek(PC++, DISASM_CODE);
-  intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   peek(intermediateAddress, DISASM_DATA);
 }')
 
 define(M6502_ABSOLUTE_WRITE, `{
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
 }')
 
 define(M6502_ABSOLUTE_READMODIFYWRITE, `{
   operandAddress = peek(PC++, DISASM_CODE);
-  operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }')
 
 define(M6502_ABSOLUTEX_READ, `{
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + X);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + X);
   if((low + X) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -106,9 +106,9 @@ define(M6502_ABSOLUTEX_READ, `{
 }')
 
 define(M6502_ABSOLUTEX_READ_DISCARD_OPERAND, `{
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + X);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + X);
   if((low + X) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -122,25 +122,25 @@ define(M6502_ABSOLUTEX_READ_DISCARD_OPERAND, `{
 }')
 
 define(M6502_ABSOLUTEX_WRITE, `{
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
 }')
 
 define(M6502_ABSOLUTEX_READMODIFYWRITE, `{
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + X), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + X), DISASM_NONE);
   operandAddress = (high | low) + X;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }')
 
 define(M6502_ABSOLUTEY_READ, `{
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -154,16 +154,16 @@ define(M6502_ABSOLUTEY_READ, `{
 }')
 
 define(M6502_ABSOLUTEY_WRITE, `{
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
 }')
 
 define(M6502_ABSOLUTEY_READMODIFYWRITE, `{
-  uInt16 low = peek(PC++, DISASM_CODE);
-  uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(PC++, DISASM_CODE);
+  const uInt16 high = (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -240,13 +240,13 @@ define(M6502_ZEROY_READMODIFYWRITE, `{
 
 define(M6502_INDIRECT, `{
   uInt16 addr = peek(PC++, DISASM_CODE);
-  addr |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
+  addr |= (static_cast<uInt16>(peek(PC++, DISASM_CODE)) << 8);
 
   // Simulate the error in the indirect addressing mode!
-  uInt16 high = NOTSAMEPAGE(addr, addr + 1) ? (addr & 0xff00) : (addr + 1);
+  const uInt16 high = NOTSAMEPAGE(addr, addr + 1) ? (addr & 0xff00) : (addr + 1);
 
   operandAddress = peek(addr, DISASM_DATA);
-  operandAddress |= (uInt16(peek(high, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(high, DISASM_DATA)) << 8);
 }')
 
 define(M6502_INDIRECTX_READ, `{
@@ -254,7 +254,7 @@ define(M6502_INDIRECTX_READ, `{
   peek(pointer, DISASM_NONE);
   pointer += X;
   intermediateAddress = peek(pointer++, DISASM_DATA);
-  intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(intermediateAddress, DISASM_DATA);
 }')
 
@@ -263,7 +263,7 @@ define(M6502_INDIRECTX_WRITE, `{
   peek(pointer, DISASM_NONE);
   pointer += X;
   operandAddress = peek(pointer++, DISASM_DATA);
-  operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
 }')
 
 define(M6502_INDIRECTX_READMODIFYWRITE, `{
@@ -271,16 +271,16 @@ define(M6502_INDIRECTX_READMODIFYWRITE, `{
   peek(pointer, DISASM_NONE);
   pointer += X;
   operandAddress = peek(pointer++, DISASM_DATA);
-  operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
+  operandAddress |= (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
 }')
 
 define(M6502_INDIRECTY_READ, `{
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  intermediateAddress = high | uInt8(low + Y);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  intermediateAddress = high | static_cast<uInt8>(low + Y);
   if((low + Y) > 0xFF)
   {
     peek(intermediateAddress, DISASM_NONE);
@@ -295,17 +295,17 @@ define(M6502_INDIRECTY_READ, `{
 
 define(M6502_INDIRECTY_WRITE, `{
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
 }')
 
 define(M6502_INDIRECTY_READMODIFYWRITE, `{
   uInt8 pointer = peek(PC++, DISASM_CODE);
-  uInt16 low = peek(pointer++, DISASM_DATA);
-  uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
-  peek(high | uInt8(low + Y), DISASM_NONE);
+  const uInt16 low = peek(pointer++, DISASM_DATA);
+  const uInt16 high = (static_cast<uInt16>(peek(pointer, DISASM_DATA)) << 8);
+  peek(high | static_cast<uInt8>(low + Y), DISASM_NONE);
   operandAddress = (high | low) + Y;
   operand = peek(operandAddress, DISASM_DATA);
   poke(operandAddress, operand, DISASM_WRITE);
@@ -315,7 +315,7 @@ define(M6502_BCC, `{
   if(!C)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -326,7 +326,7 @@ define(M6502_BCS, `{
   if(C)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -337,7 +337,7 @@ define(M6502_BEQ, `{
   if(!notZ)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -348,7 +348,7 @@ define(M6502_BMI, `{
   if(N)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -359,7 +359,7 @@ define(M6502_BNE, `{
   if(notZ)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -370,7 +370,7 @@ define(M6502_BPL, `{
   if(!N)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -381,7 +381,7 @@ define(M6502_BVC, `{
   if(!V)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -392,7 +392,7 @@ define(M6502_BVS, `{
   if(V)
   {
     peek(PC, DISASM_NONE);
-    uInt16 address = PC + Int8(operand);
+    const uInt16 address = PC + static_cast<Int8>(operand);
     if(NOTSAMEPAGE(PC, address))
       peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
     PC = address;
@@ -402,13 +402,13 @@ define(M6502_BVS, `{
 define(M6502_ADC, `{
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -469,7 +469,7 @@ define(M6502_ARR, `{
   }
   else
   {
-    uInt8 value = A & operand;
+    const uInt8 value = A & operand;
 
     A = ((value >> 1) & 0x7f) | (C ? 0x80 : 0x00);
     N = C;
@@ -544,7 +544,7 @@ define(M6502_BRK, `{
   I = true;
 
   PC = peek(0xfffe, DISASM_DATA);
-  PC |= (uInt16(peek(0xffff, DISASM_DATA)) << 8);
+  PC |= (static_cast<uInt16>(peek(0xffff, DISASM_DATA)) << 8);
 }')
 
 define(M6502_CLC, `{
@@ -564,7 +564,7 @@ define(M6502_CLV, `{
 }')
 
 define(M6502_CMP, `{
-  uInt16 value = uInt16(A) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(A) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -572,7 +572,7 @@ define(M6502_CMP, `{
 }')
 
 define(M6502_CPX, `{
-  uInt16 value = uInt16(X) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(X) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -580,7 +580,7 @@ define(M6502_CPX, `{
 }')
 
 define(M6502_CPY, `{
-  uInt16 value = uInt16(Y) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(Y) - static_cast<uInt16>(operand);
 
   notZ = value;
   N = value & 0x0080;
@@ -588,17 +588,17 @@ define(M6502_CPY, `{
 }')
 
 define(M6502_DCP, `{
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
-  uInt16 value2 = uInt16(A) - uInt16(value);
+  const uInt16 value2 = static_cast<uInt16>(A) - static_cast<uInt16>(value);
   notZ = value2;
   N = value2 & 0x0080;
   C = !(value2 & 0x0100);
 }')
 
 define(M6502_DEC, `{
-  uInt8 value = operand - 1;
+  const uInt8 value = operand - 1;
   poke(operandAddress, value, DISASM_WRITE);
 
   notZ = value;
@@ -627,7 +627,7 @@ define(M6502_EOR, `{
 }')
 
 define(M6502_INC, `{
-  uInt8 value = operand + 1;
+  const uInt8 value = operand + 1;
   poke(operandAddress, value, DISASM_WRITE);
 
   notZ = value;
@@ -651,14 +651,14 @@ define(M6502_ISB, `{
   poke(operandAddress, operand, DISASM_WRITE);
 
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -682,7 +682,7 @@ define(M6502_JMP, `{
 }')
 
 define(M6502_JSR, `{
-  uInt8 low = peek(PC++, DISASM_CODE);
+  const uInt8 low = peek(PC++, DISASM_CODE);
   peek(0x0100 + SP, DISASM_NONE);
 
   // It seems that the 650x does not push the address of the next instruction
@@ -691,7 +691,7 @@ define(M6502_JSR, `{
   poke(0x0100 + SP--, PC >> 8, DISASM_WRITE);
   poke(0x0100 + SP--, PC & 0xff, DISASM_WRITE);
 
-  PC = (low | (uInt16(peek(PC, DISASM_CODE)) << 8));
+  PC = (low | (static_cast<uInt16>(peek(PC, DISASM_CODE)) << 8));
 }')
 
 define(M6502_LAS, `{
@@ -785,7 +785,7 @@ define(M6502_PLP, `{
 }')
 
 define(M6502_RLA, `{
-  uInt8 value = (operand << 1) | (C ? 1 : 0);
+  const uInt8 value = (operand << 1) | (C ? 1 : 0);
   poke(operandAddress, value, DISASM_WRITE);
 
   A &= value;
@@ -795,7 +795,7 @@ define(M6502_RLA, `{
 }')
 
 define(M6502_ROL, `{
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the left-most bit in operand
   C = operand & 0x80;
@@ -808,7 +808,7 @@ define(M6502_ROL, `{
 }')
 
 define(M6502_ROLA, `{
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the left-most bit
   C = A & 0x80;
@@ -820,7 +820,7 @@ define(M6502_ROLA, `{
 }')
 
 define(M6502_ROR, `{
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -833,7 +833,7 @@ define(M6502_ROR, `{
 }')
 
 define(M6502_RORA, `{
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = A & 0x01;
@@ -845,7 +845,7 @@ define(M6502_RORA, `{
 }')
 
 define(M6502_RRA, `{
-  bool oldC = C;
+  const bool oldC = C;
 
   // Set carry flag according to the right-most bit
   C = operand & 0x01;
@@ -855,13 +855,13 @@ define(M6502_RRA, `{
 
   if(!D)
   {
-    Int32 sum = A + operand + (C ? 1 : 0);
+    const Int32 sum = A + operand + (C ? 1 : 0);
     N = sum & 0x80;
     V = ~(A ^ operand) & (A ^ sum) & 0x80;
     notZ = sum & 0xff;
     C = sum & 0xff00;
 
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -887,13 +887,13 @@ define(M6502_RTI, `{
   peek(0x0100 + SP++, DISASM_NONE);
   PS(peek(0x0100 + SP++, DISASM_DATA));
   PC = peek(0x0100 + SP++, DISASM_DATA);
-  PC |= (uInt16(peek(0x0100 + SP, DISASM_DATA)) << 8);
+  PC |= (static_cast<uInt16>(peek(0x0100 + SP, DISASM_DATA)) << 8);
 }')
 
 define(M6502_RTS, `{
   peek(0x0100 + SP++, DISASM_NONE);
   PC = peek(0x0100 + SP++, DISASM_DATA);
-  PC |= (uInt16(peek(0x0100 + SP, DISASM_DATA)) << 8);
+  PC |= (static_cast<uInt16>(peek(0x0100 + SP, DISASM_DATA)) << 8);
   peek(PC++, DISASM_NONE);
 }')
 
@@ -903,14 +903,14 @@ define(M6502_SAX, `{
 
 define(M6502_SBC, `{
   // N, V, Z, C flags are the same in either mode (C calculated at the end)
-  Int32 sum = A - operand - (C ? 0 : 1);
+  const Int32 sum = A - operand - (C ? 0 : 1);
   N = sum & 0x80;
   V = (A ^ operand) & (A ^ sum) & 0x80;
   notZ = sum & 0xff;
 
   if(!D)
   {
-    A = uInt8(sum);
+    A = static_cast<uInt8>(sum);
   }
   else
   {
@@ -930,7 +930,7 @@ define(M6502_SBC, `{
 }')
 
 define(M6502_SBX, `{
-  uInt16 value = uInt16(X & A) - uInt16(operand);
+  const uInt16 value = static_cast<uInt16>(X & A) - static_cast<uInt16>(operand);
   X = (value & 0xff);
 
   notZ = X;