| kerravon Ligao, Free World North, 21.02.2024, 07:24 |
8086 rules (Miscellaneous) |
Assuming I had followed these rules: https://en.wikipedia.org/wiki/Protected_mode This was not without its limitations. If an application utilized or relied on any of the techniques below, it would not run: Segment arithmetic Privileged instructions Direct hardware access Writing to a code segment Executing data Overlapping segments Use of BIOS functions, due to the BIOS interrupts being reserved by Intel[31] In reality, almost all DOS application programs violated these rules ... what could I actually do, assuming I had an 80286 computer? "binary compatibility with real-mode code" - sounds good. "the ability to access up to 16 MB of physical memory, and 1 GB of virtual memory" - sounds good. But ... WHERE? Is this something I could do on OS/2 1.x? With an MZ executable? A .com? What are they advertising? NE executables didn't exist except on MSDOS 4.0, which may or may not buy something. Is that what they are advertising? I didn't use OS/2 1.x, but it may have had an MSDOS window and an MSDOS fullscreen (as modern OS/2 does). Did something work on either of those if you followed "the rules"? As opposed to a program that DIDN'T follow the rules, e.g. it wouldn't run in the window, and you were forced to use the fullscreen. I've heard of something called the "penalty box" or "sin bin" for badly-behaved programs running on OS/2? Something like that? Or did they decide that there were so few programs that obeyed the rules, that no-one actually built anything to accommodate programs that had followed the rules? Or was the problem that MSDOS itself had used segment arithmetic in the MZ executable format such that it was not possible to run an unmodified MZ executable (at least one with more than 64k of code), in protected mode, no matter how well behaved the actual code was? Thanks. Paul. |
|
| Japheth Germany (South), 21.02.2024, 09:03 @ kerravon |
8086 rules |
> "the ability to access up to 16 MB of physical memory, and 1 GB of virtual > memory" - sounds good. > > But ... WHERE? > > Is this something I could do on OS/2 1.x? > > With an MZ executable? A .com? > > What are they advertising? > > NE executables didn't exist except on MSDOS 4.0, > which may or may not buy something. Is that what > they are advertising? Yes. NE binaries support both real-mode and protected-mode apps. The 1 GB of virtual memory, I guess that's just the theorectical limit of 8192 LDT and 8191 GDT descriptors, each with limit -1, meaning 64 kB. --- |
|
| Rugxulo Usono, 21.02.2024, 10:38 @ Japheth |
8086 rules |
> Yes. NE binaries support both real-mode and protected-mode apps. Probably because Windows 3.0 (1990) still (partially) supported 8086. |
|
| kerravon Ligao, Free World North, 21.02.2024, 11:02 @ Japheth |
8086 rules |
> > NE executables didn't exist except on MSDOS 4.0, > > which may or may not buy something. Is that what > > they are advertising? > > Yes. NE binaries support both real-mode and protected-mode apps. The 1 GB > of virtual memory, I guess that's just the theorectical limit of 8192 LDT > and 8191 GDT descriptors, each with limit -1, meaning 64 kB. Ok, thanks. So - there were compilers/linkers capable of building NE executables in the late 1980s. MSDOS 4.0 was not available for purchase as far as I know. Windows 3.0 on an 8086 could execute NE executables I think, but you couldn't do an INT 21H to write to stdout. So - as a law abiding citizen, who wanted to follow Intel's 8086 rules so that I would be in pole position when the IBM PC AT came out - how exactly was I supposed to write an MSDOS application in say Dec 1983 (when MSDOS 2.0 was available, and the 80286 was available, but before the IBM PC AT had actually shipped), so that as soon as I got my hands on an IBM PC AT (in 1984), I could whip up a protected mode 16-bit OS and run my *existing* MSDOS binaries (that followed the rules)? Or if not Dec 1983 - WHEN could I do ANYTHING sensible? What's the point of spending all that effort to follow the rules if it buys me NOTHING? Or rather - what needed to happen so that law-abiding citizens got rewarded for all their effort? Can you create a timeline or game plan that would benefit those who spent the effort to follow rules? Thanks. Paul. |
|
| mceric Germany, 21.02.2024, 11:07 @ kerravon |
8086 rules |
> https://en.wikipedia.org/wiki/Protected_mode > > This was not without its limitations. If an application utilized or relied > on any of the techniques below, it would not run: > > Segment arithmetic Segment arithmetic IS a limitation. A workaround to soften the pain of only being able to access 64k at a time by allowing those 64k to start at any multiple of 16 bytes. Being able to use 32-bit offsets directly is much better. > Privileged instructions > Direct hardware access This is configurable. You can use protected mode to tap or block direct I/O, but you can also give protected mode tasks full permissions for all I/O ports. Many instructions which are privileged did not even exist on 8086. They are privileged to make it possible to prevent tasks from interfering with each other. > Writing to a code segment This also is configurable: https://en.wikipedia.org/wiki/Segment_descriptor As far as I remember, write-protected code segments became the default for Windows much later than Win9x, because app writers were used to overwriting code :-p > Executing data > Overlapping segments Both probably is a misunderstanding: You can easily use the same area of memory for code and data, but you may have to use different segment descriptors. Nobody stops you from letting segment descriptors point to identical or at least overlapping areas of RAM. You even get the flexibility to let the areas start at any offset instead of only multiples of 16 bytes like on 8086. However, the segment length has to be a multiple of 4 kB if you want it to be more than 1 MB. Operating systems with paging will want you to set both length and offset to multiples of 4 kB. > Use of BIOS functions, due to the BIOS interrupts being reserved by > Intel[31] Very few PC designs kept the first 32 interrupts reserved for the CPU. I think the TI Professional PC did. However, most BIOSes will not like being called directly in protected mode. On the other hand, VESA VBE graphics BIOS explicitly offer a protected mode entry point. > In reality, almost all DOS application programs violated these rules Because of this, you have VM86 hardware support which makes it relatively easy for operating systems and even for drivers like EMM386 to create a task which runs believing that it would be running NOT in protected mode. To make old apps happy. > ... what could I actually do, assuming I had an 80286 computer? You can compile your apps to use protected mode to use all the advantages, or run your apps in real mode or in a VM86 task without having to change them. > "binary compatibility with real-mode code" - sounds good. You can either stay away from protected mode or use a VM86 host for that. > "the ability to access up to 16 MB of physical memory, and 1 GB of virtual > memory" - sounds good. You will have to use protected mode for that. With 386, even the 16 MB limit no longer applies. > But ... WHERE? With a DOS Extender or by using any protected mode operating system of your choice. > Is this something I could do on OS/2 1.x? Probably. > With an MZ executable? A .com? Only with a DOS Extender. > What are they advertising? Hardware features. To use them, you would have to use them. > NE executables didn't exist except on MSDOS 4.0, > which may or may not buy something. Is that what > they are advertising? Probably not. I do not think MS DOS directly supported protected mode EXE files. So you still had to use a DOS Extender and you can use most of those with MSDOS 3.xx already. > I didn't use OS/2 1.x, but it may have had an > MSDOS window and an MSDOS fullscreen (as modern > OS/2 does). Probably, but if you only want MS DOS apps, then you have no need to buy OS/2 or Windows. Unless you want to run several of them in parallel, in multiple windows. But then you will be limited by how well OS/2 and Windows can keep them from interfering with each other, because DOS apps were not originally meant to be run like that. > Or was the problem that MSDOS itself had used > segment arithmetic in the MZ executable format > such that it was not possible to run an > unmodified MZ executable (at least one with > more than 64k of code), in protected mode, no > matter how well behaved the actual code was? I doubt that anybody would recommend to run any DOS app as-is directly in protected mode. That is exactly what VM86 mode is for: To create an illusion of "everything is as in those good old 8086 times" for old DOS apps. If you want to use NEW features, you also have to compile your apps to know them. Anyway, https://wiki.syslinux.org/wiki/index.php?title=Doc/comboot is an example of running a limited subset of DOS com binaries outside an actual DOS, so you might enjoy hearing about those. They are run in real mode, though. The SYSLINUX family of boot loaders and boot menus does not provide VM86 services. --- |
|
| Ringding 21.02.2024, 11:56 @ kerravon |
8086 rules |
> Or rather - what needed to happen so that law-abiding > citizens got rewarded for all their effort? > > Can you create a timeline or game plan that would > benefit those who spent the effort to follow rules? The most beneficial plan would have been to: - Wait a few years - Recompile for the desired target (be that Unix, OS/2 or Win32, probably depending on the time frame envisioned) Because to the producer of the software, binary compatibility is a minuscule benefit. |
|
| kerravon Ligao, Free World North, 21.02.2024, 12:02 @ mceric |
8086 rules |
> multiple of 16 bytes. Being able to use 32-bit offsets directly is much > better. > > You can either stay away from protected mode or use a VM86 host for that. Neither of those things existed on the 80286. My question is restricted to the 80286, if that wasn't clear. I will digest the rest of your message though to see if that is what Intel expected to happen. BFN. Paul. |
|
| kerravon Ligao, Free World North, 21.02.2024, 12:06 @ Ringding |
8086 rules |
> > Or rather - what needed to happen so that law-abiding > > citizens got rewarded for all their effort? > > > > Can you create a timeline or game plan that would > > benefit those who spent the effort to follow rules? > > The most beneficial plan would have been to: > > - Wait a few years > - Recompile for the desired target (be that Unix, OS/2 or Win32, probably > depending on the time frame envisioned) > > Because to the producer of the software, binary compatibility is a > minuscule benefit. I'm intending to follow the rules, publish a binary, lose the source code, and then die. And I want my users to get the benefit of me being law-abiding, even though I'm lousy at source control and watching for buses when I cross the road. BFN. Paul. |
|
| kerravon Ligao, Free World North, 21.02.2024, 13:36 @ mceric |
8086 rules |
I think we are talking cross-purposes. Wikipedia says: > > In reality, almost all DOS application programs violated these rules As opposed to: Because no DOS-extenders existed, it doesn't make any difference whether a DOS program followed Intel's rules or not, because any code that was written needed to be recompiled into the DOS extender format or to some other OS format. In fact, everyone here at Wikipedia thinks that Intel must have been on the wacky weed when they wrote their irrelevant (as opposed to difficult to follow and rarely followed) rules. > With a DOS Extender or by using any protected mode operating system of your > choice. Which, as above, makes the rules irrelevant. BFN. Paul. |
|
| ecm Düsseldorf, Germany, 21.02.2024, 14:57 @ mceric |
8086 rules - CS writing, lDebugX |
> > Writing to a code segment
>
> This also is configurable:
> https://en.wikipedia.org/wiki/Segment_descriptor
>
> As far as I remember, write-protected code segments became the default for
> Windows much later than Win9x, because app writers were used to overwriting
> code :-p
If you would reference the descriptor format you would notice that the "WR" bit means "writeable" for data descriptors but "readable" for code descriptors. You cannot execute from a data descriptor loaded as CS, only a code descriptor. So you cannot ever write with a --- |
|
| Japheth Germany (South), 21.02.2024, 15:16 @ kerravon |
8086 rules |
> So - there were compilers/linkers capable of building > NE executables in the late 1980s. The MS Word v5.5 binary is such a "family application", running both in DOS and OS/2 1.X. --- |
|
| Ringding 21.02.2024, 15:24 @ Japheth |
8086 rules |
> The MS Word v5.5 binary is such a "family application", running both in DOS > and OS/2 1.X. As is MASM 5. |
|
| bretjohn Rio Rancho, NM, 21.02.2024, 17:40 @ kerravon |
8086 rules |
> This was not without its limitations. If an application utilized or relied > on any of the techniques below, it would not run: > > ... > Use of BIOS functions, due to the BIOS interrupts being reserved by > Intel[31] I would classify "Would not run" as a vast overstatement. Specifically regarding the BIOS functions, that is not actually a DOS problem -- it is a BIOS problem. And even then, the only BIOS interrupt problem I've come across that has any practical effect is INT 05, which used by both the BIOS PrintScreen function and by the CPU BOUND instruction (which didn't even exist until the 80286). |
|
| kerravon Ligao, Free World North, 21.02.2024, 23:35 (edited by kerravon, 22.02.2024, 01:19) @ bretjohn |
8086 rules |
> > This was not without its limitations. If an application utilized or > relied > > on any of the techniques below, it would not run: > > > > ... > > Use of BIOS functions, due to the BIOS interrupts being reserved by > > Intel[31] > > I would classify "Would not run" as a vast overstatement. Specifically > regarding the BIOS functions, that is not actually a DOS problem -- it is a > BIOS problem. And even then, the only BIOS interrupt problem I've come > across that has any practical effect is INT 05, which used by both the BIOS > PrintScreen function and by the CPU BOUND instruction (which didn't even > exist until the 80286). You can do BIOS calls from PM16? ie read a disk? edit: and into memory above 1 MiB? |
Thread view
Mix view