BIN/DEC (1K ZX-81)
from Popular Computing Weekly Vol. 1 No. 33 (2 December 1982), page 15

This program will convert decimal numbers into binary numbers and vice versa.
You are told which letter to enter for the function you need. After you have
made your choice the screen is cleared and the program continues with the
function you wish.

What the function does is displayed at the top of the screen. Then the number
you want is calculated and printed. The program then pauses. Pressing any key
will re-run the program.


Program notes for decimal to binary

60-70       reserve space for A$ and B$.
80          waits until a number is input.
90          lets X = your input number so that at line 170, Y is your
            original number.
100         halves your number.
110 to 115  check the remainder of the result of line 100 and allocates the
            correct binary digit to A$.
120         removes the remainder after the division in 100.
130         checks to see if the number has been converted to binary.
140 to 160  lets B$=A$ but in reverse to get the correct binary number.
170         prints the decimal number and its equivalent in binary.


Program notes for binary to decimal

200         waits for you to input your binary number.
210         the decimal counter is set to zero.
220         sets up a loop counter as long as the binary number you have input.
230         searches for the digit '1' in your binary number. If it finds
            one it increases the D counter by its equivalent decimal value.
240         continues this until each digit has been calculated.
250         prints its equivalent decimal number.



Whorled Graphics
by Simon Cross
Popular Computing Weekly, Dec. 1982, Pages 24-25

Simon Cross presents a spiral printing routine for the ZX81.

This program is a 114 byte machine code routine which prints a character,
Chosen by the user, in a "spiral" form from the edge of the screen to the
centre. It runs on the Sinclair ZX81 with more than 3K (with slight
modification it will run on the unexpanded 2X81). The program produces a 32 x
24 display on the ZXB1 with more than 3K in the unexpanded ZX81 the display is
32 x 22.

Initially, I wrote this routine to be used as a "fancy" CLS routine to brighten
up some of my Basic programs. but I think that it has enough intrinsic interest
to be the core of a "pattern-making" program.

The routine is quite simple, consisting of a main loop which itself contains
four smaller loops which print the four edges of the pattern. I needed to put a
delay loop between each printing of a character, since without these the
pattern appeared to be printed instantaneously. The character to be printed
onto the screen is stored in location 16514. The rest of the routine could be
relocated in the memory since it contains no absolute jumps.

The short demonstration program prints various randomly selected characters on
to the screen and can be enjoyed as a "pattern-making" program.

To use the routine in any other program, Poke the decimal code of the character
to be printed into location 16514. The routine is called by Rand USR 16515.

1K ZX81 modifications

The collapsed display file needs to be filled out before Poking characters into
it. Add the following lines to the pattern-making program:

5 FOR N = 0 T0 21 6 PRINT "32 spaces" 7 NEXT N

Since l do not know a simple way of filling out the bottom two lines at the
display tile, I reduce the display to 32 x 22 by altering the machine code with
the following direct commands:


POKE 16532, 22
POKE 16534, 10



ZX81 LANDER (1K ZX-81)
By Gordon Cooper
from Popular Computing Weekly Vol. 1 No. 34 (9 december 1982), pages 8-9

This program is designed to run on a standard 1K ZX81 in Slow mode. It produces
a moving graphic image of a lunar module descending to the moon surface. The
altitude, speed and remaining fuel are also displayed on the capsule's digital
instruments.

To start off try entering 5, which will leave the speed the same while using 5
of your precious gallons of fuel. To slow down further enter a larger number,
but watch your fuel. If you burn more than 9 in a given period you will see the
jet/rocket exhaust.


