Mail Archives: djgpp/1998/08/08/16:23:46
On 7 Aug 98 at 20:41, John Hosick wrote:
> Someone please help me. I bought a book that uses Intel assembly and but
> I'm using DJGPP so I have to use AT&T assembly syntax. To switch to mode
> 3h I use the following procedure:
>
> void set_video_mode (int vid_mode)
> {
> asm ("movb $0, %%ah\n\t"
> "movb $vid_mode, %%al\n\t"
In the line above, you refer to a symbol called `vid_mode', which
does not exist. If the variable was global you'd use `_vid_mode' --
but it's local. The correct way to put the value of a local variable
into a register is to use the input section of the asm block, as you
did below.
> "int $0x10\n\t"
> : /* no output registers */
> : "al" (vid_mode)
> : "ah", "al");
> }
In fact for this example it's simpler not to use assembly language at
all:
void set_video_mode (int vid_mode)
{
__dpmi_regs regs;
regs.x.ax = vid_mode & 0xff;
__dpmi_int (0x10, ®s);
}
> Also is there a book out there which teaches AT&T assembly language
> syntax?
Not AFAIK. Brennan Underwood wrote a good guide to it though, which
you can see at:
http://brennan.home.ml.org/djgpp/djgpp_asm.html
If you're writing functions that are 100% assembly language then I
think you'd be better off writing your own .S files, containing the
assembly language functions. If you're interested in this approach,
please read this mini tutorial:
http://users.ox.ac.uk/~mert0407/asmfuncs.txt
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
- Raw text -