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

  Рет қаралды 46,215

Dave's Garage

Dave's Garage

Күн бұрын

Пікірлер: 181
@NathanStraub92
@NathanStraub92 2 жыл бұрын
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!
@MR-cp4sj
@MR-cp4sj Жыл бұрын
Just a sweet comment from an obviously awesome kid
@chessprogramming591
@chessprogramming591 2 жыл бұрын
Just tested it on my online KIM-1 emulator, works like a charm! Thank you so much for putting time and effort!
@gower1973
@gower1973 2 жыл бұрын
Two retro computers sitting next to a sink with running 💦, living on the edge Dave
@andersrimmer6675
@andersrimmer6675 2 жыл бұрын
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!
@tentative_flora2690
@tentative_flora2690 2 жыл бұрын
XD when he said to find the bug and put it in the comments I knew I could count on the answer being there. Thank you for checking open source code for bugs.
@andersrimmer6675
@andersrimmer6675 2 жыл бұрын
It was a fun challenge to once again debug code like we did 30 years ago. However, I was, and am, convinced the bug was put there purposely, and would only be a bug on older machines. Never the less, it was a blast to try and remember how to check for errors the old way, and use my labs vintage equipment for just that. Monday was a day off where I live, and it was raining cats and dogs all day. Perfect for a challenge. Good times!
@modrobert
@modrobert 2 жыл бұрын
Does his C standard library code support ulong?
@andersrimmer6675
@andersrimmer6675 2 жыл бұрын
@@modrobert Just checked my Kernighan and Richie "The C Programming Language" rev. 1 from '78, and the *unsigned long* datatype is referenced multiple places with a 32 bit precision on the PDP-11, IBM 370 and Interdata 8/32. On the Honeywell 6000, the precision is 36 bits. On page 34, the book states: "The intent is that *short* and *long* should provide different lengths of integers where practical; *int* will normally reflect the most"natural" length for a particular machine. As you can see (ed: from the table of precisions on the page in the book), each compiler is free to interpret *short* and *long* as appropriate for its own hardware. About all you should count on is that *short* is no longer than *long*"
@nicomputerservices2669
@nicomputerservices2669 2 жыл бұрын
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!
@c128stuff
@c128stuff 2 жыл бұрын
I still write a fair bit of 6502 assembler code, maintaining a 'monster' which is now almost 60k of hand written assembler. As it has to run from rom, and needs to take care of 3 different bank switching schemes (c128 mmu, cartridge/expansion rom and some 'private' cartridge ram), it would require a major overhaul of the c128 target for cc65 (which might be a good idea anyway, as its support for the c128 mmu is.. primitive).
@HAGSLAB
@HAGSLAB 2 жыл бұрын
@@c128stuff Now I'm really interested in knowing what this monster is and what it does 😅
@c128stuff
@c128stuff 2 жыл бұрын
@@HAGSLAB c128 device manager. Should be easy to find with google or such..
@HAGSLAB
@HAGSLAB 2 жыл бұрын
@@c128stuff Thank you for replying, I will check it out.
@c128stuff
@c128stuff 2 жыл бұрын
@@HAGSLAB There is a new release pending, but have to finish some changes to the UI code, which I'm not really getting to. There are essentially 2 versions of it, and a derived diagnostics rom. One version is for use with the UII+ cartridge (this is also the most complete version, as it can make use of extra UII+ features for the C128), and a 'standalone' version. Its all based on a single source tree, just 3 different build targets (and the joys of keeping everything working with different features and memory layouts)
@PeranMe
@PeranMe 2 жыл бұрын
This is great, I could watch you implement the rest of the standard library too! Thank you!
@kreuner11
@kreuner11 2 жыл бұрын
Don't they have a bunch of agnostic code for it?
@tonygibbs9339
@tonygibbs9339 2 жыл бұрын
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.
@michaelhubble6252
@michaelhubble6252 2 жыл бұрын
Great video Dave. So satisfying seeing old hardware still making magic
@tarzankom
@tarzankom 2 жыл бұрын
I'm always fascinated by older equipment like this. I'm thoroughly amazed how much could be done on so little.
@mikemartinell
@mikemartinell 2 жыл бұрын
This is pretty awesome - as in awe inspiring! Keep up the great work with this and thanks for sharing.
@joeplocki3525
@joeplocki3525 2 жыл бұрын
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.
@LoesserOf2Evils
@LoesserOf2Evils 2 жыл бұрын
I understand hardly a word, but I liked every second.
@JonC341
@JonC341 2 жыл бұрын
Dave, bro this is insane. Lol I still loved every minute.
@shawnj4545
@shawnj4545 2 жыл бұрын
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!
@kevincozens6837
@kevincozens6837 2 жыл бұрын
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.
@dexteroreilly
@dexteroreilly 2 жыл бұрын
Great video Dave!
@JanWestin
@JanWestin 2 жыл бұрын
Appreciate these back to basics deep dives. With 15+ years and kicking as a developer, it is always good to remind one self on what major building blocks one relies upon on a day to day basis. Keep the flow going Dave! :) //Returning viewer
@grengren6421
@grengren6421 2 жыл бұрын
This was so facinating
@MR-cp4sj
@MR-cp4sj Жыл бұрын
Memories from the old days. It was a beautiful time
@williamansfield
@williamansfield 2 жыл бұрын
It is so much more complex to understand how computers work today, love looking at these older machines where everything can be understood. Feel I missed out in the days when this was more possible…. not giving up my iPhone though. 🤪 Dave you are doing an awesome job educating me!!
@anon_y_mousse
@anon_y_mousse 2 жыл бұрын
Computers were definitely more fun when you could picture how it all worked in your mind and not as an overview.
@makethingsbetter
@makethingsbetter 2 жыл бұрын
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.
@satchice9102
@satchice9102 2 жыл бұрын
The Sinclair ZX Spectrum and the Sinclair ZX81 are two different computers. The ZX81 came out in 1981, and the ZX Spectrum in 1982. Main differences are the ZX81 only had 1K RAM (expandable to 16K with a "RAM Pack"), mono display with only upper case text and graphics character set, no sound, flat membrane keyboard. The ZX Spectrum had 16K/48K, colour, 256x192 graphics resolution, beeping speaker sound, rubber keys. Both computers used the Zilog Z80 processor.
@makethingsbetter
@makethingsbetter 2 жыл бұрын
@@satchice9102 indeed, I do recall. I was just excited when I typed that! Ha! He used the ZX81 to do the heating and also developed a couple of games we used to play. I had the ZX Spectrum 48k myself, then the 128+ with the drive, but managed to brick it with some experimental tinkering. That was an urgent setting summer!
@microchipmatt
@microchipmatt 2 жыл бұрын
You sir, are an artist.
@ggoedert
@ggoedert 2 жыл бұрын
love the cc65! congrats on the awesome contrib, bet someone will port some games to the kim with that setup... :-)
@JohnnieWalkerGreen
@JohnnieWalkerGreen 2 жыл бұрын
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.
@anon_y_mousse
@anon_y_mousse 2 жыл бұрын
I don't remember what my first C compiler was, I tried out so many, but my favorite was definitely LCC. The lcc-win32 suite of tools that Jacob Navia wrote, expanding on the work that, of all sources, came from Microsoft Research, was great. If you use Windows you can actually still get it and a 64-bit version at that. These days I pretty much exclusively use GCC since I don't use Windows anymore.
@danielvest9602
@danielvest9602 2 жыл бұрын
Love this channel - especially when there is code!
@solarbirdyz
@solarbirdyz 2 жыл бұрын
Absolute mad lad, I love it.
@BrainboxccGames
@BrainboxccGames 2 жыл бұрын
Thanks so much! i didnt know cc65 was a thing, now i'm going to have to try and get it to work on the BBC Master 128!
@ukcroupier
@ukcroupier 2 жыл бұрын
Thanks for adding to CC65
@DavesGarage
@DavesGarage 2 жыл бұрын
You bet
@capnzilog
@capnzilog 2 жыл бұрын
Awesome. Such a delight!
@MsDuketown
@MsDuketown 2 жыл бұрын
Great vid again.. Ninja level! Hope to see a breakdown of the compiler evolution, to LLVM and the CONIO implementation for MinGW/Dev-C++.
@jeffreyphipps1507
@jeffreyphipps1507 2 жыл бұрын
Very interesting. My head hurts, but I found it really interesting! Thanks!
@drop0ne_f20
@drop0ne_f20 2 жыл бұрын
I love this stuff!!!
@OMNI_INFINITY
@OMNI_INFINITY 9 ай бұрын
*Notice how dave didn't even make the CPU from discrete components. That maybe explains some of why there wasn't a search function in task manager...*
@davidsault9698
@davidsault9698 2 жыл бұрын
wow. deep dive stuff. love it. know enough to follow it without being able to do it.
@TerribleFire
@TerribleFire 2 жыл бұрын
I do agree about static collections. I dont keep stuff unless i use it for something even if its testing hardware.
@ggoadmusic
@ggoadmusic 2 жыл бұрын
Super neat man
@randaldavis8976
@randaldavis8976 2 жыл бұрын
never knew the kim had expansion cards, thought it was a trainer board. Used Aztec C on my Apple 2+ years ago. Having a hard disk really helped.
@kirepudsje3743
@kirepudsje3743 2 жыл бұрын
uC compilers remain limited in new features. These days, it is very easy to use all the latest features of e.g. c++2b. I find the c++ constexpr stuff especially helpful with microcontollers to automatically generate lookup tables. Just generate llvm code with clang (-emit-llvm) and then use the llvm c-backend (llvm-cbe) to generate simple c-code. This can then be compiled with any minimal c-compiler. This also has the advantage of using all the latest IR code optimizations of both clang and llvm, and the uC compiler essentially only needs to use a simple peephole optimizer for the final compilation step. Possibly only limited more advanced stuff as for-loop reversal.
@MonochromeWench
@MonochromeWench 2 жыл бұрын
I was expecting a C compiler for the platform to be something ancient that used K&R C not the more familiar ANSI C. But an open source project no doubt is being used by the people who developed it so they'd want something more modern to work with.
@JamesJD3
@JamesJD3 7 ай бұрын
That is fantastic to have a c compiler for Kim. Also showing how set up a board support package. This is the same as what you need for gcc. The connection to gcc makes this video very valuable. I should break out my board and give it a try. How much space does printf take? I setup gcc for the MCP555 and printf was taking around 12K. To do simple c++ I remember only having to provide new(). That can be really simple if you never plan to delete. Back in the day I got an assembler for and ran on Kim. I had one of those Don Lancaster TTY boards and two S-100 memory boards. I started a crude set of routines save data to a floppy. I was just happy to record something and abandoned it after getting my 6809 system working. That had OS9 with c and later color graphics. Anyhow, thanks for the video.
@clintono
@clintono 2 жыл бұрын
I started with an 8088 with MS DOS 2.0. Started programming with BASICA.
@troyfrei2962
@troyfrei2962 2 жыл бұрын
In the late 1970s I could not find a compiler. In early 1980s I could only find a Compiler called Turbo Pascal 1.0 for about. 59.00. Other Compilers costed 1000s
@anon_y_mousse
@anon_y_mousse 2 жыл бұрын
Yeah, and isn't it great how in that regard things have gotten so much better. Now you can get dozens of compilers for free, thousands if you include every language.
@lucidmoses
@lucidmoses 2 жыл бұрын
Back in the day we ported FORTH to a TRS-80. Was a bit more involved as we couldn't use many of the bios routines.
@DavesGarage
@DavesGarage 2 жыл бұрын
Well, the KIM only has about 4 bios routines in total!
@lucidmoses
@lucidmoses 2 жыл бұрын
@@DavesGarage Well, that puts the 'B' in bios for sure. Creating a buffering, dynamically auto repeating keyboard driver on a device that you could only poll and didn't have any hardware debounce was a learning curve back in the day. Course Old and wiser I bet You and I could do that in our sleep now.
@RandomInsano2
@RandomInsano2 2 жыл бұрын
I’m kind of amazed CC65 supports a heap. I didn’t expect to see malloc() there at all.
@AbAb-th5qe
@AbAb-th5qe 2 жыл бұрын
cc65‘s malloc isn't the most efficient in the world, but then again 6502 machines aren't fast with lots of ram to manage anyhow. Also malloc and free aren't magical. I've implemented them myself in about 100 lines of C code total.
@RandomInsano2
@RandomInsano2 2 жыл бұрын
@@AbAb-th5qe It’s true, but some embedded projects (Rockbox comes to mind) don’t allow you to use a heap. There’s reasons there (multiple tenants in a constrained space) and I’ve done a fair bit of work with Rust’s no_std mode without an allocator. It’s interesting they bothered at all.
@AbAb-th5qe
@AbAb-th5qe 2 жыл бұрын
@@RandomInsano2 Well CC65 is a C compiler and those functions are specified as part of the C89 standard, so they're kind of required.
@JBK63
@JBK63 2 жыл бұрын
Used to use the lattice C compiler
@lucidmoses
@lucidmoses 2 жыл бұрын
Yes, I remember Lattice, Watcom, MS C, Turbo C. I don't know if anyone did it before them but that debugger in Turbo C was a game changer.
@DavesGarage
@DavesGarage 2 жыл бұрын
Me too! I still have the manuals, actually, in a box!
@DVRC
@DVRC 2 жыл бұрын
@@DavesGarage Is it just for x86 or can generate code for 68k and z80?
@Jimbaloidatron
@Jimbaloidatron 2 жыл бұрын
@@lucidmoses Believe it or not, I still occasionally use Watcom C in a commercial capacity, a real favourite for its tight accurate 16 bit DOS code. :-) But mention of MS C gives me nightmare flashbacks about v7(?) which used to complain entirely randomly 'No space left on device', an error which then magically disappears on the next compile!
@jackgerberuae
@jackgerberuae 2 жыл бұрын
DeSmet C compiler 🤣
@OMNI_INFINITY
@OMNI_INFINITY 9 ай бұрын
Should make a kim-1 variant called OB-1.
@eljuano28
@eljuano28 2 жыл бұрын
That was fun!
@chessprogramming591
@chessprogramming591 2 жыл бұрын
Fun thing. Recently I've written a chess program for KIM-1 using 909 bytes for data and code segment. I did in 6502 assembler under my own online KIM-1 emulator, code also worked on a real KIM (btw tested by the guy you bought your KIM from). What is interesting now is to see whether cc65 would generate bigger or smaller code if I feed my C prototype into it.
@konberner170
@konberner170 2 жыл бұрын
KIM-1? I was hacking Z80 assembly on my TRS-80 back then. Sadly, no C. I had an Apple I, but the my first C complier that I ran on a computer I owned was on the Kaypro under CP/M in 1982. This all made me a fan of Z80 and I never did much with 6502 or other Motorola assembly.
@guilherme5094
@guilherme5094 2 жыл бұрын
Very nice 👍!
@andersrimmer6675
@andersrimmer6675 2 жыл бұрын
So, I actually ran this on a few machines... On my Mac Pro 6,1 2013 ("TrashCan") with the 12-core Xeon ED5-2697 v2 @ 2.70Ghz, I got 70,813 iterations on an average of 5. This machine is running Windows 10 and Visual Studio 2022 On the Amiga 4000d with the Cyberstorm MKII 68060@50Mhz, the SAS Lattice 6 compiler got me 151 iterations *every* time I ran the test. Turbo C++ 3.0 in DOS on a Digital Venturis Pentium 200MMX workstation yielded 257 iterations on average. This puts the Amiga in a rather favorable light, Mhz to Mhz, but compiler optimations are surely at play also. Turbo C++ (all Borlands Turbo products actually) still amazes me with the DOS IDE; so many features and options, in so little a footprint. Lattice on Amiga is an awsome compiler put into context of the time, but the editor was and still is... less than stellar.
@XalphYT
@XalphYT 2 жыл бұрын
That VT220 is cleaner than the ones I used when they were new.
@dand4485
@dand4485 2 жыл бұрын
Great video, one thing that sounded so off for me, was "Will be reading the source off Tape. I only used Tape on the big metal mainframes at work back in the day, my PC always had a hard drive, while my first computer i did splurged and got a floppy instead of a tape drive :) No HD at that time :)
@AbAb-th5qe
@AbAb-th5qe 2 жыл бұрын
You can do relocatable code for the 6502, but you'd need to write a relocating loader for the binary code of course.
@c128stuff
@c128stuff 2 жыл бұрын
And you'll need a header describing the offsets which need change. One of the first programs I encountered which implements this, and actually has the relocating code built-in, is Commodore's IEEE-488 driver for the C64 which came as rom with the interface, but would copy itself to ram, so it could move to the $c000 range, and provided a documented relocation function for when you wanted it somewhere else.
@netdudeuk
@netdudeuk 2 жыл бұрын
@@c128stuff Wouldn't they have pre-assembled the block of code that gets relocated to run at that address ?
@c128stuff
@c128stuff 2 жыл бұрын
@@netdudeuk No, it uses a generic function which figures out where it currently is in memory, copies the code to the desired location, and uses a table with offsets in the code which need change. One little trick I learned from the code is how to have code detect on what address it is currently in ram (write a rts to a 'safe' location, jsr to it, and check the stack for the return address). And hence, it could relocate itself to arbitrary addresses.
@netdudeuk
@netdudeuk 2 жыл бұрын
@@c128stuff thanks for the explanation.
@pcInCA
@pcInCA 2 жыл бұрын
Self modifying code was a completely normal thing to do with the 6502.
@HAGSLAB
@HAGSLAB 2 жыл бұрын
Awesome video Dave! I've been using CC65 a bit as well (I have a few videos on my channel) and I love to be able to use C to program my Commodore 64 (and my own C64 emulator). This walkthrough of adding a supported target is very interesting. I've had to poke around the cfg and crt0 files myself to get a program I wrote for the C64 compiled and linked into a binary compatible with the C64 cartridge format. I've burned that to a ROM and built a cartridge for my C64. Really ineteresting and fun learning experiment.
@DAVIDGREGORYKERR
@DAVIDGREGORYKERR 2 жыл бұрын
What about gcc-6502 Toolchain should produce very fast machine code for the KIM.
@hralch1234
@hralch1234 Жыл бұрын
hi Dave, thank you this video, I enjoyed it a lot! just one quesiton, why did you select CC65 instead of SDCC? It seems to me like SDCC has more optimizations available...
@DavesGarage
@DavesGarage Жыл бұрын
I'm not familiar with SDCC, I'll have to look into it!
@OMNI_INFINITY
@OMNI_INFINITY 9 ай бұрын
Hey dave: If are in silicon valley, there is somebody I can introduce that will likely be an interesting friend. Although historically he was an Apple employee.
@AttilaSVK
@AttilaSVK 2 жыл бұрын
Declaring variables before code reminds me of good old Turbo Pascal days :) The last language I did something substantial in was PHP - if I wanted to use a variable, I just used it without declaring (and wondered why my code is not working, since PHP will treat a typo in a variable as a new one :D)
@MattKasdorf
@MattKasdorf 2 жыл бұрын
Check out Turbo Rascal (TRSE).
@AttilaSVK
@AttilaSVK 2 жыл бұрын
@@MattKasdorf I’ve seen it, but I found it a bit hard to use :) (and I forgot quite a bit of TP)
@cbuosi
@cbuosi 2 жыл бұрын
Nice!
@diboc741
@diboc741 2 жыл бұрын
Got it. Thanks. 🤣
@stephenjacks8196
@stephenjacks8196 2 жыл бұрын
The 65816 was a plug in upgrade for Apple 3. Any C compiler for 65816?
@Whatthetrash
@Whatthetrash 2 жыл бұрын
This may be wrong place to ask this, if so I apologize. I started following because of the Drag Race series (I thought it was really cool to see languages to head to head!) but I'm not sure where this stands. I looked at the Playlist but some of them have Drag Race and some don't. Is the series over? Is it a series that's gonna take a long time (like years) to complete? Are languages still being added and newer implementations of the tests being run? Where does python (my favorite language) place in all this (I know it's relatively slow). Just looking for an update on where all this stands. Thanks! :)
@laconfidentiality
@laconfidentiality 2 жыл бұрын
i recently came across your channel, i enjoy every bit of your antics and stories, i am the only person i know who still uses the old task manager to this day in my current daily OS driver, as long as it works i will continue using it over the new designs ;) quick question for you can you shade some light behind the scenes on MS adopting/embracing XML after it was obviously moot?
@orreymodo5860
@orreymodo5860 2 жыл бұрын
More Dave, More better
@JohnnieWalkerGreen
@JohnnieWalkerGreen 2 жыл бұрын
I recall there was DECUS C for PDP-11. It was hell to try to port DECUS C to PC/MSDOS.
@paulwomack5866
@paulwomack5866 2 жыл бұрын
Do you mean C projects written in the DECUS C variant, or the compiler itself?
@alexmontesino
@alexmontesino 2 жыл бұрын
hey guys be nice, he is here for the likes so push that button!!!
@superscatboy
@superscatboy 2 жыл бұрын
"Simple printf()" is quite the oxymoron 😂
@_ClericalError_
@_ClericalError_ 2 жыл бұрын
Related to CC65 for the 6502, is there any current C compiler available for the 65816 or the currently-produced W65C816?
@joeplocki3525
@joeplocki3525 2 жыл бұрын
Check the Western Design Center website - they have a variety of development tools for the '02 and '816, which includes assemblers and C compilers for the 6502 variants and the 65C816. I haven't used the C compiler, but there is documentation for it. You have to register with an email address to download the tools package but can only download once (?) with that email address, so save the download somewhere in case you ever replace your PC. The documentation on using the stuff in the package is marginal at best, but if you dig deep enough, you can use it.
@mrrandomperson3106
@mrrandomperson3106 2 жыл бұрын
I hope your final episode on this is you getting it to run Doom!
@linklovezelda
@linklovezelda 2 жыл бұрын
I heard you giggle @ "loadt and dumpt" 🤣
@saultube44
@saultube44 2 жыл бұрын
I was kidnapped before birth and made born on the wrong Country. You're making the experiments with computer I had dream; thank you
@SquallSf
@SquallSf Жыл бұрын
CC65 is nice, to just write C code and it runs on 6502, but it produces bad code. The size of the "executable" is many times more what will be compared to the same in pure Asm. There are newer better alternatives, like KickC or llvm. If you know other languages, there are quite nice options. P65Pas (Pascal for 6502) produces quite optimized code. Prog8 is doing fantastic job.
@OMNI_INFINITY
@OMNI_INFINITY 9 ай бұрын
Why is dave seemingly often in the list when I search OCD level software engineering topics? Yes, subscribed...but still...
@vast634
@vast634 2 жыл бұрын
The square-root algorithm looks funnily simple. I always thought those have some more mathematical trickery behind them.
@JohnnyWednesday
@JohnnyWednesday 2 жыл бұрын
Dear Dave - please kindly obtain an s-100 bus machine (like an 8800) and a 'Cromemco Dazzler' - because it's apparently the worlds first colour video adapter - and the freaking Altair can display bitmapped graphics (videos are here on youtube) - however, it lacks many good demos - I bet you could write a great one :P
@jk-video2716
@jk-video2716 2 жыл бұрын
I have one of those. Never had much luck with the dazzler, though.
@Krzysztof_Kwiatkowski
@Krzysztof_Kwiatkowski 2 жыл бұрын
👍
@thisisreallyme3130
@thisisreallyme3130 Жыл бұрын
Please, more cc65 exploration. It really does not matter which platform... ANY platform. :-). Most of the "cc65 community _documentation_" is actually lies within all the platform communities (apple2, C64 etc), who have stepped up to fill the vacuum left by the official project's ivory tower.
@forbiddenera
@forbiddenera 2 жыл бұрын
@4:20 .. no it isn't. Either that or I am also unconventional. Wsl2 is the best thing in Windows since pinball.
@miguelguthridge
@miguelguthridge 2 жыл бұрын
I think the main thing that makes it unconventional is the fact that he's using a Linux command line but then building the compiler for Windows.
@colinmaharaj
@colinmaharaj 2 жыл бұрын
I grew up with DOS based IDEs then windows
@louistiches4810
@louistiches4810 2 жыл бұрын
Lol, saving bytes. I would not have made it as a developer back in the day. Nowadays, we just spin up more containers.
@kencreten7308
@kencreten7308 2 жыл бұрын
Like!
@ChrisCebelenski
@ChrisCebelenski 2 жыл бұрын
Next up - a disk interface for the Kim-1? It has the PIA's so you should be able to interface it to a Pi or Arduino...
@hvrijsse
@hvrijsse 2 жыл бұрын
Apart from its name, I can't remember this thing... Maybe I was too busy mastering the Z80 and, after a while, playing with CP/M. Or I'm just getting old.
@abijeetrs6522
@abijeetrs6522 2 жыл бұрын
How much power do those retro machines use --- like the one you use for clock ?
@soberhippie
@soberhippie 2 жыл бұрын
loadt dumpt sat on a wall I have a lot of growing up to do
@jmtx.
@jmtx. 2 жыл бұрын
6502 code can be written moveable, it just takes more effort.
@MikelNaUsaCom
@MikelNaUsaCom 2 жыл бұрын
thx for the video. I'm thinking about getting back to my custom cpu and maybe add some ram to it... =D (would need the extra ram before I could implement a loader, and really wouldn't look forward to manually loading any machine language of more than 16 bytes, through the switches. ) have a great day!
@therrydicule
@therrydicule 2 жыл бұрын
Please note that some idiots tries to pass for some KZbinr with some clouts to bring them on WhatsApp and scam them... So if you see a different KZbin account trying to up you on WhatsApp, don't. Signal it as spam, and block the account.
@adriansrealm
@adriansrealm 2 жыл бұрын
No implementation for humpt?
@TheBookDoctor
@TheBookDoctor 2 жыл бұрын
Are you sure it's not some bad bits in memory, rather than a bug? Maybe there's some bits that have physically decayed and won't hold a '1' anymore.
@andersrimmer6675
@andersrimmer6675 2 жыл бұрын
Pretty sure. Also, bad memory tends to lead to varying results on each iteration
@StreuB1
@StreuB1 2 жыл бұрын
I would literally die to be your neighbor and would gladly arrive with a cold 12 pack on Friday afternoons to spend hours in the shop learning software from you.
@ferrumignis
@ferrumignis 2 жыл бұрын
I suspect your literal death would somewhat curtail your enjoyment of the beer and programming sessions...
@timreimler5288
@timreimler5288 2 жыл бұрын
I guess you got the tint straightened out?
@jamesweatherley9215
@jamesweatherley9215 2 жыл бұрын
Copypasta the sqrt function from Stack Overflow - proper modern coding transported to the 8-bit age!
@erik....
@erik.... 2 жыл бұрын
It's hard to imagine programming before stack overflow.
@stevejohnson1685
@stevejohnson1685 2 жыл бұрын
Us old-timers call this "inheritance via Copy/Paste" :-)
@andersrimmer6675
@andersrimmer6675 2 жыл бұрын
@@stevejohnson1685 in *my* lab, mastering copy/paste is called a “Certification in Microsoft OLE2 with RPC-extensions”… 😆
@brocktechnology
@brocktechnology 2 жыл бұрын
So if I'm following this right cc65 compiles code for 6502 machines but it runs on Linux or windows, not 6502 machines. Am I the only one that thinks this is weird?
@akshaymathur136
@akshaymathur136 2 жыл бұрын
Nope. It is perfectly normal to have a powerful computer compile code for a smaller less powerful processor. That is how the majority of the low level programming is done. It is called cross compiling. The phone you are using did not compile its own code, a powerful X86_64 machine did, most probably running Linux. Most of the code running on microprocessors was compiled on x86 machines. Almost all the code for arm is cross compiled. The code running on your microwave, phone, fridge, washing machines, cars was written and compiled on X86 machines. Most processors aren't even powerful of running a compiler on them. They are severely limited in both RAM and ROM.
@fnjesusfreak
@fnjesusfreak 2 жыл бұрын
Cross-compilation was nothing new even back in the days of the 6502. Microsoft used cross-assemblers.
@DavesGarage
@DavesGarage 2 жыл бұрын
Well, even if it could compile itself, would the binary fit in 64K?
@fnjesusfreak
@fnjesusfreak 2 жыл бұрын
@@DavesGarage C compilers that run do natively exist but I'm not sure any are C89... ;p
@brocktechnology
@brocktechnology 2 жыл бұрын
All these observations are true and I think nothing of building Arduino code on a windows laptop. But the part of me that's forever 12 years old and staying up half the night writing stupid programs on a commodore 64 hooked up to a black and white tv is really disappointed that this isn't the gateway to assembly language power without learning assembly language that I always hoped for.
@pawmeowzing2906
@pawmeowzing2906 2 жыл бұрын
I wish you can document your knowledge to videos
@DavesGarage
@DavesGarage 2 жыл бұрын
I thought that's kind of what I was doing! ;-)
@pawmeowzing2906
@pawmeowzing2906 2 жыл бұрын
@@DavesGarage sure is, just that I wish all your precious experiences can be fully recorded in the form of videos one day~ it is very interesting
@davidvincent8929
@davidvincent8929 2 жыл бұрын
C on an 8-bit platform
@yug5874
@yug5874 2 жыл бұрын
Why the primes?
@tonygibbs9339
@tonygibbs9339 2 жыл бұрын
I think because it is a well known algorithm with a known output, so it can be checked, and it is what Dave has been using in his Software language drag races. 🙂
@byronwatkins2565
@byronwatkins2565 2 жыл бұрын
If the memory is 16b wide, why are you initializing with 0xFF instead of 0xFFFF? If the memory is 8b wide, why are your shifts 2^4 instead of 2^3?
@johnrickard8512
@johnrickard8512 2 жыл бұрын
Because the memory is 8 bits wide but the algorithm is skipping every even number
C vs ASM: Making the World's SMALLEST Windows App
20:15
Dave's Garage
Рет қаралды 147 М.
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
Microsoft's First Product: Recovered from the Original Source Code!
9:48
Modern C++: Unique Ptrs and Vectors
16:25
Dave's Garage
Рет қаралды 147 М.
Bare Metal Programming - Booting From the Switches
15:26
Dave's Garage
Рет қаралды 96 М.
Assembly Language Snow Day!  Learn ASM Now!
32:13
Dave's Garage
Рет қаралды 105 М.
E01: Stupid C++ Tricks with Dave
15:43
Dave's Garage
Рет қаралды 341 М.
I Bought the Oldest PC on eBay! Unboxing the KIM-1
14:21
Dave's Garage
Рет қаралды 63 М.
Windows and Linux: Together at Last?
16:43
Dave's Garage
Рет қаралды 162 М.
Stupid C Tricks: Unsafe Functions You MUST Avoid!
9:26
Dave's Garage
Рет қаралды 62 М.
Retro Breakout Part 1
35:50
ByteMind
Рет қаралды 193