Jump to content
IGNORED

Store player graphic data label as const?


Gemintronic

Recommended Posts

I'm trying to store the start of a player sprite data as a const.

 

Something like this works:

 

 const _id_spcfsh = <playerL0363_1

 

But, the trouble is you need to manually dig into the output .asm source and find the correct label.

 

Is there any way to do this with a player sprite label like this?

 

p1_2
 rem Space Fish
 player1:
 %00000000
 %00000100
 %00000110
 %00001100
 %01111000
 %10011101
 %10011110
 %01111011
 %00110010
 %00001000
 %00000110
 %00000000
end

 

constpointer.thumb.png.3159819c2426533d52bb8789ffe924ff.png

Link to comment
Share on other sites

I'd suggest using the technique used in 1942.  Essentially, using 'data' statements to label the data, and setting the pointer manually.

 

For defining the sprite graphics data:

;---
;--- The following macro helps keep sprite graphics contained within a page.
;---
    asm
      MAC PAD_BB_SPRITE_DATA
.SPRITE_HEIGHT  SET {1}
      if	(<*) > (<(*+.SPRITE_HEIGHT))
      repeat	($100-<*)
      .byte	0
      repend
      endif
      if (<*) < 90
	   repeat (90-<*)
	   .byte 0
	   repend
	   endif
   ENDM

;=======================================================
;--  Sprite Graphics Data

    asm
    PAD_BB_SPRITE_DATA 5
end
  data _Small_Plane_down
   %00011000
   %01111110
   %01111110
   %00011000
   %00111100
   0
end

 

And then for setting the graphics:

 

    
;--- create constants to contain address of _Small_Plane_down data
    const _Small_Plane_high     = >_Small_Plane_down
    const _Small_Plane_low      = <_Small_Plane_down
                 
;-- IN the code, where you want to set the player sprite to use the _Small_Plane_down graphics DO: 
    player1pointerlo = _Small_Plane_low
    player1pointerhi = _Small_Plane_high

 

CAVEAT:  This code is for the multisprite kernel, but it should work in the standard kernel.  I'm not sure if the PAD_BB_SPRITE_DATA macro needs to be reworked for that kernel or not.   Let me know if things don't work... and I can fiddle around to get it to work.

  • Thanks 1
Link to comment
Share on other sites

I suspected as much.  Thank you @splendidnut

 

While I was scrolling through the bB generated asm I tried copping off of the generated sprite data sections.  Looks like it's doing something similar.

 

 asm
vp_id_1
    .byte  %11111111
    .byte  %11000101
    .byte  %10100101
    .byte  %10011001
    .byte  %11011011
    .byte  %10111001
    .byte  %10111101
    .byte  %11000111
    .byte  %10111001
    .byte  %10101001
    .byte  %10010001
    .byte  %11111111
 if (<*) > (<(*+11))
    repeat ($100-<*)
    .byte 0
    repend
    endif
 if (<*) < 90
    repeat (90-<*)
    .byte 0
    repend
    endif
end

 

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