started op table

This commit is contained in:
radumaco
2025-04-19 22:26:59 +02:00
parent d26e6b7436
commit 28243ac5d5
11 changed files with 246 additions and 1 deletions

48
cpu/functions.go Normal file
View File

@@ -0,0 +1,48 @@
package cpu
import (
"radu.macocian.me/goboy/cpu/operations"
"radu.macocian.me/goboy/memory"
)
type op_context struct {
cpu CPU_struct
addr uint
}
func Noop(context op_context) {
return
}
// LDBCd16 Load the 2 bytes of immediate data into register pair BC.
func LDBCd16(context op_context) {
operations.LD(&context.cpu.C, memory.Read8(context.addr))
operations.LD(&context.cpu.B, memory.Read8(context.addr+8))
}
// LDBCa Store the contents of register A in the memory location specified by register pair BC.
func LDBCa(context op_context) {
operations.LDInMemory8(context.cpu.BC(), context.cpu.A)
return
}
// INCBC Increment the contents of register pair BC by 1.
func INCBC(context op_context) {
operations.INC16(&context.cpu.B, &context.cpu.C)
return
}
// INCB Increment the contents of register B by 1.
func INCB(context op_context) {
operations.INC(&context.cpu.B)
}
// DECB Decrement the contents of register B by 1.
func DECB(context op_context) {
operations.DEC(&context.cpu.B)
}
// LD8B Load the 8-bit immediate operand d8 into register B.
func LD8B(context op_context) {
operations.LD(&context.cpu.B, memory.Read8(context.addr))
}