Copying More or Less than the Standard 22 Lines

Author(s): David Hoshor
Publication: Timex Sinclair User
Pub Details: Timex Sinclair User n5 (Volume 1, Issue 5)
Date: October 1983
Pages: 53

Those who own the ZX or Timex Sinclair printer have probably found that the COPY function copies the 22 lines of the screen normally used by the computer. What do you do if you want to COPY only the top 10 lines or the entire 24 lines of the screen? You end up wasting 12 lines of paper in the first case, or having the bottom of your display copy left uncopied in the second. This short, simple machine code routine allows you to specify the exact number of lines you want copied.

The COPY routine in the Sinclair ROM starts by loading the D register with the number of lines to be copied. In this routine, we just load the D register with the number of our choice and jump to the rest of the COPY routine (086B).

Enter the following program:

 1 REM (five spaces long)
10 POKE 16514,22
11 POKE 16515,10
12 POKE 16516,195
13 POKE 16517,107
14 POKE 16518,8

Run the program. The listing will now look like this:

 1 REM -▒??▒
10 POKE 16514,22
11 POKE 16515,10
12 POKE 16516,195
13 POKE 16517,107
14 POKE 16518,8

Delete lines 10, 11, 12, 13, and 14. They are no longer needed. The machine code has been installed in the 1 REM line.

Now try writing the following program:

 1 REM -▒??▒
10 FOR N=0 TO 21
20 PRINT N
30 NEXT N
40 RAND USR 16514

The screen’s lines will be numbered 0 to 21, but when the program reaches 40 RAND USR 16514, only the first 10 lines of the screen are copied.

The machine language program is:

Decimal        Mnemonics    Hex
22, n          LD D,n       16, n
195, 107, 8    JP 086B      C3, 6B, 08

The character n in the first instruction is the number of lines of the screen that you want to have copied. The number can easily be changed by POKEing 16515 with another number. Any number between 1 and 24 can be POKEd.

The routine can be called by RAND USR 16514.

Should you want to PRINT on all 24 lines of the screen as well as being able to copy all 24 lines, just incorporate in your program, POKE 16418,0. You will be able to PRINT on the bottom two lines of the screen. The command POKE 16418, 0 must be incorporated within the program; it has no effect if done in the immediate mode. If you have POKEd 16418 with zero, you must POKE 16418 with a 1 or 2 prior to an input of a variable; a crash is guaranteed otherwise. An alternate way of entering variables when you are using all 24 lines of the screen is through the use of INKEY$.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.