WriteLn and DOSBox lazarus / 68-Other OS ---------------------------------------------------------------------- Ñuño_Martínez · 2021-04-05 15:28 Not sure if it is a problem of Free Pascal or DOSBox, but WriteLn isn't working correctly in that emulator.  It does in Windows XP. See next simple program: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program test;begin  WriteLn ('This is a test program.  Should write text in the console.');  WriteLn ('This is a test program.', '  Should write text in the console.')end. Compiling for DOS 32bit Go32V2 and executing in DOSBox it looks like the attached file.  See that first WriteLn renders incorrectly, while second renders correctly. Also see that heaptrc output has issues too. Maybe that's why FPC doesn't work in DOSBox (internal error 2004121202)? ---------------------------------------------------------------------- lucamar · 2021-04-05 16:16 I can confirm that there is somethign fishy going on; see attached image (FPC 3.0.4 in DOSBox 0.74 under Linux x86_64) ---------------------------------------------------------------------- Jonas Maebe · 2021-04-05 17:27 You may want to try DOSBox-X, which aims for compatibility with regular programs as well rather than just with games. I recently read something about issues with FPC's LFN support and DOSBos-X, but afaik other than that it works. ---------------------------------------------------------------------- MarkMLl · 2021-04-05 17:45 I swear I've seen something like that before, but I've never used DOSBox, only DosEmu, Lucamar's example is downright weird: every 4th column lost except for the vertical lines. MarkMLl ---------------------------------------------------------------------- Ñuño_Martínez · 2021-04-05 19:39 Quote from: Jonas Maebe on April 05, 2021, 07:27:28 pmYou may want to try DOSBox-X, which aims for compatibility with regular programs as well rather than just with games. I recently read something about issues with FPC's LFN support and DOSBos-X, but afaik other than that it works.I didn't know about this project.  I should take a look. Thanks. Quote from: lucamar on April 05, 2021, 06:16:27 pmI can confirm that there is somethign fishy going on; see attached image (FPC 3.0.4 in DOSBox 0.74 under Linux x86_64) Quote from: MarkMLl on April 05, 2021, 07:45:33 pmLucamar's example is downright weird: every 4th column lost except for the vertical lines. That's just what happens with the installer. And the same problem with FreeDOS. ---------------------------------------------------------------------- Re-searcher · 2021-05-21 17:41 @ Ñuño_Martínez , You should not use Dosbox but the command prompt from windowsXP Now install the program Go32V2 in de command prompt. Erik ---------------------------------------------------------------------- Handoko · 2021-05-21 18:04 I remember the issue write does not work correctly on DosBox was asked one or two years ago. ---------------------------------------------------------------------- MarkMLl · 2021-05-21 18:36 Quote from: MarkMLl on April 05, 2021, 07:45:33 pmLucamar's example is downright weird: every 4th column lost except for the vertical lines. ...The difference obviously being that the vertical lines aren't in the Unicode BMP. MarkMLl ---------------------------------------------------------------------- lucamar · 2021-05-21 19:35 Quote from: MarkMLl on May 21, 2021, 08:36:05 pmQuote from: MarkMLl on April 05, 2021, 07:45:33 pmLucamar's example is downright weird: every 4th column lost except for the vertical lines....The difference obviously being that the vertical lines aren't in the Unicode BMP. I don't understand what you're trying to say; the problem is everywhere; just look at the menus: intead of: | New from template...| it shows:   Ne  f om t mpl te . .| Note also that there is no problem with the right-side vertical lines. In fact, of no single character can be said that it never appears except those on the far left, and that's probably because their position not their values. Last, WTH has the unicode BMP to do with this? Like any other DOS emulator (or even DOS itself), DOSBox doesn't use Unicode but IBM code pages and FP has been working correctly* inside it up to now. Which means something has changed in the IDE itself, introducing some bug. * Well, more or less, depending on the code page since some don't contain all the "box" characters. ---------------------------------------------------------------------- MarkMLl · 2021-05-21 20:00 The point I'm trying to make is that characters outside the BMP appear to be going through OK, so it could be something very weird related to character handling on that platform. As I've said, I think I've seen something similar with DOSEmu in the past... which probably wouldn't have been FPC, which suggests a platform problem (e.g. a commonly-used library to convert between DOS-like screen handling and Curses or whatever). MarkMLl ---------------------------------------------------------------------- lucamar · 2021-05-21 20:37 Note that Ñuño also said:Quote from: Ñuño_Martínez on April 05, 2021, 09:39:30 pmAnd the same problem with FreeDOS. so it doesn't seem to be a problem of the host platform but of the IDE itself. Unless he means "FreeDOS in DosEmu" or alike, o.c. I'll have to take the dust out of one of my older computers and test in real hardware ... some day or other ---------------------------------------------------------------------- MarkMLl · 2021-05-28 19:30 If I were to look at this running natively e.g. because I decided to re-cap a scrap PC, what would I need to know? Presumably I'd need FreeDOS (which I've never played with) but what else... Go32V2? Where do I find the latter etc.? I'd be very surprised if there really were a FreeDOS problem, since it's used by HP etc. to host setup programs. MarkMLl ---------------------------------------------------------------------- lucamar · 2021-05-28 21:15 Quote from: MarkMLl on May 28, 2021, 09:30:09 pmIf I were to look at this running natively e.g. because I decided to re-cap a scrap PC, what would I need to know? Presumably I'd need FreeDOS (which I've never played with) but what else... Go32V2? Where do I find the latter etc.? You'd need a DOS (it doesn't have to be FreeDOS, though I'd recommend it) computer and the Go32v2 release of Free Pascal, nothing else. Though, if you can (and want to) I'd also install a full Borland/Turbo Pascal (e.g. v7.0). And maybe Windows 3.1 and Delphi 1.0* I have got preconfigured IDE disks with MS/Free/Open- DOS with quite a lot of things (editors, TP/BP, BC++, MASM, FP, Win3.11+Delphi, several tools, ...) but that might be overkill if you just want to do a little test * There is a free download of Delphi 1 Client/Server at Embarcadero ... ---------------------------------------------------------------------- MarkMLl · 2021-05-29 20:43 Well, that's been an interesting exercise... ** *** Leaving everything else aside, I can confirm that FPC 3.2.0 on Go32V2 running directly on i386 hardware (Sony Miaow laptop) renders all characters and character positions correctly, in particular the menu that you showed in your posting. So I'd put my money on this being a problem in a library or BIOS facility used by multiple x86 emulators. **** ** The reason I was interested in looking at this was that I wanted to see how nicely FreeDOS played with other OSes etc. So far, I suspect that most of the problems I've seen were down to misinterpreted sector addresses, i.e. LBA vs non-LBA partition table entries, but things were hardly helped by- at one point- my thinking that I couldn't boot the FreeDOS CD and inadvertently having my drive letters messed up by the USB loader on floppy. This really takes me back to messing around with LILO 25 years ago... *** I must admit that I've got a weakness for reimagined OSes. One of the nicest I've come across was IBM's VM/CMS, where the mainframe card reader and punch had been quietly turned into an inter-user messaging system. **** I think this is the first time I've played with a DOS extender since about 1989. MarkMLl ---------------------------------------------------------------------- Re-searcher · 2021-06-21 09:40 @MarkMLI Can you tell us which dos version is installed on this laptop (Sony Miaow laptop) ? Before installing GO32V2. Erik ---------------------------------------------------------------------- MarkMLl · 2021-06-21 10:20 Quote from: Re-searcher on June 21, 2021, 11:40:56 am@MarkMLI Can you tell us which dos version is installed on this laptop (Sony Miaow laptop) ? Before installing GO32V2. Erik The latest FreeDOS. I messed around with various combinations using a scratch disk, but I think I ended up leaving it on a secondary partition of the live disk booted via GRUB hence one of the non- standard boot managers. MarkMLl ---------------------------------------------------------------------- lucamar · 2021-06-21 11:35 Quote from: MarkMLl on May 29, 2021, 10:43:19 pm** The reason I was interested in looking at this was that I wanted to see how nicely FreeDOS played with other OSes etc. So far, I suspect that most of the problems I've seen were down to misinterpreted sector addresses, i.e. LBA vs non-LBA partition table entries, [...] More problems than that gives trying to use a GPT partitioned vs. a traditional one, and since most hardware now comes GPT-partitioned ... Though I'm not quite as up-to-date as I used to be in FreeDOS; we just use v1.2 in old (or "make-up to look old") hardware when we need to install a new one; maybe the new 1.3 to-be is better in this respect. Of course one solution, as you've discovered, is to use GRUB (or similar) to boot, though you might also find some problems with that in some configurations. That's probably one of the reason why most so- called "FreeDOS" (meaning "non-OS") computers actually have some kind of small Linux (like EndlessOS). QuoteLeaving everything else aside, I can confirm that FPC 3.2.0 on Go32V2 running directly on i386 hardware (Sony Miaow laptop) renders all characters and character positions correctly, in particular the menu that you showed in your posting. So I'd put my money on this being a problem in a library or BIOS facility used by multiple x86 emulators. **** That's actually quite interesting ... and rather baffling, since the IDE has been working quite well till now and the only piece I can think of having to bear with this would be the Bosch (virtual) VGA BIOS, and that's a really mature and optimized piece of software. The other thing it might be would be the VGA emulation, but those are also rather mature and well understood. I would love to have the time to investigate this more fully, sounds interesting; unfortunately I haven't got it ---------------------------------------------------------------------- MarkMLl · 2021-06-21 14:44 Quote from: lucamar on June 21, 2021, 01:35:37 pmMore problems than that gives trying to use a GPT partitioned vs. a traditional one, and since most hardware now comes GPT-partitioned ... Though I'm not quite as up-to-date as I used to be in FreeDOS; we just use v1.2 in old (or "make-up to look old") hardware when we need to install a new one; maybe the new 1.3 to-be is better in this respect. Well, this is specifically my "old OS" laptop: formatted using Windows XP and usually booting into Debian "Lenny". However, since setting that up I've discovered that I can run a Lenny image entirely happily under Docker, which I suspect would also obfuscate (render irrelevant due to its being inaccessible) things like the distinction between classic and GPT partitioning. And if Docker's won't play ball there's always Qemu, or at a pinch UML (although if hosted on 64-bit hardware it can't run a 32-bit kernel). QuoteOf course one solution, as you've discovered, is to use GRUB (or similar) to boot, though you might also find some problems with that in some configurations. That's probably one of the reason why most so- called "FreeDOS" (meaning "non-OS") computers actually have some kind of small Linux (like EndlessOS). I suspect that much of FreeDOS's compatibility with modern hardware is based on HP using it on a diagnostic partition. QuoteQuoteLeaving everything else aside, I can confirm that FPC 3.2.0 on Go32V2 running directly on i386 hardware (Sony Miaow laptop) renders all characters and character positions correctly, in particular the menu that you showed in your posting. So I'd put my money on this being a problem in a library or BIOS facility used by multiple x86 emulators. **** That's actually quite interesting ... and rather baffling, since the IDE has been working quite well till now and the only piece I can think of having to bear with this would be the Bosch (virtual) VGA BIOS, and that's a really mature and optimized piece of software. The other thing it might be would be the VGA emulation, but those are also rather mature and well understood. I would love to have the time to investigate this more fully, sounds interesting; unfortunately I haven't got it But as I've said before, the issue appeared to be whether the characters being displayed were strict-ANSI or extended. What's the saying... "When you have eliminated the impossible the remainder, however unlikely, must be the truth"? :-) MarkMLl ---------------------------------------------------------------------- MarkMLl · 2021-07-03 11:43 Quote from: lucamar on June 21, 2021, 01:35:37 pmThat's actually quite interesting ... and rather baffling, since the IDE has been working quite well till now and the only piece I can think of having to bear with this would be the Bosch (virtual) VGA BIOS, and that's a really mature and optimized piece of software. The other thing it might be would be the VGA emulation, but those are also rather mature and well understood. I would love to have the time to investigate this more fully, sounds interesting; unfortunately I haven't got it I wonder why the Bochs manual has this, with no further explanation? "6.3 Text-mode is broken in some ancient DOS program" https://bochs.sourceforge.io/doc/docbook/user/textmode-problems.html MarkMLl ---------------------------------------------------------------------- lucamar · 2021-07-03 12:19 Quote from: MarkMLl on July 03, 2021, 01:43:05 pmI wonder why the Bochs manual has this, with no further explanation? "6.3 Text-mode is broken in some ancient DOS program" https://bochs.sourceforge.io/doc/docbook/user/textmode-problems.html Probably because lots of EGA/VGA/SVGA clones BIOSes (nevermind the hardware itself) were quite buggy so as soon as you tried something "esoteric" like, for example, change the number of lines (e.g. to 28/30 or 50/60 lines) all kinds of mayhem might ensue: characters chopped off, cursor mishaps, vsync going bonkers, etc. I wrote a program to do precisely that (change the lines to one of twelve modes) and it's full of kluges to deal with those bugs, along with a long list of cards/chipsets/BIOSes with some problem or other and whether they could be worked around somehow. ---------------------------------------------------------------------- Anon1024 · 2022-02-12 06:56 Just adding some info to fully resolve/explain this issue. The WriteLn issue is (almost certainly) not due to a bug in FPC; it is due to a bug in DOSBox. To test, I used the FPC installer for DOS. There was no special reason to use the FPC installer; I only used it because I noticed the strange display issues when I had previously tried running it under DOSBox. The installer displayed fine on:     * FreeDOS 1.2 running under QEMU     * FreeDOS 1.3 running under Bochs 2.7     * DOSBox-X v0.83.22 The installer did not display fine on DOSBox (v0.74-3). If interested, see the attachment, 'install.png' which shows another example of what other people have described. Interestingly, there seems to be a deeper issue with DOSBox which may be related to the screen corruption issue. In DOSBox, when INSTALL.EXE was run, it could not find the INSTALL.DAT file. (The error is shown in the attachment.) Both files reside in the same directory. The exact same directory was used with DOSBox-X and it worked fine. Cheers! ---------------------------------------------------------------------- Ñuño_Martínez · 2022-04-16 16:40 AFAIK FreeDOS uses some code from DOSbox so maybe that's why both have the same behavior.