﻿;***********************************************
;* MDA-8086 Dot-Matrix EXPERIMENT			* 
;* 											*
;* “Scrolling a vertical line of 8-lit LEDs” * 
;***********************************************
;
; FILENAME : MATRIX_1.ASM
; PROCESSOR : I8086

CODE SEGMENT
ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE ;
; Task-1: write the address values you have calculated in the pre-lab 
; section for PPI ports B,C, & Control Reg.
PPIC_C EQU 1EH		; control register
PPIC EQU 1CH
PPIB EQU 1AH
PPIA EQU 18H

ORG 1000H 
MOV AL,10000000b ; Task-2: write the value of the control word
OUT PPIC_C,AL ;

MOV AL,0ffH
OUT PPIA,AL
MOV AL,0ffH 
OUT PPIB,AL

mov dl,00000001b

Lable2:
mov si,0ffffh
Lable1:
inc si
mov bx,0
L1: 
MOV AL,BYTE PTR [Data+bx]
inc BX
add bx,si
inc si
OUT PPIB,AL
MOV AL,DL
OUT PPIC,AL
ROL AL,1
MOV DL,AL

L2:
CALL TIMER 
CLC
cmp si,8
je Lable2
CMP BX,8
JE Lable1
JMP L1 ;
INT 3 ;
TIMER: MOV CX,0FFFFH; this is a 16 bit counter 
TIMER1: NOP
NOP 
NOP
NOP 
LOOP TIMER1
RET ;


DATA: 
DB 11111111B ; the left most column. All dots are off 
DB 10000001B ; the next column with the top 2 dots being off 
DB 11011111B 
DB 11101111B 
DB 11101111B 
DB 11011111B 
DB 10000001B 
DB 11111111B ; the right most column

CODE ENDS 
END