Jump to content
doctorclu

What would a PRIOR statement look like in hex?

Recommended Posts

Originally posted here:

 

FifthPlayer, on 23 Sept 2018 - 11:32 AM, said:snapback.png

 

This is very easy to do. You only need to set bit 5 on GTIA's PRIOR register. It's only a tiny change, but it is a code change.

 

Where the two sprites overlap you will get a third color.

 

I realized this was the cool ability I discovered while hacking Miner 2049er where they had the green helmet for Bounty Bob. I'd love to add this ability to the Moon Patrol sprite hack we are doing. I work mostly with hex editors so I was wondering what this PRIOR register would look like in hex?

 

I found this reference on De Re Atari:

post-4709-0-42423400-1537794031.png

 

Another question I have is: would the fifth bit also be the fifth mode? If so D6 and D7 would be 00?

 

But the main question so I can search for it in the code is what the hex code would be for the PRIOR statement?

 

-------

Below is the graphics hack of Moon Patrol for the Atari 800 where the colors and sprites have already been altered. Combined color would offer a third color for the windshield on the moon buggy.

post-4709-0-10508600-1537794391.png

 

Here is the rom if you'd like to reference it for the above question on the PRIOR statement:

moon-test-n2b.bin

Edited by doctorclu

Share this post


Link to post
Share on other sites

Look for the PRIOR address, not the value. It's hard to tell what value might be used, lot of prior combinations have same results, or the function is different, but the difference cannot be seen in the image. Prior is typically set to static value, so the code should be simple

 

lda #x

sta prior

 

Prior has good description on Wiki: https://en.wikipedia.org/wiki/CTIA_and_GTIA#PRIOR_.24D01B_Write

Edited by R0ger
  • Like 2

Share this post


Link to post
Share on other sites

Combined color would offer a third color for the windshield on the moon buggy.

 

Not in this case.. as one of the color is black (color 0) so it will not produce third color when ORed (ok, it will, but it will be the same as the second color - pink/purple).

  • Like 1

Share this post


Link to post
Share on other sites

I thought the background showing in the windshield gave the effect of it being a windshield either reflecting or being seen thru the window. It's looks like a window while it does that! but another color could be cool elsewhere.. lights etc.. who knows...

Edited by _The Doctor__

Share this post


Link to post
Share on other sites
Here's a quick disassembly of your ROM using my disassembler, dis:
Looks like PRIOR is set at 82E9:
    lda #$11            ; 82E9: A9 11
    sta PRIOR           ; 82EB: 8D 1B D0

 

So you can edit location 82EA to change the PRIOR setting.

  • Like 2

Share this post


Link to post
Share on other sites

Look for the PRIOR address, not the value. It's hard to tell what value might be used, lot of prior combinations have same results, or the function is different, but the difference cannot be seen in the image. Prior is typically set to static value, so the code should be simple

 

lda #x

sta prior

 

Prior has good description on Wiki: https://en.wikipedia.org/wiki/CTIA_and_GTIA#PRIOR_.24D01B_Write

 

Some good information and what you had was spot on with what Xuel would confirm later.

 

Not in this case.. as one of the color is black (color 0) so it will not produce third color when ORed (ok, it will, but it will be the same as the second color - pink/purple).

 

Yeh the color combinations are not ideal that is true. Still something that could be useful to learn and help in some graphical hack.

 

 

Here's a quick disassembly of your ROM using my disassembler, dis:
Looks like PRIOR is set at 82E9:
    lda #$11            ; 82E9: A9 11
    sta PRIOR           ; 82EB: 8D 1B D0

 

So you can edit location 82EA to change the PRIOR setting.

 

 

Thanks for introducing me to the 6502/6510 disassembler. I tried to get that running under dos prompt in Wine (have a Mac) and so far no luck. However I have worked with Distella on the 2600 and got that to work. So with a bit more effort I should be able to get this to work too.

 

Didn't find 82E9, 82EB, or 82EA, but I did find A9 11 (3 occurrences) and 8D 1B D0 (1 occurrence). This is really cool to see how this plays out.

 

Loved this bit of information:

lda #$11 ; 82E9: A9 11

sta PRIOR ; 82EB: 8D 1B D0

 

In another hack I was given some good advice on how to look at a hex level to identify player missile objects in 2600 code.

 

In that case it was STA CXCLR" (85 2c) Is this STA=8 and CXCLR=5 2c?

Here we have STA PRIOR 8D 1B D0 Is this STA=8 and PRIOR=D 1B D0?

 

For LDA #$11 would that be LDA=A #$=9 11=11?

 

Changed 11 to 00 and had some fascinating results that show me perhaps why this featured was not turned on before now:

post-4709-0-81314300-1537806316.png

 

And oddly characters layers did not blend:

post-4709-0-48158500-1537806421.png

 

But certainly gives us something to play with.

Edited by doctorclu

Share this post


Link to post
Share on other sites

Yeah, you're not looking for the sequence 82EA but rather looking the byte at that address. In the ROM it will be at location 2EA since the ROM starts at $8000.

 

The sequence A9 11 is broken down as:

 

A9 = LDA IMMEDIATE

11 = VALUE

 

And 8D 1B D0 breaks down as:

 

8D = STA ABSOLUTE

1B = Low byte of absolute address

D0 = High byte of absolute address

 

Here you can see that PRIOR is located at address $D01B.

 

You can kinda break down the instruction bytes like you showed since generally all opcodes that start with A are some kind of LD instruction, e.g. LDA, LDX, etc. and all opcodes that start with 8 are some kind of ST instruction. But that's doesn't fully generalize. For example $A8 is TAY, i.e. transfer register A to register Y. This is a single-byte, 2 cycle instruction whereas LD instructions are all at least 2 bytes and 3 cycles.

 

The Altirra Hardware Reference Manual is the definitive guide. Trevin's page is a decent quick reference.

 

To get the players to blend you need to set bit 6 of PRIOR but note players 1&2 blend only with each other and likewise for players 3&4.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks for introducing me to the 6502/6510 disassembler. I tried to get that running under dos prompt in Wine (have a Mac) and so far no luck. However I have worked with Distella on the 2600 and got that to work. So with a bit more effort I should be able to get this to work too.

 

On Mac, you should be able to run it from the shell. You don't need Wine. You may need to add execute permissions with "chmod +x dis". Then just type "dis".

  • Like 1

Share this post


Link to post
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.

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...