80-Bus News

  

May-June 1983, Volume 2, Issue 3











Page 32 of 59











The workings of NASCOM ROM BASIC Ver 4.7

PAGE 10

HHHERLHH Now for te exciting bit – The ROM *#iHHHHH

Name

wenn ne

INIT

MSIZE

TSTMEM

SETTOP

WARMST

BAKSTK

CHKSTK

DATSUR

TMERR

ERROR

PRNTOK

GETCMD

SRCHLN

NEW

RUNSFT

INTVAR

Addr

amnne

BO19

BO36

EO5B

EO6D

EOAE

E356

E38A

ESAT

EXBF

E3C1

ESFS

E405

E499 E4B9

B4C5 E4C9

What the routine does Dn nena An PO RE me Rte mS RE HO

Copy the initial work space conditions into the work space RAM at 1000 to 105F.

Output "Memory size" prompt and get response from user.

Tf a number is given jump to TSTMEM otherwise start at the beginning of RAM and test each successive byte until the end of RAM is found. When the end has been found jump to SETTOP.

Get supplied address.

If any bad characters output "?SN Error" and re-initialise otherwise try to write a DOH byte into that address. If D9H is not read back then there ig no RAM at that address so go

to MSIZE to ask again. If DOH is read back then drop through to SETTOP.

Test for minimum memory requirement and if not enough jump to MSIZE to ask again otherwise save this address as the highest available memory location, allocate 50 bytes for string space and output the sign on message and the number of bytes free. Then drop through to WARMST.

Clear run-time registers and jump to PRNTOK.

Look back through stack for FOR or GOSUB blocks and exit with HL pointing to the block.

Check for "C" levels of stack space and output “?0M Error" if not enough stack space.

I like this section of code because you jump into the routine at one of the entry points, this loads the "E" register with the error number and the "LD BC,nn" opcode (O1H) skips all the following "LD E,n" inatructions. It is very efficient.

Output error code for error number in the E register, output the line number if needed and drop through to PRNTOK.

Output "Ok" message and drop through to GETCMD.

Get a direct statement or BASIC line, CRUNCH the text and if it is a direct statement go to EXCUTE to execute it. If it is a BASIC line then move it to the program text area.

Search for line namber in register DE.

Set PROGND to start of program text area to effectively remove

program from memory and execute the null program to clear all the other pointers.

Execute program from fitst statement.

Clear out variables and string space an reset DATA pointer.

The workings of NASCOM ROM BASIC Ver 4.7

PAGE 11

CLREG

PROMPT

CRUNCH

ENDBUF GETLIN TTYLIN

CPDEHL

CHKSYN

ourc

CLOTST

LISt

FOR

RUNCNT

EXCUTE

GETCHR

RESTOR

TSTBRK

STOP

E4DF

E4FC

£509

E5BS ESF2 E607

E68A

E690

E698

E6CC

E6DD

ET79

ETF2

E816

E836

E861

E870

Reset stack to top of memory, clear out temporary strings, disable CONTinue and execute program.

Output "? " prompt for INPUT and go to get input line.

Move text string from HL to BUFFER crunching reserved words into tokens as you go.

Mark the end of BUFFER with three nulls. Get an input line from monitor. Get an input line by character and save it in BUFFER.

Compare the DE register with the HL register returning flags:– “2 – Registers are equal, C – DE > HL and NC- DE <= HL

Make sure the next byte in the code string is the sam as the byte following the "CALL CHKSYN". If not – output "?SN Error”.

Output character in the A register to the terminal and output a CRLF if the current terminal width is exceeded. Character is not output if CTLOFG is set.

Get an input character and flip CTLOFG if it is control "oO".

LIST BASIC program from start (or specified line number) LINESN lines at a time. It does not take into account that graphics may appear in quotes, DATA or REM atatements 30 the graphic character is treated as a reserved word token and expanded to the complete word.

Assign the initial value to the index variable and then set up a FOR block on the stack.

Main execution driver loop. This gets the next statement (May be after ":" or on next line) and gives it to BEXCUTE.

Test current statement. If it is a key word then find the address of the routine from WORDTB and call it. If it is a letter then call LET to try to assign a variable. Otherwise generate "?SN Error”.

Get next character in code string and return flags:– Z =- End of statement (":" or null) C – Character is a digit otherwise NC.

RESTORE routine. Set DATA pointer to start of program or to specified line if a line number is given.

Test for break key. If pressed test for control "S" (pause). If another break pressed then stop execution and output break message.

STOP routine. Flag "STOP" an join END.

32


This is an OCR’d version of the scanned page and likely contains recognition errors.











Page 32 of 59