

; pre-processor directives; they do not add time
REFRESH_DATA	EQU	0x40
RSH_DAT		EQU	P1.0
RSH_CLK		EQU	P1.1
; ...

; refresh subroutine: here we start to calculate.
; I`ll comment line by letter and number of machine cycles of each command
RSH_MATRIX:
	MOV	R0,#REFRESH_DATA			; A - 1
RSH_NEXT_BYTE:
	MOV	A,@R0					; B - 1
	MOV	R7,#8					; C - 1
RSH_NEXT_BIT:
	CLR	RSH_CLK					; D - 1
	RRC	A					; E - 1
	MOV	RSH_DAT,C				; F - 2
	SETB	RSH_CLK					; G - 1
	DJNZ	R7,RSH_NEXT_BIT				; H - 2
	INC	R0					; I - 1
	CJNE	R0,#(REFRESH_DATA+20),RSH_NEXT_BYTE	; J - 2
	RET						; K - 2