Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea/*
*.exe
7 changes: 3 additions & 4 deletions devices/intel8086/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ func INSTR_JMP_FAR_M16(core *CpuCore) {
// core.registers.CS.Base = uint32(segment) << 4
core.flags.IsFarJump = true

core.logInstruction(fmt.Sprintf("[%#04x] JMP %s (dst=%#04x:%#04x)",
core.GetCurrentlyExecutingInstructionAddress(), addrName, addrName))
core.logInstruction(fmt.Sprintf("[%#04x] JMP %s (JMP_FAR_M16)",
core.GetCurrentlyExecutingInstructionAddress(), addrName))
return
} else if addrMode == ADR_TYPE_INDIRECT {
// Read the offset (IP) and segment (CS) from memory
Expand Down Expand Up @@ -230,10 +230,9 @@ func INSTR_JMP_NEAR_REL16(core *CpuCore) {
}

func INSTR_CALL_NEAR_REL16(core *CpuCore) {

// Get the current IP and read the offset
currentIP := core.GetIP()
offset, err := core.readImm16()
offset, err := core.memoryAccessController.ReadMemoryValue16(uint32(core.GetCurrentCodePointer()) + 1)

// Calculate the address after the instruction and the destination address
nextIP := currentIP + 3 // Size of this CALL instruction
Expand Down
2 changes: 1 addition & 1 deletion devices/io/IOPortAccessController.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (r *IOPortAccessController) WriteAddr8(port_addr uint16, value uint8) {
return
}

log.Println("Unhandled IO port write: PORT=[%#04x], value=%#02x", port_addr, value)
log.Printf("Unhandled IO port write: PORT=[%#04x], value=%#02x\n", port_addr, value)
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/mov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func Test_MovTests(t *testing.T) {
testPc.GetMemoryController().UnlockBootVector()

testPc.GetPrimaryCpu().SetCS(0x0)
testPc.GetPrimaryCpu().SetIP(1)
testPc.GetPrimaryCpu().SetIP(0)

instructions := []uint8{0xb8, 0x00, 0x90, 0x8E, 0xD8}

Expand All @@ -35,7 +35,7 @@ func Test_MovDecodeOperandSizeOverridePrefix(t *testing.T) {
testPc.GetMemoryController().UnlockBootVector()

testPc.GetPrimaryCpu().SetCS(0x0)
testPc.GetPrimaryCpu().SetIP(1)
testPc.GetPrimaryCpu().SetIP(0)

instructions := []uint8{0x66, 0x25, 0xFF, 0xFF, 0xFF, 0x9F}

Expand Down
2 changes: 1 addition & 1 deletion tests/simple_cpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func Test_DoCpuTest(t *testing.T) {
testPc.GetMemoryController().UnlockBootVector()

testPc.GetPrimaryCpu().SetCS(0x0)
testPc.GetPrimaryCpu().SetIP(1)
testPc.GetPrimaryCpu().SetIP(0)

instructions := []uint8{0xf, 0x20, 0xc0, 0x66, 0x25, 0xff, 0xff, 0xff, 0x9f, 0xf, 0x22, 0xc0, 0xff, 0xe7, 0xf, 0x1, 0xe0}

Expand Down