0% found this document useful (0 votes)
14 views4 pages

Assembly Code for Hexadecimal Display

The document contains assembly code that initializes a counter and outputs hexadecimal digits to two ports, PORTA and PORTB. It uses a loop to display each digit from a predefined font array, with a delay between outputs. The program is structured with segments and includes a delay routine for timing control.

Uploaded by

afura369
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views4 pages

Assembly Code for Hexadecimal Display

The document contains assembly code that initializes a counter and outputs hexadecimal digits to two ports, PORTA and PORTB. It uses a loop to display each digit from a predefined font array, with a delay between outputs. The program is structured with segments and includes a delay routine for timing control.

Uploaded by

afura369
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

PORTA EQU 0FFF9H

PORTB EQU 0FFFBH

CNT EQU 0FFFFH

CODE SEGMENT

ASSUME CS:CODE, DS:CODE

ORG 00

START: MOV DX, CNT

MOV AL, 80H

OUT DX, AL

J1: MOV CL, 100

MOV SI, OFFSET FONT

MOV CH, 0

J2: MOV AL, CH


MOV BL, 10

DIV BL ; AL= AL/10 AH= AL%10

PUSH AX

MOV AH, 0

MOV SI, AX

MOV AL, 01H

MOV DX, PORTB

OUT DX, AL

MOV AL, [SI]

MOV DX, PORTA

OUT DX, AL ; FIRST DIGIT

CALL DELAY

MOV AL, 02H

MOV DX, PORTB

OUT DX, AL

POP AX

MOV AL, 0

MOV SI, AX

MOV AL, [SI]

MOV DX, PORTA

OUT DX, AL ; SECOND DIGIT

CALL DELAY
INC CH

DEC CL

JNZ J2

DELAY : MOV CX, 0FFFFH

LOOP $

; PGFEDCBA

FONT DB 11000000B ;HEXA0

DB 11111001B ;HEXA1

DB 10100100B ;HEXA2

DB 10110000B ;HEXA3

DB 10011001B ;HEXA4

DB 10010010B ;HEXA5

DB 10000010B ;HEXA6

DB 11011000B ;HEXA7

DB 10000000B ;HEXA8

DB 10010000B ;HEXA9

DB 10001000B ;HEXA A

DB 10000011B ;HEXA B

DB 11000110B ;HEXA C
DB 10100001B ;HEXA D

DB 10000110B ;HEXA E

DB 10001110B ;HEXA F

CODE ENDS

END START

You might also like