     }
   } else if address >= 0xA000 and address <= 0xBFFF {
     // External RAM
-    let eram_size = rom_get_ext_ram_size();
-    let offset = address - 0xA000;
+    let eram_size = uint64(rom_get_ext_ram_size());
+    let offset = uint64(address) - 0xA000;
     if mmu_mbc1_ram_enable and offset < eram_size {
-      *((eram + (mmu_mbc1_ram_bank * 0x2000)) + offset) = value;
+      *((eram + (uint64(mmu_mbc1_ram_bank) * 0x2000)) + offset) = value;
     }
   } else {
     // Unhandled

  *(optable + 0x0E) = op_0E;
  *(optable + 0x0F) = op_0F;

  // TODO: *(optable + 0x10) = op_10;
  *(optable + 0x11) = op_11;
  *(optable + 0x12) = op_12;
  *(optable + 0x13) = op_13;


  // CPU registers
  AF = 0x01B0;
  BC = 0x1300;
  DE = 0x00D8;
  HL = 0x014D;

