Тёмный

Making a C64 Cartridge Dump RUNable, Fixing a 42-Year-Old Typo? LeMans (Part 2) 

8-Bit Show And Tell
Подписаться 56 тыс.
Просмотров 16 тыс.
50% 1

Now that we've got a binary dump of the Lemans game cartridge (see previous video linked below) how do we make it able to simply LOAD and RUN without a bunch of messing around in the machine language monitor? And as a bonus: we fix a 42-year-old typo in the game!
Part 1: Dumping LeMans cartridge: • Dumping (And Playing) ...
Part 2: Making the binary RUNnable: This video!
Part 3: This Game Cheats: • Video
Download the disk image to follow along: 8bitshowandtell.com/downloads...
To support 8-Bit Show And Tell:
Become a patron: / 8bitshowandtell
One-time donation: paypal.me/8BitShowAndTell
2nd channel: / @8-bitshowandtell247
Index:
0:00 Last time on 8BST
1:39 Turbo Macro Pro time: src6 walk-through
4:20 BASIC Stub explanation
7:32 Main program explanation
10:24 Copy routine explanation
12:21 Putting it together
14:33 Testing it
15:36 Robin From The Future: BOUNS Typo
17:30 Locating the typo in ROM
20:28 Fixing the typo in the dump?
22:00 Fixing it in our boot program instead
24:30 Testing it
26:05 Thanks to my patrons!

Наука

Опубликовано:

 

3 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 99   
@ReneSchickbauer
@ReneSchickbauer 2 месяца назад
10:39 "This copy routine only handles full pages. If you don't like that, YOU can rewrite that." The classic start of nearly every career in programming 🙂
@mikegarland4500
@mikegarland4500 4 месяца назад
This game was of course famous even around here: starting in the arcades, and then on the C64. Growing up in rural South Georgia, USA, EVERYONE I knew called it "Leh-MONS" complete with the 'S'.
@BigDrahma
@BigDrahma 4 месяца назад
This was so interesting, especially how the cart loads into RAM. I'd love to see an exploration of a very large cart like Eye of the Beholder and how the C64/C128 handles it, specifically around memory paging but also how it makes the C128 use two screen mode
@phill6859
@phill6859 4 месяца назад
Large cartridges behave more like a disk drive, there is a small area that the cartridge appears and the CPU copies it into ram. Max cartridges switch most ram off and the cartridge just appears in the CPU address space
@BigDrahma
@BigDrahma 4 месяца назад
@@phill6859 yeah but I don’t want you to explain it, I want him to.
@yadabub
@yadabub 4 месяца назад
You did a good job bouncing those lemons.
@Brian-vs9sd
@Brian-vs9sd 4 месяца назад
I absolutely love watching your videos.
@dangerofh4ckst4b14
@dangerofh4ckst4b14 4 месяца назад
Impressive as usual, thank you very much for the detailed explanation.
@larswadefalk6423
@larswadefalk6423 4 месяца назад
Actually, side note. When doing writes into the banked memories, they are going "through" to ram. So in order to do the copying part, you won't even have to switch out the rom. Of course, you'd need that later anyway in order to start the game. But I think you knew that Robin.
@8_Bit
@8_Bit 4 месяца назад
Yes, writes would go through to RAM so I wouldn't have to switch out the ROM before the first copy, from $0900 to $E000. But then for the 2nd copy the ROMs did need to be out as I chose to copy from $F000 to $3000 just to make the intention a bit more clear (in my mind, anyway). I could have copied from $1900 to $3000 to delay the ROM switch as late as possible, but that seems even less explanatory to me.
@larswadefalk6423
@larswadefalk6423 4 месяца назад
@@8_Bit agree completely. Would have done the same.
@8_Bit
@8_Bit 4 месяца назад
I watched/listened to the video again and I see that you're picking up on this part: "...reveals the RAM underneath, which is where we want to copy the cartridge to" and how it maybe implies that that the ROM had to be out to do the copy. So yeah, that's worth clarifying, thanks.
@Commodore128Mode3
@Commodore128Mode3 4 месяца назад
Hahaha when you pointed out that Lemans (I pronounce it "lemons" myself... kidding) says BOUNS instead of BONUS, when you highlited it, I SWEAR I saw "BONUS" for a few seconds. I REALLY had to look at it to see that it did indeed say BOUNS! LOL Another great video Robin! Thank you.
@GadgetUK164
@GadgetUK164 4 месяца назад
Brilliant! Loved that short series =D Bonus points for fixing that typo!
@Commodore128Mode3
@Commodore128Mode3 4 месяца назад
... or even BOUNS points! 😉
@jandjrandr
@jandjrandr 4 месяца назад
Love it when a game gets bug fixes many decades after it was made. Thanks for the walk-through of getting a game out of its cartridge form and into a loadable game form with fixes no less. Very informative.
@aresaurelian
@aresaurelian 4 месяца назад
I do believe the bouns thingy was kind of memorable. Probably kept for a reason. Thank you @8-Bit Show And Tell, for giving us these cherries on the cream of the early 1980s.
@StatMatsVidz
@StatMatsVidz 4 месяца назад
Another great and informative video Robin! Great trick using characters typed into screen ram in the BASIC editor to easily get the screen code bytes! Thanks for sharing. :)
@OnurBuyukcaglar
@OnurBuyukcaglar 4 месяца назад
We ❤ you & your videos regardless of how you pronounce certain words.
@nemofox_68
@nemofox_68 4 месяца назад
As a Frenchman the exact pronunciation of Le Mans is without "s" at the end. but it doesn't matter because we also don't know how to correctly pronounce a number of cities or states. Arkansas for example or Albuquerque 😅.
@gcherowars6758
@gcherowars6758 4 месяца назад
Same like the capitol of Iowa Des Moines (both s's are silent)
@nemofox_68
@nemofox_68 4 месяца назад
@@gcherowars6758 Indeed the names of city or states of French origin should be pronounced in French but I think that the pronunciation has become anglicized with time as for example Saint Louis whose "t" of Saint and the 's' of Louis do not pronounce. New Orleans same. in "Illinois" the "oi" is difficult to pronounce for anglophones...
@ncurtis1970
@ncurtis1970 4 месяца назад
Always interesting , well presented and very educational.
@chrisdixon5241
@chrisdixon5241 4 месяца назад
Great work! I think spotting that typo is really hard if you're actually playing / watching the game since it appears for such a short period of time. Nice job fixing it!
@Okurka.
@Okurka. 4 месяца назад
I spotted it right away in the previous video.
@rondlh20
@rondlh20 4 месяца назад
E-thousand, nice find, makes perfect sense :D
@klocugh12
@klocugh12 4 месяца назад
When life gives you LeMans, make... a cartridge dump 😅
@ralphmunoz4582
@ralphmunoz4582 4 месяца назад
Nice! That’s some good work!
@Mrshoujo
@Mrshoujo 4 месяца назад
Last time I checked, Atari 8-bit cartridge dumpers (at least the 1 I used) could automatically save the ROM contents as a binary loadable program already. It doesn't take much. You start a file with the Atari Binary File header which (and I need to refresh my mind on this) is 6 bytes. 255, 255, start load address lo byte- hi byte, end load address lo-hi. Then the bulk of the data, then the next segment loads at a specific address (and I forget what it is) & all binary load files on Atari do this. It loads the Start or Init run address in 2 byte lo-hi address fashion. For cartridges, it's usually the same address because cartridges use the OS Run vector. It's been quite some time & I need to look at my books about this, but it's super easy to dump cartridges on the Atari 8-bit & then binary load & run them. And it usually works unless they put in a copy protection routine to what we called "poke itself out of memory" since you can't over write a ROM. 👍
@8_Bit
@8_Bit 4 месяца назад
Regular C64 cartridges that map at $8000 are a bit easier; once saved they can be loaded into memory and then started by either pressing your reset button or SYS 64738. But these Ultimax cartridges, originally intended for the MAX Machine console, are a bit trickier. I imagine it'd be possible to automate this process but I assume nobody's bothered since it would be more work. By the way, there are some Commodore cartridges (VIC-20 and C64) that also do that same "poke itself out" copy protection trick. They probably got it from the Atari.
@comchia4306
@comchia4306 4 месяца назад
That game reminds me a lot of Road Fighter, which I used to play a lot on a PS1 Konami classics disc. That's super cool what you're able to do with 6502 assembly! I adore the major educational detail you put in your videos. I'd like to learn that language in more depth to achieve a life goal of making a new game for an old platform. Keep up the good work!
@8_Bit
@8_Bit 4 месяца назад
I love Road Fighter!
@comchia4306
@comchia4306 4 месяца назад
Tbh, if I didn't look at the release date, I would've figured that this was a Road Fighter knockoff. :P It also gives me a vibe of Sega's Monaco GP, from 1979.
@8_Bit
@8_Bit 4 месяца назад
@@comchia4306Yes, it's primarily inspired by Monaco GP. All these early HAL Laboratory games are actually clones of arcade games that were popular in Japan at the time.
@rdoetjes
@rdoetjes 4 месяца назад
I’ve got a very bad memory of this game. There was an arcade version and when I was 10 we went to Spain and I saw there was a credit on the game. There were some teenagers 16-18 talking and smoking (back then you were allowed to smoke and drink in the arcade section of the hotel - good ole times). And I press start. It so happened that the guy had put on some cash and was first smoking before he was going to play. He literally punched me so hard in the face that it knocked me down to the floor and I saw double. And one of the other guys kicked me in the side before they quickly returned to the cabinet and started to play. Whilst I was rolling in agony and tears.
@thenorseguy2495
@thenorseguy2495 4 месяца назад
I love these videos. Although I have no idea about what we are doing😂
@HelloKittyFanMan
@HelloKittyFanMan 3 месяца назад
Haha, "...my 'Lemons' cartridge..."!
@cromulence
@cromulence 4 месяца назад
Le mans is great and all, but have you seen the '24 hours of lemons?'
@striderskorpion
@striderskorpion 4 месяца назад
Funnily enough, RU-vid's automatic captions spell it lemons.
@TheStevenWhiting
@TheStevenWhiting 4 месяца назад
I'm from the UK, I've been saying the S for over 40 years!
@johnsobota6234
@johnsobota6234 4 месяца назад
This was so dang tasty. Good one, Robin!
@robalderden5888
@robalderden5888 4 месяца назад
TY. To start TMP you can also do: SYS 2^15 (perhaps a little easier to remember)
@Murrlin27
@Murrlin27 4 месяца назад
That was fun!!
@JustWasted3HoursHere
@JustWasted3HoursHere 4 месяца назад
Just to be sure I checked Google translate and "bouns" is not a French word.
@AureliusR
@AureliusR 4 месяца назад
Yeah if they wanted to say bonus, it would say something like "prix" or maybe "prime"
@weedmanwestvancouverbc9266
@weedmanwestvancouverbc9266 4 месяца назад
One thing I noticed about this game is the has a very similar character set to a lot of classic games on coin-ops of the era.
@JustWasted3HoursHere
@JustWasted3HoursHere 4 месяца назад
One other tiny glitch is at 24:57 with the stoplight. It seems to go from red to red to yellow to CYAN instead of green, but that may be because of a video capture artifact.
@fnjesusfreak
@fnjesusfreak 4 месяца назад
It may be because the lights are actually cyan in Japan (this being Japanese-developed).
@JustWasted3HoursHere
@JustWasted3HoursHere 4 месяца назад
@@fnjesusfreakInteresting! Indeed Hal Labs would go on to create some of the most iconic games ever for the NES.
@radioweebdx7680
@radioweebdx7680 4 месяца назад
Fortunately the world Bonus in French is La Prime, so it was a typo
@Lion_McLionhead
@Lion_McLionhead 4 месяца назад
Suspect the best way to try out a cross compiled program on real hardware without owning it is to make a cartridge & try plugging it in at a museum or trade show.
@jakubkrcma
@jakubkrcma 3 месяца назад
Le ManS 😉 Just kidding - wrote this only to obey the instructions at the start of the video. 🤣
@j.tann1970
@j.tann1970 4 месяца назад
That game is a classic early example that bad game logic has been around many years. What do I mean? Well, bad game logic is when a game does not do something you'd expect from what you experience in real life. Things like in current survivor games you could need a log to create just 1 plank when in reality 1 log will create a few planks or in this case your car having a light cone at night to show you have your headlights on but the other cars don't! lol
@Kris_M
@Kris_M 4 месяца назад
I'm leaving a comment because it makes me feel better.
@markjreed
@markjreed 4 месяца назад
Lemans in English is usually pronounced with the S. In French you don't say the N either; you just say the A through your nose. :)
@afogh2
@afogh2 4 месяца назад
Instead of the JMP $E037 a generic solution would be JMP ($FFFC)
@000jimbojones000
@000jimbojones000 4 месяца назад
hi there.... there is a game called Hades on the c64 which cannot be completed because it glitches out. someone pointed out its because the corruption starts at the beginning of the basic rom... is there a way to fix it?
@8_Bit
@8_Bit 4 месяца назад
Interesting, I hadn't heard of that one. I looked into it a bit and it looks like the best version around was by Ian Coog of Hokuto Force, and if he couldn't fix it 100% then I doubt I could do better! I'll see if I can find out any more info about it.
@TheHighlander71
@TheHighlander71 4 месяца назад
I've noticed that you change the contents of address $01 in the monitor program on the fly, but it's usually done between an SEI and CLI command in a program. Why can you safely change $01 in that monitor? I also noticed that your block copy code uses as SEI but appears to be missing a CLI. I'm sure the code you call probably does a SEI again first, but for good measure I think I would include a CLI anyway :) Dumping this code and making it run has been fun to watch. Thanks for another crystal clear explanation.
@8_Bit
@8_Bit 4 месяца назад
Super Snapshot does lots of behind-the-scenes magic to make the monitor behave like its independent of the C64 its running on. It tracks what location $01 should be from the user's perspective, but is actually dynamically changing it in the background, along with other registers, as needed, so it's safe. re: not CLI'ing at the end, I think it's actually safer the way I've done it, as a rule. The Ultimax has no built-in ROM at all (no KERNAL, nothing) and it's up to the cartridge code to initialize CPU registers and flags. The first thing LeMans does upon boot/reset is SEI, in fact. If I CLI'd first then maybe an IRQ would happen before the initialization code ran, and maybe that would be bad. If I found the game didn't work properly without a CLI then I'd investigate why and add one to the init if necessary, but then I'd probably consider that a bug that the cartridge didn't properly initialize interrupts itself.
@TheHighlander71
@TheHighlander71 4 месяца назад
@@8_BitSome super snapshot magic going on there! I've always wondered what the likelihood is of things going wrong if I changed $01 around without disabling interrupts. Maybe a fun experiment :) Not CLI'ing makes sense when you put it like that. Basically you're writing a prequel to the original initialisation. Disabling interrupts a little earlier is probably a good idea. Thanks
@desertfish74
@desertfish74 4 месяца назад
Fun episode. BOONS
@soothcoder
@soothcoder 4 месяца назад
Could you use labels to calculate the basic end pointer? Ditto could you use an expression to convert the start address into a petscii sys string? Putting all this together would make a pretty handy macro if it worked.
@8_Bit
@8_Bit 4 месяца назад
It should be possible in this assembler to use labels for the pointer to the end of BASIC, but I think it's beyond TMP's abilities to handle the PETSCII sys string unfortunately, so some amount of hard-coding is necessary. However, I've seen at least one modern 6502 cross-assembler that can do the whole thing including the string very cleanly.
@soothcoder
@soothcoder 4 месяца назад
@@8_Bit hmm it can do logical expressions and basic arithmetic but doesn’t seem to do left/right shift. But could you use multiplication or division to do the shifting? Then you could use and to mask and just add 30 hex. Now to go spin up an emulator (haven’t played with C64 coding in …. Ooh 35 years maybe?) I love your videos - very amusing to watch you fix 40 year old bugs!
@JSRFFD2
@JSRFFD2 4 месяца назад
I'm not an expert in TMP but I wonder if it has an "include binary" pseudo op so you can simply ORG $900 and then include the binary. Though in a real 1541 that include might be painful to do on every assembly run.
@donwald3436
@donwald3436 4 месяца назад
The next part is writing the patched data to a PROM?
@chainq68k
@chainq68k 4 месяца назад
This is a comment I made about how to pronounce Le Mans correctly, but it did not made me feel better. I want my money back.
@dermito
@dermito 4 месяца назад
Danke!
@8_Bit
@8_Bit 4 месяца назад
Thank you!
@dermito
@dermito 4 месяца назад
@@8_Bit Thank *you*, Robin! I'm always amazed at how much in-depth info you are able to provide around the topics you address. And please be aware that you absolutely do explain complicated matters well enough for anybody who is sufficiently interested in the topics presented :).
@gcherowars6758
@gcherowars6758 4 месяца назад
So when we addressing what causes the timer to tick faster later on?
@8_Bit
@8_Bit 4 месяца назад
There's at least one more video coming in a few weeks that will address that. Sorry I didn't state that in this video.
@C64TV
@C64TV 4 месяца назад
So what was the deal with the timer going faster? Was it a bug or a "feature"?
@8_Bit
@8_Bit 4 месяца назад
I think it's a feature, and that'll be covered very fully in the 3rd (and final?) video in April.
@greatquux
@greatquux 4 месяца назад
There’s going to be a part 3 to complete the Lemans Trilogy… right?! I mean we gotta find out how it’s calculating the time and everything. I just need confirmation. 😂
@8_Bit
@8_Bit 4 месяца назад
Yes, it should be out in a few weeks :)
@00Skyfox
@00Skyfox 4 месяца назад
I’ve had Lemans on floppy disk for a good 35+ years now. Were you not able to find it on a .d64?
@8_Bit
@8_Bit 4 месяца назад
I just wanted to learn (and show) how to do all these things (dump a cartridge, make it RUNnable) on my own.
@lucahitman
@lucahitman 4 месяца назад
maybe it would also be better to increase the duration of the message on the screen by a couple of seconds. now it’s too short
@c0v3n4n7
@c0v3n4n7 4 месяца назад
Is there any chance that you could do a series of programming a C64 game from scratch, with Turbo Macro Pro?
@8_Bit
@8_Bit 4 месяца назад
Maybe! Meantime, have you already seen my code walkthroughs for some of my already-made games in Turbo Macro Pro? I have a playlist called "C64 Game Development" on my channel page. Some of the video titles are "My First Paid Game Dev: Code Walkthrough of Frogs And Flies on the Commodore 64", "Exploring Marz: C-64 6510 Assembly Minigame Code Walkthrough", and my friend's game "Making a New Commodore 64 Game: 1nvader".
@c0v3n4n7
@c0v3n4n7 4 месяца назад
@@8_BitThank you kindly for your message. I'm going through your videos and I'm now starting that series. Saw yesterday the 1nvader and Darren did an awesome job. Your explanation is also super helpful. I'm starting reading the books you recommend but my brain doesn't compute Assembler yet :) Much study to do yet.
@AndyDo
@AndyDo 3 месяца назад
Is there a reasonable way to reverse this? If I want a CRT from a disk or tape, I assume it has to be modified to call the cartridge ram space, but it'd be cool to see the inverse.
@8_Bit
@8_Bit 3 месяца назад
If you've got an actual ".crt" cartridge image for use with emulators or Kung-Fu Flash etc, then check out the cartconv command line utility that's included with VICE emulator. It can go back and forth from binary, and .crt image. There's no automated way that I know of to go from what I show in this video, but with some experience it's fairly easy to examine the code in a machine code monitor and identify and extract the actual binary.
@chessdominos
@chessdominos 4 месяца назад
Posting this comment it makes me feel better.
@bluerizlagirl
@bluerizlagirl 4 месяца назад
Why not just set gfxsrc=$1900 and only copy 16 pages in the first run, instead of copying the graphics data twice?
@8_Bit
@8_Bit 4 месяца назад
We're mimicking how the MAX Machine "sees" the cartridge. The Max's CPU can see the full 8K of the cartridge from $E000-$FFFF. The Max's VIC-II can see the upper 4K of the cart, $F000-$FFFF, but it sees it in the equivalent of the C64's bank 0 at effectively $3000. The upper 4K of the cartridge may contain both graphics and code/data, not just graphics, so it needs to be at both locations in the C64.
@bluerizlagirl
@bluerizlagirl 4 месяца назад
@@8_Bit Ah. So the C64 still needs to see what's at F000-FFFF, but the VIC II needs to see it at 3000-3FFF because it doesn't have a full set of address lines? And in MAX mode, the address select logic is tricked to map the VIC II to the cartridge space?
@8_Bit
@8_Bit 4 месяца назад
I think that's more-or-less it, yes. 65XX architecture typically requires ROM at the end of memory since the CPU vectors (particularly reset) are at $FFFx, so that's where the cartridge had to be mapped, and typically requires RAM at the start of memory (because zero page and especially the stack are located at $0000-$1FFF. So given that the VIC-II can only see 16K and it for sure needs to see RAM which is way down at $0000-$07FF, they needed some way of bringing the cartridge ROM into that same 16K range. The MAX Machine and a C64 in "Ultimax" mode do this re-arranging automatically, but since our C64 is not in Ultimax mode we have to simulate that arrangement with this copying.
@csbruce
@csbruce 4 месяца назад
10:27 Page-aligning the source data also makes the copying faster, since there will be no page crossing with the indexed addressing. 11:34 You could amortize the «bne loop» by unrolling the loop a little. 14:48 Might look a little nicer with a space: «2023 SYS 2062». 15:43 I've heard it pronounced more as "le-mawh": ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-FDhofK4CNwQ.html 17:01 Must be "Typoglycemia": Aoccdrnig to a rscheeahcr at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer be at the rghit pclae. The rset can be a toatl mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. 21:03 Copying the cartridge data from a lower location works around the problem of not being able to SAVE location $FFFF.
@donwald3436
@donwald3436 4 месяца назад
It's definitely pronounced lemons lol.
@dougjohnson4266
@dougjohnson4266 4 месяца назад
.
@8_Bit
@8_Bit 4 месяца назад
Thanks Doug!
@thejackofeverything7961
@thejackofeverything7961 4 месяца назад
Funny how if you mispronounce anything not in your language, "if your american" everyone tries to correct you, but if you correct anyone for mispronouncing anything in ameican english people call you a "race car driver 😉" . Pull the sticks outta there people.
@der.Schtefan
@der.Schtefan 4 месяца назад
Uhm, it's pronounced Leeehmaaaan, like the baaaaaaank? Thaaaaaanks . ;)))))))
@der.Schtefan
@der.Schtefan 4 месяца назад
Oh, I feel so much better now. Thanks
Далее
BBC Master 512: It's a PC, no really it is!
24:00
Просмотров 73 тыс.
99.8% Compatible? The C64 Mode of the Commodore 128
1:02:11
Wikipedia, C64 OS Edition (Preview 1)
10:25
Просмотров 2,9 тыс.
43-Year-Old INPUT Bug Fixed: From C64 to VIC-20
35:56
Water powered timers hidden in public restrooms
13:12
Просмотров 702 тыс.
SuperCPU "Sky Travel" Easter Egg Hunt for Commodore 64
34:47
The Real Reason Robots Shouldn’t Look Like Humans
1:27:20
iPhone socket cleaning #Fixit
0:30
Просмотров 18 млн
КАКОЙ SAMSUNG КУПИТЬ В 2024 ГОДУ
14:59