1 2
4 5
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
Here's what I've been busy doing the last couple weeks... NOTE: The sound will be a little rough on some of these videos! Please watch your volume. (2013-08-14 videos removed, they are old.)
EDIT by feos 2019-06-22 Introductory Guide to Commodore C64 TASing in BizHawk
EDIT by feos 2018-08-29 Things to remember:
  • The C64 has two joystick ports. Some games require port 1. Some games require port 2. If your input doesn't seem to be working, switch ports.
  • Games that are published on magnetic media have very slow access times. Be patient with them.
  • Cartridges require no intervention; they will load immediately.
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
Accuracy tests: (more to be added later) Sound (2013-08-14 link removed.) Status: Really needs work. You can load the PRG files directly into the interim build to test them (they are direct conversions from the SID files) Envelope test: Commando Filter test: Progressiva Waveform abuse test: Opium 2 Waveform sync test: R1D1 Graphics coming soon..
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Robocop 3 required some firmware. What file do I need?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Active player (406)
Joined: 3/22/2006
Posts: 708
Yesssssssssssssss You've got some baller Moon Patrol skills, son. I did notice with that game the explosion sounds seemed rather quiet. I don't remember it being like that on C64 hardware or other emulators. Maybe it's related to the sound issues you're having?
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
feos wrote:
Robocop 3 required some firmware. What file do I need?
FW is required for all games. The ones I am testing with are from the VICE 2.4 emulator (which can be found online) however any firmware for the C64 should work. The four that are required are: basic, kernal, chargen, and dos1541. They should be placed in C64\Firmwares. Robocop 3 won't work just yet anyway- that cartridge mapper isn't implemented (it's unique). I don't envy the NES team- there are only 28 known mapper configurations for C64.
Heisanevilgenius wrote:
Yesssssssssssssss You've got some baller Moon Patrol skills, son. I did notice with that game the explosion sounds seemed rather quiet. I don't remember it being like that on C64 hardware or other emulators. Maybe it's related to the sound issues you're having?
Thanks :) The sound has been completely rewritten since these videos, and sounds a lot more like the real thing.
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
Based on the interest expressed, mapper 0005 (Ocean) has been added to the interim. This includes games like Robocop 3 and Terminator 2. Sprites aren't coded yet so it's not really playable, but it loads and executes fine. When sprites are added, it should be ready to play.
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
(2013-08-14 videos removed, they are old.) I'm awful at this. There's still a long road ahead, but at least some things are playable. More videos to come once more is implemented.
Post subject: Re: Commodore 64 Bizhawk core
Player (26)
Joined: 8/29/2011
Posts: 1206
Location: Amsterdam
Oh wow, I would love to see C64 support here! I grew up with that computer :)
Joined: 10/3/2004
Posts: 138
SaxxonPike wrote:
feos wrote:
Robocop 3 required some firmware. What file do I need?
FW is required for all games. The ones I am testing with are from the VICE 2.4 emulator (which can be found online) however any firmware for the C64 should work. The four that are required are: basic, kernal, chargen, and dos1541. They should be placed in C64\Firmwares.
Something to consider - there are slight differences in the original KERNAL ROMs available, and earlier games may have issues if they assume a specific KERNAL. I forget the specifics off-hand, but the different KERNALs handle color RAM differently when clearing the screen. That's why I say earlier games, because many games handle this themselves instead of relying on the KERNAL, and any game that handles color RAM on its own will not have issues on any KERNAL that I'm aware of.
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
I've been gone for a long time. When I started this core, I found out how much I did not know about the Commodore 64. I have since brushed up on the technology used, Mosfet behavior, and the internals of the 6502. I think the issue I was running into was the main processor is a 6510 which doesn't have the exact same line behavior as the 6502 internally. It IS binary compatible but the extra lines allow the processor to behave in a multi-chip system. I plan to return to this project soon with a much-expanded knowledge of the system, with the assistance from someone who has decapped and analyzed some of the MOS chips used. It became very obvious that the data sheets weren't enough to explain the behavior of the C64. There are quite a few bugs and quirks especially with the timer chips (6522 and 6526) that are essentially taken advantage of or compensated for by pretty much every game that uses them. I'm sorry I vanished. The project was a little too much for me to handle. But I didn't research it well enough then. I'll be much more prepared when I come back to work on it.
LocalH wrote:
SaxxonPike wrote:
feos wrote:
Robocop 3 required some firmware. What file do I need?
FW is required for all games. The ones I am testing with are from the VICE 2.4 emulator (which can be found online) however any firmware for the C64 should work. The four that are required are: basic, kernal, chargen, and dos1541. They should be placed in C64\Firmwares.
Something to consider - there are slight differences in the original KERNAL ROMs available, and earlier games may have issues if they assume a specific KERNAL. I forget the specifics off-hand, but the different KERNALs handle color RAM differently when clearing the screen. That's why I say earlier games, because many games handle this themselves instead of relying on the KERNAL, and any game that handles color RAM on its own will not have issues on any KERNAL that I'm aware of.
Most programmers use the high-address vectors (think $FFxx) that jump to other addresses within the Kernal, if they use the Kernal at all. This usually reduces the chance that a new/custom Kernal would interfere. Basic ROM hasn't changed much at all, and people seem to be a lot more willing to use these addresses directly.
Joined: 6/8/2013
Posts: 3
Just wanted to let you know I'm looking forward to seeing what you can do, I think C64 TASs would be a great addition to the site!
Joined: 10/3/2004
Posts: 138
SaxxonPike wrote:
Most programmers use the high-address vectors (think $FFxx) that jump to other addresses within the Kernal, if they use the Kernal at all. This usually reduces the chance that a new/custom Kernal would interfere. Basic ROM hasn't changed much at all, and people seem to be a lot more willing to use these addresses directly.
Agreed. While there were three main revisions to the KERNAL ROM, there was only ever one BASIC ROM in the C64 (and thus, in the C128's C64 mode as well). Even the C65's C64 mode used the same BASIC ROM (but with the fill byte changed from $AA to $FF). There was also a different KERNAL for both the SX-64 and the PET64/4064 (although neither one of these are likely targets for a TAS, as software that runs on those systems will generally run on a standard C64, good to be aware though, just on the off chance that someone encounters a game that only runs properly on either of those systems). Here is a list of known C64 KERNAL differences. Here's another list, with an easier to read breakdown of the exact changes between the R2 and R3 KERNALs. There is apparently also a difference in the RS-232 timing table, which would only apply if a game uses the KERNAL to handle serial communications through a user-port modem. Any game that bit-bangs for such communication would be immune to these changes. I wasn't necessarily saying that these would be major issues, just wanted to make sure you were aware of them on the off-chance that a game requires the "old" KERNAL (which is usually R2, although the earliest US NTSC C64s had R1) to prevent color bugs. It wouldn't be an issue of KERNAL code moving around and games using the KERNAL without the jump table, but it's an issue of different KERNAL revisions using different values when writing to color RAM while clearing the screen with a LDA #$93 : JSR $FFD2 type combination. Any game that manually clears screen and color RAM is once again immune to these differences (as is likely to be most of the C64's game library outside of the first couple of years of the C64's life). Better to ensure that these won't be problems now, before people are able to start making C64 TAS runs :P
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
There are many kinds of C64 games and there's no way to really tell from the program data what system it's supposed to be playing on, which kernal you are supposed to be using, and even which CIA chip (older C64s, really old ones, used 6526A which didn't have some of the bugs the standard 6526 did; I'm not really sure why they went with the buggier ones.. maybe oversupply?) The best we can do is put the Kernal, Basic, Charrom, and any peripheral firmware checksums (the 1541 for example) and also the C64 type which can be selected by the TASer. Almost all games designed for NTSC setups will play okay on the PAL setups (since most of the time the interrupts are driven by scanline index) but going the other way tends to be sketchy (mostly because the NTSC setup has 263 scanlines while PAL has 315.) Some games autodetect this and compensate for it. Ultimately, it's not up to the game to decide what region it's for, but the user to make sure that they are using a machine that is compatible. I anticipate there will be instances where a specific kernal/basic firmware are chosen due to exploitable bugs, and C64 type. Games written in BASIC probably won't care, and others that have a lot of idle will also probably have no difference between machine type execution-wise (other than the fact that frame-driven games will run faster on NTSC than PAL, but would otherwise be unaffected unless it needed or assigned the video chip to interrupt on the extra scanlines.) There is a large number of setups you could have as a result of the number of peripherals you can use. But because software houses didn't always know what kind of setup a user might be using (other than taking a really good guess at PAL vs NTSC due to geographic location) they had to be more flexible. Another issue is the availability of original media. Some games saved their high scores to the program disk. So even if you own the original game and dump it yourself, you can still end up with a different image. It would be preferable to use the original disks from the DISKS folder in GameBase64 Extras in order to settle any sort of dispute, as these are maintained in large part by Pete Rittwage (among others at c64preservation.com) with the sole mission to preserve original disks in a way they can be archived and reproduced. Anyway.. enough with that rant. Right now, things need to "just work". I'm consulting with a number of people who are working on a variety of MOS chips at the transistor level, translating them into logic gates which I can more readily work with. Items of interest are the 6510 (which is the 6502 with tri-state bus to make it play nice in a multi-chip system), 6522 (VIA, how the bugs work), 6526 (CIA, this timer chip is also quite buggy but more progress has been made here), 6581 (SID, virtually everything about this chip is now known), 6567/6569 (VIC, these video chips are essentially identical except for some constants for NTSC/PAL), and they are doing some more stuff with the 6502 as well. But we already have a solid 6502 core, used for other things. The C64 emulation is currently lacking the ability to halt the 6502 processor properly when the video chip demands the bus on both ph1 and ph2. Here's why:
BA      With this signal, the VIC indicated that the bus is available to
        the processor during the second clock phase (ø2 high). BA is
        normally high as the VIC accesses the bus mostly during the first
        phase. But for the character pointer and sprite data accesses, the
        VIC also needs the bus sometimes during the second phase. In this
        case, BA goes low three cycles before the VIC access. After that,
        AEC remains low during the second phase and the VIC performs the
        accesses. Why three cycles? BA is connected to the RDY line of the
        processor as mentioned, but this line is ignored on write accesses
        (the CPU can only be interrupted on reads), and the 6510 never does
        more than three writes in sequence (see [5]).
I couldn't figure out how to buffer reads for the 6502 core. The way it's configured, this value is needed immediately when read and there's no way for me to predict what the CPU wants to do until I actually execute its code. Suppose it was reading a timer chip value that decrements by 1 every cycle. The value will be incorrect by however many cycles the CPU needed to be delayed. Since a "badline" happens (usually) every 8 scanlines, and the VIC has to "stun" the processor for 40 cycles (not counting the additional cycles needed for sprite access if they are used) the likelihood of the wrong timer value being read is extremely high if the game is counting cycles (this technique is often used for "stable rasterlines", a graphics trick.) Some timing-sensitive games, when they get consistently incorrect timer values, will have a cascading effect: they could cause some very obvious graphics anomalies or perhaps not even run at all. I didn't want to muck about with the 6502 core. Any ideas would be greatly appreciated.
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
I'm almost done cracking a game. I took Legend of Blacksilver, a 4-disk RPG, and put it onto a cartridge, also while applying some fixes. In doing so, I learned an immense amount about the way the C64 works on the inside. As this project nears release, I'll actually be using Bizhawk as a debugger because of its live-ram-view abilities. Big image incoming. http://i188.photobucket.com/albums/z246/switchback3/bizhawk-lob_zps87e87adc.png I think before I get too far into testing disk drive things, I'm going to try and work on the file-level just to make sure the guts of the computer itself are working as they should. There are a couple of small (yet significant) changes I'll be making tonight. This version of the game already works as a result.
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
I completely rebuilt the PLA according to the research in this document, very recently written by "skoe", the guy who also designed the EasyFlash cartridge a lot of us use these days: http://skoe.de/docs/c64-dissected/pla/c64_pla_dissected_r1.1_a4ss.pdf Here's the current state of things according to a C64 diagnostic cartridge: This isn't going to tell us anything about 100% accurate emulation- only that the vital parts aren't obviously failing. Pretty much everything in the right column is handled by the timer chips (the interrupts that are failing are definitely the 6526 timers) so there's much work to be done there. These chips are pretty buggy to begin with. The 6581 sound chip failure is due to the lack of filters, I imagine. What blows my mind is that it passed the 6567 (video) chip test. I'm convinced it doesn't check much other than the register I/O works. I know for a fact it needs a lot of work, especially for sprites (sometimes the bottom sprite line is missing.) And even if it checks those, it's the PAL 6569 chip that's actually emulated so the scanlines aren't even the same in number of lines and length in cycles. I do know for a fact that it checks video interrupts and it'd let me know if those failed, so when it claims that interrupts failed, it's not this chip. It's no surprise everything in the left side passed- that's all 6502 core, ROM and RAM. There are more comprehensive tests that I need to compile into cartridge form to find out in depth if there's anything truly off.
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
How far along are we? Here's Oxyron - Dawnfall. There are only a couple things in this demo that don't appear correctly. And of course, filterless SID music. Link to video
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
Getting serious. Terminator 2 Link to video Uridium+ Link to video
Editor
Joined: 3/31/2010
Posts: 1466
Location: Not playing Puyo Tetris
SaxxonPike, I wanted to say thanks for all the work your doing.
When TAS does Quake 1, SDA will declare war. The Prince doth arrive he doth please.
Patashu
He/Him
Joined: 10/2/2005
Posts: 4043
Me and some of my friends will be excited for C64 TASing :D
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
hegyak wrote:
SaxxonPike, I wanted to say thanks for all the work your doing.
Thanks for your interest! :D It's been a lot of fun working on this. There's still a lot of work to be done however.
Emulator Coder
Joined: 6/8/2005
Posts: 236
Location: Madison, Wisconsin
Save states are added now. I'm working on sound issues when restoring states that should not affect the saves. Should work for cartridges and PRGs.
Joined: 6/8/2013
Posts: 3
Glad to see you're still working on this. :) I was wondering how the long load times would be handled in a TAS but I guess it's just a case of fast-forwarding it in the emulator when you're doing the TAS and then when watching an encode of it skipping to when the game is loaded.
Joined: 7/17/2012
Posts: 543
Location: Switzerland
I'm probably very stupid or blind, but where can we find the play button to start the tapes?
My Citra 3DS rerecording movie files test repositery: https://cutt.ly/vdM0jzl Youtube playlist "Citra Tests": https://cutt.ly/AdM0wg9 http://www.youtube.com/user/phoenix1291
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Can't you type RUN?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 7/17/2012
Posts: 543
Location: Switzerland
No.
My Citra 3DS rerecording movie files test repositery: https://cutt.ly/vdM0jzl Youtube playlist "Citra Tests": https://cutt.ly/AdM0wg9 http://www.youtube.com/user/phoenix1291
1 2
4 5