Live data from Hacker News

Cloning a 6502 Apple-1 in just 930 logic gates

obsolescenceguaranteed.blogspot.com

41–47 of 47 posts

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

#41
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.

Trust me, it would be easy. They could all be erased on the first edit, in time not noticeable.

Essentially the same code would have been in each interpreter, so written just twice. The space for the code to do it would be in ROM, so would not take up any of your precious 4k.

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

#42

Earlier quoted context omitted.

Thanks, I understand that microcode is one of two ways to implement the control unit on a CPU. My question was more of if a CPU only has "a spartan eight hardware instructions" and microcode is used to implement each of those eight hardware instructions how does that allow the ISA to be greater than the original eight instructions?

The microcoded CPU is processing a richer virtual ISA. Have a look at SWEET16 for an analogous 16-bit virtual CPU on an 8-bit CPU: https://en.m.wikipedia.org/wiki/SWEET16 Edit: SWEET16 would run fine on this emulated 6502, too. Inception! The Apollo guidance computer did something similar.

Also Dann McCreary wrote in 1978 an “8080 Simulator for the 6502” https://www.pagetable.com/?p=824

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

#43
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…

It did not fit in 4K on the Apple ][. PET and Atari were also 6502, like Apple, so mostly the same code. Altair and the others were 8080. So, only two interpreters. It was the same design on two instruction sets, with some simple customization per vendor. Some had a Z-80, with extra instructions available: using those made your program smaller, but slower. It is doubtful he did.

That it was so short also meant there just wasn't much to it. Bill doesn't need your unpaid defense. He didn't make his $billions from BASIC. That just gave him a customer list.

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

#44

Earlier quoted context omitted.

The microcoded CPU is processing a richer virtual ISA. Have a look at SWEET16 for an analogous 16-bit virtual CPU on an 8-bit CPU: https://en.m.wikipedia.org/wiki/SWEET16 Edit: SWEET16 would run fine on this emulated 6502, too. Inception! The Apollo guidance computer did something similar.

Also Dann McCreary wrote in 1978 an “8080 Simulator for the 6502” https://www.pagetable.com/?p=824

I now want to use the Javascript-based Gigatron emulator[1] in a browser on a Windows 2000 VM under the jslinux emulator[2]. (I wonder how jslinux would handle a few-year-old version of Firefox...)

Then I can run the Gigatron-based 6502 emulator in that browser to run the 8080 simulator you referenced to run CP/M. Under CP/M I should be able to find a COBOL program to run. I would be achieving an immense coefficient-of-"Inception" and re-enacting "The Birth and Death of all Software" [3] simultaneously.

Doing all of this in Windows NT 4.0 or Linux on my DEC Multia w/ an Alpha CPU would just be icing on the cake.

[1] https://github.com/kervinck/gigatron-rom/tree/master/Contrib...

[2] https://bellard.org/jslinux/

[3] https://www.destroyallsoftware.com/talks/the-birth-and-death...

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

#45
post #32

Earlier quoted context omitted.

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.

Sorry, it is not cool at all.

A system that runs subroutines faster according to how far they are from the start of the program is just badly designed. Robustness against poking in different line numbers is not worth trading off performance.

He should be ashamed.

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

#46
post #5
post #4

"It needs just 930 logic gates (packed into 33 standard 7400-series ICs) to create a computer that beat 'complex' 1980s home computers like the VIC-20 in terms of both CPU power and graphics." Given that 7400 chips existed at the time, why did no contemporary microcomputer go this route? Would it just have been cost prohibitive?

There were commercial computers that did. The PDP-8, as one example (not 74xx, but similar). Edit: The Xerox Alto CPU was built with 74181 chips. Cost, power consumption, space, etc, are all disadvantages. I assume the Gigatron is using modern 74HCxx CMOS chips, which consume less power than the original 74xx TTL chips.

Typical discrete logics designs were much larger than the Gigatron. So they're not the same. Using 74LS the single board draws 2.5 W.

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

#47
post #4

"It needs just 930 logic gates (packed into 33 standard 7400-series ICs) to create a computer that beat 'complex' 1980s home computers like the VIC-20 in terms of both CPU power and graphics." Given that 7400 chips existed at the time, why did no contemporary microcomputer go this route? Would it just have been cost prohibitive?

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

It doesn't need a large memory if remove the video, or if you change it to B/W.
Post reply on HN