commit 08e08e853d71c29b0681abbf6243e0b2ebcf2598
parent c1db0edcf7bcd06de946dd26d5e2bd66a33ff952
Author: Gabriel G. de Brito <gabrielgbrito@icloud.com>
Date: Fri, 19 Apr 2024 12:59:42 -0300
Added break to Sagui's test
Diffstat:
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/sagui/sagui.go b/sagui/sagui.go
@@ -133,7 +133,6 @@ func (m *Sagui) NextInstruction() (*machine.Call, error) {
case 0x5:
m.SetMemory(rbv, uint8(rav))
case 0x6:
- //fmt.Printf("%b (op %b) (ra %b) (rb %b)\n", instr, op, ra, rb)
m.SetRegister(uint64(ra), rbv)
case 0x7:
m.SetRegister(0, uint64(imm<<4)|(r0v&0xf))
diff --git a/sagui/sagui_test.go b/sagui/sagui_test.go
@@ -3,6 +3,8 @@ package sagui
import (
_ "embed"
"testing"
+
+ "github.com/gboncoffee/egg/machine"
)
//go:embed test.asm
@@ -106,4 +108,9 @@ func TestSagui(t *testing.T) {
assertRegister(1, 0, "zeroing r1 to be sure")
m.NextInstruction()
assertRegister(1, 0xa, "ld")
+
+ call, _ := m.NextInstruction()
+ if call == nil || call.Number != machine.SYS_BREAK {
+ t.Fatalf("Break failed: %v", call)
+ }
}
diff --git a/sagui/test.asm b/sagui/test.asm
@@ -65,3 +65,6 @@
; Zero r1 to be sure.
sub r1, r1
ld r1, r0
+
+ ; Finally, the "break".
+ movr r0, r0