diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ea377c..793af68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10) set(EVMU_VERSION_MAJOR 1) set(EVMU_VERSION_MINOR 6) -set(EVMU_VERSION_PATCH 0) +set(EVMU_VERSION_PATCH 1) set(EVMU_VERSION ${EVMU_VERSION_MAJOR}.${EVMU_VERSION_MINOR}.${EVMU_VERSION_PATCH}) diff --git a/legacy/source/gyro_vmu_cpu.c b/legacy/source/gyro_vmu_cpu.c index 2b706dd..9244fd9 100644 --- a/legacy/source/gyro_vmu_cpu.c +++ b/legacy/source/gyro_vmu_cpu.c @@ -31,7 +31,7 @@ static inline int _fetchRegIndAddr(struct VMUDevice* dev, uint8_t reg) { EvmuDevice_* pDevice_ = EVMU_DEVICE_PRISTINE(dev); assert(reg <= 3); //Make sure we're within bounds - int addr = (EvmuMemory_readInt(EVMU_MEMORY_PUBLIC_(pDevice_->pMemory), + int addr = (EvmuMemory_readData(EVMU_MEMORY_PUBLIC_(pDevice_->pMemory), reg | ((pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&(EVMU_SFR_PSW_IRBK0_MASK|EVMU_SFR_PSW_IRBK1_MASK))>>0x1u)) //Bits 2-3 come from PSW | (reg&0x2)<<0x7u); //MSB of pointer is bit 1 from instruction @@ -97,16 +97,16 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { break; case OPCODE_LD: EVMU_CPU_EXECUTE(); - EvmuMemory_writeInt(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, + EvmuMemory_writeData(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, EVMU_ADDRESS_SFR_ACC, - EvmuMemory_readInt(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, + EvmuMemory_readData(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, instr->operands.direct)); break; case OPCODE_LD_IND: EVMU_CPU_EXECUTE(); - EvmuMemory_writeInt(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, + EvmuMemory_writeData(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, EVMU_ADDRESS_SFR_ACC, - EvmuMemory_readInt(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, + EvmuMemory_readData(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, _fetchRegIndAddr(dev, instr->operands.indirect))); break; case OPCODE_CALL: @@ -128,11 +128,11 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { break; case OPCODE_ST: EVMU_CPU_EXECUTE(); - EvmuMemory_writeInt(pMemory, instr->operands.direct, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]); + EvmuMemory_writeData(pMemory, instr->operands.direct, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]); break; case OPCODE_ST_IND: EVMU_CPU_EXECUTE(); - EvmuMemory_writeInt(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect), pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]); + EvmuMemory_writeData(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect), pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]); break; case OPCODE_CALLF: EVMU_CPU_EXECUTE(); @@ -146,11 +146,11 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { break; case OPCODE_MOV: EVMU_CPU_EXECUTE(); - EvmuMemory_writeInt(pMemory, instr->operands.direct, instr->operands.immediate); + EvmuMemory_writeData(pMemory, instr->operands.direct, instr->operands.immediate); break; case OPCODE_MOV_IND: EVMU_CPU_EXECUTE(); - EvmuMemory_writeInt(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect), instr->operands.immediate); + EvmuMemory_writeData(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect), instr->operands.immediate); break; case OPCODE_JMP: EVMU_CPU_EXECUTE(); @@ -162,9 +162,9 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { int temp = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_C)] | (pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]<<8); temp *= pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_B)]; - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_C, (temp&0xff)); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, ((temp&0xff00)>>8)); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_B, ((temp&0xff0000)>>16)); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_C, (temp&0xff)); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, ((temp&0xff00)>>8)); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_B, ((temp&0xff0000)>>16)); pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)] &= ~EVMU_SFR_PSW_CY_MASK; if(temp>65535) { @@ -176,8 +176,8 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { break; case OPCODE_BEI: { EVMU_CPU_EXECUTE(); - int acc = EvmuMemory_readInt(pMemory, EVMU_ADDRESS_SFR_ACC); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x7f)|(accoperands.immediate? 0x80:0)); + int acc = EvmuMemory_readData(pMemory, EVMU_ADDRESS_SFR_ACC); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x7f)|(accoperands.immediate? 0x80:0)); if(acc == instr->operands.immediate) { pCpu_->pc += SGNEXT(instr->operands.relative8); } @@ -186,8 +186,8 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { case OPCODE_BE: { EVMU_CPU_EXECUTE(); int acc = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; - int mem = EvmuMemory_readInt(pMemory, instr->operands.direct); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x7f)|(accoperands.direct); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x7f)|(accpc += SGNEXT(instr->operands.relative8); } @@ -196,8 +196,8 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { case OPCODE_BE_IND: { EVMU_CPU_EXECUTE(); int imm = instr->operands.immediate; - int mem = EvmuMemory_readInt(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect)); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x7f)|(memoperands.indirect)); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x7f)|(mempc += SGNEXT(instr->operands.relative8); } @@ -216,9 +216,9 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { r = 0xff00 | pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_C)]; s = 0; } - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_B, s); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_C, r&0xff); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, (r&0xff00)>>8); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_B, s); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_C, r&0xff); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, (r&0xff00)>>8); pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)] &= ~EVMU_SFR_PSW_CY_MASK; if(!s) { pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)] |= EVMU_SFR_PSW_OV_MASK; @@ -229,7 +229,7 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { break; case OPCODE_BNEI:{ EVMU_CPU_EXECUTE(); - const int acc = EvmuMemory_readInt(pMemory, EVMU_ADDRESS_SFR_ACC); + const int acc = EvmuMemory_readData(pMemory, EVMU_ADDRESS_SFR_ACC); pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)] = (pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&0x7f)|(accoperands.immediate? 0x80:0); if(acc != instr->operands.immediate) { pCpu_->pc += SGNEXT(instr->operands.relative8); @@ -239,7 +239,7 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { case OPCODE_BNE:{ EVMU_CPU_EXECUTE(); int acc = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; - int mem = EvmuMemory_readInt(pMemory, instr->operands.direct); + int mem = EvmuMemory_readData(pMemory, instr->operands.direct); pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)] = (pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&0x7f)|(accpc += SGNEXT(instr->operands.relative8); @@ -248,7 +248,7 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { } case OPCODE_BNE_IND: { EVMU_CPU_EXECUTE(); - int mem = EvmuMemory_readInt(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect)); + int mem = EvmuMemory_readData(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect)); pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)] = (pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&0x7f)|(mem < instr->operands.immediate? 0x80:0); if(instr->operands.immediate != mem) { pCpu_->pc += SGNEXT(instr->operands.relative8); @@ -257,9 +257,9 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { } case OPCODE_BPC: { EVMU_CPU_EXECUTE(); - int mem = EvmuMemory_readIntLatch(pMemory, instr->operands.direct); + int mem = EvmuMemory_readDataLatch(pMemory, instr->operands.direct); if(mem & (1<operands.bit)) { - EvmuMemory_writeInt(pMemory, instr->operands.direct, (mem&~(1<operands.bit))); + EvmuMemory_writeData(pMemory, instr->operands.direct, (mem&~(1<operands.bit))); pCpu_->pc += SGNEXT(instr->operands.relative8); } break; @@ -269,7 +269,7 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { uint32_t flashAddr = ((pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_FPR)]&EVMU_SFR_FPR_ADDR_MASK)<<16u)| (pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_TRL)] | (pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_TRH)]<<8u)); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->flash[flashAddr]); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->flash[flashAddr]); break; } case OPCODE_STF: { @@ -308,8 +308,8 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { } case OPCODE_DBNZ: { EVMU_CPU_EXECUTE(); - int mem = EvmuMemory_readIntLatch(pMemory, instr->operands.direct)-1; - EvmuMemory_writeInt(pMemory, instr->operands.direct, mem); + int mem = EvmuMemory_readDataLatch(pMemory, instr->operands.direct)-1; + EvmuMemory_writeData(pMemory, instr->operands.direct, mem); if(mem != 0) { pCpu_->pc += SGNEXT(instr->operands.relative8); } @@ -318,8 +318,8 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { case OPCODE_DBNZ_IND:{ EVMU_CPU_EXECUTE(); int addr = _fetchRegIndAddr(dev, instr->operands.indirect); - int mem = EvmuMemory_readInt(pMemory, addr)-1; - EvmuMemory_writeInt(pMemory, addr, mem); + int mem = EvmuMemory_readData(pMemory, addr)-1; + EvmuMemory_writeData(pMemory, addr, mem); if(mem != 0) { pCpu_->pc += SGNEXT(instr->operands.relative8); } @@ -327,38 +327,38 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { } case OPCODE_PUSH: EVMU_CPU_EXECUTE(); - _gyVmuPush(dev, EvmuMemory_readInt(pMemory, instr->operands.direct)); + _gyVmuPush(dev, EvmuMemory_readData(pMemory, instr->operands.direct)); break; case OPCODE_INC: { EVMU_CPU_EXECUTE(); - EvmuMemory_writeInt(pMemory, instr->operands.direct, EvmuMemory_readIntLatch(pMemory, instr->operands.direct)+1); + EvmuMemory_writeData(pMemory, instr->operands.direct, EvmuMemory_readDataLatch(pMemory, instr->operands.direct)+1); break; } case OPCODE_INC_IND: { EVMU_CPU_EXECUTE(); int addr = _fetchRegIndAddr(dev, instr->operands.indirect); - EvmuMemory_writeInt(pMemory, addr, EvmuMemory_readIntLatch(pMemory, addr)+1); + EvmuMemory_writeData(pMemory, addr, EvmuMemory_readDataLatch(pMemory, addr)+1); break; } case OPCODE_BP: EVMU_CPU_EXECUTE(); - if(EvmuMemory_readInt(pMemory, instr->operands.direct)&(0x1<operands.bit)) { + if(EvmuMemory_readData(pMemory, instr->operands.direct)&(0x1<operands.bit)) { pCpu_->pc += SGNEXT(instr->operands.relative8); } break; case OPCODE_POP: EVMU_CPU_EXECUTE(); - EvmuMemory_writeInt(pMemory, instr->operands.direct, _gyVmuPop(dev)); + EvmuMemory_writeData(pMemory, instr->operands.direct, _gyVmuPop(dev)); break; case OPCODE_DEC:{ EVMU_CPU_EXECUTE(); - EvmuMemory_writeInt(pMemory, instr->operands.direct,EvmuMemory_readInt(pMemory, instr->operands.direct)-1); + EvmuMemory_writeData(pMemory, instr->operands.direct,EvmuMemory_readData(pMemory, instr->operands.direct)-1); break; } case OPCODE_DEC_IND:{ EVMU_CPU_EXECUTE(); const int addr = _fetchRegIndAddr(dev, instr->operands.indirect); - EvmuMemory_writeInt(pMemory, addr, EvmuMemory_readInt(pMemory, addr)-1); + EvmuMemory_writeData(pMemory, addr, EvmuMemory_readData(pMemory, addr)-1); break; } case OPCODE_BZ: @@ -371,32 +371,32 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { EVMU_CPU_EXECUTE(); int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; int s = instr->operands.immediate; - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| ((r&15)+(s&15)>15? 0x40:0)|((0x80&(~r^s)&(s^(r+s)))? 4:0)); break; } case OPCODE_ADD: { EVMU_CPU_EXECUTE(); int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; - int s = EvmuMemory_readInt(pMemory, instr->operands.direct); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| + int s = EvmuMemory_readData(pMemory, instr->operands.direct); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| ((r&15)+(s&15)>15? 0x40:0)|((0x80&(~r^s)&(s^(r+s)))? 4:0)); break; } case OPCODE_ADD_IND: { EVMU_CPU_EXECUTE(); int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; - int s = EvmuMemory_readInt(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect)); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| + int s = EvmuMemory_readData(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect)); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| ((r&15)+(s&15)>15? 0x40:0)|((0x80&(~r^s)&(s^(r+s)))? 4:0)); break; } case OPCODE_BN: EVMU_CPU_EXECUTE(); - if(!(EvmuMemory_readInt(pMemory, instr->operands.direct)&(0x1<operands.bit))) { + if(!(EvmuMemory_readData(pMemory, instr->operands.direct)&(0x1<operands.bit))) { pCpu_->pc += SGNEXT(instr->operands.relative8); } break; @@ -412,26 +412,26 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { EVMU_CPU_EXECUTE(); int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; int s = instr->operands.immediate + ((pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&EVMU_SFR_PSW_CY_MASK)>>EVMU_SFR_PSW_CY_POS); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| ((r&15)+(s&15)>15? 0x40:0)|((0x80&(~r^s)&(s^(r+s)))? 4:0)); break; } case OPCODE_ADDC: { EVMU_CPU_EXECUTE(); int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; - int s = EvmuMemory_readInt(pMemory, instr->operands.direct) + ((pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&EVMU_SFR_PSW_CY_MASK)>>EVMU_SFR_PSW_CY_POS); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| + int s = EvmuMemory_readData(pMemory, instr->operands.direct) + ((pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&EVMU_SFR_PSW_CY_MASK)>>EVMU_SFR_PSW_CY_POS); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| ((r&15)+(s&15)>15? 0x40:0)|((0x80&(~r^s)&(s^(r+s)))? 4:0)); break; } case OPCODE_ADDC_IND: { EVMU_CPU_EXECUTE(); int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; - int s = EvmuMemory_readInt(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect)) + ((pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&EVMU_SFR_PSW_CY_MASK)>>EVMU_SFR_PSW_CY_POS); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| + int s = EvmuMemory_readData(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect)) + ((pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&EVMU_SFR_PSW_CY_MASK)>>EVMU_SFR_PSW_CY_POS); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r+s); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r+s>255? 0x80:0)| ((r&15)+(s&15)>15? 0x40:0)|((0x80&(~r^s)&(s^(r+s)))? 4:0)); break; } @@ -446,8 +446,8 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { EVMU_CPU_EXECUTE(); int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; int s = instr->operands.immediate; - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r-s); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r-s<0? 0x80:0)| + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r-s); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r-s<0? 0x80:0)| ((r&15)-(s&15)<0? 0x40:0)|(UCHAR_SUB_OV(r,s)? 4:0)); break; @@ -455,9 +455,9 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { case OPCODE_SUB:{ EVMU_CPU_EXECUTE(); int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; - int s = EvmuMemory_readInt(pMemory, instr->operands.direct); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r-s); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r-s<0? 0x80:0)| + int s = EvmuMemory_readData(pMemory, instr->operands.direct); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r-s); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r-s<0? 0x80:0)| ((r&15)-(s&15)<0? 0x40:0)|(UCHAR_SUB_OV(r,s)? 4:0)); break; @@ -465,16 +465,16 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { case OPCODE_SUB_IND:{ EVMU_CPU_EXECUTE(); int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; - int s = EvmuMemory_readInt(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect)); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r-s); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r-s<0? 0x80:0)| + int s = EvmuMemory_readData(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect)); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r-s); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r-s<0? 0x80:0)| ((r&15)-(s&15)<0? 0x40:0)|(UCHAR_SUB_OV(r,s)? 4:0)); break; } case OPCODE_NOT1: { EVMU_CPU_EXECUTE(); - EvmuMemory_writeInt(pMemory, instr->operands.direct, EvmuMemory_readIntLatch(pMemory, instr->operands.direct) ^ (0x1u<operands.bit)); + EvmuMemory_writeData(pMemory, instr->operands.direct, EvmuMemory_readDataLatch(pMemory, instr->operands.direct) ^ (0x1u<operands.bit)); break; } case OPCODE_RETI: { @@ -487,18 +487,18 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; int s = instr->operands.immediate; int c = ((pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&EVMU_SFR_PSW_CY_MASK)>>EVMU_SFR_PSW_CY_POS); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r-s-c); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r-s-c<0? 0x80:0)| + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r-s-c); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r-s-c<0? 0x80:0)| ((r&15)-(s&15)-c<0? 0x40:0)|(UCHAR_SUB_OV(r,s-c)? 4:0)); break; } case OPCODE_SUBC: { EVMU_CPU_EXECUTE(); int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; - int s = EvmuMemory_readInt(pMemory, instr->operands.direct); + int s = EvmuMemory_readData(pMemory, instr->operands.direct); int c = ((pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&EVMU_SFR_PSW_CY_MASK)>>EVMU_SFR_PSW_CY_POS); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r-s-c); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r-s-c<0? 0x80:0)| + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r-s-c); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r-s-c<0? 0x80:0)| ((r&15)-(s&15)-c<0? 0x40:0)|(UCHAR_SUB_OV(r,s-c)? 4:0)); break; @@ -506,98 +506,98 @@ int gyVmuCpuInstrExecute(VMUDevice* dev, const EvmuDecodedInstruction* instr) { case OPCODE_SUBC_IND:{ EVMU_CPU_EXECUTE(); int r = pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]; - int s = EvmuMemory_readInt(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect)); + int s = EvmuMemory_readData(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect)); int c = ((pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)]&EVMU_SFR_PSW_CY_MASK)>>EVMU_SFR_PSW_CY_POS); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, r-s-c); - EvmuMemory_writeInt(pMemory, 0x101, (EvmuMemory_readInt(pMemory, 0x101)&0x3b)|(r-s-c<0? 0x80:0)| + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, r-s-c); + EvmuMemory_writeData(pMemory, 0x101, (EvmuMemory_readData(pMemory, 0x101)&0x3b)|(r-s-c<0? 0x80:0)| ((r&15)-(s&15)-c<0? 0x40:0)|(UCHAR_SUB_OV(r,s-c)? 4:0)); break; } case OPCODE_ROR: { EVMU_CPU_EXECUTE(); - int r = EvmuMemory_readInt(pMemory, 0x100); - EvmuMemory_writeInt(pMemory, 0x100, (r>>1)|((r&1)<<7)); + int r = EvmuMemory_readData(pMemory, 0x100); + EvmuMemory_writeData(pMemory, 0x100, (r>>1)|((r&1)<<7)); break; } case OPCODE_LDC: //Load from IMEM (flash/rom) not ROM? EVMU_CPU_EXECUTE(); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->pExt[pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]+(pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_TRL)] | (pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_TRH)]<<8u))]); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->pExt[pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]+(pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_TRL)] | (pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_TRH)]<<8u))]); break; case OPCODE_XCH: { - int acc = EvmuMemory_readInt(pMemory, EVMU_ADDRESS_SFR_ACC); - int mem = EvmuMemory_readInt(pMemory, instr->operands.direct); + int acc = EvmuMemory_readData(pMemory, EVMU_ADDRESS_SFR_ACC); + int mem = EvmuMemory_readData(pMemory, instr->operands.direct); acc ^= mem; mem ^= acc; acc ^= mem; - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, acc); - EvmuMemory_writeInt(pMemory, instr->operands.direct, mem); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, acc); + EvmuMemory_writeData(pMemory, instr->operands.direct, mem); break; } case OPCODE_XCH_IND: { const int addr = _fetchRegIndAddr(dev, instr->operands.indirect); - int acc = EvmuMemory_readInt(pMemory, EVMU_ADDRESS_SFR_ACC); - int mem = EvmuMemory_readInt(pMemory, addr); + int acc = EvmuMemory_readData(pMemory, EVMU_ADDRESS_SFR_ACC); + int mem = EvmuMemory_readData(pMemory, addr); acc ^= mem; mem ^= acc; acc ^= mem; - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, acc); - EvmuMemory_writeInt(pMemory, addr, mem); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, acc); + EvmuMemory_writeData(pMemory, addr, mem); break; } case OPCODE_CLR1: { - EvmuMemory_writeInt(pMemory, instr->operands.direct, EvmuMemory_readIntLatch(pMemory, instr->operands.direct)& ~(0x1u<operands.bit)); + EvmuMemory_writeData(pMemory, instr->operands.direct, EvmuMemory_readDataLatch(pMemory, instr->operands.direct)& ~(0x1u<operands.bit)); break; } case OPCODE_RORC: { - int r = EvmuMemory_readInt(pMemory, 0x100); - int s = EvmuMemory_readInt(pMemory, 0x101); - EvmuMemory_writeInt(pMemory, 0x101, (s&0x7f)|((r&1)<<7)); - EvmuMemory_writeInt(pMemory, 0x100, (r>>1)|(s&0x80)); + int r = EvmuMemory_readData(pMemory, 0x100); + int s = EvmuMemory_readData(pMemory, 0x101); + EvmuMemory_writeData(pMemory, 0x101, (s&0x7f)|((r&1)<<7)); + EvmuMemory_writeData(pMemory, 0x100, (r>>1)|(s&0x80)); break; } case OPCODE_ORI: - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]|instr->operands.immediate); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]|instr->operands.immediate); break; case OPCODE_OR: - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]|EvmuMemory_readInt(pMemory, instr->operands.direct)); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]|EvmuMemory_readData(pMemory, instr->operands.direct)); break; case OPCODE_OR_IND: - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]|EvmuMemory_readInt(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect))); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]|EvmuMemory_readData(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect))); break; case OPCODE_ROL: { - int r = EvmuMemory_readInt(pMemory, 0x100); - EvmuMemory_writeInt(pMemory, 0x100, (r<<1)|((r&0x80)>>7)); + int r = EvmuMemory_readData(pMemory, 0x100); + EvmuMemory_writeData(pMemory, 0x100, (r<<1)|((r&0x80)>>7)); break; } case OPCODE_ANDI: - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]&instr->operands.immediate); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]&instr->operands.immediate); break; case OPCODE_AND: - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]&EvmuMemory_readInt(pMemory, instr->operands.direct)); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]&EvmuMemory_readData(pMemory, instr->operands.direct)); break; case OPCODE_AND_IND: - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]&EvmuMemory_readInt(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect))); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]&EvmuMemory_readData(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect))); break; case OPCODE_SET1: { - EvmuMemory_writeInt(pMemory, instr->operands.direct, EvmuMemory_readIntLatch(pMemory, instr->operands.direct)|(0x1u<operands.bit)); + EvmuMemory_writeData(pMemory, instr->operands.direct, EvmuMemory_readDataLatch(pMemory, instr->operands.direct)|(0x1u<operands.bit)); break; } case OPCODE_ROLC: { - int r = EvmuMemory_readInt(pMemory, 0x100); - int s = EvmuMemory_readInt(pMemory, 0x101); - EvmuMemory_writeInt(pMemory, 0x101, (s&0x7f)|(r&0x80)); - EvmuMemory_writeInt(pMemory, 0x100, (r<<1)|((s&0x80)>>7)); + int r = EvmuMemory_readData(pMemory, 0x100); + int s = EvmuMemory_readData(pMemory, 0x101); + EvmuMemory_writeData(pMemory, 0x101, (s&0x7f)|(r&0x80)); + EvmuMemory_writeData(pMemory, 0x100, (r<<1)|((s&0x80)>>7)); break; } case OPCODE_XORI: - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]^instr->operands.immediate); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]^instr->operands.immediate); break; case OPCODE_XOR: - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]^EvmuMemory_readInt(pMemory, instr->operands.direct)); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]^EvmuMemory_readData(pMemory, instr->operands.direct)); break; case OPCODE_XOR_IND: - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]^EvmuMemory_readInt(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect))); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ACC, pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_ACC)]^EvmuMemory_readData(pMemory, _fetchRegIndAddr(dev, instr->operands.indirect))); break; } @@ -663,9 +663,9 @@ int gyVmuCpuInstrExecuteNext(VMUDevice* device) { //handle the BIOS call in software if no firwmare has been loaded if((pCpu_->pc = EvmuRom_callBios(EVMU_DEVICE_PRISTINE_PUBLIC(device)->pRom))) //jump back to USER mode before resuming execution. - EvmuMemory_writeInt(EVMU_DEVICE_PUBLIC_(pDevice_)->pMemory, + EvmuMemory_writeData(EVMU_DEVICE_PUBLIC_(pDevice_)->pMemory, EVMU_ADDRESS_SFR_EXT, - EvmuMemory_readInt(EVMU_DEVICE_PUBLIC_(pDevice_)->pMemory, + EvmuMemory_readData(EVMU_DEVICE_PUBLIC_(pDevice_)->pMemory, EVMU_ADDRESS_SFR_EXT)|EVMU_SFR_EXT_USER); } else if(!wasInFw){ // if(dbgEnabled(device)) EVMU_LOG_VERBOSE("Entering firmware: %d", device->pc); @@ -741,14 +741,14 @@ int gyVmuCpuReset(VMUDevice* dev) { pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)] = EVMU_SFR_PSW_RAMBK0_MASK; - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P7, EVMU_SFR_P7_P71_MASK); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_IE, 0xff); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_IP, 0x00); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P1FCR, 0xbf); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P3INT, 0xfd); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ISL, 0xc0); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_VSEL, 0xfc); - //EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_BTCR, 0x41); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P7, EVMU_SFR_P7_P71_MASK); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_IE, 0xff); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_IP, 0x00); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P1FCR, 0xbf); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P3INT, 0xfd); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ISL, 0xc0); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_VSEL, 0xfc); + //EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_BTCR, 0x41); pDevice_->pTimers->timer0.tscale = 256; pCpu_->pc = 0x0; @@ -783,26 +783,26 @@ int gyVmuCpuReset(VMUDevice* dev) { pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_EXT)] = 1; pDevice_->pMemory->pExt = pDevice_->pMemory->flash; } - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_XBNK, EVMU_XRAM_BANK_ICON); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_XRAM_ICN_GAME, 0x10); //Enable Game Icon + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_XBNK, EVMU_XRAM_BANK_ICON); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_XRAM_ICN_GAME, 0x10); //Enable Game Icon //SFR values initialized by BIOS (from Sega Documentation) - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P1FCR, 0xbf); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P3INT, 0xfd); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ISL, 0xc0); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_VSEL, 0xfc); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_BTCR, 0x41); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P1FCR, 0xbf); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P3INT, 0xfd); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ISL, 0xc0); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_VSEL, 0xfc); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_BTCR, 0x41); //pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_IE)] = SFR_IE_IE7_MASK; - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_IE, 0xff); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_IP, 0x00); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_OCR, EVMU_SFR_OCR_OCR7_MASK|EVMU_SFR_OCR_OCR0_MASK); //stop main clock, divide active clock by 6 + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_IE, 0xff); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_IP, 0x00); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_OCR, EVMU_SFR_OCR_OCR7_MASK|EVMU_SFR_OCR_OCR0_MASK); //stop main clock, divide active clock by 6 pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_P7)] = EVMU_SFR_P7_P71_MASK; - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_XBNK, EVMU_XRAM_BANK_LCD_TOP); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_VCCR, EVMU_SFR_VCCR_VCCR7_MASK); //turn on LCD - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_MCR, EVMU_SFR_MCR_MCR3_MASK); //enable LCD update - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_PCON, 0); //Disable HALT/HOLD modes, run CPU normally. + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_XBNK, EVMU_XRAM_BANK_LCD_TOP); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_VCCR, EVMU_SFR_VCCR_VCCR7_MASK); //turn on LCD + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_MCR, EVMU_SFR_MCR_MCR3_MASK); //enable LCD update + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_PCON, 0); //Disable HALT/HOLD modes, run CPU normally. // } diff --git a/legacy/source/gyro_vmu_device.c b/legacy/source/gyro_vmu_device.c index dab71e5..a3b6c85 100755 --- a/legacy/source/gyro_vmu_device.c +++ b/legacy/source/gyro_vmu_device.c @@ -93,7 +93,7 @@ int gyVmuDeviceLoadState(VMUDevice* dev, const char *path) { dev->pFlashUserData = pFlashUserData; dev->pFnFlashChange = pFnFlashChange; - switch(EvmuMemory_viewInt(pDevice->pMemory, EVMU_ADDRESS_SFR_EXT)) { + switch(EvmuMemory_viewData(pDevice->pMemory, EVMU_ADDRESS_SFR_EXT)) { case EVMU_SFR_EXT_ROM: pMemory_->pExt = pMemory_->rom; break; diff --git a/legacy/wrappers/cpp/include/evmu-core-cpp/evmu_device.hpp b/legacy/wrappers/cpp/include/evmu-core-cpp/evmu_device.hpp index 58ad451..1ece730 100644 --- a/legacy/wrappers/cpp/include/evmu-core-cpp/evmu_device.hpp +++ b/legacy/wrappers/cpp/include/evmu-core-cpp/evmu_device.hpp @@ -245,19 +245,19 @@ inline VmuDevice::operator VMUDevice*(void) const { inline uint8_t VmuDevice::viewMemoryByte(EvmuAddress address) const { return address < VMU_MEM_ADDR_SPACE_RANGE? - EvmuMemory_viewInt(EVMU_DEVICE_PRISTINE_PUBLIC(_dev)->pMemory, address): + EvmuMemory_viewData(EVMU_DEVICE_PRISTINE_PUBLIC(_dev)->pMemory, address): ELYSIAN_VMU_READ_INVALID_VALUE; } inline uint8_t VmuDevice::readMemoryByte(uint16_t address) const { return address < VMU_MEM_ADDR_SPACE_RANGE? - EvmuMemory_readInt(EVMU_DEVICE_PRISTINE_PUBLIC(_dev)->pMemory, address): + EvmuMemory_readData(EVMU_DEVICE_PRISTINE_PUBLIC(_dev)->pMemory, address): ELYSIAN_VMU_READ_INVALID_VALUE; } inline bool VmuDevice::writeMemoryByte(uint16_t address, uint8_t value) const { if(address < VMU_MEM_ADDR_SPACE_RANGE) { - EvmuMemory_writeInt(EVMU_DEVICE_PRISTINE_PUBLIC(_dev)->pMemory, address, value); + EvmuMemory_writeData(EVMU_DEVICE_PRISTINE_PUBLIC(_dev)->pMemory, address, value); return true; } else return false; } diff --git a/lib/api/evmu/hw/evmu_address_space.h b/lib/api/evmu/hw/evmu_address_space.h index 8d1ff84..84b35a2 100644 --- a/lib/api/evmu/hw/evmu_address_space.h +++ b/lib/api/evmu/hw/evmu_address_space.h @@ -65,12 +65,20 @@ extern "C" { #define EVMU_ADDRESS_SYSTEM_CURSOR_POS_ROW 0x61 // cursor position, row (0-3) #define EVMU_ADDRESS_SYSTEM_GAME_LAST_BLK 0x6d // Last block used by mini-game #define EVMU_ADDRESS_SYSTEM_BATTERY_CHECK 0x6e // Battery check flag (0xff - disable auto battery check, 0x00 - enable auto battery check) -// UNKNOWN [17 bytes] 0x6f-0x7f // Other BIOS magical shit? +// UNKNOWN [17 bytes] 0x6f-0x7f // Other BIOS magical shit? //-------------------- Stack Storage -------------------- #define EVMU_ADDRESS_SYSTEM_STACK_BASE 0x80 // First entry for stack storage // STACK STORAGE [126 BYTES] 0x81-0xfe // Generic storage on the stack #define EVMU_ADDRESS_SYSTEM_STACK_END 0xff // Last entry for stack storage +//==================== BIOS INPUT VARIABLES (RAM BANK 1) ===================== +#define EVMU_ADDRESS_USER_FMBANK 0x7d // Flash memory read bank address +#define EVMU_ADDRESS_USER_FMADD_H 0x7e // Flash memory read start upper address +#define EVMU_ADDRESS_USER_FMADD_L 0x7f // Flash memory read start lower address +#define EVMU_ADDRESS_USER_FM_RET_BASE 0x80 // Flash read/write start address +#define EVMU_ADDRESS_USER_FM_RET_SIZE 128 // Flash read/write count (128 bytes) +#define EVMU_ADDRESS_USER_FM_RET_END 0xff // Flash read/write end address + //==================== SPECIAL FUNCTION REGISTERS ==================== //-------------------- CPU, Interrupts, Clocks Registers -------------------- #define EVMU_ADDRESS_SFR_ACC 0x100 // Accumulator diff --git a/lib/api/evmu/hw/evmu_cpu.h b/lib/api/evmu/hw/evmu_cpu.h index 06df425..6e76113 100755 --- a/lib/api/evmu/hw/evmu_cpu.h +++ b/lib/api/evmu/hw/evmu_cpu.h @@ -1,8 +1,18 @@ +/*! \file + * \brief Sanyo LC86k CPU Core + * \ingroup Peripherals + * + * \todo + * - Properties + * - secs per instruction in msec/nsec, not float + * - pull Rom/BIOS update out of CPU update path + */ #ifndef EVMU_CPU_H #define EVMU_CPU_H #include "../types/evmu_peripheral.h" #include "evmu_isa.h" +#include #define EVMU_CPU_TYPE (GBL_TYPEOF(EvmuCpu)) #define EVMU_CPU(instance) (GBL_INSTANCE_CAST(instance, EvmuCpu)) @@ -13,8 +23,27 @@ GBL_DECLS_BEGIN -GBL_CLASS_DERIVE_EMPTY (EvmuCpu, EvmuPeripheral) -GBL_INSTANCE_DERIVE_EMPTY(EvmuCpu, EvmuPeripheral) +GBL_FORWARD_DECLARE_STRUCT(EvmuCpu); + +typedef uint16_t EvmuPc; + +GBL_CLASS_DERIVE(EvmuCpu, EvmuPeripheral) + EVMU_RESULT (*pFnFetch) (GBL_SELF, + EvmuPc pc, + EvmuInstruction* pEncoded); + EVMU_RESULT (*pFnDecode) (GBL_SELF, + const EvmuInstruction* pEncoded, + EvmuDecodedInstruction* pDecoded); + EVMU_RESULT (*pFnExecute)(GBL_SELF, + const EvmuDecodedInstruction* pInstr); + EVMU_RESULT (*pFnRunNext)(GBL_SELF); +GBL_CLASS_END + +GBL_INSTANCE_DERIVE(EvmuCpu, EvmuPeripheral) + GblBool halted; + GblBool haltAfterNext; + GblBool pcChanged; +GBL_INSTANCE_END GBL_PROPERTIES(EvmuCpu, (pc, GBL_GENERIC, (READ, WRITE, LOAD, SAVE), GBL_UINT32_TYPE), @@ -24,17 +53,23 @@ GBL_PROPERTIES(EvmuCpu, (instructionOperand3, GBL_GENERIC, (READ), GBL_UINT8_TYPE) ) +GBL_SIGNALS(EvmuCpu, + (pcChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT16_TYPE, pc)) +) + EVMU_EXPORT GblType EvmuCpu_type (void) GBL_NOEXCEPT; -EVMU_EXPORT EvmuAddress EvmuCpu_pc (GBL_CSELF) GBL_NOEXCEPT; -EVMU_EXPORT void EvmuCpu_setPc (GBL_SELF, EvmuAddress address) GBL_NOEXCEPT; +EVMU_EXPORT EvmuPc EvmuCpu_pc (GBL_CSELF) GBL_NOEXCEPT; +EVMU_EXPORT void EvmuCpu_setPc (GBL_SELF, EvmuPc address) GBL_NOEXCEPT; EVMU_EXPORT const EvmuDecodedInstruction* EvmuCpu_currentInstruction (GBL_CSELF) GBL_NOEXCEPT; -EVMU_EXPORT EVMU_RESULT EvmuCpu_execute (GBL_CSELF, + +EVMU_EXPORT EVMU_RESULT EvmuCpu_execute (GBL_SELF, const EvmuDecodedInstruction* pInstr) GBL_NOEXCEPT; -EVMU_EXPORT EvmuAddress EvmuCpu_indirectAddress (GBL_CSELF, uint8_t indirectMode) GBL_NOEXCEPT; +EVMU_EXPORT EVMU_RESULT EvmuCpu_runNext (GBL_SELF) GBL_NOEXCEPT; + EVMU_EXPORT double EvmuCpu_secsPerInstruction (GBL_CSELF) GBL_NOEXCEPT; EVMU_EXPORT GblSize EvmuCpu_cyclesPerInstruction (GBL_CSELF) GBL_NOEXCEPT; @@ -43,21 +78,3 @@ GBL_DECLS_END #undef GBL_SELF_TYPE #endif // EVMU_CPU_H - - -#if 0 -EVMU_EXPORT EVMU_RESULT EvmuCpu_instructionInfo (GBL_CSELF, - EvmuDecodedInstruction* pInstruction, - EvmuWord* pIndirectAddress, - uint8_t* pEllapsedCycles) GBL_NOEXCEPT; - -//EVMU_EXPORT EVMU_RESULT EvmuCpu_executeInstruction (GBL_CSELF, -// const EvmuInstruction* pInstruction) GBL_NOEXCEPT; - -EVMU_EXPORT EVMU_RESULT EvmuCpu_executeEncoded (GBL_CSELF, - const EvmuInstruction* pInstr) GBL_NOEXCEPT; - -EVMU_EXPORT EVMU_RESULT EvmuCpu_executeDecoded (GBL_CSELF, - const EvmuDecodedInstruction* pInstr) GBL_NOEXCEPT; -#endif - diff --git a/lib/api/evmu/hw/evmu_lcd.h b/lib/api/evmu/hw/evmu_lcd.h index 9ff95b0..0d61eec 100755 --- a/lib/api/evmu/hw/evmu_lcd.h +++ b/lib/api/evmu/hw/evmu_lcd.h @@ -3,6 +3,8 @@ * \ingroup Peripherals * \todo * - Pixel ghosting still needs some work + * - update screen when in sleep mode + * - access/control XRAM bank */ #ifndef EVMU_LCD_H @@ -57,11 +59,11 @@ GBL_CLASS_DERIVE(EvmuLcd, EvmuPeripheral) GBL_CLASS_END GBL_INSTANCE_DERIVE(EvmuLcd, EvmuPeripheral) - GblBool screenChanged; - GblBool ghostingEnabled; - GblBool filterEnabled; - GblBool screenSaverEnabled; ///< Continue updating when display is disabled GblSize screenRefreshDivisor; ///< How many hardware refreshes before software refresh + uint32_t screenChanged : 1; ///< User-driven toggle for knowing when to redraw + uint32_t ghostingEnabled : 1; ///< Emulate pixel ghosting/fade effect + uint32_t filterEnabled : 1; ///< Enable linear filtering + uint32_t invertColors : 1; ///< Swap black and white pixel values GBL_INSTANCE_END GBL_PROPERTIES(EvmuLcd, @@ -70,15 +72,14 @@ GBL_PROPERTIES(EvmuLcd, (refreshRate, GBL_GENERIC, (READ, WRITE), GBL_ENUM_TYPE), (ghostingEnabled, GBL_GENERIC, (READ, WRITE), GBL_BOOL_TYPE), (filterEnabled, GBL_GENERIC, (READ, WRITE), GBL_BOOL_TYPE), + (invertColors, GBL_GENERIC, (READ, WRITE), GBL_BOOL_TYPE), (icons, GBL_GENERIC, (READ, WRITE), GBL_FLAGS_TYPE) ) GBL_SIGNALS(EvmuLcd, (screenRefresh, (GBL_INSTANCE_TYPE, pReceiver)), - (screenToggle, (GBL_INSTANCE_TYPE, pReceiver), - (GBL_BOOL_TYPE, enabled)), - (iconsChange, (GBL_INSTANCE_TYPE, pReceiver), - (GBL_FLAGS_TYPE, flags)) + (screenToggle, (GBL_INSTANCE_TYPE, pReceiver), (GBL_BOOL_TYPE, enabled)), + (iconsChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_FLAGS_TYPE, flags)) ) EVMU_EXPORT GblType EvmuLcd_type (void) GBL_NOEXCEPT; diff --git a/lib/api/evmu/hw/evmu_memory.h b/lib/api/evmu/hw/evmu_memory.h index bd863a9..8209726 100755 --- a/lib/api/evmu/hw/evmu_memory.h +++ b/lib/api/evmu/hw/evmu_memory.h @@ -3,6 +3,7 @@ #include "../types/evmu_peripheral.h" #include "../hw/evmu_sfr.h" +#include #define EVMU_MEMORY_TYPE (GBL_TYPEOF(EvmuMemory)) #define EVMU_MEMORY_NAME "FIXME" @@ -15,15 +16,7 @@ GBL_DECLS_BEGIN -GBL_DECLARE_ENUM(EVMU_MEMORY_SEGMENT) { - EVMU_MEMORY_SEGMENT_RAM, - EVMU_MEMORY_SEGMENT_SFR, - EVMU_MEMORY_SEGMENT_XRAM, - EVMU_MEMORY_SEGMENT_WRAM, - EVMU_MEMORY_SEGMENT_ROM, - EVMU_MEMORY_SEGMENT_FLASH, - EVMU_MEMORY_SEGMENT_COUNT -}; +GBL_FORWARD_DECLARE_STRUCT(EvmuMemory); GBL_DECLARE_ENUM(EVMU_MEMORY_BANK) { EVMU_MEMORY_BANK_INVALID, @@ -45,13 +38,48 @@ GBL_DECLARE_ENUM(EVMU_MEMORY_EXT_SRC) { EVMU_MEMORY_EXT_SRC_FLASH_BANK_1 = EVMU_SFR_EXT_FLASH_BANK_1 }; -GBL_CLASS_DERIVE_EMPTY (EvmuMemory, EvmuPeripheral) -GBL_INSTANCE_DERIVE_EMPTY(EvmuMemory, EvmuPeripheral) +GBL_CLASS_DERIVE(EvmuMemory, EvmuPeripheral) + EVMU_RESULT (*pFnReadData) (GBL_CSELF, EvmuAddress addr, EvmuWord* pValue); + EVMU_RESULT (*pFnReadDataLatch) (GBL_CSELF, EvmuAddress addr, EvmuWord* pValue); + EVMU_RESULT (*pFnWriteData) (GBL_SELF, EvmuAddress addr, EvmuWord value); + EVMU_RESULT (*pFnWriteDataLatch)(GBL_SELF, EvmuAddress addr, EvmuWord value); + EVMU_RESULT (*pFnReadProgram) (GBL_CSELF, EvmuAddress addr, EvmuWord* pValue); + EVMU_RESULT (*pFnWriteProgram) (GBL_SELF, EvmuAddress addr, EvmuWord value); + EVMU_RESULT (*pFnReadFlash) (GBL_CSELF, EvmuAddress addr, EvmuWord* pValue); + EVMU_RESULT (*pFnWriteFlash) (GBL_SELF, EvmuAddress addr, EvmuWord value); +GBL_CLASS_END + +GBL_INSTANCE_DERIVE(EvmuMemory, EvmuPeripheral) + uint32_t ramChanged : 1; + uint32_t sfrChanged : 1; + uint32_t xramChanged : 1; + uint32_t flashChanged : 1; + uint32_t romChanged : 1; + uint32_t wramChanged : 1; +GBL_INSTANCE_END GBL_PROPERTIES(EvmuMemory, - (stackPointer, GBL_GENERIC, (READ), GBL_UINT8_TYPE), - (extBusSource, GBL_GENERIC, (READ), GBL_ENUM_TYPE), - (intBusSource, GBL_GENERIC, (READ), GBL_ENUM_TYPE) + (ramBank, GBL_GENERIC, (READ, WRITE), GBL_ENUM_TYPE), + (xramBank, GBL_GENERIC, (READ, WRITE), GBL_ENUM_TYPE), + (programSource, GBL_GENERIC, (READ, WRITE), GBL_ENUM_TYPE), + (stackPointer, GBL_GENERIC, (READ), GBL_UINT8_TYPE), + (vselIncrement, GBL_GENERIC, (READ, WRITE), GBL_BOOL_TYPE), + (vrmad, GBL_GENERIC, (READ, WRITE), GBL_UINT16_TYPE), + (vtrbf, GBL_GENERIC, (READ, WRITE), GBL_UINT8_TYPE) +) + +GBL_SIGNALS(EvmuMemory, + (ramValueChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT32_TYPE, address), (GBL_ENUM_TYPE, bank)), + (ramBankChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_ENUM_TYPE, bank)), + (sfrValueChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT32_TYPE, address)), + (xramValueChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT32_TYPE, address), (GBL_ENUM_TYPE, bank)), + (xramBankChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_ENUM_TYPE, bank)), + (flashValueChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT32_TYPE, address)), + (romValueChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT32_TYPE, address)), + (programSourceChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_BOOL_TYPE, flash)), + (wramValueChange, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT32_TYPE, address)), + (stackPush, (GBL_INSTANCE_TYPE, pReceiver), (GBL_UINT8_TYPE, value)), + (stackPop, (GBL_INSTANCE_TYPE, pReceiver)) ) EVMU_EXPORT GblType EvmuMemory_type (void) GBL_NOEXCEPT; @@ -60,24 +88,28 @@ EVMU_EXPORT EvmuAddress EvmuMemory_indirectAddress (GBL_CSELF, uint8_t mode) GBL_NOEXCEPT; // Read/write into internal RAM address space (RAM, SFRs, XRAM) -EVMU_EXPORT EvmuWord EvmuMemory_readInt (GBL_CSELF, EvmuAddress addr) GBL_NOEXCEPT; -EVMU_EXPORT EvmuWord EvmuMemory_readIntLatch (GBL_CSELF, EvmuAddress addr) GBL_NOEXCEPT; -EVMU_EXPORT EvmuWord EvmuMemory_viewInt (GBL_CSELF, EvmuAddress addr) GBL_NOEXCEPT; +EVMU_EXPORT EvmuWord EvmuMemory_readData (GBL_CSELF, EvmuAddress addr) GBL_NOEXCEPT; +EVMU_EXPORT EvmuWord EvmuMemory_readDataLatch (GBL_CSELF, EvmuAddress addr) GBL_NOEXCEPT; +EVMU_EXPORT EvmuWord EvmuMemory_viewData (GBL_CSELF, EvmuAddress addr) GBL_NOEXCEPT; -EVMU_EXPORT EVMU_RESULT EvmuMemory_writeInt (GBL_SELF, - EvmuAddress address, - EvmuWord value) GBL_NOEXCEPT; +EVMU_EXPORT EVMU_RESULT EvmuMemory_writeData (GBL_SELF, + EvmuAddress address, + EvmuWord value) GBL_NOEXCEPT; + +EVMU_EXPORT EVMU_RESULT EvmuMemory_writeDataLatch (GBL_SELF, + EvmuAddress address, + EvmuWord value) GBL_NOEXCEPT; // External addres space (ROM/Flash) -EVMU_EXPORT EvmuWord EvmuMemory_readExt (GBL_CSELF, EvmuAddress addr) GBL_NOEXCEPT; +EVMU_EXPORT EvmuWord EvmuMemory_readProgram (GBL_CSELF, EvmuAddress addr) GBL_NOEXCEPT; -EVMU_EXPORT EVMU_RESULT EvmuMemory_writeExt (GBL_SELF, +EVMU_EXPORT EVMU_RESULT EvmuMemory_writeProgram (GBL_SELF, EvmuAddress addr, EvmuWord value) GBL_NOEXCEPT; EVMU_EXPORT EVMU_MEMORY_EXT_SRC - EvmuMemory_extSource (GBL_CSELF) GBL_NOEXCEPT; -EVMU_EXPORT EVMU_RESULT EvmuMemory_setExtSource (GBL_SELF, + EvmuMemory_programSource (GBL_CSELF) GBL_NOEXCEPT; +EVMU_EXPORT EVMU_RESULT EvmuMemory_setProgramSource (GBL_SELF, EVMU_MEMORY_EXT_SRC src) GBL_NOEXCEPT; EVMU_EXPORT EvmuWord EvmuMemory_readFlash (GBL_CSELF, EvmuAddress addr) GBL_NOEXCEPT; @@ -85,6 +117,7 @@ EVMU_EXPORT EvmuWord EvmuMemory_readFlash (GBL_CSELF, EvmuAddress addr) GB EVMU_EXPORT EVMU_RESULT EvmuMemory_writeFlash (GBL_SELF, EvmuAddress addr, EvmuWord value) GBL_NOEXCEPT; +//READ/WRITE ROM EVMU_EXPORT int EvmuMemory_stackDepth (GBL_CSELF) GBL_NOEXCEPT; EVMU_EXPORT EvmuWord EvmuMemory_viewStack (GBL_CSELF, GblSize depth) GBL_NOEXCEPT; diff --git a/lib/api/evmu/hw/evmu_rom.h b/lib/api/evmu/hw/evmu_rom.h index 2351c59..1e73867 100644 --- a/lib/api/evmu/hw/evmu_rom.h +++ b/lib/api/evmu/hw/evmu_rom.h @@ -5,7 +5,7 @@ * \todo * - CLEAN UP IMPLEMENTATION IN GENERAL * - remove "reestDevice" references (pending Flash updates get moved) - * - EvmuRom_setBiosMode() + * - EvmuRom_setBiosMode() (set mode button then jump to Colton's address?) * - EvmuRom["biosMode"]: R/W * - EvmuRom["dateTime"]: R/W (pending on ISO8601 in Gimbal) * - Maybe signal when entering/exiting BIOS @@ -65,7 +65,7 @@ GBL_DECLARE_ENUM(EVMU_BIOS_MODE) { EVMU_BIOS_MODE_GAME, ///< Game/Application mode EVMU_BIOS_MODE_TIME, ///< Clock/time mode EVMU_BIOS_MODE_MAPLE, ///< Connected to DC, Maple slave mode - EVMU_BIOS_MODE_UNKNOWN, ///< Unnknown mode (unknown BIOS) + EVMU_BIOS_MODE_UNKNOWN, ///< Unknown mode (unknown BIOS) EVMU_BIOS_MODE_COUNT ///< Number of BIOS modes }; @@ -90,6 +90,7 @@ EVMU_EXPORT EVMU_BIOS_TYPE EvmuRom_biosType (GBL_CSELF) EVMU_EXPORT EVMU_BIOS_MODE EvmuRom_biosMode (GBL_CSELF) GBL_NOEXCEPT; EVMU_EXPORT EVMU_RESULT EvmuRom_loadBios (GBL_SELF, const char* pPath) GBL_NOEXCEPT; +EVMU_EXPORT EVMU_RESULT EvmuRom_unloadBios (GBL_SELF) GBL_NOEXCEPT; EVMU_EXPORT EvmuAddress EvmuRom_callBios (GBL_SELF, EvmuAddress entry) GBL_NOEXCEPT; EVMU_EXPORT EVMU_RESULT EvmuRom_skipBiosSetup (GBL_SELF, GblBool enableSkip) GBL_NOEXCEPT; diff --git a/lib/api/evmu/types/evmu_ibehavior.h b/lib/api/evmu/types/evmu_ibehavior.h index 4e97e19..b26642b 100644 --- a/lib/api/evmu/types/evmu_ibehavior.h +++ b/lib/api/evmu/types/evmu_ibehavior.h @@ -16,8 +16,6 @@ GBL_DECLS_BEGIN GBL_FORWARD_DECLARE_STRUCT(EvmuEmulator); GBL_INTERFACE_DERIVE(EvmuIBehavior) - EVMU_RESULT (*pFnInitialize)(GBL_SELF); - EVMU_RESULT (*pFnFinalize) (GBL_SELF); EVMU_RESULT (*pFnReset) (GBL_SELF); EVMU_RESULT (*pFnUpdate) (GBL_SELF, EvmuTicks ticks); EVMU_RESULT (*pFnSaveState) (GBL_CSELF, GblStringBuffer* pString); @@ -27,8 +25,6 @@ GBL_INTERFACE_END EVMU_EXPORT GblType EvmuIBehavior_type (void) GBL_NOEXCEPT; EVMU_EXPORT EvmuEmulator* EvmuIBehavior_emulator (GBL_CSELF) GBL_NOEXCEPT; -EVMU_EXPORT EVMU_RESULT EvmuIBehavior_initialize (GBL_SELF) GBL_NOEXCEPT; -EVMU_EXPORT EVMU_RESULT EvmuIBehavior_finalize (GBL_SELF) GBL_NOEXCEPT; EVMU_EXPORT EVMU_RESULT EvmuIBehavior_reset (GBL_SELF) GBL_NOEXCEPT; EVMU_EXPORT EVMU_RESULT EvmuIBehavior_update (GBL_SELF, EvmuTicks ticks) GBL_NOEXCEPT; EVMU_EXPORT EVMU_RESULT EvmuIBehavior_saveState (GBL_SELF, GblStringBuffer* pString) GBL_NOEXCEPT; diff --git a/lib/lib/libgimbal b/lib/lib/libgimbal index 7373051..c86fa14 160000 --- a/lib/lib/libgimbal +++ b/lib/lib/libgimbal @@ -1 +1 @@ -Subproject commit 737305170fe205a7a9bea85ab5439470b2ada535 +Subproject commit c86fa14e1e193ec31164199698f36d13fc2dcf18 diff --git a/lib/source/hw/evmu_cpu.c b/lib/source/hw/evmu_cpu.c index 4f48896..19c596a 100755 --- a/lib/source/hw/evmu_cpu.c +++ b/lib/source/hw/evmu_cpu.c @@ -10,12 +10,13 @@ #include "evmu_gamepad_.h" #include "evmu_timers_.h" #include "../types/evmu_peripheral_.h" +#include -EVMU_EXPORT EvmuAddress EvmuCpu_pc(const EvmuCpu* pSelf) { +EVMU_EXPORT EvmuPc EvmuCpu_pc(const EvmuCpu* pSelf) { return EVMU_CPU_(pSelf)->pc; } -EVMU_EXPORT void EvmuCpu_setPc(EvmuCpu* pSelf, EvmuAddress address) { +EVMU_EXPORT void EvmuCpu_setPc(EvmuCpu* pSelf, EvmuPc address) { EVMU_CPU_(pSelf)->pc = address; } @@ -35,10 +36,41 @@ EVMU_EXPORT GblSize EvmuCpu_cyclesPerInstruction(const EvmuCpu* pSelf) { return EvmuIsa_format(pSelf_->curInstr.encoded.bytes[EVMU_INSTRUCTION_BYTE_OPCODE])->cc; } -EVMU_EXPORT EVMU_RESULT EvmuCpu_executeNext(EvmuCpu* pSelf) { + +EVMU_EXPORT EVMU_RESULT EvmuCpu_execute(EvmuCpu* pSelf, const EvmuDecodedInstruction* pInstr) { + GBL_CTX_BEGIN(NULL); + GBL_INSTANCE_VCALL(EvmuCpu, pFnExecute, pSelf, pInstr); + GBL_CTX_END(); +} + +EVMU_EXPORT EVMU_RESULT EvmuCpu_runNext(EvmuCpu* pSelf) { + GBL_CTX_BEGIN(NULL); + GBL_INSTANCE_VCALL(EvmuCpu, pFnRunNext, pSelf); + GBL_CTX_END(); +} + +static EVMU_RESULT EvmuCpu_fetch_(EvmuCpu* pSelf, EvmuPc pc, EvmuInstruction* pInstr) { + GBL_CTX_BEGIN(NULL); + EvmuCpu_* pSelf_ = EVMU_CPU_(pSelf); + //Fetch instruction + GblSize sourceSize = 4; //bullshit, fix me + GBL_CTX_VERIFY_CALL(EvmuIsa_fetch(pInstr, + &pSelf_->pMemory->pExt[pc], + &sourceSize)); + GBL_CTX_END(); +} + +static EVMU_RESULT EvmuCpu_decode_(EvmuCpu* pSelf, const EvmuInstruction* pEncoded, EvmuDecodedInstruction* pDecoded) { + GBL_UNUSED(pSelf); GBL_CTX_BEGIN(NULL); + //Decode Instruction + GBL_CTX_VERIFY_CALL(EvmuIsa_decode(pEncoded, + pDecoded)); + GBL_CTX_END(); +} - //static uint64_t instrCount = 0; +static EVMU_RESULT EvmuCpu_runNext_(EvmuCpu* pSelf) { + GBL_CTX_BEGIN(NULL); EvmuCpu_* pSelf_ = EVMU_CPU_(pSelf); EvmuMemory_* pMemory_ = pSelf_->pMemory; @@ -46,34 +78,31 @@ EVMU_EXPORT EVMU_RESULT EvmuCpu_executeNext(EvmuCpu* pSelf) { EvmuDevice* pDevice = EvmuPeripheral_device(EVMU_PERIPHERAL(pSelf)); EvmuRom* pRom = pDevice->pRom; - //Fetch instruction - GblSize sourceSize = 4; //bullshit, fix me - GBL_CTX_VERIFY_CALL(EvmuIsa_fetch(&pSelf_->curInstr.encoded, - &pMemory_->pExt[pSelf_->pc], - &sourceSize)); + // Fet instruction + GBL_INSTANCE_VCALL(EvmuCpu, pFnFetch, pSelf, pSelf_->pc, &pSelf_->curInstr.encoded); pSelf_->curInstr.pFormat = EvmuIsa_format(pSelf_->curInstr.encoded.bytes[EVMU_INSTRUCTION_BYTE_OPCODE]); //Decode instruction - GBL_CTX_VERIFY_CALL(EvmuIsa_decode(&pSelf_->curInstr.encoded, - &pSelf_->curInstr.decoded)); - - // EVMU_PERIPHERAL_INFO(pSelf, "[%lu] [%x] %s", instrCount++, pSelf_->pc, pSelf_->curInstr.pFormat->pMnemonic); + GBL_INSTANCE_VCALL(EvmuCpu, pFnDecode, pSelf, &pSelf_->curInstr.encoded, &pSelf_->curInstr.decoded); //Advance program counter pSelf_->pc += pSelf_->curInstr.pFormat->bytes; //Execute instructions - EvmuCpu_execute(pSelf, &pSelf_->curInstr.decoded); + GBL_INSTANCE_VCALL(EvmuCpu, pFnExecute, pSelf, &pSelf_->curInstr.decoded); + + //Notify debugger/UI of next instruction executing + GBL_CTX_CALL(GblSignal_emit(GBL_INSTANCE(pSelf), "pcChange", pSelf_->pc)); //Check if we entered the firmware - if(!(pMemory_->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_EXT)] & 0x1)) { + if(EvmuRom_biosActive(pRom)) { if(EvmuRom_biosType(pRom) == EVMU_BIOS_TYPE_EMULATED) { //handle the BIOS call in software if no firwmare has been loaded if((pSelf_->pc = EvmuRom_callBios(pRom, pSelf_->pc))) //jump back to USER mode before resuming execution. - EvmuMemory_writeInt(pMemory, + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_EXT, - EvmuMemory_readInt(pMemory, + EvmuMemory_readData(pMemory, EVMU_ADDRESS_SFR_EXT) | 0x1); } } @@ -81,7 +110,7 @@ EVMU_EXPORT EVMU_RESULT EvmuCpu_executeNext(EvmuCpu* pSelf) { GBL_CTX_END(); } -EVMU_EXPORT EVMU_RESULT EvmuCpu_execute(const EvmuCpu* pSelf, const EvmuDecodedInstruction* pInstr) { +static EVMU_RESULT EvmuCpu_execute_(EvmuCpu* pSelf, const EvmuDecodedInstruction* pInstr) { // EVMU MICRO ISA #define PC pSelf_->pc #define OP(NAME) pOperands->NAME @@ -89,12 +118,12 @@ EVMU_EXPORT EVMU_RESULT EvmuCpu_execute(const EvmuCpu* pSelf, const EvmuDecodedI #define SFR_MSK(NAME, FIELD) EVMU_SFR_##NAME##_##FIELD##_MASK #define SFR_POS(NAME, FIELD) EVMU_SFR_##NAME##_##FIELD##_POS #define INDIRECT() EvmuMemory_indirectAddress(pMemory, OP(indirect)) -#define VIEW(ADDR) EvmuMemory_viewInt(pMemory, ADDR) -#define READ(ADDR) EvmuMemory_readInt(pMemory, ADDR) -#define READ_LATCH(ADDR) EvmuMemory_readIntLatch(pMemory, ADDR) -#define WRITE(ADDR, VAL) EvmuMemory_writeInt(pMemory, ADDR, VAL) -#define READ_EXT(ADDR) EvmuMemory_readExt(pMemory, ADDR) -#define WRITE_EXT(ADDR, VAL) EvmuMemory_writeExt(pMemory, ADDR, VAL) +#define VIEW(ADDR) EvmuMemory_viewData(pMemory, ADDR) +#define READ(ADDR) EvmuMemory_readData(pMemory, ADDR) +#define READ_LATCH(ADDR) EvmuMemory_readDataLatch(pMemory, ADDR) +#define WRITE(ADDR, VAL) EvmuMemory_writeData(pMemory, ADDR, VAL) +#define READ_EXT(ADDR) EvmuMemory_readProgram(pMemory, ADDR) +#define WRITE_EXT(ADDR, VAL) EvmuMemory_writeProgram(pMemory, ADDR, VAL) #define READ_FLASH(ADDR) EvmuMemory_readFlash(pMemory, ADDR) #define WRITE_FLASH(ADDR, VAL) EvmuMemory_writeFlash(pMemory, ADDR, VAL) #define PUSH(VALUE) EvmuMemory_pushStack(pMemory, VALUE) @@ -112,8 +141,8 @@ EVMU_EXPORT EVMU_RESULT EvmuCpu_execute(const EvmuCpu* pSelf, const EvmuDecodedI #define OP_ADD_CARRY(RVALUE) OP_ADD_(RVALUE, 1) #define OP_SUB_CY_EXP (a-b-c<0) #define OP_SUB_AC_EXP ((a&15)-(b&15)-c<0) -#define UCHAR_SUB_OV(a, b) (((int8_t)(a^(b)) < 0 && (int8_t)(b^(a-b)) >= 0)) -#define OP_SUB_OV_EXP (UCHAR_SUB_OV(a,(b+c))) +#define OP_SUB_OV_(a, b) (((int8_t)(a^(b)) < 0 && (int8_t)(b^(a-b)) >= 0)) +#define OP_SUB_OV_EXP (OP_SUB_OV_(a,(b+c))) #define OP_SUB_(RVALUE, CY_EN) OP_ARITH(-, (RVALUE), CY_EN, OP_SUB_CY_EXP, OP_SUB_AC_EXP, OP_SUB_OV_EXP) #define OP_SUB(RVALUE) OP_SUB_(RVALUE, 0) #define OP_SUB_CARRY(RVALUE) OP_SUB_(RVALUE, 1) @@ -416,7 +445,7 @@ EVMU_EXPORT EVMU_RESULT EvmuCpu_execute(const EvmuCpu* pSelf, const EvmuDecodedI case EVMU_OPCODE_LDC: {//Load from IMEM (flash/rom) not ROM? EvmuAddress address = READ(SFR(ACC)); address += (READ(SFR(TRL)) | READ(SFR(TRH)) << 8u); - if(EvmuMemory_extSource(pMemory) == EVMU_MEMORY_EXT_SRC_FLASH_BANK_1) + if(EvmuMemory_programSource(pMemory) == EVMU_MEMORY_EXT_SRC_FLASH_BANK_1) address += EVMU_FLASH_BANK_SIZE; WRITE(SFR(ACC), READ_EXT(address)); break; @@ -515,7 +544,7 @@ static EVMU_RESULT EvmuCpu_IBehavior_update_(EvmuIBehavior* pIBehav, EvmuTicks t EvmuPic_update(EVMU_PIC_PUBLIC_(pDevice_->pPic)); EvmuTimers_update(EVMU_TIMERS_PUBLIC_(pDevice_->pTimers)); if(!(pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PCON)] & EVMU_SFR_PCON_HALT_MASK)) - EvmuCpu_executeNext(pSelf); + EvmuCpu_runNext(pSelf); const double cpuTime = EvmuCpu_secsPerInstruction(pSelf); time += cpuTime; @@ -544,25 +573,43 @@ static GBL_RESULT EvmuCpuClass_init_(GblClass* pClass, const void* pData, GblCon GBL_UNUSED(pData); GBL_CTX_BEGIN(pCtx); - EVMU_IBEHAVIOR_CLASS(pClass)->pFnUpdate = EvmuCpu_IBehavior_update_; - EVMU_IBEHAVIOR_CLASS(pClass)->pFnReset = EvmuCpu_IBehavior_reset_; + if(!GblType_classRefCount(GBL_CLASS_TYPEOF(pClass))) { + GBL_PROPERTIES_REGISTER(EvmuCpu); + + GblSignal_install(EVMU_CPU_TYPE, + "pcChange", + GblMarshal_CClosure_VOID__INSTANCE_UINT16, + 1, + GBL_UINT16_TYPE); + + } + + EVMU_IBEHAVIOR_CLASS(pClass)->pFnUpdate = EvmuCpu_IBehavior_update_; + EVMU_IBEHAVIOR_CLASS(pClass)->pFnReset = EvmuCpu_IBehavior_reset_; + EVMU_CPU_CLASS(pClass) ->pFnFetch = EvmuCpu_fetch_; + EVMU_CPU_CLASS(pClass) ->pFnDecode = EvmuCpu_decode_; + EVMU_CPU_CLASS(pClass) ->pFnExecute = EvmuCpu_execute_; + EVMU_CPU_CLASS(pClass) ->pFnRunNext = EvmuCpu_runNext_; GBL_CTX_END(); } GBL_EXPORT GblType EvmuCpu_type(void) { static GblType type = GBL_INVALID_TYPE; + + static GblTypeInfo typeInfo = { + .pFnClassInit = EvmuCpuClass_init_, + .classSize = sizeof(EvmuCpuClass), + .instanceSize = sizeof(EvmuCpu), + .instancePrivateSize = sizeof(EvmuCpu_) + }; + if(type == GBL_INVALID_TYPE) { GBL_CTX_BEGIN(NULL); type = GblType_registerStatic(GblQuark_internStringStatic("EvmuCpu"), EVMU_PERIPHERAL_TYPE, - &(const GblTypeInfo) { - .pFnClassInit = EvmuCpuClass_init_, - .classSize = sizeof(EvmuCpuClass), - .instanceSize = sizeof(EvmuCpu), - .instancePrivateSize = sizeof(EvmuCpu_) - }, - GBL_TYPE_FLAGS_NONE); + &typeInfo, + GBL_TYPE_FLAG_TYPEINFO_STATIC); GBL_CTX_VERIFY_LAST_RECORD(); GBL_CTX_END_BLOCK(); } diff --git a/lib/source/hw/evmu_lcd.c b/lib/source/hw/evmu_lcd.c index de31af2..8578642 100755 --- a/lib/source/hw/evmu_lcd.c +++ b/lib/source/hw/evmu_lcd.c @@ -214,7 +214,8 @@ static float samplePixel_(const EvmuLcd* pSelf, GblSize x, GblSize y) { EVMU_EXPORT uint8_t EvmuLcd_decoratedPixel(const EvmuLcd* pSelf, GblSize x, GblSize y) { GBL_ASSERT(x < EVMU_LCD_PIXEL_WIDTH && y < EVMU_LCD_PIXEL_HEIGHT); - return 255 - (samplePixel_(pSelf, x, y)/(float)EVMU_LCD_GHOSTING_FRAMES)*255.0f; + const uint8_t white = (samplePixel_(pSelf, x, y)/(float)EVMU_LCD_GHOSTING_FRAMES)*255.0f; + return pSelf->invertColors? white : 255 - white; } EVMU_EXPORT GblFlags EvmuLcd_icons(const EvmuLcd* pSelf) { @@ -360,6 +361,9 @@ static GBL_RESULT EvmuLcd_GblObject_property_(const GblObject* pObject, const Gb case EvmuLcd_Property_Id_filterEnabled: GblVariant_setBool(pValue, pSelf->filterEnabled); break; + case EvmuLcd_Property_Id_invertColors: + GblVariant_setBool(pValue, pSelf->invertColors); + break; case EvmuLcd_Property_Id_icons: GblVariant_setFlags(pValue, EvmuLcd_icons(pSelf), GBL_FLAGS_TYPE); break; @@ -392,6 +396,9 @@ static GBL_RESULT EvmuLcd_GblObject_setProperty_(GblObject* pObject, const GblPr case EvmuLcd_Property_Id_filterEnabled: pSelf->filterEnabled = GblVariant_toBool(pValue); break; + case EvmuLcd_Property_Id_invertColors: + pSelf->invertColors = GblVariant_toBool(pValue); + break; case EvmuLcd_Property_Id_icons: EvmuLcd_setIcons(pSelf, GblVariant_toFlags(pValue)); break; diff --git a/lib/source/hw/evmu_memory.c b/lib/source/hw/evmu_memory.c index 288e505..1a28118 100755 --- a/lib/source/hw/evmu_memory.c +++ b/lib/source/hw/evmu_memory.c @@ -13,9 +13,9 @@ EVMU_EXPORT EvmuAddress EvmuMemory_indirectAddress(const EvmuMemory* pSelf, uint GBL_CTX_BEGIN(pSelf); GBL_CTX_VERIFY(mode <= 3, GBL_RESULT_ERROR_OUT_OF_RANGE, "Invalid indirection mode: [%x]", mode); - value = (EvmuMemory_readInt(pSelf, + value = (EvmuMemory_readData(pSelf, mode | - ((EvmuMemory_viewInt(pSelf, EVMU_ADDRESS_SFR_PSW) & + ((EvmuMemory_viewData(pSelf, EVMU_ADDRESS_SFR_PSW) & (EVMU_SFR_PSW_IRBK0_MASK|EVMU_SFR_PSW_IRBK1_MASK)) >> 0x1u)) //Bits 2-3 come from PSW | (mode&0x2)<<0x7u); //MSB of pointer is bit 1 from instruction @@ -29,7 +29,7 @@ EVMU_EXPORT EvmuAddress EvmuMemory_indirectAddress(const EvmuMemory* pSelf, uint * side-effects since latch and port values can be diffferent, * meaning a SET1 could be setting more than just 1 bit. */ -EVMU_EXPORT EvmuWord EvmuMemory_readIntLatch(const EvmuMemory* pSelf, EvmuAddress addr) { +EVMU_EXPORT EvmuWord EvmuMemory_readDataLatch(const EvmuMemory* pSelf, EvmuAddress addr) { EvmuMemory_* pSelf_ = EVMU_MEMORY_(pSelf); switch(addr) { case EVMU_ADDRESS_SFR_T1L: @@ -39,11 +39,11 @@ EVMU_EXPORT EvmuWord EvmuMemory_readIntLatch(const EvmuMemory* pSelf, EvmuAddres case EVMU_ADDRESS_SFR_P7: return pSelf_->pIntMap[addr/VMU_MEM_SEG_SIZE][addr%VMU_MEM_SEG_SIZE]; default: - return EvmuMemory_readInt(pSelf, addr); //fall through to memory for non-latch data + return EvmuMemory_readData(pSelf, addr); //fall through to memory for non-latch data } } -EVMU_EXPORT EvmuWord EvmuMemory_readInt(const EvmuMemory* pSelf, EvmuAddress addr) { +EVMU_EXPORT EvmuWord EvmuMemory_readData(const EvmuMemory* pSelf, EvmuAddress addr) { EvmuWord value = 0; GBL_CTX_BEGIN(pSelf); @@ -117,7 +117,7 @@ EVMU_EXPORT EvmuWord EvmuMemory_readInt(const EvmuMemory* pSelf, EvmuAddress add return value; } -EVMU_EXPORT EvmuWord EvmuMemory_viewInt(const EvmuMemory* pSelf, EvmuAddress address) { +EVMU_EXPORT EvmuWord EvmuMemory_viewData(const EvmuMemory* pSelf, EvmuAddress address) { EvmuMemory_* pSelf_ = EVMU_MEMORY_(pSelf); EvmuWord value = 0; @@ -125,13 +125,13 @@ EVMU_EXPORT EvmuWord EvmuMemory_viewInt(const EvmuMemory* pSelf, EvmuAddress add value = pSelf_->wram[0x1ff&((pSelf_->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_VRMAD2)]<<8) | pSelf_->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_VRMAD1)])]; } else { - value = EvmuMemory_readInt(pSelf, address); + value = EvmuMemory_readData(pSelf, address); } return value; } -EVMU_EXPORT EVMU_RESULT EvmuMemory_writeInt(EvmuMemory* pSelf, EvmuAddress addr, EvmuWord val) { +EVMU_EXPORT EVMU_RESULT EvmuMemory_writeData(EvmuMemory* pSelf, EvmuAddress addr, EvmuWord val) { GBL_CTX_BEGIN(pSelf); EvmuMemory_* pSelf_ = EVMU_MEMORY_(pSelf); @@ -292,7 +292,7 @@ EVMU_EXPORT EVMU_RESULT EvmuMemory_writeInt(EvmuMemory* pSelf, EvmuAddress addr, GBL_CTX_END(); } -EVMU_EXPORT EvmuWord EvmuMemory_readExt(const EvmuMemory* pSelf, EvmuAddress addr) { +EVMU_EXPORT EvmuWord EvmuMemory_readProgram(const EvmuMemory* pSelf, EvmuAddress addr) { EvmuWord value = 0; GBL_CTX_BEGIN(pSelf); @@ -314,16 +314,16 @@ EVMU_EXPORT EvmuWord EvmuMemory_readExt(const EvmuMemory* pSelf, EvmuAddress add return value; } -EVMU_EXPORT EVMU_MEMORY_EXT_SRC EvmuMemory_extSource(const EvmuMemory* pSelf) { +EVMU_EXPORT EVMU_MEMORY_EXT_SRC EvmuMemory_programSource(const EvmuMemory* pSelf) { EvmuMemory_* pSelf_ = EVMU_MEMORY_(pSelf); return pSelf_->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_EXT)]; } -EVMU_EXPORT EVMU_RESULT EvmuMemory_setExtSource(EvmuMemory* pSelf, EVMU_MEMORY_EXT_SRC src) { +EVMU_EXPORT EVMU_RESULT EvmuMemory_setProgramSource(EvmuMemory* pSelf, EVMU_MEMORY_EXT_SRC src) { GBL_CTX_BEGIN(NULL); EvmuMemory_* pSelf_ = EVMU_MEMORY_(pSelf); - EvmuMemory_writeInt(pSelf, EVMU_ADDRESS_SFR_EXT, src); + EvmuMemory_writeData(pSelf, EVMU_ADDRESS_SFR_EXT, src); /* switch(src) { case EVMU_MEMORY_EXT_SRC_FLASH_BANK_1: @@ -348,7 +348,7 @@ EVMU_EXPORT EVMU_RESULT EvmuMemory_setExtSource(EvmuMemory* pSelf, EVMU_MEMORY_E GBL_CTX_END(); } -EVMU_EXPORT EVMU_RESULT EvmuMemory_writeExt(EvmuMemory* pSelf, +EVMU_EXPORT EVMU_RESULT EvmuMemory_writeProgram(EvmuMemory* pSelf, EvmuAddress addr, EvmuWord value) { GBL_CTX_BEGIN(pSelf); @@ -540,18 +540,18 @@ static GBL_RESULT EvmuMemory_reset_(EvmuIBehavior* pSelf) { pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_P3)] = 0xff; //Reset all P3 pins (controller buttons) pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_PSW)] = EVMU_SFR_PSW_RAMBK0_MASK; - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P7, EVMU_SFR_P7_P71_MASK); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_IE, 0xff); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_IP, 0x00); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P1FCR, 0xbf); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P3INT, 0xfd); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ISL, 0xc0); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_VSEL, 0xfc); - //EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_BTCR, 0x41); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P7, EVMU_SFR_P7_P71_MASK); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_IE, 0xff); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_IP, 0x00); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P1FCR, 0xbf); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P3INT, 0xfd); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ISL, 0xc0); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_VSEL, 0xfc); + //EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_BTCR, 0x41); pDevice_->pTimers->timer0.tscale = 256; GBL_CTX_INFO("Resetting PC."); - if(skipSetup) { + if(skipSetup && EvmuRom_biosType(pDevice->pRom) != EVMU_BIOS_TYPE_EMULATED) { EvmuCpu_setPc(pDevice->pCpu, EVMU_BIOS_SKIP_DATE_TIME_PC); } else { EvmuCpu_setPc(pDevice->pCpu, 0x0); @@ -561,7 +561,7 @@ static GBL_RESULT EvmuMemory_reset_(EvmuIBehavior* pSelf) { // pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_P7)] |= SFR_P7_P71_MASK; pDevice_->pMemory->pIntMap[VMU_MEM_SEG_GP1] = pDevice_->pMemory->ram[VMU_RAM_BANK0]; pDevice_->pMemory->pIntMap[VMU_MEM_SEG_GP2] = &pDevice_->pMemory->ram[VMU_RAM_BANK0][VMU_MEM_SEG_SIZE]; - //EvmuMemory_setExtSource(pMemory, EVMU_MEMORY_EXT_SRC_ROM); + //EvmuMemory_setprogramSource(pMemory, EVMU_MEMORY_EXT_SRC_ROM); pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_EXT)] = 0; pDevice_->pMemory->pExt = pDevice_->pMemory->rom; } //else { @@ -573,37 +573,37 @@ static GBL_RESULT EvmuMemory_reset_(EvmuIBehavior* pSelf) { if(EvmuRom_biosType(pDevice->pRom) == EVMU_BIOS_TYPE_EMULATED) { pDevice_->pMemory->pIntMap[VMU_MEM_SEG_GP1] = pDevice_->pMemory->ram[VMU_RAM_BANK1]; pDevice_->pMemory->pIntMap[VMU_MEM_SEG_GP2] = &pDevice_->pMemory->ram[VMU_RAM_BANK1][VMU_MEM_SEG_SIZE]; - //EvmuMemory_setExtSource(pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); + //EvmuMemory_setprogramSource(pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_EXT)] = 1; pDevice_->pMemory->pExt = pDevice_->pMemory->flash; } - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_XBNK, EVMU_XRAM_BANK_ICON); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_XRAM_ICN_GAME, 0x10); //Enable Game Icon + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_XBNK, EVMU_XRAM_BANK_ICON); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_XRAM_ICN_GAME, 0x10); //Enable Game Icon //SFR values initialized by BIOS (from Sega Documentation) // not according to docs, but testing - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P1DDR, 0xff); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P1FCR, 0xbf); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P3INT, 0xfd); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_P3DDR, 0x00); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_ISL, 0xc0); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_VSEL, 0xfc); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_BTCR, 0x41); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P1DDR, 0xff); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P1FCR, 0xbf); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P3INT, 0xfd); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_P3DDR, 0x00); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_ISL, 0xc0); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_VSEL, 0xfc); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_BTCR, 0x41); //pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_IE)] = SFR_IE_IE7_MASK; - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_IE, 0xff); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_IP, 0x00); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_OCR, EVMU_SFR_OCR_OCR7_MASK|EVMU_SFR_OCR_OCR0_MASK); //stop main clock, divide active clock by 6 + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_IE, 0xff); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_IP, 0x00); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_OCR, EVMU_SFR_OCR_OCR7_MASK|EVMU_SFR_OCR_OCR0_MASK); //stop main clock, divide active clock by 6 pDevice_->pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_P7)] = EVMU_SFR_P7_P71_MASK; - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_XBNK, EVMU_XRAM_BANK_LCD_TOP); - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_VCCR, EVMU_SFR_VCCR_VCCR7_MASK); //turn on LCD - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_MCR, EVMU_SFR_MCR_MCR3_MASK); //enable LCD update - EvmuMemory_writeInt(pMemory, EVMU_ADDRESS_SFR_PCON, 0); //Disable HALT/HOLD modes, run CPU normally. + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_XBNK, EVMU_XRAM_BANK_LCD_TOP); + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_VCCR, EVMU_SFR_VCCR_VCCR7_MASK); //turn on LCD + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_MCR, EVMU_SFR_MCR_MCR3_MASK); //enable LCD update + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_PCON, 0); //Disable HALT/HOLD modes, run CPU normally. - if (skipSetup) { + if (skipSetup && EvmuRom_biosType(pDevice->pRom) != EVMU_BIOS_TYPE_EMULATED) { for (int i = 0; i < EVMU_ADDRESS_SEGMENT_SFR_SIZE; i++) { - EvmuMemory_writeInt(pMemory, 0x100 + i, sfr_bin[i]); + EvmuMemory_writeData(pMemory, 0x100 + i, sfr_bin[i]); } } diff --git a/lib/source/hw/evmu_memory_.h b/lib/source/hw/evmu_memory_.h index d30560f..574d61d 100644 --- a/lib/source/hw/evmu_memory_.h +++ b/lib/source/hw/evmu_memory_.h @@ -30,21 +30,24 @@ typedef enum EVMU_MEMORY__INT_SEGMENT_ { } EVMU_MEMORY__INT_SEGMENT_; typedef struct EvmuMemory_ { - EvmuCpu_* pCpu; + EvmuCpu_* pCpu; // Internal Memory BUS - EvmuWord ram [EVMU_ADDRESS_SEGMENT_RAM_BANKS][EVMU_ADDRESS_SEGMENT_RAM_SIZE]; //general-purpose RAM - EvmuWord sfr [EVMU_ADDRESS_SEGMENT_SFR_SIZE]; //not including XRAM - EvmuWord xram [EVMU_ADDRESS_SEGMENT_XRAM_BANKS][EVMU_ADDRESS_SEGMENT_XRAM_SIZE]; + EvmuWord ram [EVMU_ADDRESS_SEGMENT_RAM_BANKS][EVMU_ADDRESS_SEGMENT_RAM_SIZE]; //general-purpose RAM + EvmuWord sfr [EVMU_ADDRESS_SEGMENT_SFR_SIZE]; //Excluding XRAM + EvmuWord xram [EVMU_ADDRESS_SEGMENT_XRAM_BANKS][EVMU_ADDRESS_SEGMENT_XRAM_SIZE]; //VRAM // External Memory BUS - EvmuWord flash [EVMU_FLASH_SIZE]; - EvmuWord rom [EVMU_ROM_SIZE]; + EvmuWord flash [EVMU_FLASH_SIZE]; + EvmuWord rom [EVMU_ROM_SIZE]; - EvmuWord wram [EVMU_WRAM_SIZE]; + // Extra Working RAM + EvmuWord wram [EVMU_WRAM_SIZE]; - EvmuWord* pIntMap [EVMU_MEMORY__INT_SEGMENT_COUNT_]; //contiguous RAM address space - EvmuWord* pExt; + // Memory-Map for current internal BUS address space + EvmuWord* pIntMap [EVMU_MEMORY__INT_SEGMENT_COUNT_]; //contiguous RAM address space + // Memory-Map for current external BUS address space + EvmuWord* pExt; } EvmuMemory_; GBL_DECLS_END diff --git a/lib/source/hw/evmu_pic.c b/lib/source/hw/evmu_pic.c index 0def1a7..4948071 100755 --- a/lib/source/hw/evmu_pic.c +++ b/lib/source/hw/evmu_pic.c @@ -145,9 +145,9 @@ static int EvmuPic__checkInterrupt_(EvmuPic_* pSelf_, EVMU_IRQ_PRIORITY p) { pSelf_->intStack[p] = interrupt; EvmuMemory_pushStack(pMemory, EvmuCpu_pc(pDevice->pCpu) & 0xff); EvmuMemory_pushStack(pMemory, (EvmuCpu_pc(pDevice->pCpu) & 0xff00) >> 8); //push return address - EvmuMemory_writeInt(pMemory, + EvmuMemory_writeData(pMemory, EVMU_ADDRESS_SFR_PCON, - EvmuMemory_readInt(pMemory, + EvmuMemory_readData(pMemory, EVMU_ADDRESS_SFR_PCON) & ~EVMU_SFR_PCON_HALT_MASK); EvmuCpu_setPc(pDevice->pCpu, EvmuPic_isrAddress((EVMU_IRQ)i)); //jump to ISR address return 1; diff --git a/lib/source/hw/evmu_rom.c b/lib/source/hw/evmu_rom.c index 4a57868..8f36eef 100644 --- a/lib/source/hw/evmu_rom.c +++ b/lib/source/hw/evmu_rom.c @@ -106,6 +106,19 @@ EVMU_EXPORT EVMU_RESULT EvmuRom_loadBios(EvmuRom* pSelf, const char* pPath) { GBL_CTX_END(); } +EVMU_EXPORT EVMU_RESULT EvmuRom_unloadBios(EvmuRom* pSelf) { + GBL_CTX_BEGIN(NULL); + EVMU_LOG_VERBOSE("Unloading BIOS"); + EVMU_LOG_PUSH(); + + EvmuRom_* pSelf_ = EVMU_ROM_(pSelf); + memset(pSelf_->pMemory->rom, 0, sizeof(EvmuWord) * EVMU_ROM_SIZE); + pSelf_->eBiosType = EVMU_BIOS_TYPE_EMULATED; + + EVMU_LOG_POP(1); + GBL_CTX_END(); +} + EVMU_EXPORT EvmuAddress EvmuRom_callBios(EvmuRom* pSelf, EvmuAddress entry) { EvmuAddress returnPc = 0; @@ -125,9 +138,9 @@ static void biosWriteFlashRom_(EvmuRom_* pSelf_) { int i, a = ((pDevice_->pMemory->ram[1][0x7d]<<16)|(pDevice_->pMemory->ram[1][0x7e]<<8)|pDevice_->pMemory->ram[1][0x7f])&0x1ffff; VMUFlashDirEntry* pEntry = gyVmuFlashDirEntryGame(dev); if(!pEntry || a >= pEntry->fileSize * VMU_FLASH_BLOCK_SIZE) - EvmuMemory_writeInt(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, 0x100, 0xff); + EvmuMemory_writeData(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, 0x100, 0xff); else { - EvmuMemory_writeInt(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, 0x100, 0x00); + EvmuMemory_writeData(EVMU_DEVICE_PRISTINE_PUBLIC(dev)->pMemory, 0x100, 0x00); for(i=0; i<0x80; i++) { const uint16_t flashAddr = (a&~0xff)|((a+i)&0xff); pDevice_->pMemory->flash[flashAddr] = pDevice_->pMemory->ram[1][i+0x80]; @@ -214,8 +227,8 @@ static EVMU_RESULT EvmuRom_callBios_(EvmuRom* pSelf, EvmuAddress pc, EvmuAddress for(i=0; i<0x80; i++) if((r = (pDevice_->pMemory->flash[(a&~0xff)|((a+i)&0xff)] ^ pDevice_->pMemory->ram[1][i+0x80])) != 0) break; - EvmuMemory_writeInt(pDevice->pMemory, 0x100, r); - *pRetPc = 0x115;\ + EvmuMemory_writeData(pDevice->pMemory, 0x100, r); + *pRetPc = 0x115; break; } case EVMU_BIOS_SUBROUTINE_FM_PRD_EX: { //fm_prd_ex(ORG 0120H) diff --git a/lib/source/hw/evmu_timers.c b/lib/source/hw/evmu_timers.c index a5bd70d..df01283 100755 --- a/lib/source/hw/evmu_timers.c +++ b/lib/source/hw/evmu_timers.c @@ -11,7 +11,7 @@ static void EvmuTimers_updateBaseTimer_(EvmuTimers* pSelf) { EvmuDevice* pDevice = EvmuPeripheral_device(EVMU_PERIPHERAL(pSelf)); VMUDevice* dev = EVMU_DEVICE_REEST(pDevice); - EvmuWord btcr = EvmuMemory_readInt(pDevice->pMemory, EVMU_ADDRESS_SFR_BTCR); + EvmuWord btcr = EvmuMemory_readData(pDevice->pMemory, EVMU_ADDRESS_SFR_BTCR); if(pMemory->sfr[EVMU_SFR_OFFSET(EVMU_ADDRESS_SFR_BTCR)] & EVMU_SFR_BTCR_OP_CTRL_MASK) { #if 1 diff --git a/test/source/evmu_cpu_test_suite.c b/test/source/evmu_cpu_test_suite.c index 0f5b3b6..a76b0cf 100644 --- a/test/source/evmu_cpu_test_suite.c +++ b/test/source/evmu_cpu_test_suite.c @@ -21,7 +21,7 @@ GBL_TEST_INIT() { pFixture->pCpu = pFixture->pDevice->pCpu; pFixture->pMemory = pFixture->pDevice->pMemory; - EvmuMemory_setExtSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); + EvmuMemory_setProgramSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); GBL_TEST_CASE_END; } @@ -39,7 +39,7 @@ GBL_TEST_CASE(nop) { } GBL_TEST_CASE(ld) { - EvmuMemory_writeInt(pFixture->pDevice->pMemory, 0x2, 27); + EvmuMemory_writeData(pFixture->pDevice->pMemory, 0x2, 27); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -49,7 +49,7 @@ GBL_TEST_CASE(ld) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pDevice->pMemory, EVMU_ADDRESS_SFR_ACC), 27); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pDevice->pMemory, EVMU_ADDRESS_SFR_ACC), 27); GBL_TEST_CASE_END; } @@ -58,7 +58,7 @@ GBL_TEST_CASE(ld) { GBL_TEST_CASE(ldInd) { const EvmuAddress ind = EvmuMemory_indirectAddress(pFixture->pMemory, 3); - EvmuMemory_writeInt(pFixture->pMemory, ind, 0xab); + EvmuMemory_writeData(pFixture->pMemory, ind, 0xab); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_LD_IND, @@ -67,13 +67,13 @@ GBL_TEST_CASE(ldInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pDevice->pMemory, + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pDevice->pMemory, EVMU_ADDRESS_SFR_ACC), 0xab); GBL_TEST_CASE_END; } GBL_TEST_CASE(st) { - EvmuMemory_writeInt(pFixture->pDevice->pMemory, EVMU_ADDRESS_SFR_ACC, 128); + EvmuMemory_writeData(pFixture->pDevice->pMemory, EVMU_ADDRESS_SFR_ACC, 128); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -83,13 +83,13 @@ GBL_TEST_CASE(st) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pDevice->pMemory, 3), 128); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pDevice->pMemory, 3), 128); GBL_TEST_CASE_END; } GBL_TEST_CASE(stInd) { - EvmuMemory_writeInt(pFixture->pDevice->pMemory, EVMU_ADDRESS_SFR_ACC, 129); + EvmuMemory_writeData(pFixture->pDevice->pMemory, EVMU_ADDRESS_SFR_ACC, 129); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -99,7 +99,7 @@ GBL_TEST_CASE(stInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 2)), 129); GBL_TEST_CASE_END; @@ -115,7 +115,7 @@ GBL_TEST_CASE(mov) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pDevice->pMemory, 4), 255); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pDevice->pMemory, 4), 255); GBL_TEST_CASE_END; } @@ -130,7 +130,7 @@ GBL_TEST_CASE(movInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3)), 245); GBL_TEST_CASE_END; @@ -161,7 +161,7 @@ GBL_TEST_CASE(pop) { } })); - GBL_TEST_COMPARE(EvmuMemory_viewInt(pFixture->pDevice->pMemory, 5), 128); + GBL_TEST_COMPARE(EvmuMemory_viewData(pFixture->pDevice->pMemory, 5), 128); GBL_TEST_COMPARE(EvmuMemory_stackDepth(pFixture->pDevice->pMemory), 0); GBL_TEST_CASE_END; @@ -314,10 +314,10 @@ GBL_TEST_CASE(ret) { } GBL_TEST_CASE(bei) { - EvmuWord psw = EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); + EvmuWord psw = EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 44); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 44); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -328,9 +328,9 @@ GBL_TEST_CASE(bei) { } })); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), 0xbabe - 17); - GBL_TEST_VERIFY(!(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); + GBL_TEST_VERIFY(!(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 33); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 33); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_BEI, @@ -339,18 +339,18 @@ GBL_TEST_CASE(bei) { .relative8 = -17 } })); - GBL_TEST_VERIFY(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); + GBL_TEST_VERIFY(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), 0xbabe - 17); GBL_TEST_CASE_END; } GBL_TEST_CASE(be) { - EvmuWord psw = EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); + EvmuWord psw = EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); - EvmuMemory_writeInt(pFixture->pMemory, 0xad, 80); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 80); + EvmuMemory_writeData(pFixture->pMemory, 0xad, 80); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 80); const EvmuAddress pc = EvmuCpu_pc(pFixture->pCpu); @@ -364,9 +364,9 @@ GBL_TEST_CASE(be) { })); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc + 22); - GBL_TEST_VERIFY(!(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); + GBL_TEST_VERIFY(!(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 60); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 60); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -376,16 +376,16 @@ GBL_TEST_CASE(be) { .relative8 = 22 } })); - GBL_TEST_VERIFY(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); + GBL_TEST_VERIFY(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc + 22); GBL_TEST_CASE_END; } GBL_TEST_CASE(beInd) { - EvmuWord psw = EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); - EvmuMemory_writeInt(pFixture->pMemory, + EvmuWord psw = EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 77); const EvmuAddress pc = EvmuCpu_pc(pFixture->pCpu); @@ -401,7 +401,7 @@ GBL_TEST_CASE(beInd) { })); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc - 128); - GBL_TEST_VERIFY(!(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); + GBL_TEST_VERIFY(!(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -412,7 +412,7 @@ GBL_TEST_CASE(beInd) { .relative8 = -128 } })); - GBL_TEST_VERIFY(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); + GBL_TEST_VERIFY(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc - 128); GBL_TEST_CASE_END; @@ -421,10 +421,10 @@ GBL_TEST_CASE(beInd) { GBL_TEST_CASE(bnei) { const EvmuAddress pc = EvmuCpu_pc(pFixture->pCpu); - EvmuWord psw = EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); + EvmuWord psw = EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 43); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 43); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -435,9 +435,9 @@ GBL_TEST_CASE(bnei) { } })); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc - 17); - GBL_TEST_VERIFY(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); + GBL_TEST_VERIFY(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 44); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 44); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_BNEI, @@ -447,18 +447,18 @@ GBL_TEST_CASE(bnei) { } })); - GBL_TEST_VERIFY(!(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); + GBL_TEST_VERIFY(!(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc - 17); GBL_TEST_CASE_END; } GBL_TEST_CASE(bne) { - EvmuWord psw = EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); + EvmuWord psw = EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); - EvmuMemory_writeInt(pFixture->pMemory, 0xad, 80); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 79); + EvmuMemory_writeData(pFixture->pMemory, 0xad, 80); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 79); const EvmuAddress pc = EvmuCpu_pc(pFixture->pCpu); @@ -472,9 +472,9 @@ GBL_TEST_CASE(bne) { })); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc + 22); - GBL_TEST_VERIFY(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); + GBL_TEST_VERIFY(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 80); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 80); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -485,15 +485,15 @@ GBL_TEST_CASE(bne) { } })); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc + 22); - GBL_TEST_VERIFY(!(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); + GBL_TEST_VERIFY(!(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); GBL_TEST_CASE_END; } GBL_TEST_CASE(bneInd) { - EvmuWord psw = EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); - EvmuMemory_writeInt(pFixture->pMemory, + EvmuWord psw = EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw&~EVMU_SFR_PSW_CY_MASK); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 76); const EvmuAddress pc = EvmuCpu_pc(pFixture->pCpu); @@ -509,7 +509,7 @@ GBL_TEST_CASE(bneInd) { })); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc - 128); - GBL_TEST_VERIFY(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); + GBL_TEST_VERIFY(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -521,7 +521,7 @@ GBL_TEST_CASE(bneInd) { } })); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc - 128); - GBL_TEST_VERIFY(!(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); + GBL_TEST_VERIFY(!(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW) & EVMU_SFR_PSW_CY_MASK)); GBL_TEST_CASE_END; } @@ -529,7 +529,7 @@ GBL_TEST_CASE(bneInd) { GBL_TEST_CASE(bp) { const EvmuAddress pc = EvmuCpu_pc(pFixture->pCpu); - EvmuMemory_writeInt(pFixture->pMemory, 0x3, 0xf8); + EvmuMemory_writeData(pFixture->pMemory, 0x3, 0xf8); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_BP, @@ -558,7 +558,7 @@ GBL_TEST_CASE(bp) { GBL_TEST_CASE(bpc) { const EvmuAddress pc = EvmuCpu_pc(pFixture->pCpu); - EvmuMemory_writeInt(pFixture->pMemory, 0x3, 0xff); + EvmuMemory_writeData(pFixture->pMemory, 0x3, 0xff); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_BPC, @@ -569,7 +569,7 @@ GBL_TEST_CASE(bpc) { } })); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc + 127); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x3), 0x7f); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x3), 0x7f); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -582,7 +582,7 @@ GBL_TEST_CASE(bpc) { } })); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc + 127); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x3), 0x7f); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x3), 0x7f); GBL_TEST_CASE_END; } @@ -590,7 +590,7 @@ GBL_TEST_CASE(bpc) { GBL_TEST_CASE(bn) { const EvmuAddress pc = EvmuCpu_pc(pFixture->pCpu); - EvmuMemory_writeInt(pFixture->pMemory, 0x3, 0x7f); + EvmuMemory_writeData(pFixture->pMemory, 0x3, 0x7f); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_BN, @@ -619,7 +619,7 @@ GBL_TEST_CASE(bn) { GBL_TEST_CASE(bz) { const EvmuAddress pc = EvmuCpu_pc(pFixture->pCpu); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_BZ, @@ -629,7 +629,7 @@ GBL_TEST_CASE(bz) { })); GBL_TEST_COMPARE(EvmuCpu_pc(pFixture->pCpu), pc + 127); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x1); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x1); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_BZ, @@ -647,7 +647,7 @@ GBL_TEST_CASE(bz) { GBL_TEST_CASE(dbnz) { const EvmuAddress pc = EvmuCpu_pc(pFixture->pCpu); - EvmuMemory_writeInt(pFixture->pMemory, 0x3, 0x2); + EvmuMemory_writeData(pFixture->pMemory, 0x3, 0x2); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_DBNZ, @@ -674,7 +674,7 @@ GBL_TEST_CASE(dbnz) { GBL_TEST_CASE(dbnzInd) { const EvmuAddress pc = EvmuCpu_pc(pFixture->pCpu); - EvmuMemory_writeInt(pFixture->pMemory, + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 2), 0x2); GBL_CTX_VERIFY_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -704,9 +704,9 @@ static GBL_RESULT clearPswFlags_(GblTestSuite* pSelf) { GBL_CTX_BEGIN(pSelf); EvmuCpuTestSuite_* pFixture = EVMU_CPU_TEST_SUITE_(pSelf); - EvmuWord psw = EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); + EvmuWord psw = EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); psw &= ~(EVMU_SFR_PSW_CY_MASK|EVMU_SFR_PSW_AC_MASK|EVMU_SFR_PSW_OV_MASK); - GBL_TEST_CALL(EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw)); + GBL_TEST_CALL(EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, psw)); GBL_CTX_END(); } @@ -715,7 +715,7 @@ static GBL_RESULT testPswFlags_(GblTestSuite* pSelf, GblBool cy, GblBool ac, Gbl GBL_CTX_BEGIN(pSelf); EvmuCpuTestSuite_* pFixture = EVMU_CPU_TEST_SUITE_(pSelf); - EvmuWord psw = EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); + EvmuWord psw = EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW); GBL_TEST_COMPARE(((psw & EVMU_SFR_PSW_CY_MASK) >> EVMU_SFR_PSW_CY_POS), cy); GBL_TEST_COMPARE(((psw & EVMU_SFR_PSW_AC_MASK) >> EVMU_SFR_PSW_AC_POS), ac); GBL_TEST_COMPARE(((psw & EVMU_SFR_PSW_OV_MASK) >> EVMU_SFR_PSW_OV_POS), ov); @@ -725,7 +725,7 @@ static GBL_RESULT testPswFlags_(GblTestSuite* pSelf, GblBool cy, GblBool ac, Gbl GBL_TEST_CASE(addi) { // ACC initial value - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); // Add immediate with no flags set GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -736,7 +736,7 @@ GBL_TEST_CASE(addi) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); // Add immediate with AC set @@ -748,7 +748,7 @@ GBL_TEST_CASE(addi) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); // Add immediate with AC and OV set @@ -760,7 +760,7 @@ GBL_TEST_CASE(addi) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); // Add immediate with CY and OV set @@ -772,7 +772,7 @@ GBL_TEST_CASE(addi) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); GBL_TEST_CASE_END; @@ -781,8 +781,8 @@ GBL_TEST_CASE(addi) { GBL_TEST_CASE(add) { // ACC initial value - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0x13); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0x13); // Add direct with no flags set GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -793,11 +793,11 @@ GBL_TEST_CASE(add) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); // Add direct with AC set - EvmuMemory_writeInt(pFixture->pMemory, 0x69, 0xa); + EvmuMemory_writeData(pFixture->pMemory, 0x69, 0xa); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADD, @@ -806,11 +806,11 @@ GBL_TEST_CASE(add) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); // Add direct with AC and OV set - EvmuMemory_writeInt(pFixture->pMemory, 0x70, 0xf); + EvmuMemory_writeData(pFixture->pMemory, 0x70, 0xf); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADD, @@ -819,11 +819,11 @@ GBL_TEST_CASE(add) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); // Add direct with CY and OV set - EvmuMemory_writeInt(pFixture->pMemory, 0x71, 0x80); + EvmuMemory_writeData(pFixture->pMemory, 0x71, 0x80); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADD, @@ -832,7 +832,7 @@ GBL_TEST_CASE(add) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); GBL_TEST_CASE_END; @@ -840,8 +840,8 @@ GBL_TEST_CASE(add) { GBL_TEST_CASE(addInd) { // ACC initial value - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x13); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x13); // Add indirect with no flags set GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -852,11 +852,11 @@ GBL_TEST_CASE(addInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); // Add indirect with AC set - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xa); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xa); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADD_IND, @@ -865,11 +865,11 @@ GBL_TEST_CASE(addInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); // Add indirect with AC and OV set - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADD_IND, @@ -878,11 +878,11 @@ GBL_TEST_CASE(addInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); // Add indirect with CY and OV set - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x80); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x80); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADD_IND, @@ -891,7 +891,7 @@ GBL_TEST_CASE(addInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); GBL_TEST_CASE_END; @@ -901,7 +901,7 @@ GBL_TEST_CASE(addci) { GBL_TEST_CALL(clearPswFlags_(pSelf)); // ACC initial value - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); // Addc immediate with no flags set GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -912,7 +912,7 @@ GBL_TEST_CASE(addci) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); // Addc immediate with AC set @@ -924,7 +924,7 @@ GBL_TEST_CASE(addci) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); // Addc immediate with AC and OV set @@ -936,7 +936,7 @@ GBL_TEST_CASE(addci) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); // Addc immediate with CY and OV set @@ -948,7 +948,7 @@ GBL_TEST_CASE(addci) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); @@ -961,7 +961,7 @@ GBL_TEST_CASE(addci) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CASE_END; @@ -971,8 +971,8 @@ GBL_TEST_CASE(addc) { GBL_TEST_CALL(clearPswFlags_(pSelf)); // ACC initial value - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0x13); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0x13); // Addc with no flags set GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -983,11 +983,11 @@ GBL_TEST_CASE(addc) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); // Addc with AC set - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0xa); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0xa); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADDC, @@ -996,11 +996,11 @@ GBL_TEST_CASE(addc) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); // Addc with AC and OV set - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0xf); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0xf); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADDC, @@ -1009,11 +1009,11 @@ GBL_TEST_CASE(addc) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); // Addc with CY and OV set - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0x80); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0x80); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADDC, @@ -1022,11 +1022,11 @@ GBL_TEST_CASE(addc) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); // addc 0x68: accum: 0x1, CY = 1 => mem[0x68] = 3 - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0x1); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0x1); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADDC, @@ -1035,7 +1035,7 @@ GBL_TEST_CASE(addc) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CASE_END; @@ -1043,8 +1043,8 @@ GBL_TEST_CASE(addc) { GBL_TEST_CASE(addcInd) { // ACC initial value - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x13); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x13); // Addc indirect with no flags set GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -1055,11 +1055,11 @@ GBL_TEST_CASE(addcInd) { // ACC initial value } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x68); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); // Addc indirect with AC set - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xa); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xa); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADDC_IND, @@ -1068,11 +1068,11 @@ GBL_TEST_CASE(addcInd) { // ACC initial value } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x72); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); // Addc indirect with AC and OV set - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADDC_IND, @@ -1081,11 +1081,11 @@ GBL_TEST_CASE(addcInd) { // ACC initial value } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x81); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); // Addc indirect with CY and OV set - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x80); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x80); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADDC_IND, @@ -1094,12 +1094,12 @@ GBL_TEST_CASE(addcInd) { // ACC initial value } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); // Addc indirect with CY in - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x1); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x1); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ADDC_IND, @@ -1108,7 +1108,7 @@ GBL_TEST_CASE(addcInd) { // ACC initial value } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CASE_END; @@ -1117,7 +1117,7 @@ GBL_TEST_CASE(addcInd) { // ACC initial value GBL_TEST_CASE(subi) { GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1127,7 +1127,7 @@ GBL_TEST_CASE(subi) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -1138,12 +1138,12 @@ GBL_TEST_CASE(subi) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUBI, @@ -1151,7 +1151,7 @@ GBL_TEST_CASE(subi) { .immediate = 0x2 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -1161,7 +1161,7 @@ GBL_TEST_CASE(subi) { .immediate = 0x95 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); GBL_TEST_CASE_END; @@ -1170,8 +1170,8 @@ GBL_TEST_CASE(subi) { GBL_TEST_CASE(sub) { GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0xc); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0xc); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1181,10 +1181,10 @@ GBL_TEST_CASE(sub) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0x68); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0x68); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUB, @@ -1193,13 +1193,13 @@ GBL_TEST_CASE(sub) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0x2); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0x2); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUB, @@ -1207,10 +1207,10 @@ GBL_TEST_CASE(sub) { .direct = 0x68 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0x95); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0x95); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUB, @@ -1218,7 +1218,7 @@ GBL_TEST_CASE(sub) { .direct = 0x68 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); GBL_TEST_CASE_END; @@ -1227,8 +1227,8 @@ GBL_TEST_CASE(sub) { GBL_TEST_CASE(subInd) { GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xc); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xc); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1238,10 +1238,10 @@ GBL_TEST_CASE(subInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x68); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x68); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUB_IND, @@ -1250,13 +1250,13 @@ GBL_TEST_CASE(subInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x2); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x2); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUB_IND, @@ -1264,10 +1264,10 @@ GBL_TEST_CASE(subInd) { .indirect = 1 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x95); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x95); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUB_IND, @@ -1275,7 +1275,7 @@ GBL_TEST_CASE(subInd) { .indirect = 1 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); GBL_TEST_CASE_END; @@ -1284,7 +1284,7 @@ GBL_TEST_CASE(subInd) { GBL_TEST_CASE(subci) { GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1294,7 +1294,7 @@ GBL_TEST_CASE(subci) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -1305,12 +1305,12 @@ GBL_TEST_CASE(subci) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUBCI, @@ -1318,7 +1318,7 @@ GBL_TEST_CASE(subci) { .immediate = 0x2 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -1328,7 +1328,7 @@ GBL_TEST_CASE(subci) { .immediate = 0x95 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); GBL_TEST_CASE_END; @@ -1337,8 +1337,8 @@ GBL_TEST_CASE(subci) { GBL_TEST_CASE(subc) { GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0xc); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0xc); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1348,10 +1348,10 @@ GBL_TEST_CASE(subc) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0x68); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0x68); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUBC, @@ -1360,13 +1360,13 @@ GBL_TEST_CASE(subc) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0x2); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0x2); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUBC, @@ -1374,10 +1374,10 @@ GBL_TEST_CASE(subc) { .direct = 0x68 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); - EvmuMemory_writeInt(pFixture->pMemory, 0x68, 0x95); + EvmuMemory_writeData(pFixture->pMemory, 0x68, 0x95); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUBC, @@ -1385,7 +1385,7 @@ GBL_TEST_CASE(subc) { .direct = 0x68 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); GBL_TEST_CASE_END; @@ -1394,8 +1394,8 @@ GBL_TEST_CASE(subc) { GBL_TEST_CASE(subcInd) { GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xc); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xc); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1405,10 +1405,10 @@ GBL_TEST_CASE(subcInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x49); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x68); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x68); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUBC_IND, @@ -1417,13 +1417,13 @@ GBL_TEST_CASE(subcInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CALL(clearPswFlags_(pSelf)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x2); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x80); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x2); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUBC_IND, @@ -1431,10 +1431,10 @@ GBL_TEST_CASE(subcInd) { .indirect = 0x1 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7e); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x95); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x95); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SUBC_IND, @@ -1442,7 +1442,7 @@ GBL_TEST_CASE(subcInd) { .indirect = 0x1 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xe9); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_TRUE)); GBL_TEST_CASE_END; @@ -1450,36 +1450,36 @@ GBL_TEST_CASE(subcInd) { GBL_TEST_CASE(mul) { // Case 1 - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, 0xc4); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x11); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_C, 0x23); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_B, 0x52); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, 0xc4); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x11); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_C, 0x23); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_B, 0x52); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_MUL })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7d); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_C), 0x36); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_B), 0x5); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x7d); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_C), 0x36); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_B), 0x5); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); // Case 2 - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, 0xc4); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x7); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_C, 0x5); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_B, 0x10); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, 0xc4); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x7); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_C, 0x5); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_B, 0x10); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_MUL })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x70); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_C), 0x50); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_B), 0x00); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x70); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_C), 0x50); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_B), 0x00); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); @@ -1488,36 +1488,36 @@ GBL_TEST_CASE(mul) { GBL_TEST_CASE(div) { // Case 1 - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, 0xc4); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x79); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_C, 0x5); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_B, 0x7); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, 0xc4); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x79); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_C, 0x5); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_B, 0x7); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_DIV })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x11); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_C), 0x49); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_B), 0x6); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x11); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_C), 0x49); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_B), 0x6); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_FALSE)); // Case 2 - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, 0xc0); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x7); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_C, 0x10); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_B, 0x0); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_PSW, 0xc0); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x7); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_C, 0x10); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_B, 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_DIV })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_C), 0x10); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_B), 0x00); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_C), 0x10); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_B), 0x00); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_TRUE, GBL_TRUE)); @@ -1525,7 +1525,7 @@ GBL_TEST_CASE(div) { } GBL_TEST_CASE(andi) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0xff); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0xff); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1535,7 +1535,7 @@ GBL_TEST_CASE(andi) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x55); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x55); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1545,14 +1545,14 @@ GBL_TEST_CASE(andi) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); GBL_TEST_CASE_END; } GBL_TEST_CASE(and) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0xff); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x55); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0xff); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x55); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1562,9 +1562,9 @@ GBL_TEST_CASE(and) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x55); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x55); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0xaa); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0xaa); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_AND, @@ -1573,14 +1573,14 @@ GBL_TEST_CASE(and) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); GBL_TEST_CASE_END; } GBL_TEST_CASE(andInd) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0xff); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x55); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0xff); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x55); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1590,9 +1590,9 @@ GBL_TEST_CASE(andInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x55); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x55); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xaa); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xaa); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_AND_IND, @@ -1601,13 +1601,13 @@ GBL_TEST_CASE(andInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); GBL_TEST_CASE_END; } GBL_TEST_CASE(ori) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1617,7 +1617,7 @@ GBL_TEST_CASE(ori) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1627,7 +1627,7 @@ GBL_TEST_CASE(ori) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, @@ -1638,7 +1638,7 @@ GBL_TEST_CASE(ori) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3f); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3f); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1648,14 +1648,14 @@ GBL_TEST_CASE(ori) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); GBL_TEST_CASE_END; } GBL_TEST_CASE(or) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x3); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x3); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1665,9 +1665,9 @@ GBL_TEST_CASE(or) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0xc); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0xc); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_OR, @@ -1676,9 +1676,9 @@ GBL_TEST_CASE(or) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x30); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x30); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_OR, @@ -1687,9 +1687,9 @@ GBL_TEST_CASE(or) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3f); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3f); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0xc0); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0xc0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_OR, @@ -1698,14 +1698,14 @@ GBL_TEST_CASE(or) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); GBL_TEST_CASE_END; } GBL_TEST_CASE(orInd) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x3); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x3); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1715,9 +1715,9 @@ GBL_TEST_CASE(orInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xc); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xc); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_OR_IND, @@ -1726,9 +1726,9 @@ GBL_TEST_CASE(orInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x30); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0x30); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_OR_IND, @@ -1737,9 +1737,9 @@ GBL_TEST_CASE(orInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3f); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3f); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xc0); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xc0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_OR_IND, @@ -1748,13 +1748,13 @@ GBL_TEST_CASE(orInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); GBL_TEST_CASE_END; } GBL_TEST_CASE(xori) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1764,7 +1764,7 @@ GBL_TEST_CASE(xori) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1773,7 +1773,7 @@ GBL_TEST_CASE(xori) { .immediate = 0xf0 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1782,7 +1782,7 @@ GBL_TEST_CASE(xori) { .immediate = 0xf } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf0); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1791,14 +1791,14 @@ GBL_TEST_CASE(xori) { .immediate = 0xf0 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); GBL_TEST_CASE_END; } GBL_TEST_CASE(xor) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0xf); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0xf); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1808,9 +1808,9 @@ GBL_TEST_CASE(xor) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0xf0); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0xf0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_XOR, @@ -1818,9 +1818,9 @@ GBL_TEST_CASE(xor) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0xf); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0xf); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_XOR, @@ -1828,9 +1828,9 @@ GBL_TEST_CASE(xor) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf0); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf0); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0xf0); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0xf0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_XOR, @@ -1838,14 +1838,14 @@ GBL_TEST_CASE(xor) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); GBL_TEST_CASE_END; } GBL_TEST_CASE(xorInd) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -1855,9 +1855,9 @@ GBL_TEST_CASE(xorInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf0); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_XOR_IND, @@ -1865,9 +1865,9 @@ GBL_TEST_CASE(xorInd) { .indirect = 0x1 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_XOR_IND, @@ -1875,9 +1875,9 @@ GBL_TEST_CASE(xorInd) { .indirect = 0x1 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf0); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xf0); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf0); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xf0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_XOR_IND, @@ -1885,25 +1885,25 @@ GBL_TEST_CASE(xorInd) { .indirect = 0x1 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x00); GBL_TEST_CASE_END; } GBL_TEST_CASE(rol) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x55); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ROL })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xaa); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xaa); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ROL })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x55); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x55); GBL_TEST_CASE_END; } @@ -1911,26 +1911,26 @@ GBL_TEST_CASE(rol) { GBL_TEST_CASE(rolc) { clearPswFlags_(pSelf); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x60); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x60); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ROLC })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xc0); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xc0); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ROLC })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x80); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x80); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ROLC })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_FALSE)); @@ -1938,26 +1938,26 @@ GBL_TEST_CASE(rolc) { &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ROLC })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CASE_END; } GBL_TEST_CASE(ror) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x1); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x1); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ROR })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x80); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x80); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_ROR })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x40); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x40); GBL_TEST_CASE_END; } @@ -1965,26 +1965,26 @@ GBL_TEST_CASE(ror) { GBL_TEST_CASE(rorc) { clearPswFlags_(pSelf); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x6); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x6); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_RORC })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x3); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_RORC })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x1); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_RORC })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x80); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x80); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_TRUE, GBL_FALSE, GBL_FALSE)); @@ -1992,7 +1992,7 @@ GBL_TEST_CASE(rorc) { &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_RORC })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xc0); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xc0); GBL_TEST_CALL(testPswFlags_(pSelf, GBL_FALSE, GBL_FALSE, GBL_FALSE)); GBL_TEST_CASE_END; @@ -2001,7 +2001,7 @@ GBL_TEST_CASE(rorc) { GBL_TEST_CASE(inc) { clearPswFlags_(pSelf); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x0); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_INC, @@ -2009,9 +2009,9 @@ GBL_TEST_CASE(inc) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0x1); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0xf0); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0xf0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_INC, @@ -2019,10 +2019,10 @@ GBL_TEST_CASE(inc) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0xf1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0xf1); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0xff); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0xff); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_INC, @@ -2030,7 +2030,7 @@ GBL_TEST_CASE(inc) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0x0); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0x0); GBL_TEST_CASE_END; } @@ -2038,7 +2038,7 @@ GBL_TEST_CASE(inc) { GBL_TEST_CASE(incInd) { clearPswFlags_(pSelf); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 0x0); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_INC_IND, @@ -2046,10 +2046,10 @@ GBL_TEST_CASE(incInd) { .indirect = 0x3 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3)), 0x1); - EvmuMemory_writeInt(pFixture->pMemory, + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 0xf0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -2058,11 +2058,11 @@ GBL_TEST_CASE(incInd) { .indirect = 0x3 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3)), 0xf1); - EvmuMemory_writeInt(pFixture->pMemory, + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 0xff); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -2071,7 +2071,7 @@ GBL_TEST_CASE(incInd) { .indirect = 0x3 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3)), 0x0); GBL_TEST_CASE_END; @@ -2080,7 +2080,7 @@ GBL_TEST_CASE(incInd) { GBL_TEST_CASE(dec) { clearPswFlags_(pSelf); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x2); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x2); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_DEC, @@ -2088,9 +2088,9 @@ GBL_TEST_CASE(dec) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0x1); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0xf0); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0xf0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_DEC, @@ -2098,10 +2098,10 @@ GBL_TEST_CASE(dec) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0xef); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0xef); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x0); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_DEC, @@ -2109,7 +2109,7 @@ GBL_TEST_CASE(dec) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0xff); GBL_TEST_CASE_END; } @@ -2117,7 +2117,7 @@ GBL_TEST_CASE(dec) { GBL_TEST_CASE(decInd) { clearPswFlags_(pSelf); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 0x2); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 0x2); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_DEC_IND, @@ -2125,9 +2125,9 @@ GBL_TEST_CASE(decInd) { .indirect = 0x3 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3)), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3)), 0x1); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 0xf0); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 0xf0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_DEC_IND, @@ -2135,10 +2135,10 @@ GBL_TEST_CASE(decInd) { .indirect = 0x3 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3)), 0xef); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3)), 0xef); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 0x0); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3), 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_DEC_IND, @@ -2146,14 +2146,14 @@ GBL_TEST_CASE(decInd) { .indirect = 0x3 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3)), 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 3)), 0xff); GBL_TEST_CASE_END; } GBL_TEST_CASE(xch) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x33); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0xff); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x33); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0xff); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -2163,15 +2163,15 @@ GBL_TEST_CASE(xch) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0x33); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0x33); GBL_TEST_CASE_END; } GBL_TEST_CASE(xchInd) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x33); - EvmuMemory_writeInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xff); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x33); + EvmuMemory_writeData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1), 0xff); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -2181,14 +2181,14 @@ GBL_TEST_CASE(xchInd) { } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1)), 0x33); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EvmuMemory_indirectAddress(pFixture->pMemory, 1)), 0x33); GBL_TEST_CASE_END; } GBL_TEST_CASE(clr1) { - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x1); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x1); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_CLR1, @@ -2197,9 +2197,9 @@ GBL_TEST_CASE(clr1) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0x0); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0x0); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x80); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x80); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_CLR1, @@ -2208,13 +2208,13 @@ GBL_TEST_CASE(clr1) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0x00); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0x00); GBL_TEST_CASE_END; } GBL_TEST_CASE(set1) { - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x0); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SET1, @@ -2223,9 +2223,9 @@ GBL_TEST_CASE(set1) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0x1); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x00); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x00); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_SET1, @@ -2234,13 +2234,13 @@ GBL_TEST_CASE(set1) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0x80); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0x80); GBL_TEST_CASE_END; } GBL_TEST_CASE(not1) { - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x0); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_NOT1, @@ -2249,9 +2249,9 @@ GBL_TEST_CASE(not1) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0x1); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0x1); - EvmuMemory_writeInt(pFixture->pMemory, 0x23, 0x80); + EvmuMemory_writeData(pFixture->pMemory, 0x23, 0x80); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_NOT1, @@ -2260,39 +2260,39 @@ GBL_TEST_CASE(not1) { .direct = 0x23 } })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, 0x23), 0x0); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, 0x23), 0x0); GBL_TEST_CASE_END; } GBL_TEST_CASE(ldc) { - EvmuMemory_setExtSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); - EvmuMemory_writeExt(pFixture->pMemory, 0x123, 0x77); + EvmuMemory_setProgramSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); + EvmuMemory_writeProgram(pFixture->pMemory, 0x123, 0x77); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, 0x1); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, 0x23); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, 0x1); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, 0x23); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_LDC, })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x77); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x77); - EvmuMemory_setExtSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_ROM); - EvmuMemory_writeExt(pFixture->pMemory, 0x123, 0x33); + EvmuMemory_setProgramSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_ROM); + EvmuMemory_writeProgram(pFixture->pMemory, 0x123, 0x33); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, 0x1); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, 0x23); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, 0x1); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, 0x23); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_LDC, })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x33); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x33); GBL_TEST_CASE_END; } @@ -2316,16 +2316,16 @@ GBL_TEST_CASE(reti) { GBL_TEST_CASE(ldf) { EvmuMemory_writeFlash(pFixture->pMemory, 0x1abcd, 0x89); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, 0xab); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, 0xcd); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, 0xab); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, 0xcd); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_LDF, })); - GBL_TEST_COMPARE(EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x89); + GBL_TEST_COMPARE(EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC), 0x89); GBL_TEST_CASE_END; } @@ -2334,14 +2334,14 @@ static GBL_RESULT stfUnlockToState_(GblTestSuite* pSelf, EVMU_FLASH_PROGRAM_STAT GBL_CTX_BEGIN(pSelf); EvmuCpuTestSuite_* pFixture = EVMU_CPU_TEST_SUITE_(pSelf); - const EvmuWord oldTrh = EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH); - const EvmuWord oldTrl = EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL); - const EvmuWord oldAcc = EvmuMemory_readInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC); + const EvmuWord oldTrh = EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH); + const EvmuWord oldTrl = EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL); + const EvmuWord oldAcc = EvmuMemory_readData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC); if(state >= EVMU_FLASH_PROGRAM_STATE_0) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, (EVMU_FLASH_PROGRAM_STATE_0_ADDRESS & 0xff00)>>8); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, EVMU_FLASH_PROGRAM_STATE_0_ADDRESS & 0xff); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, EVMU_FLASH_PROGRAM_STATE_0_VALUE); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, (EVMU_FLASH_PROGRAM_STATE_0_ADDRESS & 0xff00)>>8); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, EVMU_FLASH_PROGRAM_STATE_0_ADDRESS & 0xff); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, EVMU_FLASH_PROGRAM_STATE_0_VALUE); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_STF, @@ -2349,9 +2349,9 @@ static GBL_RESULT stfUnlockToState_(GblTestSuite* pSelf, EVMU_FLASH_PROGRAM_STAT } if(state >= EVMU_FLASH_PROGRAM_STATE_1) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, (EVMU_FLASH_PROGRAM_STATE_1_ADDRESS & 0xff00)>>8); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, EVMU_FLASH_PROGRAM_STATE_1_ADDRESS & 0xff); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, EVMU_FLASH_PROGRAM_STATE_1_VALUE); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, (EVMU_FLASH_PROGRAM_STATE_1_ADDRESS & 0xff00)>>8); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, EVMU_FLASH_PROGRAM_STATE_1_ADDRESS & 0xff); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, EVMU_FLASH_PROGRAM_STATE_1_VALUE); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_STF, @@ -2359,18 +2359,18 @@ static GBL_RESULT stfUnlockToState_(GblTestSuite* pSelf, EVMU_FLASH_PROGRAM_STAT } if(state >= EVMU_FLASH_PROGRAM_STATE_2) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, (EVMU_FLASH_PROGRAM_STATE_2_ADDRESS & 0xff00)>>8); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, EVMU_FLASH_PROGRAM_STATE_2_ADDRESS & 0xff); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, EVMU_FLASH_PROGRAM_STATE_2_VALUE); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, (EVMU_FLASH_PROGRAM_STATE_2_ADDRESS & 0xff00)>>8); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, EVMU_FLASH_PROGRAM_STATE_2_ADDRESS & 0xff); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, EVMU_FLASH_PROGRAM_STATE_2_VALUE); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_STF, })); } - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, oldTrh); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, oldTrl); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, oldAcc); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, oldTrh); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, oldTrl); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, oldAcc); GBL_CTX_END(); } @@ -2380,13 +2380,13 @@ GBL_TEST_CASE(stf) { EvmuMemory_writeFlash(pFixture->pMemory, 0x1ab00+129, 0x76); // Configure flash address registers - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, 0xab); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, 0xcd); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRH, 0xab); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, 0xcd); // Write without being in system mode - EvmuMemory_setExtSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); + EvmuMemory_setProgramSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 0x0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { @@ -2395,7 +2395,7 @@ GBL_TEST_CASE(stf) { GBL_TEST_COMPARE(EvmuMemory_readFlash(pFixture->pMemory, 0x1ab00+129), 0x76); // Write without unlocking - EvmuMemory_setExtSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); + EvmuMemory_setProgramSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_STF, @@ -2403,8 +2403,8 @@ GBL_TEST_CASE(stf) { GBL_TEST_COMPARE(EvmuMemory_readFlash(pFixture->pMemory, 0x1ab00+129), 0x76); // Write at state 0 - EvmuMemory_setExtSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_ROM); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1|EVMU_SFR_FPR_UNLOCK_MASK); + EvmuMemory_setProgramSource(pFixture->pMemory, EVMU_MEMORY_EXT_SRC_ROM); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1|EVMU_SFR_FPR_UNLOCK_MASK); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_STF, @@ -2437,7 +2437,7 @@ GBL_TEST_CASE(stf) { // Write when done + unlocked but invalid start address GBL_TEST_CALL(stfUnlockToState_(pSelf, EVMU_FLASH_PROGRAM_STATE_2)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_STF, @@ -2445,12 +2445,12 @@ GBL_TEST_CASE(stf) { GBL_TEST_COMPARE(EvmuMemory_readFlash(pFixture->pMemory, 0x1ab00+129), 0x76); // Write successfully for 128 bytes - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1|EVMU_SFR_FPR_UNLOCK_MASK); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1|EVMU_SFR_FPR_UNLOCK_MASK); GBL_TEST_CALL(stfUnlockToState_(pSelf, EVMU_FLASH_PROGRAM_STATE_2)); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_FPR, 0x1); for(GblSize b = 0; b < 128; ++b) { - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, b); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, b); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, b); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, b); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_STF, @@ -2460,8 +2460,8 @@ GBL_TEST_CASE(stf) { } // Ensure 129th write FAILS - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, 129); - EvmuMemory_writeInt(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 129); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_TRL, 129); + EvmuMemory_writeData(pFixture->pMemory, EVMU_ADDRESS_SFR_ACC, 129); GBL_TEST_CALL(EvmuCpu_execute(pFixture->pDevice->pCpu, &(const EvmuDecodedInstruction) { .opcode = EVMU_OPCODE_STF, diff --git a/test/source/evmu_memory_test_suite.c b/test/source/evmu_memory_test_suite.c index 4251f5b..d5b9b8d 100644 --- a/test/source/evmu_memory_test_suite.c +++ b/test/source/evmu_memory_test_suite.c @@ -37,7 +37,7 @@ GBL_RESULT EvmuMemoryTestSuite_readIntInvalid_(GblTestSuite* pSelf, GblContext* EvmuMemoryTestSuite_* pSelf_ = EVMU_MEMORY_TEST_SUITE_(pSelf); GBL_TEST_EXPECT_ERROR(); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, 0xffff), 0); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, 0xffff), 0); GBL_TEST_COMPARE(GBL_CTX_LAST_RESULT(), GBL_RESULT_ERROR_OUT_OF_RANGE); GBL_CTX_CLEAR_LAST_RECORD(); @@ -50,33 +50,33 @@ GBL_RESULT EvmuMemoryTestSuite_writeIntInvalid_(GblTestSuite* pSelf, GblContext* EvmuMemoryTestSuite_* pSelf_ = EVMU_MEMORY_TEST_SUITE_(pSelf); GBL_TEST_EXPECT_ERROR(); - GBL_TEST_COMPARE(EvmuMemory_writeInt(pSelf_->pMemory, 0xffff, 0xff), + GBL_TEST_COMPARE(EvmuMemory_writeData(pSelf_->pMemory, 0xffff, 0xff), GBL_RESULT_ERROR_OUT_OF_RANGE); GBL_CTX_CLEAR_LAST_RECORD(); GBL_CTX_END(); } -GBL_RESULT EvmuMemoryTestSuite_readExtInvalid_(GblTestSuite* pSelf, GblContext* pCtx) { +GBL_RESULT EvmuMemoryTestSuite_readProgramInvalid_(GblTestSuite* pSelf, GblContext* pCtx) { GBL_CTX_BEGIN(pCtx); EvmuMemoryTestSuite_* pSelf_ = EVMU_MEMORY_TEST_SUITE_(pSelf); GBL_TEST_EXPECT_ERROR(); - GBL_TEST_COMPARE(EvmuMemory_readExt(pSelf_->pMemory, EVMU_FLASH_SIZE), 0x0); + GBL_TEST_COMPARE(EvmuMemory_readProgram(pSelf_->pMemory, EVMU_FLASH_SIZE), 0x0); GBL_TEST_COMPARE(GBL_CTX_LAST_RESULT(), GBL_RESULT_ERROR_OUT_OF_RANGE); GBL_CTX_CLEAR_LAST_RECORD(); GBL_CTX_END(); } -GBL_RESULT EvmuMemoryTestSuite_writeExtInvalid_(GblTestSuite* pSelf, GblContext* pCtx) { +GBL_RESULT EvmuMemoryTestSuite_writeProgramInvalid_(GblTestSuite* pSelf, GblContext* pCtx) { GBL_CTX_BEGIN(pCtx); EvmuMemoryTestSuite_* pSelf_ = EVMU_MEMORY_TEST_SUITE_(pSelf); GBL_TEST_EXPECT_ERROR(); - GBL_TEST_COMPARE(EvmuMemory_writeInt(pSelf_->pMemory, EVMU_FLASH_SIZE, 0xff), + GBL_TEST_COMPARE(EvmuMemory_writeData(pSelf_->pMemory, EVMU_FLASH_SIZE, 0xff), GBL_RESULT_ERROR_OUT_OF_RANGE); GBL_CTX_CLEAR_LAST_RECORD(); GBL_CTX_END(); @@ -87,13 +87,13 @@ GBL_RESULT EvmuMemoryTestSuite_ramBankChange_(GblTestSuite* pSelf, GblContext* p EvmuMemoryTestSuite_* pSelf_ = EVMU_MEMORY_TEST_SUITE_(pSelf); - const EvmuWord psw = EvmuMemory_viewInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_PSW); + const EvmuWord psw = EvmuMemory_viewData(pSelf_->pMemory, EVMU_ADDRESS_SFR_PSW); - EvmuMemory_writeInt(pSelf_->pMemory, 0x0, 0x1); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_PSW, psw & ~EVMU_SFR_PSW_RAMBK0_MASK); - GBL_TEST_COMPARE(EvmuMemory_viewInt(pSelf_->pMemory, 0x0), 0); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_PSW, psw | EVMU_SFR_PSW_RAMBK0_MASK); - GBL_TEST_COMPARE(EvmuMemory_viewInt(pSelf_->pMemory, 0x0), 1); + EvmuMemory_writeData(pSelf_->pMemory, 0x0, 0x1); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_PSW, psw & ~EVMU_SFR_PSW_RAMBK0_MASK); + GBL_TEST_COMPARE(EvmuMemory_viewData(pSelf_->pMemory, 0x0), 0); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_PSW, psw | EVMU_SFR_PSW_RAMBK0_MASK); + GBL_TEST_COMPARE(EvmuMemory_viewData(pSelf_->pMemory, 0x0), 1); GBL_CTX_END(); } @@ -103,23 +103,23 @@ GBL_RESULT EvmuMemoryTestSuite_extChange_(GblTestSuite* pSelf, GblContext* pCtx) EvmuMemoryTestSuite_* pSelf_ = EVMU_MEMORY_TEST_SUITE_(pSelf); - EvmuMemory_writeExt(pSelf_->pMemory, 0x1, 0x1); - EvmuMemory_setExtSource(pSelf_->pMemory, EVMU_MEMORY_EXT_SRC_ROM); - GBL_TEST_COMPARE(EvmuMemory_readExt(pSelf_->pMemory, 0x1), 0); - EvmuMemory_setExtSource(pSelf_->pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); - GBL_TEST_COMPARE(EvmuMemory_readExt(pSelf_->pMemory, 0x1), 1); + EvmuMemory_writeProgram(pSelf_->pMemory, 0x1, 0x1); + EvmuMemory_setProgramSource(pSelf_->pMemory, EVMU_MEMORY_EXT_SRC_ROM); + GBL_TEST_COMPARE(EvmuMemory_readProgram(pSelf_->pMemory, 0x1), 0); + EvmuMemory_setProgramSource(pSelf_->pMemory, EVMU_MEMORY_EXT_SRC_FLASH_BANK_0); + GBL_TEST_COMPARE(EvmuMemory_readProgram(pSelf_->pMemory, 0x1), 1); GBL_CTX_END(); } #if 0 static EVMU_RESULT setIrbk_(EvmuMemory* pSelf, GblBool irbk0, GblBool irbk1) { - EvmuWord psw = EvmuMemory_readInt(pSelf, EVMU_ADDRESS_SFR_PSW); + EvmuWord psw = EvmuMemory_readData(pSelf, EVMU_ADDRESS_SFR_PSW); psw &= ~(EVMU_SFR_PSW_IRBK0_MASK|EVMU_SFR_PSW_IRBK1_MASK); if(irbk0) psw |= EVMU_SFR_PSW_IRBK0_MASK; if(irbk1) psw |= EVMU_SFR_PSW_IRBK1_MASK; - return EvmuMemory_writeInt(pSelf, EVMU_ADDRESS_SFR_PSW, psw); + return EvmuMemory_writeData(pSelf, EVMU_ADDRESS_SFR_PSW, psw); } GBL_RESULT EvmuMemoryTestSuite_indirectAddressInvalid_(GblTestSuite* pSelf, GblContext* pCtx) { GBL_CTX_BEGIN(pCtx); @@ -127,7 +127,7 @@ GBL_RESULT EvmuMemoryTestSuite_indirectAddressInvalid_(GblTestSuite* pSelf, GblC EvmuMemoryTestSuite_* pSelf_ = EVMU_MEMORY_TEST_SUITE_(pSelf); for(uint8_t addr = 0; addr < 0xf; ++addr) { - EvmuMemory_writeInt(pSelf_->pMemory, addr, addr); + EvmuMemory_writeData(pSelf_->pMemory, addr, addr); } @@ -158,23 +158,23 @@ GBL_RESULT EvmuMemoryTestSuite_wramRead_(GblTestSuite* pSelf, GblContext* pCtx) GBL_CTX_BEGIN(pCtx); EvmuMemoryTestSuite_* pSelf_ = EVMU_MEMORY_TEST_SUITE_(pSelf); - const EvmuWord vsel = EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL); + const EvmuWord vsel = EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL); // Test with auto-increment + overflow - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL, vsel|EVMU_SFR_VSEL_INCE_MASK); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL, vsel|EVMU_SFR_VSEL_INCE_MASK); GBL_CTX_VERIFY_CALL(EvmuMemory_writeWram(pSelf_->pMemory, 0x1ff, 0xab)); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2, 0x1); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1, 0xff); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VTRBF), 0xab); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2), 0xfe); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1), 0x0); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2, 0x1); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1, 0xff); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VTRBF), 0xab); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2), 0xfe); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1), 0x0); // Test without auto increment - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL, vsel&~EVMU_SFR_VSEL_INCE_MASK); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL, vsel&~EVMU_SFR_VSEL_INCE_MASK); GBL_CTX_VERIFY_CALL(EvmuMemory_writeWram(pSelf_->pMemory, 0x00, 0xac)); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VTRBF), 0xac); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2), 0xfe); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1), 0x0); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VTRBF), 0xac); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2), 0xfe); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1), 0x0); GBL_CTX_END(); } @@ -196,24 +196,24 @@ GBL_RESULT EvmuMemoryTestSuite_wramWrite_(GblTestSuite* pSelf, GblContext* pCtx) GBL_CTX_BEGIN(pCtx); EvmuMemoryTestSuite_* pSelf_ = EVMU_MEMORY_TEST_SUITE_(pSelf); - const EvmuWord vsel = EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL); + const EvmuWord vsel = EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL); // Test with auto-increment + overflow - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL, vsel|EVMU_SFR_VSEL_INCE_MASK); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2, 0x1); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1, 0xff); - GBL_CTX_VERIFY_CALL(EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VTRBF, 0xcd)); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2), 0xfe); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1), 0x0); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL, vsel|EVMU_SFR_VSEL_INCE_MASK); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2, 0x1); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1, 0xff); + GBL_CTX_VERIFY_CALL(EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VTRBF, 0xcd)); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2), 0xfe); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1), 0x0); GBL_TEST_COMPARE(EvmuMemory_readWram(pSelf_->pMemory, 0x1ff), 0xcd); // Test without auto-increment - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL, vsel&~EVMU_SFR_VSEL_INCE_MASK); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2, 0x0); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1, 0x0); - GBL_CTX_VERIFY_CALL(EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VTRBF, 0xef)); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2), 0xfe); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1), 0x0); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VSEL, vsel&~EVMU_SFR_VSEL_INCE_MASK); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2, 0x0); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1, 0x0); + GBL_CTX_VERIFY_CALL(EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VTRBF, 0xef)); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD2), 0xfe); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SFR_VRMAD1), 0x0); GBL_TEST_COMPARE(EvmuMemory_readWram(pSelf_->pMemory, 0x0), 0xef); GBL_CTX_END(); @@ -225,7 +225,7 @@ GBL_RESULT EvmuMemoryTestSuite_xramBankChangeInvalid_(GblTestSuite* pSelf, GblCo EvmuMemoryTestSuite_* pSelf_ = EVMU_MEMORY_TEST_SUITE_(pSelf); GBL_TEST_EXPECT_ERROR(); - GBL_TEST_COMPARE(EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_XBNK, 3), + GBL_TEST_COMPARE(EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_XBNK, 3), GBL_RESULT_ERROR_OUT_OF_RANGE); GBL_CTX_CLEAR_LAST_RECORD(); @@ -237,16 +237,16 @@ GBL_RESULT EvmuMemoryTestSuite_xramBankChange_(GblTestSuite* pSelf, GblContext* EvmuMemoryTestSuite_* pSelf_ = EVMU_MEMORY_TEST_SUITE_(pSelf); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_XBNK, 0); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE, 1); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_XBNK, 1); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE), 0); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE, 2); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_XBNK, 2); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE), 0); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE, 3); - EvmuMemory_writeInt(pSelf_->pMemory, EVMU_ADDRESS_SFR_XBNK, 0); - GBL_TEST_COMPARE(EvmuMemory_readInt(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE), 1); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_XBNK, 0); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE, 1); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_XBNK, 1); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE), 0); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE, 2); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_XBNK, 2); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE), 0); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE, 3); + EvmuMemory_writeData(pSelf_->pMemory, EVMU_ADDRESS_SFR_XBNK, 0); + GBL_TEST_COMPARE(EvmuMemory_readData(pSelf_->pMemory, EVMU_ADDRESS_SEGMENT_XRAM_BASE), 1); GBL_CTX_END(); } @@ -258,8 +258,8 @@ GBL_EXPORT GblType EvmuMemoryTestSuite_type(void) { const static GblTestCase cases[] = { { "readIntInvalid", EvmuMemoryTestSuite_readIntInvalid_ }, { "writeIntInvalid", EvmuMemoryTestSuite_writeIntInvalid_ }, - { "readExtInvalid", EvmuMemoryTestSuite_readExtInvalid_ }, - { "writeExtInvalid", EvmuMemoryTestSuite_writeExtInvalid_ }, + { "readProgramInvalid", EvmuMemoryTestSuite_readProgramInvalid_ }, + { "writeProgramInvalid", EvmuMemoryTestSuite_writeProgramInvalid_ }, { "ramBankChange", EvmuMemoryTestSuite_ramBankChange_ }, { "extChanged", EvmuMemoryTestSuite_extChange_ }, { "wramReadInvalid", EvmuMemoryTestSuite_wramReadInvalid_ }, diff --git a/test/source/evmu_test_main.c b/test/source/evmu_test_main.c index f355dff..7323703 100755 --- a/test/source/evmu_test_main.c +++ b/test/source/evmu_test_main.c @@ -2,6 +2,7 @@ #include "evmu_memory_test_suite.h" #include "evmu_cpu_test_suite.h" #include "evmu_isa_test_suite.h" +#include #if defined(__DREAMCAST__) && !defined(NDEBUG) # include @@ -25,5 +26,5 @@ int main(int argc, char* pArgv[]) { GblTestScenario_unref(pScenario); - return GBL_RESULT_SUCCESS(result)? 0 : -1; + return GBL_RESULT_SUCCESS(result)? EXIT_SUCCESS : EXIT_FAILURE; }