Jump to content
IGNORED

[ATTN 5200 Programmers] 5200 Splash Screen Revisited


Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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) :roll:

 

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :roll: ). I haven't run Pitfall! or Mountain King on either of these emulators.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...