Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inconsistency in RND
#6
Alessandro Wrote:Thank you, now it works Big Grin

On a side note, I thought that functions, being a kind of subroutines (at least that's what I read in the Wiki) should be put at the end of the code, as it was normal with subroutines. (I never mastered the use of functions in Sinclair BASIC to be honest.)

If you need to call a function before implementing it, you can also pre-declare a function (like in C), using DECLARE, followed by the function header:
Code:
DECLARE FUNCTION FASTCALL myRND as Byte

  for n = 1 TO 20
  print at 2,0; myRND; ",";
  next n
  
  stop

FUNCTION FASTCALL myRND As Byte
   Asm
   ld a, r
   and 0x1F
   End Asm
END FUNCTION
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)