@@ -549,7 +549,19 @@ def op_out(self, port: int, rr: int):
549549 val = self .read_reg (rr )
550550 self .write_ram (port , val )
551551
552- def op_jmp (self , label : str ):
552+ def op_jmp (self , label : str | int ):
553+ """Jump to a given label or numeric address by updating the program counter.
554+
555+ This operation sets the CPU's program counter (self.pc) to the target address minus one.
556+ The subtraction of one accounts for the fact that the instruction dispatcher will typically
557+ increment the program counter after the current instruction completes.
558+
559+ Args:
560+ label (str | int): The jump target. If a string, it is treated as a symbolic label
561+ and looked up in self.labels to obtain its numeric address. If an int (or any
562+ value convertible to int), it is used directly as the numeric address.
563+ """
564+
553565 if isinstance (label , str ):
554566 if label not in self .labels :
555567 raise KeyError (f"Label { label } not found" )
@@ -893,6 +905,28 @@ def op_brcc(self, label: str):
893905 if not c :
894906 self .op_jmp (label )
895907
908+ def op_brge (self , label : str | int ):
909+ """BRGE - Branch if Greater or Equal (Signed)
910+
911+ Args:
912+ label: Destination label or address to jump to if the condition is met.
913+ """
914+
915+ s = self .get_flag (SREG_S )
916+ if not s :
917+ self .op_jmp (label )
918+
919+ def op_brlt (self , label : str | int ):
920+ """BRLT - Branch if Less Than (Signed).
921+
922+ Args:
923+ label: Destination label or address to jump to if the condition is met.
924+ """
925+
926+ s = self .get_flag (SREG_S )
927+ if s :
928+ self .op_jmp (label )
929+
896930 def op_push (self , rr : int ):
897931 """Push a register value onto the stack.
898932
0 commit comments