; jmp_test.asm
; increase on test
	FIM R0R1, 0      ; initialize: R0=0, R1=0
begin:
	JMS display      ; display value on ROM I/O pins

	JMS checkTest    ; check test-signal
	JCN Z, begin     ; no test, next iteration

	INC R0           ; increase Register 0

	LDM 1            ; 1 into accumulator
	XCH R1           ; store 1 in Register 1
	JUN begin        ; next iteration


; subroutine to check the test input
checkTest:
	JCN T, test      ; conditional jump if test
	LDM 0            ; 0 into accumulator
	XCH R1           ; store 0 in Register 1
	BBL 0            ; return zero: no inc
test: 
	LD R1            ; load Register 1
	JCN Z, newTest   ; signal is new
	BBL 0            ; inc
newTest:
	BBL 1            ; no inc

; copy contents of R1 onto ROM output port pins
;
display:
	FIM R2R3, 0
	SRC R2R3	
	LD R0
	WRR		 ; write to ROM output pins
	BBL 0
