### Author Topic: Bit issues  (Read 3086 times)

0 Members and 1 Guest are viewing this topic.

#### Camdenmil

• LV4 Regular (Next: 200)
• Posts: 121
• Rating: +4/-0
##### Bit issues
« on: February 14, 2011, 11:29:34 pm »
I have a tilemap that is in bits. When I use this code, it works except when I have V=60 and W=50, the bit subroutine always returns 256. When I use any other dimensions, it returns 1 or 0.
Code: [Select]
W=60H=50.W=Width of map, H=Height of map, A=Start of appvar (returned from getcalc)sub(BIT,Y*W+X^8,Y*W+X/8+A,°U.Bitnum, Address, Where to store the result of the test.CodeLbl BIT{r2}er1->{r3}ReturnIt would probably take up less space putting this code inline, but why isn't this working for a 60x50 map while it works for any other dimensions.
EDIT: I got it with some other sizes like 59x49 and other numbers around that area, but what is causing the bit checking to return 256?
« Last Edit: February 14, 2011, 11:34:59 pm by Camdenmil »
It is bad luck to be superstitious.

#### squidgetx

• Food.
• CoT Emeritus
• LV10 31337 u53r (Next: 2000)
• Posts: 1881
• Rating: +503/-17
• rawr.
##### Re: Bit issues
« Reply #1 on: February 15, 2011, 07:23:37 am »
Code: [Select]
W=60H=50.W=Width of map, H=Height of map, A=Start of appvar (returned from getcalc)sub(BIT,Y*W+(X^8),Y*W+(X/8)+A,°U.Bitnum, Address, Where to store the result of the test.CodeLbl BIT{r2}er1->{r3}rReturn
« Last Edit: February 15, 2011, 07:23:50 am by squidgetx »

#### Deep Toaster

• So much to do, so much time, so little motivation
• LV13 Extreme Addict (Next: 9001)
• Posts: 8217
• Rating: +758/-15
##### Re: Bit issues
« Reply #2 on: February 15, 2011, 06:23:55 pm »
Code: [Select]
W=60H=50.W=Width of map, H=Height of map, A=Start of appvar (returned from getcalc)sub(BIT,Y*W+(X^8),Y*W+(X/8)+A,°U.Bitnum, Address, Where to store the result of the test.CodeLbl BIT{r2}er1->{r3}rReturn

EDIT: Nvm, it's in the [code].

EDIT2: Hmm, wouldn't {r2}er1->{r3}r potentially overwrite the next byte, though?
« Last Edit: February 15, 2011, 06:25:11 pm by Deep Thought »

#### Camdenmil

• LV4 Regular (Next: 200)
• Posts: 121
• Rating: +4/-0
##### Re: Bit issues
« Reply #3 on: February 15, 2011, 07:34:16 pm »
Thanks, that worked, although is there a way to do it without messing with the next byte?
It is bad luck to be superstitious.

#### Deep Toaster

• So much to do, so much time, so little motivation