Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About POS
#1
I just needed the POS function to adapt a code of mine from FreeBASIC... But I didn't suspect POS is already defined in ZX Basic! I realized when the compiler halted: it seems two POS functions are too much Smile

By the way, this was my definition:

Code:
#define systemSPOSN 23688

function pos() as ubyte

    return 34-peek(systemSPOSN)

end function

First I made some tests, because I wasn't sure if the object code produced by the compiler uses the ROM routines and so the related system variables are updated as well. I find out the content of the S POSN system variable is not the same when the same code is executed by Sinclair Basic or compiled by ZX Basic:

Code:
#define systemSPOSN 23688

cls
print at 0,0;peek(systemSPOSN) ' prints 34
print at 1,10;peek(systemSPOSN) ' prints 24
print at 2,20;peek(systemSPOSN) ' prints 14
print at 3,25;peek(systemSPOSN) ' prints 9
stop

' Sinclair Basic prints one less (33, 23, 13 and 8)!

Yes, the same program in Sinclair Basic returns lower values. It's interesting.

Anyway, it's great POS already exists. I took a look at its source file and the rest of library files. There are many interesting undocumented functions.

I created the POS page in the wiki.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)