@@8_Bit Yep it is. He and his brother Richard lived in Braunton Devon and submitted quite a few type ins to magazines. Then they both moved up to Manchester to work at Ocean.
Robin, how ACCURATE is the Jiffy clock? Miss day and age internal clocks are usually controlled by a quartz crystal but I don't recall that there is one in the Commodore
@@weedmanwestvancouverbc9266 If I see it correctly, the jiffy clock is generated by one of the timers in one of the CIA chips which is driven by the system frequency which is generated with a quartz. It is not very accurate though, I think I read because the quartz is not stabilized. Each of the two CIA chips also has a more accurate time-of-day clock driven by the powere line frequency.
@@weedmanwestvancouverbc9266 It's as accurate as the 1.000213 MHz clock crystal used to generate the CPU clock, plus or minus a couple nanoseconds for the clock phase difference between the CPU and CIA. Important to note that the crystal isn't oven-controlled or anything, so it's gonna drift with temperature but it's about as rock-solid as you can get, really
Very neat. I've never seen this. Although you can accomplish more or less the same thing by turning reverse on and using space to plot what you want. Although one advantage this might have is that I bet you can color in the bottom right character without causing the screen to scroll. I bet this could work on the VIC-20 too.
Yes, this will allow the bottom right corner to be plotted without scroll, and it's also much easier to make lines going up or down than using RVS mode.
@@8_Bit Related to "not scrolling the screen if you write to the last screen cell": What happens if you are in Program mode rather than Immediate mode -- can embedded cursor control keycode (up/down left/right) be used to paint the screen from within a program? Wondering if this can be used to defeat that godawful problem where printing to the rightmost column caused the computer to frig up the logical/physical line linkage. Makes sense in immediate mode, but is a total bug to leave that active in Program mode. How did they not catch that? surely the same issue was present in earlier C= machines? Whoever finds the right poke to disable that in Run mode gets a Nobel Prize.
Robin.. Thank you so much!!! As a very young kid in the later 80's and early 90's and also not native English I started programming with basic and I kind of missed out on the whole assembly programming. It has been fascinating me the last years and I even bought original hardware again. And just thinking back a year ago vs now... I am actually able to fully grasp all of it. You have been a big influence for me with your excellent explanations and enthusiasm so that I now have understanding and dabble on my own with assembly on a real machine. Kind of like re-living childhood in a what-if I had someone like a dad or older brother that could take me along.
This is great! I wish I'd known about this back in the '80s. Four numbers that will always be embedded in my memory are 53280, 53281, 49152, and 64738.
Great video! As someone else already commented, I couldn't help thinking of the pipes screensaver when seeing you etch-a-sketching the screen :) I suppose that technically, POKE 788,84 could have the unintended consequence of changing the cursor colour to something unexpected, since you effectively just store whatever is in the accumulator at $0247 without loading the "correct value" to it first. The great thing about random pokes is you don't always see the side-effects, and those are the best kind of bugs to figure out ;)
I can't wait to buy my own C64. I "inhereted" my uncle's, but my father threw it away not realising it's actual value. He just thought it was a gaming console. My life was dramatically changed by that shitty decision. Finding a C64 and watching this content is like taking back my life.
Good luck. I owned one myself, so I'm plenty good with an emulator (WinVICE) for fooling around. Those poke works as intended on WinVICE's accurate C64 emulator (it has both an "accurate" and a "fast" emulator).
Look up the c64 mini or maxi. Pretty sure they kept it true to function for these things. What's more, has USB ports, can connect to modern displays directly and other handy upgrades. The mini does not have a functional keyboard, it's more or less a game console, but you can attach an external keyboard to it. I'm waiting for them to release the Amiga maxi, then I'll pick up one of both.
$0314 just reminded me of what a nerd I was as a kid. I had a Commodore 64 growing up. I also had a Casio databank watch. The one you could save phone numbers into. It also had a 'secret' databank that you could unlock with a numeric password. I set the password to 0314, due to its significance in the C64.
I had a magazine with a list of pokes. Brought it to school to study them in my free time. Handed it over to a kid who asked for it. He never gave it back. Very tough lesson learned. Never entrust anyone with your poke codes.
My guess for the original "etch-a-sketch" poke targeting the BIT instruction rather than the optimal jump location is probably implementing a crude way of tracking which publications simply replicated the trick from those that truly rediscovered the trick by proper disassembly like you just did Robin. Loved this video!
It's amazing how much we could accomplish with older computers that were far more limited in resources than what we have now. Yet I still spend roughly half of the time I'm on a computer these days waiting for things to load or source code to compile. I really miss those simpler days of computing.
Very true, when my phone is lagging trying to display a couple of buttons despite having several Ghz of processing power, I wonder where we went wrong when a C64 can do the same at a smooth 50/60 FPS.
Funny little story about that SYS64759 we can see there, too: Shortly after buying our first computer, which was a C64 (my parents and us kids): My dad and I were looking up the different ways you can partially or near-fully reset the computer without flipping the switch all the time, and we saw in the manual that 59 was supposed to be the hard reset, but then it only looks like "restore." So we were like, "Huh... it doesn't fully reset." But the I saw programs that would do the nearly hard reset with -38. And then for 4 decades I hadn't seen 59 pop up again until now. But guess what: I just tried 64760 and that does a better-looking soft reset than 59 does: it retypes the "boot screen"! So it looks kind of like about half of what 38 does (where you know that 38 enlarges the borders and does whatever hard-reset stuff), but 60 is just a flash and done. I wonder why the manual (at least original) never mentioned 38 or 60. Oh, and by the way, did you know that the 128 equivalent of 38 is 65341? That seems to do nothing in 64 mode, but it's fun to play around with increments and decrements from those in both computers/modes too.
Well you sent me down quite the rabbit hole with this comment. The C64 user's manual does indeed claim (on page 18) that SYS64759 is the command to perform a 'hard reset'. I remember trying that as a kid, and finding that it didn't actually work. It seemed to just have the same effect as a Run/Stop-Restore combo -- similar to something that might happen when trying to call bogus machine-language code. At the time I thought that the code was somehow 'broken', and/or the manual was mistaken. Looking into the code today, I think my original suspicion was correct. According to the Kernal ROM disassembly, address 64759 ($FCF7) is actually *in the middle* of an instruction! It's in the middle of a `JSR $FD50` instruction, which calls the RAM test routine. If you try to disassemble the ROM at $FDF7 (thus seeing the code the way the 6502 would try to execute it if you jumped there), you get a couple SBC's, an ISB (an 'undocumented' opcode), and finally a BRK. A BRK instruction invokes the interrupt handler, which, on the C64, ultimately responds to a BRK in the same way as a Run/Stop-Restore combo (which itself invokes an interrupt): It jumps to the BASIC warm-start vector. This is why bad ML code can cause a similar result as a Run/Stop-Restore: It trips over a BRK opcode, which so happens to be represented by the value $00. This is exactly the same reason SYS64795 produces a Run/Stop-Restore-like result: "Bad" ML code. Or rather, perfectly good ML code being misinterpreted as a BRK instruction. SYS64760 on the other hand, jumps to a perfectly valid instruction. In fact, it's right in the middle of the Kernal's reset code. It's the start of a block of instructions which restores the default IO vectors, initializes the VIC, and jumps to the BASIC cold-start vector. It's **the** reset code, but skipping several steps, including clearing the stack, checking for a cartridge, initializing the rest of the hardware, and checking the RAM. I'm probably not the first one to discover this, but it's interesting going back after all this years and actually investigating for myself what was going on "under the hood"
Interesting. I have three manuals, one in English and two in German, and only the English one (probably the earliest of the three) states 64759 as the reset address, which is clearly a mistake. On any 65xx system, a hardware reset makes the CPU look at address 65532 for the reset vector, which on the C64 points to 64738. The number 64738 is very quick and easy to type, two fingers just need to start at 6 and 4 and than move outwards alternately. I always wondered if this address of the reset routine on the C64 was chosen because of that.
I used to set 788-9 to 192,0 (49152 or $C000) and write a little routine to increment a counter which i would check for in my BASIC programs to tell it to go back to the home screen if Restore was pressed, especially useful for programs that i compiled using Laser Compiler. I remember in particular putting JMP $EA31 at the end.
@robumf 16 minutes ago I remember doing that when I was young within the first year of Commodore. Also running memory dump to screen. Using peak and also using peek to poke audio.
Out and Call commands in Amstrad CPC Locomotive BASIC were fun to mess with and I also would collect these. Call &13 twice would send the machine into a spectacular crash made even more spectacular with the speech synthesis module attached. There were loads more that had weird unexpected results but I lost them through the mists of time.
wow. this takes me back! THANK YOU for sharing that kindred nostalgic moment when one would find a special poke or special routine in RUN, ZZAP, AHOY! I would later save it for later use to experiment with. I personally would either write them down or clip them out of the very magazine & tape them into a notebook saved specifically for my c64 clippings :) These moments back in the day felt magical :) Thanks always for sharing your memories Robin! LOVE your videos
Hey Robin. Great Video. Thanks :) Try to explain POKE56335,4 now. The cursor is almost unstoppable running and the color only can changed during the run to white and black with STRG or CMD 1 & 2. Even RUN/STOP & RESTORE will not work.
I find it fascinating that this doesn't crash anything. At first I thought it was an easter egg from the original developers until you revealed that it was the interrupt vector being manipulated.
I used to disable the ability to stop my programs so that my buddies couldn't steal my code. I wrote an Administrator's help program for the role-playing game Top Secret and a couple of my buddies wanted to know how I accomplished some of the things I did. So I would get it running for the Admin and then no one could interrupt it.
@@magnustveten492tbh without these Commodore machines my life would have been totally different. Most likely in a bad way. It set me up for half of my life.
22:20 A piece of trivia: World Cup Carnival was a rebadged version of an earlier (budget?) football game sold at full price as a licenced World Cup tie-in by US Gold. Apparently the developers contracted by US Gold (they didn't have in house developers making their output erratic quality-wise) for making World Cup Carnival failed to come up with the goods, so they bought the rights to this older and sub-par game. I just can't remember the name of the original game.
POKE 788,78 also works. It jumps in the middle of STA $CE instruction, so $CE, JSR $EA24 gets interpreted as DEC $2420, NOP, (DEC $2420 is harmless unless you have some program in the memory). POKE 788,80 also seems to work. Not sure what this JSR $EA24 does, but it doesn't break the trick for me, it may have some unknown side effect though.
4:26 A long time ago (1989 ?) I was on a technical/electronic course and they had a Commodore PET. We had some downtime so I kept poking looking for the video memory address. I found it! and made a game where you drive up the screen and use the cursor buttons to steer, and the road gets thinner as time progresses. My first foray into game design with limited memory.
Similar, though Light Cycles and Snake both keep moving once put into motion. And of course have collision detection etc. But they are born out of the same concept.
I used to poke inc 51820 jmp irq somewhere low and then poke only the high byte of the IRQ vector. You have to take care that the inc /jmp starts at the right place, because you can not disable interrupts.
0:09 SYS 64738 is a great metaphor - someone should write a song about it! 11:11 Another bug is that the interrupt routine doesn't execute a CLD instruction, so the SBC instructions in the time comparison will erroneously operate in BCD mode if a user routine that uses Decimal mode is interrupted. 16:29 Address $EA51 would also be an innocuous NOP.
It seems that it uses whatever character you were on when you hit return on the poke immediate command. If you do POKE 788,82:A and have the cursor on the A it now draws reverse A's!
You know a video like this explaining how the super snap shot draws that windowed menu screen with how it seems to animate into view would be very cool. Not sure why that caught my attention but never seen something work like that on a c64.
I would've thought any of us who did assembly programming back in those days would get curious about interpreting multi-byte instructions starting at points other than the beginning. I sure did. Maybe because I never had an assembler and did all my machine code programming by poking instructions into RAM a byte at a time. Or maybe because I used to enjoy writing disassemblers in BASIC.
Yes, POKE 56325,25 (or an even lower value) will make the system interrupt occur more frequently, and therefore speed up cursor movements. It seems to work fine together with POKE 788,82.
alternative explanation: maybe they figured out 82 logically by looking at the disassembly, and then afterwards discovered that 80 also worked while experimenting with it. If so i'm guessing they chose to share that version because, functionally it's pointless but jumping to the middle of an instruction to change its meaning is a way cooler hack. or maybe they came at it from the other side, they were just exploring the general technique of finding instructions with second meanings when read misaligned, and in the process of searching for interesting misaligned jump targets in the kernel discovered this.
If so, then I would have expected those magazine letters I showed to have said POKE 788,82 instead of POKE 788,80. As I showed in the video, the 80 isn't properly instruction-aligned while 82 is.
Disassembling ROM code was a lot harder back then. The C64 has "become everything it was not" in the last decade and a half. Once it stopped being "outdated junk" and became "fond memories" a lot has happened.
@@andersjjensen I never considered it outdated or just for memories, but a welll thought-out machine that is interesting to use and program in any time.
I had no idea of this poke. I thought I knew them all by heart! My first try in VICE C64SC gave me an inverted P. The second time I reproduced what you did. I wonder what that was about... Hold up, 788 is $314, which is the IRQ vector. This usually holds $31 from $ea31. So changing it to 82 means we IRQ to $ea52 instead of $ea31. So we skip 31 bytes from the beginning of the IRQ code.
HI ROBIN PLEASE DO A VIDEO ON WHAT MACHINE CODE INSTRUCTIONS DO TO THE HARDWARE OF THE COMPUTER AND HOW THE COMPUTER PROCESSES THOSE INSTRUCTIONS ! ! !
A friend in high school studied sin waves so he could create a program to translate musical notes into poke commands in order to simulate real instruments.
Maybe I've missed it, but I'm wondering if you've ever compared and contrasted the original C64 with TheC64 "maxi". Are there functional differences? If I missed it, I'd appreciate being led in the direction to it.
I made a few videos about TheC64, starting with one titled 'Exploring TheC64 "Maxi" Full-Size Commodore 64 Replica'. I'd link to it but UA-cam usually censors anything with a link. I have a playlist with the other TheC64 videos, you should be able to find it by searching my channel page.
Why not just enjoy the _8-bit renaissance_ that is currently going on: Commander X16, Agon Light, Cerberus 2100, Spectrum Next, Foenix F256, MiSTer, MSXVR, Neo6502, RC2014, and many others...
@@NuntiusLegis Sure, I also still use my 1978 Sharp MZ-80K and my 1979 HP-85. Emulators and replicas of old machines are cool indeed, but I was specifically replying that there is no shortage of exciting new 8-bit machines. On top of that, FPGA machines like MiSTer, Spectrum Next and Mega 65 add a complete new class of hardware. My point being: it is a great time for retro-computing right now.
@@NuntiusLegis I consider that to be a good thing. The industry at the time gathered around x86 and Microsoft, which made sense from an business point of view; but for the hobbyists that made the landscape a lot poorer. I prefer a diverse ecosystem where each machine has its own personality and quirks, and it is in that spirit that I replied to the comment by @andrewhillis9544 who misses Sinclair/Commodore/Acorn.
10:00 when we say "update the system clock" l trust we mean TI and TI$. I assume the CIA timers keep on counting regardless of what we do to the 788 vector. I also assume we could use the 24bit jiffy space in 0 page for whatever (assuming we avoid UDTIM) and instead measure elapsed time by directly reading the CIA registers? Valid or am l totally offbase?
Yes, TI and TI$. The CIA timers are in an endless loop, counting down cycles from approximately 1,000,000 divided by 60 to zero over and over automatically, and firing the system IRQ each time zero is reached. The jiffy counter addresses would be free for re-use if they're not being updated by the system interrupt anymore, but of course TI and TI$ would return useless values. But no, besides the endless descending loop of ~16,666 to zero there's no elapsed time by default to read from the CIA. You could setup the TOD clock on either CIA as a decent substitute with some extra code.
@@8_Bit 16,666? Isn't that like 4.6 minutes? I thought these were 24 hour clocks? And counting down? Does that mean the TI/TI$ is derived by the OS doing some kind of subtraction from some other (mystery) value to arrive at TI/TI$ aka elapsed time?
@@saganandroid4175 The CIA is set to fire an IRQ every ~16,666 machine cycles. In that IRQ handler, the 24-bit jiffy counter is incremented. This is the value displayed when printing TI. When printing TI$ then some math is used to convert that to a 24 hour HHMMSS string.
Whenever I see a commodore64 video, I'm mesmerised that you can just cursor to some line, change something and run that line just again by hitting return.
It does seem to be a near ideal system for this sort of exploratory/explanatory hacking presentation. I've got an Apple IIc video coming out tomorrow where I try to do this same sort of thing and the Applesoft editor doesn't lend itself nearly as well, unfortunately.
Easter egg poke. I wish I had all thoses documentation back in 80'. All I had is rudimentary basic commands. No poke there, no assembly or low level programming.
POKE 56576,199 disabled the system reset through run/stop and restore. So combining this with POKE 788, 52 lets you run a basic program without being able to stop it...
there was this one poke that put the whole memory mapped on screen, every memory location was viewed as one bit. Sadly, i don't have a machine right now, and i can't remember what the poke was. Does anyone know?
Seems like there's a better poke. If this is changing the IRQ vector, couldn't you just change the ISR to jump over the code which does the reset and therefore keep things like the clock working?
I haven't tried it yet. It looks nice but I'd be a lot more interested in it if it had the PETSCII characters and other special C64 keys on it and they mapped nicely to a C64 emulator.
I wonder if it works with all ROM versions. It's not safe to jump to undocumented ROM address, there may be different code there. Or maybe even this is an explanation why the original POKE was slightly different.
It is interesting and funny, but not really useful. It is basically character graphics with only one character, not making use of the magnificent CBM graphical characters (PETSCII).
John Palmer worked for Ocean Software in Manchester in the late 80’s. I worked with him at Kuju Sheffield, lovely bloke.
You're certain this is the same John Palmer? Pretty neat!
@@8_Bit Yep it is. He and his brother Richard lived in Braunton Devon and submitted quite a few type ins to magazines. Then they both moved up to Manchester to work at Ocean.
Robin, how ACCURATE is the Jiffy clock? Miss day and age internal clocks are usually controlled by a quartz crystal but I don't recall that there is one in the Commodore
@@weedmanwestvancouverbc9266 If I see it correctly, the jiffy clock is generated by one of the timers in one of the CIA chips which is driven by the system frequency which is generated with a quartz. It is not very accurate though, I think I read because the quartz is not stabilized.
Each of the two CIA chips also has a more accurate time-of-day clock driven by the powere line frequency.
@@weedmanwestvancouverbc9266 It's as accurate as the 1.000213 MHz clock crystal used to generate the CPU clock, plus or minus a couple nanoseconds for the clock phase difference between the CPU and CIA. Important to note that the crystal isn't oven-controlled or anything, so it's gonna drift with temperature but it's about as rock-solid as you can get, really
Very neat. I've never seen this. Although you can accomplish more or less the same thing by turning reverse on and using space to plot what you want. Although one advantage this might have is that I bet you can color in the bottom right character without causing the screen to scroll. I bet this could work on the VIC-20 too.
Yes, this will allow the bottom right corner to be plotted without scroll, and it's also much easier to make lines going up or down than using RVS mode.
You can also switch on a computer using a paperclip but that doesn't mean it's the best way to do it.
@@Okurka. Hey now, be nice.
@@vhfgamer That was me being nice.
@@8_Bit Related to "not scrolling the screen if you write to the last screen cell": What happens if you are in Program mode rather than Immediate mode -- can embedded cursor control keycode (up/down left/right) be used to paint the screen from within a program? Wondering if this can be used to defeat that godawful problem where printing to the rightmost column caused the computer to frig up the logical/physical line linkage. Makes sense in immediate mode, but is a total bug to leave that active in Program mode. How did they not catch that? surely the same issue was present in earlier C= machines? Whoever finds the right poke to disable that in Run mode gets a Nobel Prize.
Robin.. Thank you so much!!! As a very young kid in the later 80's and early 90's and also not native English I started programming with basic and I kind of missed out on the whole assembly programming. It has been fascinating me the last years and I even bought original hardware again. And just thinking back a year ago vs now... I am actually able to fully grasp all of it. You have been a big influence for me with your excellent explanations and enthusiasm so that I now have understanding and dabble on my own with assembly on a real machine. Kind of like re-living childhood in a what-if I had someone like a dad or older brother that could take me along.
Thanks, it's great to hear that you're having fun with it! There's still so much to explore on these systems we grew up with.
Robin really is like the Carl Sagan / James Burke / David Suzuki / Tim Hunkin of Commodore Programming. The spirit of Butterfield flows within him.
Back in the day, I would have loved this. Can you send this to me back in the early 1980s?
This is great! I wish I'd known about this back in the '80s.
Four numbers that will always be embedded in my memory are 53280, 53281, 49152, and 64738.
Great video!
As someone else already commented, I couldn't help thinking of the pipes screensaver when seeing you etch-a-sketching the screen :)
I suppose that technically, POKE 788,84 could have the unintended consequence of changing the cursor colour to something unexpected, since you effectively just store whatever is in the accumulator at $0247 without loading the "correct value" to it first.
The great thing about random pokes is you don't always see the side-effects, and those are the best kind of bugs to figure out ;)
I can't wait to buy my own C64. I "inhereted" my uncle's, but my father threw it away not realising it's actual value. He just thought it was a gaming console. My life was dramatically changed by that shitty decision. Finding a C64 and watching this content is like taking back my life.
You make it sound like you m*rdered your father and just got out of jail.
Good luck. I owned one myself, so I'm plenty good with an emulator (WinVICE) for fooling around. Those poke works as intended on WinVICE's accurate C64 emulator (it has both an "accurate" and a "fast" emulator).
Look up the c64 mini or maxi. Pretty sure they kept it true to function for these things. What's more, has USB ports, can connect to modern displays directly and other handy upgrades. The mini does not have a functional keyboard, it's more or less a game console, but you can attach an external keyboard to it. I'm waiting for them to release the Amiga maxi, then I'll pick up one of both.
@@zarroth TheC64 Mini/Maxi run Vice 2.4; the latest Vice version is 3.8.
This does not sound good, please seek help for mental health problems.
I had once considered "JMP EA31" for a custom license plate (but I settled on "2 1337" instead)
SYS64738
2 1337 4U
N00B was already taken.
What do skeletal injuries have to do with this?
My good friends and I celebrate our leetness every day at 1:37 pm, The time display on my watch is in 24-hour mode.
$0314 just reminded me of what a nerd I was as a kid.
I had a Commodore 64 growing up. I also had a Casio databank watch. The one you could save phone numbers into. It also had a 'secret' databank that you could unlock with a numeric password.
I set the password to 0314, due to its significance in the C64.
I HONESTLY HAVEN'T GOT A CLUE WHAT YOU ARE TALKING ABOUT HERE 8-BIT BUT I ENJOYED THIS VIDEO ANYWAY & IT APPEALED TO MY GEEKINESS/NERDINESS ! ! !
I had a magazine with a list of pokes. Brought it to school to study them in my free time. Handed it over to a kid who asked for it. He never gave it back. Very tough lesson learned. Never entrust anyone with your poke codes.
My guess for the original "etch-a-sketch" poke targeting the BIT instruction rather than the optimal jump location is probably implementing a crude way of tracking which publications simply replicated the trick from those that truly rediscovered the trick by proper disassembly like you just did Robin. Loved this video!
It's amazing how much we could accomplish with older computers that were far more limited in resources than what we have now. Yet I still spend roughly half of the time I'm on a computer these days waiting for things to load or source code to compile. I really miss those simpler days of computing.
Very true, when my phone is lagging trying to display a couple of buttons despite having several Ghz of processing power, I wonder where we went wrong when a C64 can do the same at a smooth 50/60 FPS.
Funny little story about that SYS64759 we can see there, too: Shortly after buying our first computer, which was a C64 (my parents and us kids): My dad and I were looking up the different ways you can partially or near-fully reset the computer without flipping the switch all the time, and we saw in the manual that 59 was supposed to be the hard reset, but then it only looks like "restore." So we were like, "Huh... it doesn't fully reset." But the I saw programs that would do the nearly hard reset with -38. And then for 4 decades I hadn't seen 59 pop up again until now. But guess what: I just tried 64760 and that does a better-looking soft reset than 59 does: it retypes the "boot screen"! So it looks kind of like about half of what 38 does (where you know that 38 enlarges the borders and does whatever hard-reset stuff), but 60 is just a flash and done. I wonder why the manual (at least original) never mentioned 38 or 60. Oh, and by the way, did you know that the 128 equivalent of 38 is 65341? That seems to do nothing in 64 mode, but it's fun to play around with increments and decrements from those in both computers/modes too.
Well you sent me down quite the rabbit hole with this comment.
The C64 user's manual does indeed claim (on page 18) that SYS64759 is the command to perform a 'hard reset'. I remember trying that as a kid, and finding that it didn't actually work. It seemed to just have the same effect as a Run/Stop-Restore combo -- similar to something that might happen when trying to call bogus machine-language code. At the time I thought that the code was somehow 'broken', and/or the manual was mistaken. Looking into the code today, I think my original suspicion was correct.
According to the Kernal ROM disassembly, address 64759 ($FCF7) is actually *in the middle* of an instruction! It's in the middle of a `JSR $FD50` instruction, which calls the RAM test routine. If you try to disassemble the ROM at $FDF7 (thus seeing the code the way the 6502 would try to execute it if you jumped there), you get a couple SBC's, an ISB (an 'undocumented' opcode), and finally a BRK.
A BRK instruction invokes the interrupt handler, which, on the C64, ultimately responds to a BRK in the same way as a Run/Stop-Restore combo (which itself invokes an interrupt): It jumps to the BASIC warm-start vector. This is why bad ML code can cause a similar result as a Run/Stop-Restore: It trips over a BRK opcode, which so happens to be represented by the value $00.
This is exactly the same reason SYS64795 produces a Run/Stop-Restore-like result: "Bad" ML code. Or rather, perfectly good ML code being misinterpreted as a BRK instruction.
SYS64760 on the other hand, jumps to a perfectly valid instruction. In fact, it's right in the middle of the Kernal's reset code. It's the start of a block of instructions which restores the default IO vectors, initializes the VIC,
and jumps to the BASIC cold-start vector. It's **the** reset code, but skipping several steps, including clearing the stack, checking for a cartridge, initializing the rest of the hardware, and checking the RAM.
I'm probably not the first one to discover this, but it's interesting going back after all this years and actually investigating for myself what was going on "under the hood"
Interesting. I have three manuals, one in English and two in German, and only the English one (probably the earliest of the three) states 64759 as the reset address, which is clearly a mistake. On any 65xx system, a hardware reset makes the CPU look at address 65532 for the reset vector, which on the C64 points to 64738.
The number 64738 is very quick and easy to type, two fingers just need to start at 6 and 4 and than move outwards alternately. I always wondered if this address of the reset routine on the C64 was chosen because of that.
I used to set 788-9 to 192,0 (49152 or $C000) and write a little routine to increment a counter which i would check for in my BASIC programs to tell it to go back to the home screen if Restore was pressed, especially useful for programs that i compiled using Laser Compiler. I remember in particular putting JMP $EA31 at the end.
@robumf
16 minutes ago
I remember doing that when I was young within the first year of Commodore.
Also running memory dump to screen. Using peak and also using peek to poke audio.
Man I would have really impressed my aunt and uncle if I knew this back when we had a C64! 😄
Out and Call commands in Amstrad CPC Locomotive BASIC were fun to mess with and I also would collect these. Call &13 twice would send the machine into a spectacular crash made even more spectacular with the speech synthesis module attached. There were loads more that had weird unexpected results but I lost them through the mists of time.
wow. this takes me back!
THANK YOU for sharing that kindred nostalgic moment when one would find a special poke or special routine in RUN, ZZAP, AHOY!
I would later save it for later use to experiment with.
I personally would either write them down or clip them out of the very magazine & tape them into a notebook saved specifically for my c64 clippings :)
These moments back in the day felt magical :)
Thanks always for sharing your memories Robin! LOVE your videos
I just love the depth of your videos! ♥
Hey Robin. Great Video. Thanks :) Try to explain POKE56335,4 now. The cursor is almost unstoppable running and the color only can changed during the run to white and black with STRG or CMD 1 & 2. Even RUN/STOP & RESTORE will not work.
I find it fascinating that this doesn't crash anything. At first I thought it was an easter egg from the original developers until you revealed that it was the interrupt vector being manipulated.
I used to disable the ability to stop my programs so that my buddies couldn't steal my code. I wrote an Administrator's help program for the role-playing game Top Secret and a couple of my buddies wanted to know how I accomplished some of the things I did. So I would get it running for the Admin and then no one could interrupt it.
Looking at a commodore poke command on a weekday summer afternoon feels like the summer 40 years ago that never ended.
Summer?
@@Okurka. Yes, it is summer in the Northern hemisphere. Unless you live in Svalbard. Then it's just he half of the winter where it doesn't get dark.
@@andersjjensen Summer starts tomorrow.
@@Okurka. According to your particular local calendar rules, perhaps. Where I live the 23rd is "midsummer night".
So.... people were collecting POKEmons before it was cool?
Gotta catch 'em all.
No that’s when it WAS cool :)
@@magnustveten492tbh without these Commodore machines my life would have been totally different. Most likely in a bad way. It set me up for half of my life.
I wonder if someone who wrote the interrupt routine wrote it specifically so that would be possible. Maybe a gift for his kid to play with?
I am so old I remember this. What an amazing world we live in.
APOLOGIES FOR MY CAPITAL LETTERS BUT I AM VISUALLY SIGHT IMPAIRED AND I AM NOT SHOUTING AT ANYONE ! ! !
As a kid playing around we found POKE 56565 set the cursor blink speed. Problem was if you did 0 it was so quick that typing to change again was hard!
Thanks for sharing this esoteric knowledge 👍🏻👍🏻
22:20 A piece of trivia: World Cup Carnival was a rebadged version of an earlier (budget?) football game sold at full price as a licenced World Cup tie-in by US Gold. Apparently the developers contracted by US Gold (they didn't have in house developers making their output erratic quality-wise) for making World Cup Carnival failed to come up with the goods, so they bought the rights to this older and sub-par game. I just can't remember the name of the original game.
It was Artic's "World Cup Football" :)
@@TheMalMeninga Thanks. Seriously, they changed one word, which makes it even stupider.
And if you POKE 788,81, the interrupt jumps to EA which is NOP, so it also works 😅
Came here just to post this. Immediately recognized EA as a NOP.
POKE 788,78 also works. It jumps in the middle of STA $CE instruction, so $CE, JSR $EA24 gets interpreted as DEC $2420, NOP, (DEC $2420 is harmless unless you have some program in the memory).
POKE 788,80 also seems to work. Not sure what this JSR $EA24 does, but it doesn't break the trick for me, it may have some unknown side effect though.
4:26 A long time ago (1989 ?) I was on a technical/electronic course and they had a Commodore PET. We had some downtime so I kept poking looking for the video memory address. I found it! and made a game where you drive up the screen and use the cursor buttons to steer, and the road gets thinner as time progresses. My first foray into game design with limited memory.
Oh my HECK! This is so COOL! HOW come I never knew this for FOUR DECADES?!
"...has converted the Commodore 64 into an Etch-A-Sketch."
My (overactive?) imagination: "...into a Tron Light Cycle!" 1:38
Similar, though Light Cycles and Snake both keep moving once put into motion. And of course have collision detection etc. But they are born out of the same concept.
I used to poke inc 51820 jmp irq somewhere low and then poke only the high byte of the IRQ vector. You have to take care that the inc /jmp starts at the right place, because you can not disable interrupts.
0:09 SYS 64738 is a great metaphor - someone should write a song about it!
11:11 Another bug is that the interrupt routine doesn't execute a CLD instruction, so the SBC instructions in the time comparison will erroneously operate in BCD mode if a user routine that uses Decimal mode is interrupted.
16:29 Address $EA51 would also be an innocuous NOP.
There is actually a C64 tune called SYS 64738
ua-cam.com/video/Slf7YjsXidM/v-deo.htmlsi=YrbtzheWTqCJKESm
I think it's cool how many people are connected to you now sir!
The most concise implementation of Paint of all time.
It seems that it uses whatever character you were on when you hit return on the poke immediate command. If you do POKE 788,82:A and have the cursor on the A it now draws reverse A's!
You know a video like this explaining how the super snap shot draws that windowed menu screen with how it seems to animate into view would be very cool. Not sure why that caught my attention but never seen something work like that on a c64.
It's TRON! Wet Paint! Every collision game ever!
Windows screensaver pipes C64 Edition at the beginning of the video. 😁
🤓ua-cam.com/video/RsF6zcn8Rqs/v-deo.html
One poke over the line, sweet Jesus, one poke over the line.
One poke man!!! ONE POKE OVER THE LIYEEEEIIIIIIINE *furiously licks c64 case*
@@stevebell4853 jesus!
THANKS 8-BIT FOR ANOTHER GREAT VIDEO ! ! !
I would've thought any of us who did assembly programming back in those days would get curious about interpreting multi-byte instructions starting at points other than the beginning. I sure did. Maybe because I never had an assembler and did all my machine code programming by poking instructions into RAM a byte at a time. Or maybe because I used to enjoy writing disassemblers in BASIC.
Very cool!
Ah you forgot to tell us how to save our etch a sketch with that Poke 788,82 trick. I guess a little program to write the screen memory to a file.
Plus the color RAM. :-)
A turn of events: Github is for fossils, and home-alone 8-bit computing is seeing quite the renaissance. 🎾
Wasn't there a poke to make the key repeats lightning fast? Could it be combined with this one to make the drawing faster?
Yes, POKE 56325,25 (or an even lower value) will make the system interrupt occur more frequently, and therefore speed up cursor movements. It seems to work fine together with POKE 788,82.
alternative explanation: maybe they figured out 82 logically by looking at the disassembly, and then afterwards discovered that 80 also worked while experimenting with it. If so i'm guessing they chose to share that version because, functionally it's pointless but jumping to the middle of an instruction to change its meaning is a way cooler hack. or maybe they came at it from the other side, they were just exploring the general technique of finding instructions with second meanings when read misaligned, and in the process of searching for interesting misaligned jump targets in the kernel discovered this.
had a ZX Spectrum. POKE 23609, 0-255 would change the keyboard click (value 1) to silent (value 0) up to a 1 second beep (255). 30 was a good length
That is literally the best poke ever Robin!
Maybe someone "discovered" it in the same way you demonstrated how it works - via analysis of a disassembly of the kernel.
If so, then I would have expected those magazine letters I showed to have said POKE 788,82 instead of POKE 788,80. As I showed in the video, the 80 isn't properly instruction-aligned while 82 is.
Disassembling ROM code was a lot harder back then. The C64 has "become everything it was not" in the last decade and a half. Once it stopped being "outdated junk" and became "fond memories" a lot has happened.
@@8_Bit Misremembered theft of 788,82 claim which came from somewhere? The odds of accidental discovery are nil. Commodore insider leak?
@@andersjjensen I never considered it outdated or just for memories, but a welll thought-out machine that is interesting to use and program in any time.
I had no idea of this poke. I thought I knew them all by heart! My first try in VICE C64SC gave me an inverted P. The second time I reproduced what you did. I wonder what that was about...
Hold up, 788 is $314, which is the IRQ vector. This usually holds $31 from $ea31. So changing it to 82 means we IRQ to $ea52 instead of $ea31. So we skip 31 bytes from the beginning of the IRQ code.
Great Video! Thank you Robin!
I like your "Telidon" button. Always wanted to play with Telidon but it was DOA.
HI ROBIN PLEASE DO A VIDEO ON WHAT MACHINE CODE INSTRUCTIONS DO TO THE HARDWARE OF THE COMPUTER AND HOW THE COMPUTER PROCESSES THOSE INSTRUCTIONS ! ! !
Hmm, what's that poke for each of the Commodore PET ROMs?
A friend in high school studied sin waves so he could create a program to translate musical notes into poke commands in order to simulate real instruments.
With an 8 bit computer he could basically have hand drawn sine waves on checkered paper and still be more accurate than the computer.
@@andersjjensen No. And the comment is not about drawing sine waves.
Maybe I've missed it, but I'm wondering if you've ever compared and contrasted the original C64 with TheC64 "maxi". Are there functional differences?
If I missed it, I'd appreciate being led in the direction to it.
I made a few videos about TheC64, starting with one titled 'Exploring TheC64 "Maxi" Full-Size Commodore 64 Replica'. I'd link to it but UA-cam usually censors anything with a link. I have a playlist with the other TheC64 videos, you should be able to find it by searching my channel page.
Other kids used to poke fun at me for collecting these.
Womp womp.
THIS LOOKS FUN ! ! !
makes me wish I still had my C64 - lovely video
Just buy one. :-)
HELP I was searching for an 8 bit version of the Melanie song "Show and Tell" and found this channel 😭
I WISH COMMODORE, SINCLAIR RESEARCH & ACORN COMPUTERS WERE STILL AROUND & I MISS THOSE DAYS ! ! ! 😭😭😭😭😭😭😭
Why not just enjoy the _8-bit renaissance_ that is currently going on: Commander X16, Agon Light, Cerberus 2100, Spectrum Next, Foenix F256, MiSTer, MSXVR, Neo6502, RC2014, and many others...
@@koenlefever I just enjoy the C64 which is immortal (original hardware still works, emulators, replicas).
@@NuntiusLegis Sure, I also still use my 1978 Sharp MZ-80K and my 1979 HP-85. Emulators and replicas of old machines are cool indeed, but I was specifically replying that there is no shortage of exciting new 8-bit machines.
On top of that, FPGA machines like MiSTer, Spectrum Next and Mega 65 add a complete new class of hardware.
My point being: it is a great time for retro-computing right now.
@@koenlefever Scatters the community quite a bit though.
@@NuntiusLegis I consider that to be a good thing. The industry at the time gathered around x86 and Microsoft, which made sense from an business point of view; but for the hobbyists that made the landscape a lot poorer. I prefer a diverse ecosystem where each machine has its own personality and quirks, and it is in that spirit that I replied to the comment by @andrewhillis9544 who misses Sinclair/Commodore/Acorn.
10:00 when we say "update the system clock" l trust we mean TI and TI$. I assume the CIA timers keep on counting regardless of what we do to the 788 vector. I also assume we could use the 24bit jiffy space in 0 page for whatever (assuming we avoid UDTIM) and instead measure elapsed time by directly reading the CIA registers? Valid or am l totally offbase?
Yes, TI and TI$. The CIA timers are in an endless loop, counting down cycles from approximately 1,000,000 divided by 60 to zero over and over automatically, and firing the system IRQ each time zero is reached. The jiffy counter addresses would be free for re-use if they're not being updated by the system interrupt anymore, but of course TI and TI$ would return useless values. But no, besides the endless descending loop of ~16,666 to zero there's no elapsed time by default to read from the CIA. You could setup the TOD clock on either CIA as a decent substitute with some extra code.
@@8_Bit 16,666? Isn't that like 4.6 minutes? I thought these were 24 hour clocks? And counting down? Does that mean the TI/TI$ is derived by the OS doing some kind of subtraction from some other (mystery) value to arrive at TI/TI$ aka elapsed time?
@@saganandroid4175 The CIA is set to fire an IRQ every ~16,666 machine cycles. In that IRQ handler, the 24-bit jiffy counter is incremented. This is the value displayed when printing TI. When printing TI$ then some math is used to convert that to a 24 hour HHMMSS string.
Really amazing poke!
Yeah! Collecting pokes. Not to be confused with collecting pokemons.
Yeah we poked quite a bit back in the day
this video just shows you'd be great at poker
Thanks, interesting... Could you use that poke to make an snake game?
And the default poke for 788 is 49, so use that if you want to restore programatically.
PRINT PEEK(788)
That is how you arrive at the default (or current) value (for anyone reading along wondering how).
@@andersjjensen: I already knew that; that's how I found the default, of course.
Whenever I see a commodore64 video, I'm mesmerised that you can just cursor to some line, change something and run that line just again by hitting return.
It does seem to be a near ideal system for this sort of exploratory/explanatory hacking presentation. I've got an Apple IIc video coming out tomorrow where I try to do this same sort of thing and the Applesoft editor doesn't lend itself nearly as well, unfortunately.
POKE 53280 AND 53281.
I will never forget these numbers 😂
Never heard about this one, that's amazing.
Cool poke! Is there an equivalent for the Vic 20?
Heh, I made a etch-a-sketch program myself a long time ago.
I miss these simpler times of early computing.
Right, machine code was much simpler than the high-level programming language they now use. /s
Easter egg poke. I wish I had all thoses documentation back in 80'. All I had is rudimentary basic commands. No poke there, no assembly or low level programming.
POKE 56576,199 disabled the system reset through run/stop and restore. So combining this with POKE 788, 52 lets you run a basic program without being able to stop it...
there was this one poke that put the whole memory mapped on screen, every memory location was viewed as one bit. Sadly, i don't have a machine right now, and i can't remember what the poke was. Does anyone know?
Seems like there's a better poke. If this is changing the IRQ vector, couldn't you just change the ISR to jump over the code which does the reset and therefore keep things like the clock working?
What's the song? who wrote it? Lyrics? LOVE IT!💛
Have you reviewed the 8BitDo Retro Mechanical Keyboard - C64 Edition? I think they should send you one speculatively if they have any sense.
Hey thanks for pointing to this product! I think it is awesome
Very cool! 😊
I haven't tried it yet. It looks nice but I'd be a lot more interested in it if it had the PETSCII characters and other special C64 keys on it and they mapped nicely to a C64 emulator.
@@8_Bit Doh, of course. I didn't even check that 🤦.
It doesn't even have the C64 layout.
Dang if I did know that in the days we did go to shops and used computers there....😂
Looks like the pipes screensaver for Windows ;)
8 bit pipe screensaver in 1982!?
Heh, these 788 things don't work in 128 mode. I figured they wouldn't but I always like to check 128 on these 64 things.
@8_Bit are all Kernal revisions exactly the same for $EA31? Maybe that could explain the slightly different address?
As far as I know all revisions are the same for this area from $EA31 to $EA60 or so.
I like the song!!!
I was Compute! Gazette fan and I never came across this Poke.
I wonder if it works with all ROM versions. It's not safe to jump to undocumented ROM address, there may be different code there. Or maybe even this is an explanation why the original POKE was slightly different.
Kandinsky 2024? (Or perhaps Kandinsky 1985)
yeh the easter egg on older commodores "wait6502,1" dont think it runs on C64 but PETs ect ok with it its the Bill Gates easter egg
Yeah, that WAIT Microsoft easter egg was only in certain PETs. Once Commodore noticed it, they disabled it in later PET ROM revisions.
♫ I heard there was a secret poke... ♫
I WAS ALWAYS GETTING TOLD OFF BY MY MATHS & COMPUTER TEACHER FOR CRASHING THE SCHOOLS TRS-80 MODEL 2 COMPUTERS WITH POKE 16389,255 ! ! !🤔🤔🤔
Amazing!
'POKE' & 'PEEK' COULD BE VIDEOGAME OR CARTOON CHARACTERS ? ? ?🤔🤔🤔
It would be interesting to know of any software that found a use for this 80-84, etc.
It is interesting and funny, but not really useful. It is basically character graphics with only one character, not making use of the magnificent CBM graphical characters (PETSCII).
Commodore 64... The SECOND computer I ever owned.
Same here. I had a Timex Sinclair 1000 (like a ZX81) first.