# 80-Bus News

## May–June 1983, Volume 2, Issue 3

The workings of NASCOM ROM BASIC Ver 4.7

PAGE 16

LOG

F6C7

LOG(X) routine. Get LOG of FPREG.
Scale the number to be between 0 and 1.
Add SQR(1/2) to value.
Divide into SQR(2).
Subtract from 1.
Compute the sum of series using LOGTAB for coefficients.
Subtract 0.5 from result.
Re-scale the number and then multiply by LOG(2).

MULT

F706

Multiply FPREG by value on stack.

FPMULT

F708

MULTIPLY FPREG by value in BCDE.

DIV

F767

Divide the value on stack by FPREG and leave the result in FPREG.

DVBCDE

F768

Divide the value in BCDE by FPREG and leave the result in FPREG.

TSTSGN

F813

Test sign of number in FPREG.

SGN

F822

SGN(X) routine.

ABS

F838

ABS(X) routine.

STAKFP

F844

Move value in FPREG to stack.

PHLTFP

F851

Move value at HL to FPREG.

FPBCDE

F854

Move value in BCDE to FPREG.

BCDEFP

F85F

Move FPREG to BCDE.

F862

Move value at HL to BCDE.

FPTHL

F86B

Move Value in FPREG to HL.

SIGNS

F879

Set sign of result depending on signs of operands.

CMPNUM

F88E

Compare numbers.

FPINT

F8BB

Get integer of FP value.

INT

F8E6

INT(X) routine.

ASCTFP

F91A

Convert ASCII floating point number into binary.

NUMASC

F9B8

Convert floating point binary into ASCII.

SQR

FAAC

SQR(X) routine. Uses SQR(X) = X ^ 0.5

POWER

FAB5

Raise base BCDE to the power FPREG.
Uses X^Y = EXP( Y*LOG(X) ).

The workings of NASCOM ROM BASIC Ver 4.7

PAGE 17

EXP

FAFA

EXP(X) routine.
Scale value to be between 0 and 1
Compute sum of series using EXPTAB for coefficients.
Re-scale number.

SUMSER

FB5B

Sum the series using table of coefficients at HL.
(( N1 * X^2 + N2 ) * X^2 + N3 ) * X^2 ... + Nn

SUMSER1

FB6A

Sum the series using table of coefficients at HL.
(( N1 * X + N2 ) * X + N3 ) * X ... + Nn

RND

FB8B

RND(X) routine.

COS

FC00

COS(X) routine. Uses COS(X) = SIN(X+PI/2).

SIN

FC03

SIN(X) routine.
Divide angle by 2*PI.
Get fraction part.
Move other quadrants around and set what result will be.
Sum the series using table of coefficients at SINTAB.

TAN

FC67

TAN(X) routine. TAN(X) = SIN(X) / COS(X).

ATN

F67C

ATN(X) routine.
If value > 1 then get 1/value and set PI/2 – angle.
Sum the series using table of coefficients at ATNTAB.
Negate result if original value was > 4.

WIDTH

FDA5

WIDTH routine. Set terminal width but NOT commas width.

LINES

LINES routine.

DEEK

FDBC

DEEK(X) routine.

DOKE

FDC7

DOKE A,V routine.

SCREEN

FDE6

SCREEN X,Y routine.

FE11

Get screen address from row and column in DE and BC.

INLINE

FEE8

Get an input line from NAS-SYS.

GETXYA

FF15

Get (X,Y) for SET,RESET and POINT.
Return address on screen and a bit mask.

SETB

FF40

SET(X,Y) routine.

RESETB

FF55

RESET(X,Y) routine.

POINTB

FF79

POINT(X,Y) routine.

XYPOS

FF96

Convert (X,Y) to a row and column on screen.

NASCOM ROM BASIC source code is available in ASM and LST file format.