Live data from Hacker News

Cloning a 6502 Apple-1 in just 930 logic gates

obsolescenceguaranteed.blogspot.com

31–40 of 47 posts

Re: Cloning a 6502 Apple-1 in just 930 logic gates

#32
post #22

I still recall the shock discovering that Micro-soft BASIC in the Apple ][ did a linear search for the line number from, the beginning of the program, on each GOTO or GOSUB. It would have been super-easy to memoize the search result at the branch site, but Bill couldn't be bothered.

In fact you could poke around and get the line numbers in a different order and the program would still run properly. That's why subroutines were put at the beginning of "efficient" code.

This is cool. I feel like this has implications in metaprogramming, code generation, state machines, interposition, and stuff I haven't thought of.

This changes my understanding of the semantics of basic immensely.

Re: Cloning a 6502 Apple-1 in just 930 logic gates

#33
post #20

Earlier quoted context omitted.

The simplicity of Gigatron is compensated by the large memory that was extremely expensive.

This is a much more profound insight than is readily apparent. It is really easy to build a Turing machine -- except for the tape. You could probably build a universal TM is a lot less than 930 gates. All hardware design is essentially nothing more than taking common design patterns and moving off the tape and into the engine so that the tape can be more compact and the machine can run faster. This is the main reason…

74 series gate golf to get the most compact hardware brainfuck implementation:

http://grapsus.net/74/

Re: Cloning a 6502 Apple-1 in just 930 logic gates

#34
post #22

I still recall the shock discovering that Micro-soft BASIC in the Apple ][ did a linear search for the line number from, the beginning of the program, on each GOTO or GOSUB. It would have been super-easy to memoize the search result at the branch site, but Bill couldn't be bothered.

Doesn't sound that easy to me. You'd need an efficient way to forget all those memoized values on each program edit, and every byte of program storage counted when memory size was a whopping 4K.

Re: Cloning a 6502 Apple-1 in just 930 logic gates

#35
post #22

I still recall the shock discovering that Micro-soft BASIC in the Apple ][ did a linear search for the line number from, the beginning of the program, on each GOTO or GOSUB. It would have been super-easy to memoize the search result at the branch site, but Bill couldn't be bothered.

Sneer all you want, Microsoft Basic was a reasonable achievement considering that:

1) it ran in under 4K bytes of memory on an Altair 8800. That means less than 4,096 bytes of memory. Not 4,096 Kilobytes or Megabytes. 4,096 bytes.

2) An enhanced version ran in under 8K bytes of memory. Less than 8,192 bytes. Let me repeat: less than 8,192 bytes.

When you're fitting an entire BASIC interpreter in 8,192 bytes, you're not spending a lot of effort to memoize a search result.

Bill had a lot on his plate at the time. The software started out on the Altair, but all sorts of manufacturers were soon beating the door down begging for versions for the Commodore PET, the Atari, and countless other computers.

https://en.wikipedia.org/wiki/Microsoft_BASIC

Re: Cloning a 6502 Apple-1 in just 930 logic gates

#36
post #20

Earlier quoted context omitted.

This is a much more profound insight than is readily apparent. It is really easy to build a Turing machine -- except for the tape. You could probably build a universal TM is a lot less than 930 gates. All hardware design is essentially nothing more than taking common design patterns and moving off the tape and into the engine so that the tape can be more compact and the machine can run faster. This is the main reason…

74 series gate golf to get the most compact hardware brainfuck implementation: http://grapsus.net/74/

I have to admit that is pretty cool in a sick and twisted kind of way.

Re: Cloning a 6502 Apple-1 in just 930 logic gates

#37
post #22

I still recall the shock discovering that Micro-soft BASIC in the Apple ][ did a linear search for the line number from, the beginning of the program, on each GOTO or GOSUB. It would have been super-easy to memoize the search result at the branch site, but Bill couldn't be bothered.

Sneer all you want, Microsoft Basic was a reasonable achievement considering that: 1) it ran in under 4K bytes of memory on an Altair 8800. That means less than 4,096 bytes of memory. Not 4,096 Kilobytes or Megabytes. 4,096 bytes. 2) An enhanced version ran in under 8K bytes of memory. Less than 8,192 bytes. Let me repeat: less than 8,192 bytes. When you're fitting an entire BASIC interpreter in 8,192 bytes, you're n…

From what I've read, Microsoft BASIC was considered too bloated for a 4K machine, plus Bill Gates wrote an open letter to hobbyists and suggested they were all pirates, so a smaller BASIC was developed called "Tiny BASIC":

"Tiny BASIC was published openly and later invented the term "copyleft" to describe this. This made it popular in the burgeoning early microcomputer market."

https://en.wikipedia.org/wiki/Tiny_BASIC

Re: Cloning a 6502 Apple-1 in just 930 logic gates

#38
>"Turning 930 logic gates into a working 6502 Apple-1 clone? Like the venerable IBM 360/30, the Gigatron uses a form of microcode to elevate its spartan eight hardware instructions into a comfortable instruction set you can live with. Like the 8-bit IBM 360/30 CPU, the Gigatron normally pretends to be a 16-bitter using its microcoded instruction set. Unlike the IBM, though, the Gigatron's instruction set is not compatible with anything else.

Which sparked a discussion: could the microcode also contain a 6502 compatible instruction set? That would prove that a 6502 compatible system could be done with much, much less hardware, even back in the 70s.

Short answer: yes. In fact, you can make it into an entire Apple-1 clone without the use of a 6502.

[...]

Marcel wrote the Gigatron's 6502 microcode quickly (no bugs detected so far) but wrapping the Apple-1 around it took about a year. The machine has become dual-core: you either use its colourful native vCPU microcode to embarrass 1980s home computers, or you boot it into 6502/Apple-1 mode to demonstrate how a compatible Apple-1 including all its display hardware can be done in only 930 logic gates. Hmm!

The 6502 microcode takes up about 1K of ROM cells, and could fit inside a fast late-70s ROM. But the Gigatron cheats a bit by using a biggish 128K EPROM from the 1980s. That leaves enough space to tuck in the 6502/Apple-1 microcode next to all the other features of the latest Gigatron v5a ROM."

Re: Cloning a 6502 Apple-1 in just 930 logic gates

#39

What's fascinating about this is that the home computer "revolution" could have started a few years sooner had people just realized they could make a CPU out of 33 74xxx series IC chips. These were relatively low cost by the early to mid 70s. It took a generation of skill to go back and see what could be done with just these logic building blocks.

But they did build those systems. They were called minicomputers. They took up more room than a microcomputer and cost a bunch more money. Because building a system like this is expensive both in engineering and component costs.

For example, one thing about the Gigatron is that it uses static RAM. Static RAM is fast, but expensive, and back in the early 80s even dynamic RAM was dear, and static RAM was several times more expensive than that. All the early 8080 and 6502 computers were using dynamic RAM. With static RAM, and fetching instructions out of ROM, and using a 74 series that wasn't available at the time, the Gigatron benefits from modern times.

Re: Cloning a 6502 Apple-1 in just 930 logic gates

#40

Earlier quoted context omitted.

But they did build those systems. They were called minicomputers. They took up more room than a microcomputer and cost a bunch more money. Because building a system like this is expensive both in engineering and component costs.

For example, one thing about the Gigatron is that it uses static RAM. Static RAM is fast, but expensive, and back in the early 80s even dynamic RAM was dear, and static RAM was several times more expensive than that. All the early 8080 and 6502 computers were using dynamic RAM. With static RAM, and fetching instructions out of ROM, and using a 74 series that wasn't available at the time, the Gigatron benefits from mo…

The Original Commodore PET, up until the model "N" that was introduced in 1979, had static RAM. I had the 8k model back in 1978.
Post reply on HN