Limbaj de Asamblare - Cod

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

.

model small
.stack 1024
.data
vector db 50 dup ('$')
layer1 db '[----------------MENU--------------------]',0ah, 0dh, '$'
layer2 db '[----------------------------------------]',0ah, 0dh, '$'
menu1 db '[
1. Citire numar
]', 0ah, 0dh, '$'
menu2 db '[
2. Citire lungime vector ]', 0ah, 0dh,'$'
menu3 db '[
3. Citire vector
]', 0ah, 0dh, '$'
menu4 db '[
4. Cautare numar in vector ]', 0ah, 0dh, '$'
menu5 db '[
5. Info
]', 0ah, 0dh, '$'
menu6 db '[
6. Exit
]',0ah, 0dh, '$'
menu7 db '[
7. Afisare nr
]',0ah, 0dh, '$'
info db 'Autor: eu', 0ah, 0dh, '$'
submenu db 'Introduceti numarul: ',0ah, 0dh, '$'
submenu1 db 'Introduceti un numar: ',0ah, 0dh, '$'
submenu2 db 'Nu s-a gasit numarul!', 0ah, 0dh, '$'
submenu3 db 'Am gasit numarul in vector!',0ah, 0dh, '$'
msg db 'Introduceti un vector: ', 0ah, 0dh, '$'
msg2 db 'Numarul este:', 0ah,0dh, '$'
msg3 db 'Introduceti lungimea vectorului:', 0ah,0dh, '$'
newline db 0ah, 0dh, '$'
.code
mov ax, dgroup
mov ds,ax
mov ah , 09h
mov dx, offset layer1
int 21h
; meniu1
mov ah , 09h
mov dx , offset meniu1
int 21 h
; meniu1
mov ah , 09h
mov dx , offset meniu1
int 21 h
; meniu1
mov ah , 09h
mov dx , offset meniu1
int 21 h
; meniu1
mov ah , 09h
mov dx , offset meniu1
int 21 h
start:
mov ah, 08h

int 21h
cmp al, '1'
je op1
cmp al, '2'
je op2...
....
jne default
jmp start
op1 :
mov ah , 09h
mov dx , offset submeniu1
int 21h
mov ah , 01h
int 21h
call citire_nr
call newline
int 21h
jmp start
op2:
mov ah , 09h
mov dx, offset newline
mov ah , 09h
mov dx, offset msg3
int 21h
mov
int
mov
mov
jmp

ah, 08h
21h
lung_vector , al
dx , offset lung_vector
start

default:
call newline
mov ah,9h
mov dx, offset defaul1
int 21h
jmp start
op 3:
mov ah,09h
mov dx, offset newline
int 21h
mov ah,09h
mov dx, offset msg
int 21h
mov ah,01h
int 21h
call citire_vector
mov ah, 09h

mov dx, offset newline


int 21h
jmp start
op4:
mov ah, 09h
mov dx, offset newline
int 21h
mov si, offset vector
mov al, car
call cautare_char
jmp start

op7:
mov ah, 09h
mov dx, offset msg2
int 21h
mov si, offset nr
call afisare_nr
jmp start
proc citire_nr
mov nr, al
sub nr, 30h
int 21h
ret 2
citire_nr endp
proc afisare_nr
mov ah, 09h
mov dx, si
int 21h
ret 2
afisare_nr endp
proc citire_vector
mov vector[0], 48
lea dx, vector
mov ah,0ah
int 21h
mov ch, 0
mov cl, vector[1]
add cx, 5
mov si, cx
mov vector[si], '$'
ret
citire_vector endp
proc cautare_char ;{
mov ah, 9
mov dx, offset submenu
int 21h

mov ah, 01h


int 21h
mov car, al
mov si, 2
mov bl, car
cautare_car:
cmp vector[si], '$'
je op3_nu_e
cmp vector[si], bl
je op3_da
inc si
jmp cautare_car
op3_nu_e:
mov ah, 09h
mov dx, offset newline
int 21h
mov ah, 9
mov dx, offset submenu2
int 21h
jmp start
op3_da:
mov ah, 09h
mov dx, offset newline
int 21h
mov ah, 9
mov dx, offset submenu3
int 21h
jmp start ;}
cautare_char endp
end

You might also like