Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > LDA (ZP,x)
2016-05-16 14:31
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....
 
2016-05-18 12:31
Krill

Registered: Apr 2002
Posts: 2980
Quoting lft
and 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.
2016-05-18 12:48
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.
2016-05-18 14:12
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.
2016-05-18 19:18
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.
2016-05-18 20:46
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
2016-05-19 08:50
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?
2016-05-19 14:14
Rastah Bar
Account closed

Registered: Oct 2012
Posts: 336
Quoting oziphantom
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?


A complete description of TAS and other undocumented opcodes can be found here
No More Secrets v0.9
2016-05-20 16:30
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
2016-05-20 22:13
HCL

Registered: Feb 2003
Posts: 728
Quoting lft
Another 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) :).
2016-05-21 08:56
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
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
YPS
Alakran_64
algorithm
Ben Breton/Absence o..
Freeze/Blazon
Guests online: 109
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.231 sec.