www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/10/19:09:01

From: nikki AT gameboutique DOT co (nikki)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: My inline assembly program won't work.
Date: 10 Feb 1997 17:36:57 GMT
Organization: GameBoutique Ltd.
Lines: 42
Message-ID: <5dnmbp$eol@flex.uunet.pipex.com>
References: <32FF3ECC DOT 36F AT xs4all DOT nl>
NNTP-Posting-Host: www.gameboutique.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> 		"movw __dos_ds, %%fs;"	// [*1]
> 
> 		"movl %%eax, %%fs:$0xa0000(,%%ecx,4);"	// [*2]
> 
> [*1] When I try to compile this, I get "Undefined Reference" ,but go32.h
> is included

i'm fairly sure you can't move from memory to a segment switch like this
you have to go via ax or something. your best bet would be to have this
preloaded by the compiler. using '"a" (_dos_ds)' 

> [*2] When I try to compile this, I get "bad memory operand after segment
> override". If I try removing the segment override, I get "operands given
> don't match any known 386 instruction".

i haven't a clue what you're actually trying to do here. looking at the c
code below it would seem more sensible to have 3 pointers to the virtual
screens you want to mix, lock the memory with the crt0 switch and set
nearptr enabled all as switches using :

#include <crt0.h>
int _crt0_startup_flags = _CRT0_FLAG_NEARPTR | _CRT0_FLAG_NONMOVE_SBRK;

now you don't have to bother with segment stuff, just pass the 3 pointers
to the code, load, or, or, store, exit.
replacing *2 with something like
movl %%eax,(%3,%%ecx,4)

where %3 is now the pointer to screen memory base address

incidentally, can you use ; to end lines like that? i thought inline asm
had to be of the form "movl %%eax,%%ebx\n\t" with the \n in?

 anyway, hope that's some help, i'm doing it from the top of my head so i
might have made a booboo somewhere tho :)

regards
nik

-- 
Graham Tootell           
nikki AT gameboutique DOT com  

- Raw text -


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