Commodore 64 Part 1: How The Memory Map Worked

2016 ж. 9 Мау.
57 807 Рет қаралды

I introduce the C64 memory map by way of tracing the circuits used to activate the VIC-II for reads and writes. Notes on circuit schematics follow.
C64 Schematic I used: www.commodore.ca/manuals/funet...
decoder datasheet pdf.datasheetcatalog.com/datas...

Пікірлер
  • What an amazing explanation of the digital logic used to make things happen on the C64. It really is a lesson that can be used for integrated circuits as a whole (in my opinion). Computers understand two things; voltage and the lack of voltage. Yes, analog exists, but not for the sake of processing without software to make decisions based on such things. I really enjoyed this. Thanks for the killer content.

    @rickwitt5735@rickwitt57354 жыл бұрын
  • Loved seeing you trace through the schematics of the C64. Fascinating!

    @davidlineberger644@davidlineberger6445 жыл бұрын
  • Still hoping for a fourth episode. But I really need to let you know, that this video of 18 minutes has given me more insight than 40 books and it's true. Please make more videos because what this 18 minutes has given me capabilities to do is amazing and others experience the same.

    @Infinitesap@Infinitesap3 жыл бұрын
  • Lovely clear video - many thanks. Seeing how a poke command becomes binary and where it REALLY pokes the chip is an insight that helps truly understand how/why commands work. I plan to learn machine code and assembly language and will check out all your guides - thanks a mill, great work!

    @cumbrianrambler7715@cumbrianrambler77157 жыл бұрын
  • The schematic and all of the documentation was available back then too. The Programmer's Guide contained an exhaustive description of the chip registers and KERNAL functions. The Internet had nothing to do with it becoming available.

    @diggydude5229@diggydude52294 жыл бұрын
  • You just filled in a huge info gap for me! Thanks. More like this please 😀

    @w4twa@w4twa3 жыл бұрын
  • Great video indeed! A very deep journey inside C64 memory map.

    @mark12358@mark123585 жыл бұрын
  • That was a brilliant explanation and I loved how you traced the programming instructions through the hardware schematics of the C64 to show what is going on in the machine and I wish I had known what you have just shown me here back in the late 1970's and into the 1980's when I started programming in Commodore BASIC and 6502/6510 Assembly Language and I soon realized back then that I was much better at debugging programs than coding from scratch although my programming skills got better with more experience ! ! ! 👍👍👍👍👍👍👍

    @andrewhillis9544@andrewhillis95442 жыл бұрын
  • Man this was great. I've been scratching my head over how memory mapping was actually implemented. I've seen other vids on the subject but never had that 'aha' moment.

    @adammontgomery7980@adammontgomery79806 жыл бұрын
  • In 1990 we built a Eprom burner out of a Vic-20 to burn the chips from nintendo nes carts to blank chips.. Love all things commodore

    @RyN834@RyN8347 жыл бұрын
  • oof, this is the first watch i've given it so far, and i feel like i am going to need many more to understand it, but i thoroughly enjoy this approach. thank you ever so much for this awesome tutorial!

    @srenhaandbk7904@srenhaandbk79044 жыл бұрын
  • Jack really said that to Bill? He’s my hero!

    @anthonyjagers7770@anthonyjagers7770 Жыл бұрын
  • This is a really good explanation. I repair arcade game hardware which works almost identically. Modern systems aren't too different you just write to abstracted hardware through libraries but under the hood an enable line is set and data passes along a bus.

    @jamesrbrindle@jamesrbrindle6 жыл бұрын
    • Ya I would liken it to sending mail on a postage bus. The old time computers you just said, "here!" IBM followed the DEC model more, with interrupts handling everything on the bus.

      @peterlamont647@peterlamont6476 жыл бұрын
  • I bought one in 1982 (and I had to charge it to do it as 595$ was alot for me back then). I loved it then and wrote many programs with it but I moved on from it to bigger and better but I never really enjoyed what came later as much. Now I'm back using a c64 maxi and I love it. I can write my silly programs and have some fun and I get to get on youtube and look for interesting info from the past. Loved this video. I don't know if you made more of these about the c64 but if you did I will be watching them.

    @mikeyoung9810@mikeyoung98104 жыл бұрын
  • Fantastically clear explanation of how memory-mapped peripherals work! Awesome!

    @MattGodbolt@MattGodbolt7 жыл бұрын
  • As someone who grew with the C64, and just finished my first emulators (Color GB, SMS and NES), this is really fun. Subbed =)

    @DarkMoe@DarkMoe7 жыл бұрын
  • The ram was addressed with 8 lines and using a cas and ras line to do an 8 x 8 matrix for the memory

    @chulangjj@chulangjj6 жыл бұрын
  • Thanks for taking the time to make this, I've just got into C64 programming and this makes poke and assembly so much easier to understand. Any chance you'll do some more?

    @ravenmadd1343@ravenmadd13434 жыл бұрын
  • That PLA went bad in my C64 when I was a kid. Thanks to the schematic, I was able to track down the problem and replace the chip. I forget exactly what the behavior was, but I remember the computer still worked, but the video was all messed up and I was able to type in enough POKE commands to determine that memory wasn't being banked properly. Good times.

    @snorman1911@snorman19117 жыл бұрын
    • POKE 56000 , 100 READY. PRINT PEEK(56000) 32 READY. What the f....? POKE 56000, 100000000000 ?ILLEGAL QUANTITY ERROR READY. I had the same problem.

      @Richardddoobies@Richardddoobies7 жыл бұрын
    • What did you guys replace it with? Were the original chips available at the time? Or was there already a market for aftermarket Commodore 64 PLAs?

      @gregorymalchuk272@gregorymalchuk2723 жыл бұрын
    • @@gregorymalchuk272 This was around 1994, original PLAs were available from Jameco.

      @snorman1911@snorman19113 жыл бұрын
  • Fantastic video!

    @battlemode@battlemode6 жыл бұрын
  • I don't think I'd say "not active," usually I've heard it stated as "active low"

    @EricPoulsen@EricPoulsen7 жыл бұрын
    • +Eric Poulsen good point

      @Fill_In_The_Blank_Programmer@Fill_In_The_Blank_Programmer7 жыл бұрын
    • Even better, use "asserted" and "deasserted". That way it doesn't matter if it's active high or low.

      @neilbradley@neilbradley7 жыл бұрын
    • 'Active low/active high' is the industry standard term...Ive never heard anyone say 'asserted or unasserted' ever. In boolean algebra it's very common to refer to things in terms of 'not' or 'bar'....I think he was actually thinking in terms of boolean algebra while thinking aloud. It's a good approach in any case when you are following a logic structure on a wiring diagram. Both ways are able to be understood and his explanations were detailed and easy to follow. One further point I would like to make is that the I/O and the CIAs actively played a role in how the chip was used. In fact, I once had a black screen on a commodore 64, and the problem ended up being the 6526 CIA! I removed it, and the computer turned on just fine...because it defaulted to 0 on the register(since it wasn't there anymore). The CIA would control the bank area of where the chip would look for it's data. This feature allowed for variable screen map locations even though the chip could technically only see 16K at once. You could change where that 16K was! In contrast, the VIC-20 doesn't have this feature, and the graphics are thus hardwired to the low memory area, and cannot be moved at all. This is annoying at times and results in some rather silly code and ridiculous loading schemes where you would have to poke values around before running the games. The PLA actually made all this complicated logic possible on the commodore 64 without making to overly expensive(or at all awkward), as well as DRAM refreshing...which _dramatically_ reduced the cost in comparison with the competition who were all using expensive SRAM to make things easier/reliable on the manufacturing side.

      @peterlamont647@peterlamont6476 жыл бұрын
    • I have always referred a 0, 1 or H (for tristate high impedance o/p) as low or active low (when referring to circuit diagrams) etc.

      @simeyD@simeyD6 жыл бұрын
    • @@peterlamont647 Great insight.

      @Infinitesap@Infinitesap3 жыл бұрын
  • This shows how old I am:- I first learned to program in BASIC and POKE-ing and PEEK-ing to memory on a Tandy TRS-80 series 2 and series 3 (also Known as the Trash-80 ! ! !). 👍👍👍👍👍👍👍

    @andrewhillis9544@andrewhillis95442 жыл бұрын
  • Great video mate, thank you very much 🤙

    @kraftwerk974@kraftwerk974Ай бұрын
  • Ahh 1982 an excellent year for me

    @Havanacuba1985@Havanacuba19854 жыл бұрын
  • Nice video, thanks for postin

    @fuzzybad@fuzzybad7 жыл бұрын
  • Nicely explained :)

    @andrewsmail8307@andrewsmail83076 жыл бұрын
  • Me midways watching the video: It sounds like Jason Turner talking. 🤔 Me looking at ending dialog: aha! Please make more c64 vids!

    @razterizer@razterizer4 жыл бұрын
  • thank you for sharing.

    @1mindtab@1mindtab7 жыл бұрын
  • According to Jack's son, the offer was $1 and his father set the deal with a $50K check...

    @AnJo888@AnJo8885 жыл бұрын
  • Great video! I am very interested in learning machinr language, so I hope you will make more videos about it. And you have a very easy-to-understand way of explaining it :)

    @Psylicium@Psylicium7 жыл бұрын
    • glad you liked it! I hope you saw the next video that I just posted the other day, with an intro to Machine Language? kzhead.info/sun/ot6Ek6puiGh6m4E/bejne.html

      @Fill_In_The_Blank_Programmer@Fill_In_The_Blank_Programmer7 жыл бұрын
  • Damn, I'll have to learn so much

    @vinigame7490@vinigame74903 жыл бұрын
  • It tells me that i must make a PAL Chip first then i shall build the VIC Chip in a CPLD or FPGA - Cool Thank you for telling us this!

    @volkerking5932@volkerking59326 жыл бұрын
  • Would be good to see such techniques used for making c^$ games work on the C64GS cartridge system which sadly had little support.

    @obsoletepowercorrupts@obsoletepowercorrupts6 жыл бұрын
  • I learnt to code on this - remember hacking a star trek game that was written in basic but hidden (not well) from the ability to see the code

    @specialandroid1603@specialandroid16035 жыл бұрын
  • Great video, love your work. Only just found this channel. Been 4 years TRP, any new videos coming?

    @thedoomgoon@thedoomgoon3 жыл бұрын
    • Yes, yesterday!

      @Fill_In_The_Blank_Programmer@Fill_In_The_Blank_Programmer3 жыл бұрын
  • Can you explain more about the PROM chips and how the graphics spirits characters get displayed on the CTR screen by the counter chips sync signals. So program a graphic spirit and character how would this be done because the color PROM chip has all the color information that gets encoded. The CRT monitor has a decoder chip to decode the color information from the PROM chip. The X and Y coordinates are done by the V & H counter chips not in the character ROM or spirit ROM or color color PROM chip. How does the X and Y coordinates get applied to the graphics ROM chips?

    @billwilliams6338@billwilliams63384 жыл бұрын
  • Woah... not for the casual C64 fan. :) Still gave it a thumb's up because it sounds like an awesome explanation to those that enjoy electronics engineering.

    @fakshen1973@fakshen19734 жыл бұрын
  • 1s and 0s got on the bus, and went to the PLA and that group sent them to VIC ...to get stored

    @Miccelhome@Miccelhome6 жыл бұрын
  • I spent my whole childhood with a C64. I thought this was an interesting video. I have questions though. 1. How did you know why to use the VIC as your inference starting point? 2. You've only discussed the address lines that receive ones. But if a PLA receives 2 ones over address lines and then gives 0 as output over another line, then I assume that in another place on the schematic, a 1 could be outputted when receiving multiple zeroes? 3. How did you know that the first poke number corresponds to address lines and the second one to value lines?

    @JayBlackthorne@JayBlackthorne7 жыл бұрын
  • Wow, I knew these things were complicated but had no idea. It's one thing understanding -- it's another designing, testing and mass-manufacturing at a competitive price. I can only imagine what the architecture of modern, high-end chips looks like o.o

    @JustSayin24@JustSayin247 жыл бұрын
    • If you consider that the entire specs for the hardware fit on (essentially) 2 standard sheets of paper, its amazingly simple. A modern motherboard.... I mean a modern cellphone is kind of simple considering almost everything is on one chip, but still...

      @Fill_In_The_Blank_Programmer@Fill_In_The_Blank_Programmer7 жыл бұрын
    • Oh and this was my first programmable calculator, a hand me down of a hand me down, and the 3rd device I ever programmed: www.rskey.org/fx4000p ;)

      @Fill_In_The_Blank_Programmer@Fill_In_The_Blank_Programmer7 жыл бұрын
  • THE RETRO PROGRAMMER, If the RAM range is 2000- 23FF. How do I compute the RAM's range like how can I manually compute and get that 2000-23FF hexadecimal numbers? If the RAM range is 3000-31FF by looking at the decoder chip how can you get the RAM ranges manually without having or getting the memory map to tell you the rams ranges. What determines the RAMS starting and ending ranges?

    @billwilliams6338@billwilliams63384 жыл бұрын
  • The computer i'm most familiar with from back then is the Apple IIe.

    @nicholasmaude6906@nicholasmaude69064 жыл бұрын
  • flashback to when programers were programers and coders were secret agents.

    @deanshull4063@deanshull40632 жыл бұрын
  • It might take me longer to understand the math behind this (not my strong subject in HS) but you've earned a sub

    @AllGamingStarred@AllGamingStarred3 жыл бұрын
  • Nothing about the bank switching state? There is also RAM on 53280 if you choose to bank switch it in. Fact is that RAM also takes up the entire address space but you will have to bank switch to use it.

    @FlyingSurprise@FlyingSurprise4 жыл бұрын
  • I used to do assembly language on the C64. I still remember 53280 = $D020.

    @sa3270@sa32706 жыл бұрын
    • Omg the memories ... also $0314 and $0315 for kernal irq handling and ofc from vic $d020 (border color), $d021 (background color) and $d012 (raster irq) :D

      @BalazsBatari@BalazsBatari3 жыл бұрын
  • I think you are talking the method called "bank-switching", widely used in games are'nt you? One bank would be the current 1024 bytes showing on the screen and meanwhile another screen would be built in another bank and be switched on to when needed for smooth transitions between scenes with no loading.

    @imemyself2820@imemyself28206 жыл бұрын
  • I want that demo music from 1:35 :D Awesome!

    @tomaszkolasa6774@tomaszkolasa67747 жыл бұрын
    • csdb.dk/release/?id=146723 Enjoy! :-)

      @realsnoddas@realsnoddas7 жыл бұрын
    • Thank You :)

      @tomaszkolasa6774@tomaszkolasa67747 жыл бұрын
  • LOL already laughed at your first sentence! Thumbs Up!

    @twretro@twretro2 жыл бұрын
  • Very cool video but I think you didn't reveal the magic of poking 0 and peeking 240 back :) My guess: decimal 240 is 11110000 binary and since we can have 16 colours only which is log_2(16) = 4 that leaves us with 4 bits, the other 4 are not used (possibly do not physically exist within the VIC) to store colour code and seem to be always returned as "high", that's why 0 is being read as 240(11110000), 1 as 241 (11110001) etc.

    @OlegTikhonov@OlegTikhonov7 жыл бұрын
    • You are right. But now: Only on emulators do you always get 1111 in the upper half of the byte! On real hardware, you get a random value.

      @samwilson5544@samwilson55445 жыл бұрын
  • Sorry, there is a big mistake in the first few minutes. The BASIC that was laying around ( = Dartmouth BASIC) was adapted by Microsoft for the Commodore 64, and there was very well paid for. Back in those days 25.000 US Dollars was a huge sum of money. You could buy a house or a big luxury car for that. And besides that, Microsoft adapted BASIC for other 6502 computers before, so it must have been not to much work.

    @vanhetgoor@vanhetgoor8 күн бұрын
  • Why does your voice sound THE SAME as Jason Turner's voice from the channel with C++ Weekly ?

    @typedef_@typedef_3 жыл бұрын
  • Are you keeping up with the Commodore or is the Commodore keeping up with you?

    @jfangx@jfangx4 жыл бұрын
  • C64 and VB? Nice

    @MichaelBattaglia@MichaelBattaglia3 жыл бұрын
  • Okay, well if you can get inside their minds a little, why might they think it's better to use the last 16 decimal-based numerals of 256 for the colors instead of just the first 16?

    @HelloKittyFanMan.@HelloKittyFanMan.6 жыл бұрын
  • The alleged story about Commodore and Microsoft and BASIC is an urban legend - Microsoft as a rule did not offer perpetual licensees to MS-BASIC. So while Commodore might not have agreed to the royalty fee Microsoft was looking for, they without a doubt agreed to a lessor amount.

    @looneyburgmusic@looneyburgmusic2 жыл бұрын
  • Nice explanation

    @reset1974@reset19746 жыл бұрын
  • I LOVE C64 👍🥂🎩

    @dr.ignacioglez.9677@dr.ignacioglez.9677 Жыл бұрын
  • You sound like Jason Turner? Are you?

    @ruadeil_zabelin@ruadeil_zabelin6 жыл бұрын
    • Yea I can imagine. Great job though.

      @ruadeil_zabelin@ruadeil_zabelin6 жыл бұрын
  • This could been explained much more logical than this. Hi-byte and Low-byte (both 8 bit) determines these 16-bit addresses you talk about. This is something you learn when going into machine code language and is basically how the computer finds it's way through the memory map (which goes from $0000-$FFFF).

    @jmp01a24@jmp01a247 жыл бұрын
    • You could always make you're vid...

      @LordmonkeyTRM@LordmonkeyTRM6 жыл бұрын
    • Snap! Anyway it is more complicated than that on the C64. It has all kinds of bank switching, ram refresh, IO space with ram underneath at the same address, the CIA partially controlling the video chip etc. The Commodore 64 seems deceptively simple, but in reality the memory map is anything but simple. In terms of program memory I would entirely agree! In fact, that is exactly right down to the 74LS245's and the HIRAM and LOWRAM !CS lines etc. but once you get into the I/O...oh geez...They had to do some wizardry to fit 96K on a machine with 64K addresses and memory that erases itself every 100 microseconds.

      @peterlamont647@peterlamont6476 жыл бұрын
  • I have a feeling that you are not writing to or addressing the VIC at all. The VIC does not appear to look at the A5 address line, so that bit cant possibly mean anything to the VIC, yet it does mean something to the system itself, so it is not insignificant... Rather, I think that the act of writing to address D020 in this circumstance causes the "COLOR RAM" chip to be selected, because the COLOR RAM chip takes in all address lines from A9..A0 therefore A5 does mean something to it - and only data lines from D3..D0 (see below) are connected to COLOR RAM which has some significance... Writing a value of 1 and reading back a value of 241 (0xF1) can be explained as follows... COLOR RAM is connected only to D3..D0, corresponding to the lower nibble. D7..D4 are not connected to COLOR RAM. Therefore when you write to COLOR RAM, only the lowest nibble even matters - you can put any value you want in the higher nibble and it is simply ignored. As for reading ... TTL chips tended to have weak pull ups on their inputs, which meant that if those pins were left floating, they would be reasonably stable at a logic high. Therefore, when you read a value from COLOR RAM, and it places its value on to D3..D0 only, D7..D4 are effectively floating and therefore pulled high and thus read as high by the CPU. Hence you get all ones in the upper nibble, and the value of that memory location in the lower nibble. I think it is important to note that it may not be as simple as the address alone that determines which chip is selected. There are a lot of other input signals to the PLA which can influence which output(s) are activated. Without knowing the product terms of the PLA it would be hard to say. What does cause me some doubt, however, is that on the schematic the COLOR RAM chip is labelled as having a memory range of D800-DBFF. But given what I can see from the schematic, I am fairly confident in what I wrote above.

    @TomStorey96@TomStorey965 жыл бұрын
    • Actually I just found a PDF called "The C64 PLA Dissected", I cant post links but try googling it. This seems to contain the product terms for the PLA along with a wealth of other information about it. I think it satisfies what I wrote above in terms of selecting the VIC or COLOR RAM.

      @TomStorey96@TomStorey965 жыл бұрын
    • The color RAM chip with its memory range of D800-DBFF is for the 1000 tiles for a text screen memory. Each tile makes each text character capable of being a different color. Wherever the screen memory is, usually 1024 to 2023 decimal, is matched up with color RAM's value. What a poke to $D020 does is set a register to cause the VIC to make the border color what you want it to be. Likewise poking to $D021 makes the background all one color. This way you do not have to change 1000 color locations, the VIC does the hard work for you. The VIC is an amazing chip that actually does RAM refresh and other tasks, and it can even put the processor on hold and use time slots for its own purposes. The VIC and the 6510 take turns accessing the data and address buses using the system clock as the task switcher. Very clever multiplexing scheme, and elegant.

      @GrowlyBear917@GrowlyBear9175 жыл бұрын
  • "4086" um no its 4096.

    @MisterHunterRow@MisterHunterRow5 жыл бұрын
  • I think your order is quite wrong today's computers have multiple cores - up to 18, generally 2-6 each core have multiple execution units - AMD K6 had 6 of them, AMD Athlon had 10 of them (3 ALUs, 3FPUs, 3AGUs, Load/Store) today CPUs are capable of executing very complex operations, which does more then one thing and sometimes it would render more then one operation per clock per execution unit. considering just that 4GHz / 1MHz = 4000 10 execution units - 40000 say 4 cores - 160000 now we are much closer 6502 had 0 cache, 1 execution unit, 2 registers. Just considering number of registers (not even touching register renaming) we are talking about 8 times more registers on x86_64 we may be very well close to million times faster

    @WizardNumberNext@WizardNumberNext6 жыл бұрын
  • I'm not sure if you know that, but every time a new video clip comes your voice will either be louder or softer that's very annoying

    @SciDOCMBC@SciDOCMBC4 жыл бұрын
  • Could someone with an average IQ like myself ever learn how to build and program a C64 from scratch?

    @neurotraumatized-thrall@neurotraumatized-thrall7 жыл бұрын
    • @Chris2: Depends on how much you limit yourself in THIS particular topic by such beliefs of having an average IQ. ;) It only takes a longer concentration on details at the beginning phase of learning. Later - it's just pleasant and fun. BTW. Love and interest for something overweights obstacles.

      @CJWarlock@CJWarlock6 жыл бұрын
    • @slaSSification: Srsly? ;) Easy peasy. :)

      @CJWarlock@CJWarlock6 жыл бұрын
    • Chris, this video assumes knowledge in a number of subjects. While I understand it entirely, 4 years ago I would be utterly lost. You can learn this computer inside and out. I recommend getting one! They are an amazing way to teach you everything about computers, and they aren't that expensive yet. If you do buy one on ebay, make sure it is "tested and working". Not just "turns on". Some people think the little red LED means it is working, or in fact they know it is broken and are trying to rip people off.

      @peterlamont647@peterlamont6476 жыл бұрын
    • When learning this kind of stuff, I've found it better to apply some level of abstraction , even at this level. When you become comfortable with the larger concepts, you can then start looking at implementation details, how the circuits work etc. About 6 months ago, i gave myself the goal of building a computer from scratch. I had only minimal knowledge of computer architecture and programming. While i now understand the concepts shown in the video, i definitely could not say the same a half a year ago. As long as you put your mind to it, as long as you don't give up and spend time on it, you'll eventually get there

      @hydrochloricacid2146@hydrochloricacid21466 жыл бұрын
  • Look, Shatner, you pause in the middle of statements way to often.

    @WalkerRileyMC@WalkerRileyMC5 жыл бұрын
  • you take way too long to show how to convert from decimal to binary or hexadecimal.

    @DavidVirebayre@DavidVirebayre7 жыл бұрын
  • Being CS does not make you a teacher - that's what I've learned. Another nerd talking to himself on video, so sad.

    @JohnAnderson4242@JohnAnderson42425 жыл бұрын
  • Pfft..... Playstation 2 sold 151 million units.

    @tenminutetokyo2643@tenminutetokyo26435 жыл бұрын
    • And the PS2 is a CONSOLE ... not a programmable computer, what's ypur point?

      @Nautilus1972@Nautilus19725 жыл бұрын
KZhead