Node:Xfer, Next:, Previous:Zero SP, Up:Low-level

18.4 How to move data between your program and conventional memory

Q: How can I move data between my program and the transfer buffer?

Q: How do I access my peripheral card which is memory-mapped to an address between 640K and 1M?

Q: How can I read or change a value of one of the variables in the BIOS data area?

Q: How can I peek at an address whose far pointer I get from an INT 21h call?

A: Usually, memory-mapped devices or absolute addresses below 1MB mark are outside your program's address space, so you cannot access them directly. "Direct access", when you just dereference a pointer, means in DJGPP that you use your program's DS selector, and all the addresses are offsets relative to the base of that selector. So first, you will need a special selector that will allow you to access your device or absolute address. There are several methods you can get such a selector:

Once you have a selector, you can use one of three methods to access your absolute addresses using that selector: