;EXAM3.ASM
;DEMO LOOKUP TABLE and display on PORT1
;
	ORG	0000H		;LOAD IN 8000H
;

MAIN:	MOV	R5,#17		;LOAD COUNT OFF BYTE
	MOV	DPTR,#TABLE1	;LOAD TABLE POINTER
LOOP:	CLR	A
	MOVC	A,@A+DPTR
	MOV	P1,A
	LCALL	DELAY
	INC	DPTR		;INC POINTER
	DJNZ	R5,LOOP		;DEC COUNTER R3


	SJMP	MAIN

DELAY: 	MOV    R2,#8		;wait 0.8 sec
	LCALL  DTSEC		;call delay in 1/10 second input in R2
	RET

; ********** DTSEC SUB **********
; DELAY	1/10 SECOND
; IN  =	R2
; REG =	R2,R3,R4

DTSEC:	MOV	R3,#179
DTSEC1:	MOV	R4,#0
DTSEC2:	DJNZ	R4,DTSEC2
	NOP
	NOP
	DJNZ	R3,DTSEC1
	DJNZ	R2,DTSEC
	RET


TABLE1: DB     01111110B
	DB     10111101B
	DB     11011011B
	DB     11100111B
	DB     11101011B
	DB     11101101B
	DB     11101110B
	DB     11011111B
	DB     10111111B
	DB     01111111B
	DB     11111111B
	DB     00011111B
	DB     11000111B
	DB     11110001B
	DB     11111100B
	DB     11111110B
	DB     11111111B

END

