|
Subject: Re: [stella] Bit flip From: "TwoHeaded Software" <adavie@xxxxxxxxxxxxx> Date: Mon, 10 Sep 2001 19:03:40 +1000 |
ldx #7
flip lsr zp ; zp holds the byte to flip the bit of
rol a
dex
bpl flip
; on exit, a = flipped byte
That's not exactly quick, but it should do the job. It will flip the bits
for ANY input, not just a single-bit.
Me, I'd be thinking about my algorithm if I needed to do this sort of job.
This is not an efficient procedure. It's ugly.
Cheers
A
-
Andrew Davie, TwoHeaded Software
adavie@xxxxxxxxxxxxx
----- Original Message -----
From: "Glenn Saunders" <cybpunks2@xxxxxxxxxxxxx>
To: <stella@xxxxxxxxxxx>
Sent: Monday, September 10, 2001 6:51 PM
Subject: Re: [stella] Bit flip
> At 06:36 PM 9/10/2001 +1000, you wrote:
> >Table-lookup, 256 bytes. Index your original value to get the
bit-flipped
>
>
> It wouldn't need 256 bytes because if only 1 bit is set then there can
only
> be 8 possible values:
>
> 00000001
> 00000010
> 00000100
> 00001000
> 00010000
> 00100000
> 01000000
> 10000000
>
> Would need to index a table containing:
>
> Lookup
> %10000000
> %01000000
> %00100000
> %00010000
> %00001000
> %00000100
> %00000010
> %00000001
>
> But how do you use a number like that to create an index?
>
> Would you left shift the accumulator and test for zero and increment the X
> register until it reaches zero, then LDA Lookup,X?
>
> To be more specific, I'm starting to think (getting ahead of myself,
before
> I even have a working kernel) of how to translate an X/Y coordinate of a
> collision into a playfield bitmap RAM write. Because the playfield
> registers are stored in alternating normal and reversed bit order I can't
> just write directly. I need to potentially reverse the bit order before I
> OR it with the proper RAM location.
>
>
> -
> Archives (includes files) at http://www.biglist.com/lists/stella/archives/
> Unsub & more at http://www.biglist.com/lists/stella/
>
-
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [stella] Bit flip, Glenn Saunders | Thread | Re: Aw: [stella] My first (hopefull, Eckhard Stolberg |
| Re: Aw: [stella] Bit flip, Thomas Jentzsch | Date | Re: [stella] TIA sound note table, , Thomas Jentzsch |
| Month |