rropuma07 Posted October 29, 2015 Share Posted October 29, 2015 Hi guys, I'm new here, but my friends and I are designing a fully functioning Atari 7800 for a college class. Our design will be synthesized on an FPGA. I've looked all over the internet and can't seem to solve my confusion over the Hidden Control Register. I first learned about it on Dan B's post here https://sites.google.com/site/atari7800wiki/7800-control-register Seems pretty simple, but this explanation seems inconsistent with the BIOS code located here http://www.atarihq.com/danb/files/7800bios.asm My understanding is that anytime a value is written to INPTCTRL, it is writing to the Control register. Firstly, many times, the value #$16 is written to the control register, but I thought the control register was a four bit value. What is the purpose of writing a 5 bit value to a 4 bit register? Secondly, during execution of the code located at LF7D4 (though the code is actually executed from the RIOT RAM as part of the Atari 2600 initialization), there are stores and loads to TIA registers even though the lock bit on the control register has not been set. This isn't consistent with the idea that the control register can be written by storing to any address from $00-$1F. Lastly, the control register lock bit never really seems to be set. The only time I can find it set is at LF880, but that is when the self-test fails. I would expect the lock bit to be set in both Atari 2600 and 7800 initialization before we do an indirect jump to the start of the programmer's code. I suppose it's possible that the programmer is expected to set the lock bit, but it doesn't make much sense to require the programmer to do that. Can anybody shed some light on these questions? If not, is there anyone I might be able to contact or any other forum I might be able to post to? Cheers! 1 Quote Link to comment Share on other sites More sharing options...
fiddlepaddle Posted October 29, 2015 Share Posted October 29, 2015 Sorry I can't answer any of your questions, but just want you to know this project is really cool... 1 Quote Link to comment Share on other sites More sharing options...
DanBoris Posted October 29, 2015 Share Posted October 29, 2015 Hi guys, I'm new here, but my friends and I are designing a fully functioning Atari 7800 for a college class. Our design will be synthesized on an FPGA. I've looked all over the internet and can't seem to solve my confusion over the Hidden Control Register. I first learned about it on Dan B's post here https://sites.google.com/site/atari7800wiki/7800-control-register Seems pretty simple, but this explanation seems inconsistent with the BIOS code located here http://www.atarihq.com/danb/files/7800bios.asm My understanding is that anytime a value is written to INPTCTRL, it is writing to the Control register. Firstly, many times, the value #$16 is written to the control register, but I thought the control register was a four bit value. What is the purpose of writing a 5 bit value to a 4 bit register? Secondly, during execution of the code located at LF7D4 (though the code is actually executed from the RIOT RAM as part of the Atari 2600 initialization), there are stores and loads to TIA registers even though the lock bit on the control register has not been set. This isn't consistent with the idea that the control register can be written by storing to any address from $00-$1F. Lastly, the control register lock bit never really seems to be set. The only time I can find it set is at LF880, but that is when the self-test fails. I would expect the lock bit to be set in both Atari 2600 and 7800 initialization before we do an indirect jump to the start of the programmer's code. I suppose it's possible that the programmer is expected to set the lock bit, but it doesn't make much sense to require the programmer to do that. Can anybody shed some light on these questions? If not, is there anyone I might be able to contact or any other forum I might be able to post to? Cheers! Looking at the schematics it appears that any writes to the TIA addresses go to both the control register and TIA, this would explain the writes to the TIA you are seeing. I am not sure why they are setting bit 4 ($10) when writing to the control register. Maybe this was something that was going to be used but they changed their minds. The lock bit would be set by this code before going into 2600 mode... LF831: LDA #$FD STA COLUPF Quote Link to comment Share on other sites More sharing options...
rropuma07 Posted October 29, 2015 Author Share Posted October 29, 2015 Thanks for the quick reply Dan! That explains a lot about what's happening in 2600 mode. I'm still not sure how the lock bit gets set in 7800 mode since the code that is executed before it jumps to the start of the cartridge is: LF7B9: LDX #$16 ; finally, back to something important STX INPTCTRL ; switch out bios and use reset vector TXS ; on cart to start the game. SED JMP(LFFFC) Unless the lock bit is set somewhere else, which wouldn't make sense because that would yield this write to the control register pointless. Quote Link to comment Share on other sites More sharing options...
DanBoris Posted October 30, 2015 Share Posted October 30, 2015 Thanks for the quick reply Dan! That explains a lot about what's happening in 2600 mode. I'm still not sure how the lock bit gets set in 7800 mode since the code that is executed before it jumps to the start of the cartridge is: LF7B9: LDX #$16 ; finally, back to something important STX INPTCTRL ; switch out bios and use reset vector TXS ; on cart to start the game. SED JMP(LFFFC) Unless the lock bit is set somewhere else, which wouldn't make sense because that would yield this write to the control register pointless. I took a look at the source code for a couple 7800 games and they all lock the system into 7800 mode at start up. This makes sense since the 2600 games obviously would not know to do this, but 7800 games would have been programmed to handle this. Quote Link to comment Share on other sites More sharing options...
rropuma07 Posted October 30, 2015 Author Share Posted October 30, 2015 Ah okay. It makes sense that they would allow the programmer to decide if they wanted to use the TIA instead of the MARIA. This definitely clears up all our questions about the control register. Thanks again for all the help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.