Mail Archives: djgpp/2000/08/26/13:32:05
On Sat, 26 Aug 2000 02:26:54 +0100, "Josiaha Hudini"
<recoup_this AT netmachine DOT fsnet DOT co DOT uk> wrote:
> How would I put the byte 0x4 into video memory, center of the screen,
>160, 100, or 0xA0000:7DAO, in mode 0x13, using inline assembly, in Djgpp?
>
>
I would not recomend doing such a simple task as setting one byte in
memory with assembly code. This task is much simpler to do with
builtin library functions. A function call _farpokeb(_dos_ds,0xA7DA0,
0x4); Is much more elegant way to perform this task. It is not slower
either (at least when you compile with optimizations enabled.)
If you really need to do that using inline assembly, just load value
of variable _go32_info_block.selector_for_linear_memory
into some segment register (I would recomend ES), and then use movb
to move 0x4 to address 0xA7DA0 (don't forget to use segment override.)
I will not give any code for this because:
(1) If you really are in need of doing this in inline assembly, you
must know how to program in assembler (that hyper-horrible AT&T
syntax.)
(2) I have never done anything using inline assembly, because syntax
is so horrible (I don't mean assembly in general!)
BTW:Where I did obtain 0xA7DA0?
Answer:This is because low memory access selector (segment) of DJGPP
needs address encoded in special way. Formula to compute this address
is: Address=Segment*0x10+Offset, or in this case 0xA000*0x10+0x7DA0=
0xA7DAO.
Ilari Liusvaara
- Raw text -