Jump to content
SteveB

Hashtag-Parameters in SUB

Recommended Posts

Hi,

 

Extended BASIC uses # for sprite- and file-numbers, like CALL MOTION(#1,16,0). I have build a subroutine for a sprite with XB256 and it feels somehow wrong to use just the sprite-number without a #.

SUB SPEED(S,X,Y)
  CALL VREAD(1920,112,A$)
  X = ASC(SEG$(A$,S*4-3,1))
  IF X>127 THEN X=X-256
  Y = ASC(SEG$(A$,S*4-2,1))
  IF Y>127 THEN Y=Y-256
SUBEND    

With CALL SPEED(1,X,Y) I can read the speed of of sprite #1. It would look better and more consistent if I could use CALL SPEED(#1,X,Y) instead, but this gives me a syntax error, no matter how I try to define the SUB.

 

[The CALL VREAD() will be replaced with CALL LINK("VREAD",1920,112,A$) by SXB in this example if you want to use the routine in standard XB/XB256]

 

Any ideas?

Share this post


Link to post
Share on other sites

XB can pass numeric and string variables or constants to an assembly sub. Here is the problem:

#1 is not a number

"#1" is a string and could be passed, but then you need the quotes.

I could never see a way around this.

Share this post


Link to post
Share on other sites

I have been working on the source code of XB GPL and Assembly longer then probably than anyone else as it is my sole project.

Why they picked the # symbol to put in Sprite routine is a mystery for me too.

Share this post


Link to post
Share on other sites

I consider these definitive answers, thank you both!

 

I kind of like the #1, but the # gave me hell for the syntax-highlighter in TiCodEd. But I finally managed to apapt it for the next version I am currently working on. It was interpreted as I don't know what until the end of the line.

 

      image.png.57adda560f77f7e771cb3eb07f342c13.png

will finally become

     image.png.a25287d434088b6f125ea6534b9049c6.png 

as expected.

 

 

 

 

Edited by SteveB
  • Like 2

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