Hacker News new | past | comments | ask | show | jobs | submit login
Run CP/M on your C64 using emulation (pagetable.com)
70 points by Luc 32 days ago | hide | past | web | favorite | 63 comments

I hate to be the "BBC Model B" guy :)

But anyway, back in the mid 80's I wrote a ton of dBase II code (using WordStar as my editor - I think it was v2), for my employer and at the time couldn't afford a full blown PC (I owned a BBC 'B') so he let me borrow a Torch Z80 co-processor which ran a variant of CP/M called CP/N. It worked like a treat. It used the Beeb's "Tube" interface that basically turned the BBC micro into an I/O device - not unlike the Commodore effort. John, now sadly gone from our mortal coil, was an official BBC/Acorn outlet, so we got to play with a lot of toys.

I don't remember the mechanics of getting my code to and from the office CP/M PC's at the time; even under Torch CP/N I seem to remember that BBC drives weren't compatible with real CP/M/MS-DOS PC's - I think I may have transported my code through the medium of floppy disc and used a BBC Micro in the office to squirt my code to/from via serial cable and some XModem/Kermit type of affair, which was no biggy because we already moved data between DG mini's (John was also a Data General broker) to/from PC's anyway. This was all before the joy of ethernet, though we did have a bunch of machines that ran a thing called SageNet(?) which was a kind of network. It's a long time ago, my memories are fading now :)

As a final tangent, we initially had a NEC PC8800 and a NEC Advanced Personal Computer - which were lovely bits of kit for their day. We eventually moved to a bunch of PC "clones" (one made by Ferranti which was a really odd thing). I have other stories, but that'll do for now.

When I was ten I got a vic 20. Do you know how old I was when I arranged my first beta testing session? I invited my brother to play a text based adventure game that drew on screen the scenery using nested if else statements. I programmed the first couple of scenes and asked him to play through them. He said it was a bit short but the idea was good. He was eight. I was still ten.

I have two kids now. 9 and 12. They are brighter than me. They speak swedish and English almost fluently thx to yt and since I introduced computers early in their lives they aren't scared of anything. My son started his YT channel at the age of 8. Mostly in game footage. He uses down pretty cool sw to edit his clips.

My daughter plays Roblox and act as everyone's go to for all questions revolving around that game.

Both navigate windows or Android or macos like they have inherited their knowledge from me. My kids are brighter as hell. Not one has asked me about programming.

I blame 8080. It's not accessible. Is it technically more advanced? Perhaps. But somewhere along the line we forgot about computing and children. Somewhere along the line we said it's no longer important for kids to learn programming. It's for adults.

> I blame 8080. It's not accessible. Is it technically more advanced? Perhaps.

I think blaming 8080 is extremely inappropriate here, as it is historically inaccurate. Intel 8080 is a preliminary microprocessor (and usually even not considered a x86 processor at all), it was designed in the early 70s, it was very accessible. Arguably, it was the processor that created Altair 8800, which was the ancestor of the entire lines of home computers in the 80s. The original Microsoft BASIC interpreter also targeted Intel 8080 and Altair 8800, the BASIC interpreter would later be licensed to all the other home computer manufacturers including Commodore. The derivative of the Intel 8080, Zilog Z80, was used on Sinclair and MSX computers, particularly, ZX Spectrum is the British-equivalent of Commodore 64, and MSX is the Japanese equivalent (also made and sold in some European countries) and introduced a generation to programming.

With the correct historical background in mind, you better to blame 8085, 8086 or 8088. It was those processors that established the x86 architecture and the IBM PC, leading us to desktop computing as we know it today.

Long words short, 8080 gave us home computers. 8088 gave us desktop computers.

I think its more the removal of the compiler from a default installation that has killed programming for kids. If the major OS's still shipped with tools onboard (i.e. without requiring an additional install) that enabled development out of the box, the barrier to entry would be lower.

As it is however, developer tools are a multi-billion dollar industry, and there is very definitely a desire by all the players in this space to milk it for every penny.

When did computers ever come with a compiler in a default installation? And when was that ever a kid's first exposure to programming (as opposed to interpreted BASIC)?

Everyone I've talked to who got into programming as a kid (as opposed to through school/a job) was through BASIC/Visual Basic or making web pages and adding JavaScript, or though some kind of game scripting language. For me it was HyperCard/HyperTalk.

None of them just sat down with GCC.

Home computers didn't ship with compilers either. On an Atari ST you had the option to get a commercial C-Compiler from DRI and Megamax. The DRI compiler suite required you to disc-jockey multiple floppies to compile (in two stages), and then link the final executable, where intermediate object files had to be stored on floppies as well. RAM disks only helped so much on 1024 or 512 KB RAM.

A web browser has a full compiler/interperter available. JavaScript isn't the best language in the world, but in context, these simple BASICs derived from Dartmouth BASIC were so crappy that Dijkstra said

> It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.

and wrote Go-to Considered Harmful talking about BASIC.

ie. it's not a high bar we're trying to reach here.

I think the distinction needs to be made between native development, which is much more performant, with far less dependencies, than web-based development - which requires a great deal of runway before it can be launched.

Removing compilers from the base OS install package has been detrimental to application development, and has created a bias towards web-based tools, for the reasons you state.

Outside of Unix, base install has never included compilers. And the people talking about yesteryear's more introspectable computers aren't talking about Unix workstations.

These people are talking about BASIC interpreters, not native development.

And there's no dependencies for web based development unless you want them. Just open notepad and save a .html file. Done.

Windows ships with PowerShell which is a very capable programming language.

PowerShell is a relatively recent default inclusion in Windows, and it's not marketed or thought of as "You can build your own games with it!"

Bookstores used to be packed with things like "The Big Book of Computer Games" and magazines with program listings for interesting programs you'd type in (a task my mother and I shared). A blog/video series about using PowerShell for simple games would be pretty interesting.

Windows default file editors aren't that great either. The C64's full screen editor was designed for entering and editing BASIC programs, very visually.

I disagree. There are many books on programming in PowerShell and you can call into any .NET library from it, so you can certainly write games.

I didn't say you couldn't write games using PowerShell. I said there doesn't seem to be books or docs or blogs about using PowerShell for games, or for really anything other than system automation and system utilities.

I'm sure it's possible to write Eliza or a pong game in PowerShell. These are the kinds of things that introduced kids to programming, and without an easily accessible, included language with the mindshare that they are appropriate for entertainment purposes, less experienced but curious people will gravitate away from it.

Got some examples?

Blaming the processor doesn't make any sense. Early x86 / DOS machines were very accessible. They all shipped with BASIC.

I'd say blame Windows. If Windows had shipped with the equivalent of GW-BASIC + extensions, we'd have a different discussion...

> Early x86 / DOS machines were very accessible. They all shipped with BASIC


The original IBM PC/XT machines came with BASIC in ROM. If you turned it on without a DOS floppy disk in it, it booted into BASIC instead. On early IBM PC clones (that omitted BASIC to save cost), instead of saying "no boot disk found" they would error out with "No ROM BASIC"

The BIOS interrupt call 18h still exists to launch BASIC from ROM

> If Windows had shipped with the equivalent of GW-BASIC + extensions

Windows 98 shipped with Windows Scripting Host that could run .vbs scripts. I wrote a lengthy (10 page, IIRC) "introduction to programming" article for a gaming magazine years ago that only used VBScript since that was simple enough syntactically (no weird sigils) and available in every computer out of the box (i even got a couple of people thanking me for this :-P).

And of course Internet Explorer with JScript was in there since Win95 OSR.

> Blaming the processor doesn't make any sense.

True, it doesn't. I've expressed this opinion in my further reply in the thread, https://news.ycombinator.com/item?id=19953066, and suggested the cultural shift due to desktop computing is a better angle to view this issue.

I said "you'd better to blame Intel 8086" rhetorically just to pointed out some historical background.

QBASIC.EXE was present in NT4. It was there until Win2K. I'm not sure if QBASIC was distributed with any 9x Windows.

It was on the Win95 (and i also think 98) CD in an "DOSUTILS" folder or something like that.

Good point... Though if I remember correctly, it still did not offer access to any Windows features. It was essentially a DOS app.

To be completely fair, 8085 had nothing to do with it. 8085 was an advanced version of 8080.

Good catch. I should be more careful next time...

I think you mean “6502 gave us desktop (micro)computers.”

Most 8080 and then Z80 systems of the mid-1970s used S-100 and were oriented around a separation of CPU and I/O, i.e. “Just plug a surplus terminal or teletype into a serial port to use the computer!”

It was really the 6502 and its use by the original “self-contained” Apple I that made desktop microcomputers a real product. Yes, buying an Apple I just you just got a board, but it was it intended to be put in a desktop case (and advertised that way) with a surplus keyboard and plugged into a TV, and could use audiocassette for storage. That made it way more approachable.

Thx for straightening me out.

Ok, so let's blame 8085, 8086 or 8088.

Or, we (as in I) can blame no one and instead, only realize there's no blame to manage.

Anyway, I regret that we killed 6502. I hope my kids will pick up programming anyway. I think later in life they will feel crippled if they didn't.

> Or, we (as in I) can blame no one and instead, only realize there's no blame to manage.

I agree, I think the problem was not a particular microprocessor, but a greater cultural issue. At the end of home computer era, a PC has became someone's workbench, end users are not expected to learn and write programs anymore. There were bright sides, Xerox Alto, GUI, desktop publishing, multimedia, widely-available programs, no need to repeat those stories, we all know them. Meanwhile, accessibility to programming has largely been lost in this process.

On second thought, it's not all black-and-white, some accessibility to programming still exists. On Unix-like systems, "python", "perl" is one command away, and even on Windows, JavaScript is one browser window away. If the next generation rewrites the computing history today, I wonder what tools/environment would be seen as the 21st century equivalent of 6502 and home computers. I'm sure it would have a dedicated chapter to Raspberry Pi and Arduino devboards at least.

>> even on Windows, JavaScript is one browser window away

I have nothing but love for Bill Gates' software. I programmed my vic 20 using his BASIC.

In my twenties I had no trouble picking up WINTEL + JS. But that's because I had already learnt what is computing. I had already realized what is a virtual machine and what is a "high-level language".

When I try to explain to my kids the architecture that is today's computing I don't know where to start. Now I wish there where sprites. When I was ten I grasped the concept or sprites.

There is a fair amount of cargo-culting in the following statement but I still believe in it:

If we had maintained the 8-bit architecture and even 6502 as a "gateway drug", today, we would be much better off. Talent is hard to find, in my mind, because there is no longer a C64.

There was nothing remotely close to the Python infrastructure we have now, complete with fairly advanced software constructs in fairly accessible manner. Also keep in mind that there are other engineering disciplines than software. In those disciplines, the key is becoming an expert user in a a very high level tool, such as LT Spice, Solidworks, various FEA packages, etc., and even higher level more specialized tools. There, to design something, there is no time to fiddle with actual coding, unless you’re a graduate student actually writing a new tool.

At the 8 bit computers and some of the 16 bit home computers they all came with aversion of BASIC. That meant people with even different machines could trade information.

I am not saying which language microcomputers should come, just that if all the microcomputer came with the same language from day one we would see a lot more people programming today.

Personally, I don't like Pascal and I know a lot of people are against BASIC. What about Comal? You need something that is easy to program the simple stuff, but has the ability to teach good programming style.

It's not even that. You just need something simple to get started with that produces instant results and is built in to the computer.

Ex: VBScript, bash, python, etc.

You don't explain everything from scratch.

You are suggesting, are you not, that top-down is as good as bottom-up?

To that I disagree. I believe what caught my interest was the bottom-up approach that was the commodore manuals.

A lot of people who learned programming in the home computer era learned through BASIC which was already a very high level language (well, except perhaps the C64 one which was kinda crippled, but that was an exception), often with graphics commands to draw lines, circles, etc, play sounds, do color, etc. Some of them went on to learn assembly, but that came later, after they got their feet wet with the high level BASIC.

This isn't any different than someone learning -say- Python or JS today and then moving on to C or C++. If anything, i know artists in the game industry who started learning Python to automate some stuff in their workflow and then slowly started using C# and C++ (often such people end up as "technical artists" in bigger teams, which is an in-between artists and graphics programmers, implementing high level systems for artists and designers on top of the low level systems graphics programmers provide).

The original discussion was accessibility to programming, and now it's top-down vs. bottom-up programming, which is a different topic. But IMHO, even if you believe top-down is not as good as bottom-up, it's still better than your original parent comment, which explicitly mentioned no programming at all.

>> and now it's top-down vs. bottom-up

You're right, it's a different topic entirely. I was trying to enforce the notion of the 8-bit architecture being superior to our current to beginners because of how easy it was to comprehend, even at the hardware level.

Looking again at my kids, I'm starting to question my initial premise that everyone should learn programming. They seem to want to become either the best fruit market owner in the world or the next Zlatan.

There's still a little cottage industry of 6502 (and its successor, 65816) homebrew computers[1]. You can still buy them from electronics distributors[2]. There's also a very good Basic[3] available. Building one of these may be a good learning experience with kids.

1908s computers were way simpler, and with far fewer distractions than modern machines.

[1] http://6502.org/homebuilt [2] https://www.mouser.com/ProductDetail/Western-Design-Center-W... [3] http://retro.hansotten.nl/lee-davison-web-site/enhanced-6502...

What's to keep you from picking up a an Apple IIc on eBay?

I think buying an Apple ][ missed the point. I think misterman0 meant to say is not the specific issue of teaching his own children to write programs, but accessibility to programming in general (I invited my brother to play a text based adventure game [...] He was eight. I was still ten.), and how the low accessibility has buried many potentially talented children from exploring it by themselves (I have two kids now. 9 and 12. They are brighter than me. [...] My son started his YT channel at the age of 8. Mostly in game footage. He uses down pretty cool sw to edit his clips.).

I was one of those kids with an Apple ][ and in fact I still own it. I thought about setting it up for my own kids (now 16 and 18) years ago to tinker with. But I realized that it wasn’t due to accessibility that they aren’t interested in programming. Times change and my things aren’t their things. If they wanted to program, there’s a lot of modern and accessible environments to start with. They had plenty of friends doing things like LEGO mindstorms or finding other ways to program. I realized they were no more interested in programming than learning how to change a spark plug when I tried to show them that. And it wasn’t because computing (like many other things) has become more complex.

I’m not really even sure computing is less accessible now. Kids find a way.

Has nothing todo with a processor. It's all about what the cool stuff you _can_ do is. Minecraft, YouTube, Instagram, who needs BASIC?

It's not about programming, it's about doing cool stuff. In 8bit era that meant programming. Even if you wanted to do grafx or sound you ended up programming the box.

Nineteenseventies Unix or Plan9 are cool, you can program on them. The iPhone is cooler, you can do movies and stuff.

Here is another vector: compared to the software you could buy back then, the things you could do in your spare time programming were more oftne than not cooler or at least comparably cool. To make a better version of any on single app that comes preinstalled with your Mac is not something you just do.

So, why should anyone be interested in learning to program in the first place?

>Here is another vector: compared to the software you could buy back then, the things you could do in your spare time programming were more oftne than not cooler or at least comparably cool. To make a better version of any on single app that comes preinstalled with your Mac is not something you just do.

IMO this is definitely the issue, rather than availability. If someone is too lazy to download some programming software then they're almost certainly too lazy to learn to program.

> My daughter plays Roblox and act as everyone's go to for all questions revolving around that game.

Feel free to ignore this if she's not interested, but you could try...

Show her the roblox development kit, and show her how to walk through the tutorials for setting up a basic obby (obstacle course), then when she's playing a game ask her fi there's something she thinks would be a cool idea, then show her how to implement just that tiny idea.

Then get her to come up with an idea for a game, and a bunch of ideas for what happens in it and how it flows, and help her create it, and then polish it up a bit, and publish it so her friends can play it.

I'm not sure where I'd recommend anyone (child or adult) start learning how to program. After BASIC disappeared, I always thought Javascript was a good starting place, but even that ecosystem has gotten crazy complex.

Teach them C. Get the screen flashing.

PICO-8 [1] is a good way to introduce programming to kids in the way people learned in the early 80's. The retro and simplistic interface is a pleasure to work with, and Lua as a programming language is a nice bonus.

My 7 yr-old and I just finished our interpretation of Pong. He needed help of course, but got the basic concepts of X-Y axis, variables, calculating ball movement, etc

[1] https://www.lexaloffle.com/pico-8.php

I suspect it all has to do with the software distribution models.

The C64 generation got a lot of software through things like 'enter it yourself magazines', which would often have programming information on the next page. It was an open invitation "hack and customize the game" which gets you onboarded to programming. You also had things like defeating crude copy protection as an incentive to learn how the machine worked.

I got into computers a little later-- my first computer was a 386SX that was obsolete almost as soon as it came out of the box. With no modem, your software selections were limited to buying whatever pig-in-a-poke the local computer store had. When the supply of new exciting software that would run on it dried up, opening up GWBASIC was my route to getting more enjoyment out of the machine.

Today, there's basically an infinite library of software easily available. The reaction to "I finished my game and want something new" won't be "let's change the delay loops so the aliens are faster" or "Can I write my own Dragon Quest clone", it's "pop open Steam/the App Store"

I wouldn't blame the 8080... The culture around early computers was very different. My earliest computers - TI 99/4A, Apple IIe, Amiga, etc - all shipped with BASIC manuals. Complain about BASIC as a language, but it had a ton of functionality built it and made these machines accessible to anyone. I, too, taught myself basic when I was very young...

I think this is an important part of the puzzle.

In 6502/6510/Z80 days, computers came with big books to tell you how to program them.

Today they come with a leaflet, or less. People are expected to go out and find out how to program their computers, rather than have that information right in front of them.

Programming is extremely accessible. It's not as required any more, since you can find endless other things to do with your computer easily, so it's not as obvious an progression to try it.

I tried to emulate CP/M on my C64 in 2015. I have typed in DIR and I’ll tell you if it worked when it completes execution.

I hope you've upgraded your C64 power supply so it won't kill the machine before "dir" even finishes its execution ;-)

He wasn't kidding when he said that the emulation is too slow to even properly register key presses in time. Booted in VirtualC64, tried to type in "dir", and it came out as "dr", and then took a pretty long time to tell me that "dr" isn't a thing.

I then typed in "dir" slowly, and this time it worked, but took about a minute to type out the few directory lines... character by character.

So, as the article suggests already, I'd really consider this to have been unusably slow even at that time. And then it suffers from the same problem as the actual Z80 CP/M cartridge, namely that the 1541 disk drive cannot read any disks that would contain CP/M stuff.

But as a curiosity, that all makes this just more interesting.

> Booted in VirtualC64

Perhaps and possibly an unfair comparison given that you're already running in an emulated C64?

It would be worrying if a PC can’t emulate a C64 much faster than the original system. And if the GP didn’t remove frame locking, the emulator ran at the same speed of a real C64

No, my computer, as most today, has plenty of power to emulate the C64 with cycle-accurate speed (at least close to), so it should be exactly the same performance as on a real C64.

I even switched to unthrottled at times, which with my setup gives about what a ~9MHz C64 would be like. The real one is about 1MHz. Even that was very slow.

Fair enough, though I'd like to grab an actual C64 to see what the experience is really like with the C64's own hardware.

But like all things here it's a hack, everyone's mileage may vary :)

Do you mean because of subjective feeling of it independent of speed?

Because as for performance, we are talking about emulating a fixed-frequency machine thousands of times slower. There was no "variable performance", CPU and video timings are pretty much exactly defined. This CP/M emulator was exactly as fast or slow on any stock C64[1], and, correctness assumed, any emulator worth its salt on any non-ancient PC (20 years?) will show no perceptible difference.

The "thousands of times slower" is not entirely true, since a C64 emulator has to emulate much more than just its CPU, and the emulator task gets uncontrollably preempted. But there is no way that CP/M will feel any different on the real machine, in terms of performance.

[1] The only significant exception was that NTSC machines were a tiny bit faster than PAL machines: A tad over 1MHz vs. a tad below 1MHz, to fit the respective video standard's timings.

I always find these articles so weird. What’s next? Software to facilitate a 5 x 5 grid of people running Freiden calculators (a la Los Alamos)? I’m being snarky. In 1981 had access to a CPM system, and immediately bought a FORTRAN 4 compiler “Watfor” written at the Univ of Waterloo. A highly useful system. Wrote a program to design ring laser resonators. My first experience with “personal” computing.

The correct way of running CP/M on a C64 is to make an hardware update to C128.

The C128 was a great machine when it came out. Best of both worlds. True 80 columns and no hacks lol

The 80 column chip itself was not very good, though. It lacked a raster interrupt (meaning you'd have to poll) and was full of bugs: http://commodore64.se/wiki/index.php/Commodore_128_assembly_...

I have one of those Z80 CPM cartridges for my 64. It’s a massive thing. Have never tried it. Got it in a mound of C64 stuff that came with an SX64 on Craigslist.

Or plug in the CP/M cartridge in the back and away you go..

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact