Topic: OPEN #, PRINT #, etc. usage


I'm trying to use the BASIC file stream access with a DivMMC Future board but seems I can't find the correct syntax, either the syntax is not accepted or I get an "invalid file name" error. All documents I can find explains how to load tap files and save basic programs, but nothing about file stream usage from BASIC.

Can someone explain the correct syntax to access files with OPEN # statement ?

Also I would like to do the same from assembly, is there some document explaing how to call the esxdos functions ?

I'm trying to refresh my knowledge of Spectrum programming, something I haven't done in over 30 years...

Thanks for any help.

Best regards,


Re: OPEN #, PRINT #, etc. usage

Hi Marco,

I may be totally wrong, but I don´t know about File-streams in standard Basic. Only streams for printer, screen.

On Betadisk/TR-DOS there was some functions for file-stream-access: https://www.worldofspectrum.org/pub/sin … Manual.txt

I don´t know if something like it exists on e.g. ZX Spectrum 128 +3

And I don´t know if esxDOS emulates these file-stream-function in it´s TRDOS-emulation or +3 syntax.



3 (edited by macca 2019-03-14 11:06:20)

Re: OPEN #, PRINT #, etc. usage

That helped a lot, thanks!
I can now use TRD files to store programs.
Streams works, sort of. Seems that it can write to streams but can't read them back. When I try to open a stream file for reading it always returns invalid stream error.
There is also a bit of confusion with the USR entry points, 15619 works but in another document (beta disk manual) I found 15360 that also works to enter DOS, 15636 that should run commands from BASIC but doesn't work (enters DOS and does nothing).

Are the sources of esxdos and all modules available somewhere ? I tried to do some searches without success.

Best regards,


Re: OPEN #, PRINT #, etc. usage

I think when you mount a TRD image the default is read-only. Not sure if the vdisk command supports opening it for writing. There's no support for random file access from BASIC in esxDOS. You can do it in machine code using the (secret) API, but if you want to use channels and streams you'd have to write your own handler for it. I am considering adding random file access support to UnoDOS 3, but thus far there hasn't been much interest in it.


Re: OPEN #, PRINT #, etc. usage

Did some more tests using Fuse to know that the syntax is correct.

Sequential stream write works, read doesn't work and always returns invalid stream.
Random access streams doesn't work at all, always returns nonsense in BASIC when reaching the PRINT or INPUT commands.

Also the MOVE command seems that doesn't do anything (it should release the space used by deleted files).

I have used the same programs with Fuse with betadisk enabled and they work perfectly, so I think the TR-DOS emulation has some bugs.

6 (edited by Luzie 2019-03-18 19:03:53)

Re: OPEN #, PRINT #, etc. usage

Maybe you should consider +3e ( http://www.worldofspectrum.org/zxplus3e/ ) for your streaming purposes instead of esxDOS?

macca wrote:

Also the MOVE command seems that doesn't do anything (it should release the space used by deleted files).

MOVE is not emulated. This is from the README of esxDOS 0.8.6:

Known Bugs
TR-DOS: FORMAT and MOVE commands don't work yet