Search
 
SCRIPT & CODE EXAMPLE
 

ASSEMBLY

assembly fibonacci

org 100h

jmp start

;	setting vars
num1 dw 1
num2 dw 1

start:
  
mov 	cx, 20 ;	counter (for the Fibonacci function)
mov 	ax, num1
;	print twice to get "1 1 " at the start of the run     

Fibonacci:
    mov 	bx, num1
    add 	bx, num2
    mov 	dx, bx
    mov 	bx, num1
    mov 	num2, bx
    mov 	bx, dx
    mov 	num1, bx

    ;	this part is for printing ax you dont have to mov dx into ax...
    ;			dx = ax = current fibonacci number
    ;mov ax, dx
    ;	use print function!!

loop Fibonacci  ; loop for 20 times

mov ah, 0
int 16h
ret
Comment

PREVIOUS NEXT
Code Example
Assembly :: press button on enter 
Assembly :: x86 assembly hello world 
Assembly :: install retroarch on Linux 
Assembly :: include code in latex 
Assembly :: how to import servo library in arduino 
Assembly :: cout boolalpha 
Assembly :: re optional 
Assembly :: nano error reading lock file not enough data read 
Assembly :: pytorch list gpus 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: chart js remove grid 
Javascript :: datatables remove pagination 
Javascript :: angular current year 
Javascript :: window.reload 
Javascript :: Basic JavaScript: Use Recursion to Create a Countdown 
Javascript :: jquery only number allowed to 10 digit 
Javascript :: jquery selector input by type 
Javascript :: vuex-module-decorators rawError globally 
Javascript :: city regex pattern 
Javascript :: get current url js 
Javascript :: regex remove html tags 
Javascript :: js loop array backwards 
Javascript :: Consider using the "jsdom" test environment. 
Javascript :: js reload iframe 
Javascript :: react-native italics 
Javascript :: moment format datetime postgresql 
Javascript :: Drupal 8 get page node current path 
Javascript :: installing jQuery in react js 
Javascript :: js even or 
Javascript :: breakline in react native 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =