## Re: [stella] Any guru to solve a problem with the ROL instruction ?

 Subject: Re: [stella] Any guru to solve a problem with the ROL instruction ? From: Darrell Spice Date: Sat, 17 Apr 2004 15:11:27 -0500
arrrgh - the 2nd line should say "this rolls into bit 0"

think I'll go take a nap :-)

On Apr 17, 2004, at 2:59 PM, Darrell Spice wrote:

correction - the rotation is the other way, but PF0 is reversed when displayed.

```11001100 - 1st line - C is 0, this 0 rolls into bit 0 on the next ROL
10011000 - 2nd line - C is 1, this rolls into bit 1 on the next ROL
00110001 - 3rd line - C is 1, ditto
01100011 - 4th line```

and so on.

On Apr 17, 2004, at 2:12 PM, Darrell Spice wrote:

ROL uses the C(carry flag) as an additional bit during the rotate. Looking at just PF0ADR this is what you're getting:

```11001100 - 1st line - C is 0, this 0 rolls into bit 7 on the next ROL
01100110 - 2nd line - C is 0, ditto
00110011 - 3rd line - C is 0, ditto
00011001 - 4th line - C is 1, this 1 rolls into bit 7 on the next ROL
10001100 - 5th line - C is 1
11000110 - 6th line - C is 0
01100011 - 7th line - C is 0
00110001 - 8th line - C is 1
10011000 - 9th line - C is 1```

if you look closely, you'll see that every other "black diagonal" is a little bit bigger. I suspect you're not wanting this. When you add in PF2ADR the C flag from the ROL on PF0ADR is rolled into the 7th bit of PF2ADR, while the C from PF2ADR is rolled into the 7th bit of the next PF0ADR value.

It might be easer to see the problem if you change your PF0ADR initial value to #%10101010

On Apr 17, 2004, at 1:38 PM, Christian Bogey wrote:

```Hi,
I wrote a little demo to try to make some effects
using playfield and I've got a bug in my program
but I can't find why it occurs :-(```

Maybe one of the 6502 gurus here may help me ;-)

```I'm using the ROL instruction to modify the patterns
of PF0 and PF2 (I'am using shadows number in ram) and
I noticed :```

```* Using the ROL instruction 1 time gives a good
result.
* Using it 2 times makes a total mess in the Playfield```

```  display.
* Trying to compile with the first line only, gives a
good result (ROL PF0 Value).
* Trying to compile with the second line only, gives a```

```  good result (ROL PF2 Value).
* Trying to compile both lines and it's a total mess !
* BTW I noticed the problem doesn't occur if I'm using```

```  ROL for the 1st line and ROR with the 2nd (maybe a
hint to find the cause of the problem ?)```

Does anybody can explain me where I'am wrong ???

```I've join the source : the bug is located under the
line 103 labeled :```

```;-------------- PROBLEM STARTS
HERE--------------------```

Thanks,

Chris

Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com
<Demo.asm>
```Darrell Spice, Jr.
http://www.spiceware.org/```

---------------------------------------------------------------------- ------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

```Darrell Spice, Jr.
http://www.spiceware.org/```

----------------------------------------------------------------------- -----------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

```Darrell Spice, Jr.
http://www.spiceware.org/```

```----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/```