Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Scrivere un programma assembly che:
- ;carichi da tastiera un vettore di 9 elementi,ogni elemento e' un digit
- ;Inserisca da tastiera una cifra
- ;conti le occorrenze della cifra nel vettore
- ;stampi a video il numero di occorrenze, se la cifra è presente nel vettore
- ;stampi a video il messaggio NON TROVATO, se la cifra non è presente
- ;nel vettore
- ; multi-segment executable file template.
- data segment
- ; add your data here!
- pkey db "press any key...$"
- msg1 db "inserire 9 elementi:" ,10,13, "$"
- msg2 db "inserire il valore da cercare:" ,10,13, "$"
- msg3 db "la cifra e' presente per " "volte $",10,13
- msg4 db "valore NON TROVATO",10,13
- vett db 9(0)
- val db (0)
- cont db (0)
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- ; add your code here
- lea dx,msg1
- mov ah,9
- int 21h
- mov si,0
- carica:mov ah,1
- int 21h
- cmp si,09
- je fine_carica
- mov vett[si],al
- inc si
- jmp carica
- fine_carica: lea dx,msg2
- mov ah,9
- int 21h
- xor ax,ax
- mov ah,1
- int 21h
- mov val,al
- mov si,0
- controllo:cmp vett[si],al
- je incrementa_vett
- inc cont
- jmp controllo
- incrementa_vett:
- inc si
- jmp controllo
- lea dx, pkey
- mov ah, 9
- int 21h ; output string at ds:dx
- ; wait for any key....
- mov ah, 1
- int 21h
- mov ax, 4c00h ; exit to operating system.
- int 21h
- ends
- end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment