SECTION .TEXT NAME="main" ORG 256

init:
	MOV A, #4
	MOV 32, A
	MOV A, #1
	MOV 33, A
	MOV A, #6
	MOV 34, A
	MOV A, #9
	MOV 35, A
	MOV A, #8
	MOV 36, A
	MOV A, #3
	MOV 37, A
	MOV A, #10
	MOV 38, A
	MOV A, #2
	MOV 39, A

	MOV A, #7
	MOV R 7, A

outer_loop:
	MOV A, #7
	MOV R 6, A
	MOV A, #32
	MOV R 0, A
	MOV A, #33
	MOV R 1, A

inner_loop:
	MOV A, @R 0
	SUBB A, @R 1
	JNC switch2
cont:
	INC R 0
	INC R 1

	DJNZ R 6, inner_loop	
	
	DJNZ R 7, outer_loop
end:
	NOP
	SLEEP

switch:
	MOV A, @R 0
	MOV R 2, A
	MOV A, @R 1
	MOV @R0, A
	MOV A, R 2
	MOV @R1, A
	JMP cont

switch2:
	XCH A, @R 0
	XCH A, @R 1
	XCH A, @R 0
	JMP cont
