home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
PROGRAMM
/
CODE32.ZIP
/
EXAMPLE3.ASM
< prev
next >
Wrap
Assembly Source File
|
1993-01-09
|
2KB
|
60 lines
; This program prints the square root of a number you put on the command line.
;
; Link this one with ARGC32, and enable CCHEKSTR.
.386p
jumps
code32 segment para public use32
assume cs:code32, ds:code32, ss:code32
include start32.inc
include argc32.inc
public _main
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
; DATA
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
syntaxmsg db 'SYNTAX: EXAMPLE3 <hex number to root>$'
numbuf db 32 dup(0)
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
; CODE
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
include sqrt.rt
include pdosstr.rt
include putnumtm.rt
include strltu.rt
include strhtn.rt
;-----------------------------------------------------------------------------
exiterr:
mov edx,offset syntaxmsg
call _putdosmsg
jmp _exit
;═════════════════════════════════════════════════════════════════════════════
_main:
xor al,al ; get number string from command line
mov edx,offset numbuf
call _cchekstr
jc exiterr
call _strltu ; lower to uppercase cuz strhtn needz
call _strhtn ; it that way
call _sqrt
mov cl,7
call _putnumtomem
call _putdosstr ; buffer was all zeros before, so its
; already zero-terminated
jmp _exit
code32 ends
end