Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inconsistency in RND
#3
Unfortunately it does not work. I wrote this simple program (prova.bas):
Code:
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

but at the moment of compiling it, here is the result:

prova.bas:1: warning: Using default implicit type 'float' for 'myRND'
prova.bas:9: identifier 'myRND' is a var, not a function
prova.bas:9: 'myRND' already declared as a var at 1

To make it work, I must insert the Assembly code into a subroutine:
Code:
10  myRND()
  print peek 49152; ",";

  pause 0
  
  if code inkey$=13 then goto 10

  stop  

sub myRND()
   Asm
   ld a, r
   and 0x1F
   LD (49152),A
   End Asm
end sub

This will produce the desired effect.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)