This commit is contained in:
Sid 2020-10-17 11:41:11 +01:00
parent edac661d26
commit 1f526b5331
2 changed files with 5 additions and 6 deletions

View File

@ -1,8 +1,8 @@
package chip8
import (
"math/rand"
"fmt"
"math/rand"
)
const graphicsBufferSize = 64 * 32
@ -349,7 +349,7 @@ func (cpu *Chip8) UpdateKeys(newKeys [16]byte) {
}
func (cpu *Chip8) PerformCycle() {
cpu.opcode = (uint16(cpu.memory[cpu.pc]) << 8) + uint16(cpu.memory[cpu.pc + 1])
cpu.opcode = (uint16(cpu.memory[cpu.pc]) << 8) + uint16(cpu.memory[cpu.pc+1])
cpu.pc += 2
switch cpu.opcode >> 12 {
case 0:
@ -386,4 +386,3 @@ func (cpu *Chip8) PerformCycle() {
cpu.fifteenIndexOpcodes()
}
}

View File

@ -1,13 +1,13 @@
package main
import (
"fmt"
"git.jacknet.io/S.D/Chip-8_Go/chip8"
"fmt"
)
)
func main() {
prog := make([]byte, 6)
cpu := chip8.NewCHIP8(prog)
cpu.PerformCycle()
fmt.Printf("This should print out zero: %d!\n", cpu.GetGraphicsBuffer()[0])
}
}