Author Topic: Bit issues  (Read 3504 times)

0 Members and 1 Guest are viewing this topic.

Offline Camdenmil

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 121
  • Rating: +4/-0
    • View Profile
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=60
H=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
.Code
Lbl BIT
{r2}er1->{r3}
Return
It 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.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Bit issues
« Reply #1 on: February 15, 2011, 07:23:37 am »
Code: [Select]
W=60
H=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
.Code
Lbl BIT
{r2}er1->{r3}r
Return
« Last Edit: February 15, 2011, 07:23:50 am by squidgetx »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Bit issues
« Reply #2 on: February 15, 2011, 06:23:55 pm »
Code: [Select]
W=60
H=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
.Code
Lbl BIT
{r2}er1->{r3}r
Return


You edited out your response?

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 »




Offline Camdenmil

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 121
  • Rating: +4/-0
    • View Profile
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.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Bit issues
« Reply #4 on: February 15, 2011, 07:35:29 pm »
Yeah, just take the r off.