Albiet, this isn't specifically for a Mac, its something I'm working on for an intro to assembly class. I'm working on a program to recursively generate fibonacci numbers, and here's what I have so far...
Its giving me all kinds of errors (if I do it in protected mode, it won't let me write to [bx], now its giving me errors everywhere, including there, and multiple other lines. Anybody have any suggestions or pointers?
Code:
TITLE Fibonacci
; Richard
; Feb 20, 2007
.model small
.386
.stack 4096
.DATA
array DWORD 30 DUP(0)
INCLUDE Irvine16.inc
.code
main PROC
mov ax,@data
mov ds,ax
mov BX, OFFSET array
mov [bx],0
add bx, 4
mov [bx],1
sub bx,4
mov cx,0
call fib
mov ax, 4C00H ; setup
int 21H ; return to DOS
ReturnMain:
call WriteDec
call Crlf
exit
main ENDP
fib PROC
mov dx,[bx]
mov cx,[bx+4]
add cx,dx
mov [bx+8],cx
add bx,4
cmp ax,30
jnz L1
L1: inc cx
call fib
fib ENDP
END main
Its giving me all kinds of errors (if I do it in protected mode, it won't let me write to [bx], now its giving me errors everywhere, including there, and multiple other lines. Anybody have any suggestions or pointers?