Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

8086 program logic..

Status
Not open for further replies.

Srivatsa

New Member
Guys, i have mup lab exam this monday and i need to understand the logic of the following program- An ALP to alternatively display FIRE and HELP with flickering effects on a 7 segment display... i have typed the program below, please help me out with the logic...( pawrite, pbwrite etc are procedures used which are defined in separate program, i have typed that also after the ain program).I have also attached the same program in asm format too just incase for any use(p4b.asm is the main file, iolib.asm is the file containing procedure definitions)...

;PROGRAM TO DISPLAY FIRE & HELP ALTERNATIVELY WITH FLICKERING EFFECTS ON A 7-SEGMENT DISPLAY ------>


assume cs:code,ds:data
data segment
FIRE db 71h,06h,77h,79h
HELP db 76h,79h,38h,73h
save1 dw 0ffffh
save dw 1 dup(?)
save2 dw 0ffffh
data ends

code segment
extrn pawrite:far
extrn crwrite:far
extrn pbwrite:far
extrn keypress:far

start:mov ax,data
mov ds,ax
xor ax,ax
mov al,80h
call crwrite
xor bx,bx
xor cx,cx
xor dx,dx
mov dx,0ffffh

label2:
mov cx,04h
lea si,HELP
mov bl,0feh

label1:
mov al,00h
mov save,dx
call pawrite
mov dx,save
mov al,bl
rol bl,01h
mov save,dx
call pbwrite
mov dx,save
mov al,[si]
inc si
mov save,dx
call pawrite
mov dx,save
dec cl
cmp cl,00h
jg label1
dec dx
cmp dx,00h
jl label2
xor bx,bx
xor cx,cx
xor dx,dx
mov dx,0ffffh

label4:
mov cx,04h
lea si,FIRE
mov bl,0feh

label3:
mov al,00h
mov save,dx
call pawrite
mov dx,save
mov al,bl
rol bl,01h
mov save,dx
call pbwrite
mov dx,save
mov al,[si]
inc si
mov save,dx
call pawrite
mov dx,save
dec cl
cmp cl,00h
jg label3
dec dx
cmp dx,00h
jl label4
call keypress
jmp start
mov ah,4ch
int 21h
code ends
end start

;**************************************************************************

;PROGRAM CONTAINING PROCEDURES OF PAWRITE,PBWRITE etc..


.model small
.data
port equ 378h
status equ 379h
control equ 37ah
.stack 500h
.code
mov ax,@data
mov ds,ax
mov es,ax

public crwrite
crwrite proc
mov dx,port
out dx,al
push ax
mov bx,control
mov al,05h
out dx,al
mov dx,control
mov al,04h
out dx,al
pop ax
ret
crwrite endp

public pawrite
pawrite proc
mov dx,port
out dx,al
push ax
mov dx,control
mov al,03h
out dx,al
mov dx,control
mov al,02h
out dx,al
pop ax
ret

pawrite endp

public pbwrite
pbwrite proc
mov dx,port
out dx,al
push ax
mov dx,control
mov al,00h
out dx,al
pop ax
ret
pbwrite endp

public pcwrite
pcwrite proc
mov dx,port
out dx,al
push ax
mov dx,control
mov al,07h
out dx,al
mov dx,control
mov al,06h
out dx,al
pop ax
ret
pcwrite endp

public paread
paread proc
mov dx,control
mov al,2ah
out dx,al
mov dx,port
in al,dx
ret
paread endp


public pbread
pbread proc
mov dx,control
mov al,28h
out dx,al
mov dx,port
in al,dx
ret
pbread endp

public pcread
pcread proc
mov dx,control
mov al,2eh
out dx,al
mov dx,port
in al,dx
ret
pcread endp


delay proc
push cx
push ax
back: mov cx,0fffeh
back1: mov ax,00ffh
dec ax
jnz back1
loop back
pop ax
pop cx
ret
delay endp


public keypress
keypress proc
push ax
mov ah,06h
mov dl,0ffh
int 21h
cmp al,00
jne en
pop ax
ret

en:
mov ah,4ch
int 21h
keypress endp
end
;***********************************************************************

Guys, please help me with the logic.. Its very important and urgent.. Please help me out :( :(
Thanks in advance.. :)
 
A short deadline, uncommented code complete with magic numbers and no circuit diagram. A reverse engineering nightmare.
 
Status
Not open for further replies.

Latest threads

Back
Top