[fpc-devel] Questions regarding m68k-atari target
Karoly Balogh
charlie at scenergy.dfmk.hu
Sat Jan 29 13:13:08 CET 2022
Hi,
On Sat, 29 Jan 2022, Thorsten Otto via fpc-devel wrote:
> On Freitag, 28. Januar 2022 20:21:03 CET Karoly Balogh wrote:
>
>> a fixed GAS/LD support would be nice, of course.
>
> Yes, but currently i'm a bit lost here. Since that combination currently
> does not support "smart linking", i guess i'll stick to vasm for now.
Just for the record, the GNU as/ld is Atari specific, it's not a general
issue for FPC on m68k. We run just fine with GNU as/ld on Linux/m68k for
example, with all the bells & whistles enabled, but of course that's just
ELF, and doesn't need any special treatment.
> There are other parts that should be improved, and seem more important
> to me (like ARGV support, completing the GEMDOS/BIOS/XBIOS interface
> etc)
Totally agree here.
> Currently i'm trying to figure out whats wrong with readln() (used eg.
> when getting the help screen). On both TOS anfd MiNT, i have to press
> "return" three times. But can't find where readln(textfile) (without any
> extra arguments) is implemented. All i can find is some declaration in
> inc/system.fpd, and the procedure fpc_readln_end in inc/text.inc. Is
> that actually the function which is called? And how does that magic
> work?
All read/write I/O functions of the RTL just wrap to OS specific calls,
implemented in rtl/atari/sysfile.inc. Specifically, you want to look at
do_read() and do_write(). These just call gemdos_fread() and
gemdos_fwrite() for now, respectively. I think this is the main issue, as
I've seen GEMDOS has special calls for console I/O which are not being
utilized now. Or maybe you can set some file handle behavior, but we don't
do that either.
> I expect there some problem with expecting CR/LF also when reading from
> console (although the win32 platform does not seem to suffer from this)
Again, this isn't a generic problem, but Atari specific. I think the
problem is the special nature of the console window, at least there seem
to be special GEMDOS specific calls for console I/O. This of course add
some complexity, because I didn't know how to choose the right file I/O
function based on maybe the type of my file handle, or had no idea how
redirection worked, etc. So I just wired it to gemdos_fread(), because
that was kinda working (minus the 3 times enter thing). It certaily works
for file I/O, otherwise the compiler would be read anything properly, and
since even the compiler works, that can't be broken there.
I think gemdos_fread() to a con handle actually just blocks there in case
we try to read from stdin, and stdin is a console handle. FPC certainly
doesn't try to wait for enter 3 times.
Cheers,
--
Charlie
More information about the fpc-devel
mailing list