Apple I Keyboard

We are using an Apple ][ keyboard to control our Apple original.

Of course the connectors are not compatible. So, a simple rewiring may work. However, if one were to put some logic between, then if the Strobes are active low instead of active high, or if the Reset is active low instead of active high, or if some of the data bits are usually high instead of usually low, then one could easily make adjustments. Plus, with enough logic, one could pretend to be typing in programs.

That is what I have done. With a BASYS3 FPGA board I listen to the Apple ][ keyboard and pass that data along. But I also listen to a telephone keypad, and if a button is pressed I send my own data. The most useful program is the BASIC interpreter. It takes 6 minutes! That is about 30 characters a second to enter a line of data, and then an appropriate pause at the end of each line so the data can be processed. Then a command to RUN and BASIC is going. Then, another key may be pressed on the keypad to load a BASIC program. That is a slower process, as BASIC takes some time to process each character. But, BASIC programs are usually short anyway.

Apple 1 INTEGER BASIC #2

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: RETURN

8000 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.