Jump to content
IGNORED

Re-using the first bit in color related variables?


Gemintronic

Recommended Posts

So, I noticed the color values always go up by 2 for NTSC:

 

$46

$48

$4A

 

etc..

 

I was wondering if this would make snatching the first bit as a seperate bitwise variable safe?

 

dim bgcolor = a

def hastreasure=bgcolor{0}

 

Do real Atari 2600's on real TVs freak out when a color is $47 instead of $46?

Link to comment
Share on other sites

The lsb is ignored/unused in the hardware registers, so with a RAM shadow you could use the bit for other purposes.

 

Not as handy as the msb of course since 6502 can easily test it with a single instruction, plus the N flag usually reflects it's state after many operations.

 

If you wanted to use the msb in assembly, easy enough, you could just adjust your colour value stores, then when copying to the hardware registers, e.g.

 

LDA SCOLUBK

ASL A

STA COLUBK

  • Like 1
Link to comment
Share on other sites

Or you could shift the byte right, moving the lowest bit into the carry flag, and branch to one routine or another depending on whether carry is set. That way the color data can be used as-is for color purposes, but you can still use the lowest bit for some other on/off variable. In fact, I think that might be how batari Basic tests the lowest bit when you use it as a bit variable-- by shifting the byte right and then checking the carry flag.

Edited by SeaGtGruff
Link to comment
Share on other sites

If you are doing: dim bgcolor = a

aren't you setting the bits of "a" as opposed to the bits of the color register ?

If you can just set the LSB of a register without using your variables, that would be extra bits.

 

The DPC+ Kernel has 35 bytes for variables.

I learned you can add three more bits from the unused bits of SWCHB.

Maybe we can add more bits from the ignored color register bits?

How many registers have ignored bits? COLUBK, COLUPF, PF0 ????????

Link to comment
Share on other sites

There's a big difference between data bytes and registers. If a register doesn't use a particular bit, that bit isn't just ignored by the register-- it doesn't exist. In other words, the TIA color registers contain only 7 bits. So you can use any ignored bits for other things in the data, but that doesn't mean there are extra bits in the registers that can be used for storage. Anyway, the TIA registers are either read-only or write-only, so even if the ignored bits did exist in the registers themselves, you wouldn't be able to store anything in them and then read them back. :(

 

PS-- SWCHB is a 6532/RIOT register, not a TIA register, which is why the unused bits are available for storage-- the SWCHB register has 8 bits, and you can read from it or write to it depending on how you've set the control bits.

Edited by SeaGtGruff
  • Like 1
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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