| |
oziphantom
Registered: Oct 2014 Posts: 490 |
LDA (ZP,x)
Has anybody ever used this opcode and if so what for? |
|
... 33 posts hidden. Click here to view all posts.... |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Quoting lftand update those values with the (zp,x) addressing mode. I have a hunch that under normal demo conditions (TM), self-modifying and unrolled code will gain more. Also, one half of the "hot" sprite registers are in consecutive locations (colours, pointers) while the other half are not (x and y co-ordinates) - so 50% of those accesses when updating the "physical" sprites will be slower due to the extra indirection via ZP pointers. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
usually a plexer writes sprites in a fixed order, thus it can be unrolled. one excetion I know of cadaver's BOFH which assigns priority to virtual sprites and tries to pick a HW sprite based on that. |
| |
Fresh
Registered: Jan 2005 Posts: 101 |
Yes, the multiplexer can surely be speedcoded with better performance.
Yet, among the proposed solutions, this use of (zp,x) is imho one of the most sensible. This and (zp)-like, when X is known. |
| |
Skate
Registered: Jul 2003 Posts: 494 |
Not directly ZP,x related but recently i moved one of my effect loops to zeropage. When you run your code at zeropage, you have interesting cycle saving method alternatives. For instance if we need to do something like;
ora $xxxx
sta $xxxx
using
lda #<xxxx
sta lo1
sta lo2
lda #>xxxx
sta hi1
sta hi2
is a big waste. Instead we prefer;
lda #<xxxx
sta zp
lda #>xxxx
sta zp+1
ora (zp),y
sta (zp),y
right? If index is not required;
...
ora (zp,x)
sta (zp,x)
would be fine as well. But if your code itself is running on ZP;
lda #<xxxx
sta addr
lda #>xxxx
sta addr+1
ora $xxxx,y : addr = *-2
sta (addr),y ; or sta (addr,x) if suitable
is a nice method to save some cycles. |
| |
Monte Carlos
Registered: Jun 2004 Posts: 359 |
It can be used for text scrollers with varying y-pos to fill in the rightmost char if addresses are prepared in zp |
| |
oziphantom
Registered: Oct 2014 Posts: 490 |
If they just could have saved the metal on putting it on the LDA, STA, ORA, CMP etc ZP instructions put put it on
JMP( XXXX,x ) instead.
Or yes LDA ( ZP,x ),y would also be very handy.
What does TAS do? |
| |
Rastah Bar Account closed
Registered: Oct 2012 Posts: 336 |
Quoting oziphantomIf they just could have saved the metal on putting it on the LDA, STA, ORA, CMP etc ZP instructions put put it on
JMP( XXXX,x ) instead.
Or yes LDA ( ZP,x ),y would also be very handy.
What does TAS do?
A complete description of TAS and other undocumented opcodes can be found here
No More Secrets v0.9 |
| |
oziphantom
Registered: Oct 2014 Posts: 490 |
Ah that doc in a round about way defines what H is. I've seen it on other sites but nothing defined H. Although it seems to be a typo and it should be H+1. Thanks |
| |
HCL
Registered: Feb 2003 Posts: 728 |
Quoting lftAnother thing I've had in mind, but never actually implemented, is this: Suppose you're doing something like kefrens bars with open sideborders. You repeat the last line of a row of characters and modify the font on the fly. But in the borders, you repeat sprite data, let's say one sprite on either side. That means you have a single graphics buffer consisting of 46 bytes, but those bytes are distributed somewhat irregularly in RAM. So make a table in zp consisting of 46 pointers to them. Then use (zp,x) in the drawing operations. You can even access neighbouring cells with (zp-2,x) and (zp+2,x).
Yepp, Slammer is right.. That's what i did in Royal Arte :), but without border :P. Totally forgot about that, and i never thought i ever used (zp,x) :). |
| |
Wisdom
Registered: Dec 2001 Posts: 90 |
Used it in Thread Over and in Matrix 16. Might be useful in some size-coding cases. |
Previous - 1 | 2 | 3 | 4 | 5 - Next |