[Coco] tetris question

Darren A mechacoco at gmail.com
Sun Jan 17 19:54:40 EST 2010


On 1/17/10, Robert Gault wrote:
>
> I don't have the pak so can't try it on a real Coco3.
>
> I mounted an image in MESS and looked at the initial code for the pak.
> It starts with a test that seems problematic to me.
>   lda #63
> a@ sta $ffbf
>   cmpa $ffbf
>   bne $c01a	branches to PMODE code Coco1 or 2, artifact colors
>   deca
>   bne a@
>   goes to HSCREEN code Coco3, real colors
>
> When I run this test on my Coco3
> 10 M=&HFFBF
> 20 FORI=63TO0STEP-1
> 30 POKE M,I:PRINT PEEK(M);
> 40 NEXT
> I find that bit6 at $FFBF is locked high so the value at $FFBF will
> never equal that in regA. In fact this true for all the palette
> registers. Makes me wonder if the pak can correctly tell what type of
> Coco is in use.

This is due to the fact that the palette registers are only six bits
wide and don't put anything on the data bus for bits 6 and 7.  Those
bits will tend to reflect whatever was on the data bus during the CPU
cycle prior to the read of the palette register.

In the case of a PEEK command, bit 7 will be a 0 and bit 6 will be a 1
because the code for PEEK uses a zero-offset indexing mode to read the
address. In this case the cycle immediately preceding the read of the
palette register will read the byte of code at $B754 which is $7E.

If you patch the PEEK routine to use a 5-bit offset mode (with an
offset of 0) by doing a POKE &HB753,0 your test program should show
values with bit 6 cleared.

Darren



More information about the Coco mailing list