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
Are there any code examples left?
New code examples in category Assembly
-
Assembly 2022-03-27 17:40:42 create your own macro in assembly language
-
Assembly 2022-03-22 20:55:01 printf format specifiers c
-
Assembly 2022-03-20 06:00:11 how to listen for changes on an ObservableMap
-
Assembly 2022-03-11 19:40:11 vundle vim-javascript
-
Assembly 2022-03-01 07:30:06 restart kde
-
Assembly 2022-02-24 11:00:40 assembly print
-
Assembly 2022-02-16 02:15:03 vim shortcuts keyboard code
-
Assembly 2022-02-12 22:50:25 hello world x64 assembly
-
Assembly 2022-02-02 18:11:11 cout boolalpha