absolute address pointer in MS C 5.1

Fred Smith fredex at cg-atla.UUCP
Mon Jan 1 14:50:03 AEST 1990


In article <5850 at sdcc6.ucsd.edu> bruno at sdcc10.ucsd.edu (Bruce W. Mohler) writes:
>I'm trying to print out a series of characters at an
>absolute address (up in the F000:xxxx ROM) from inside
>of an MS C 5.1 program. 
>
>This doesn't work for me:
>
>	char far *machine_id = (0xFFFFE);	/* F000:FFFE */
>
>Bruce W. Mohler
>Systems Programmer (aka Staff Analyst)
>bruno at sdcc10.ucsd.edu
>voice: 619/586-2218



Try this:

  char far *machine_id;

  FP_SEG (machine_id) = 0xf000;
  FP_OFF (machine_id) = 0xfffe;

  while (loop_condition)
    printf ("%c", *machine_id++);

In Microsoft C this is the prescribed method of setting a far pointer. I must
admit that such usage of these two macros is rather obscure, but that IS the
way to do it.

Fred



More information about the Comp.lang.c mailing list