flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > OS Loading Process |
Author |
|
alexfru 18 Mar 2018, 04:48
You learn your hardware, how it can output a character to wherever (serial port, display, etc). You then write code to do it. As simple as that.
|
|||
18 Mar 2018, 04:48 |
|
DimonSoft 18 Mar 2018, 06:23
moveax41h wrote: What are the first steps? I understand a little bit about a bootloader but my question is more specifically, how do we establish the ability to do things like print a character without the interrupt to do this provided by the DOS kernel, for example? I am aware that we can define our own software interrupts by placing pointers to handlers in offsets from the ES register but even still, how does that code eventually actually print a char to the screen? The only thing I can think of is that there are some other hardware interrupts which are "built-in" that we can use sort of like in a driver but I am not sure on this and would like some clarification. Thank you. It really depends. From your question it seems you’re targeting BIOS, not UEFI, so I’ll go on with that. The next thing the answer depends on is your target CPU mode. Since you’re talking about replacing MS-DOS services, I’ll decide you’re targeting real mode. --- In real mode you basically have 1.75 ways to perform character output. First, you can use BIOS services provided by means of int 10h. Several of them are for your purpose, providing different levels of comfort. The second method (half of a method, actually) is to reinvent the BIOS services partially by writing directly to the video memory and keeping track of things like, say, caret position. This way is considered to be a bit faster but, definitely, if you reinvent exactly what BIOS does the performance might be nearly the same. Now, the third method (quarter of a method) that works for every CPU mode out there is to work directly with video card by means of I/O ports. In fact, the simplest way would still be to map video memory somewhere and write there but if you want to get rid of int 10h completely this is the way to go. Although it is the hardest one. --- Now discarding my assumptions in backwards manner. If you’re in protected mode, you’ll have to switch to directly interfacing video card. There’re a few other means like VBE but, AFAIK, they are not supported well enough to be relied on these days. If you’re eager to output characters somewhere except the display, I/O ports are again the way to go. In general, while you’re in real mode your helper functions are BIOS services provided by, most notably, int 10h (video), int 13h (disks) and int 16h (keyboard). If you decide not to use them or they’re unavailable (say, if you’re not in real mode anymore), you’ll have to access specific I/O ports. UEFI is the same idea, different programming interface (and targeted for protected mode). Last edited by DimonSoft on 19 Mar 2018, 06:37; edited 1 time in total |
|||
18 Mar 2018, 06:23 |
|
revolution 19 Mar 2018, 02:26
And just to make things more confusing: Each set of video/disk/interfaces/etc. are different and specific for each machine. While there are some similarities for basic functions, doing anything even slightly advanced requires knowledge of the low level specific features. So you would need to download the actual manufacturers spec for each brand/make/model you need to support with your drivers. It usually can be done for most common hardware, it just require lots of effort and searching.
|
|||
19 Mar 2018, 02:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.