Skip to content

Commit

Permalink
revert push16
Browse files Browse the repository at this point in the history
  • Loading branch information
koron committed Apr 19, 2024
1 parent 6474a92 commit 31f4e56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 0 additions & 7 deletions cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,6 @@ func (cpu *CPU) fetch16() uint16 {
return (uint16(h) << 8) | uint16(l)
}

func (cpu *CPU) push16(v uint16) {
cpu.SP--
cpu.Memory.Set(cpu.SP, uint8(v>>8))
cpu.SP--
cpu.Memory.Set(cpu.SP, uint8(v))
}

func (cpu *CPU) ioIn(addr uint8) uint8 {
if cpu.IO == nil {
return 0
Expand Down
8 changes: 6 additions & 2 deletions op_callret.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package z80

func oopCALLnn(cpu *CPU) {
copCALLnn(cpu, cpu.fetch16())
nn := cpu.fetch16()
copCALLnn(cpu, nn)
}

func oopRETI(cpu *CPU) {
Expand Down Expand Up @@ -35,7 +36,10 @@ func oopRET(cpu *CPU) {
// eXpanded OPration codes

func copCALLnn(cpu *CPU, nn uint16) {
cpu.push16(cpu.PC)
cpu.SP--
cpu.Memory.Set(cpu.SP, uint8(cpu.PC>>8))
cpu.SP--
cpu.Memory.Set(cpu.SP, uint8(cpu.PC))
cpu.PC = nn
}

Expand Down

0 comments on commit 31f4e56

Please sign in to comment.