-
Notifications
You must be signed in to change notification settings - Fork 5
/
history.htm
83 lines (83 loc) · 6.38 KB
/
history.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>history</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<link rel="stylesheet" href="/G-Pascal/G-Pascal.css" />
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<h1 id="what-is-g-pascal">What is G-Pascal?</h1>
<div class="quick_link">
<a href="index.htm">Back to main G-Pascal page</a>
</div>
<p><img src="images/G-Pascal%20version%201.jpg" /> <img src="images/G-Pascal%20version%202.jpg" /> <img src="images/G-Pascal%20version%203.jpg" /></p>
<p>Author: Nick Gammon</p>
<p>Date: February 2022</p>
<hr />
<h2 id="it-all-started-with-512-bytes-of-ram">It all started with 512 bytes of RAM</h2>
<p>In 1979 I bought a Motorola 6800 evaluation kit, which involved a couple of printed circuit boards and a heap of components. I soldered it together and got it working. The “PC” had 512 bytes of RAM, and programs had to be keyed in through a small keyboard in hex (that is, raw machine code).</p>
<p><img src="images/Motorola_hex_keypad.jpg" /></p>
<p>Interesting though this was, it was very tedious hand-assembling programs and keying them in, byte by byte. After I expanded the computer with a RAM board (from Pennywise Peripherals) I had the idea of writing an assembler, to simplify writing code. My first version of this assembler had to be hand-coded in hex machine-code. I found that the 6800 instruction set had a lot of consistency about it. For example, the top 4 bits of an instruction would be the addressing mode, and the bottom 4 bits the opcode. For example with LDA (load accumulator):</p>
<ul>
<li>LDA (A immediate): $86</li>
<li>LDA (A direct): $96</li>
<li>LDA (A extended): $B6</li>
<li>LDA (A indirect): $A6</li>
</ul>
<p>… and so on. So you can see that LDA always was in the format $x6 where x was the addressing mode and the 6 was for LDA.</p>
<p>Meanwhile SBC (subtract with carry) looked like this:</p>
<ul>
<li>SBC (A immediate): $82</li>
<li>SBC (A direct): $92</li>
<li>SBC (A extended): $B2</li>
<li>SBC (A indirect): $A2</li>
</ul>
<p>… and so on. So again, the “2” at the end was the operation (subtract with carry) and the first four bits were the addressing mode. From that you could deduce that any of the instructions (which used this format) had addressing modes like this:</p>
<ul>
<li>A immediate: $8x</li>
<li>A direct: $9x</li>
<li>A extended: $Bx</li>
<li>A indirect: $Ax</li>
</ul>
<p>This made writing the assembler comparatively easy, because you basically worked out the addressing mode, which gave you 4 bits of the opcode, and the instruction name, which gave you the other 4 bits. Combining those gave you a complete opcode. There were some exceptions, of course, such as the “push” and “pull” instructions which didn’t have an addressing mode.</p>
<p>Once this was finished I bought an UV EPROM expansion board (also from Pennywise Peripherals) and burnt the assembler onto the EPROM chips, giving me an on-board assembler that was available as soon as you powered up the board. (You erased memory by placing the chips inside a UV-emitting box for a few minutes).</p>
<p><img src="images/Motorola_EPROM_board.jpg" /></p>
<p>Once I had an assembler I could keep enhancing it by writing new versions of the assembler in the earlier version. The EPROM board had enough capacity that there was room for the old version (on one half) and the new, improved, version (on the other half). Thus I was able to keep “bootstrapping” the assembler into a newer and better version.</p>
<hr />
<h2 id="tiny-pascal">Tiny Pascal</h2>
<p><img src="images/Byte%20article.png" /></p>
<p>The compiler was originally written in 1979 for the Motorola 6800 after reading a series of articles in Byte magazine (September, October, and November in 1978) written by Kin-Man Chung and Herbert Yuen. That article described making a “Tiny” Pascal compiler written in Basic. That particular version was burnt onto UV-eraseable PROM, and kept on-board to my “personal” computer, along with a text editor and code to load/save programs.</p>
<hr />
<h2 id="g-pascal">G-Pascal</h2>
<p>After I purchased an Apple II, I ported the compiler to the 6502 processor, and released a version in April 1982.</p>
<p><img src="images/G-Pascal%20version%201.jpg" /></p>
<p>Version 2 was released shortly afterwards, I can’t recall exactly the differences between them.</p>
<p>In April 1983 I was contacted by Ian Webster, the editor of Australian Personal Computer magazine, who suggested that the new state-of-the-art computer would be the Commodore 64. As it had the same chip as the Apple II (the 6502) he suggested I port G-Pascal to the Commodore 64. I spent a few months adapting the compiler to work with the Commodore 64, and in particular added a whole lot of support for their graphics and sound features.</p>
<p><img src="images/G-Pascal%20version%203.jpg" /></p>
<p>This was released in November 1983 to favourable reviews.</p>
<hr />
<h2 id="today">Today?</h2>
<p>G-Pascal fell into disuse gradually as more powerful computers arrived, with the Apple II, and Commodore 64 being superceded by more powerful machines. However after watching Ben Eater’s videos about his “6502 breadboard computer” I thought perhaps it was time to revive G-Pascal.</p>
<p>I still had, thankfully, a copy of the source for the Commodore 64, in the form of a listing file. This was fortunate because I was able to load the source into Vasm, with a fair bit of mucking around, and confirmed that the generated code was the same as in 1983. Then it was a matter of removing the references to the Commodore 64 stuff, and adding in support for the VIA chip, the LCD, and some other features, like CRC checks of the source.</p>
<hr />
<h2 id="references">References</h2>
<ul>
<li><a href="https://en.wikipedia.org/wiki/EPROM">EPROM - Wikipedia</a></li>
<li><a href="https://archive.org/details/byte-magazine">Byte Magazine archives</a></li>
</ul>
<div class="quick_link">
<a href="index.htm">Back to main G-Pascal page</a>
</div>
</body>
</html>