| |
oziphantom
Registered: Oct 2014 Posts: 490 |
LDA (ZP,x)
Has anybody ever used this opcode and if so what for? |
|
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Rare. But for pointers on ZP f.e. |
| |
Hein
Registered: Apr 2004 Posts: 954 |
I used it for my music editor to call functions in and outside IRQ, so that IRQ can call the same subroutine when it's allready running outside IRQ. Else the ZP values are trashed when IRQ is done and returning to the original function.
X=0 out IRQ, X=2 in IRQ
snippet:
lda zp_ed_scr_nybble_hi,x
sta (zp_ed_scr_to_lo,x)
inc zp_ed_scr_to_lo,x
bne +
inc zp_ed_scr_to_hi,x
+
lda zp_ed_scr_nybble_lo,x
sta (zp_ed_scr_to_lo,x)
inc zp_ed_scr_to_lo,x
bne +
inc zp_ed_scr_to_hi,x
+
...
|
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
never. |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
It's one of those "seemed like a good idea at the time" opcodes. Everyone would have been happier if we got (ZP),x instead. |
| |
Peiselulli
Registered: Oct 2006 Posts: 81 |
(zp) is also missing |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
another opcode would have been more useful, fex sty abs,x stx abs,y. or the mentioned (),x |
| |
Jammer
Registered: Nov 2002 Posts: 1335 |
Or txy/tyx ;) |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
It's useful for channelized implementations like a music player. If you have your voice structures in zp you can address your data pointers using the regular 0,7,14 index for instance. I've used this method in Breakage.
The fact that the 6502 instruction set is so asymmetric is a large part of making it fun to code for IMO. |
| |
cadaver
Registered: Feb 2002 Posts: 1160 |
tlr: That's a cool usage. Though you'll have the downside of having to manipulate the ZP pointer every time you want to access successive bytes (for example note, instrument, duration) from music data, instead of just incrementing Y. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
I really miss add. (adc without carry) |
... 33 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 | 3 | 4 | 5 - Next |