
GOOD GAME! GOOD GAME!
This game, in Compukit BASIC, was briefly reviewed in the last issue of Practical Electronics, along with other programs by the same author. As promised, the full listing appears below. Note that the stars represent multiplication signs (i..e. asterisks).
1 REM "LE PASSE-TEMPS" A. KNIGHT 15/12/79 25 ?"1) The object of the game is to get FOUR" 26 ?"IN A LINE" 28 ?"2) The board is a 6 by 7 matrix, and a line" 29 ?"may be horizontal, vertical or diagonal." 30 ?"3) Columns are filled from the base upward." 32 ?"4) In play, only three keys are used:":? 33 ?"a) Shift left moves the pointer left." 34 ?"b) Shift right..." 35 ?"c) The space bar drops your marker to the" 36 ?"foot of the selectec column" 40 DIM$(44),T(11):POKE 530,1:?:GOTO 60 50 FOR I=1 TO 4000:NEXT 60 M$="HIT 'Z' TO CONTINUE":GOSUB 970 70 Q=57088:POKE Q,253:IF PEEK(Q)><223 THEN 70 80 E=0:F=0:G=0:FOR A=1 TO 42:S(A)=0:NEXT 90 ? TAB(16)" LE PASS-TEMPS":?:? 91 ?:? TAB(7)"SCORES":?:? 92 ?"YOU";TAB(9)S1 93 ?:?"ME";TAB(9)S2:? 94 ?"DRAWN";TAB(9)S3:?:?:? 95 RESTORE 100 L=5338:DATA 136,143,209,208 110 FOR T=1 TO 13:IF T/2=INT(T/2) THEN RESTORE 120 READ A,B:FOR C=1 TO 28 STEP 4 125 IF T=1 THEN 140 126 POKE L,143:POKE L+29,136 130 POKE L+C,A:POKE L+C+B,B 140 NEXT C:L=L+64:NEXT T 150 N=36:FOR C=1 TO 7:N(C)=N:N=N+1:NEXT 160 R=53336:C=4 170 S=S1+S2+S3:IF S/2<>INT(S/2) THEN 495 200 M$="MY MOVE":GOSUB 950 205 V=0:X=0:Y=0:Z=0 210 FOR J=1 TO 7:C=C+1:IF C>7 THEN C=1 220 P=R+C*4:IF N(C)>0 THEN GOSUB 700 230 IF F THEN 450 240 NEXT 250 IF X THEN C=X:GOTO 450 260 IF Y THEN C=Y:GOTO 330 270 IF Z THEN C=Z:GOTO 330 310 C=INT(RND(1)*7+1):IF N(C)<1 THEN 310 320 V=V+1:IF C<>4 AND V<5 THEN 310 330 IF N(C)<8 THEN F=0:GOTO 450 340 IF V<10 THEN 400 350 IF V/3=INT(V/3) THEN MM=1:M$="NOW WHAT DO I DO?":GOSUB 970 360 IF V<21 THEN 400 370 FOR A=1 TO 500:Q=INT(RND(1)*940+53260) 380 J=INT(RND(1)*256):POKE Q,J 390 NEXT:E=1:GOTO 640 400 N(C)=N(C)-7:Z=0:GOSUB 700:N(C)=N(C)+7 410 IF F THEN F=0:IF V<9 THEN 310 420 IF Z THEN Z=0:IF V<6 THEN 310 430 IF X THEN X=0:GOTO 310 450 X=R+63+C*4+128*(N(C)-C)/7 470 FOR B=1 TO 2:POKE X+B,154:POKE X+B+64,155:NEXT 480 S(N(C))=5:N(C)=N(C)-7 490 IF F THEN M$="I WIN!":GOSUB 970:S2=S2+1:GOTO 50 495 M$="YOUR MOVE":GOSUB 950 500 P=R+C*4:POKE P,31:POKE P+1,31:POKE 530,1<Rest of listing to follow>
101 SCREEN EDITOR
A screen editor has been sent in by N. A. Climpson, which to use is simplicity itself. Loading this software is easy too, for machine code is transported into the Compukit's memory by a self-destructing BASIC program.
The program occupies 324 bytes of RAM, two zero page addresses 00F9 and 00FA and five addresses 02F6-02FA in an area of RAM not used by BASIC. It is located for the 8K machine at memory locations 7865 to 8189 (decimal) so that it can be protected from BASIC. A response of 7850 to MEMORY SIZE? on cold start is satisfactory.
Key memory locations for editor program in an 8K Compukit.
00F9 Low byte of V.D.U. RAM address 00FA High byte of V.D.U. RAM address 02F6 Input cursor position temporary 02F7 Character temporary store 02F8 Character temporary store 02F9 Edit cursor horizontal position 02FA Edit cursor vertical position 1F2D-1F4D Editor entry and key pressed detection 1EB9-1ED1 Control B routine 1ED2-1EED Control D routine 1EEE-1F2C Rubout routine 1F4E-1F96 Control U routine 1F87-1F97 Handles edit cursor over top line 1F98-1FB2 Return routine. Initialises stores 1FB3-1FD5 Control F routine 1FD6-1FF3 Subroutine senses scroll up and repositions edit cursor one line up 1FF4-1FFD Subroutine for saving character about to be sat on by edit cursor and substituting cursor character 1F64 Number of scrolling lines on screen The functions are accessed through the use of Rubout, and the control key plus U, D, F, and B.
Control U moves the edit cursor up
Control F copies forward
Control B moves the edit cursor backwards
Control D deletes on the edit line
Rubout true backspaceThe line to be altered is displayed anywhere on the screen using LIST.
With Control U an Edit Cursor separates from the Input Cursor and moves vertically up the screen. (If it goes off the top it reappears at the bottom.)
The Edit Cursor is stopped at the selected line and moved forward with Control F. Each character the Edit cursor moves past on the old line is copied by the Input cursor on a new line at the bottom of the screen. The auto repeat facility can be used. Return at any stage enters the new line displayed at the bottom of the screen.
Extra characters are inserted into the new line by halting the Edit Cursor at the appropriate position and entering characters through the keyboard. Resumption of Control F copies the rest of the old line to the new one at the bottom of the screen.
Deletions can be made at any point by pressing Control D which displays a # for each deleted character on the old (Edit) line and gives no input on the new (Input) line.
Changing of characters is accomplished by copying forward to the "correction" position, entering new characters through the keyboard, typing Control D over the unwanted characters on the Edit line and continuing to copy forward over the remainder.
Use of Control B allows movement of the Edit Cursor to the left without moving the Input Cursor. This feature is incredibly useful, allowing you to repeat phrases on a line, or, in conjunction with Control U, move the Edit Cursor around the screen to pick out phrases listed elsewhere and make a new composite line. One use of this function is in the condensation of programs, since several single BASIC statements can be brought together on one line with ease.
This editing facility cannot be used to alter the Input Line; only a previously entered program line.
On long statements which run to a second line, the Edit Cursor needs typically sixteen Control Ds to carry it over the undisplayed part of the video memory if blanks are to be avoided on the Input Line. Alos, on two-line statemwnts, Rubout should not be used to retreat from the second line to the first.
The program listed here should be loaded and RUN, to shift the machine code into memory. It is probable that you will not require the services of the Editor immediately, in which case RETURN will have been pressed during programming; but if the Editor is required immediately after loading, it is necessary to press Return to initialise certain memory locations.
The Editor is a compromise between versatility and memory consumption, but will nevertheless be most useful to 101 users.
PEVDU SOFTWARE?
Sir - I have recently built the PE VDU, with which I am most pleased.
Could you suggest where I might obtain suitable operating software to drive the VDU and full keyboard. The micro I am using is the issue 2 MK14 with new monitor.
Also, can you suggest how I might remove the scan lines from my screen (only apparent when VDU board is connected to TV set). I am going in direct video.
N. F. Harris
Burton-on-Trent101 TRICK
Here is a tip sent in by J. D. Owen of Dyfed.
100 PRINT CHR$(13); TAB(48)CHR$(13);
110 PRINT (new information);Line 100 clears the bottom line of the VDU before line 110 reprints new information. This prevents the previous information from scrolling up the screen.
A similar trick is to replace line 100 with:
POKE 512,205
TV TEASER
Sir - I own a UK101 and wish to display 64 characters per line. In your articles on the UK101 you say that this may be achieved by getting the TV to underscan, but you also say that the software is arranged to limit the line length to 48 characters to prevent loss of information. How is it possible to alter this - would a machine code routine work, or some "POKEs", or would the ROMs need rewriting?
I would be very grateful if someone could answer this problem as I feel that 64 columns would be very useful.
T. D. Allen
Poole.