One-Line PET Emulator for Commodore 64

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi it's robin today i've been reading this issue of the trans actor volume five issue one with a focus on sound and graphics i think it's from 1984 has quite a few interesting articles here breaking the sprite barrier sprite rotation projectile plotting more screen blitzes vic-20 sound effects the fundamentals of music voice interface for the cbm plus a first look at the new commodore 264. always great artwork on these bunch of angels proclaiming the commodore 64. i think i don't know anyway there's tons interesting stuff in this issue but here on page 21 is the one line pet emulator need to run some pet software on your commerce 64 try these pokes courtesy of jim butterfield i thought this is so cool a one-line pet emulator we'll give it a try and then figure out how it works hardly need my holder for this but anyway i had it out so here we go poke five six five seven six comma five i believe that points the vic at a different memory bank the vic can only see 16k at once so you can configure it to look at any of the four banks of 16k of ram poke 53272 comma 4 that would point video memory to a different area poke 648 comma 128 that would point the basic screen editor at a different part of memory actually that that one's obvious at 8 000 hex or three two seven six eight which i happen to know is where pet screen memory is poke 1024 comma zero on the c64 that screen memory but on the pet that's the beginning of basic memory and i think we've discussed recently how there needs to be a zero at the beginning of basic memory for the basic interpreter to work properly there needs to be a zero there and then the first line of basic follows right after poke 44 comma four okay i think that's the start of basic memory okay take a look at mapping just to be sure yeah that's the pointer to the start of basic program text normally that's an eight to point to 0801 or oh eight zero zero hexagon comma 64. i guess we're already figuring out how mostly how this works aren't we so anyway it starts the that changes the start of basic memory and poke 56 comma 128 so that should be the end of basic memory and that's a pointer to the highest address used by basic and on the pat there's up to 32k of ram and it ends right at 8 000 hex right before video memory starts so this is saying the c64 to cap basic ram right below video memory at three two seven six eight decimal eight eight zero zero zero hex and then just clear the screen interesting then the magazine that uses lowercase i guess i could switch to that there and finally a new and the new serves two purposes first of all once you've run this program it's obviously just configuring the c64 but isn't actively running anymore so that just gets it out of memory ready to load a pet program and also after you change these basic pointers around like here this at the the start and end of basic memory you need to do either a new or a clear clr just to clean things up afterwards so that's the program i gave the commentary did i give away too much let's try running it and see if it works okay it says it's ready so i've got some pet programs on the disc here let's give it a try now i think my super snapshot's still active so i'll do a distractory here we go whoa well it was working and then the screen filled up with garbage let's try that again here we go okay so actually hey look at this super snapshot by lms tech use the cursor keys to select feature wedge load save setup for new disk directory so this is interesting obviously some super snapshot memory is getting copied onto the screen here so while the beginning of the directory is listing this is executing some super snapshot code but then when the screen scrolls the garbage appears so that makes me think that this wedge directory so i guess the scroll code assumes that screen memory is at the regular c64 default and doesn't take into account if you've rearranged screen memory even though c64 seems normal right now actually it's video memory instead of being at the regular location is up at 8 000 basic has been switched around so really the c64 is configured very much like a pat currently and the fact that it can be done with just one line of code i think indicates that the designers of the c64 very much had pet compatibility in mind i don't think it's a coincidence that you can so easily configure a c64 to behave much like a pet so i think if we do a slash dollar sign that will instead load the directory into basic ram and then if we list that there's the full directory without corruption so that's interesting so i got several pet games here let's see if any of them work we'll load up my favorite dungeon so it seems to be there let's give it a try run oh switch back to uppercase there we go cursor number 15 dungeon copyright 79 by brian sawyer search for gold in the ancient ruins setting up so far so good just like on the pat this takes a minute to set up more or less literally a minute so i'll fast forward this [Music] four three two one yeah hey great okay so we've gotta move but on the pad you know it has a number pad down here that is often used like a directional pad a d-pad for pet games unfortunately that's not available so we'll have to use the number keys up here which isn't as intuitive by the way people often suggest that the c64 by retro games should have a pet mode and i point out that actually that wouldn't be all that fun part of the appeal the c64 is that has an accurate keyboard for c64 and vic-20 modes but the pet keyboard is so different that it's like you might as well be using an emulator yeah and in fact it would just be not fun to play so actually that's the same problem we'll have here today but anyway okay so one should go down and southwest yeah looks like it's working two to move down three to move south east to moved south oh there's a door it's a hallway so press f4 should go west it's all working haven't found any monsters yet it's a big room three should move southeast oh there a spider with 17 points is near six to move on top of him that's east an attack the spider is dead your hit points have been raised this is working perfectly you may move uh eight to move north oh there's a doorway gold is near more gold seven should be northwest a group with 80 points is near i have 113 nine to move northeast an attack the groove has 14 hit points well i sure got a lot of attack the gru is dead your hit points have been raised actually i'm doing really good you may move anyway okay we're not good we spent enough time on this game in those other episodes and q dies and reveals the dungeon and of course because it's uh basic two that bug isn't there for the uh that we fixed in that previous episode do you wanna play again no thank you ready well i'm impressed okay let's let's try another one or two here blackjack okay we'll try that one run blackjack up here right now shuffling i think it's said your bat i don't know 10. bat oh i got seven hearts nine insurance uh no do you want to hit you have 16 no ace and five oh dealer wins losing ten bucks your bat one hundred nine and seven do you wanna hit against two oh no i got 16. no jack 14 busted you win winning so i'm plus 90. i wonder how big a bet i can do 1000 bucks i have 18 do you want to hit no 13 busted you win hey i'm doing pretty good here you're bat zero no okay and here i'm just going to reset back to the c64 now we're in c64 mode let's try loading that blackjack again i'll load it again with the slash which is the wedge shortcut for just loading comma eight which loads into the beginning of c64 memory so the c64 will load pet programs basic pet programs into memory correctly okay there's the program let's try running it blackjack shuffling your bat a thousand oh this game works anyway by no dungeon doesn't do i hit no okay so i guess that wasn't that impressive okay let's try another game everest okay looks good run become a mountaineer okay so the game seems to be frozen when i run it just on the c64 without running the emulator first there should be a diamond down that bottom row okay so i saved that pet emulator program run load everest okay there it is run become a mountaineer press return to begin okay there we go now the game's working okay so we're that diamond down at the bottom of the screen in the middle avalanche if i press nine move up and so the the goal here is to climb up the mountain you see how the there's the temperature okay i got that strength meter so if we climb up here i think all those numbers i'm moving seven to move uh up to the left seven come on there we go so you have to pick your path the number represents how much strength it costs to climb up that part of the screen or to that to the next tile so you have to like conserve your strength that was expensive that was six but here i can move to this three up above me you see that diamond on the screen service hard to follow okay uh eight move up again okay move to that four and uh seven oh uh it looks like i've been heading towards a very expensive part of the mountain uh i guess i'll move oh avalanche eight well my strength is running very low here four yeah i'm i'm toast here strength zero out of energy your dad your climbing was good why thank you brian by the way this is by brian sawyer the author of dungeon he made a number of games back then do you want to try again no okay so we're actually having pretty good luck here i know for a fact that games like space invaders won't work um try one more here star force run oops syntax air oh yeah well that one didn't work pet emulator run i'll try that space invaders okay it's just a machine code program we'll try running it oh that's promising how produce sound effects i love this uh pet ski diagram of how to wire up a speaker to your pet it's got that diagram your pet and that one's the parallel port little arrow audio amp connects cb2 to your app through 50 to 500k ohm resistor i think adrian's digital basement i think he did this once or no our uh jim happel did yeah i i think it's my friend jim happel here we go let's see does it do anything oh score advanced table oh something appeared up there and then yeah we'll try going to the snapshot oh it's actually right frozen so anyway this program almost for sure has some pokes either to the crt or actually more likely to the input output chips for timers or whatever and this pet emulator cannot and does does not and cannot remap those uh those registers so full pet compatibility just really isn't possible but it's nice that works with some of those games just look a little bit more how it works five six five seven six okay so poking five into five six five seven six bits zero and one select the 16k vic two memory bank which well i don't know why they didn't bother to list them all but anyway zero one is bank two one one binary is three that's bank zero it's kind of converted and then one zero would be bank one and zero one would be bank two and that's what this is five in decimal is one zero one binary so zero one means bank two and bank two starts at eight thousand that's where screen memory is on the pat so we're telling the vic to look to the range of memory from 8000 to bff that is three two seven six eight uh i don't know about why it's why we're putting five in there bit two is the rs232 data output or pin m of the user port what happens if you put a one in there it still work no a error there oh okay to edit this i have to shrink that line and put new just barely over that 80 character limit that the basic editor has so we have to actually abbreviate this line to change it so now i'm going to change that to poke comma 1 and run that yeah so i guess one works too yeah and next is this poke five three two seven two four in hex of course that's just zero four so that means the upper nibble is a zero that means the video matrix base address video matrix is going to be at zero which you add to the base eight thousand so yeah screen memory is going to be at eight thousand hex or three two seven six eight decimal and the lower nipple sets the text character dot data base address and the reason it's being set to four is that's where the rom character set lives so if we set this to zero and ran it oh once again i abbreviate this if we run that now our character set is also looking at screen memory eight zero zero zero so that's why it's ugly so we should be able to type it in blind poke five three two seven two comma four there and now the vic is fetching its character data its font its character sad from the regular rom location 648 tells the basic screen editor where in video memory the vic is looking right now so it's nice that they added that configurability to it and 128 you just multiply it by 256 that's just the page number where it starts multiply it by 256 and you get screen memory 32768 code 1024 yeah that's the start of basic memory just putting a zero there which is necessary if you don't do that you'll guess syntax error when you try to do anything in basic even if you try a list poke 44 is the high byte of the start of memory so if we just take that 4 and multiply it by 256 then we get 1024 which is this same number by no coincidence notice that butterfield doesn't bother to poke the low byte of it it's already initialized to zero so and because he wants to make this one liner there's no no point in wasting the space on that and poke 56 comma 128 yeah that's the top basic memory so 128 times 256 yet again is screen memory basic memory goes up to it's non-inclusive so it's actually one bite below that and we already talked about it just clears the screen and new and here's a little challenge i was wondering if we could make this even more like the pad if i re-abbreviate these to save as much space as possible gotta get rid of that space p shift o so we can abbreviate all these pokes into p shift o just so we can squeeze as much as possible into the 80 character limit and then the print can change into a question mark and then new okay so now we got a bit of space what i'd like to do is also poke 53281 the background color comma 0 to black just like the pet crt has a black background and after the screen clear i'd like to insert control six which is the green color now what i really like to do is also change the border color to black but i could not figure out how to get that in so that's a challenge if any of you can figure that out please let me know i tried setting like a variable like i tried saying a to 53272 and here i'll do it i'll do it in line two just so you can see so if we take out 53272 and then here we insert a equals 532 72 and then we can have a bit of a savings here a plus nine maybe you see we only have three characters free uh yeah new doesn't have an abbreviation end shift e is next but that's still not enough characters and every other poke here seems necessary to me well there's two 128s here but anyway i fought with it for a little while and could not come up with a way of setting the border color as well within that 80 character limit yes you could make a line through some tricks but i wanted to be a one-liner that you can actually just type in like a normal line of basic so we will delete line two so here's our slightly improved pet emulator run there now we have green text on a black background with a terrible blue border you know what i'm just gonna set that myself even though that's cheating let's load up yahtzee and run that yahtzee hey how many to play oh just playing by myself oh it'd be nice if darren was here we were just talking about yahtzee on my podcast growing up 80s with darren folds and he was talking about computer yahtzee do instructions no initializing there we go robin what do i want to reject one two and three yeah oh now i got i'll get rid of the six six four oh that's pretty poor we'll put that category one there now we got two points in the ones that's so much of a waste gatsby's pretty cool game okay that i like how it has some strategy oh here one two three um i'll keep the five and get rid of the six in case i can get a straight here oh and i got a pair one more try get a four no that's terrible i'll just put that my twos one two okay i'll get rid of the five in case i can get the let's see one once again well we got a lot of mileage of another one liner very fun little program from jim butterfield that not only showed big cleverness on his part but also on how flexible the commodore 64 really is thank you to my patrons for their support thank you for watching and we'll talk to you next time [Music] when i was 10 i became obsessed with video games and the like i dreamed of donkey kong space invaders through the night at school we had a commodore pet we wore out the a key screaming [Music] and i bought a timex sinclair begun to learn how to have but i couldn't get it to save her load so i promptly went to bring it back [Music]
Info
Channel: 8-Bit Show And Tell
Views: 26,398
Rating: undefined out of 5
Keywords:
Id: qWZyv1pomy4
Channel Id: undefined
Length: 27min 16sec (1636 seconds)
Published: Thu Dec 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.