From: Ilari DOT Liusvaara AT mbnet DOT fi Newsgroups: comp.os.msdos.djgpp Subject: Re: Inline memory access Date: Sat, 26 Aug 2000 15:52:03 GMT Organization: Clinet Internet Services Lines: 33 Message-ID: <39a7df3c.25914103@news.mbnet.fi> References: <39a71d80 AT news-uk DOT onetel DOT net DOT uk> NNTP-Posting-Host: mb-u11ip114.mbnet.fi X-Trace: news.clinet.fi 967305105 16543 194.100.166.33 (26 Aug 2000 15:51:45 GMT) X-Complaints-To: abuse AT clinet DOT fi NNTP-Posting-Date: 26 Aug 2000 15:51:45 GMT X-Newsreader: Forte Free Agent 1.21/32.243 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Sat, 26 Aug 2000 02:26:54 +0100, "Josiaha Hudini" 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