Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
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 )
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 ]
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).
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
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.
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.
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.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
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.
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.
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 ]