Jump to content
IGNORED

Drawing playfields from data statements


Grebnedlog

Recommended Posts

The code is a big counter.

It counts by bits, bytes and data statements

It maintains a counter in parallel that counts

by columns and rows. The columns advance for every bit

and the rows for every fourth byte.

The bytes go 0,1,2,3...

Three is the fourth byte so the code masks the lower

two bits (ands byte_ptr with a mask that happens to equal

three, ie byte_ptr & 3) and increments the row if they equal

three.

 

To do 28 bits the easiest would be to check the column

and if it's 27 reset it to 0, increment the row and skip

the rest of this byte and go to the next byte.

 

 dim print_row = a
 dim current_col = b
 dim current_bit = c
 dim current_byte = d
 dim ds_index = e
 dim byte_ptr = f

WritePFChunk

 print_row = 0
 current_col = 0
 for ds_index = 0 to 3

 for byte_ptr = 0 to 175
 current_bit = $80
 on ds_index goto DCASE0 DCASE1 DCASE2 DCASE3

NEXT_BYTE
 next
 next
 return

DCASE0 current_byte = L4_0[byte_ptr] : goto BIT_LOOP
DCASE1 current_byte = L4_1[byte_ptr] : goto BIT_LOOP
DCASE2 current_byte = L4_2[byte_ptr] : goto BIT_LOOP
DCASE3 current_byte = L4_3[byte_ptr]

BIT_LOOP
 if current_byte & current_bit then pfpixel current_col print_row on else pfpixel current_col print_row off 
 if current_col = 27 then current_col = 0 : print_row = print_row + 1 : goto NEXT_BYTE
 current_col = current_col + 1
 current_bit = current_bit / 2
 if current_bit then goto BIT_LOOP
 goto NEXT_BYTE

Edited by bogax
Link to comment
Share on other sites

Don't know if it will help DPC+ users, but this should help everybody else:

 

http://www.atariage.com/forums/blog/302/entry-9759-small-update-for-visualbb/

 

Visual batari Basic now has the ability to convert normal playfield data to data that looks like this:

 

   data _Maze_01
   $7F,$FF,$FF,$7F,$60,$06,$60,$60,$66,$66,$66,$66,$60,$00,$00,$66,
   $67,$67,$7E,$66,$60,$60,$00,$60,$66,$66,$66,$7E,$60,$06,$06,$60,
   $66,$66,$66,$66,$60,$60,$00,$60,$7F,$FF,$FF,$7F
end

 

It displays just as fast as this would:

 

     playfield:
     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     X........X............X........X
     X........X............X........X
     X..XXXX..X..XXXXXXXX..X..XXXX..X
     X..............................X
     X..............................X
     X..XXXX..XXX..X..X..XXX..XXXX..X
     X.....X.......X..X.......X.....X
     X.....X.......X..X.......X.....X
     X..X..X..XXXXXX..XXXXXX..X..X..X
     X..X........................X..X
     X..X........................X..X
     X..XXXX..XXXXXX..XXXXXX..XXXX..X
     X..............................X
     X..............................X
     XXXX..X..XXXXXXXXXXXXXX..X..XXXX
     X.....X..................X.....X
     X.....X..................X.....X
     X..XXXXXXX..XXXXXXXX..XXXXXXX..X
     X..............................X
     X..............................X
     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     ................................
end

 

And don't worry, VbB automatically reverses the appropriate numbers so they can be used directly with playfield variables.

 

Check out my reply in jwierer's blog for more information.

 

 

 

Update:

 

I found out from RevEng that this will definitely NOT work for DPC+ users. But it will help regular kernel bB users who want to instantly change parts of the screen.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...