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 > Any fancy ways to set/clear XMSB
2016-09-03 12:09
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.
2016-09-03 12:39
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
2016-09-03 13:03
oziphantom

Registered: Oct 2014
Posts: 490
-2 -> 2 would be a better addition limit.
2016-09-03 14:29
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
2016-09-03 14:34
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.
2016-09-03 19:26
ChristopherJam

Registered: Aug 2004
Posts: 1409
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
diabolus
Flashback
LightSide
Peacemaker/CENSOR/Hi..
duce/extend
Beast/Crescent
Guests online: 99
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 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (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 Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 Fungus  (9.8)
5 S!R  (9.8)

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