80-Bus News

  

May–June 1983, Volume 2, Issue 3

Page 33 of 59

The workings of NAS­COM ROM BASIC Ver 4.7

PAGE 12

END

E872

END routine. Flag “END”.
Save address of break and set continue address and line. If from STOP or break then output “Break” message and if not a direct statement then output line number also.

CONT

E89E

CONT routine. Get continue address, if it is zero then output “?ON Error” else set address and line as current and continue.

NULL

E8B1

NULL routine. Set number of nulls to be output after CRLF.

CHKLTR

E977

Test next character in code string and return flags:– NC – Letter, C – Not a letter.

FPSINT

E97F

Get an integer 0 to 32767 from next character.

POSINT

E982

Get an integer 0 to 32767 to DE.

DEPINT

E985

Test for integer 0 to 32767 and leave it in DE.

DEINT

E98B

Test for integer −32768 to 32767 and leave it in DE.

ATOH

E9A5

Read an ASCII integer 0 to 65529 into DE from code string.

CLEAR

E9CA

CLEAR routine. “CLEAR” Clear variables,
“CLEAR s” also reserves string space (where t is 0 to 32767),
“CLEAR,t” sets top of memory (where t is 0 to 32767),
“CLEAR s,t” reserves string space and sets RAM top.

RUN

EA10

RUN routine. “RUN” run from start of program, “RUN n” run from specified line.

GOSUB

EA1C

GOSUB routine. Create a GOSUB block on the stack and GOTO specified line.

GOTO

EA2D

GOTO routine. Get ASCII line number and continue execution from that line.

RETURN

EA4B

RETURN routine. Look back through stack for a GOSUB block and if one is found POP line number and address in line and continue execution from there. Otherwise “?RG Error” occurs.

DATA

EA70

DATA routine. Flag DATA and drop through to common code.

REM

EA72

REM routine. Flag REM and look for end of statement, DATA statement ends with “:” or null, REM statement ends only with null (End of line).

LET

EA87

LET routine. Get variable name, make sure “=” follows, evaluate expression and assign it to the variable.

ON

EAE1

ON GOTO / ON GOSUB routine. Get integer expression (0 to 255). Look through list of ASCII line numbers until the Nth value is found. If value N exists GOTO or GOSUB that line. Otherwise drop through to next statement.

The workings of NAS­COM ROM BASIC Ver 4.7

PAGE 13

IF

EAFF

IF routine. Evaluate expression. If it is zero then dop through to the next line. Otherwise GOTO line number if specified else go to execute the statement.

PRINT

EB23

PRINT routine.

INPUT

EBFD

INPUT routine. Test for direct mode, if in direct mode then no INPUT allowed (“?ID Error”). Otherwise output prompt string if one is given, Get an input line and join READ routine to assign values to variables.

READ

EC2C

READ routine. Get address of next DATA item and flag READ. Read in items an assign to variables (used for INPUT and READ). If any errors occur use READFG to see if:–
“OSN Error” or “?0D Error” are needed for READ or
“Redo” or “Extra ignored” are needed for INPUT.

FDTLP

ECD2

Find next DATA statement.

NEXT

ECF6

NEXT routine. Look back through stack for a matching FOR block. If one is found then add STEP to index variable and compare it with the TO value. If the loop has not been completed then continue execution from the first statement in that loop. Otherwise remove the FOR block from the stack. Then look for another variable (Eg “NEXT B,A”). If found then re-enter NEXT routine to process this loop. Otherwise continue execution from the statement after the NEXT.

GETNUM

ED41

Get a numeric expression.

TSTNUM

ED44

Make sure current value is numeric (“?TM Error” if not).

TSTSTR

ED45

Make sure current value is a string (“?TM Error” if not).

CHKTYP

ED46

Make sure current value is of the type selected by TYPE.

EVAL

ED5A

Evaluate an expression using algebraic logic (Do multiplication and division before addition and subtraction. Etc.). Leave the result in FPREG and set TYPE to string or numeric.

FNOFST

EE33

Enter with offset into FNCTAB. If it is “POINT (X,Y)” then jump directly to “POINT (X,Y)” routine (This SHOULD have been a jump via the POINT reflection). If it is LEFT$, RIGHTS or MID$ then evaluate the string expression and get the “,” after it then go to the string function. If it is any other function then get its address from FNCTAB and call it.

SGNEXP

EE70

Get sign of number and return in the D register:–
FF – Negative, 00 Positive.

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

Page 33 of 59