| |
oziphantom
Registered: Oct 2014 Posts: 490 |
Any fancy ways to set/clear XMSB
Anybody got some fancy ways to set/clear Sprite MSBs.
At the moment I have
... add something to x here
lda #0
bcc +
lda D010Set,x
+ sta ZPTemp1
lda $d010
and D010Mask,x
ora ZPTemp1
sta $d010
rts
D010Mask .byte %11111110
.byte %11111101
.byte %11111011
.byte %11110111
.byte %11101111
.byte %11011111
D010Set .byte %00000001
.byte %00000010
.byte %00000100
.byte %00001000
.byte %00010000
.byte %00100000
I only support 6 sprites hence don't have full mask/set tables. |
|
| |
Pex Mahoney Tufvesson
Registered: Sep 2003 Posts: 52 |
First optimization would be to do this:
bcc do_nothing
lda D010Set,x
eor $d010
sta $d010
do_nothing:
..this .works whenever "add something here" in your code means something between 0-127 pixels.
---
Have a noise night!
http://mahoney.c64.org |
| |
oziphantom
Registered: Oct 2014 Posts: 490 |
-2 -> 2 would be a better addition limit. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
better keep your X values as 16 bit, then in an unrolled loop you can set d010 as needed.
lda #$00
ldx xhi1
beq +
ora #%00000001
+
..,
,,,
sta $d010 |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
you could even do this..
lda #$00
xhi1 ora table
xhi2 ora table
..
sta d010
then xcoo hi becomes selfmod of the ora address. |
| |
ChristopherJam
Registered: Aug 2004 Posts: 1409 |
Another thread on this from March this year:
Updating sprite X msb |
| |
TNT Account closed
Registered: Oct 2004 Posts: 189 |
If you can set $d010 in one go (instead of changing bits one by one like in a multiplexer) you can also do
ldx #0
cpx spr0hi
ror
cpx spr1hi
ror
...
cpx spr7hi
ror
eor #$ff
sta $d010
|