DEBRO Posted July 5, 2002 Share Posted July 5, 2002 Cafeman was testing code on a 2 port 5200 and found that the game would not load. Later he suggested that the problem may have been related to the splash screen code and he was right. Remember we were copying the BIOS to RAM so we could manipulate the century. Well, at the time this code was written, I didn’t have a 2 port BIOS ROM and really didn’t think about the differences. The main difference is for the 2 port BIOS Atari added code to check for PAL compatibility. This in essence increased the BIOS ~ 22 bytes. We have to compensate for this in our programs so here is an updated splash screen code. Here is a code snipplet ;============================================================================ ; C O N S T A N T S ;============================================================================ BIOSCOPYLOCATIONHIGH = $FD COPYLOCATION2PORTLOW = $58 COPYLOCATION4PORTLOW = $42 INXINSTRUCTION = $E8 NOPINSTRUCTION = $EA RTSINSTRUCTION = $60 CODESTART = $4000 ;============================================================================ ; Z P - V A R I A B L E S ;============================================================================ org $19 tempLow ds 1 tempHigh ds 1 org CODESTART ;========================================================DisplayStartupScreen ; DisplayStartupScreen ; ; Copy the startup code for the 5200 BIOS into RAM. This is done so the ; copyright date can be Y2K complient. We store this data into RAM because ; this routine will only be called once (during game start up) and this saves ; precious ROM space. This RAM will be reused later in the program too. ; ; I chose to use page 6 and 7 to store my routine. You can place it anywhere ; in RAM you like as long as the BIOS doesn't touch it :) ; DisplayStartupScreen ldy #$00 lda #BIOSCOPYLOCATIONHIGH sta tempHigh ; ; here is where we check to see if this a 2-port or 4-port system ; a 4-port system will have an inx instruction ($E8) in location $FD32 ; a 2-port system will have a lda instruction ($AD) in location $FD32 ; lda $FD32 cmp #INXINSTRUCTION ; if there is no inx instruction here then this is a bne TwoPortSystem ; 2-port system FourPortSystem lda #COPYLOCATION4PORTLOW sta tempLow jmp CopyBIOSLoop1 TwoPortSystem lda #COPYLOCATION2PORTLOW sta tempLow CopyBIOSLoop1 lda (tempLow),y sta $0600,y ; I chose to use page 6 but you can move it :) iny bne CopyBIOSLoop1 ldy #$50 inc tempHigh CopyBIOSLoop2 lda (tempLow),y sta $0700,y dey bpl CopyBIOSLoop2 lda #<CopyrightMessage ; Point the copyright read to our ROM sta $0724 ; address. lda #>CopyrightMessage sta $0725 ldx #$0B lda #NOPINSTRUCTION ; ; here we place NOP instructions in the routine. It was easier than removing ; the unwanted instructions. ; NOPLoop sta $0732,x dex bpl NOPLoop lda #RTSINSTRUCTION ; Place a rts to return from the subroutine sta $0750 ; This replaces the jmp instruction jsr $0600 rts ; ; Copyright message for start code in ATASCII ; CopyrightMessage .byte $63,$6F,$70,$79,$72,$69,$67,$68,$74,$00 ; "COPYRIGHT " .byte $52,$50,$50,$51,$00 ; "2001 " .byte $61,$74,$61,$72,$69 ; "ATARI" I hope everyone had a wonderful 4th of July. Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted July 5, 2002 Share Posted July 5, 2002 Is this code expected to work with BOTH the 2-port and the 4-port now, Dennis? Quote Link to comment Share on other sites More sharing options...
Dutchman2000 Posted July 5, 2002 Share Posted July 5, 2002 Dennis- Could you e-mail me the complete code? I'm still using your first attempt.. Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted July 5, 2002 Share Posted July 5, 2002 Am I really the only one of the 5200 homebrewers who owns and uses 2-port? Or, maybe everybody hasn't got to the 'real machine' stage yet? Quote Link to comment Share on other sites More sharing options...
OldGuru Posted July 6, 2002 Share Posted July 6, 2002 Am I really the only one of the 5200 homebrewers who owns and uses 2-port? I used to have one till it broke - back then, when it used to work, we didn't have the Y2K splash screen coded yet... I then got a 4-port console and since then never tried the code on a 2-port console... Thanks for testing that, it could have been quite a pain to ship cartridges to people and then find out about the 2-port vs. 4-port BIOS differences... OG Quote Link to comment Share on other sites More sharing options...
+Mitch Posted July 6, 2002 Share Posted July 6, 2002 If any of you guys want a copy of the 2 port BIOS to test with the emulators, I put it up on my web site here. Mitch http://atari7800.atari.org Quote Link to comment Share on other sites More sharing options...
DEBRO Posted July 8, 2002 Author Share Posted July 8, 2002 Is this code expected to work with BOTH the 2-port and the 4-port now, Dennis? Sorry, I've been out of town. Yeah this change will work for both the 2-port and the 4-port. The trick is to check location $FD32. If an inx instruction is there, then it is a 4-port system. @Dutchman2000 That is the whole code. Replace the old one with the one I posted here. @Mitch Yeah, I grabbed the ROM from your site to test the change. Thanks Quote Link to comment Share on other sites More sharing options...
Dutchman2000 Posted July 8, 2002 Share Posted July 8, 2002 I'm having some problems implementing this new code. If i ORG it at $19 as in the above code, it creates a BIN of about 50k. If I change the starting address to $4000, it doesn't like the value of TempLow. Any ideas? Quote Link to comment Share on other sites More sharing options...
DEBRO Posted July 8, 2002 Author Share Posted July 8, 2002 I'm having some problems implementing this new code. If i ORG it at $19 as in the above code, it creates a BIN of about 50k. If I change the starting address to $4000, it doesn't like the value of TempLow. Any ideas? Oops...I forgot to add the org for the code. Thanks Dutchman. I'll edit my original post to include this. Do keep in mind that this is a routine that you should use in your code as you see fit. You can copy this routine and really place it anywhere in your code you would like. As for the temp variables used, well you could use any variable you would like. Quote Link to comment Share on other sites More sharing options...
calamari Posted July 13, 2002 Share Posted July 13, 2002 Here's a slighly more ROM efficient version of the beginning of DEBRO's code.. The original was fine, but I've been doing too much 2600 coding lately, so the replacement version saves 2 instructions (or 5 bytes) DEBRO's original code (above): lda $FD32 cmp #INXINSTRUCTION ; if there is no inx instruction here then this is a bne TwoPortSystem ; 2-port system FourPortSystem lda #COPYLOCATION4PORTLOW sta tempLow jmp CopyBIOSLoop1 TwoPortSystem lda #COPYLOCATION2PORTLOW sta tempLow My modified code: lda #COPYLOCATION2PORTLOW;Assume 2 port system ldx $FD32 cpx #INXINSTRUCTION ;Is this a 4 port? bne NotFourPort ;Jump if not lda #COPYLOCATION4PORTLOW;Yes, 4 port system NotFourPort sta tempLow One weird thing is that the original version of the y2k fix that I got way back when seemed to work fine on a real 2 port (and on the emulator).. but these new ones work too, so it's cool Thanks DEBRO for making the fix! calamari Quote Link to comment Share on other sites More sharing options...
DEBRO Posted July 13, 2002 Author Share Posted July 13, 2002 Cool calamari. I like tight optimized 6502 code too since I've been looking at the 2600 Incidently Dan's original ClearRAM routine can be reduce too. I think the one I have saves ~2 to 5 bytes can't remember how many cycles Quote Link to comment Share on other sites More sharing options...
DEBRO Posted July 13, 2002 Author Share Posted July 13, 2002 One weird thing is that the original version of the y2k fix that I got way back when seemed to work fine on a real 2 port (and on the emulator).. but these new ones work too, so it's cool I got to thinking about this and I don't see how the original code would've worked on a 2-port system. Is it possible that all 2-port 5200s don't have the PAL code? As I stated before the PAL code shifted the splash screen data ~22 bytes. Hmmm...I don't have the original, original code (or can't find it in my source directory) but I guess it's also possible that the original code may have copied more code than it needed from ROM. Oh well, this one is safer anyway. Good night. Quote Link to comment Share on other sites More sharing options...
+Mitch Posted July 13, 2002 Share Posted July 13, 2002 I got to thinking about this and I don't see how the original code would've worked on a 2-port system. Is it possible that all 2-port 5200s don't have the PAL code? That is correct. There are a few 2 ports that came from the factory with the original (4 port) Bios. I know because I have one. Mitch http://atari7800.atari.org Quote Link to comment Share on other sites More sharing options...
DEBRO Posted July 13, 2002 Author Share Posted July 13, 2002 That is correct. There are a few 2 ports that came from the factory with the original (4 port) Bios. I know because I have one. Mitchhttp://atari7800.atari.org Well, I guess that would explain it (except for it running on the emulator). I guess the 2-port 5200 the oringinal code was tested on had the 4-port BIOS. Interesting Quote Link to comment Share on other sites More sharing options...
+Mitch Posted July 13, 2002 Share Posted July 13, 2002 Well, I guess that would explain it (except for it running on the emulator). I guess the 2-port 5200 the oringinal code was tested on had the 4-port BIOS. Interesting I think the reason it works in the emulators is because the 5200 Bios ROM that is on all the emulation sites is the 4 port one. Mitch http://atari7800.atari.org Quote Link to comment Share on other sites More sharing options...
DEBRO Posted July 13, 2002 Author Share Posted July 13, 2002 I think the reason it works in the emulators is because the 5200 Bios ROM that is on all the emulation sites is the 4 port one. Mitchhttp://atari7800.atari.org True, but I think calamari ran this in an emulator using the 2-port BIOS on your site but I can't be sure about that. Calamari should be sending me a test ROM later so I can see why it works on the emulator. Quote Link to comment Share on other sites More sharing options...
+Mitch Posted July 13, 2002 Share Posted July 13, 2002 I think calamari ran this in an emulator using the 2-port BIOS on your site but I can't be sure about that. Calamari should be sending me a test ROM later so I can see why it works on the emulator. Hmm, I haven't used your test program but I know using the 2 port bios with Pitfall and Mountain King in the emulator crashes it. Which emulator are you using, by the way? Mitch http://atari7800.atari.org Quote Link to comment Share on other sites More sharing options...
DEBRO Posted July 13, 2002 Author Share Posted July 13, 2002 Hmm, I haven't used your test program but I know using the 2 port bios with Pitfall and Mountain King in the emulator crashes it. Which emulator are you using, by the way? Mitchhttp://atari7800.atari.org I use Atari800WinPLus and VSS. I tried it on both and they work fine (of course these are emulators ). I haven't run Pitfall! or Mountain King on either of these emulators. Quote Link to comment Share on other sites More sharing options...
calamari Posted July 14, 2002 Share Posted July 14, 2002 For all interested in a test ROM & source (with the old code): http://www.azstarnet.com/~jeffryj/mario.zip calamari Quote Link to comment Share on other sites More sharing options...
calamari Posted July 14, 2002 Share Posted July 14, 2002 oops! I have c:5200 where I was changing the rom, and c:emuatari800.. guess where the emu was .. anyways, after really changing to the 2 port rom in the emulator, only the new version seems to work. calamari 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.