added half carry flags

This commit is contained in:
radumacocian
2025-06-30 14:34:58 +02:00
parent e323266814
commit 5f6ee58378
4 changed files with 57 additions and 7 deletions

View File

@@ -0,0 +1,10 @@
package operations
func GetLowerByte(value uint16) byte {
return (byte)(value)
}
func GetHigherByte(value uint16) byte {
return (byte)(value >> 8)
}

View 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)
}
}