Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Write a program that writes into a vector of 20 DW elements, the first numbers of Fibonacci series
- ;Fibonacci series: –vet[i] = vet[i-1] + vet[i-2] => vet = 1, 1, 2, 3, 5, 8, …
- DIM EQU 20
- .MODEL small
- .STACK
- .DATA
- vett DW DIM DUP ?
- temp DW ?
- .CODE
- .START
- MOV CX,0
- MOV DI,0
- MOV AX,0
- MOV BX,1
- MOV vett[DI],1
- ADD DI,2
- ciclo:
- ADD AX,BX
- MOV vett[DI],AX
- MOV AX,BX
- MOV BX,vett[DI]
- ADD DI,2
- INC CX
- CMP CX,DIM
- JNE ciclo
- ;Program is right, but I don't print because when I print numbers with more digits,
- ;so numbers after 9, it considers other
- ;characters of ASCII code, since I write MOV DL,'0',
- ;and into ASCII code the numbers arriving up to 9.
- .EXIT
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement