Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
variable being created it checks<br />
the syntax of the variable name.<br />
Then an area of RAM is used to<br />
store the value along with the<br />
variable name.<br />
If a reserved word has been<br />
found the position of the token<br />
value in the ROM list<br />
determines where the program<br />
jumps to in the Basic ROM to<br />
verify the correct syntax of any<br />
characters which follow the<br />
word until a colon or zero byte<br />
is discovered, For example, if<br />
the line was PRINT "HELLO",<br />
the PRINT token would be 99<br />
Hex, The system would then<br />
expect a variable name, a<br />
quotation mark, a colon or a<br />
zero. In this case it finds a<br />
space. which is ignored, followed<br />
by a quotation mark.<br />
The system then takes the<br />
ASCII code from between the<br />
quotes one by one. The ASCII is<br />
converted into a screen POKE<br />
value and this places the letters<br />
which spell HELLO on the next<br />
available screen location.<br />
When the end of a line is<br />
found the line link is retrieved<br />
from memory and the next line<br />
link is stored along with the<br />
new line number. The line is<br />
then copied into the Basic<br />
buffer and the line is scanned<br />
and interpreted as before.<br />
This process continues until<br />
there are no more lines left or<br />
an END or STOP command is<br />
located.<br />
Obviously with all this<br />
memory movement, evaluation<br />
and syntax checking going<br />
on the program runs a lot more<br />
slowly than a pure machine<br />
code program written<br />
specifically to create the same<br />
effect but it should be remembered<br />
that all programs are<br />
executed by the microprocessor<br />
in machine code, Basic is<br />
only a figment of the ROM's<br />
memory. When a language<br />
such as Logo or Pascal is loaded<br />
the Basic ROM is switched out<br />
in favour of the new machine<br />
code routines which interpret<br />
the syntax of the new language.<br />
Any language on a<br />
computer is a language of<br />
convenience rather like<br />
Margaret Thatcher and<br />
President Mitterand discussing<br />
policies through the medium<br />
of an interpreter. As we all<br />
know this not only lengthens<br />
the time taken for the<br />
discussion but can also lead to<br />
misunderstandings unless<br />
great care is taken.<br />
Next month we shall see<br />
how the processor helps to<br />
store numerical and string<br />
variables.<br />
400 FORL=1T04:60SU8690:PRINT<br />
RES(11):60SU81150:NEXT:REM LD<br />
907:LDA1120<br />
410 FORBL=7T00 STEP-I:YRS."(<br />
LEFT)-':RESTORE:BLS=RIGHTS(<br />
STRS(BL),I)<br />
420 IF8L=6THENXX=0:PA=3<br />
430 IFBL=5THENPA=0<br />
440 FORL=0102:605U8690:PR:NT<br />
RES(01):60SU81150:NEXT:REM SY<br />
A 0800,Y<br />
450 60SUB710ta="(R6H1)(R6HT<br />
)0a+BLS<br />
460 P0S=ACS(6)<br />
,0 "+CS:60SUB1190<br />
(LEFT)(LEFT)<br />
470 READW:606U81150:PRINTRES<br />
(0)<br />
480 PRINTMS(2):POS=MDP'080"<br />
+BLI:60SUB1190<br />
490 CS=<br />
1439313532<br />
20 (RVS) 1<br />
"+MI0 , 500 TS="(HOME)10804RISHTI(S<br />
S("13 81.12+1,2)<br />
TROL),1)4"(0001N)(LEFT)(LEF<br />
19133 :606U811<br />
THLEFTI(LEFT)(LEFT)a+RISHTS<br />
(51S,BL4.3)<br />
510 PRINT4BS:PO3=AES(4)+"20"<br />
:60SUB1190<br />
520 60SUB1000:PRIN<br />
-SUB10001READCS:60SUB1120<br />
RES(0):60<br />
530 PRINTa(HOMEHDOWN)<br />
540 P0S=1:606U81190<br />
550 PRINT"(HOME) (DOWNI(DOWN)<br />
POISHTS(ACS,BL+2);"<br />
560 609U8690:PRINTRES(I):605<br />
UB1150<br />
570 YPS="1(DOWN)(LEFT) 1(DOWN<br />
)(LEFT)1(DOWN)(LEFT)(LEFT)--<br />
1•:60SUB710<br />
580 CS="0<br />
1,1):IFEL=0THENC$<br />
+RIGHT 590 0 READW:60SUB1150:PR!NTRES<br />
S(STRII -1" (0)<br />
(BL-1) 600 FORIAT01:605U8690:PRINT<br />
RES(W):60SUB11601NEXT<br />
610 IFBL=OTHENREADAS,AS:XX=5<br />
014=7:60T0630<br />
620 READCS,0:606U81160<br />
630 606UB960:PRINTDPS:FORD=0<br />
TOXX310:NEXTIPRINTRES(0):NEX<br />
TBL<br />
640 60SU8690:PRINTRES(W):60S<br />
UB1150<br />
650 PRINT"(HOME)(DOWN)(DOON)<br />
(DONN)(DONN)(R6HT) (RGHT)READ<br />
Ya:XX=250<br />
660 POW(HOME)(DOWN)(DOWN)(<br />
DOWNI(DOWN)(DOWN)(R6HT)(R6HT<br />
I 1<br />
:<br />
6<br />
0<br />
6<br />
U<br />
12<br />
670 PRINTa(CLR)"<br />
680 END<br />
690 60SU81060:60SUB1100:READ<br />
CS:60SUE11120:FOROOT01:60SUB<br />
990:NEXT:READC$01<br />
700 RETURN<br />
710 PRINTYWYPS:6OSUB960:RE<br />
TURN<br />
720 PRINTIOBOO (C64) ______<br />
730 PRINT' I<br />
I<br />
740 . PRINT" ISYS491521 HRVS)<br />
Y RES (OFF)I"<br />
750 PRINT"<br />
760 PRINT' 1<br />
1 a<br />
I I<br />
770 PRINT' 1 I HRVS)<br />
X RES (OFF)la<br />
780 PRINT'<br />
a<br />
1<br />
770 PRINT" 1<br />
1'<br />
I I<br />
800 PRINT" 1<br />
ACC (OFF)1<br />
I IERVS)<br />
810 PRINT' L(RVS)<br />
----<br />
(OFF 820 PRINT" HRVS)SCREEN(OFF<br />
I RRVS) C000 (OFF)!<br />
830 PRINT' HRVSIP<br />
RDSRAM(OFF)I°<br />
840 PRINT' __ 1111VS)C<br />
OUNTER(OFF)1"<br />
850 PRINT" I 1<br />
a<br />
860 PRINT" 1 1 I<br />
la<br />
870 PRINT' (RVS) (OFF)<br />
----ERVS)ADDRESSIOFFI"<br />
880 PRINT'<br />
a<br />
890 PRINT' (RVS) (OFF)____<br />
900 PRINT' (RYS) DATA(OFF)I<br />
RRVS) DECODER (OFF)1<br />
910 PRINT' (RVS) BUS(OFFII<br />
920 PRINT" (RVS) (OFF) (R<br />
VS) (OFF) (RVS) (OFF)<br />
(RVS) (OFF)"<br />
930 PRINT (RVS) (OFF) (R<br />
VS) (OFF) (RVS) (OFF)<br />
(RVS) (OFF)"<br />
940 RETURN<br />
950 REM 11111 DELAY<br />
960 FORDOTOXX:NEXT<br />
970 RETURN<br />
980 REM IS1: DATA BUS<br />
990 FOR 8=1T03:60T01010<br />
Memory<br />
1000 FOR B=3TOISTEP-1<br />
1010 PRINTRW(R6HTI(RVS)<br />
CB) 1<br />
1020 0 FORC=1102:PRINT"(RSHT)(<br />
RVS)18$(8)D8S(B)D8S(B)140(8<br />
):NEXT<br />
1030 605U89601NEXT<br />
1040 RETURN<br />
1050 REM MI PC VALUE<br />
1060 READPS<br />
1070 POS=ACS(3)+<br />
+":60SUB11901PRINTN(RVS)"<br />
6<br />
(LEFT) PDS "+PS<br />
1080 PRINT/ISM:RETURN<br />
1090 REM 1111 MEMLOC<br />
1100 605U8960:PRINTMDSPS:RET<br />
URN<br />
1110 REM 3111 MEMCONT<br />
1120 POSOID14."(DOON)(R6HT)1<br />
M60901190 4.<br />
1130 PRINTMS(0):RETURN<br />
1140 REM MI DECODER<br />
1150 IFOITHENPRINTACS(10"<br />
1160 P0S=ACS(11)43:60SU81190<br />
1170 PRINTRECOMETURN<br />
1180 REM Mt FLASH<br />
1190 FORA=OTOPAIPRINT"(RVS)"<br />
P01"(0FFIN:60SUB960:PRINTPOS<br />
:609U0960:NEXT:RETURN<br />
1200 REM litt DATA<br />
1210 DATA0004,99,"STA 0<br />
11,0005,00,<br />
8,2 , 1<br />
1220 00', DATA2,20<br />
1230 2,C0 DATAC007,88,1EY " ,<br />
1,6 06,0<br />
1240 8,0 DATAC008,10,BPL,14009,<br />
FA,"(R6HT)(R6HTIORSHTI(R6HT)<br />
SFA<br />
1004'0<br />
,1 1250 DATA000A,60,"RTS a,<br />
1<br />
"(R 1260 DATACPU DEMONSTRATION,"<br />
6HT :2<br />
HOW I(R - SOW<br />
6HT !"<br />
tD0WNiCr.4. ) 0<br />
_ D<br />
Al ( D120<br />
1.7 RA<br />
, G7<br />
HY.:Q0E<br />
C H-<br />
DT<br />
- DATA'iDOWN:E wO4D<br />
LEAV.PAFO 4)<br />
.<br />
. A TD<br />
S:64.<br />
OF<br />
71Z:0<br />
AE<br />
C r.<br />
, I,07,07<br />
" .<br />
:..,S: ATA s1320<br />
C;<br />
DA<br />
REEN CUO o7<br />
.20.20.4 C(<br />
.A0 A[K:. :: A<br />
•<br />
—Cc A9.L 4 !<br />
, DA0. S,<br />
#.!.: 1.:: T<br />
: A