dmsc/fastbasic

File I/O not working when cross-compiled

Closed this issue · 2 comments

Hey there.

It seems that cross-compiled FB doesn't allow disk I/O, doesn't see the D handler or the like.

When I cross-compile a basic open/write/close in FB, and load the resulting com file in any way under any DOS, I get error 130. Tried under DOS 2.5 and BWDos.

If I take the same lines and put it through FB, FBI, run direct OR compiled, the code runs fine, no errors.

In other words, file IO works like a charm using the Atari editor/compiler, but doesn't work at all for me using the cross compiler. (all those ? ERR() commands are just because I wanted to see what was breaking things).

Code:

open #1, 8, 0, "d1:test.txt"
? ERR()
? #1, "Hello world!"
? ERR()
close #1
? ERR()

Run direct on the system, error codes are all 1.
Compiled and run on system, again all 1.
Cross-compiled, I get error 130, 133, and 1.

dmsc commented

Hi, and thanks for the bug report!

Error 130 means that device does not exist. In the code you pasted, the "d1:" must be in uppercase, as the Atari OS only recognizes upper "D". With this change, your program works here, see attached ZIP, the ATR was generated with:

fb prog.bas
cp prog.xex dos25/
dir2atr -b Dos25 new.atr  dos25/

test-bug50.zip

Have Fun!

Oh, wow. Ok. I totally forgot the “Atari doesn’t really do lower case” situation and didn’t put two and two together on this one. Of course the device handle needs to be upper case, and it makes sense that in FB on the system itself it would work as it is in uppercase by default there as opposed to when I cross compiled.

I’ll close this for now, and check it out tomorrow. Thanks a million and great work on this thing!