Jump to content
IGNORED

Why is the POINT instruction not accepted by the BASIC interpreter?


Recommended Posts

In several BASIC manuals I read that the format of the POINT instruction is this:

 

POINT #n,x,y

 

where n = iocb channel

x = bytes

y = sector

 

whatever I try I always get an ERROR already when I type this instruction on a line, no matter what value n, x or y are.

 

Ofcourse the #n is already open in my example.

 

Checked on rev. B and rev. C basic.

 

Is my documentation wrong?

 

The NOTE instruction (same format!) works great!

 

I hope someone can explain it to me.

 

Thanks

Marius

Link to comment
Share on other sites

From http://www.atariarchives.org/creativeatari/Using_Disks_With_Atari_Basic.php:

 

POINT #reference number, sector variable, byte variable: This physically POINTs the disk head to the sector and byte. If that sector and byte are not located within the file opened with that reference number, you get an error message.

 

So if you're getting an error, the sector and byte you're referencing must not be found within the file.

Link to comment
Share on other sites

From http://www.atariarch...Atari_Basic.php:

 

POINT #reference number, sector variable, byte variable: This physically POINTs the disk head to the sector and byte. If that sector and byte are not located within the file opened with that reference number, you get an error message.

 

So if you're getting an error, the sector and byte you're referencing must not be found within the file.

 

...which means a program uses NOTE to remember where it is in the file, and then later it uses POINT to go directly there again.

Link to comment
Share on other sites

Some Doses use sector number, others provide a more useful sector offset which allows true random access.

With sector # only you need to read the whole file then build your own index.

 

Thanks for all replies guys. The problem is: I knew this already, and I obviously did not express myself right.

 

The problem is the basic interpreter simply does NOT understand the POINT instruction. It results in an error already as soon as you press RETURN.

 

try this:

10 POINT #1,327,29 (or whatever values)

 

It results in:

 

ERROR - 10 POINT #1,327,29

 

If my values would be wrong, it would be result in an error during the RUN of the program. The values are RIGHT. I found these values using NOTE #1,x,y (which works).

 

The line above results (ofcourse) in an ERROR 17.

 

In turbobasic it works. So my question again: why is the POINT instruction not accepted by the BASIC interpreter?

Link to comment
Share on other sites

Are you sure they have to be variables with POINT (syntax wise)? I know they have to be with NOTE since you are gettnig the position. With most DOS's you are only going to be giving POINT values you received from doing NOTE so normally you would be using variables though. It does look like you are not getting a syntax error but an error in execution of the line. I believe with SpartaDos the values used are more of a file position vs a sector/offset so you might be able to use values not necessarily received from a NOTE command.

 

NOTE and POINT are useful for...

(1) Saving a position in a file and returning to it while a program is running.

(2) Use Note to build an index file with some utility program once. Anytime the file you indexed is copied or moved you would have to rebuild the index (except maybe not with SpartaDos)

(3) Read through the file and build an index on disk or in an array at program startup with NOTE, and then you can use POINT to randomly access the data.

 

try something like POINT #1, 255, 29 and see if you get a different error. If the first parameter is sector offset it probably has to be 0 to 255.

Edited by kenfused
Link to comment
Share on other sites

Isn't there another I/O command that also must be a variable? It strikes me that there is one where in Microsoft Basic, it will accept a numeric value, but in regular Atari Basic, it must be a variable?

Can't remember what it is, and may be related to the same code sequence used for both in A8 Basic. (?)

-Larry

 

Atari Basic, has to be variables. Turbo Basic, can be numeric or an expression.

Link to comment
Share on other sites

GET and INPUT - variables only as parms aside from IOCB#, although that's natural and obvious.

XIO - any parm can be a variable or expected type of expression.

OPEN/CLOSE - num expression or variable.

NOTE - num variables only aside from IOCB#, but again "natural and obvious"

 

It might well be that they mistakenly defined the last 2 parameters for POINT as having to be variables.

Although at the time of Basic being written, Dos 1 was probably the only one in existence and relative indexing wasn't available, so it probably didn't make sense to allow constants at that time.

Link to comment
Share on other sites

I just tried it out and find it weird they made it work that way. Time to break out the Atari Basic sourcebook and see if he gives a reason. There is little reason to use constants with most DOS's but the fact they did it that way means you can't use an array entry either.

Link to comment
Share on other sites

  • 1 month later...

Some Doses use sector number, others provide a more useful sector offset which allows true random access.

With sector # only you need to read the whole file then build your own index.

 

Thanks for all replies guys. The problem is: I knew this already, and I obviously did not express myself right.

 

The problem is the basic interpreter simply does NOT understand the POINT instruction. It results in an error already as soon as you press RETURN.

 

try this:

10 POINT #1,327,29 (or whatever values)

 

It results in:

 

ERROR - 10 POINT #1,327,29

 

If my values would be wrong, it would be result in an error during the RUN of the program. The values are RIGHT. I found these values using NOTE #1,x,y (which works).

 

The line above results (ofcourse) in an ERROR 17.

 

In turbobasic it works. So my question again: why is the POINT instruction not accepted by the BASIC interpreter?

 

Here's an example of NOTE, POINT usage in Atari Basic (from my decades old Phonebook program):

 

.......

870 ? :? " Searching ";

875 NOTE #1,SECTOR,BYTE:INPUT #1;RECORD$

880 IF RECORD$(1,15)<>LASTNAME$ THEN 875

885 IF RECORD$(16,30)<>FIRSTNAME$ THEN 875

886 IF RECORD$(125,125)=" " THEN 893

887 POSITION 2,8:ATTR$="ANUNSYNI"

888 ? " Record is already deleted. No " :? " action will be taken. ";

889 ? "}";:FOR WAIT=1 TO 500:NEXT WAIT

890 CLOSE #1:GOTO 45

893 RECORD$(125,125)="D"

895 ? :? :? " DELETING...";

900 POINT #1,SECTOR,BYTE:PRINT #1;RECORD$

905 GOTO 830

.......

Link to comment
Share on other sites

  • 8 years later...

Hi there....

I'm in the same kind of trouble too....

I have a binary file than contains 10 bytes from 1 to 10

i want to open the file, point to the 5th byte, and read it and every next bytes...

Like this

 

OPEN  #1,4,0,"D:NUMBERS.BIN"

POINT #1,5

FOR F=1 TO 3

GET #1,A

?A

NEXT F

CLOSE #1

 

result: 5,6,7

 

I'm almost certain I did this in Atari basic in the 80's...

I used the POINT command to SEEK to a position in a file before reading.

Or was this in Quick Basic ?

The Note and Point are used for sector/bytes access.

I remember using such command to acces random data in a file, like a database file...

Was in on Atari ?

 

I need to do so in TurboBasic XL 1.5

Am I missing the "point" ????

 

Link to comment
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...