Editor
Joined: 3/31/2010
Posts: 1466
Location: Not playing Puyo Tetris
Alyosha wrote:
^that error with samples should have also been fixed with the last pull request, I even downloaded and compiled from master just to make sure, did you get that error message from a build after the pull request was merged hegyak?
Let me double check this. I probably didn't Rebase like I should have. Edit: After Rebasing, I can't find mF8_sega. Was it not included in the Merge? Edit 2: Checking the Solution File, the mF8_sega file was never included in the solution. Adding it manually, corrected this issue. Expect a commit soon to fully correct this.
When TAS does Quake 1, SDA will declare war. The Prince doth arrive he doth please.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
I do see the bug in the health bars now though, thanks for pointing it out! Looks like a bug in playfield priority setting, should be pretty simple to fix, I'm surprised it didn't come up before. EDIT: oh yeah, I had trouble with that file too. mF8_sega.cs was included in the merge, and it shows up properly in the the folders, but for some reason isn't recognized by the project. I don't understand why though. EDIT: So it turns out this is a more complicated issue then I originally suspected. What the game is doing is setting playfield priority like this: A5 04 LDA CXM0FB 85 0A STA CTRLPF So it's loading A from the collision register that keeps track of collisions between missile 0 and playfield/Ball. Then it uses this to set playfield priority at 0A. The problem is that the playfield priority bit is bit 2 of CTRLPF, but CXM0FB only uses bits 6 and 7. CXM0FB is a TIA read register, and as far as I know the CPU cannot write to the 2 bit of it (and anyway this would be a write to NUSIZ0 at 04 in the TIA write registers.) This is all very confusing. I don't see how bit 2 of CXM0FB could be 1, as needed to change the playfield priority in this way, unless there is something unmodelled about the physical arrangement of these registers. Still researching an explanation. EDIT AGAIN Ok, apparently this is a well known issue of deciding what to do when there are unused pins on the data bus. Stella's solution is to simply use the last value that was there for each unused pin. It also however gives the option to randomly drive the pins. Current AtariHawk code implicitly sets the pins to 0, since it's just returning a new byte with the appropriate collision bits set. Apparently the unused ones are 'usually' in there previous state enough to make the Stella approach more desirable. A bit sloppy to program something this way, but I'll try to account for it, since there are examples on real hardware that correctly display the health bar. Ok, so on the left we see the old glitch version where the health bars show through the background. On the right the fixed version where they dont. This is really just a programming error on the part of the game developer. Certainly he meant to write LDA #04, but forgot the '#' and simply wrote LDA 04 in whatever compiler he was using, a simple and common error. #04 is what is needed to change the playfield priority in the usual way. It is a stroke of luck that Loading CXM0FB doesn't change the bus state (04 being the last fetch and that register only effecting bits 6 and 7.) Any other situation would have made the error obvious. Ultimately I simply added a bus state variable that is tracked along with everyhting else to fix this. Were it not for such an obscure case I surely would never have even thought of it. Maybe future work would be to make the bus state part of the CPU, but maybe not I'm not sure how practical / useful that would be. Anyway that was an interesting excercise in bug hunting.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
After many hours trying to figure out the 4A50 mapper and what it was trying to do, and then giving up and looking at how Stella did it, I finally worked out the bugs to get it running. It turns out there was a rather serious bug in AtariHawk itself where PeekMemory actually pointed to ReadMemory in the system. This caused chaos when I tried to trace log out what was going, as the tracelogger peeks changed banks too when it shouldn't have. Once that got fixed it was only a matter of tracking down where banks weren't being changed properly. The ultimate problem was just an incorrectly placed closing bracket. :( Anyway this is still displaying things a bit Different then Stella, so I'll have to see why, but the test program looks perfect and anyway this is the only example game I could find. EDIT: turns out I just needed to add in a vblank delay in the same manner as the numerous other latch delays. The demo game draws the screen in a unique fashion using vblank and needed this delay to match up the drawing edges. With this inclusion the game draws perfectly, so it looks like 4A50 and the associated bugs are now resolved.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
So I was asked to look at Compumate as the next big bug to sort out. I had some time today so I dug into it. It turns out there were numerous bugs in both the mapper and core that needed to be sorted out. But, by comparing tracelogs between Stella and BizHawk I was able to sort everything out and get it running pretty quickly. (the program alternates drawing lines between frames, so it really does look like this if you only look at one frame) Of course just getting it loaded up is only a small part of the battle, as there is currently no way to send it any meaningful input, but it's a start! The most important things that came out of this is realizing that console startup needs to have improved accuracy for the compumate to work. The 'game' does not set the stack pointer appropriately before doing basic operations (as most games typicaly do) instead relying on the 6532 start up sequence. This sequence sends a reset signal to the 6507 which sets the stack pointer to FD. The current code does not utilize this start up sequence instead just setting everything to default, which for the 6507 is stack pointer 0, which unfortunately overlaps TIA addresses, corrupting the return address of a JSR. Anyway, I hardcoded in an initial stack pointer of FD simulating post reset behaviour, but I am ultimately not very satisfied with this approach and will probably try to use reset correctly, but right now I don't know how this will work with the current machinery.
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3575)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
Wow, nice work! Yeah, for meaningful input we need the computer peripheral set up. If you are interested in learning that process in bizhawk this is a great opportunity, if you are hoping to learn more parts of the system. If not, I can do that part, peripherals are a lot more involved and require some situational awareness
It's hard to look this good. My TAS projects
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
Adding the keyboard sounds well beyond my programming ability. I think I'll stick with fixing core bugs, but if you get the framework for it in place I will definitely help putting everything together and sorting out any issues. I made the initial commits with all necessary bug fixes so the system loads, so it's just waiting for the keyboard to put it all together. This also makes me think that paddle support would be great to have, but that is probably even harder then the keyboard.
Skilled player (1742)
Joined: 9/17/2009
Posts: 4986
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
I'm not sure if this is the right place to post, but the game Star Wars: The Empire Strikes Back seems to not exactly...work. Disregarding the black bars on the side of the screen, on BizHawk 1.11.6, pressing any of the buttons do not move the ship whatsoever. Given there's only 1 button on the controller I'm not sure what I'm doing wrong. Is it the emulator's fault or the game?
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
jlun2 wrote:
I'm not sure if this is the right place to post, but the game Star Wars: The Empire Strikes Back seems to not exactly...work. Disregarding the black bars on the side of the screen, on BizHawk 1.11.6, pressing any of the buttons do not move the ship whatsoever. Given there's only 1 button on the controller I'm not sure what I'm doing wrong. Is it the emulator's fault or the game?
Seems like it's working fine to me. The game expects you to hit 'reset' before you can play it, so make sure you do that, then it plays fine even on 1.11.6. The black lines are part of the Atari 2600 TIA and are not an error. I usually see them called 'The HMove Comb', it is a side effect of moving objects on screen.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
After a lot of staring at the code I finally resolved the high pitch sound bug that effects several games, notably Combat, so the tanks don't squeek anymore. I also rewrote most of the audio generation code to be closer to cycle accurate, although there are still a few minor bugs to sort out. I'm pretty happy to have gotten this done since it is now much simpler and sounds better.
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11492
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Just remembered. For encoding we have to crop top and bottom by 16 pixels each. Why are they even there if we need to remove them anyway?
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.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
feos wrote:
Just remembered. For encoding we have to crop top and bottom by 16 pixels each. Why are they even there if we need to remove them anyway?
Well, screen size for A2600 games was software controlled. Most games had 192 scanlines, but some had more (Tapper for example had 210.) The defaults are set for the maximum extent I believe.
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11492
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
So maybe our encoding isn't right? Like, we had to add overscan to SMS manually to make the output match the TV, otherwise it's aspect ratio was completely wrong. http://tasvideos.org/forum/viewtopic.php?t=15855 Maybe we should figure this out for atari too? Variable cropping doesn't sound like a prudent solution.
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.
Editor, Emulator Coder, Site Developer
Joined: 5/11/2011
Posts: 1108
Location: Murka
feos wrote:
So maybe our encoding isn't right? Like, we had to add overscan to SMS manually to make the output match the TV, otherwise it's aspect ratio was completely wrong. http://tasvideos.org/forum/viewtopic.php?t=15855 Maybe we should figure this out for atari too? Variable cropping doesn't sound like a prudent solution.
What do you mean, figure this out? All of this information is known and has been known for a very long time. The metadata that the 2600 core puts out is correct for NTSC; if you want square or as close to square as you'd ever get pixels, stretch the output image, originally 160px wide, to 275px wide.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
Also remember that the A2600 core has settings that control the output of the video window in Atari->Settings (NTSC/PAL) Top line /Bottom line. So you can open a game and make the cropping correct before dumping it. Not sure if this is what you want or not.
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11492
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
I dunno if I want square or not, I want a setup that would be correct and reliable. I doubt the picture on a TV gets different cropping depending on the generated height. Probably we shouldn't crop a all? Or crop differently?
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.
Editor, Emulator Coder, Site Developer
Joined: 5/11/2011
Posts: 1108
Location: Murka
feos wrote:
I dunno if I want square or not, I want a setup that would be correct and reliable. I doubt the picture on a TV gets different cropping depending on the generated height. Probably we shouldn't crop a all? Or crop differently?
I'm not sure what you mean by reliable; are you afraid that the encoder is going to sneeze on his keyboard and type the wrong number? There are no random factors here. As far as correct goes, what I just posted is correct, so use that.
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11492
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
You can't answer these directly?
feos wrote:
Probably we shouldn't crop a all? Or crop differently?
Reliable means I put it in the script and it works correctly for all situations. Right now the script is told to crop 16 from top and bottom, as I said. I also said that I don't know if square is close to authentic or not. You just say it's "correct".
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.
Fog
Emulator Coder, Experienced player (641)
Joined: 4/5/2014
Posts: 459
feos wrote:
You can't answer these directly?
feos wrote:
Probably we shouldn't crop a all? Or crop differently?
Reliable means I put it in the script and it works correctly for all situations. Right now the script is told to crop 16 from top and bottom, as I said. I also said that I don't know if square is close to authentic or not. You just say it's "correct".
I vote for no cropping, personally. Aspect ratio correction of 160x224 gives us 300x224, which is as close to 4:3 as you're going to get.
Editor, Emulator Coder, Site Developer
Joined: 5/11/2011
Posts: 1108
Location: Murka
feos wrote:
You can't answer these directly?
What are you talking about? I'm not sure how much more plain I can make it. The output from the emulator will be 160 pixels wide. Stretch it so it is 275 pixels wide, without altering the height. This will be correct 100% of the time for any NTSC game on any NTSC 2600. The end. Stop imaging complexity where there isn't any.
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11492
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Kangaroo (1983) (Atari) [!].a26 from Good2600 v3.14 (Missing 16) doesn't leave the core busy loop. CRC32: 1D961D5A MD5: 35AE38B0DCA275C89C565355CCEBD7AC SHA-1: 982B8016B393A9AA7DD110295A53C4612ECF2141
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.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
feos wrote:
Kangaroo (1983) (Atari) [!].a26 from Good2600 v3.14 (Missing 16) doesn't leave the core busy loop. CRC32: 1D961D5A MD5: 35AE38B0DCA275C89C565355CCEBD7AC SHA-1: 982B8016B393A9AA7DD110295A53C4612ECF2141
This was one of those games that had banks swapped internally. Added to the internal list with the others like Congo Bongo fixes it. The failure actually occured at the function that tries to differentiate between NTSC and PAL. Probably I should do something so silent crashes like these are avoided. EDIT: Done. Now the core will throw an error when a frame seems endless instead of just looping forever.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
Since the coleco turbo controller was fresh in my mind , I decided to implement the A2600 Driving controller since the concept is identical (and way easier since the angular resolution is much lower.) Now you can play Indy500 (and whatever other games use this controller, if there are any.)
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
I just made a fairly significant commit to Atari 2600 that improves HMove emulation. now various newer demos relying on precise Hmove behaviour (like Bang! and Flush) work. Also behaviour is much closer to Stella in "Hit HMOVE At Various Cycles After WSYNC Test (Bradford W. Mott) (1998) (PD)" although there are a couple remaining differences. Anyone using A2600 please keep an eye out for regressions.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
So it turns out that audio related variables were never being savestated in the core, oops! I refactored the audio code to allow easy savestating. Now sounds should play correctly when loading a state.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3826)
Joined: 11/30/2014
Posts: 2834
Location: US
In trying to sort out some recent regressions, I noticed some other bugs and also noticed that the core has fallen a bit behind in terms of accuracy and up to date TIA knowledge. I implemented some bug fixes to catch up a bit on some of the basics, but other things are still a work in progress. various timer tests now work (the knowledge to make them work was actually already written down on the document i linked in the first page of this thread,, I guess I just glossed over it!) Also the 32charnew demo which requires writes to RESP to delay the draw command (but not the position counter) now displays correctly. this one was quite tricky since as far as I could tell it's not written down anywhere that this is what happens. Anyway with these improvements the core is now (almost) back up to parity with Stella with the main deficiency being collision detection during HMOVE and hBlank when ENAB is written to. (And Journey Escape which is what originally led to this investigation.)