Q: Far pointers ? 
Author Message
 Q: Far pointers ?

I'm a french student so please excuse me for my poor english...
Moreover I'm not sure that this discussion group is the correct one so
please excuse me again if I'm wrong...

I'm trying to draw a rectangle on an external monitor using an "old" VGA
board.
I found in a book a way of accessing the screen buffer with the
following expression :
 char *line;
 line=MK_FP(0xa000,n*100);
 The MK_FP macro from dos.h should return a far pointer
_MK_FP(seg, offset) (void __far *)(((unsigned long)seg << 16) +
(unsigned long)(unsigned)offset)

 The segment of the far pointer will be a000h, which is the base of the
graphic mode VGA screen buffer. The offset will be the line number, n,
multiplied by the number of bytes in an 800-pixel line - that is, 100
bytes.

 Unfortunatly, it seems that this macro doesn'twork correctly in my
program.
 Is there another way of doing the same thing using another function ?

 Thank you in advance for your answers !



Mon, 13 Nov 2000 03:00:00 GMT  
 Q: Far pointers ?

First, some bad news.  Not only is that code non-standard C, it probably
won't work on any modern operating system.  The ones [MS-DOS,Win3.1] that it
was written for are all passe now.  C does not use far pointers.  That is a
compiler specific trick to work around a severe limitation in the addressing
mode of a particular CPU.  If you want to learn how to draw things on the
screen, I suggest that you might like to read the FAQ for

Also, the game programming groups might be helpful.  That book you were
reading is now completely useless.

Now, some more bad news.  Saying "I am sorry if this is off-topic" does not
make something become topical.  If you read the FAQ for a newsgroup, that
should be helpful.  Many newsgroups have charters, so you might examine
those first also.  This particular newsgroup has an excellent automatic
posting entitled "--- Welcome to comp.lang.c!  Please read this first."
posted by Billy Chambless.  It was last posted on May 26 at 6:34 PM.  It is
an excellent help to learn how to use usenet resources properly.
Here are some links you might like to explore to learn to become an
excellent and courteous poster:
http://student.anu.edu.au/netiquette.html
http://www.cs.rochester.edu/u/leblanc/internet-course/usenet/etiquett...
http://www.quasar.ualberta.ca/nethowto/resource/usenet.htm
http://docuspace.uchicago.edu/g_news-eti.html
http://unix1.sncc.lsu.edu/internet/usenet/usenet-etiquette.html

Now the good news.  Hmmm... You did not use void main() anywhere in your
uncompilable snippet nor try to assign i=i++;
--
Hypertext C-FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-FAQ ftp: ftp://rtfm.mit.edu, C-FAQ Book: ISBN 0-201-84519-9
Try "C Programming: A Modern Approach" ISBN 0-393-96945-2
Want Software?  Algorithms?  Pubs? http://www.infoseek.com

Quote:

>I'm a french student so please excuse me for my poor english...
>Moreover I'm not sure that this discussion group is the correct one so
>please excuse me again if I'm wrong...

>I'm trying to draw a rectangle on an external monitor using an "old" VGA
>board.
>I found in a book a way of accessing the screen buffer with the
>following expression :
> char *line;
> line=MK_FP(0xa000,n*100);
> The MK_FP macro from dos.h should return a far pointer
>_MK_FP(seg, offset) (void __far *)(((unsigned long)seg << 16) +
>(unsigned long)(unsigned)offset)

> The segment of the far pointer will be a000h, which is the base of the
>graphic mode VGA screen buffer. The offset will be the line number, n,
>multiplied by the number of bytes in an 800-pixel line - that is, 100
>bytes.

> Unfortunatly, it seems that this macro doesn'twork correctly in my
>program.
> Is there another way of doing the same thing using another function ?

> Thank you in advance for your answers !



Mon, 13 Nov 2000 03:00:00 GMT  
 Q: Far pointers ?



Quote:
>I'm a french student so please excuse me for my poor english...
>Moreover I'm not sure that this discussion group is the correct one so
>please excuse me again if I'm wrong...

>I'm trying to draw a rectangle on an external monitor using an "old" VGA
>board.
>I found in a book a way of accessing the screen buffer with the
>following expression :
> char *line;
> line=MK_FP(0xa000,n*100);
> The MK_FP macro from dos.h should return a far pointer
>_MK_FP(seg, offset) (void __far *)(((unsigned long)seg << 16) +
>(unsigned long)(unsigned)offset)

You appear to be asking about DOS specific things, so
comp.os.msdos.programmer would be a good place to post (VGA, dos.h,
_MK_FP, far pointers are not defined by the C language but are
meaningful in a DOS environment).

--
-----------------------------------------


-----------------------------------------



Mon, 13 Nov 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. long pointers again -- far pointers

2. Huge pointers vs Far pointers

3. far **pointer ?

4. Illegal use of far pointer

5. near, huge and far pointers

6. Need help with DOS and far pointers

7. Working with far pointers and screen mode 0x13

8. Problems with far pointers on x86

9. C near and far pointer declarations

10. allocating far pointers

11. Far pointer problem.

12. Pointer arithmetics - how far can you go

 

 
Powered by phpBB® Forum Software