mirror of
https://github.com/macocianradu/goboy.git
synced 2026-03-18 21:10:07 +00:00
added half carry flags
This commit is contained in:
10
cpu/operations/read_byte.go
Normal file
10
cpu/operations/read_byte.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package operations
|
||||
|
||||
func GetLowerByte(value uint16) byte {
|
||||
return (byte)(value)
|
||||
}
|
||||
|
||||
func GetHigherByte(value uint16) byte {
|
||||
return (byte)(value >> 8)
|
||||
}
|
||||
|
||||
25
cpu/operations/read_byte_test.go
Normal file
25
cpu/operations/read_byte_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReadLowerByte(t *testing.T) {
|
||||
SP := uint16(0x1234)
|
||||
|
||||
actual := GetLowerByte(SP)
|
||||
|
||||
if actual != 0x34 {
|
||||
t.Errorf("actual %v != expected %v", actual, true)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadUpperByte(t *testing.T) {
|
||||
SP := uint16(0x1234)
|
||||
|
||||
actual := GetHigherByte(SP)
|
||||
|
||||
if actual != 0x12 {
|
||||
t.Errorf("actual %v != expected %v", actual, true)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user