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 > how 2 move bits ? with ASL
2010-07-22 08:18
turtle
Account closed

Registered: Mar 2005
Posts: 44
how 2 move bits ? with ASL

the problem...

i want to have a line like this
!sprite 1
************************
***********************
**********************
error =(
!sprite 1
************************
******* ******* *******
******* ******* ******
pliz help =) with this rutine or do u have some better .

irq
lda sprite1+2,x
clc
asl a
sta sprite1+2,x
bcc nc1 (no carry)

lda sprite1+1,x (when carry, move bit over to
ora #%00000001 (the left bit
sta sprite1+1,x

nc1
lda sprite1+1,x
clc
asl a
sta sprite1+1,x
bcc nc2

lda sprite1,x
ora #%00000001
sta sprite1,x

nc2
lda sprite1,x
clc
asl a
sta sprite1,x
bcc nc3

lda sprite2+2,x
ora #%00000001
sta sprite2+2,x

----------------------------------------------




;---------------------------------------
sprite1 *= $3000

.byte %11111111
.byte %11111111
.byte %11111111

sprite2 *= $3040
.byte %00000000
.byte %00000000
.byte %00000000

.byte %00000000
.byte %00000000
.byte %00000000

2010-07-22 08:25
JCB
Account closed

Registered: Jun 2002
Posts: 241
I think you want some ROL in there.

ASL will shift left with the "top" pixel in the carry, so then ROL will copy the carry into the next byte whilst also shifting that byte left and once again putting the top bit in the carry. Also as ASL doesn't shift the carry in there's no need for clc before it.

Just something like

ASL Sprite1+2,x
ROL Sprite1+1,x
ROL Sprite1,x

Of course that presumes X has been set up before.

Hope I understood what you wanted..


Pete
2010-07-22 08:43
turtle
Account closed

Registered: Mar 2005
Posts: 44
Quote: the problem...

i want to have a line like this
!sprite 1
************************
***********************
**********************
error =(
!sprite 1
************************
******* ******* *******
******* ******* ******
pliz help =) with this rutine or do u have some better .

irq
lda sprite1+2,x
clc
asl a
sta sprite1+2,x
bcc nc1 (no carry)

lda sprite1+1,x (when carry, move bit over to
ora #%00000001 (the left bit
sta sprite1+1,x

nc1
lda sprite1+1,x
clc
asl a
sta sprite1+1,x
bcc nc2

lda sprite1,x
ora #%00000001
sta sprite1,x

nc2
lda sprite1,x
clc
asl a
sta sprite1,x
bcc nc3

lda sprite2+2,x
ora #%00000001
sta sprite2+2,x

----------------------------------------------




;---------------------------------------
sprite1 *= $3000

.byte %11111111
.byte %11111111
.byte %11111111

sprite2 *= $3040
.byte %00000000
.byte %00000000
.byte %00000000

.byte %00000000
.byte %00000000
.byte %00000000



the problem...

i want to have a line like this
!sprite 1
************************
***********************
**********************
error =(
!sprite 1
************************
0******0*******0*******
0******0*******0******
0******0*******0*****
0******0*******0****
pliz help =) with this rutine or do u have some better .

irq
lda sprite1+2,x
clc
asl a
sta sprite1+2,x
bcc nc1 (no carry)

lda sprite1+1,x (when carry, move bit over to
ora #%00000001 (the left bit
sta sprite1+1,x

nc1
lda sprite1+1,x
clc
asl a
sta sprite1+1,x
bcc nc2

lda sprite1,x
ora #%00000001
sta sprite1,x

nc2
lda sprite1,x
clc
asl a
sta sprite1,x
bcc nc3

lda sprite2+2,x
ora #%00000001
sta sprite2+2,x

----------------------------------------------




;---------------------------------------
sprite1 *= $3000

.byte %11111111
.byte %11111111
.byte %11111111

sprite2 *= $3040
.byte %00000000
.byte %00000000
.byte %00000000

.byte %00000000
.byte %00000000
.byte %00000000
2010-07-22 08:50
turtle
Account closed

Registered: Mar 2005
Posts: 44
Quote: I think you want some ROL in there.

ASL will shift left with the "top" pixel in the carry, so then ROL will copy the carry into the next byte whilst also shifting that byte left and once again putting the top bit in the carry. Also as ASL doesn't shift the carry in there's no need for clc before it.

Just something like

ASL Sprite1+2,x
ROL Sprite1+1,x
ROL Sprite1,x

Of course that presumes X has been set up before.

Hope I understood what you wanted..


Pete


=)
2010-07-22 10:47
Oswald

Registered: Apr 2002
Posts: 5094
you dont need the clc .. bcc ... ora part.

ASL works like this:

C <- 11111111 <-0

then you use ROL

C <- 11111111 <- C
2010-07-22 13:06
GT
Account closed

Registered: Sep 2008
Posts: 308
Use a hammer. ;-)
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
Chesser/Blazon
deetsay
Weetibix
zscs
Courage
iAN CooG/HVSC
ciccior2003/HF
ArturoDente
Guests online: 115
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 No Listen  (9.6)
2 Layers  (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 Logo Graphicians
1 t0m3000  (10)
2 Sander  (9.8)
3 Mermaid  (9.5)
4 Facet  (9.4)
5 Shine  (9.4)

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