I hung out with Jim Butterfield in the mid 80s. He was a genius. I couldn’t appreciate his work as a teenager but seeing his code and concepts pop up here and there on TH-cam 35 years later reminds me of just how smart he was.
Even as a teen I knew who Jim Butterfield was, at least in name only. I would see his name mentioned in software, manuals, magazines, books, etc. Great episode!
This is just way too cool, I’m gonna have to play around with this sometime on my breadbox C64. Kinda makes one wonder, if done in 2 BASIC lines or in assembly as just a simple load program or driver, could one configure one of those 80 column adapters for the C64 to be able to run 80 column PET software?
Transacter. I must say I was intrigued when I saw this on the magazine rack of my local Stars and Stripes bookstore. I may have used my VIC 20 and Commodore 64 but when I got my Amiga they went to the side. But it was The Transacter magazine that had me take another look at my older Commodore computers. And that issue was the only one missing a subscription postal card.
Jim Butterfield hung around a computer store called Batteries Included at the Village by the Grange mall in Toronto. Every Friday, as a Grade 9 student I would visit him and he would show me amazing things on the Commodore PET like a 4 voice music program!
I took my C64 to thanksgiving and played some games with my niece. She enjoyed it and so did my sister. Nostalgia for my sister and seeing a bit of history while having fun for my niece.
Video RAM starts at $8000. that‘s also where your module resides. So when the module scrolls video memory, it only can take it from the ROM as it has no access to its underlying RAM. That‘s why it shows „garbage“. It‘s the Rom from $8028 onward. Loop
My eldest brother just found old photographs of me using my Vic-20 when I was 13 years old back in 1982! I’m now 52 and would like to experience those good times again so I have just ordered a new C-64. I never upgraded to the Commodore 64 later unfortunately, cars and girls were a higher priority I guess…. Really enjoying your channel and keep up the great work.
Robin, Shortly after buying my C64 I joined a Commodore club that met in a pizza place in San Dimas, California. As a new member I was given two disks full of Basic programs. When I looked at them all of them were converted Pet programs. According to the remarks the first line of the programs made it possible to run on a C64. I also learned about TPUG by reading the remarks. 😃
Amazing hack! I'm already a fan of Jim Butterfield because of his KIM-1 genies software) A bit strange why they call it "emulator" in the manual while it's rather a re configuring the memory layout to be compatible with PET software, but probably just due to marketing purposes. Since it works like a charm it doesn't matter really) Thanks for sharing!
"Emulator" simply refers to having one machine (the "host") run software for another machine (the "target") as well as the target machine itself could run that software. Note that an emulator does not have to run _all_ software that the target machine can run, just that _some_ software can be run on the host and appear, for practical purposes, indistinguishable from running it on the target. Even today we have many emulators for much older and slower systems that can correctly run most, but not all, software for the target system. (Typically the failure is due to insufficient emulation of what most people would consider bugs in the target system.) The word was coined by IBM in 1963. Up to that point they had written many simulators for their newer machines that would run software from their older machines to give some form of backward compatibility. These simulators ran the old software slower than the original machines, however, which was sometimes (perhaps often) a problem. With the IBM 360 line they added some hardware support for these simulators that could let them run at the full speed of the older machines, and this was a significant enough improvement that they coined the term "emulator" to distinguish these full-speed simulators from the older ones that couldn't run software at the same speed as the target. In this case, the word "emulator" certainly applies because, for those programs that the emulator is capable of running correctly, it runs them at full speed (or close enough that the user won't see the difference). There are still other minor differences; for example the character glyphs on the C64 are different from the PET, and, in the examples given here, even the foreground and background colours of the text screen are different. Which characteristics can be different while still calling the process "emulation" is obviously somewhat dependent on the feelings of the end user.
Interestingly on the C64 wiki this is listed as being able to run C64 programs on a PET/CBM:- C64 programs can be made to run on a PET/CBM computer by running this command: POKE 40,1: POKE 41,8: POKE 8*256,0: NEW
I think that only handles BASIC programs that PRINT everything, while this program also handles POKEs to screen, greatly improving compatibility. (Still cool, though)
There is a shorter way to exact 80 characters to set border & background to black. Only the clear screen is missing: 1A=53272:B=128:Po56576,5:PoA,4:Po648,B:PoB*8,0:Po44,4:Po56,B:PoA+9,0:PoA+8,0:NEW
Fantastic, and very interesting. Now somebody just needs to make a C64 numeric keypad. I'd imagine they used the inverse S instead of the heart as it was easier to print.
Makes me wonder wether that one liner would work on a C128 since that machine has a numeric keypad per default Edit : and perhaps using the 80 columns mode aswel 👍🏻
@@Kakariki73 The problem with 80-column mode on the C128 is that you can't directly access screen RAM. Any program that relied on POKEs to screen memory would not work in 80-column mode.
It would be interesting to see if Dungeon had the Basic error that allowed the diagonal wall phasing glitch that it did on Basic 4 on the PET's when running on the C64
My first introduction to computers was a PET 2001 with chicklet keys in school and although you can run PET games on the C64 it's not the same. This is why emulation doesn't float my boat. I need a green screen (not a TV screen), I need the keys, I need the tape deck, I need the size of the beast for my nostalgic juices to start flowing. I wish I could afford one now.
Yeah, real ones are expensive (around $1000 and up on ebay) but have you seen this PET project that uses all real hardware components (no emulation or FPGA)? th-cam.com/video/zHAIuE5BQWk/w-d-xo.html Then all you have to do is find yourself an old green monochrome monitor and you're halfway there! [edit: The kit even includes a PET-like keyboard!]
I can relate... Although my first computer was bought in '91 and it was a PC - IBM PS/1 with 286 CPU and 1MB of RAM, VGA video, some weird audio card (no PCM) that I wish I had known how to program it. The machine can be emulated with IBMulator, but I truly miss my original system that I've lost during time - and I know it's unlikely that I'll ever find one that's the same model or even just close and for a price that I can afford. Saddens me, and it was in full working condition the last time I saw it. The last time I used it for was as a terminal, connected to my Linux workstation with null modem cable I used it to access IRC from my bed :D The IBMulator is very good emulator, I like it - I wouldn't say it doesn't float my boat, but I can't pretend the experience to ever be the same.
I really should read more carefully - I thought the title was "Online PET Emulator for Commodore 64" and was full on WTF? :D Made more sense when I started watching the video ;) P.S. I have lately become so addicted to podcasts I rarely listen to music when walking outdoors any more - I've included a number of vintage computer podcasts, but I've also found Growing Up 80's and I love it! Just one day I listened the episode about corner stores, and there was a ton of stuff there that was much similar to other stuff here in Finland (we're also two-language country - Finnish and Swedish) so there's that too. Some things were just so damn _same,_ although naturally there were differences as well.
I'm glad you're enjoying GU80s, kiitos! Our city of Thunder Bay has a large Finnish population, and still have a few shops where Finnish is regularly spoken. One pair of my great-grandparents were born there, and my grandmother grew up speaking Finnish at home and stayed fluent throughout her life.
@@8_Bit Wow, now that's a coincidence if I ever saw one =) GU80s is definitely one of my feel good podcasts, listening it takes me back to my own childhood in the 80's and makes me feel all kinds of warm and fuzzy (even when it doesn't necessarily match up), so the kiitokset belong all to you ;) Both of you :) Thanks for the reply - it's a small world sometimes! I wonder... Do you know if you've ever tasted this Finnish candy we call salmiakki? It's not the brand, it's just the substance it's made of and my understanding is that it's not used as candy anywhere else in the world - it's a weird taste, not salty nor sweet (although the candy made of it can have salt or sugar in it), not really anything I know to compare with? I guess that's not a much of a description and I guess I'll have to hope that you would know it if you know it ;D I wouldn't be that surprised if such candy would have been available somewhere with large Finnish population :)
@@robsku1 Yes, we do have that here though most often now I see the Dutch version because my mom-in-law was born there, they call it dubbelzoute drop I think. I think it's nearly the same as salmiakki, probably a somewhat different mixture and of course shape, but overall similar. A Swedish friend also likes something similar.
@@robsku1 I think it may have been available throughout Canada. From looking at Wikipedia, salmiakki seems to be what we in western Canada called "double-salted liquorice."
This is very interesting. I mean the PET was even more before my time but it'd make me wanna try some PET games on the bread bin if I had the chance. Considering the PET was more of a business machine however, how does this emulator stack up with business software?
Great seeing all these old PET programs! We modified Dungeon to Dungeons of Half Moon Bay High School with monsters the names of teachers, then we modified the multiplier so they had massive hit points and would kill any student that came near! I added an intro of a warning from Detrix the dungeon master. Pretty sure I still have the cassette around somewhere… Oh the days of simple coding!
Yes, though in back in 1982 they had a looser definition of what an emulator was. If it allowed a computer to run software from another computer, it was an emulator.
I kind of fitted the emulator with black screen and green cursor into one line, but only for direct-mode with abbreviations and without line-number, with line-number I still come one character short: POKE56576,5:POKE53272,4:POKE53280,0:POKE53281,0:POKE648,128:POKE642,4:POKE644,128:PRINT"{Green}":SYS64767 Using POKEs to 642 and 644 combined with SYS64767 saves you the POKE to 1024 and the Clear-Screen (kind of). Using A=53272 actually does not save anything. It takes up 8 characters (including the following ":" ) and saves 4 bytes once (53272) and 2 bytes twice (53280,53281) = 8 bytes as well
Nice, and since the original program NEWs itself, a direct-mode-only version seems somewhat valid. The only reason to make it a program, really, is so it's possible to SAVE and LOAD it.
This should also be possible with the Commodore C128, but would a more accurate emulator be possible on the C128 that does 40 and 80 columns PET software (at least that uses the Kernal)?
@@JohnGuillorykf5qeo Yes, I replied to my own comment, but doesn't the $ffd2 or C128 equivalent work? i.e., you can still PRINT to the 80 columns screen, right?
@@JohnGuillorykf5qeo In any case, a 40 columns emulator on the C128 would be somewhat better because the C128 has a number pad similar to the PET. So some 40 columns games that use the number pad would be easier to play.
@@JohnGuillorykf5qeo Hm. It occurs to me, though, that you could mirror the 80-column screen RAM in main RAM, change the KERNAL character output routines to print to both, and have the timer interrupt that does things like keyboard scanning (60 times per second or so) also check the main RAM copy for changes and copy those to the C128's 80-column frame buffer, right?
I think one of the reasons commodore and other 8 bit micro companies did not survive past the 90s is because their computers did not have decent backwards compatibility compared to the pc and mac.
There were many factors but mostly it was bad management at Commodore. Amiga had more custom chips which made it better but more expensive to produce than other competing computers. You will find the information on TH-cam if you search for it. It is a real shame that the Amiga never reached its potential because of stupidity. It was the C64 that helped keep Commodore alive for so long
@@thesuperdog Yea but i wonder if the amiga could be more successful if it could run c64 software and maybe even vic 20 and pet i know a lot of people loved the ibm pc because all the pcs where compatible with each other and you could run a program from the early 80s on a high end pc in the 90s (but not on a modern pc without dos box). but of course like you said the company had a lot more problems but thats another advantage the pc had it was a more open platform 3d parties could make pcs and if ibm messed up someone else would just make a better pc but if you tried to make a better amiga you would get sued.
It is funny you say that, because the Macintosh's lack of back-compatibility with the existing Apple 2 line was considered a huge issue for several years. The IIgs is really the computer Apple should've thrown all their weight behind, but they were certain the 2 line was dead even before the original Macintosh launched, and it became a self-fulfilling prophecy.
@@belstar1128 The C-128 had that backwards-compatibility with the 64 as well as CP/M compatibility, but it still wasn't enough to save Commodore. I can't remember if Butterfield ever programmed any "Frankenstein" applications using both sides of the 128, but other near geniuses did, and it was amazing to me. Customers just didn't seem to like the 128 as well as the 64. Commodore tried to move on and catch that lightning in a bottle again with the planned 264 and/or C65, but other internal issues brought them to their knees.
I did try that at the end, but only squeezed the background and character colours into the single line; border wouldn't fit. Of course, the one-line limit is totally arbitrary, but it's part of what makes things fun for me.
@@8_Bit Different versions of the Kernel handled character color three different ways, and compatibility with screen pokes would depend upon which Kernel version one was using. When using the middle version, code which poked characters onto the screen wouldn't be able to show anything after a screen clear, since character cell colors would all be set to match the background.
@@KoopaMedia64 In middle-ROM versions, clearing the screen sets all color attributes to match the background color, so characters poked into screen memory would be invisible until code "prints" to those spots on the screen.
@@KoopaMedia64 Probably the best Kernal was the last version. Instead of setting colors to match the background, they were set to match the current cursor color. So one way to tell the difference between Kernel versions is the following line: POKE 646,0:PRINT CHR$(147):POKE 1024,160 This line clears the screen and pokes a solid square into the top left corner. If it's got the original Kernal, the square will be white. If it's got the first revision (as yours does), the square will be invisible because it'll be set to the background color to hide the 'sparkle' problem that the original C64 had. On the last revision, it'll be black, because you're first changing the cursor color to black and _then_ clearing the screen. In regards to the 'sparkle', here's some more information: A lot of people blamed the VIC-II chip, but the _actual_ problem was a ROM chip of which 3 million were in service with no problems in other systems, including the video game Asteroids. The ROM, which had been designed years earlier, had a special precharging circuit to make it run faster, but the circuit made it sensitive to spurious signals. The video circuitry and the 6510 microprocessor alternated in controlling the system bus, and when control passed from one to the other, voltage spikes were sometimes generated. It just happened that these voltage spikes hit the exact timing. If the spike had been a few nanoseconds shorter or longer, it wouldn't have been a problem. The spike was just wide enough that the ROM saw it as a valid address. It would ignore the next address request and give the video chip wrong data. Since the ROM contained the C64 character set, the screen display would be littered with random slices of characters. The sprite-to-background collision registers would read this as a collision.
even if the keyboard isnt compatible, i think im gonna make a d64 file with the pet code on it to have some fun with it on my TheC64 anyways, if i cared about convenience of use, i wouldnt be using old computers lol
This makes me wonder. Could I get PET compatibility with my "TheC64" machine? I was trying to test this with VICE but the Left CTRL doesn't seem to trigger the CBM key. I'll have to figure it out but I do wonder if a very basic PET emulator would work on TheC64. I know it is missing the number pad but USB number pads are a dime a dozen. It makes me think...
This PET emulator or the somewhat more advanced one Commodore made should work fine on TheC64. But an actual VICE-quality PET emulator would require Retro Games to actually implement it, or I suppose some very enthusiastic and skilled hacker could do it. And yeah, the missing number pad would be a problem. I'm not sure if TheC64 firmware would support a stand-alone number pad and even if it did, it wouldn't necessarily automatically map the keys right. But it might work!
I've never seen a PET Emulator cartridge either - though Commodore did release one on cassette. I haven't tried it yet to know if it's much better than this simple one.
@@8_Bit A revised kernel and BASIC ROM could probably allow for compatibility with many programs that expect to make direct calls into the PET's ROM. If the interrupt service routine switched banking properly, BASIC could even sit at $C000-$DFFF as it would on a PET or VIC-20.
@@8_Bit Same here, have never seen a cartridge version from Commodore, just the disk version that emulates the PET 2001. I can make a .D64 version available on my Google Drive if y'all want to check it out. (The last time I checked, the disk still worked...)
Is it possible to make a PET game loader for each compatible game? I understand it would break the 1 liner restriction, but it would be nice and user friendly. Initialize the emulator Load specific game Autorun game.
Yes, it is possible. Something like the following code would do it: 1 POKE 56576,5:POKE 53272,4:POKE 646,128:POKE 1024,0:POKE 44,4:POKE 56,128 2 PRINT "{CLR}LOAD";CHR$(34);"program name";CHR$(34);",8{HOME}"; 3 POKE 198,1:POKE 631,131:NEW Note that the NEW command has been moved from line 1 to line 3. Line 2 prints LOAD"program",8 at the top of the screen and leaves the cursor in the top-left corner of the screen (over the letter L in LOAD). Line 3 POKEs the code for SHIFT-RUN/STOP into the keyboard buffer (so that the C64 will type "LOAD" and then "RUN" automatically.)
Have totally lost all my C64 basic skills a long time ago... but you can't make a for next loop with read data "address,value,address,value" and so on? then just poke address,data;next?
That would be a long video. In text mode, there's two types of horizontal scroll: A coarse scroll and a smooth scroll. A coarse scroll is easy enough that even BASIC can do it. A smooth scroll is only possible from BASIC if you set the _entire screen_ to 38 columns. (Most demos use a raster interrupt to set only the bottom line to 38 columns.) If you want wiggling text and border lines, you're going to need machine language.
2:41 '128' would be one PAST the highest address used by BASIC. 3:48 I don't think just a CLR will handle changing the ★start★ of BASIC. 4:00 Maybe you should SAVE a program that has a NEW in it, before RUNing it. 4:42 Does the Super Snapshot assert itself into processor memory at $8000 while doing stuff? If so, screen-scrolling reads would read its ROM instead of screen RAM. 5:35 You were able to configure the start/end of BASIC on the PET, so that's always been around. The VIC-20 included the ability to redirect the screen editor to a new area as a matter of necessity considering its various RAM-expansion options, and the VIC had no hope of easily emulating a PET. So, it seems more like a coincidence that the C64 can configure its memory to be similar to the PET. Also, it has RAM available everywhere in the address space. 6:53 That last second lingers for a while! 10:56 Will it take a negative bet? Has anyone tried that on "Jeopardy!"? 21:50 You could always just make the program a "two-liner"! 22:29 1 SYS2063:REM{66 bytes of carefully chosen machine code}. 23:57 Is there a brighter green?
re: $8000 and the Snapshot, ah yes, that's probably what is happening. The C64's "light green" looks so mint (?) coloured to me that I don't think it would be better, but I agree the regular green looks too dark on my video capture. I brightened it up "in post" for the end credits. Maybe I should have done that for the last few minutes of the main video too.
"1 SYS2063:REM{66 bytes of carefully chosen machine code}." Ha! Cheating! But I think you're on to something there. Actually could do quite a bit in 66 bytes.
I wonder about dungeon, the start part where it counts down 60 seconds ... is that really what it does isn't it a simple counter, since whe i run it on my 48MHz U64e it still takes the same amount of time, i don't think it actually does anything... or? Those quite awful 3d programs Driller for examle is way too fast at 48MHz, but a simple basic program crawl exactly like at 1MHz.
I don't have an answer for why it wouldn't go faster, but it wouldn't make much sense to me for it to be just a simple counter for it's own sake, if it wasn't making some preparations during that time... A valid question though, I'd like to know as well :)
It depends on how the game implements the timer. Remember, the Commodore computers (except perhaps for the Amiga) all implement a "Jiffy Clock" that updates 50 or 60 times per second, depending on if it's a PAL or NTSC system. So a very simple code segment might look like this: 10 TI$="000000":REM reset the jiffy timer to 0 20 IF TI$>"000059" GOTO 50:REM skip the next line after the timer reaches 1 minute 30 PRINT CHR$(19);"Time Remaining: ";60-VAL(RIGHT$(TI$,2));CHR$(157);" seconds" 40 GOTO 20 50 REM rest of the program begins here As long as the emulator correctly implements the jiffy clock, the code segment above will _always_ count exactly 60 seconds, regardless of how fast the emulator is running.
@@SpearM3064 - Amigas have a JiffyClock. Two, in fact. It's actually improved as reading the MSB latches the whole thing so it won't change during read - it's still the same three-byte affair that the C64/128 version is. The clock continues counting in the background during the latch, but the values shown to the program are fixed until the LSB is read. One difference is that it's driven by VBLANK rather than a fixed crystal, so it's 50Hz in PAL screen modes and such, regardless of if the machine itself is PAL or NTSC. It's actually called the "TOD clock" (time of day - it's related to the C64 TOD stuff, but not the exact same). They're driven by the 8520 CIAs of course. Here's an interesting thing: ZX Spectrums and bunches of other 8-bit machines ALSO have a three-byte TOD/JiffyClock-style affair, often driven through the VBLANK....BBC Micros, through, have a 100hz fixed-rate clock that spans like 5 bytes.
Short answer: no. Long answer: I am in a long-running feud with Robin's cross-media storytelling habits about his early and deeply regrettable computer purchases. (Also "no.")
@@gklinger Oh, you could and I wouldn’t kick it out of bed for eating electrons. But neither would I answer questions like “what’s your favorite gift from Golan?” by saying “well it all started when I thought about great gifts from Golan but I instead asked him to give me a terrible computer. A computer which is terribly known for its terribleness. And it was terrible. So it was terrible for a while and *then*-“
I think we've ended up with a stricter meaning of "emulator" over the last 20-30 years than existed back in the early '80s. It's an emulator in the loose sense that it allows a C64 to run software for another platform, the PET, but it's far from comprehensive, and even if we didn't have the tiny one-line limit, we could only further improve compatibility somewhat.
No; software in a virtual machine does not directly access the hardware of the host machine, as the programs here do. (Or at least does not do so entirely unmediated.) Virtual machines can be (or be used to build) emulators, but there are plenty of emulators out there that choose to emulate a system well enough to properly run only a subset of programs for the target machine, and this is one of those. (In fact, most emulators don't run _every_ conceivable program for their target systems. Even VICE will still not properly run some C64 demos, and earlier versions of emulators for popular 8-bit systems often did not correctly run quite a number of the more "clever" programs available for the platform.) See my reply to the top-level comment from Code Monkey King for more on where the term "emulator" originated and its meaning.
I hung out with Jim Butterfield in the mid 80s. He was a genius. I couldn’t appreciate his work as a teenager but seeing his code and concepts pop up here and there on TH-cam 35 years later reminds me of just how smart he was.
Jim is definitely one of the legends of Commodore, for sure. I've read many of his books over the years. His knowledge of the C64 is deep.
@@JustWasted3HoursHere Was deep. :(
@@JustWasted3HoursHere Sadly, he’s been gone over a decade.
I wrote this game way back when. Thanks for keeping it alive !
Thanks Brian, I'm a big fan of your work!
Even as a teen I knew who Jim Butterfield was, at least in name only. I would see his name mentioned in software, manuals, magazines, books, etc. Great episode!
Yes, Jim was ever-present in Commodore land during the '80s.
It's amazing how much we want to go back to older and older computers... :-)
This is just way too cool, I’m gonna have to play around with this sometime on my breadbox C64.
Kinda makes one wonder, if done in 2 BASIC lines or in assembly as just a simple load program or driver, could one configure one of those 80 column adapters for the C64 to be able to run 80 column PET software?
Transacter. I must say I was intrigued when I saw this on the magazine rack of my local Stars and Stripes bookstore. I may have used my VIC 20 and Commodore 64 but when I got my Amiga they went to the side. But it was The Transacter magazine that had me take another look at my older Commodore computers. And that issue was the only one missing a subscription postal card.
The Transacter magazine program listings where there was no SCREAMING 😆
0:02 Wow! I remember that issue cover! I'm sure I've got a copy of this one squirrelled away someplace.
Same here! In a box somewhere in my basement I have a copy. Just seeing it brought back so much nostalgia!
Of course you know how to fix the directory listing instantly.. Thank you for being you, and sharing a part of you on TH-cam. Happy Christmas Robin!
Jim Butterfield hung around a computer store called Batteries Included at the Village by the Grange mall in Toronto. Every Friday, as a Grade 9 student I would visit him and he would show me amazing things on the Commodore PET like a 4 voice music program!
I took my C64 to thanksgiving and played some games with my niece. She enjoyed it and so did my sister. Nostalgia for my sister and seeing a bit of history while having fun for my niece.
Video RAM starts at $8000. that‘s also where your module resides. So when the module scrolls video memory, it only can take it from the ROM as it has no access to its underlying RAM. That‘s why it shows „garbage“. It‘s the Rom from $8028 onward. Loop
My eldest brother just found old photographs of me using my Vic-20 when I was 13 years old back in 1982! I’m now 52 and would like to experience those good times again so I have just ordered a new C-64. I never upgraded to the Commodore 64 later unfortunately, cars and girls were a higher priority I guess…. Really enjoying your channel and keep up the great work.
Girls? 😮 BEHAVE!
😉
Robin,
Shortly after buying my C64 I joined a Commodore club that met in a pizza place in San Dimas, California. As a new member I was given two disks full of Basic programs. When I looked at them all of them were converted Pet programs. According to the remarks the first line of the programs made it possible to run on a C64. I also learned about TPUG by reading the remarks. 😃
Amazing hack! I'm already a fan of Jim Butterfield because of his KIM-1 genies software)
A bit strange why they call it "emulator" in the manual while it's rather a re configuring the memory layout
to be compatible with PET software, but probably just due to marketing purposes. Since it works like a charm
it doesn't matter really) Thanks for sharing!
It's an emulator the way Wine Is Not an Emulator is.
"Emulator" simply refers to having one machine (the "host") run software for another machine (the "target") as well as the target machine itself could run that software. Note that an emulator does not have to run _all_ software that the target machine can run, just that _some_ software can be run on the host and appear, for practical purposes, indistinguishable from running it on the target. Even today we have many emulators for much older and slower systems that can correctly run most, but not all, software for the target system. (Typically the failure is due to insufficient emulation of what most people would consider bugs in the target system.)
The word was coined by IBM in 1963. Up to that point they had written many simulators for their newer machines that would run software from their older machines to give some form of backward compatibility. These simulators ran the old software slower than the original machines, however, which was sometimes (perhaps often) a problem. With the IBM 360 line they added some hardware support for these simulators that could let them run at the full speed of the older machines, and this was a significant enough improvement that they coined the term "emulator" to distinguish these full-speed simulators from the older ones that couldn't run software at the same speed as the target.
In this case, the word "emulator" certainly applies because, for those programs that the emulator is capable of running correctly, it runs them at full speed (or close enough that the user won't see the difference). There are still other minor differences; for example the character glyphs on the C64 are different from the PET, and, in the examples given here, even the foreground and background colours of the text screen are different. Which characteristics can be different while still calling the process "emulation" is obviously somewhat dependent on the feelings of the end user.
Interestingly on the C64 wiki this is listed as being able to run C64 programs on a PET/CBM:-
C64 programs can be made to run on a PET/CBM computer by running this command: POKE 40,1: POKE 41,8: POKE 8*256,0: NEW
I think that only handles BASIC programs that PRINT everything, while this program also handles POKEs to screen, greatly improving compatibility. (Still cool, though)
@@8_Bit Yeah, there was always going to be more compatibility going C64-to-PET.....and obviously good luck in changing that screen to blue :)
There is a shorter way to exact 80 characters to set border & background to black. Only the clear screen is missing: 1A=53272:B=128:Po56576,5:PoA,4:Po648,B:PoB*8,0:Po44,4:Po56,B:PoA+9,0:PoA+8,0:NEW
Breaking the 8 Sprite barrier?? *That's MADNESS!!*
th-cam.com/video/7C8IvnMmJTA/w-d-xo.html to see C64 sprite multiplexing
@@LEGOpachinko Nice!
That emulator is worth it just to play dungeon. Simple graphics but looks like a lot of fun.
The PET was a great start to my life with computing. I remember Dungeon and the text-based “Hunt the Wumpus” games, especially.
0:33 The one in green is clearly smoking something.
Fantastic, and very interesting. Now somebody just needs to make a C64 numeric keypad.
I'd imagine they used the inverse S instead of the heart as it was easier to print.
Makes me wonder wether that one liner would work on a C128 since that machine has a numeric keypad per default
Edit : and perhaps using the 80 columns mode aswel 👍🏻
@@Kakariki73 The problem with 80-column mode on the C128 is that you can't directly access screen RAM. Any program that relied on POKEs to screen memory would not work in 80-column mode.
I love that you sound so surprised when something works and something not works xD
It would be interesting to see if Dungeon had the Basic error that allowed the diagonal wall phasing glitch that it did on Basic 4 on the PET's when running on the C64
This is very cool. Jim was the king!
That was fun! I did not know about that possibility
My first introduction to computers was a PET 2001 with chicklet keys in school and although you can run PET games on the C64 it's not the same. This is why emulation doesn't float my boat. I need a green screen (not a TV screen), I need the keys, I need the tape deck, I need the size of the beast for my nostalgic juices to start flowing. I wish I could afford one now.
Yeah, real ones are expensive (around $1000 and up on ebay) but have you seen this PET project that uses all real hardware components (no emulation or FPGA)? th-cam.com/video/zHAIuE5BQWk/w-d-xo.html Then all you have to do is find yourself an old green monochrome monitor and you're halfway there! [edit: The kit even includes a PET-like keyboard!]
I can relate... Although my first computer was bought in '91 and it was a PC - IBM PS/1 with 286 CPU and 1MB of RAM, VGA video, some weird audio card (no PCM) that I wish I had known how to program it. The machine can be emulated with IBMulator, but I truly miss my original system that I've lost during time - and I know it's unlikely that I'll ever find one that's the same model or even just close and for a price that I can afford. Saddens me, and it was in full working condition the last time I saw it. The last time I used it for was as a terminal, connected to my Linux workstation with null modem cable I used it to access IRC from my bed :D The IBMulator is very good emulator, I like it - I wouldn't say it doesn't float my boat, but I can't pretend the experience to ever be the same.
Awesome video! What a neat trick.
I really should read more carefully - I thought the title was "Online PET Emulator for Commodore 64" and was full on WTF? :D Made more sense when I started watching the video ;)
P.S. I have lately become so addicted to podcasts I rarely listen to music when walking outdoors any more - I've included a number of vintage computer podcasts, but I've also found Growing Up 80's and I love it! Just one day I listened the episode about corner stores, and there was a ton of stuff there that was much similar to other stuff here in Finland (we're also two-language country - Finnish and Swedish) so there's that too. Some things were just so damn _same,_ although naturally there were differences as well.
I'm glad you're enjoying GU80s, kiitos! Our city of Thunder Bay has a large Finnish population, and still have a few shops where Finnish is regularly spoken. One pair of my great-grandparents were born there, and my grandmother grew up speaking Finnish at home and stayed fluent throughout her life.
@@8_Bit Wow, now that's a coincidence if I ever saw one =) GU80s is definitely one of my feel good podcasts, listening it takes me back to my own childhood in the 80's and makes me feel all kinds of warm and fuzzy (even when it doesn't necessarily match up), so the kiitokset belong all to you ;) Both of you :)
Thanks for the reply - it's a small world sometimes! I wonder... Do you know if you've ever tasted this Finnish candy we call salmiakki? It's not the brand, it's just the substance it's made of and my understanding is that it's not used as candy anywhere else in the world - it's a weird taste, not salty nor sweet (although the candy made of it can have salt or sugar in it), not really anything I know to compare with? I guess that's not a much of a description and I guess I'll have to hope that you would know it if you know it ;D I wouldn't be that surprised if such candy would have been available somewhere with large Finnish population :)
@@robsku1 Yes, we do have that here though most often now I see the Dutch version because my mom-in-law was born there, they call it dubbelzoute drop I think. I think it's nearly the same as salmiakki, probably a somewhat different mixture and of course shape, but overall similar. A Swedish friend also likes something similar.
@@robsku1 I think it may have been available throughout Canada. From looking at Wikipedia, salmiakki seems to be what we in western Canada called "double-salted liquorice."
This is very interesting.
I mean the PET was even more before my time but it'd make me wanna try some PET games on the bread bin if I had the chance.
Considering the PET was more of a business machine however, how does this emulator stack up with business software?
Great seeing all these old PET programs!
We modified Dungeon to Dungeons of Half Moon Bay High School with monsters the names of teachers, then we modified the multiplier so they had massive hit points and would kill any student that came near!
I added an intro of a warning from Detrix the dungeon master. Pretty sure I still have the cassette around somewhere…
Oh the days of simple coding!
It’s less of an emulator and more of a compatibility mode.
Yes, though in back in 1982 they had a looser definition of what an emulator was. If it allowed a computer to run software from another computer, it was an emulator.
I kind of fitted the emulator with black screen and green cursor into one line, but only for direct-mode with abbreviations and without line-number, with line-number I still come one character short:
POKE56576,5:POKE53272,4:POKE53280,0:POKE53281,0:POKE648,128:POKE642,4:POKE644,128:PRINT"{Green}":SYS64767
Using POKEs to 642 and 644 combined with SYS64767 saves you the POKE to 1024 and the Clear-Screen (kind of). Using A=53272 actually does not save anything. It takes up 8 characters (including the following ":" ) and saves 4 bytes once (53272) and 2 bytes twice (53280,53281) = 8 bytes as well
Nice, and since the original program NEWs itself, a direct-mode-only version seems somewhat valid. The only reason to make it a program, really, is so it's possible to SAVE and LOAD it.
This should also be possible with the Commodore C128, but would a more accurate emulator be possible on the C128 that does 40 and 80 columns PET software (at least that uses the Kernal)?
Actually, thinking about it, POKEing to the screen on the 80-columns display won't work. Only PRINTing to it will. I think.
No, because the 128's 80-col mode is not directly accessible via the cpu.
@@JohnGuillorykf5qeo Yes, I replied to my own comment, but doesn't the $ffd2 or C128 equivalent work? i.e., you can still PRINT to the 80 columns screen, right?
@@JohnGuillorykf5qeo In any case, a 40 columns emulator on the C128 would be somewhat better because the C128 has a number pad similar to the PET. So some 40 columns games that use the number pad would be easier to play.
@@JohnGuillorykf5qeo Hm. It occurs to me, though, that you could mirror the 80-column screen RAM in main RAM, change the KERNAL character output routines to print to both, and have the timer interrupt that does things like keyboard scanning (60 times per second or so) also check the main RAM copy for changes and copy those to the C128's 80-column frame buffer, right?
Nice video clip, keep it up, thank you :)
@4:12 LMS Tech programmers using absolute vs. relative references in their fast scrolling function?
I think one of the reasons commodore and other 8 bit micro companies did not survive past the 90s is because their computers did not have decent backwards compatibility compared to the pc and mac.
There were many factors but mostly it was bad management at Commodore. Amiga had more custom chips which made it better but more expensive to produce than other competing computers. You will find the information on TH-cam if you search for it. It is a real shame that the Amiga never reached its potential because of stupidity. It was the C64 that helped keep Commodore alive for so long
@@thesuperdog Yea but i wonder if the amiga could be more successful if it could run c64 software and maybe even vic 20 and pet i know a lot of people loved the ibm pc because all the pcs where compatible with each other and you could run a program from the early 80s on a high end pc in the 90s (but not on a modern pc without dos box).
but of course like you said the company had a lot more problems but thats another advantage the pc had it was a more open platform 3d parties could make pcs and if ibm messed up someone else would just make a better pc but if you tried to make a better amiga you would get sued.
It is funny you say that, because the Macintosh's lack of back-compatibility with the existing Apple 2 line was considered a huge issue for several years.
The IIgs is really the computer Apple should've thrown all their weight behind, but they were certain the 2 line was dead even before the original Macintosh launched, and it became a self-fulfilling prophecy.
@@belstar1128 The C-128 had that backwards-compatibility with the 64 as well as CP/M compatibility, but it still wasn't enough to save Commodore. I can't remember if Butterfield ever programmed any "Frankenstein" applications using both sides of the 128, but other near geniuses did, and it was amazing to me. Customers just didn't seem to like the 128 as well as the 64. Commodore tried to move on and catch that lightning in a bottle again with the planned 264 and/or C65, but other internal issues brought them to their knees.
@@haroldlane4647Can you elaborate a bit on this interestingly sounding Frankenstein topic? 😮
I need to save that one-liner!
WIth all due respect to my old friend, may he rest in peace, this program really needed: "POKE53280,0:POKE53281,0:POKE646,5.
I did try that at the end, but only squeezed the background and character colours into the single line; border wouldn't fit. Of course, the one-line limit is totally arbitrary, but it's part of what makes things fun for me.
@@8_Bit Different versions of the Kernel handled character color three different ways, and compatibility with screen pokes would depend upon which Kernel version one was using. When using the middle version, code which poked characters onto the screen wouldn't be able to show anything after a screen clear, since character cell colors would all be set to match the background.
@@flatfingertuning727 That probably rules out my C64 then, it’s got the middle kernal version. What would the different screen poke look like?
@@KoopaMedia64 In middle-ROM versions, clearing the screen sets all color attributes to match the background color, so characters poked into screen memory would be invisible until code "prints" to those spots on the screen.
@@KoopaMedia64 Probably the best Kernal was the last version. Instead of setting colors to match the background, they were set to match the current cursor color. So one way to tell the difference between Kernel versions is the following line:
POKE 646,0:PRINT CHR$(147):POKE 1024,160
This line clears the screen and pokes a solid square into the top left corner. If it's got the original Kernal, the square will be white. If it's got the first revision (as yours does), the square will be invisible because it'll be set to the background color to hide the 'sparkle' problem that the original C64 had. On the last revision, it'll be black, because you're first changing the cursor color to black and _then_ clearing the screen.
In regards to the 'sparkle', here's some more information: A lot of people blamed the VIC-II chip, but the _actual_ problem was a ROM chip of which 3 million were in service with no problems in other systems, including the video game Asteroids. The ROM, which had been designed years earlier, had a special precharging circuit to make it run faster, but the circuit made it sensitive to spurious signals. The video circuitry and the 6510 microprocessor alternated in controlling the system bus, and when control passed from one to the other, voltage spikes were sometimes generated.
It just happened that these voltage spikes hit the exact timing. If the spike had been a few nanoseconds shorter or longer, it wouldn't have been a problem. The spike was just wide enough that the ROM saw it as a valid address. It would ignore the next address request and give the video chip wrong data. Since the ROM contained the C64 character set, the screen display would be littered with random slices of characters. The sprite-to-background collision registers would read this as a collision.
7:38 what about having option for PET, but support a standard USB-keyboard mapped like a PET keyboard as far as possible.
$8000? That's an expensive screen.
Microcomputer hardware was expensive in the early days! Fortunately it came down to $400 by the time of the C64.
even if the keyboard isnt compatible, i think im gonna make a d64 file with the pet code on it to have some fun with it on my TheC64 anyways, if i cared about convenience of use, i wouldnt be using old computers lol
This makes me wonder. Could I get PET compatibility with my "TheC64" machine? I was trying to test this with VICE but the Left CTRL doesn't seem to trigger the CBM key. I'll have to figure it out but I do wonder if a very basic PET emulator would work on TheC64. I know it is missing the number pad but USB number pads are a dime a dozen. It makes me think...
This PET emulator or the somewhat more advanced one Commodore made should work fine on TheC64. But an actual VICE-quality PET emulator would require Retro Games to actually implement it, or I suppose some very enthusiastic and skilled hacker could do it. And yeah, the missing number pad would be a problem. I'm not sure if TheC64 firmware would support a stand-alone number pad and even if it did, it wouldn't necessarily automatically map the keys right. But it might work!
Maybe retro games will make a complete mini PET.
Sounds like it might be better to call it a PET *BASIC* emulator, no?
Bets! Where can one get a copy of that disk??? I haven’t seen that game in ages!!
The disk shown in this video is called "PET Games Disk 01 (19xx)(-).d64"
It doesn't feel authentic without the background and border in black and the characters in.....green. ;-)
_Will it run the PET version of PETSCII Robots?_
No.
I have a C64 sales pamphlet from Commodore, it shows a Pet Emulator cartridge.
I've never seen one. I guess it was not released?
I've never seen a PET Emulator cartridge either - though Commodore did release one on cassette. I haven't tried it yet to know if it's much better than this simple one.
@@8_Bit A revised kernel and BASIC ROM could probably allow for compatibility with many programs that expect to make direct calls into the PET's ROM. If the interrupt service routine switched banking properly, BASIC could even sit at $C000-$DFFF as it would on a PET or VIC-20.
@@8_Bit Same here, have never seen a cartridge version from Commodore, just the disk version that emulates the PET 2001. I can make a .D64 version available on my Google Drive if y'all want to check it out. (The last time I checked, the disk still worked...)
Nice. But we need to see how to rotate sprites and have more than 8 of them 😹
You say they worked to make it compatible. I would say the used if it ain't broke principle instead!
Is it possible to make a PET game loader for each compatible game?
I understand it would break the 1 liner restriction, but it would be nice and user friendly.
Initialize the emulator
Load specific game
Autorun game.
Yes, it is possible. Something like the following code would do it:
1 POKE 56576,5:POKE 53272,4:POKE 646,128:POKE 1024,0:POKE 44,4:POKE 56,128
2 PRINT "{CLR}LOAD";CHR$(34);"program name";CHR$(34);",8{HOME}";
3 POKE 198,1:POKE 631,131:NEW
Note that the NEW command has been moved from line 1 to line 3. Line 2 prints LOAD"program",8 at the top of the screen and leaves the cursor in the top-left corner of the screen (over the letter L in LOAD). Line 3 POKEs the code for SHIFT-RUN/STOP into the keyboard buffer (so that the C64 will type "LOAD" and then "RUN" automatically.)
Have totally lost all my C64 basic skills a long time ago... but you can't make a for next loop with read data "address,value,address,value" and so on? then just poke address,data;next?
but could Attack of the PETSCII Robots run?
I love Robin ;)
Can you make a video about programming scrolling text and wiggling text and border lines like C64 demo’s
That would be a long video. In text mode, there's two types of horizontal scroll: A coarse scroll and a smooth scroll. A coarse scroll is easy enough that even BASIC can do it. A smooth scroll is only possible from BASIC if you set the _entire screen_ to 38 columns. (Most demos use a raster interrupt to set only the bottom line to 38 columns.) If you want wiggling text and border lines, you're going to need machine language.
2:41 '128' would be one PAST the highest address used by BASIC.
3:48 I don't think just a CLR will handle changing the ★start★ of BASIC.
4:00 Maybe you should SAVE a program that has a NEW in it, before RUNing it.
4:42 Does the Super Snapshot assert itself into processor memory at $8000 while doing stuff? If so, screen-scrolling reads would read its ROM instead of screen RAM.
5:35 You were able to configure the start/end of BASIC on the PET, so that's always been around. The VIC-20 included the ability to redirect the screen editor to a new area as a matter of necessity considering its various RAM-expansion options, and the VIC had no hope of easily emulating a PET. So, it seems more like a coincidence that the C64 can configure its memory to be similar to the PET. Also, it has RAM available everywhere in the address space.
6:53 That last second lingers for a while!
10:56 Will it take a negative bet? Has anyone tried that on "Jeopardy!"?
21:50 You could always just make the program a "two-liner"!
22:29 1 SYS2063:REM{66 bytes of carefully chosen machine code}.
23:57 Is there a brighter green?
re: $8000 and the Snapshot, ah yes, that's probably what is happening.
The C64's "light green" looks so mint (?) coloured to me that I don't think it would be better, but I agree the regular green looks too dark on my video capture. I brightened it up "in post" for the end credits. Maybe I should have done that for the last few minutes of the main video too.
"1 SYS2063:REM{66 bytes of carefully chosen machine code}."
Ha! Cheating! But I think you're on to something there. Actually could do quite a bit in 66 bytes.
@@JustWasted3HoursHere: You have to choose instruction bytes that can be entered from the keyboard.
@@csbruce That's fair.
While we're adding quibbles: at 20:57 the low byte of TXTTAB is already __1,__ not 0.
Impressive! Not perfect, but still impressive. 🙂
Also a way to LOAD"$",8,1
:D
I wonder about dungeon, the start part where it counts down 60 seconds ... is that really what it does isn't it a simple counter, since whe i run it on my 48MHz U64e it still takes the same amount of time, i don't think it actually does anything... or? Those quite awful 3d programs Driller for examle is way too fast at 48MHz, but a simple basic program crawl exactly like at 1MHz.
I don't have an answer for why it wouldn't go faster, but it wouldn't make much sense to me for it to be just a simple counter for it's own sake, if it wasn't making some preparations during that time... A valid question though, I'd like to know as well :)
It depends on how the game implements the timer. Remember, the Commodore computers (except perhaps for the Amiga) all implement a "Jiffy Clock" that updates 50 or 60 times per second, depending on if it's a PAL or NTSC system. So a very simple code segment might look like this:
10 TI$="000000":REM reset the jiffy timer to 0
20 IF TI$>"000059" GOTO 50:REM skip the next line after the timer reaches 1 minute
30 PRINT CHR$(19);"Time Remaining: ";60-VAL(RIGHT$(TI$,2));CHR$(157);" seconds"
40 GOTO 20
50 REM rest of the program begins here
As long as the emulator correctly implements the jiffy clock, the code segment above will _always_ count exactly 60 seconds, regardless of how fast the emulator is running.
@@SpearM3064 - Amigas have a JiffyClock. Two, in fact. It's actually improved as reading the MSB latches the whole thing so it won't change during read - it's still the same three-byte affair that the C64/128 version is. The clock continues counting in the background during the latch, but the values shown to the program are fixed until the LSB is read. One difference is that it's driven by VBLANK rather than a fixed crystal, so it's 50Hz in PAL screen modes and such, regardless of if the machine itself is PAL or NTSC. It's actually called the "TOD clock" (time of day - it's related to the C64 TOD stuff, but not the exact same). They're driven by the 8520 CIAs of course.
Here's an interesting thing: ZX Spectrums and bunches of other 8-bit machines ALSO have a three-byte TOD/JiffyClock-style affair, often driven through the VBLANK....BBC Micros, through, have a 100hz fixed-rate clock that spans like 5 bytes.
Why don't you just use the CLS command instead of print to clear the screen?
There is no "cls" in Commodore BASIC.
@@TDGalea D'oh! 30+ years ago I would have remembered this myself. Thanks.
Great video is the way i wish/want my videos to turn out
Everest and dungeon look great i will try them out thanks again
You need to work on your Blackjack skills. Pro Tip: 16 you always hit.
The is because a loss would still be a loss
26:57 grrr
No love for the TS-1000?
Short answer: no.
Long answer: I am in a long-running feud with Robin's cross-media storytelling habits about his early and deeply regrettable computer purchases. (Also "no.")
@@jpcompton So I shouldn't post one ASAP as a Christmas gift?
@@gklinger Oh, you could and I wouldn’t kick it out of bed for eating electrons. But neither would I answer questions like “what’s your favorite gift from Golan?” by saying “well it all started when I thought about great gifts from Golan but I instead asked him to give me a terrible computer. A computer which is terribly known for its terribleness. And it was terrible. So it was terrible for a while and *then*-“
@@jpcompton At the risk of this getting weird, I miss you.
Yes Linux!
Would this not be a virtual machine rather than an emulator
I think we've ended up with a stricter meaning of "emulator" over the last 20-30 years than existed back in the early '80s. It's an emulator in the loose sense that it allows a C64 to run software for another platform, the PET, but it's far from comprehensive, and even if we didn't have the tiny one-line limit, we could only further improve compatibility somewhat.
No; software in a virtual machine does not directly access the hardware of the host machine, as the programs here do. (Or at least does not do so entirely unmediated.)
Virtual machines can be (or be used to build) emulators, but there are plenty of emulators out there that choose to emulate a system well enough to properly run only a subset of programs for the target machine, and this is one of those. (In fact, most emulators don't run _every_ conceivable program for their target systems. Even VICE will still not properly run some C64 demos, and earlier versions of emulators for popular 8-bit systems often did not correctly run quite a number of the more "clever" programs available for the platform.)
See my reply to the top-level comment from Code Monkey King for more on where the term "emulator" originated and its meaning.