Help with an Assembly Language program
I've been taking an IBM Assembly Language class and for our first program, I have to print the first ten numbers of the Fibonacci numbers (0, 1, 1, 2, 3, 5, 8, 13, 21, 34), yet the slides and sample programs don't make any sense to me, are there any tutorials or examples that are on the net that would help me? Also here is what I was able to make so far, based off one of the examples.
title sumNumbers Adds the first 10 number of fibonacci numbers
.model small
;---------------------------------------------------------------------
.data
number word 0 ; Starting integer and 1st fibonacci number
number2 word 1 ; 2nd number of Fibonacci
count word 10 ; Number of additions
type word 'Fibonocci' ; The type of numbers
;---------------------------------------------------------------------
.code
main proc far
mov ax,@data ; Initialize
mov ds,ax ; segment registers
mov cx,count ; Initialize to count 10 numbers
mov ax,number ; Move the first number to
CountNum:
inc ax ; Push ten numbers
push ax ; incrementally
inc bx ;
push bx ;
dec cx ; onto the
jnz CountNum ; stack
mov cx,count ; Initialize to add 10 numbers
mov ax,00 ; Zero-out registers
mov bx,00 ; used for addition
AddNum:
pop bx ; Restore value from stack
add ax,bx ; Add restored value to sum
dec cx ; One addition completed
jnz AddNum ; Keep adding until count=0
call decimal ; Display sum
mov ax,4c00h ; End
int 21h ; processing
;----------------------------------------------------------------------
DECIMAL PROC ;Converts contents of ax to
MOV SI,10 ; decimal and prints it
MOV CX,0
NONZERO: MOV DX,0
DIV SI
PUSH DX
INC CX
CMP AX,0
JNE NONZERO
DIGITLOOP: POP DX
ADD DL,30H
MOV AH,2
INT 21H
LOOP DIGITLOOP
RET
DECIMAL ENDP
;----------------------------------------------------------------------
main endp
end main