[stella] Earliest safe write to PF1 for asymmetrical playfield?

seagtgruff at aol.com seagtgruff at aol.com
Sat Jul 5 14:58:17 CDT 2008


A while back, I created a table for myself that shows the latest cycles at which you can write to the playfield registers, for each playfield pixel (plus the beginning of HBLANK). I don't know how well this will reproduce here, because it uses four special characters-- the division symbol, plus superscripts 0, 1, and 2. The superscripted numbers represent thirds, so a superscript of 0 is "no-thirds," a superscript of 1 is "one-third," and a superscript of 2 is "two-thirds." The chart shows the calculations for the two types of playfields, repeated and reflected. (What *do* we call the "non-reflected" playfield mode, anyway? :ponder:)

As I was putting together the calculations for the chart, I tested each value. Since this was more than a year ago, I don't remember how much testing I did on an actual 2600; my recollection is that I tested each and every value in the Stella and z26 emulators, and tested a few choice values on an actual 2600 ("heavy sixer") to verify the behavior of the emulators. I don't think I tested any values on my early-model 7800. Note that for most pixels, the calculated cycles increment by 1, but for some pixels there's an increment of 2 cycles. In those cases, I also tested the "skipped" cycle (and I believe I tested some of those on my "heavy sixer" as well, to be sure). What I found is that the playfield pixels will *not* change partway through the display-- i.e., you will get either the old value or the new value for the entire playfield pixel. For example, the values for the left copy of PF0 are cycles 22, 23, 24, and 26. If you write to PF0, and the write ends on cycle 25, then all of the third pixel of PF0 will display the old value, and all of the fourth pixel will display the new value. This makes sense, because it conforms to the fact that we must drop any fractional portion of a cycle.

Obviously, most of the time we'd want the entire playfield register to display either the old or the new value. However, there could conceivably be some cases where we'd want to change the playfield partway through the display, so that the first few pixels display the old value, and the last few pixels display the new value. The only legitimate example I can think of is where the change would make no difference for the first few pixels anyway (i.e., because they'd be the same for both values), and for some reason in a tightly-timed loop we can't manage the write for the new value at the optimum cycle, so we "fudge" by writing the new value at some other cycle that still gives us the results we're looking for.

This chart is like a spreadsheet showing the calculations, and gives more detail than most people need or want to see-- I did it this way purely for my own benefit (partly to document how each final value was obtained, and partly to help me easily spot any errors in the final values). The important values are the ones in the last row. For example:

======================================
| L. PF0 | 068  | 072  | 076  | 080  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  22² |  24º |  25¹ |  26² |
|        |  - ² |  - ² |  - ² |  - ² |
|        |  22º |  23¹ |  24² |  26º |
|        |------|------|------|------|
|        |  22  |  23  |  24  |  26  |
======================================

The first row shows the color clock on which each pixel of PF0 (left copy) begins. Then we divide the color clock by 3 to get the (fractional) machine cycle in the third row. Then we subtract two-thirds of a cycle to get the (fractional) machine cycle in the fifth row. Finally, we truncate any fractional portion to get the machine cycle in the seventh row.

Michael

=================
| HBLANK | 000  |
|        | ÷ 3  |
|        |  00º |
|        |  - ² |
|        |  75¹ |
|        |------|
|        |  75  |
======================================
| L. PF0 | 068  | 072  | 076  | 080  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  22² |  24º |  25¹ |  26² |
|        |  - ² |  - ² |  - ² |  - ² |
|        |  22º |  23¹ |  24² |  26º |
|        |------|------|------|------|
|        |  22  |  23  |  24  |  26  |
==================================================================
| L. PF1 | 084  | 088  | 092  | 096  | 100  | 104  | 108  | 112  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  28º |  29¹ |  30² |  32º |  33¹ |  34² |  36º |  37¹ |
|        |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |
|        |  27¹ |  28² |  30º |  31¹ |  32² |  34º |  35¹ |  36² |
|        |------|------|------|------|------|------|------|------|
|        |  27  |  28  |  30  |  31  |  32  |  34  |  35  |  36  |
==================================================================
| L. PF2 | 116  | 120  | 124  | 128  | 132  | 136  | 140  | 144  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  38² |  40º |  41¹ |  42² |  44º |  45¹ |  46² |  48º |
|        |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |
|        |  38º |  39¹ |  40² |  42º |  43¹ |  44² |  46º |  47¹ |
|        |------|------|------|------|------|------|------|------|
|        |  38  |  39  |  40  |  42  |  43  |  44  |  46  |  47  |
==================================================================
| R. PF0 | 148  | 152  | 156  | 160  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  49¹ |  50² |  52º |  53¹ |
|        |  - ² |  - ² |  - ² |  - ² |
|        |  48² |  50º |  51¹ |  52² |
|        |------|------|------|------|
|        |  48  |  50  |  51  |  52  |
==================================================================
| R. PF1 | 164  | 168  | 172  | 176  | 180  | 184  | 188  | 192  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  54² |  56º |  57¹ |  58² |  60º |  61¹ |  62² |  64º |
|        |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |
|        |  54º |  55¹ |  56² |  58º |  59¹ |  60² |  62º |  63¹ |
|        |------|------|------|------|------|------|------|------|
|        |  54  |  55  |  56  |  58  |  59  |  60  |  62  |  63  |
==================================================================
| R. PF2 | 196  | 200  | 204  | 208  | 212  | 216  | 220  | 224  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  65¹ |  66² |  68º |  69¹ |  70² |  72º |  73¹ |  74² |
|        |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |
|        |  64² |  66º |  67¹ |  68² |  70º |  71¹ |  72² |  74º |
|        |------|------|------|------|------|------|------|------|
|        |  64  |  66  |  67  |  68  |  70  |  71  |  72  |  74  |
==================================================================

=======================================================================

=================
| HBLANK | 000  |
|        | ÷ 3  |
|        |  00º |
|        |  - ² |
|        |  75¹ |
|        |------|
|        |  75  |
======================================
| L. PF0 | 068  | 072  | 076  | 080  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  22² |  24º |  25¹ |  26² |
|        |  - ² |  - ² |  - ² |  - ² |
|        |  22º |  23¹ |  24² |  26º |
|        |------|------|------|------|
|        |  22  |  23  |  24  |  26  |
==================================================================
| L. PF1 | 084  | 088  | 092  | 096  | 100  | 104  | 108  | 112  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  28º |  29¹ |  30² |  32º |  33¹ |  34² |  36º |  37¹ |
|        |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |
|        |  27¹ |  28² |  30º |  31¹ |  32² |  34º |  35¹ |  36² |
|        |------|------|------|------|------|------|------|------|
|        |  27  |  28  |  30  |  31  |  32  |  34  |  35  |  36  |
==================================================================
| L. PF2 | 116  | 120  | 124  | 128  | 132  | 136  | 140  | 144  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  38² |  40º |  41¹ |  42² |  44º |  45¹ |  46² |  48º |
|        |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |
|        |  38º |  39¹ |  40² |  42º |  43¹ |  44² |  46º |  47¹ |
|        |------|------|------|------|------|------|------|------|
|        |  38  |  39  |  40  |  42  |  43  |  44  |  46  |  47  |
==================================================================
| R. PF2 | 148  | 152  | 156  | 160  | 164  | 168  | 172  | 176  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  49¹ |  50² |  52º |  53¹ |  54² |  56º |  57¹ |  58² |
|        |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |
|        |  48² |  50º |  51¹ |  52² |  54º |  55¹ |  56² |  58º |
|        |------|------|------|------|------|------|------|------|
|        |  48  |  50  |  51  |  52  |  54  |  55  |  56  |  58  |
==================================================================
| R. PF1 | 180  | 184  | 188  | 192  | 196  | 200  | 204  | 208  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  60º |  61¹ |  62² |  64º |  65¹ |  66² |  68º |  69¹ |
|        |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |  - ² |
|        |  59¹ |  60² |  62º |  63¹ |  64² |  66º |  67¹ |  68² |
|        |------|------|------|------|------|------|------|------|
|        |  59  |  60  |  62  |  63  |  64  |  66  |  67  |  68  |
==================================================================
| R. PF0 | 212  | 216  | 220  | 224  |
|        | ÷ 3  | ÷ 3  | ÷ 3  | ÷ 3  |
|        |  70² |  72º |  73¹ |  74² |
|        |  - ² |  - ² |  - ² |  - ² |
|        |  70º |  71¹ |  72² |  74º |
|        |------|------|------|------|
|        |  70  |  71  |  72  |  74  |
======================================


-----Original Message-----
From: Dennis Debro <dennis at debrofamily.com>
To: 'Atari 2600 programming list' <stella at atari2600.org>
Sent: Sat, 5 Jul 2008 12:38 pm
Subject: Re: [stella] Earliest safe write to PF1 for asymmetrical playfield?




Hi there,
I'd go with Michael's explanation. I just checked my work and my answers
ere based on my PF data for Pac-man so it was specific to the way the PF
ata was structured.
Take care, 
ennis 

_______________________________________________
tella mailing list
tella at atari2600.org
ttp://atari2600.org/mailman/listinfo/stella

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://atari2600.org/pipermail/stella/attachments/20080705/f7349656/attachment-0001.html 


More information about the Stella mailing list