Emulator progress, and envy…
I’ve made a tiny bit of headway, but also encountered a link which makes me envious of much greater hacking skill. Óscar Toledo did an 8080 emulator that can boot CP/M as part of the 19th International Obfuscated C Code Contest, winning Best of Show. Its brevity is the “soul of wit”. Check it out.
Óscar also has written several tiny chess programs, and a Javascript chess program. Awesome.
While I didn’t find his code to be all that helpful (it’s, well, dense to say the least), I did find his approach to be helpful. A few additional minutes of hacking, and I managed to get the Tiny BASIC that he runs on his simulator to work on my own. Witness the following BASIC program:
>LIST 10 PRINT "A PROGRAM TO EXPLORE THE 3 * X + 1 PROBLEM" 20 FOR I = 1 TO 10 25 T = I 30 GOSUB 100 35 PRINT 40 NEXT I 50 STOP 100 PRINT T, 110 IF T = 1 GOTO 1000 120 LET J = T / 2 130 IF 2 * J # T GOTO 140 135 LET T = J 136 GOTO 100 140 T = 3 * T + 1 150 GOTO 100 1000 PRINT 1010 RETURN OK >RUN A PROGRAM TO EXPLORE THE 3 * X + 1 PROBLEM 1 2 1 3 10 5 16 8 4 2 1 4 2 1 5 16 8 4 2 1 6 3 10 5 16 8 4 2 1 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 8 4 2 1 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 10 5 16 8 4 2 1 OK >
Not bad! I suspect that even though my 8080 simulator is still pretty rough, I could get CP/M booted on it in much the same way that he did. More later.