Jump to content
IGNORED

asl CXPPMM


Recommended Posts

Hi.

In Stella dev mode, if I use

asl CXM0P or asl CXM1P

the screen becomes a mess.

If I use

asl CXPPMM

everything works fine.

 

Is there a reson for that?

Can I use asl or another instruction with these registers?

Thanks

 

Link to comment
Share on other sites

17 minutes ago, Thomas Jentzsch said:

But you do write them. ASL is a RMW (read, modify, write) operation. And since the TIA read and write registers share the same addresses, you are producing unwanted writes to TIA.

ok thanks

Link to comment
Share on other sites

Yeah, mirrored addressing plus TIA having Read-Only registers as well as Write-Only registers that share the same addresses at certain mirrors is confusing when you start coding for the 2600. 

 

The mirrored addressing is somewhat easy to understand since the same 128 bytes of RAM are used for both Zero Page RAM (anything with address $00xx) as well as the stack which is in Page 1 (anything with address $01xx). 

 

These topics might help with the mirrored addressing:

 

The memory map referenced in the first topic is no longer online, you can find it here via the Wayback Machine.

By default the VCS.H file sets the read-only registers and the write-only registers to both start at address 0 for your code:

 

image.thumb.png.46a3d90105643f2f4288023a21bf412c.png

 

Which means your code will use the same mirror addresses for these registers:

  • CXM0P (read-only) and VSYNC (write-only) are both at $0000
  • CXM1P (read-only) and VBLANK (write-only) are both at $0001
  • CXPPMM (read-only) and COLUP1 (write-only) are both at $0007

So doing an ASL CXM0P will read CXM0P but write to VYSNC and ASL CXM1P will read CXM1P and write to VBLANK, which both affect video output.

 

ASL CXPPMM will read CXPPM but write to COLUP1, so that modifies the color of PLAYER1 and MISSILE1. You might have been be updating COLUP1 later in the code, which would have hid the color change.

  • Like 3
Link to comment
Share on other sites

On 7/14/2024 at 12:33 PM, Cisano said:

Can I use asl or another instruction with these registers?

Yes. There are some ranges that can be used because the write register is undefined.

 

Example:

ASL CXM1P | $30   ; Read CXM1P, Write Undefined

 

 


--------------------------------------------
$0000 - $003F = TIA.......(write)......(read)
--------------------------------------------
$0000 = TIA Address $00 - (VSYNC)......(CXM0P)
$0001 = TIA Address $01 - (VBLANK).....(CXM1P)
$0002 = TIA Address $02 - (WSYNC)......(CXP0FB)
$0003 = TIA Address $03 - (RSYNC)......(CXP1FB)
$0004 = TIA Address $04 - (NUSIZ0).....(CXM0FB)
$0005 = TIA Address $05 - (NUSIZ1).....(CXM1FB)
$0006 = TIA Address $06 - (COLUP0).....(CXBLPF)
$0007 = TIA Address $07 - (COLUP1).....(CXPPMM)
$0008 = TIA Address $08 - (COLUPF).....(INPT0)
$0009 = TIA Address $09 - (COLUBK).....(INPT1)
$000A = TIA Address $0A - (CTRLPF).....(INPT2)
$000B = TIA Address $0B - (REFP0)......(INPT3)
$000C = TIA Address $0C - (REFP1)......(INPT4)
$000D = TIA Address $0D - (PF0)........(INPT5)
$000E = TIA Address $0E - (PF1)........(UNDEFINED)
$000F = TIA Address $0F - (PF2)........(UNDEFINED)
$0010 = TIA Address $10 - (RESP0)......(CXM0P)
$0011 = TIA Address $11 - (RESP1)......(CXM1P)
$0012 = TIA Address $12 - (RESM0)......(CXP0FB)
$0013 = TIA Address $13 - (RESM1)......(CXP1FB)
$0014 = TIA Address $14 - (RESBL)......(CXM0FB)
$0015 = TIA Address $15 - (AUDC0)......(CXM1FB)
$0016 = TIA Address $16 - (AUDC1)......(CXBLPF)
$0017 = TIA Address $17 - (AUDF0)......(CXPPMM)
$0018 = TIA Address $18 - (AUDF1)......(INPT0)
$0019 = TIA Address $19 - (AUDV0)......(INPT1)
$001A = TIA Address $1A - (AUDV1)......(INPT2)
$001B = TIA Address $1B - (GRP0).......(INPT3)
$001C = TIA Address $1C - (GRP1).......(INPT4)
$001D = TIA Address $1D - (ENAM0)......(INPT5)
$001E = TIA Address $1E - (ENAM1)......(UNDEFINED)
$001F = TIA Address $1F - (ENABL)......(UNDEFINED)
$0020 = TIA Address $20 - (HMP0).......(CXM0P)
$0021 = TIA Address $21 - (HMP1).......(CXM1P)
$0022 = TIA Address $22 - (HMM0).......(CXP0FB)
$0023 = TIA Address $23 - (HMM1).......(CXP1FB)
$0024 = TIA Address $24 - (HMBL).......(CXM0FB)
$0025 = TIA Address $25 - (VDELP0).....(CXM1FB)
$0026 = TIA Address $26 - (VDELP1).....(CXBLPF)
$0027 = TIA Address $27 - (VDELBL).....(CXPPMM)
$0028 = TIA Address $28 - (RESMP0).....(INPT0)
$0029 = TIA Address $29 - (RESMP1).....(INPT1)
$002A = TIA Address $2A - (HMOVE)......(INPT2)
$002B = TIA Address $2B - (HMCLR)......(INPT3)
$002C = TIA Address $2C - (CXCLR)......(INPT4)
$002D = TIA Address $2D - (UNDEFINED)..(INPT5)
$002E = TIA Address $2E - (UNDEFINED)..(UNDEFINED)
$002F = TIA Address $2F - (UNDEFINED)..(UNDEFINED)
$0030 = TIA Address $30 - (UNDEFINED)..(CXM0P)
$0031 = TIA Address $31 - (UNDEFINED)..(CXM1P)
$0032 = TIA Address $32 - (UNDEFINED)..(CXP0FB)
$0033 = TIA Address $33 - (UNDEFINED)..(CXP1FB)
$0034 = TIA Address $34 - (UNDEFINED)..(CXM0FB)
$0035 = TIA Address $35 - (UNDEFINED)..(CXM1FB)
$0036 = TIA Address $36 - (UNDEFINED)..(CXBLPF)
$0037 = TIA Address $37 - (UNDEFINED)..(CXPPMM)
$0038 = TIA Address $38 - (UNDEFINED)..(INPT0)
$0039 = TIA Address $39 - (UNDEFINED)..(INPT1)
$003A = TIA Address $3A - (UNDEFINED)..(INPT2)
$003B = TIA Address $3B - (UNDEFINED)..(INPT3)
$003C = TIA Address $3C - (UNDEFINED)..(INPT4)
$003D = TIA Address $3D - (UNDEFINED)..(INPT5)
$003E = TIA Address $3E - (UNDEFINED)..(UNDEFINED)
$003F = TIA Address $3F - (UNDEFINED)..(UNDEFINED)

 

  • Like 2
Link to comment
Share on other sites

46 minutes ago, glurk said:

Just because you CAN doesn't mean you SHOULD.  LOL!!

 

I would just use BIT and not worry about unintended effects, FWIW.

Usually a carry flag lasts longer than a negative flag. Therefore I have been using ASL too (e.g. with INPT4). 

  • Like 1
Link to comment
Share on other sites

22 hours ago, Omegamatrix said:

Yes. There are some ranges that can be used because the write register is undefined.

 

Example:

ASL CXM1P | $30   ; Read CXM1P, Write Undefined

 

That is cool!

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