I have emailed you before, and i got so excited that a major player in the computer world awnsered me. So here goes my question. My friend and I want to make our own computer software, We bought an old computer and scraped it, and made a new computer, but we want to make our own operating system, You said you made basic for the Apple 1 and II. What did you us to make it? what type of software, if any would we need to make it with, and is there any hard ware we might need?
I don't know if these comments will apply, but here they are.
In high school I fell in love with minicomputers, which were basically small computers equivalent to the microprocessors once they came out. Well, I could never afford a minicomputer but I looked at the programming instructions for machine language and tried to write my own short routines. In college I started trying to figure out how compilers, like Fortran, were written. I knew that the compiler program had to read a line at a time and figure it out and convert it to code that the computer could run. So I started writing a routine in assembly language (machine language) that would analyze a line for correctness. But I never could afford a computer to try it on, nor an assembler to type it into. It was just a personal program that nobody else knew about.
After I'd designed a computer, before Apple was even conceived, I decided to write a BASIC for real. I'd never studied how to do this, but I had self trained myself a bit back in college as I described above. I'd never used BASIC but I knew that this was the popular language for games and that was too important to ignore. The first thing I did was get a BASIC manual at Hewlett Packard, where I was working. I read it and made notes and pretty much learned what commands it had. Of course this was Hewlett Packard BASIC. It differed from the Digital Equipment BASIC, that Bill Gates' first BASIC was based on, mostly in some string manipulation. This later turned out to be the greatest difference between my BASIC and theirs. I was tired of MID$, LEFT$, RIGHT$ type functions so I preferred the HP BASIC better (A$(5,7) meant the 5th through 7th characters of A$).
I'd never formally educated myself in the area of compilers and interpreters (compilers translate a program to machine code to run rapidly later, interpreters scan the program and figure it out as it's being run, which results in much slower execution--BASIC is an interpreted language). But I knew how Syntax charts defined the structure and words of a programming language, as you find these in programming manuals. I decided to write down a full Syntax description of my BASIC to begin. I'd never done such a thing, but it wasn't hard and was modeled after others that I could find.
I next decided that I'd actually put this syntax list into memory as part of my BASIC interpreter. It was stored character by character. I figured that I'd just scan the input line, after the user hit Return, character by character, tracing a path through the syntax table and backing and retrying things. If the line made it through the Syntax table then it was good, otherwise it was in error.
The unexplainable part is how I came up with the way my BASIC would actually do what it was supposed to. As BASIC elements were found in the Syntax Table, I generated tokens (codes) for these elements. For example, a left parenthesis might generate token #87. But in another usage, a left parenthesis might generate token #115. It depended on where it was encountered in my Syntax table in memory, the one I was traversing character by character and matching the input line. In an inefficient effort to make my BASIC very tiny and save every possible byte (even the minimal amount of memory for a computer language was very expensive in 1975) I actually counted how many BASIC symbols the 'matched' one was from the start of the syntax table, and used that count as it's token value.
After this step, I generated a line that didn't have to go through the Syntax evaluator again. The Syntax evaluator could be very tiny and run slowly, as it only ran once per line, which took only a fraction of a second for a typical line. When the program ran, it was already half in shape for speed.
Now comes a less explainable part. I had read and heard some things about compilers but I still don't know to this day if what I did was good or bad. As a line executed in a running program, it consisted of numbers (precompiled into constants I think) and variable names and grammar elements like a plus sign token or a left parenthesis token. When, during execution, the BASIC encountered a 'noun' (number or variable) it was pushed onto a noun stack, ready for retrieval. This was like our HP calculators where I worked.
When the BASIC encountered a 'verb' (a token that called for an operation) it would be evaluated in comparison to a verb stack. This was the way of reading a human-written expression from left to right, but doing the operations in a different order (2+3*4 does the multiplication first in most computer languages, even though the plus sign appears first). For each token I assigned 2 priorities. One was the priority to push preceding tokens off the stack for execution. For example, 3 + 7 * 5 would push 3 on the noun stack, + on the verb stack, then 7 on the noun stack (where it's ready to be the first element removed from this first-in last-out stack). When the * is encountered, it had a higher execution priority than + so it didn't pull the 7 and 3 off and add them yet. Instead it pushed the * onto the verb stack and then the 5 onto the noun stack. The end of line was a token with priority to push everything off.
So at this time the * is the 'topmost' token on the verb stack. It comes off and runs a prewritten multiply routine that pulls two items off the noun stack, adds them, and pushes the result back on that noun stack.
Any token that causes others to be executed immediately off the verb stack would keep looking at token priorities until it's own priority was such that it would merely be pushed onto the verb stack and await later execution.
Parentheses bring another factor into play. A left parenthesis is always pushed onto the top of a verb stack, hiding the execution priority of the preceding operator token until a right parenthesis, with extremely high execution priority, causes all tokens to be executed until the left parenthesis is encountered. At that time the right parenthesis has found it's mate and stops forcing ops (tokens) to execute. This is a sort of exception to the concept of a single priority. In addition, the left parenthesis forces no ops off the verb stack, acting as though it has extremely high priority. But no ops force it off, until the right parenthesis, as though it had an extremely low execution priority. So I actually had two priorities for each token, a 'push' tendency and a 'pull' tendency. A verb (token) would only push other verbs off the verb stack and execute them if it's push priority was greater than their pull priority.
I have no idea where these sorts of ideas came from. They just came to me as I needed an elegant solution.
A table held bites with 2 one of zixteen priorities for each token that might be in the interpreted BASIC program. Another table held an address pointer for each token, that pointed to the routine to run when that token was forced to execute. So for each of the dozens of tokens, I had to only write a short routine. This kept the program less complicated and easier to add new commands to.
I couldn't afford an assembler. I wrote the entire program on paper, assigning memory addresses for each program instruction. When I shortened a routine, it was too much trouble to re-write (by hand) a few K-Bytes of code just to shrink the space. So there were many cases of short empty spaces in my BASIC. When a routine needed to expand, I'd usually jump to a patch area where it's latter part was. None of this would have happened if I could have afforded an assembler, which would have packed things properly.
I was just curious about what you did for Atari? I've heard that Steve Jobs had worked there and was using you for chip consolidation on the Breakout arcade game. I was curious if this is true and what all you did for Atari?
I did design Breakout for Atari, in very few chips. Steve got me to do it in 4 days which is unbelievable for hardware. We both stayed up all night for 4 nights in a row and barely finished it. While Steve wirewrapped my design and it's changes, I would go onto the factory floor and play all night, for free, the first driving arcade game, GRAN TRACK 10. I got so good that years later, when I'd moved to Scotts Valley, I found a pizza parlor with that game and a free pizza for a score over 36. I could easily do this and after two free pizzas they took the game out.
I worked at Hewlett Packard. I had designed my own version of Pong with very few chips and the Atari people saw it and offered me a job. But I loved HP too much.
I was still in diapers when you and Steve Jobs started Apple in his parents garage. When I was in grade school my father bought me an ADAM computer (Z80) made by Coleco. Soon after that I was turned to the Apple //e. I remember very vividly the first time, at a convention, the first LISA. I was mesmerized. I first start using the MAC 512 in school, the newspaper. I used them until I graduated from school. I had every thing from the 512 to the Power Mac. Then because of the ever rising price of computers I was forced to turn the enemy, IBM. I now own both.
I was wondering how much you used the IBM compatible computers if ever?? Also, who decided to leave the bite out of the Apple in the logo?? You have seemed to be a very concerned person, kudos on your outlook on life. What is your outlook on the afterlife? What kind of religious beliefs do you have? Please reply, and thank you for your contributions to world that I grew up in .
I barely used the IBM compatables in early times. I kinda' liked the "junior" or something but nobody else did. I use them once in a while these days, when they are needed for my network administration. But I work around them as much as possible. I have a friend who has to use them and develop for and on them and he hates them just as much and always uses a Mac if there's any way. In his case, he's definitely expert enough on both platforms, the PC's are just more difficult.
I talked myself into some very strong religious beliefs around the start of college, and before too. I was very good and pure and generally only crossed streets at the corners and didn't drink or smoke or use drugs or participate in wild things. My religion was a pact with myself. I was very independent and had been strongly influenced by writers like Emmerson and Thoreau. I wasn't to be a follower. I wouldn't conform to my peers and do things just because they did them. If I was to get drunk it would have been alone only, because I had a reason and not just to follow others. I wouldn't join any church because then you're just going along with a bunch of other people. Is it that hard to figure out what's good and bad? I had nothing against the bible but didn't really read it. I admired Jesus. He must have been great to be so well remembered 2000 years later, and his turning the other cheek meant something akin to being good to those who are bad to you or say bad things about you. I picked up a lot of my internal religion cues from Dylan songs and Paul Simon songs (the "Boxer") and Dave Mason ("We just Disagree") and others to this day. I love popular music for these sorts of insights.
My favorite religious person was an engineer at Hewlett Packard who was also a Mormon (but not the former Mormon who was the lab manager and who turned down the idea of a computer, not as the movie shows but rather because he couldn't justify it as an HP product despite the fact that he loved it very much). Bill said that when people say that they have inner goodness, how can you tell if they're telling the truth. Outer things like the clothes they wear or the college they graduated don't mean as much as how they feel about and treat people, what's in their heart. He explained that he didn't forego coffee and other things because they were evil or bad or unhealthy. But these sorts of sacrifices are on the outside where everybody can see. Others can't see your inside but they can see these things. If you make such sacrifices for you religion and never waver, people can see that you hold true to your religion's tenets and beliefs, they can see that you must be true to these other tenets of being good as well.
When you first began working with the Apple (and I've read that you worked for both HP and Atari) what kind of education in the area of hardware construction and software development did you have (e.g. formal logic, mathematics, etc.)?
In third grade I was the only boy that could do flash cards as fast as the girls. In 4th and 5th grades I built electronics projects for science fairs. By 6th grade I could build and design many simple electronic circuits and had a ham radio license. I built my Hallicrafters receiver and transmitter as kits. In 6th grade I also built a tic-tac-toe computer out of hundreds of transistors and diodes on a 3' x 4' piece of plywood, using nails for connectors to solder to. I almost finished this computer, based on logic gates. In 8th grade I built a 10 bit parallel adder/subtractor and did very well in the local science fairs. The Air Force gave me their special award for the best electronic project in the Bay Area Science Fair, even though as an 8th grader I was competing with up to 12th graders.
I constructed house to house intercoms in my neighborhood as a kid and read Popular Electronics, along with Tom Swift. I once won a soldering iron from Popular Electronics Magazine for submitting a joke. Occassionally I could ride my bike all the way to Sunnyvale Electronics and buy enough parts to build some small project, most often for a school prank.
In high school I got my first minicomputer manual. I know how logic worked and I'd already sketched out many pages of a calculator design. Now I worked out a design for the PDP-8 computer based on my knowledge of logic. I started getting more and more computer manuals to practice my designs. Also I kept up with the latest chip catalogs. Every time I redesigned a minicomputer, I tried to use fewer chips than before. My design skills got better and better and I started getting very tricky on occassion. I would first look for the best chips that did the job at hand, but then would spend many more hours trying to find one chip intended for something else, that would do the job with fewer chips than normal. I found that I could often win at this game.
It was only a game. I had no friends or relatives or teachers that did this design stuff with me. I had nobody to even show my designs to. I'd be embarrassed if anybody watched me designing them while in classes. It was an advantage for my shyness that nobody knew what I was doing.
I was a math and science and electronics star in Junior High School and in High School, winning many honors. I was also a good math and science student, achieving many 800's on my college entrance exams. I didn't apply to any prestigious colleges because I visited the University of Colorado in Boulder and saw snow for the first time. That was the only place I'd go after that.
I kept up my designs in college. I took a year off to pay for my third college year, programming for a local computer company. I took some real computer courses my third year, at Berkeley. I loved these courses so much that I'd sometimes finish the course bookwork in 2 weeks.
I took off a year to earn money for my fourth college year. I wound up working on calculators at Hewlett Packard as an engineer. As my career progressed, I didn't have a chance to complete my degree. I worked on countless interesting computer projects outside of work. I also ran my dial-a-joke in this time frame. Eventually, we started Apple.
You may have some answers in this long discourse, but mainly it boils down to my having been mostly self taught and not formerly educated in computer areas.