int86 implementation
int86 implementation
hi,
I'm unsure of how to go about implementing an int86-like function as found in dos.h. I need to execute video interrupt in real mode and would like guidance on how to implement such a function (code would be nice )
Thanks
I'm unsure of how to go about implementing an int86-like function as found in dos.h. I need to execute video interrupt in real mode and would like guidance on how to implement such a function (code would be nice )
Thanks
H Technology Solutions - Business Operating System Specialists
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: int86 implementation
Code would be nice but you can't have any because you won't learn anything. That function just loads a bunch of registers from parameters and executes an INT. It's basica assembly. If you can't code it yourself you should probably learn a bit more before taking on OSDev'ing.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: int86 implementation
Very helpful
Instead of making me reinvent the wheel please just post the code.
Instead of making me reinvent the wheel please just post the code.
Last edited by jasonc122 on Wed Mar 03, 2010 6:31 pm, edited 1 time in total.
H Technology Solutions - Business Operating System Specialists
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: int86 implementation
An int86 function changes in complexity depending on if you run in protected mode or not. From your post it sounds like real mode, which means the int86 function is quite elementary to write (as Love4Boobies has already stated).
Re: int86 implementation
I'm running in protected mode and need to run an INT in real mode. What's the easiest way to add a 16 bit code thunk (which will include the 16 bit INT instruction) to 32 bit elf? Failing that just please post the code - I'll learn much faster from that
H Technology Solutions - Business Operating System Specialists
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: int86 implementation
You probably need to actually drop back to real mode and then run the interrupt, and return to protected mode when done.
The alternative is to write a virtual 8086 mode monitor.
The alternative is to write a virtual 8086 mode monitor.
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: int86 implementation
Please stop asking us to post the code, trust me, just blindly copy-and-pasting code will cause no end to hell for you down the line, and you generally don't learn from it.
As pcmattman said, in protected mode you cannot just directly call a BIOS interrupt, instead you either need to drop back to real mode (normally not a good idea) or implement VM8086.
Just out of curiosity, why do you need to call a BIOS int, because unless it's for setting the video mode, it's usually easier to write your own driver for the device, and use that. Calling the BIOS from PMode is ... difficult.
As pcmattman said, in protected mode you cannot just directly call a BIOS interrupt, instead you either need to drop back to real mode (normally not a good idea) or implement VM8086.
Just out of curiosity, why do you need to call a BIOS int, because unless it's for setting the video mode, it's usually easier to write your own driver for the device, and use that. Calling the BIOS from PMode is ... difficult.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Re: int86 implementation
You could use x86emu (cached here).jasonc122 wrote:I'm running in protected mode and need to run an INT in real mode. What's the easiest way to add a 16 bit code thunk (which will include the 16 bit INT instruction) to 32 bit elf? Failing that just please post the code - I'll learn much faster from that
Also, you can easily run INT services if you are in real mode, even from the DOS command line, you can see a sample here, just look for the "CPU/opcodes" and "CPU/regs" folders.
YouTube:
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
Re: int86 implementation
Because of the way you keep asking for code, I doubt a lot of people will give you it.
Anyway, what you're looking for is inside the Intel docs (drop PMode -> RMode, the opposite and the stages in between (16-bit PMode?)). As already was said, the alternative is to implement VM8086. The only thing that might be of help when doing the first is that an easy way to execute 16-bit code is (assuming your OS is running in 32-bit protected mode) to write a flat binary program that you can jump to or call that goes back and forth.
Anyway, what you're looking for is inside the Intel docs (drop PMode -> RMode, the opposite and the stages in between (16-bit PMode?)). As already was said, the alternative is to implement VM8086. The only thing that might be of help when doing the first is that an easy way to execute 16-bit code is (assuming your OS is running in 32-bit protected mode) to write a flat binary program that you can jump to or call that goes back and forth.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: int86 implementation
It sounds to me like he's in real mode (dos.h).
I also think the OP has stopped reading the thread.
It's not difficult, it's just slow, non-re-entrant (which in the end adds to the slowness) and it doesn't provide as many features as a device driver.thepowersgang wrote:Just out of curiosity, why do you need to call a BIOS int, because unless it's for setting the video mode, it's usually easier to write your own driver for the device, and use that. Calling the BIOS from PMode is ... difficult.
I also think the OP has stopped reading the thread.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]