git @ Cat's Eye Technologies SITU-SOL / 8388cd6
Attempt to fix image links for serving via git-web-interfaces. Chris Pressey 2 years ago
1 changed file(s) with 148 addition(s) and 148 deletion(s). Raw diff Collapse all Expand all
8181
8282 For the sake of example, assume we’ve already written a programming environment — the one that we want to put into our computer, a computer that doesn’t have any sort of programming environment on it yet. Assume we’ve written this program by hand, on paper… and that we’ve already converted it all into machine code. The first line of it might look something like this:
8383
84 ![](images/tumblr_inline_npj0dzr5L21tvda25_540.jpg)
84 ![](images/tumblr_inline_npj0dzr5L21tvda25_540.jpg?raw=true)
8585
8686 …followed by many, many more lines.
8787
9999
100100 In fact, the front panels of some of the earliest home computers had switches and lights on them for just this purpose, like the Altair 8800 shown here:
101101
102 ![](images/tumblr_inline_npj713CSRw1tvda25_540.jpg)
102 ![](images/tumblr_inline_npj713CSRw1tvda25_540.jpg?raw=true)
103103
104104 And in the absence of any other hardware, **this was how you programmed it.** You flipped the switches to represent the binary value you wanted to write into memory, and pressed a button to write it.
105105
117117
118118 Indeed, this technology exists, and you have probably heard of it: the _punched card_.
119119
120 ![](images/tumblr_inline_nqi14lL43P1tvda25_540.jpg)
120 ![](images/tumblr_inline_nqi14lL43P1tvda25_540.jpg?raw=true)
121121
122122 At its simplest, a punchcard reader is barely any more complex than front-panel switches. When a card is inserted, switch contacts close where there are holes in the card, and stay open where
123123 there aren’t holes. And then that bit pattern gets written to memory. As a bonus, the punched card serves as a record of the bytes that were written to memory, and can be re-used.
181181
182182 _July 3, 2015_
183183
184 ![](images/tumblr_inline_nqxhbjR1Zh1tvda25_540.jpg)
185
186 ![](images/tumblr_inline_nqr9iiQmY81tvda25_540.jpg)
184 ![](images/tumblr_inline_nqxhbjR1Zh1tvda25_540.jpg?raw=true)
185
186 ![](images/tumblr_inline_nqr9iiQmY81tvda25_540.jpg?raw=true)
187187
188188 * * *
189189
190 ![](images/tumblr_inline_nqr9ipKWZB1tvda25_540.jpg)
190 ![](images/tumblr_inline_nqr9ipKWZB1tvda25_540.jpg?raw=true)
191191
192192 * * *
193193
194 ![](images/tumblr_inline_nqr9jfJpBU1tvda25_540.jpg)
194 ![](images/tumblr_inline_nqr9jfJpBU1tvda25_540.jpg?raw=true)
195195
196196 * * *
197197
198198 All written! Now, to load it (see _Loading the code_ above for details on this)...
199199
200 ![](images/tumblr_inline_nqr9kqAnnd1tvda25_540.jpg)
201
202 ![](images/tumblr_inline_nqr9kwi0tG1tvda25_540.jpg)
203
204 ![](images/tumblr_inline_nqr9lkgX0n1tvda25_540.jpg)
205
206 ![](images/tumblr_inline_nqxheuHGdA1tvda25_540.jpg)
207
208 ![](images/tumblr_inline_nqxhfrjk8j1tvda25_540.jpg)
209
210 ![](images/tumblr_inline_nqxhgdnJBX1tvda25_540.jpg)
200 ![](images/tumblr_inline_nqr9kqAnnd1tvda25_540.jpg?raw=true)
201
202 ![](images/tumblr_inline_nqr9kwi0tG1tvda25_540.jpg?raw=true)
203
204 ![](images/tumblr_inline_nqr9lkgX0n1tvda25_540.jpg?raw=true)
205
206 ![](images/tumblr_inline_nqxheuHGdA1tvda25_540.jpg?raw=true)
207
208 ![](images/tumblr_inline_nqxhfrjk8j1tvda25_540.jpg?raw=true)
209
210 ![](images/tumblr_inline_nqxhgdnJBX1tvda25_540.jpg?raw=true)
211211
212212 A better front-panel simulator
213213 ------------------------------
218218
219219 The front-panel simulator below works a lot like the 1802 Membership Card front panel (see _Loading the code_ for more details on that.)
220220
221 ![](images/tumblr_inline_nr1av8OuMZ1tvda25_540.jpg)
221 ![](images/tumblr_inline_nr1av8OuMZ1tvda25_540.jpg?raw=true)
222222
223223 The screen shows an approximation of 8 LEDs and 8 SPST switches that would be connected to the 8 data lines on a real front panel.
224224
225 ![](images/tumblr_inline_nr19f04T6y1tvda25_540.jpg)
225 ![](images/tumblr_inline_nr19f04T6y1tvda25_540.jpg?raw=true)
226226
227227 The keys on the bottom row of the keyboard move each switch down; the keys in the 2nd-to-bottom row move each switch up. (In an effort to be more realistic, they are not toggled by a single key.)
228228
229 ![](images/tumblr_inline_nr19fai3D41tvda25_540.jpg)
229 ![](images/tumblr_inline_nr19fai3D41tvda25_540.jpg?raw=true)
230230
231231 Pressing Return causes the binary value selected by the switches to be written to the current address in RAM. That value is then reflected in the LEDs.
232232
233 ![](images/tumblr_inline_nr19flxudE1tvda25_540.jpg)
233 ![](images/tumblr_inline_nr19flxudE1tvda25_540.jpg?raw=true)
234234
235235 Other simulated buttons (not show in the UI) are
236236
249249
250250 I decided, while I was writing all this code by hand, I might as well also write out some stuff about 6502 programming that I can never remember when I need it.
251251
252 ![](images/tumblr_inline_nr2d6pZykG1tvda25_540.jpg)
253
254 ![](images/tumblr_inline_nr2d7al9he1tvda25_540.jpg)
255
256 ![](images/tumblr_inline_nr4dif0mwk1tvda25_540.jpg)
257
258 ![](images/tumblr_inline_nr2d7jFcv61tvda25_540.jpg)
252 ![](images/tumblr_inline_nr2d6pZykG1tvda25_540.jpg?raw=true)
253
254 ![](images/tumblr_inline_nr2d7al9he1tvda25_540.jpg?raw=true)
255
256 ![](images/tumblr_inline_nr4dif0mwk1tvda25_540.jpg?raw=true)
257
258 ![](images/tumblr_inline_nr2d7jFcv61tvda25_540.jpg?raw=true)
259259
260260 Sketches of the design and code for the machine-language monitor. It was basically written three times; once in pencil, once with a ballpoint pen, and the final version (not shown here, coming soon!) with fineliners.
261261
262 ![](images/tumblr_inline_nr2d7pw2iS1tvda25_540.jpg)
263
264 ![](images/tumblr_inline_nr2sx2a8Qs1tvda25_540.jpg)
265
266 ![](images/tumblr_inline_nr2d80BPRW1tvda25_540.jpg)
267
268 ![](images/tumblr_inline_nr2d89ZDc21tvda25_540.jpg)
269
270 ![](images/tumblr_inline_nr2d8lfBmD1tvda25_540.jpg)
271
272 ![](images/tumblr_inline_nr2d90BXxP1tvda25_540.jpg)
273
274 ![](images/tumblr_inline_nr2d9rK7M71tvda25_540.jpg)
275
276 ![](images/tumblr_inline_nr2d9wo2q71tvda25_540.jpg)
262 ![](images/tumblr_inline_nr2d7pw2iS1tvda25_540.jpg?raw=true)
263
264 ![](images/tumblr_inline_nr2sx2a8Qs1tvda25_540.jpg?raw=true)
265
266 ![](images/tumblr_inline_nr2d80BPRW1tvda25_540.jpg?raw=true)
267
268 ![](images/tumblr_inline_nr2d89ZDc21tvda25_540.jpg?raw=true)
269
270 ![](images/tumblr_inline_nr2d8lfBmD1tvda25_540.jpg?raw=true)
271
272 ![](images/tumblr_inline_nr2d90BXxP1tvda25_540.jpg?raw=true)
273
274 ![](images/tumblr_inline_nr2d9rK7M71tvda25_540.jpg?raw=true)
275
276 ![](images/tumblr_inline_nr2d9wo2q71tvda25_540.jpg?raw=true)
277277
278278 SITU-MON
279279 --------
280280
281281 _July 9, 2015_
282282
283 ![](images/tumblr_inline_nr4holCA4X1tvda25_540.jpg)
284
285 ![](images/tumblr_inline_nr4hosyQAs1tvda25_540.jpg)
286
287 ![](images/tumblr_inline_nr4hp8XGSf1tvda25_540.jpg)
288
289 ![](images/tumblr_inline_nr4hpmbakm1tvda25_540.jpg)
290
291 ![](images/tumblr_inline_nr4hpsIKia1tvda25_540.jpg)
292
293 ![](images/tumblr_inline_nr4hpyN6841tvda25_540.jpg)
294
295 ![](images/tumblr_inline_nr4hq8dN861tvda25_540.jpg)
296
297 ![](images/tumblr_inline_nr4hqngl9V1tvda25_540.jpg)
298
299 ![](images/tumblr_inline_nr4hqsGRxP1tvda25_540.jpg)
300
301 ![](images/tumblr_inline_nr4hr03Mce1tvda25_540.jpg)
302
303 ![](images/tumblr_inline_nr4hr8HQh41tvda25_540.jpg)
304
305 ![](images/tumblr_inline_nr4hrdRrgc1tvda25_540.jpg)
306
307 ![](images/tumblr_inline_nr4hrkdfFw1tvda25_540.jpg)
308
309 ![](images/tumblr_inline_nr4hrqEraH1tvda25_540.jpg)
310
311 ![](images/tumblr_inline_nr4hrz45NF1tvda25_540.jpg)
283 ![](images/tumblr_inline_nr4holCA4X1tvda25_540.jpg?raw=true)
284
285 ![](images/tumblr_inline_nr4hosyQAs1tvda25_540.jpg?raw=true)
286
287 ![](images/tumblr_inline_nr4hp8XGSf1tvda25_540.jpg?raw=true)
288
289 ![](images/tumblr_inline_nr4hpmbakm1tvda25_540.jpg?raw=true)
290
291 ![](images/tumblr_inline_nr4hpsIKia1tvda25_540.jpg?raw=true)
292
293 ![](images/tumblr_inline_nr4hpyN6841tvda25_540.jpg?raw=true)
294
295 ![](images/tumblr_inline_nr4hq8dN861tvda25_540.jpg?raw=true)
296
297 ![](images/tumblr_inline_nr4hqngl9V1tvda25_540.jpg?raw=true)
298
299 ![](images/tumblr_inline_nr4hqsGRxP1tvda25_540.jpg?raw=true)
300
301 ![](images/tumblr_inline_nr4hr03Mce1tvda25_540.jpg?raw=true)
302
303 ![](images/tumblr_inline_nr4hr8HQh41tvda25_540.jpg?raw=true)
304
305 ![](images/tumblr_inline_nr4hrdRrgc1tvda25_540.jpg?raw=true)
306
307 ![](images/tumblr_inline_nr4hrkdfFw1tvda25_540.jpg?raw=true)
308
309 ![](images/tumblr_inline_nr4hrqEraH1tvda25_540.jpg?raw=true)
310
311 ![](images/tumblr_inline_nr4hrz45NF1tvda25_540.jpg?raw=true)
312312
313313 I love bits. Bits are great when you’re coding and you want 2,000 of something
314314 ------------------------------------------------------------------------------
369369
370370 So I read over the code again, and, indeed.
371371
372 ![](images/tumblr_inline_nrd676kT5h1tvda25_540.jpg)
372 ![](images/tumblr_inline_nrd676kT5h1tvda25_540.jpg?raw=true)
373373
374374 See the problem?
375375
376376 So! A bit painful that this mis-numbering happened so early in the code, but, there was nothing to be done except to go through it all and correct the addresses:
377377
378 ![](images/tumblr_inline_nrd69wRzNL1tvda25_540.jpg)
379
380 ![](images/tumblr_inline_nrd6ac4zJw1tvda25_540.jpg)
381
382 ![](images/tumblr_inline_nrd6asawdr1tvda25_540.jpg)
383
384 ![](images/tumblr_inline_nrd6b59cBw1tvda25_540.jpg)
378 ![](images/tumblr_inline_nrd69wRzNL1tvda25_540.jpg?raw=true)
379
380 ![](images/tumblr_inline_nrd6ac4zJw1tvda25_540.jpg?raw=true)
381
382 ![](images/tumblr_inline_nrd6asawdr1tvda25_540.jpg?raw=true)
383
384 ![](images/tumblr_inline_nrd6b59cBw1tvda25_540.jpg?raw=true)
385385
386386 And then, back to the front-panel simulator. Reset the address to the beginning. Keep advancing the address until you get to the next byte that needs correcting, enter the new byte, repeat. A little nerve-wracking, but not terribly difficult, because I was getting pretty used to this by now...
387387
388388 Then, reset the address to the beginning again, and… execute!
389389
390 ![](images/tumblr_inline_nrd66akZir1tvda25_540.png)
390 ![](images/tumblr_inline_nrd66akZir1tvda25_540.png?raw=true)
391391
392392 Hey! That looks... like what I expected! Let’s see if it works:
393393
394 ![](images/tumblr_inline_nrdcglfU4p1tvda25_540.png)
394 ![](images/tumblr_inline_nrdcglfU4p1tvda25_540.png?raw=true)
395395
396396 It works! It works!
397397
399399
400400 So now... we have a machine-code monitor! It’s crude and ugly, but it does the trick, and it’s small — 250 bytes, or maybe 251 bytes now, because of the addressing correction? I’m not sure, but it’s still less than 255 bytes, and that’s great.
401401
402 ![](images/tumblr_inline_nrdcf8U9We1tvda25_540.jpg)
402 ![](images/tumblr_inline_nrdcf8U9We1tvda25_540.jpg?raw=true)
403403
404404 We’re not done, though! A machine-language monitor is a _kind of_ a programming environment, but it’s not a very good one. We won’t have to convert anything to binary, and entering lines on a keyboard is a lot easier than using front-panel switches. But we do still need to hand-assemble our code to hex, and compute addresses and so forth, which means we’ll still be using paper a lot.
405405
406406 Here’s an example of how much easier it will be, though. It’s a fancier version of the warm-up exercise, the “echo” program. It displays a sort of prompt between lines, and lets you quit by starting the line with a period.
407407
408 ![](images/tumblr_inline_nrdcfwfVun1tvda25_540.jpg)
408 ![](images/tumblr_inline_nrdcfwfVun1tvda25_540.jpg?raw=true)
409409
410410 Note that, since we don’t have to convert to binary anymore, we can format the listing on paper more compactly. Entering and reviewing and running it is a matter of a few monitor commands:
411411
412 ![](images/tumblr_inline_nrdcwtBdJt1tvda25_540.png)
412 ![](images/tumblr_inline_nrdcwtBdJt1tvda25_540.png?raw=true)
413413
414414 And we test it a bit to make sure that it works as designed...
415415
416 ![](images/tumblr_inline_nrdcxeiBNf1tvda25_540.png)
416 ![](images/tumblr_inline_nrdcxeiBNf1tvda25_540.png?raw=true)
417417
418418 I’m quite happy with this!
419419
424424
425425 _July 26, 2015_
426426
427 ![](images/tumblr_inline_nrzvpv3cLI1tvda25_540.jpg)
428
429 ![](images/tumblr_inline_nrzwgcclo91tvda25_540.jpg)
430
431 ![](images/tumblr_inline_nrzvqgXQfp1tvda25_540.jpg)
432
433 ![](images/tumblr_inline_nrzvqyNVaf1tvda25_540.jpg)
434
435 ![](images/tumblr_inline_nrzvrcdNt41tvda25_540.jpg)
436
437 ![](images/tumblr_inline_nrzvsmnZih1tvda25_540.jpg)
438
439 ![](images/tumblr_inline_nrzvrp1ZbY1tvda25_540.jpg)
427 ![](images/tumblr_inline_nrzvpv3cLI1tvda25_540.jpg?raw=true)
428
429 ![](images/tumblr_inline_nrzwgcclo91tvda25_540.jpg?raw=true)
430
431 ![](images/tumblr_inline_nrzvqgXQfp1tvda25_540.jpg?raw=true)
432
433 ![](images/tumblr_inline_nrzvqyNVaf1tvda25_540.jpg?raw=true)
434
435 ![](images/tumblr_inline_nrzvrcdNt41tvda25_540.jpg?raw=true)
436
437 ![](images/tumblr_inline_nrzvsmnZih1tvda25_540.jpg?raw=true)
438
439 ![](images/tumblr_inline_nrzvrp1ZbY1tvda25_540.jpg?raw=true)
440440
441441 Now, the program listing! No, wait — I don’t want you to get the impression that this just appeared fully-formed on paper. So, first, I’ll ask you to imagine about 30 sheets of paper that looked something like this:
442442
443 ![](images/tumblr_inline_nrzx8z4FaS1tvda25_540.jpg)
443 ![](images/tumblr_inline_nrzx8z4FaS1tvda25_540.jpg?raw=true)
444444
445445 OK, now the program listing!
446446
447 ![](images/tumblr_inline_nrvw3yUlEx1tvda25_540.jpg)
448
449 ![](images/tumblr_inline_nrvw4g36bA1tvda25_540.jpg)
450
451 ![](images/tumblr_inline_nrvupnPebC1tvda25_540.jpg)
452
453 ![](images/tumblr_inline_nrvuprwkNT1tvda25_540.jpg)
454
455 ![](images/tumblr_inline_nrvupwdWX91tvda25_540.jpg)
456
457 ![](images/tumblr_inline_nrvv2u0j8d1tvda25_540.jpg)
458
459 ![](images/tumblr_inline_nrvv318iAj1tvda25_540.jpg)
460
461 ![](images/tumblr_inline_nrvv39RAu01tvda25_540.jpg)
462
463 ![](images/tumblr_inline_nrvv3ejZHU1tvda25_540.jpg)
464
465 ![](images/tumblr_inline_nrvv3lkICJ1tvda25_540.jpg)
447 ![](images/tumblr_inline_nrvw3yUlEx1tvda25_540.jpg?raw=true)
448
449 ![](images/tumblr_inline_nrvw4g36bA1tvda25_540.jpg?raw=true)
450
451 ![](images/tumblr_inline_nrvupnPebC1tvda25_540.jpg?raw=true)
452
453 ![](images/tumblr_inline_nrvuprwkNT1tvda25_540.jpg?raw=true)
454
455 ![](images/tumblr_inline_nrvupwdWX91tvda25_540.jpg?raw=true)
456
457 ![](images/tumblr_inline_nrvv2u0j8d1tvda25_540.jpg?raw=true)
458
459 ![](images/tumblr_inline_nrvv318iAj1tvda25_540.jpg?raw=true)
460
461 ![](images/tumblr_inline_nrvv39RAu01tvda25_540.jpg?raw=true)
462
463 ![](images/tumblr_inline_nrvv3ejZHU1tvda25_540.jpg?raw=true)
464
465 ![](images/tumblr_inline_nrvv3lkICJ1tvda25_540.jpg?raw=true)
466466
467467 ...
468468
470470
471471 At this point it’s handy to have a list of the entry points, so I wrote that up too:
472472
473 ![](images/tumblr_inline_nrvw5etEln1tvda25_540.jpg)
474
475 ![](images/tumblr_inline_nrvw6d9snl1tvda25_540.jpg)
473 ![](images/tumblr_inline_nrvw5etEln1tvda25_540.jpg?raw=true)
474
475 ![](images/tumblr_inline_nrvw6d9snl1tvda25_540.jpg?raw=true)
476476
477477 Now, to enter it... luckily, entering hex digits with SITU-MON is a lot easier than entering bits using front-panel switches.
478478
479 ![](images/tumblr_inline_nrvwdeHmFt1tvda25_540.png)
480
481 ![](images/tumblr_inline_nrvy8qIiJh1tvda25_540.png)
482
483 ![](images/tumblr_inline_nrvy8xy0h61tvda25_540.png)
484
485 ![](images/tumblr_inline_nrvy92hoW91tvda25_540.png)
486
487 ![](images/tumblr_inline_nrvy99cwPG1tvda25_540.png)
479 ![](images/tumblr_inline_nrvwdeHmFt1tvda25_540.png?raw=true)
480
481 ![](images/tumblr_inline_nrvy8qIiJh1tvda25_540.png?raw=true)
482
483 ![](images/tumblr_inline_nrvy8xy0h61tvda25_540.png?raw=true)
484
485 ![](images/tumblr_inline_nrvy92hoW91tvda25_540.png?raw=true)
486
487 ![](images/tumblr_inline_nrvy99cwPG1tvda25_540.png?raw=true)
488488
489489 All done!
490490
496496
497497 And in order to test it, I needed to have a symbal table for it to work on. I made one up with two very simple “commands” whose effect would be both obvious to see, and non-intrusive on the rest of the system. I decided to have them call two of the simpler routines present in SITU-MON (`WRITE_PROMPT` and `INCR_ADDR`). (And yes, you’re right, they should really be called `$ADDR` and `$INC`, with the dollar signs — thank you for paying attention to the spec. But, this was just to test...)
498498
499 ![](images/tumblr_inline_nrvv4mqr641tvda25_540.jpg)
500
501 ![](images/tumblr_inline_nrw4c1iXf71tvda25_540.png)
499 ![](images/tumblr_inline_nrvv4mqr641tvda25_540.jpg?raw=true)
500
501 ![](images/tumblr_inline_nrw4c1iXf71tvda25_540.png?raw=true)
502502
503503 I wrote the test driver so that I could A8200 then G in
504504 SITU-MON, enter a few symbals, and then, after it returned to SITU-MON,
518518
519519 Once I fixed that, I was able to compile simple “programs”:
520520
521 ![](images/tumblr_inline_nrw4gcaz1J1tvda25_540.png)
521 ![](images/tumblr_inline_nrw4gcaz1J1tvda25_540.png?raw=true)
522522
523523 There was still one more bug. The code generated when compiling a `!` (repeat) was wrong — it was jumping one byte too far back in memory. Once spotted, that was another easy fix. And then...
524524
525 ![](images/tumblr_inline_ns3yny81dG1tvda25_540.png)
526
527 ![](images/tumblr_inline_ns3yoeoq9e1tvda25_540.png)
525 ![](images/tumblr_inline_ns3yny81dG1tvda25_540.png?raw=true)
526
527 ![](images/tumblr_inline_ns3yoeoq9e1tvda25_540.png?raw=true)
528528
529529 Huzzah!
530530
589589
590590 The code for `$SYMBALS`:
591591
592 ![](images/tumblr_inline_ns755p3Sz51tvda25_540.jpg)
592 ![](images/tumblr_inline_ns755p3Sz51tvda25_540.jpg?raw=true)
593593
594594 Dumping the contents of a symbal:
595595
596 ![](images/tumblr_inline_ns755k2lm71tvda25_540.jpg)
597
598 ![](images/tumblr_inline_ns756fINuA1tvda25_540.jpg)
596 ![](images/tumblr_inline_ns755k2lm71tvda25_540.jpg?raw=true)
597
598 ![](images/tumblr_inline_ns756fINuA1tvda25_540.jpg?raw=true)
599599
600600 Replacing all calls to symbal1 with calls to symbal2:
601601
602 ![](images/tumblr_inline_ns7565MTzC1tvda25_540.jpg)
603
604 ![](images/tumblr_inline_ns755u00Fn1tvda25_540.jpg)
602 ![](images/tumblr_inline_ns7565MTzC1tvda25_540.jpg?raw=true)
603
604 ![](images/tumblr_inline_ns755u00Fn1tvda25_540.jpg?raw=true)
605605
606606 Calling those last two routines from the interactive prompt, with `/D SYMBAL` to dump and `/R SYMBAL1 SYMBAL2` to replace calls to symbals:
607607
608 ![](images/tumblr_inline_ns756b1crZ1tvda25_540.jpg)
608 ![](images/tumblr_inline_ns756b1crZ1tvda25_540.jpg?raw=true)
609609
610610 So, if the point of this project was to write the code by hand, I can indeed say I have written those routines by hand! Not assembled, entered, or tested... but written, yes!
611611