08 November 2021, 18:21 | #241 | ||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,216
|
Quote:
Unfortunately, the console.device only supports a subset of the ANSI sequences, does not support all the equivalences, and some sequences are not quite interpreted according to the standards. (ViNCEd can be switched to support the sequences according to the specs). On *ix/Linux, it is "termcap" and "curses" that provide an interface towards the implementations of "ANSI sequences". Quote:
Thus, it is "paged" in the sense that you can switch between 4 pages that either define one of the four bitplanes, or characters/attributes. But you can also select the address within the VGA memory window (text mode does not require a lot of space), but also select which of the (potentially large) VGA memory fits into the (at most) 128K window available for the VGA chipset within the CPU address space. It's a big pile of mess. Later VGA chipsets allow "linear access", but the early ones don't. There is a reason why there is no P96 driver for the Retina as it only offers this insane "segmented memory model". |
||
08 November 2021, 19:23 | #242 | ||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
In addition, can that system detect a key up ? Quote:
|
||
08 November 2021, 19:50 | #243 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,216
|
Quote:
No, actually VESA. VGA modes are stil limited by the memory window. VESA offered a bios interface to set the pages, but also offered a linear window. All the VESA modes were vendor-specific extensions on top of the legacy VGA modes, offering various implementations. VGA is planar, except for the "linked" nibble modes which work by hardware hack by interleaving pages. All the "real" chunky, hi-color and true-color modes are vendor-specific extensions that were (partially) accessed through the vesa bios extensions. |
|
08 November 2021, 20:29 | #244 |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,099
|
You could not in any way count on ANSI.SYS being loaded (because it took up precious lowmem), and it only works if the software is well-behaved and uses the proper DOS functions for output.
BIOS (and DOS) support for keyboard I/O was very basic and AFAIR you couldn't get key specific key up/down events that way (BIOS interface is just INT 16h and most of those extended functions aren't available for general use). Real software, except for command line utilities, when needing anything beyond very basic stuff accessed the HW directly. See e.g. the keyboard handling of Wolfenstein: https://github.com/id-Software/wolf3...OLFSRC/ID_IN.C (mouse input is handled using a more proper interface (INT 33h) though) |
10 November 2021, 19:28 | #245 | |||||||
Registered User
Join Date: Mar 2021
Location: Sydney, Australia
Posts: 184
|
Quote:
Quote:
tiny - code and data segments are the same and unchanged. this is actually what normal systems like the Amiga use as the only available option. small - code and data segments are fixed, but different, giving you up to 64k for each address space medium - code segment register can change (so needs to be reloaded all the time), allowing you to have more than 64k of code. data restricted to 64k. compact - code segment register doesn't change, so code restricted to 64k, but data register is constantly reloaded allowing more than 64k of data to be addressed. large - both code and data segment register are constantly reloaded, allowing access to more than 64k of both code and data huge - same as large, but when data (not code) pointers are manipulated, care is taken to ensure that if a 64k boundary is crossed, the segment register is adjusted, and in either case, the offset is normalized to be as small as possible. This has a large performance overhead and is rarely used, and a popular C compiler, Turbo C, doesn't even support it properly, merely allowing static data to exceed 64k in this model. This is why it is not necessary (as far as I can tell, from my experience in writing an OS), to plaster your code with near/far pointers. All you need to do is select a memory model appropriate to your requirements. Unfortunately when I was writing PDOS/86, and mostly sharing a code base with PDOS/386 (it was only later with PDOS-generic that I realized the code base could be shared beyond just x86), I only understood up to "large", but actually the job for the OS (but not applications) required "huge". Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||||
10 November 2021, 20:18 | #246 |
Registered User
Join Date: Mar 2021
Location: Sydney, Australia
Posts: 184
|
What does this actually mean? PDOS/386 comes with a "vga driver" that directly accesses 0xb8000. I wouldn't have thought it was technically possible to prevent an 80386 from doing that and demanding that it is accessed via segment : offset real mode instead.
|
10 November 2021, 20:22 | #247 |
Registered User
Join Date: Mar 2021
Location: Sydney, Australia
Posts: 184
|
If the barrier to having portable source code is ANSI.SYS not being always-loaded, then how about adding a flag to MSDOS executables to say "auto load ANSI support"? Perhaps this is the magic bullet that was missing from MSDOS, and if we could have our time again (holding hardware constant), all we need is a governmental mandate that ANSI support be required to allow competition.
|
10 November 2021, 20:41 | #248 | |||||||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
A program should have the ability to detect key presses. Or key releases. Or several keys simultaneously. Quote:
Quote:
Compilers can be setup for "small data" model, where a register (typically a4 or a5) is used to access bss section. That's about all. Quote:
Compare this to 68k where you can access any place, any time, and still use things similar to short pointers (relative accesses). If you want your system to work on top of true MSDOS, you should perhaps consider going to flat mode. Quote:
Quote:
Quote:
Besides, flipping frames requires either recomputing whole scene or data copying from previous scene. So you will lose performance for little benefit - if any at all. Quote:
MSDOS is PC hardware oriented. Quote:
Frankly, fflush(stdout) for screen handling, really ? What if someone redirects output to some file ? Yes, with simple ">file" command. Oh yeah, now the user will see nothing and wonder what happens ! Graphical operations and file operations are two very different things and it is IMO horrible design mistake to have them use same API. Or maybe it's just me, because i can do screen setup with just 4 lines of asm using my system framework. |
|||||||||
10 November 2021, 20:49 | #249 | |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,099
|
Quote:
I was just trying to add some background to the discussion (ANSI.SYS wasn't really used/relied upon, interactive programs didn't use BIOS/DOS for keypresses). I'm still not 100% sure what you goal is, but if it's to get recompiled well-behaved DOS programs to work, I'd ignore ANSI stuff if I were you. |
|
13 November 2021, 01:52 | #250 | |||||||||||||||
Registered User
Join Date: Mar 2021
Location: Sydney, Australia
Posts: 184
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||||||||||||
13 November 2021, 01:56 | #251 | ||
Registered User
Join Date: Mar 2021
Location: Sydney, Australia
Posts: 184
|
Quote:
Quote:
|
||
13 November 2021, 09:10 | #252 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,216
|
Quote:
It means that the VGA memory window became too limiting early enough, namely as soon as high-color and true-color screens and larger screen resolutions became the norm. Thus, VGA chipset vendors implemented "segmentation", by which you made a particular range of VGA addresses available in the VGA memory window. Thus, if you wanted to access a pixel, you had first to tell the chipset which part of the framebuffer to make visible in the VGA window, and then poked into the right place of the VGA window. It is like the 8086 segment register nonsense, just that the segment registers are here represented by registers of the VGA chipset you had to fill to make the right part of its frame buffer accessible. Later chipsets allowed linear addressing, but then of course left the 640K memory model of the PCs, and they allowed continous access to the entire frame buffer without having to switch the window every time. P96 only supports the latter type of chipsets, though EGS also supports some of the "segmented memory models". |
|
13 November 2021, 13:20 | #253 | ||||||||||||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
Quote:
68000 OTOH was more forward-looking design. Quote:
Still doesn't say where it came from. Anyway, let's see it the other way : why should the user have to choose a memory model at all ? Quote:
Quote:
Quote:
So working on 8086 is wanted now ? Who will do that ? There is no interest. Quote:
Quote:
Imagine, one day you'll have to allocate from graphics memory (chip mem on the Amiga, which is similar in concept to GPU mem). Oh, sorry, allocation primitives just can't do that. Quote:
Then better drop the idea. Extra screen copies will take too much time. Frame flipping is there to avoid display tearing, but there is no such thing with pure text displays. Quote:
I don't think so. You are designing for situations that never happen. Quote:
Quote:
Quote:
Quote:
Is it a good idea to use file i/o for fullscreen text ? That depends what your design goals are -- but if performance is among them, i have to tell you that direct character poking on screen will always be faster than a file API that has to parse ansi codes. That said, i fail to see any interest in supporting fullscreen text-only programs at all. We have GUIs since several decades now. |
||||||||||||||
14 November 2021, 08:11 | #254 | |||||||||||
Registered User
Join Date: Mar 2021
Location: Sydney, Australia
Posts: 184
|
Ok, first of all, thanks for helping me try to understand my own goals. Unfortunately I seem to have been conflating two apparently distinct goals.
1. I want a complete development system written in C90. ie a C compiler written in C, a C library written in C, an editor written in C, a file transfer program written in C that drives a serial port and an OS written in C. PDOS-generic is my flagship OS for this. I am using a modified GCC 3.2.3 as the C compiler, which requires something like 20 MB to recompile itself, so this is not something for the 8086. I'm instead looking for something like a 32 MiB system which based on historical memory prices is something that became viable around 1992. With this development system you have everything you need to construct a "perfect" replacement OS, with graphics support etc. But this basic system only needs a monochrome text monitor to run micro-emacs. My interest basically stops here, so I want to clarify what standards are required to get here. 2. After the MSDOS 2.0 API was locked in in 1983 and the migration progress from effectively 8080 CP/M to 8086 MSDOS began, I want programming practices put in place such that when the superior Amiga 1000 was released in 1985, a simple recompile would mean that all C90-compliant programs would work (this is easy), programs that interacted with FAT directories via the MSDOS API would also work, and, if possible, fullscreen applications also work. For the last bit of that, I thought of another possibility. You could do fopen("CON:", "r+b") which accesses (via fseek() and putc()) a 25*80*2 byte "file" which is actually simply directly accessing memory at 0xb8000 (PC implementation only). This would then fit the "everything is a file" paradigm, which C seems to be based on, and I would like to drive to its limit. Quote:
Quote:
Quote:
Quote:
Quote:
char *x; *x = 0xab; you have successfully defined a pointer suitable to manipulating a byte, and then manipulated it. Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||||||||
14 November 2021, 11:35 | #255 | |||||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,216
|
Quote:
Quote:
Quote:
The amount of overhead this pile of mess created in the "huge" memory model speaks for itself. With proper 32-bit extended registers for the huge model, the problems were gone. Consider how AMD extended the 32bit world to 64 bit: That(!) was a proper extension. Not this terrible intel kludge. Quote:
Quote:
|
|||||
14 November 2021, 12:28 | #256 | |||||||||||
Registered User
Join Date: Mar 2021
Location: Sydney, Australia
Posts: 184
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||||||||
14 November 2021, 15:02 | #257 | |||||||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,216
|
Quote:
Quote:
Quote:
It is actually a much simpler system. Physical address = segment pointer + offset register. Just that the segment pointer is hidden in a virtual machine, and not accessible legacy applications, and the offset register is all that is seen. It would be the job of the Os to populate the segment pointer in a process-dependent way to allow legacy applications to work. But intel, in their infinite wisdom, created a kludge, something they abandoned in the next generation. Quote:
Apparently not, no, but they didn't come up with "segment pointers" once again - which is the way how intel addressed this issue when "64K is enough for everyone" was no longer acceptable. Quote:
Quote:
Quote:
A low-capacity system today is not a 8086 system. Neither a 6502 system. A low-capacity system today is an arm mobile core, as in the raspi, or an arduino core. This is what I would advice as "cheap embedded system" today. Not the obsolete systems of yesterday with their architectural kludges. If your interest "low capacity", that's called "embedded", and 8086 is not quite the answer for this market segment. |
|||||||
14 November 2021, 20:22 | #258 | ||||||||||||
Registered User
Join Date: Mar 2021
Location: Sydney, Australia
Posts: 184
|
Quote:
Quote:
When you write some C code (as I do) and then wish to run on the 8086, you can do so simply by telling the C compiler which memory model you wish to use, and you don't need to use "near" and "far". Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
||||||||||||
14 November 2021, 22:32 | #259 | ||||||||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,216
|
Quote:
Quote:
Quote:
Quote:
Quote:
Here you go: Code:
int offset(char *base,char *ptr) { return ptr - base; } char big[1<<20]; int main(void) { printf("Offset is %d\n",big,&big[1<<17]); return 0; } Quote:
Now, I believe, you're in the process of making the same mistake. Instead of thinking about the design of a sane system, you're copying from an insane one, one not much thought was given in its design. Quote:
Quote:
This question does not even make sense to me. Hardware isn't held constant, it is something that evolves along with software, intertwined with each other. If software hadn't developed things like loops or subroutines, we wouldn't have "jump subroutine" or "stack pointer". If hardware hadn't provided more computational power and larger memory sizes, we wouldn't have high-level languages. C64 "Os" was not an Os, it was just a collection of useful subroutines. The Atari 8-bit Os was something that was close to be an Os, with a channel-based I/O system and several abstraction layers. Yet, of course, it didn't survive the test of time because it didn't have services for memory allocation, and the hardware did not have memory protection. AmigaOs did not survive, and even if Amiga hardware had, CBM would have had to invented something new and replace AmigaOs as resource management was absent. MS-DOS did not surive for similar reasons, and was obsoleted by Windows NT. MacOs did not survive and was replaced by a BSD-type kernel. But I don't need to write my own Os to understand that. I've programmed on some of the above systems (at least Atari, Amiga, Mac, Unix, Windows) to understand why some designs did not survive, and others did. Start from the good designs that passed the test of time. The unix system seems to be fairly good, according to this test. That is something worth investigating, and not MS-DOS. |
||||||||
15 November 2021, 06:41 | #260 | |||||||||
Registered User
Join Date: Mar 2021
Location: Sydney, Australia
Posts: 184
|
Quote:
What I have with PDOS-generic is an OS, written in pure C90, that performs that basic functionality, assuming an appropriate BIOS is provided. And if no appropriate BIOS is provided, that is the only thing I need to write for any new platform. Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||||||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|