Jump to content
IGNORED

stack pointer specifics


antron

Recommended Posts

when the stack pointer is pointing to the first byte of ram, what value is actually in the stack pointer? $00 or $80?

(is it the actual location or an offset from $80?)

 

if it is an offset, what is the affect of setting the most significant bit to 1?

would %10000000 also point to the first byte in ram? or into that mirrored TIA address space that is right after the RAM?

 

TIA

Edited by antron
Link to comment
Share on other sites

when the stack pointer is pointing to the first byte of ram, what value is actually in the stack pointer?  $00 or $80?

If you want the stack pointer to point to VCS memory location $80, then you have to write $80 to SP.

 

(is it the actual location or an offset from $80?)

Don't get confused. It is just an ordinary pointer. It points to the adress thats is in it. Nothing special here.

 

if it is an offset, what is the affect of setting the most significant bit to 1? would %10000000 also point to the first byte in ram?

It is not an offset and you access the adress that it points to. So you will access the TIA if the MSB is 0 and RAM if the MSB is 1

Link to comment
Share on other sites

I see. Thanks.

 

that actually works out in my favor.

 

in a kernel that will run 16 times, i was keeping a linecount in y to do two indexed reads from ram and two indirect indexed reads from rom (pointing to the right 32 byte chunk in rom).

 

now i can keep the linecount in the stack pointer. transfer it to x, and then mask the upper three bits of x (with sax: and x with a, store in x, 2 cycles) to make indexed reads from the right chunk of rom (and i need all 3 bits).

 

you can't set bits with lda, sax but you can turn them off. (i could txa, ora, tax but i need those 2 extra cycles) i just have to keep my indexed ram data at the end of ram, and pull it.

 

now all my linecount overhead is gone, and i come out 3 cycles ahead at the end of the day (i had to store it in a temp because there is a point that i need all three registers to change three colors in 9 cycles)

 

thanks again :D

Edited by antron
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...