Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - __far Pointer
Hi all, I was hoping someone could help me with a question. I want to place data at a specific location in memory. I am writing this program with no run-time support, so dynamic memory allocation is out of the question. The location I want to place data in is in a seperate segment, so I believe I will need to use a far pointer. I searched this site and found the __far pointer keyword. I figure I need to create a pointer using the __far keyword and place the address in it following the instructions I found on this site. I am going to need to do this in both real mode and protected mode. For example, say I am executing code in real mode located in segment 0900h and I want to place data in segment 1200h at offset 0000h. How would I do this? I know protected mode is different with its global descriptor table but is this also possible in protected mode. I don't know if I explained this carefully enough, so tell me if I need to clarify. Thanks! Nov 06 2004
"IR" <IR_member pathlink.com> wrote in message news:cmj6r3$2fld$1 digitaldaemon.com...Hi all, I was hoping someone could help me with a question. I want to place data Nov 06 2004
Is there any way just to write data to a far segment using a far pointer? In article <cmj7qc$2h2n$1 digitaldaemon.com>, Walter says..."IR" <IR_member pathlink.com> wrote in message news:cmj6r3$2fld$1 digitaldaemon.com...Hi all, I was hoping someone could help me with a question. I want to place data Nov 06 2004
Using MK_FP(), you can create a far pointer to any memory location, then read and write that location. "IR" <IR_member pathlink.com> wrote in message news:cmjcjc$2nnu$1 digitaldaemon.com...Is there any way just to write data to a far segment using a far pointer? Nov 06 2004
Im sorry to keep bothering you but I am still new to this and am trying to learn. I know how I would read data from that location but how would you write. Thanks again. In article <cmjt3m$au8$1 digitaldaemon.com>, Walter says...Using MK_FP(), you can create a far pointer to any memory location, then read and write that location. "IR" <IR_member pathlink.com> wrote in message news:cmjcjc$2nnu$1 digitaldaemon.com...Is there any way just to write data to a far segment using a far pointer? Nov 06 2004
char __far *p = MK_FP(0x1200, 0x40); *p = 6; // writes 6 to 1200:0040 "IR" <IR_member pathlink.com> wrote in message news:cmk0u6$fl9$1 digitaldaemon.com...Im sorry to keep bothering you but I am still new to this and am trying to learn. I know how I would read data from that location but how would you write. Nov 07 2004
The program has to include dos.h in order to use MK_FP(). Do you know if MK_FP() uses any DOS interrupts or any other DOS functions? The reason I ask is because I'm writing a program with no underlying OS support. If it does use some type of DOS support, can you tell me how to set the far pointer without using MK_FP(). Thanks In article <cmlsjq$56a$1 digitaldaemon.com>, Walter says...char __far *p = MK_FP(0x1200, 0x40); *p = 6; // writes 6 to 1200:0040 "IR" <IR_member pathlink.com> wrote in message news:cmk0u6$fl9$1 digitaldaemon.com...Im sorry to keep bothering you but I am still new to this and am trying to learn. I know how I would read data from that location but how would you write. Nov 08 2004
From dos.h: #define MK_FP(seg,offset) \ ((void __far *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) So, no, it does not use DOS functions. "IR" <IR_member pathlink.com> wrote in message news:cmo00b$kjq$1 digitaldaemon.com...The program has to include dos.h in order to use MK_FP(). Do you know if MK_FP() uses any DOS interrupts or any other DOS functions? The reason I ask is because I'm writing a program with no underlying OS Nov 08 2004
|