cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/15/01:23:15

From: <fremlin AT oncology DOT wisc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Why add 36008 to offset to reach buffer?
Date: Mon, 14 Apr 97 21:15:27 CST
Organization: University of Wisconsin, Madison
Lines: 59
Message-ID: <86332.fremlin@oncology.wisc.edu>
NNTP-Posting-Host: f209-146.net.wisc.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 11 Apr 1997 00:36:59 GMT, 
Guido Bursch  <bursch AT uni-muenster DOT de> wrote:

>Hi all!
>
>I have a question for my little virtual screen program.
>I made up a virtual scree in mode 13h with:
>
>unsigned char virtscreen[64000];
>
>Then I try to access it via inline-asm:
>
>__asm__("
>  pushl %%eax\n
>  movl $36008, %%eax\n  ?????
>  movb $15, %0(,%%eax,1)\n
>  popl %%eax"
>  :
>  : "m"(&virtscreen) 

This is wrong. As far as I see it, you are putting the address where
the variable 'virtscreen' is stored in a register. 'virtscreen' is
already a pointer so you should just store 'virtscreen' in the register,
i.e. : "m" (virtscreen).

>);
>
>and then copy it with dosmemput or movedata to video memory.
>It changes the first pixel to white (what I want).
>But why I have to add 36008 to the 'offset' (eax) to
>reach the first pixel?

It appears to be just luck that adding 36008 to the memory address
where 'virtscreen' is stored gets you the address where the data
pointed to by 'virtscreen' is stored.

But how did you get 36008? By trial and error?! 

>It would be great, if anyone would tell me what I'm
>doing wrong.
>
>               Thanks alot!!

Good luck and happy coding!

>
>BTW: Please dont't email me personally (it may cause problems).
>
>


(fremlin AT oncology DOT wisc DOT edu or fremdh AT essex DOT ac DOT uk)

Cattle die, kindred die,
   Every man is mortal;
But I know one thing that does not die,
  The glory of a great deed

The Elder Edda

- Raw text -


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