diff --git a/internal/vm/exec_funcs.go b/internal/vm/exec_funcs.go index 169d6ce..57b9e35 100644 --- a/internal/vm/exec_funcs.go +++ b/internal/vm/exec_funcs.go @@ -330,6 +330,15 @@ func execBPL(a *Appleone, o op) error { return nil } +// branch on C = 1 N Z C I D V +// - - - - - - +func execBCS(a *Appleone, o op) error { + if a.getCarry() != 0 { + a.branch(o) + } + return nil +} + // X - M N Z C I D V // + + + - - - func execCPX(a *Appleone, o op) error { diff --git a/internal/vm/opcodes.go b/internal/vm/opcodes.go index ea87c3c..9178632 100644 --- a/internal/vm/opcodes.go +++ b/internal/vm/opcodes.go @@ -336,7 +336,7 @@ var opcodes = map[uint8]op{ // addressing assembler opc bytes cyles // -------------------------------------------- // relative BCS oper B0 2 2** - 0xB0: newOp("BCS", 0xB0, 2, relative, todo), + 0xB0: newOp("BCS", 0xB0, 2, relative, execBCS), // CPX Compare Memory and Index X // addressing assembler opc bytes cyles