[Coco] replicating bitwise operators in BASIC
Chris Osborn
fozztexx at fozztexx.com
Sun Sep 11 22:41:44 EDT 2016
On Sep 8, 2016, at 11:57 PM, Brett Gordon <beretta42 at gmail.com> wrote:
> Cool. Makes sense. The stock BASIC manual was a bit sketchy on that
> issue. Suppose the problem did exist. What would be the solution?
I was lacking bitwise operators in a few dialects when I created the Terraspin program for the BASIC Month challenge that I did back in July. The only operators I needed were AND, right shift, and checking to see if the lowest bit was set. Right shift was easy to simulate, just divide by two. Checking the lowest bit was done with divide, multiply, and subtract in a user defined function. The AND required a loop.
The routines are in the source here and fully commented:
https://redd.it/4qs0f3
--
Follow me on twitter: @FozzTexx
Check out my blog: http://insentricity.com
More information about the Coco
mailing list