Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Any fancy ways to set/clear XMSB
2016-09-03 12:09
oziphantom

Registered: Oct 2014
Posts: 478
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.
2016-09-03 12:39
Pex Mahoney Tufvesson

Registered: Sep 2003
Posts: 50
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
2016-09-03 13:03
oziphantom

Registered: Oct 2014
Posts: 478
-2 -> 2 would be a better addition limit.
2016-09-03 14:29
Oswald

Registered: Apr 2002
Posts: 5017
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
2016-09-03 14:34
Oswald

Registered: Apr 2002
Posts: 5017
you could even do this..

lda #$00
xhi1 ora table
xhi2 ora table
..
sta d010

then xcoo hi becomes selfmod of the ora address.
2016-09-03 19:26
ChristopherJam

Registered: Aug 2004
Posts: 1370
Another thread on this from March this year:

Updating sprite X msb
2016-09-03 22:00
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
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
Mixer
Higgie/Kraze/Onslaught
pcollins/Quantum
Røly/Mayday!
Falborg
A3/AFL
radius75
kbs/Pht/Lxt
Didi/Laxity
Guests online: 75
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 Wafer Demo  (9.5)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Onscreen 5k  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Fullscreen Graphicians
1 Carrion  (9.8)
2 Joe  (9.8)
3 Duce  (9.8)
4 Mirage  (9.7)
5 Facet  (9.7)

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