INMC News

  

Autumn 1979, Issue 4

Page 13 of 30

combination of the BASIC and monitor as it was recorded. So what to do, your mate down the road has “Nascom ROM Basic” and you have “Nascom Tape Basic”. First, don’t give up, all hobbies ought to have a bit of frustration value built in otherwise you’ll soon get bored. Go into ‘X’ mode in NASBUG T4/​NAS-SYS (if you’ve got T2, sorry, you can’t do it), then ‘LIST’ with the tape recorder going. Now all your mate does is to zap the tape in his recorder, switch on, and lo!, the BASIC thinks its got a super fast typist on the keyboard. Thats a bit simplified ‘cos you’ll have to output some nulls at the end of each line using the‘NULL’ command, and there’s some snags there. Read the ‘LITTLE KNOWN FACTS’ spread about this newsletter.

Now for a couple of tips;

One feature missing on the 8K BASIC which is extremely useful on the (dare I mention it) Tandy TRS-80 Level II (which is a 12K extended BASIC by the way), is an ‘INKEY$’ command, it’s a must for interactive keyboard games etc. What is does is scan the keyboard once, and if a key is down, return with its value. It doesn’t wait for a key press like the ‘INPUT’ command. A simple bit of machine code fixes this.

For NASBUG T4

0C80  CD 63 00            CALL KBD      Scan the keyboard once.
0C83  38 04               JRC, PUTINB   If a char, go to PUTINB.
0C85  CB FF               SET 7, A      If no char, set bit 7,
0C87  18 02               JR RET        then go to RET.
0C89  47         PUTINB   LD B, A       Put the char in B,
0C8A  AF                  XOR A         then clear A.
0C8B  2A 0D E0   RET      LD HL, ABRET  Load HL with return address,
0C8E  E9                  JP (HL)       and jump to it.

It’s a bit inconvenient to load that by hand, so lets turn it into BASIC and let it load itself.

10 REM   REAL TIME INPUT FOR NASBUG T4
20 DATA 27085,14336,-13564,6399,18178,10927,-8179,233
30 DOKE 4100,3200: FOR I9=3200 TO 3214 STEP 2
40 READ I8: DOKE I9,I8: NEXT
100 REM   TO USE
110 Z=USR(0): REM IF Z<0 THEN NO KEY WAS PRESSED
120 REM           IF 2>0 THEN Z = THE ASCII VALUE RETURNED

For those lucky few with NAS-SYS, things are slightly different, and in consequence the routine is one byte shorter, thus:

For NAS-SYS 1

0C80  DF                  RST SCAL      Internal subroutine call
0C81  61                  DEFB #61      Table number for KBD
0C82  38 0F               JR C, PUTINB          etc

Then as for the NASBUG routine


Page 13 of 30