Mail Archives: djgpp/1998/05/11/18:19:38
From: | Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Memory writting in assembley
|
Date: | Mon, 11 May 1998 20:06:46 +0100
|
Organization: | None
|
Message-ID: | <GjW74CAGx0V1Ewmq@talula.demon.co.uk>
|
References: | <01bd7ccf$d4b5ca40$a6ef41c2 AT default>
|
NNTP-Posting-Host: | talula.demon.co.uk
|
MIME-Version: | 1.0
|
Lines: | 37
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Dark Angel writes:
>In djgpp i used _farpokeb to write to the video memory, because protected
>mode don't let me do a direct write.
>
>How can it be done in assembley?
For any questions of this type, gcc itself is your best possible
teacher. Take your current C function, compile it with the -S switch,
and look at the .s file that gcc produces. Once you've seen exactly how
gcc does this, you will be in a good position to write something better
of your own (or perhaps decide that you can't improve on the C version
so you may as well not bother: this does often happen because the gcc
optimiser is pretty good :-)
>When i wan't to call a dos interrupt in djgpp i use dpmi_int, no problem.
>But if i wnat to call the same interrupt but in assembley, can use the
>function INT?
If the function only take integer parameters this is safe, but if it
uses any pointers to memory buffers you must copy this data to a
conventional memory buffer and then use a DPMI call. You could code this
directly in asm (using int 0x31 with ax=0x300, which is the DPMI
simulate real mode interrupt function that is called by __dpmi_int()),
or more easily you could just call the libc __dpmi_int() function from
your asm code.
I think this isn't really a good idea, though. It is only worth using
asm for really time-critical bits of code, and real mode interrupt calls
are by their very nature extremely slow. If you need to call such
interrupts, I think there is no point coding it in asm, and if speed is
so important, you should try to find ways of avoiding the interrupt
altogether...
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Miracles are nothing if you've got the wrong intentions" - Mike Keneally
- Raw text -