; Drawing Z On The Dot Matrix
CODE SEGMENT
ASSUME CS:CODE, DS:CODE, ES:CODE, SS:CODE

PPICR EQU 1EH	; control register
PPIC  EQU 1CH	; port C
PPIB  EQU 1AH	; port B
PPIA  EQU 18H	; port A

ORG 1000H

MOV AL,	80H 	; control word for all output 
OUT PPICR, AL

MOV AL, 0FFH	; send all ones to Port-A
OUT	PPIA, AL


DO:
    MOV BX,0
	
    MOV AL, DATA_C[BX]   ; enabling all the column in the specified rows
    OUT PPIC, AL
    MOV AL,DATA_A[BX]    ; enabling rows R0, R7 
	
    OUT PPIB, AL
 CALL TIMER
 INC BX
    MOV AL, DATA_C[BX]     ; enabling the first point on the Z
    OUT PPIC, AL 
    MOV AL, DATA_A[BX]
    
	OUT PPIB, AL
    CALL TIMER
 INC BX
 MOV AL, DATA_C[BX]	; enabling the second point on Z
    OUT PPIC, AL 
    MOV AL, DATA_A[BX]
    
	OUT PPIB, AL
CALL TIMER
    INC BX
	MOV AL, DATA_C[BX]    ; enabling the third point on Z
    OUT PPIC, AL 
    MOV AL, DATA_A[BX]
    
	OUT PPIB, AL
    CALL TIMER            
    INC BX
	MOV AL, DATA_C[BX]     ; enabling the fourth point on Z
    OUT PPIC, AL 
    MOV AL, DATA_A[BX]
    
	OUT PPIB, AL
    CALL TIMER
    INC BX
	MOV AL, DATA_C[BX]    ; enabling the fifth point on Z
    OUT PPIC, AL 
    MOV AL, DATA_A[BX]
    
	OUT PPIB, AL
    INC BX
    
	
          
    CALL TIMER
    JMP DO    
        
INT 3

PROC TIMER
	MOV CX, 0FFH	; this is a 16 bit counter
TIME: 
	NOP
	NOP	
	NOP
	NOP
LOOP TIME
RET

DATA_C DB 42H,46H,4AH,52H,64H,42H
DATA_A DB 0BFH,0DFH,0EFH,0F7H,0FBH,0FDH

CODE ENDS
END