Jump to content
KevKelley

Inconsistent Bit Operation Activity

Recommended Posts

So I was taking a stab at making some difficulty progression, with one aspect tied to the score.  I had it to where if the score hit 500 a bit would change and the counter should speed up and draw pixels quicker.  What is odd is that sometimes it happens and then other times the counter pretty much stops.  I am not sure if I am overlooking anything.


This is the pixel routine
 

  temp2 = counter/8 - 5
  if !counter & 7 && temp2 < 8  then var31 = dat[temp2]

  data dat
  $80, $40, $20, $10, $08, $04, $02, $00
end 
SKIP_CONVEYOR

   temp5 = (rand&15)+(rand&2)
   temp6 = (rand&3)+(rand&3)+4
 if e{5} then goto PIXEL_GEN
  if z{6} then counter = counter +1.0  :goto PIXEL_GEN 
 if !z{6} then counter = counter + 2.0:goto PIXEL_GEN
PIXEL_GEN

 if counter <> 100 then SKIP_PIXEL_GEN

   pfpixel temp5 temp6 on
   counter = 0.00
 if !d{3} && counter >0 then goto SKIP_STATUS
 if counter = 0  then statusbarlength=statusbarlength-4
SKIP_STATUS

 rem conveyor belt

SKIP_PIXEL_GEN

 

The check I made is this:

 

 if _sc2 =$05 && _sc3 = $00 then z{6}=0

 

Is it possible that if the timing is right, and the score is met, the counter switches to counter+2.0 and the counter <> 100 condition is never met so it skips the pixel code forever?

Share this post


Link to post
Share on other sites

I think while typing up my question and rereading the code I think I may have answered my own question.  

I tried replacing the check with this:

 if z{6} && _sc2 =$05 && _sc3 = $00 then counter=0.0: z{6}=0

So far I haven't gotten anymore inconsistencies.  

  • Like 1

Share this post


Link to post
Share on other sites

So data tables can be anywhere? 

Share this post


Link to post
Share on other sites

I'm guessing when in assembly it knows where to go?

Share this post


Link to post
Share on other sites
Posted (edited)

you don't show what counter is presummably its an 8.8 variable

 

if counter is less than 40 then temp2 will be 251 or greater

39/8 = 4

4 - 5 = -1 = 255

 

a data statement can be anywhere in the same bank

bB normally inserts a jump (like a goto) around each data statement

if you use the noinlinedata optimization it will omit the jumps and

you have to put the data statement out of the code path (eg after a goto or a return)

Edited by bogax
clarification
  • Like 2

Share this post


Link to post
Share on other sites

Whoops. Yeah. counter =x.y

 

Thanks. I'll have to play around with this.

 

Share this post


Link to post
Share on other sites

   temp5 = (rand&15)+(rand&2)

   will produce a number 0..15 or 17


   temp6 = (rand&3)+(rand&3)+4

   will produce a number 4..10

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, KevKelley said:

So data tables can be anywhere? 

 

I just did a test with data in the main loop and outside of the main loop and both compiled. In other BASIC-style programs that I used, if I remember correctly,  the program would crash if the flow of the program ran over normal data.

 

I'm still going to keep all of my normal data outside of the main loop so I can find it quicker.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...