Commodore 64 Part 1: How The Memory Map Worked

Поділитися
Вставка
  • Опубліковано 9 чер 2016
  • 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...
  • Наука та технологія

КОМЕНТАРІ • 99

  • @rickwitt5735
    @rickwitt5735 4 роки тому +6

    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.

  • @diggydude5229
    @diggydude5229 4 роки тому +3

    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.

  • @Infinitesap
    @Infinitesap 3 роки тому +3

    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.

  • @andrewhillis9544
    @andrewhillis9544 2 роки тому +1

    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 ! ! ! 👍👍👍👍👍👍👍

  • @anthonyjagers7770
    @anthonyjagers7770 Рік тому +1

    Jack really said that to Bill? He’s my hero!

  • @mikeyoung9810
    @mikeyoung9810 4 роки тому +2

    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.

  • @jamesrbrindle
    @jamesrbrindle 6 років тому +7

    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.

    • @peterlamont647
      @peterlamont647 6 років тому

      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.

  • @davidlineberger644
    @davidlineberger644 5 років тому +5

    Loved seeing you trace through the schematics of the C64. Fascinating!

  • @RyN834
    @RyN834 8 років тому +10

    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

  • @andrewhillis9544
    @andrewhillis9544 2 роки тому +1

    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 ! ! !). 👍👍👍👍👍👍👍

  • @snorman1911
    @snorman1911 7 років тому +4

    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.

    • @Richardddoobies
      @Richardddoobies 7 років тому +3

      POKE 56000 , 100
      READY.
      PRINT PEEK(56000)
      32
      READY.
      What the f....?
      POKE 56000, 100000000000
      ?ILLEGAL QUANTITY
      ERROR
      READY.
      I had the same problem.

    • @gregorymalchuk272
      @gregorymalchuk272 3 роки тому

      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?

    • @snorman1911
      @snorman1911 3 роки тому

      @@gregorymalchuk272 This was around 1994, original PLAs were available from Jameco.

  • @w4twa
    @w4twa 3 роки тому +2

    You just filled in a huge info gap for me! Thanks. More like this please 😀

  • @cumbrianrambler7715
    @cumbrianrambler7715 7 років тому +3

    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!

  • @vinigame7490
    @vinigame7490 3 роки тому +1

    Damn, I'll have to learn so much

  • @mark12358
    @mark12358 6 років тому +1

    Great video indeed! A very deep journey inside C64 memory map.

  • @adammontgomery7980
    @adammontgomery7980 6 років тому +1

    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.

  • @chulangjj
    @chulangjj 6 років тому +2

    The ram was addressed with 8 lines and using a cas and ras line to do an 8 x 8 matrix for the memory

  • @thedoomgoon
    @thedoomgoon 3 роки тому +2

    Great video, love your work. Only just found this channel. Been 4 years TRP, any new videos coming?

  • @EricPoulsen
    @EricPoulsen 8 років тому +23

    I don't think I'd say "not active," usually I've heard it stated as "active low"

    • @Fill_In_The_Blank_Programmer
      @Fill_In_The_Blank_Programmer  8 років тому +4

      +Eric Poulsen good point

    • @neilbradley
      @neilbradley 7 років тому +1

      Even better, use "asserted" and "deasserted". That way it doesn't matter if it's active high or low.

    • @peterlamont647
      @peterlamont647 6 років тому +7

      '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.

    • @simeyD
      @simeyD 6 років тому +2

      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.

    • @Infinitesap
      @Infinitesap 3 роки тому

      @@peterlamont647 Great insight.

  • @srenhaandbk7904
    @srenhaandbk7904 4 роки тому +1

    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!

  • @JustSayin24
    @JustSayin24 8 років тому +1

    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

    • @Fill_In_The_Blank_Programmer
      @Fill_In_The_Blank_Programmer  8 років тому +1

      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_Programmer  8 років тому +1

      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 ;)

  • @razterizer
    @razterizer 4 роки тому +2

    Me midways watching the video: It sounds like Jason Turner talking. 🤔
    Me looking at ending dialog: aha!
    Please make more c64 vids!

  • @MattGodbolt
    @MattGodbolt 8 років тому +4

    Fantastically clear explanation of how memory-mapped peripherals work! Awesome!

  • @DarkMoe
    @DarkMoe 7 років тому +1

    As someone who grew with the C64, and just finished my first emulators (Color GB, SMS and NES), this is really fun. Subbed =)

  • @ravenmadd1343
    @ravenmadd1343 4 роки тому +1

    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?

  • @AnJo888
    @AnJo888 5 років тому +3

    According to Jack's son, the offer was $1 and his father set the deal with a $50K check...

  • @Havanacuba1985
    @Havanacuba1985 4 роки тому +1

    Ahh 1982 an excellent year for me

  • @specialandroid1603
    @specialandroid1603 5 років тому +2

    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

  • @battlemode
    @battlemode 6 років тому +2

    Fantastic video!

  • @volkerking5932
    @volkerking5932 6 років тому +2

    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!

  • @Psylicium
    @Psylicium 8 років тому +2

    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 :)

    • @Fill_In_The_Blank_Programmer
      @Fill_In_The_Blank_Programmer  8 років тому +1

      glad you liked it! I hope you saw the next video that I just posted the other day, with an intro to Machine Language? ua-cam.com/video/ozKcF6Q6DhI/v-deo.html

  • @Miccelhome
    @Miccelhome 6 років тому +1

    1s and 0s got on the bus, and went to the PLA and that group sent them to VIC ...to get stored

  • @AllGamingStarred
    @AllGamingStarred 3 роки тому +1

    It might take me longer to understand the math behind this (not my strong subject in HS) but you've earned a sub

  • @billwilliams6338
    @billwilliams6338 4 роки тому +1

    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
    @billwilliams6338 5 років тому +1

    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?

  • @andrewsmail8307
    @andrewsmail8307 6 років тому +1

    Nicely explained :)

  • @MichaelBattaglia
    @MichaelBattaglia 3 роки тому +1

    C64 and VB? Nice

  • @kraftwerk974
    @kraftwerk974 Місяць тому

    Great video mate, thank you very much 🤙

  • @FlyingSurprise
    @FlyingSurprise 4 роки тому +1

    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.

  • @fakshen1973
    @fakshen1973 4 роки тому +1

    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.

  • @fuzzybad
    @fuzzybad 8 років тому +2

    Nice video, thanks for postin

  • @deanshull4063
    @deanshull4063 2 роки тому +1

    flashback to when programers were programers and coders were secret agents.

  • @OlegTikhonov
    @OlegTikhonov 7 років тому +6

    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.

    • @samwilson5544
      @samwilson5544 5 років тому +1

      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.

  • @nicholasmaude6906
    @nicholasmaude6906 4 роки тому +1

    The computer i'm most familiar with from back then is the Apple IIe.

  • @tomaszkolasa6774
    @tomaszkolasa6774 8 років тому +3

    I want that demo music from 1:35 :D Awesome!

  • @sa3270
    @sa3270 6 років тому +5

    I used to do assembly language on the C64. I still remember 53280 = $D020.

    • @bayyyi
      @bayyyi 3 роки тому +1

      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

  • @1mindtab
    @1mindtab 8 років тому +1

    thank you for sharing.

  • @obsoletepowercorrupts
    @obsoletepowercorrupts 6 років тому +1

    Would be good to see such techniques used for making c^$ games work on the C64GS cartridge system which sadly had little support.

  • @typedef_
    @typedef_ 4 роки тому +1

    Why does your voice sound THE SAME as Jason Turner's voice from the channel with C++ Weekly ?

  • @JayBlackthorne
    @JayBlackthorne 8 років тому +1

    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?

  • @jfangx
    @jfangx 4 роки тому +2

    Are you keeping up with the Commodore or is the Commodore keeping up with you?

  • @twretro
    @twretro 2 роки тому

    LOL already laughed at your first sentence! Thumbs Up!

  • @imemyself2820
    @imemyself2820 6 років тому +1

    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.

  • @looneyburgmusic
    @looneyburgmusic 2 роки тому

    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.

  • @jmp01a24
    @jmp01a24 7 років тому +1

    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).

    • @LordmonkeyTRM
      @LordmonkeyTRM 6 років тому

      You could always make you're vid...

    • @peterlamont647
      @peterlamont647 6 років тому

      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.

  • @vanhetgoor
    @vanhetgoor Місяць тому

    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.

  • @HelloKittyFanMan.
    @HelloKittyFanMan. 6 років тому +1

    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?

  • @ruadeil_zabelin
    @ruadeil_zabelin 6 років тому +2

    You sound like Jason Turner? Are you?

  • @dr.ignacioglez.9677
    @dr.ignacioglez.9677 Рік тому

    I LOVE C64 👍🥂🎩

  • @reset1974
    @reset1974 6 років тому

    Nice explanation

  • @TomStorey96
    @TomStorey96 5 років тому +1

    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
      @TomStorey96 5 років тому

      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.

    • @GrowlyBear917
      @GrowlyBear917 5 років тому +1

      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.

  • @MisterHunterRow
    @MisterHunterRow 5 років тому +1

    "4086" um no its 4096.

  • @neurotraumatized-thrall
    @neurotraumatized-thrall 7 років тому +2

    Could someone with an average IQ like myself ever learn how to build and program a C64 from scratch?

    • @CJWarlock
      @CJWarlock 7 років тому +1

      @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
      @CJWarlock 7 років тому

      @slaSSification: Srsly? ;) Easy peasy. :)

    • @peterlamont647
      @peterlamont647 6 років тому +1

      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.

    • @hydrochloricacid2146
      @hydrochloricacid2146 6 років тому +1

      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

  • @SciDOCMBC
    @SciDOCMBC 4 роки тому +2

    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

  • @WizardNumberNext
    @WizardNumberNext 6 років тому +1

    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

  • @WalkerRileyMC
    @WalkerRileyMC 5 років тому +1

    Look, Shatner, you pause in the middle of statements way to often.

  • @JohnAnderson4242
    @JohnAnderson4242 5 років тому +2

    Being CS does not make you a teacher - that's what I've learned. Another nerd talking to himself on video, so sad.

  • @DavidVirebayre
    @DavidVirebayre 7 років тому +13

    you take way too long to show how to convert from decimal to binary or hexadecimal.

  • @tenminutetokyo2643
    @tenminutetokyo2643 5 років тому

    Pfft..... Playstation 2 sold 151 million units.

    • @Nautilus1972
      @Nautilus1972 5 років тому +3

      And the PS2 is a CONSOLE ... not a programmable computer, what's ypur point?