Jump to content

Photo

A Two-Player Competitive and Co-Op "Tetris" for the Atari 2600 VCS

tetris atari 2600 homebrew

186 replies to this topic

#176 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • 180 posts

Posted Wed Nov 21, 2018 12:24 AM

Thanks alot for sharing so much information!

I'm now decrementing and I see what you mean

Some follow up questions..

 

Can I DCP the a register somehow instead of a byte?

 

What does this do?

    eor  #$FF      ; ...
    adc  #$F9      ; it's complicated...
 
And the magic number 46?
That's it for now  :)


#177 AkashicRecord OFFLINE  

AkashicRecord

    Chopper Commander

  • Topic Starter
  • 171 posts
  • Programming Tetris

Posted Wed Nov 21, 2018 7:43 AM

Thanks alot for sharing so much information!
I'm now decrementing and I see what you mean
Some follow up questions..
 
Can I DCP the a register somehow instead of a byte?
 
What does this do?
    eor  #$FF      ; ...
    adc  #$F9      ; it's complicated...
 
And the magic number 46?
That's it for now  :)

That positioning routine is basically a perfectly calibrated subtraction loop. Because of HBLANK, we need to push the minimum coordinate out a bit so that the subtraction doesn't cross zero too early. "46" ends up being a suitable value for the loop.

The other instructions make up for the lack of a bitwise Negation instruction in the 6502 instruction set. What we can do however, is flip all of the bits of the value, giving the one's-complement of the number.  Using some bit-trickery and exploiting wrap-around, we can massage this value a bit and get exactly what is needed.

The addition following the Exclusive-OR, adjusts the value via wraparound so that the value falls within a signed range of -7 and 7. The left shifts place the value in the appropriate area of the HMxx register...that is to say that only the upper 4 bits are relevant, don't think of those 4 shifts as mathematical, they are just moving a bit pattern into place. (HMOVE semantics are the real complicated thing here.)

One other factor here is that we have to treat that value as an unsigned value, otherwise you wouldn't be able to target pixels 128-159. That's why I say, "it's complicated."
 
 
As for the first question, DCP works memory and gives a free compare with the A register, saving 1 byte and 2 cycles.  There wouldn't be any reason to compare against a register that you are decrementing!

And no way to INC or DEC the A register because it is designed for ADC and SBC.  :)

Edited by AkashicRecord, Wed Nov 21, 2018 12:20 PM.


#178 AkashicRecord OFFLINE  

AkashicRecord

    Chopper Commander

  • Topic Starter
  • 171 posts
  • Programming Tetris

Posted Thu Nov 22, 2018 1:34 PM

I feel guilty not posting any updated code yet, but I've been kind of busy the past few days.  I did manage to make some adjustments to my kernel strategy though, so it looks like I should be able to pull of great-looking 1-Player game modes (as far as detail is concerned.)  The 2P modes (at first) will probably have simple, solid color schemes though.  (Mostly because I'm striving for a single-scanline kernel as much as possible.)

 

I'm trying to make this kernel as "generic" as possible so that I can repurpose it in upcoming games, so it is taking a little more time than expected.  (I was originally aiming for a two-month development timeline, but that may have been extended a teensy bit.)

 

 

...anyone interested in an "Excitebike" type of game for the 2600?  :D



#179 Kosmic Stardust OFFLINE  

Kosmic Stardust

    Princess Rescuer

  • 18,392 posts
  • Location:Milky Way Galaxy

Posted Fri Nov 23, 2018 12:04 PM

I really like this idea. It should have been obvious. :)

I'll experiment with writing the frame counter to VBLANK for an alternating effect every other frame.

Won't this cause some tubes to screw up the draw sequence?

 

Vblank uses a "blacker than black" color, essentially 0V over composite. Solid black is actually a few millivolts higher than this signal level. This is why Nintendo told developers not to use colors 56-63 on the color pallet tables because this signal could be misconstrued as a vblank signal by the tube or digital set.

 

Just curious, will use of this function to blank out an entire scanline potentially trigger a midscreen vblank (resulting in stuttering screen, rolling, or "unusable signal" display on some sets but not others?)



#180 AkashicRecord OFFLINE  

AkashicRecord

    Chopper Commander

  • Topic Starter
  • 171 posts
  • Programming Tetris

Posted Fri Nov 23, 2018 12:56 PM

Won't this cause some tubes to screw up the draw sequence?
 
Vblank uses a "blacker than black" color, essentially 0V over composite. Solid black is actually a few millivolts higher than this signal level. This is why Nintendo told developers not to use colors 56-63 on the color pallet tables because this signal could be misconstrued as a vblank signal by the tube or digital set.
 
Just curious, will use of this function to blank out an entire scanline potentially trigger a midscreen vblank (resulting in stuttering screen, rolling, or "unusable signal" display on some sets but not others?)


Writing to VSYNC would definitely screw up the signal, but VBLANK should be fine.

I'm close to putting this stuff to the test later today...but not on real hardware.

#181 Kosmic Stardust OFFLINE  

Kosmic Stardust

    Princess Rescuer

  • 18,392 posts
  • Location:Milky Way Galaxy

Posted Fri Nov 23, 2018 1:07 PM

Writing to VSYNC would definitely screw up the signal, but VBLANK should be fine.

I'm close to putting this stuff to the test later today...but not on real hardware.

Okay gotcha. :)



#182 AkashicRecord OFFLINE  

AkashicRecord

    Chopper Commander

  • Topic Starter
  • 171 posts
  • Programming Tetris

Posted Fri Nov 23, 2018 6:04 PM

Okay gotcha. :)

 

...I could be wrong however, so maybe someone with more experience can chime in.



#183 JeremiahK OFFLINE  

JeremiahK

    Chopper Commander

  • 223 posts
  • Location:Indiana, USA

Posted Fri Nov 23, 2018 7:24 PM

I don't understand all the intricacies, but I do know that if you leave VBLANK permanently disabled, the screen rolls.  Even with proper VSYNCing and timing.  So it does have some importance in the image syncing process.



#184 AkashicRecord OFFLINE  

AkashicRecord

    Chopper Commander

  • Topic Starter
  • 171 posts
  • Programming Tetris

Posted Sat Nov 24, 2018 11:23 AM

I took a few minutes to throw together a quick test program that just outputs 7 blank lines (over a blue background) and then outputs a VBLANK line and repeats this pattern 24 times down the screen.  This seems perfectly fine in Stella and RetroArch for Android, but I have no idea what this would do on a real CRT.
 
Until further notice, I think I'll press on with this idea and continue to integrate it into the new kernel for testing.
 
Attached File  VBLANK-test.bin   2KB   45 downloads

Edited by AkashicRecord, Sat Nov 24, 2018 1:00 PM.


#185 JeremiahK OFFLINE  

JeremiahK

    Chopper Commander

  • 223 posts
  • Location:Indiana, USA

Posted Sat Nov 24, 2018 9:13 PM

I just tested this, and it works perfectly on my CRT.



#186 AkashicRecord OFFLINE  

AkashicRecord

    Chopper Commander

  • Topic Starter
  • 171 posts
  • Programming Tetris

Posted Sat Nov 24, 2018 10:14 PM

I just tested this, and it works perfectly on my CRT.


Excellent, can't appreciate it enough.

It might not be a necessary tactic, but it's definitely nice to know that it works.

#187 AkashicRecord OFFLINE  

AkashicRecord

    Chopper Commander

  • Topic Starter
  • 171 posts
  • Programming Tetris

Posted Tue Dec 18, 2018 2:11 PM

Just a small heads-up.

I'm still plugging away at the game, but the most recent two weeks or so found me a new full-time job (with overtime) so I've had to focus on that recently.

I did have a sort of business meeting with an acquaintance over dinner as well, discussing this and future games.

I also did a little retro window shopping for an old VCS, so I have my eyes on a 4-switcher now...and the guys at the shop were pretty interested in seeing a cartridge of this game in 2019. :)





Also tagged with one or more of these keywords: tetris, atari 2600, homebrew

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users