;--------------------------------------------------------------- ; Program: Math *NASM Version* ; Summary: Attempt complicated math functions in ASM. ; Function: At the start of the program, you are given a ; choice as to which math function you wish to try. ; Simply follow the instructions and you will ; get your answer. ; ; Owner: Wolfman2000 ; Date: Changes ; 10/05/06 First version ;--------------------------------------------------------------- ;------------------------------- CPU 8086 ;8086 instructions only segment st stack ;define the stack segment with st resb 256 ;reserve 256 bytes for the stack extern stringOut ;------------------------------- segment .data ;Data segment ;------------------------------- welcome db "Choose your function.",13,10 db "1) Factorial",13,10 db "2) Prime Test",13,10 db "3) Quit",13,10,'$' ;The welcome message. A bit long. again db "Try again.",13,10,'$' goodbye db "Goodbye.",13,10,'$' ;The goodbye message. ;------------------------------- segment .text ;Code segment ;------------------------------- ..start mov ax,seg welcome ;establish addressability mov ds,ax ;done intro: mov dx,welcome ;Print out welcome call far stringOut ; I'm unsure of how to force putting in a number, and then ; having the user press ENTER. mov ah,1 int 21h ;read in the choice cmp al,3 ;Was it one? ja leaving ;stub: finish later. mov dx,again call far stringOut leaving: ;To be finished later mov dx,goodbye call far stringOut jmp intro Quit: mov ax,4c00h ;quit int 21h ;yep ---------------------------------------------------------------- CPU 8086 ; extern ..start ;------------------------------- segment .text ;------------------------------- ..start stringOut: mov ah,9 int 21h retf ----------------------------------------------------------------