2.3 version

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.3 version

Post by Mr. Kibernetik »

New function will be implemented:
FILE_END (n$)
returns 1 if file pointer of specified file [n$] is currently at the end of file. Otherwise it returns 0.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.3 version

Post by Mr. Kibernetik »

New function will be implemented:
FILE_POS (n$)
returns current position of file pointer for file [n$].

Dalede
Posts: 131
Joined: Fri Dec 28, 2012 4:00 pm
Location: Grass Valley, CA, USA
Contact:

Re: 2.3 version

Post by Dalede »

Looking good. Here are a few more items to consider.

The ASC and CHR$ functions (added in 2.2) can be used to analyze binary data a byte at a time but there doesn't seem a way to read binary data from a file although there is a way to write it using CHR$(n);

There needs to be commands to deal with the files themselves, not just the contents. We can create and delete a file but a few more would be nice.

1. copy a file to another name (great for creating a backup)
2. rename a file
3. read a list of files in the current folder. Perhaps a pseudo file called DIR could be created that when opened can be used to read the filenames in the folder.

Dale

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.3 version

Post by Mr. Kibernetik »

Dalede wrote:Looking good. Here are a few more items to consider.

The ASC and CHR$ functions (added in 2.2) can be used to analyze binary data a byte at a time but there doesn't seem a way to read binary data from a file although there is a way to write it using CHR$(n);

There needs to be commands to deal with the files themselves, not just the contents. We can create and delete a file but a few more would be nice.

1. copy a file to another name (great for creating a backup)
2. rename a file
3. read a list of files in the current folder. Perhaps a pseudo file called DIR could be created that when opened can be used to read the filenames in the folder.

Dale
Yes, good suggestions.

Binary reading is already announced as: FILE n$ READ x

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.3 version

Post by Mr. Kibernetik »

New command will be implemented:
FILE n$ SETPOS x
sets current position of file pointer for file [n$] to value [x].

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.3 version

Post by Mr. Kibernetik »

New command will be implemented:
OPTION FILEMODE INSERT/OVER
sets file writing functions into insert or overwrite mode. This affects how data is written to the file. In insert mode, file writing functions insert new data at position of file pointer, shifting existing data so nothing is overwritten. In overwrite mode, file writing functions overwrite existing data. Default is overwrite mode.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.3 version

Post by Mr. Kibernetik »

New command will be implemented:
FILE n$ WRITE x
writes byte (value 0..255) from variable [x] to file [n$].
It is possible to specify several variables to write multiple bytes:
FILE n$ WRITE x,y,...

Dalede
Posts: 131
Joined: Fri Dec 28, 2012 4:00 pm
Location: Grass Valley, CA, USA
Contact:

Re: 2.3 version

Post by Dalede »

Always converting binary to numbers seems a bit difficult to work with. For writing strings can also write binary data directly using strings. It would be nice to be able to also read binary data into a string so that it stays in binary form, either in 1 byte size chunks or perhaps even fixed length chunks. These days of unicode even the interpretation of text some be complicated.

Dale

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.3 version

Post by Mr. Kibernetik »

Dalede wrote:Always converting binary to numbers seems a bit difficult to work with. For writing strings can also write binary data directly using strings. It would be nice to be able to also read binary data into a string so that it stays in binary form, either in 1 byte size chunks or perhaps even fixed length chunks. These days of unicode even the interpretation of text some be complicated.
I cannot understand your idea. Can you please explain it a bit more?

Dalede
Posts: 131
Joined: Fri Dec 28, 2012 4:00 pm
Location: Grass Valley, CA, USA
Contact:

Re: 2.3 version

Post by Dalede »

Mr. Kibernetik wrote:
Dalede wrote:Always converting binary to numbers seems a bit difficult to work with. For writing strings can also write binary data directly using strings. It would be nice to be able to also read binary data into a string so that it stays in binary form, either in 1 byte size chunks or perhaps even fixed length chunks. These days of unicode even the interpretation of text some be complicated.
I cannot understand your idea. Can you please explain it a bit more?
What I am talking about is a binary number from 0 to 255 can be stored in a single byte but a basic number can take 1 to 3 digits display the number and it is stored in memory not at the binary digit but a floating point number. However a string of one character can be store in one byte and can have all of the values from 0 to 255 although not all of them are visible to the eye when the character is prints. A string value is true binary. So long has basic can manipulate strings with compares, disassembly, and assembly it can serve as a way to manipulate true binary. This can aid in working with binary files instead of always converting to a floating point number in the range of 0 to 255.

Of course the real power will come when you can also manipulate bytes of data using AND, OR and XOR capabilities. These could be used directly to manipulate a string or if you chose you could could even implement them for numbers I suppose if you assume a binary value.

Dale

Post Reply