home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Jason Aller Floppy Collection
/
123.img
/
TASM.ZIP
/
SQRETBLE.C
< prev
next >
Wrap
Text File
|
1988-10-31
|
614b
|
17 lines
/* Table of square values */
asm SquareLookUpTable label word;
asm dw 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100;
/* Function to look up the square of a value between 0 and 10 */
int LookUpSquare(int Value)
{
asm mov bx,Value; /* get the value to square */
asm shl bx,1; /* multiply it by 2 to look*/
/* up in a table of*/
/* word-sized elements */
asm mov ax,[SquareLookUpTable+bx]; /* look up the square */
return(_AX); /* return the result */
}