Inline assembly. Rewrite assembly code?

I've not tested this, but it should get you started.

Up vote 2 down vote favorite share g+ share fb share tw.

Compiler: gcc(i586-elf-gcc). The GAS syntax confuses me. Please give tell me how to write this as inline assembly that works for gcc.

. Set_video_mode: mov ah,00h mov al,13h int 10h . Init_mouse: mov ax,0 int 33h Similar one I have in assembly.

I wrote them separate as assembly routines to call them from my C program. I need to call these and some more interrupts from C itself. Also I need to put some values in some registers depending on which interrupt routine I'm calling.

Please tell me how to do it. All that I want to do is call interrupt routines from C. It's OK for me even to do it using int86() but I don't have source code of that function.

I want int86() so that I can call interrupts from C. I am developing my own tiny OS so I got no restrictions for calling interrupts or for any direct hardware access. Gcc assembly operating-system dos interrupts link|improve this question edited Jan 17 at 12:50Olmar3171314 asked Jan 17 at 11:35Manu Hegde676 70% accept rate.

– Simon Richter Jan 17 at 12:51 in some way "yes" – Manu Hegde Jan 17 at 14:36 I see another problem: You want your code to be executed in real mode (16 bit), where gcc and gas will generate 32 bit code – drhirsch Jan 177 at 9:03.

I've not tested this, but it should get you started: void set_video_mode (int x, int y) { int ah asm ("ah") = x; int al asm ("al") = y; volatile asm ("int 10h" : /* no outputs */ : /* no inputs */ : /* clobbers */ "ah", "al"); } I've put in two 'clobbers' as an example, but you'll need to set the correct list of clobbers so that the compiler knows you've overwritten register values (maybe none).

Looking at this again ... you might need to make the two ints volatile to prevent the compiler optimizing them away. Note sure. – ams Jan 20 at 12:14.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions