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
#2
programandala.net Wrote: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.

Thank you very much! ;-) That's the wiki is for. I was thinking we should put required #include line also, shouldn't we?
Reply
#3
boriel Wrote:I was thinking we should put required #include line also, shouldn't we?

At first I didn't understand what you mean... Then I realized I was compiling with the --sinclair option. I tried without it, and POS was not avalaible any more Smile By the way, why is it considered a Sinclair Basic issue? I supossed the --sinclair option added only some Sinclair Basic specific commands, like POINT and others.

Anyway, of course the wiki should include the needed #include or option for every external command. I think we should define standard sections for every page. The FreeBASIC docs uses: Syntax, Usage, Parameters, Return value, Description, Example, Differences with QB (Sinclair Basic for us), See also... Some of them are redundant in many pages. A clear and updated documentation is very important in order to use the program. Since I'm writing a complex program in ZX Basic, I'm willing to work on the wiki at the same time.
Reply
#4
programandala.net Wrote:
boriel Wrote:I was thinking we should put required #include line also, shouldn't we?

At first I didn't understand what you mean... Then I realized I was compiling with the --sinclair option. I tried without it, and POS was not avalaible any more Smile By the way, why is it considered a Sinclair Basic issue? I supossed the --sinclair option added only some Sinclair Basic specific commands, like POINT and others.

Anyway, of course the wiki should include the needed #include or option for every external command. I think we should define standard sections for every page. The FreeBASIC docs uses: Syntax, Usage, Parameters, Return value, Description, Example, Differences with QB (Sinclair Basic for us), See also... Some of them are redundant in many pages. A clear and updated documentation is very important in order to use the program. Since I'm writing a complex program in ZX Basic, I'm willing to work on the wiki at the same time.

What --sinclair does is just include all the libraries containing SCREEN$, POINT and ATTR functions. But these libraries also contain POS and COL among other functions. Perhaps we should place these function (POS, COL) into another file?
Reply
#5
boriel Wrote:What --sinclair does is just include all the libraries containing SCREEN$, POINT and ATTR functions. But these libraries also contain POS and COL among other functions. Perhaps we should place these function (POS, COL) into another file?

I think so. They have nothing to do with Sinclair Basic.
Reply
#6
I hope they work. I included them under "library things" :-)

<!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Library#Library">http://www.boriel.com/wiki/en/index.php ... ry#Library</a><!-- m -->
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)