Authors
Publication
Pub Details
Date
Pages
Sometimes a programming problen can be easily solved by using certain tricks. Here are a few tips and techniques to help you possibly the next time you get stuck. I hope you will find them useful.
THE SAVE PROBLEM
To replace the message “Start tape then press Enter” you just need to POKE 26689, 38. Try:
10 PRINT #0; "All right, I'm ready."'"Start your tape"'"AFTER that press ENTER"
20 POKE 26689,38: SAVE "demo"
For those with a Spectrum ROM, POKE 23736, 181 starts SAVEing immediatly, without waiting for a key press.
THE SCROLL PROBLEM
This little machine code routine scrolls a certain number of lines during a certain time. These codes can be put anywhere in memory.
10 CLEAR 49999
20 FOR I=50000 TO 50020
30 READ A: POKE I,A
40 NEXT I
50 DATA 205,220,27,205,96,38,237,67,250,91,197, 253,70,192,205,59,9,193,16,246,201
Use this routine with INPUT USR add, x, y where add=start address and x= 1st line to be scrolled, y=how many times. With the routine at 50000, try:
10 CLS
20 PRINT " ....Don't move.... "
30 INPUT AT 0,0; "Write something:"; LINE aş
40 INPUT USR 50000,22,1
50 PRINT AT 21,0; a$
60 GOTO 30
THE LOAD PROBLEM
Large programs are generally recorded in several parts on cassette. After the loader program, a screen presentation is loaded and the main program is now ready to be loaded. But it’s not very esthetic when the program name overprints the screen presentation.
To avoid this situation, we can add to the loader program POKE 23570,16 and in the main program, we must restore by using POKE 23570,6. PRINT and LIST will be corrupted otherwise.
THE INKEY$ PROBLEM
Suppose we have: 50 IF INKEYS=”Y” THEN GOTO 100. If the keyboard is in lowercase mode, the computer will see “y” instead of “Y” and pass on to the next line. Again POKE will rescue us:
POKE 23658,8 for UPPERCASE mode
POKE 23658,0 for LOWERCASE mode
POKE 23617,2 for GRAPHIC mode
POKE 23617,1 for EXTENDED mode
Try:
10 POKE 23658, value (or 23617, value)
20 INPUT LINE a$
THE INPUT PROBLEM
In Sinclair BASIC, the INPUT statement has some limitations. When we hit ENTER, the information on the screen is cleared. The following tip will keep it on the screen. This task is performed by calling a ROM routine which scrolls the screen up a line. Note the apostrophe after the variables, its vital.
EX #1
10 INPUT "what?"; w$'USR 2361, USR 2361
20 INPUT "when?"; w'USR 2361, USR 2361
EX #2
10 INPUT AT 0,0; "what?"; w$'USR 2361
20 INPUT AT 0,0; "when?"; w'USR 2361
Also it’s possible to do an INPUT AT in Sinclair BASIC. Try: INPUT AT 5,0; AT 0,0; “?”;a But again, when we hit ENTER, the information on the screen is cleared. To keep this information, we can write a subroutine with INKEY$ which simulates an INPUT statement, but an easier way would be welcome. Enter 10 REM 123456
POKE locations 26715-26719 (can be anywhere in memory) with the values 253,54,49,2,201. Now add 20 INPUT AT 10,0; AT 0,0; “month: “¡LINE m$'”year: “; y’USR 26715 and RUN
The first AT reserves 11 lines from screen bottom and the second will place the input on the first of these reserved lines. We must use the same BORDER and PAPER color. WHY? Try adding 15 BORDER 4: PAPER 7 Now you know…
Products
Media
Image Gallery
Source Code
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.