135 10 DIM S% 7 20 !S%=&08040201 30 S%!4=&4010 (Refer to chapter 39 for an explanation of the above techniques). Next a row of Teletext control codes must be written down the left hand side of the screen to convert every line into a graphics display: 40 PROCGR and the associated procedure is: 200 DEF PROCGR 210 LOCAL Y% 220 VDU 12 230 FOR Y%=0 TO 18 240 VDU 10,13,&97 250 NEXT 260 ENDPROC The main program – in this case to plot a ‘sine curve’ – follows: 50 FOR X=0 TO 75 STEP 0.25 60 PROCPLOT (X,28+28*SIN(X/10)) 70 NEXT 80 END and lastly here is the procedure to plot the point:
300 DEF PROCPLOT(X%,Y%) 310 LOCAL C%,A% 330 VDU 31,X% DIV2+1, 19-Y% DIV3 340 C%=S%?((X% AND 1)+(2-Y%MOD3)*2) 350 A%=135 360 VDU (USR &FFF4 AND &FF00) DIV256 OR C% OR 128 370 ENDPROC There is no need to know how it works but here is an explanation in case you are interested. The X and Y coordinates are put into X% and Y% and then line 330 moves the text cursor to the position X% , Y% . Line 340 uses the look-up table ( S% ) to calculate the ‘value’ (in terms of ASCII code) of the selected pixel at X% , Y% . Setting A%=135 and jumping to the subroutine at &FFF4 returns the ASCII code of the character which includes the spot X% , Y% .
See chapter 43, which explains this OSBYTE call for a similar example. The character read from the screen is then ORed with the new pixel ( C% ) and written with the VDU statement.