RETRO C 1977: a C Compiler for the KIM-1

preview_player
Показать описание
Dave introduces CC65 and adapts the open-source compiler to the 1977 KIM-1 platform before unleashing it on a Prime Sieve to test its performance.

For information on my book, "Secrets of the Autistic Millionaire":

My other channel, join now so you're there for episode 01 of my AudioBook!

Primary Equipment (Amazon Affiliate Links):

As always, all content and opinions are mine only, (c) 2022 Plummer's Software LLC. I am not now nor have I ever been a spokesperson for Microsoft, and retired from my technical role almost 20 years ago.

Found the bug! currentFactor needed to be cast to ulong before being assigned when it is squared, otherwise, it overflows the ushort.
Рекомендации по теме
Комментарии
Автор

My dad used to work with you at Microsoft back in the day, and said you were smart when he recommend your channel. I think that was an understatement! Thanks for a great video. I bought your book this weekend and it should be arriving any day. Excited to give it a read!

NathanStraub
Автор

Two retro computers sitting next to a sink with running 💦, living on the edge Dave

gower
Автор

This is great, I could watch you implement the rest of the standard library too! Thank you!

PeranMe
Автор

FOUND IT! Line 59!
At first, I thought your bit manipulation macro was the culprit, but I could find nothing wrong with it. I typed up you code in Turbo C 3.0 for DOS, and ran witrh much the same result as your own. I proceded to exchange your macro code for my own Turbo Pascal version, that does the same in reverse order, but that *also* was to no avail. (of course I ported the Turbo Pascal code). Now I could put the code into Visual Studo 2022, and here it ran *just* fine.
THEN - as I spent WAY too many hours looking at the issue the wrong way around, I saved *all* the primes found by your code to disk, and the same for my correct 9592 primes from my Turbo Pascal implementation, and compared the result. Sure enough, a few primes was missing, but from strange places in between many others. I isolated the first prime as 3083 by help of my trusty UltraEdit 9.20b, and found that this was mmissing as currentFactor just hit 257 in value, and in line 107, this number is multiplied by itself, yielding 66, 049 - just over the 65, 536 limit of an UNSIGNED INTEGER on yours and mine platforms. This also explains why the code ran on Windows in Visual Studo 2022.
Changing the declaration of currentFactor on line 59 from a uint to a ulong - ét voila!
Thanks for the challenge and the opportunity for an old-school, these days much neglected code review!

andersrimmer
Автор

Nice work! I've written some code with CC65 for the Atari 8-bit computers and it is very cool to be able to write C for the 6502. 6502 assembly is fine but man does having a C compiler really take the edge off, especially when it comes to writing a decent sized program, it's night and day to have a decent high level language to work in. It really does open up a world possibilities for getting some useful work out of these older machines. Great to see a new target!

nicomputerservices
Автор

Just tested it on my online KIM-1 emulator, works like a charm! Thank you so much for putting time and effort!

chessprogramming
Автор

CC65 is great, I've used it for years on the Atari 8-bit and Lynx. I'm sure they will accept the beginnings of this target support in the project, and once in there, hopefully more people will take up filling it out. It's a community project (CC65) and relies on many people doing small improvements to the libraries. Unfortunately the main compiler/assembler/linker author retired from the project a while ago (Ulrich Bassewitz), so that side of the project hasn't had much support lately. It would be really great to see someone help out on that front!

shawnj
Автор

This is pretty awesome - as in awe inspiring! Keep up the great work with this and thanks for sharing.

mikemartinell
Автор

I found this a brilliant video Dave about porting CC65 to the KIM1. Thanks very much. I started coding in C (Hisoft-C) on the ZX Spectrum in 1984, before learning it at university after Pascal.

tonygibbs
Автор

Great video Dave. So satisfying seeing old hardware still making magic

michaelhubble
Автор

I'm always fascinated by older equipment like this. I'm thoroughly amazed how much could be done on so little.

tarzankom
Автор

Thanks for this, I've been looking at implementing CC65 for my homebrew 6502 for a while, but even using C64 as an example, I still couldn't quite work it out. Seeing the exact changes/additions you made in a pull request has given me new hope on my little project. You rule dude.

joeplocki
Автор

My first C compiler on PC was the Mark Williams C Compiler. My first Unix Box was DUAL System 83/20 (Motorola MC 680000) running version 6 (latter version 7). My first PC-XT uses 2 boxes: the hard disk was in a separate box.

JohnnieWalkerGreen
Автор

Great vid again.. Ninja level!

Hope to see a breakdown of the compiler evolution, to LLVM and the CONIO implementation for MinGW/Dev-C++.

MsDuketown
Автор

Memories from the old days. It was a beautiful time

MR-cpsj
Автор

My uncle got me into coding many moons ago. He used to have his Sinclair spectrum ZX81 managing his heating system! My tinkering has always been playing with graphics and games.

makethingsbetter
Автор

love the cc65! congrats on the awesome contrib, bet someone will port some games to the kim with that setup... :-)

ggoedert
Автор

Love this channel - especially when there is code!

danielvest
Автор

Always fun playing around with vintage computer hardware. You did a good job getting the CC65 compiler working on such an old machine. Some years ago I had a similar but not quite as involved project where I worked out how to get a GCC compiler running on an SGI IRIX computer. I documented the process and put it up on my website. I received feedback and questions from various places around the world. The biggest surprise came when I received a comment from a person working at Woods Hole Oceanographic Institution. I don't know if I still have that message as an older copy of my email program corrupted some of the folders containing saved mail.

kevincozens
Автор

I understand hardly a word, but I liked every second.

LoesserOfEvils