[Coco] replicating bitwise operators in BASIC

Dave Philipsen dave at davebiz.com
Sat Sep 10 23:47:48 EDT 2016


One way to do it without boolean operators is to simply use a truth 
table for the logic as a lookup table.  For integers large than 0-1 
(single bit) you'd have to rotate through all of the bits (up to 15).  
Since ECB doesn't have a rotate function and you've asked to do it 
without AND then you may have to extract the individual bits through a 
subtraction routine.  I think it could still be relatively quick using 
tables for the logic and tables for the subtraction though definitely 
not as quick as having the logic operators.

Dave


On 9/10/2016 10:26 PM, Brett Gordon wrote:
> Bogus test?
>
> 1.5   =  0b01.10
> 3.25 =  0b11.01
>
> The fractional part would disappear even if BASIC did keep the fractions.
> :)
>
> As the OP... I point out nobody actually answered my intended question:
> what if we had no AND, OR, or NOT... is it possible to replicate these from
> other means?
>
> Lost:  I consider USR()'ing cheating. ;)
>
> cheers, brett
>



More information about the Coco mailing list