delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/13/01:53:59

Date: Thu, 12 Mar 1998 19:33:33 -0800 (PST)
Message-Id: <199803130333.TAA08543@adit.ap.net>
Mime-Version: 1.0
To: sochaxx AT flash DOT net (art socha), djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: DJGPP/NASM HELP!!

At 10:51  3/11/1998 -0800, art socha wrote:
>Ok, I finally got NASM to avoid using DJGPP's crappy looking unix-style 
>assembler. It works great.
>
>Next step, write video routines with NASM and link with DJGPP. Great, 
>easily done. Got the initialization and exit procs done. 
>
>Now to write to video memory. Obviously I'm using 32-bit pmode and need 
>to access video memory. Now then, using TASM with DOS32(a 32 bit extender 
>for asm programmers), i simply access video memory via
>
>mov eax,0a0000h
>mov [eax],15       ;plot a pixel in the upper left hand corner...
>
>0a0000h as opposed to 16-bit segmentation 0a000h
>
>this works fine with the flat mode in TASM linked with DOS32!
>
>however using NASM i keep getting a general protection error when it 
>reaches the mov eax,0a0000h statement. doesn't make much sense to me 
>unless NASM or DJGPP is protecting video memory from being written (and 
>why this would be i don't know).

Because it's very hard to allow access to video memory without allowing
access to all memory, and that would be a Bad Thing. (Overwriting DOS can
ruin your whole day...) It's a feature, not a bug.

You can probably use your code without much change if you first load a
segment register with a selector for conventional memory. You can get this
with `__dpmi' functions, or use the predefined `_dos_ds' selector (but note
that `_dos_ds' is really a macro). You will have to keep the selectors
separate to let you access your own virtual memory as well as conventional
memory.

HTH

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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