Alas, sometimes things just don’t go smoothly.

Ouch, and that was an original too.

So, this is how we restore it:

Punching cards by hand… Notice the purple stripe at the top? Must be an imposter! (plus I put a datecode on the back)

Skip to content
# Author: Jeff Kaylin

## Punched Card Replacements

## Apple 1 INTEGER BASIC #2

## Apple 1 INTEGER BASIC

## Apple 1 BASIC

## LCM+L Logo

Alas, sometimes things just don’t go smoothly.

Ouch, and that was an original too.

So, this is how we restore it:

Punching cards by hand… Notice the purple stripe at the top? Must be an imposter! (plus I put a datecode on the back)

Okay, if the Apple 1 computer does not have screen addressing, how am I doing SPIROGRAPH?

7000 REM SET PIXEL (X, Y) 0-39, 0-47

7010 Z = 1 : Q = V(10*(Y/2)+X/4+1) * 2

7020 FOR S = 1 TO 4 – X MOD 4

7030 Z = Z * 4: Q = Q / 4

7040 NEXT S

7050 Q = Q MOD 4: Z = Z / 4

7060 IF Y MOD 2 = 0 THEN 7080

7070 IF Q MOD 4 = 0 THEN V(10*(Y/2)+X/4+1) = V(10*(Y/2)+X/4+1) + Z: RETURN

7080 IF Q MOD 4 = 0 THEN V(10*(Y/2)+X/4+1) = V(10*(Y/2)+X/4+1) + Z * 2: RETURN8000 REM PRINT SCREEN 40 * 48; TBTBTBTB

8010 FOR Y = 0 TO 23

8020 FOR X = 0 TO 39

8030 IF Y = 23 AND X = 39 THEN RETURN

8040 Z = V(Y * 10 + X / 4 + 1) * 4

8050 FOR S = 1 TO 4 – X MOD 4

8060 Z = Z / 4

8070 NEXT S

8080 Z = Z MOD 4

8090 IF Z = 3 THEN PRINT “:”;

8100 IF Z = 2 THEN PRINT “‘”;

8110 IF Z = 1 THEN PRINT “,”;

8120 IF Z = 0 THEN PRINT ” “;

8130 NEXT X

8140 NEXT Y

As the screen is 40 x 24 characters, it would be nice to make that 40 x 48 — using ‘ , and : to double vertical resolution.

First I made an array of 240 integers. It would have been nice to make an array of 40 x 48 integers, but there isn’t enough memory, and two dimensional arrays are not supported. So I had to fit two vertical dots and 4 horizontal dots into one integer. Then, using shift-by-divide and the MOD function, I could calculate what I wanted on the screen, and finally print it all out at once. However, I didn’t print out the last character, as that would have scrolled the screen.

Spirograph is round, so the 48 lines vertically are not needed. And, this is important, because the program actually loads, but does not run — getting an out-of-memory error. Deleting some of the many REMarks frees up enough space to run.

If the Apple 1 computer came with INTEGER BASIC, then how am I doing BIORHYTHM?

9000 REM SIN/COS (DEGREES) INPUT A, OUTPUTS S, C

9010 S = ((A MOD 360)+360) MOD 360: REM GET ANGLE 0-359

9020 IF S < 180 THEN 9060

9030 IF S < 270 THEN 9050

9040 C = C5(S-270+1): S =-C5(360-S+1): RETURN: REM 270-359

9050 C =-C5(270-S+1): S =-C5(S-180+1): RETURN: REM 180-269

9060 IF S < 90 THEN 9080

9070 C =-C5(S-90+1): S = C5(180-S+1): RETURN: REM 90-179

9080 C = C5(90-S+1): S = C5(S+1): RETURN: REM 0-089

9800 REM SET UP TABLE

9810 DIM C5(91)

9820 S=0: C=8192

9830 FOR A = 0 TO 45

9840 C5(A+1) = S: C5(90-A+1) = C

9850 S=S+((C/3)*10)/191

9860 C=C-((S/3)*10)/191

9870 NEXT A

9880 RETURN

First I set up an array to hold SIN for 0 to 90 degrees. (You don’t need more if you know COS is SIN of the angle plus 90, and other quadrants are symmetrical).

But, creating an array of 91 values would pretty much take up all of available programming space, so I generated it using the differential equations — relating SIN and COS. I also made the values go from 0 to 8192, as going from 0 to 1 is not useful.

INTEGER BASIC for the Apple 1 computer is not well documented.

Here are some things I found:

A FOR loop will always execute at least once. This is unlike most BASIC machines, which will not execute the innards of FOR I = 1 TO 0.

Although the exponentiation symbol is recognized (^), don’t use it — that is a lock-up condition.

IF statements will execute a command. However, multiple commands on the same line are not contained within the IF result. That is, IF X > Y THEN A = 0: GOTO 1230 will always go to 1230.

This is our Logo. See how it is an isometric view of an angular robot hand? Well, it sure looks like it started that way.

My initial goal was to convert this image into a descriptions of lines so that we could create a logo for our printed circuit boards. It should have been easy: line from a to b, circle at x, y with radius r, etc. But, those black lines you see in that picture are not actually black lines. They are areas defined by zero-width line edges. Finding accurate endpoints for those lines was annoying.

So, I quickly thought it may be easier to re-create a 3D model and then project those edges to a 2D plane. That was not easy, yet, perhaps, it may have been easier than the original goal.

Now we have a 3D model of the robot hand, plus a projection to a 2D plane.

This line drawing is scalable in an Excel spreadsheet, and creates a Script file to use in Eagle PCB layout.

This is the bonus: