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
9870 NEXT A
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: