www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/17/08:36:56

From: billlanam AT california DOT com (Bill Lanam)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: My inline assembly program won't work.
Date: Mon, 10 Feb 1997 21:31:39 GMT
Message-ID: <32ff9237.150933@seashell.california.com>
References: <32FF3ECC DOT 36F AT xs4all DOT nl>
NNTP-Posting-Host: 140.174.210.232
Lines: 55
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Mon, 10 Feb 1997 16:29:16 +0100, Andrei 'old-boy' Ellman <ellman AT xs4all DOT nl>
wrote:

>Hi,
>
>I have been trying to assemble the following .c file with some inline
>assembly, and I can't get it to work. What I am trying to do is to
>compile the following:
>
>------------------------------------------------------------------
>
>#include <allegro.h>	// To define BITMAP datastructures and 'screen'
>			// and bmp_read_line.
>#include <go32.h>	// For _dos_ds
>
>void mixvid_13h(BITMAP *bmp1, BITMAP *bmp2, BITMAP *bmp3)
>
>/*
>The code is being made for 80486.
>*/
>
>{
>	unsigned long bmp1_read_address= bmp_read_line(bmp1, 0);
>	unsigned long bmp2_read_address= bmp_read_line(bmp2, 0);
>	unsigned long bmp3_read_address= bmp_read_line(bmp3, 0);
>
>	/*
>	For those of you not familiar with Allegro, assume
>	bmpX_read_address contains the start address of the 3 memory
>	bitmaps.
>	*/
>
>	asm (
>
>		"pushw %%fs;"
>		"movw __dos_ds, %%fs;"	// [*1]
You might have to use a input memory restriction like so
		"movw %3, %%fs;"
in the input section add
		"m" (_dos_ds)
>		"movl $15996, %%ecx;"	// $15996 = (320*200/4)-4
>
>		"LOOP:"
>
>		"movl (%0,%%ecx,4), %%eax;"
>		"orl (%1,%%ecx,4), %%eax;"
>		"orl (%2,%%ecx,4), %%eax;"
>
>		"movl %%eax, %%fs:$0xa0000(,%%ecx,4);"	// [*2]
Didn't crash when I had it as the only inline assembly line in a program.
Maybe the prior error somehow caused this error???  I don't have allegro so I
didn't try compiling the whole thing.  Are you using version 2.7.2.1 ?


    Bill Lanam

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019