Mail Archives: djgpp/1999/07/18/01:46:31
Hello Nate (and others),
I understand a lot you explained to me and I realy appreciate it. Hope you
can take som more of my questions.
>> - I noticed that there are lots of functions that look so much like the
above:
>> _farpokeb
>> _farpokew
>> _farnspokew
>> etc.
>
>You'll notice that the ones with "ns" in the middle don't require the
>segment as one of their args ("ns" = "no segment"). You must select the
>segment first with `_farsetsel' for these. This is a performance
>advantage but probably not useful when getting started. The others pass
>the segment each time.
Ok. I think I understand. And I had this working:
_farpokeb(_dos_ds,0xA0000 + y*320+x, color);
_dos_ds is said to be a selector to allow direct access to absolute
addresses.
- Can this _dos_ds looked at as some kind of 'portal with guardsmen' that
allow 0 to 1 MB addresses?
- If so ... Are all _farnspokeb(), _farnspokel(), _farnspeekw() etc. codes
using that same 'portal' defined once(?) in a porgram with
_farsetsel(_dos_ds)?
- Can I just use the same _dos_ds with all my _farpokeb() accesses to those
addresses? Or does _my_ds come in here somewhere?
- And what does the DS mean in _dos_ds?
>> - Why are there so many functions that look like they are far or near types
>> ? The compiler is 32bit and in the FAQ stated that DJGPP doesn't even
>> recognise the far and near types ?!?!
>
>Some compilers allow you to specify near and far as part of the pointer,
>like `char far *p'. GCC (DJGPP's compiler) doesn't-- all pointers are
>effectively near. These functions are provided to let you access memory
>outside your segment anyway.
I don't realy get this. Where will my pointers become far or remain near?
If I were to declare:
int i[100], *ptr;
ptr=i;
Is this within my program's segment or is it going to be far?
If far, ... what would be near?
And if I were to declare:
unsigned char *double_buffer
double_buffer = (unsigned char *)malloc(320*200);
This 'double_buffer' is far, right?
If there are any differences between the '*ptr' and the 'double_buffer',
what are they?
Regards;
Mark.
- Raw text -