Atari m68k lazarus / 68-Other OS ---------------------------------------------------------------------- peters060 · 2022-04-17 09:36 Hi all, I just thought I would introduce myself and take the opportunity to thank the fpc developers especially ChainQ and Thorsten who put a lot of effort into getting fpc working on Atari tos and mint. I've been long term Pascal "fan" but never had great opportunity to use it in my job. I started dabbling again with Atari PurePascal in 2020 and then, last year, discovered fpc. I tried porting the app I was working on and was able to get it running. My next aim was to use some fpc libraries.  Unfortunately, atari fpc doesn't find source files with long filenames, it only works with 8+3 even when it is installed on a suitable partition.  This means that any existing fpc apps cantor cannot be easily ported and fpc can't build itself. Maybe this could be added to feature request (wish list) ? ---------------------------------------------------------------------- marcov · 2022-04-17 11:31 Wishing is all good and dandy, but how do you expect this would work without renaming all sources to whatever limited convention atari supports? Actually we kept 8.3 till 2015 because of plain dos, but it was untenable to keep such limits forever on all targets. ---------------------------------------------------------------------- MarkMLl · 2022-04-17 11:38 Quote from: marcov on April 17, 2022, 01:31:37 pmActually we kept 8.3 till 2015 because of plain dos, but it was untenable to keep such limits forever on all targets. What version was that? If OP specifically wants to compile natively it would be worth his while investigating what's changed since both in the core libraries and extra packages. MarkMLl ---------------------------------------------------------------------- marcov · 2022-04-17 11:47 Quote from: MarkMLl on April 17, 2022, 01:38:23 pmQuote from: marcov on April 17, 2022, 01:31:37 pmActually we kept 8.3 till 2015 because of plain dos, but it was untenable to keep such limits forever on all targets. What version was that? If OP specifically wants to compile natively it would be worth his while investigating what's changed since both in the core libraries and extra packages. 3.0.0, together with win9x support; but those don't support m68k/Atari. But even those older versions had little kinks due to limited plain dos testing. I think the first step would be to find out what Atari community has to offer for such problems, that are not unique to Free Pascal(e.g. dos worked on a doslfn driver for a while). Otherwise you are limited to using the filesystems that can or cross compile. (and since recompiling FPC takes 8 minutes on a RPI4, I shudder how long it does on Amiga. Even a small twenty years ago, with FPC 1.0.x on Mac 840AV (the heaviest retail m68k machine from  Apple with a factory overclocked 68040/40 + 128MB of RAM, more than oldies typically have) it iirc took 35 minutes. added later: or maybe I misunderstand and there is a way to do lfn support, and must it be added to the RTL ---------------------------------------------------------------------- peters060 · 2022-04-17 16:32 Atari MINT os supports long filenames on FAT32 and ext2 so in theory I don't need to rename anything. However when compiling with fpc it fails to find the lib files.  When I renamed them to 8+3 then they are found. I suspect it's an issue in how fpc is getting the files but I don't know enough about how this works. ---------------------------------------------------------------------- MarkMLl · 2022-04-17 17:26 That sounds like an fpc.cfg problem... Somewhat later: I'm not sure the "right" way to do this, but running the FPC compiler with -va and looking for "Handling" lines shows what's being fed to it. What immediately stands out is this sort of thing Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i [0.008] Handling option "-Fu/usr/local/lib/fpc/3.2.2/units/x86_64-linux"  which is the expansion of Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i -Fu/usr/local/lib/fpc/$fpcversion/units/$fpctarget  Hardcoding (in fpc.cfg) that with something that doesn't embed quite as many dots in the directory name and uses a shorter target name might fix the problem. MarkMLl ---------------------------------------------------------------------- marcov · 2022-04-17 19:58 Quote from: peters060 on April 17, 2022, 06:32:19 pmAtari MINT os supports long filenames on FAT32 and ext2 so in theory I don't need to rename anything. However when compiling with fpc it fails to find the lib files.  When I renamed them to 8+3 then they are found. Exactly which lib files (.ppu ? .a ?), and which program couldn't find it. The compiler or the linker (vlink I assume)?  QuoteI suspect it's an issue in how fpc is getting the files but I don't know enough about how this works. Sometimes compiling with -va, piping that to file, and then searching for the filename in question can be a revelation. ---------------------------------------------------------------------- peters060 · 2022-04-17 22:24 I was using djLogOverSimpleLogger from slf4p If the name is reduced to 8+3 and all lower case , djsimple.pas, then the file is found. I will recreate the error and post it here. ---------------------------------------------------------------------- avra · 2022-04-17 23:10 Quote from: peters060 on April 17, 2022, 11:36:29 amUnfortunately, atari fpc doesn't find source files with long filenames, it only works with 8+3 even when it is installed on a suitable partition.  This means that any existing fpc apps cantor cannot be easily ported and fpc can't build itself. As an ex Atari MEGA STE user I do sympathize for what you are trying to do, but why don't you just use cross compilation from pc? ---------------------------------------------------------------------- peters060 · 2022-04-18 09:23 That's like saying, why not abandon all the other platforms and everyone just use Windows.  The whole point is to use fpc on Atari. I don't find cross compiling to be convenient.  I don't have enough space to set up multiple computers so i generally use either Atari or this phone. ---------------------------------------------------------------------- MarkMLl · 2022-04-18 09:59 Surely you can run a Windows emulator on an Atari >:-) Actually, I sympathise: I'd quite like to get FPC working on CCP/M-86 which is a distant cousin of (what used to be?) the Arati's underlying OS. "Surely you've got more than one computer?" was a quaint joke when Dave Moore was telling people how to debug FTL Modula-2 on systems which were very likely driven by an RS232 terminal, but now that every computer has a screen, keyboard, mouse... MarkMLl ---------------------------------------------------------------------- winni · 2022-04-18 10:17 Quote from: MarkMLl on April 18, 2022, 11:59:10 am Actually, I sympathise: I'd quite like to get FPC working on CCP/M-86 which is a distant cousin of (what used to be?) the Arati's underlying OS. MarkMLl Hi! It is called "Atari TOS". More details (in german ) http://www.atari-computermuseum.de/tos.htm Winni ---------------------------------------------------------------------- Handoko · 2022-04-18 10:30 Quote from: peters060 on April 18, 2022, 11:23:45 amThat's like saying, why not abandon all the other platforms and everyone just use Windows. I hope you can understand, we actually want to keep support for as many platforms as possible unfortunately Lazarus/FPC is a volunteer project. We are currently lack of manpower. Learning cross compiling is not easy, I know it. But that is a solution, you only need to invest some time at the beginning to understand how to do it. ---------------------------------------------------------------------- PascalDragon · 2022-04-18 10:36 Quote from: peters060 on April 17, 2022, 11:36:29 amMaybe this could be added to feature request (wish list) ? ChainQ already wrote on the Atari forum that long filenames are simply not yet supported on Atari, but if someone provides code for them they'll definitely be considered. For now you best use the cross compiler which does not have these restrictions. ---------------------------------------------------------------------- MarkMLl · 2022-04-18 11:04 Quote from: winni on April 18, 2022, 12:17:10 pmQuote from: MarkMLl on April 18, 2022, 11:59:10 amActually, I sympathise: I'd quite like to get FPC working on CCP/M-86 which is a distant cousin of (what used to be?) the Arati's underlying OS. It is called "Atari TOS". Thank you, I know. But my point is that by now it's unclear how much of the original TOS (nee CP/M-68K) is considered supportable, or if MiNT has completely superseded it. And while Turbo Pascal ran on CP/M-80 and CP/M-86 (hence on CCP/M-86), those OSes provided an API roughly comparable with MS-DOS v1 (no support for directories etc.) so I'd be surprised if FPC were to run on them without major surgery. MarkMLl ---------------------------------------------------------------------- peters060 · 2022-04-19 10:44 I know ChainQ is aware of the problem but I wanted to make sure a wider audience was aware of it. I did have a dig into the fpc code but couldn't identify where the units are loaded. ---------------------------------------------------------------------- marcov · 2022-04-19 12:03 Try to remove tf_use_8_3,   in compiler/systems/i_atari.pas ---------------------------------------------------------------------- winni · 2022-04-19 12:04 Hi! There was never a Turbo Pascal  Version for the Atari ST. But you could run a MSDOS-Emulator and then use the DOS version of TP. Pascal for Atari ST : * UCSD Pascal, ported to Motorola 68000 by Focus, Hannover * ST Pascal  from CCD (with the utils function EatSpaces ) The floppy disk layout was  the same as MSDOS but somewhere in the boot sector you hat to set a compatibility flag (bit). Beware of using 8th bit for filenames: Beyond #127 Atari had its own idea where to put äüö and the others. Winni ---------------------------------------------------------------------- MarkMLl · 2022-04-19 19:08 Quote from: winni on April 19, 2022, 02:04:38 pmThere was never a Turbo Pascal  Version for the Atari ST. But you could run a MSDOS- Emulator and then use the DOS version of TP. You miss my point. DR OSes, including CP/M-68K, didn't know about directories and that presumably affects the earliest versions of TOS. Software of that era including Turbo Pascal used fixed-length 8.3 filenames in FCBs and had no API for either changing directory or specifying that a file was in a particular directory. QuotePascal for Atari ST : * UCSD Pascal, ported to Motorola 68000 by Focus, Hannover * ST Pascal  from CCD (with the utils function EatSpaces ) Plus Hisoft HighSpeed Pascal. QuoteBeware of using 8th bit for filenames: Beyond #127 Atari had its own idea where to put äüö and the others. Also some DR OSes and derivatives used the MSB of the 8.3 filename in the FCB to indicate special file access attributes. That's probably later than the TOS fork. So I think what I'm really trying to say is that there are plentiful gotchas that can inflict any attempt to get something like FPC ported to an OS of that era... unless it really has been augmented with a unix-like (or at least MS-DOS v3 like) API. And I've done enough support etc. work to know just how difficult the OS imitation game can be. MarkMLl ---------------------------------------------------------------------- peters060 · 2022-04-19 20:30 This is the error: # ./fpc.ttp  -Wtmint -Sg  /usr/src/gemical/gemical.pas Free Pascal Compiler version 3.3.1 [2022/03/13] for m68k Copyright (c) 1993-2022 by Florian Klaempfl and others Target OS: Atari ST/STE Compiling /usr/src/gemical/gemical.pas Compiling /usr/src/gemical/mainical.pas mainical.pas(86,5) Fatal: Can't find unit djLogOverSimpleLogger used by MainIcal Fatal: Compilation aborted Error: ppc68k.ttp returned an error exitcode The src code is on ext2 partition and the filename is djLogOverSimpleLogger.pas The fpc.cfg is: -l -view #-Xs -O2 -FDbin -Fu/f/Applications/fpascal/units/atari/* ---------------------------------------------------------------------- winni · 2022-04-19 21:28 Quote from: MarkMLl on April 19, 2022, 09:08:44 pm You miss my point. DR OSes, including CP/M-68K, didn't know about directories and that presumably affects the earliest versions of TOS. Software of that era including Turbo Pascal used fixed-length 8.3 filenames in FCBs and had no API for either changing directory or specifying that a file was in a particular directory. Hi! Forget about DR and CP/M in relation with the Atari ST. The TOS was a simply clone  of MSDOS concerning  the file system. You could read and write MSDOS floppies if you set the compatibility flag. You could create, delete and rename directories. Either on the GEM desktop or on the TOS command line. And you could allocate nearly all of your RAM (1 MB!!!) in one array which was a great progess. In opposite with the missdesigned 386 where you could only allocate chunks of 64 kB, which lead to lists of 64 kB chunks in Turbo Pascal on DOS. Winni ---------------------------------------------------------------------- peters060 · 2022-04-20 07:17 I'm running Freemint and it's on a 68060@60MHz. ---------------------------------------------------------------------- PascalDragon · 2022-04-20 08:58 Quote from: peters060 on April 19, 2022, 12:44:22 pmI know ChainQ is aware of the problem but I wanted to make sure a wider audience was aware of it. A wider audience isn't helping if a person that needs to implement it is to be someone that has knowledge about Atari's long file name support and I'd wager that nearly everyone here does not have that. Quote from: peters060 on April 19, 2022, 12:44:22 pmI did have a dig into the fpc code but couldn't identify where the units are loaded. The compiler is simply using what the RTL provides. You need to implement the correct handling in rtl/atari/sysfile.inc and rtl/atari/sysdir.inc and then the compiler will implicitely pick it up as well when it's rebuild with the adjusted RTL. Quote from: marcov on April 19, 2022, 02:03:20 pmTry to remove tf_use_8_3,   in compiler/systems/i_atari.pas That's not helping as long as the long file name support is not implemented in the Atari RTL. ---------------------------------------------------------------------- winni · 2022-04-20 14:41 Hi! If someone has old docs or filenames with the Atari-ST-homebrew 8th bit - here is the glyph table for all chars from #0 to #255. Between #32 and #127 it is ASCII Winni ---------------------------------------------------------------------- peters060 · 2022-04-21 10:53 @PascalDragon So fpc uses the rtl to find the units for compilation ? It looks like the atari rtl uses the gemdos calls so maybe it would have to be extended with something freemint compatible.  I don't know how freemint handles long filenames. I will see what I can learn. Thanks ---------------------------------------------------------------------- PascalDragon · 2022-04-21 12:16 Quote from: peters060 on April 21, 2022, 12:53:36 pmSo fpc uses the rtl to find the units for compilation ? The compiler completely relies on the RTL for file access and directory iteration. So if you fix it so that long filenames work for normal applications they should also work for the compiler (aside from maybe some setting like marcov mentioned). ---------------------------------------------------------------------- MarkMLl · 2022-04-21 12:43 Quote from: PascalDragon on April 21, 2022, 02:16:49 pmQuote from: peters060 on April 21, 2022, 12:53:36 pmSo fpc uses the rtl to find the units for compilation ? The compiler completely relies on the RTL for file access and directory iteration. So if you fix it so that long filenames work for normal applications they should also work for the compiler (aside from maybe some setting like marcov mentioned). For OP's benefit, I think the important point here is that it doesn't rely on any external make program with its own path handling. From the POV of somebody interested in the overall family of DR OSes, the documentation I've seen suggests that TOS/GEMDOS moved away from the FCB-based API fairly early but it doesn't explicitly document (i.e. in https://freemint.github.io/tos.hyp/en/gemdos_file.html#Fopen etc.) what the limitations are. MarkMLl