Jump to content

Photo

2 PF colors on the same line


12 replies to this topic

#1 atari2600land OFFLINE  

atari2600land

    Waffles:

  • 10,721 posts
  • Man's best invention. Ever.
  • Location:Salem, Oregon

Posted Thu Sep 1, 2016 2:52 AM

What I set out to do originally when I began learning Atari 2600 assembly was a port of the Odyssey 2 game I made about the Mr. Celery. While I ended up with a fun game, it wasn't what I set out to do. Now I'm going to attempt to make a straight port of the Odyssey 2 game. That begins with the title screen. I had the PF all one color, but then I thought "if I can remove the reflection of the PF0, PF1 and PF2, perhaps I could make them be a different color as well." I ended up with this:

celeryo1.png

Sort of a similarity to the Odyssey 2 title screen, shown here:

celeryo2titlescreen.png

And yes, the score will be displayed on the title screen as well, I just haven't gotten that far yet. I was just playing around with what I could do. But there won't be a high score function, the title screen took up more room than you can imagine.

I just was awed at the discovery I made and am wondering what other 2600 games have two different PF colors on the same scanline.

Attached Files



#2 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 21,636 posts
  • Location:The land of Gorch

Posted Thu Sep 1, 2016 7:15 AM

As you noted in your file, bit1 set in CTRLPF sets the color of the playfield from the 2 players...ignoring COLUPF. This feature was used quite often in early games that use PF score digits. But that's not the only way. Cycle time permitting, you can alter COLUPF at any point within a scanline.

#3 atari2600land OFFLINE  

atari2600land

    Waffles:

  • Topic Starter
  • 10,721 posts
  • Man's best invention. Ever.
  • Location:Salem, Oregon

Posted Fri Sep 2, 2016 3:09 AM

OK, this is stupid. The game now is displaying a copy of player 1 so there's two player 1s and just one player 0. I copied and pasted code from CollectMini so it shouldn't be doing this, yet it is. What I want to know is WHY? And how can I just make there be one player 1?!

Attached Files



#4 BNE Jeff OFFLINE  

BNE Jeff

    Moonsweeper

  • 286 posts
  • Location:Virginia, USA

Posted Fri Sep 2, 2016 3:11 AM

Its more obvious in the earlier games and is one of the features that reveals that the Atari was developed as a Pong machine with a cpu attached.  (the PF colors in score mode). 

 

If you have multiple players then try checking page 40 in the Stella manual. (NUSIZ)


Edited by BNE Jeff, Fri Sep 2, 2016 3:30 AM.


#5 SpiceWare OFFLINE  

SpiceWare

    Quadrunner

  • 11,304 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Fri Sep 2, 2016 7:58 AM

As BNE Jeff pointed out it's NUSIZ. Since you know it's player1 that's wrong, let Stella help you!

1) hit ` to enter the debugger

 

2) In the Prompt, type in the command trapwrite NUSIZ1
Screen Shot 2016-09-02 at 8.52.02 AM.png

3) Click Exit. Stella will stop right away. You'll probably see what's wrong.

 

4) If not, it's helpful to click on the TIA tab
Screen Shot 2016-09-02 at 8.52.14 AM.png

5) when done type in the command cleartraps

Screen Shot 2016-09-02 at 8.52.24 AM.png



#6 atari2600land OFFLINE  

atari2600land

    Waffles:

  • Topic Starter
  • 10,721 posts
  • Man's best invention. Ever.
  • Location:Salem, Oregon

Posted Fri Sep 2, 2016 6:07 PM

I decided to switch the code over to the program that uses the Combat stack trick. Only trouble is, I want a playfield that isn't mirrored or anything. I tried the trick I did for the other program to make an unmirrored playfield, but there are a bunch of black lines. I was wondering if it is possible to get rid of them and have it be a solid green color like it was if I had mirrored it.

 

Attached Thumbnails

  • celeryo5.png

Attached Files



#7 BNE Jeff OFFLINE  

BNE Jeff

    Moonsweeper

  • 286 posts
  • Location:Virginia, USA

Posted Sat Sep 3, 2016 3:28 AM

 

2) In the Prompt, type in the command trapwrite NUSIZ1

 

I tried it...Cool :thumbsup:   I'll have to remember it.  I assume it works for most or all registers.. 



#8 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 21,636 posts
  • Location:The land of Gorch

Posted Sat Sep 3, 2016 3:38 PM

Count yer cycles. Also, the second write to PF1 is being done too soon (cycle 31). Should be cycle 38 minimum.

#9 zilog_z80a OFFLINE  

zilog_z80a

    Space Invader

  • 12 posts

Posted Wed Jun 28, 2017 1:22 PM

As you noted in your file, bit1 set in CTRLPF sets the color of the playfield from the 2 players...ignoring COLUPF. This feature was used quite often in early games that use PF score digits. But that's not the only way. Cycle time permitting, you can alter COLUPF at any point within a scanline.

 

^you can alter COLUPF at any point within a scanline.^

 

HI, i`m newbie, can you pls show me a little code doing that?

 

would be really really helpfull !! cheers! and ty

 

pd: "learning asm "


Edited by zilog_z80a, Wed Jun 28, 2017 1:47 PM.


#10 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 21,636 posts
  • Location:The land of Gorch

Posted Sat Jul 1, 2017 5:05 PM

If you understand how a 6-sprite score routine works (which updates the sprite graphic registers mid-scanline after each has been drawn), changing PF color is basically the same principle - updating the color register after a certain number of cycles has passed (but before the start of the next scanline). The added limitation to this is that there are no VDEL and HM registers for PF - the visible portion of a scanline occupies cycles 22 to 75 (cycle 76 marks the beginning of the next scanline)...so a PF color change can only be possible every 4th horizontal position of the 160. "Bus stuffing" (i.e. using a coprocessor to handle the updates using a 2-cycle opcode) could lower this limitation to every 3rd horizontal position.
ldx   #$0F   ;2
Block:
 sta   WSYNC  ;3 00
 lda   #$80   ;2 02
 sta   COLUBK ;3 05
 ldy   #$07   ;2 07
Delay:
 dey          ;2 09/14/19/24/29/34/39
 bne   Delay  ;2 12/17/22/27/32/37/41
 lda   #$30   ;2 43
 dex          ;2 45
 sta   COLUBK ;3 48
 bne   Block  ;2 50
 sta   WSYNC  ;3 00
 stx   COLUBK ;3 03
This example draws a 15-scanline band (the X register used to count down the number of lines). Each scanline begins by resetting the background color to dark blue. A delay loop using the Y register wastes cycles on approach to the middle of the scanline, and then the background color is changed to dark red exactly at cycle 48 - the center of the visible screen. At the end of the Block loop, the X register is reused to set the background color to zero (black) on the following scanline.

#11 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 21,636 posts
  • Location:The land of Gorch

Posted Sat Jul 1, 2017 5:46 PM

Note that an easy way to alter the playfield pixel color exactly at cycle 48 is to use "Score mode" by setting bit 1 on + bit 2 off in register CTRLPF. Instead of using COLUPF for the pixel color, the display will use COLUP0 for the left half of the screen, and COLUP1 for the right half. This is a native hardware ability of the machine, so you might not find it very useful. Here's a code example similar to the above that alters the background color at a different point in each scanline.
ldx   #$0B   ;2
Block:
 sta   WSYNC  ;3 00
 lda   #$80   ;2 02
 sta   COLUBK ;3 05
 txa          ;2 07
 tay          ;2 09
 lda   #$30   ;2 11
Delay:
 dey          ;2 13/18/23/28/33/38/43/48/53/58/63
 bne   Delay  ;2 16/21/26/31/36/41/46/51/56/61/65
 dex          ;2 67
 sta   COLUBK ;3 70
 bne   Block  ;2 72
 sta   WSYNC  ;3 00
 stx   COLUBK ;3 03
The X registers' value is passed to Y for the delay time...so the result is that the color change uses a diagonal pattern instead of directly in the center of the screen.

#12 zilog_z80a OFFLINE  

zilog_z80a

    Space Invader

  • 12 posts

Posted Sun Jul 2, 2017 4:28 PM

Note that an easy way to alter the playfield pixel color exactly at cycle 48 is to use "Score mode" by setting bit 1 on + bit 2 off in register CTRLPF. Instead of using COLUPF for the pixel color, the display will use COLUP0 for the left half of the screen, and COLUP1 for the right half. This is a native hardware ability of the machine, so you might not find it very useful. Here's a code example similar to the above that alters the background color at a different point in each scanline.

ldx   #$0B   ;2
Block:
 sta   WSYNC  ;3 00
 lda   #$80   ;2 02
 sta   COLUBK ;3 05
 txa          ;2 07
 tay          ;2 09
 lda   #$30   ;2 11
Delay:
 dey          ;2 13/18/23/28/33/38/43/48/53/58/63
 bne   Delay  ;2 16/21/26/31/36/41/46/51/56/61/65
 dex          ;2 67
 sta   COLUBK ;3 70
 bne   Block  ;2 72
 sta   WSYNC  ;3 00
 stx   COLUBK ;3 03
The X registers' value is passed to Y for the delay time...so the result is that the color change uses a diagonal pattern instead of directly in the center of the screen.

 


ty Nukey Shay, sometimes i can imagine things but when people like you teachs is realy great!! cos this puts my ideas in the "yeh my friend you are in the right way"

 

ty very very much.

 

cheers.



#13 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 21,636 posts
  • Location:The land of Gorch

Posted Mon Jul 3, 2017 3:27 AM

No tech...I'm just some guy who hacks. BTW that second example illustrates the problem of "fine tuning" color changes within a scanline: there's only a 5-cycle difference between the lines, but you can see how far 5 cycles goes.




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users