bruno@sdcc10.ucsd.edu (Bruce W. Mohler) (12/31/89)
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. I must be flushing all around the solution. I've looked in all 3 of the MS C binders, in Norton's _Programmer's Guide to the IbM PC_, even Kencht's _Advanced Quick C_, without finding the answer. This doesn't work for me: char far *machine_id = (0xFFFFE); /* F000:FFFE */ It doesn't work to express the address in the format that it is in the comment. I've tried swapping 'char' and 'far', but that's a syntax error. Any suggestions? This must be fairly easy (its easy to make a program non-portable, isn't it?). Thanks, in advance! -- Bruce W. Mohler Systems Programmer (aka Staff Analyst) bruno@sdcc10.ucsd.edu voice: 619/586-2218
bill@twwells.com (T. William Wells) (12/31/89)
In article <5850@sdcc6.ucsd.edu> bruno@sdcc10.ucsd.edu (Bruce W. Mohler) writes:
: char far *machine_id = (0xFFFFE); /* F000:FFFE */
Try either of:
char far *machine_id = 0xF000FFFE;
char far *machine_id = 0xFFFEF000;
If you get compile time errors, add a cast:
char far *machine_id = (char far *)0xF000FFFE;
char far *machine_id = (char far *)0xFFFEF000;
This is only a guess, but is easy enough to check out.
---
Bill { uunet | novavax | ankh | sunvice } !twwells!bill
bill@twwells.com
bruno@sdcc10.ucsd.edu (Bruce W. Mohler) (12/31/89)
In article <5849@sdcc6.ucsd.edu>, bruno@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... > > char far *machine_id = (0xFFFFE); /* F000:FFFE */ > > Any suggestions? ... > > -- > Bruce W. Mohler > Systems Programmer (aka Staff Analyst) > bruno@sdcc10.ucsd.edu > voice: 619/586-2218 Thanks to Chuck Kane ckane@uiece.ece.uiuc.edu Dan Lanciani ddl@harvard.* Doug McDonald mcdonald@aries.scs.uiuc.edu John Birchfield jb@altair.csustan.edu for their quick answers to my problem. One interesting note: none of them suggested using the FP_SEG and FP_OFF macros (which were buried in the Run-Time Library Reference). Their solutions corrected my silly failure to convert the segmented address into a 32-bit pointer. Thanks again. The net is always the fastest way to get an answer. -- Bruce W. Mohler Systems Programmer (aka Staff Analyst) bruno@sdcc10.ucsd.edu voice: 619/586-2218 -- Bruce W. Mohler Systems Programmer (aka Staff Analyst) bruno@sdcc10.ucsd.edu voice: 619/586-2218
fredex@cg-atla.UUCP (Fred Smith) (01/01/90)
In article <5850@sdcc6.ucsd.edu> bruno@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@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
kaleb@mars.jpl.nasa.gov (Kaleb Keithley) (01/03/90)
In article bruno@sdcc10.ucsd.edu (Bruce W. Mohler) writes: >This doesn't work for me: > > char far *machine_id = (0xFFFFE); /* F000:FFFE */ > What you want is char far *machine_id = 0xF000FFFE; Chewey, get us outta here! kaleb@mars.jpl.nasa.gov (818)354-8771 Kaleb Keithley
pajerek@kadsma.uucp (Don Pajerek) (01/09/90)
In article <5850@sdcc6.ucsd.edu> bruno@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 */ > > >Thanks, in advance! > >Bruce W. Mohler Try char far *machine_id = *(char far *)0xF000FFFEL; - djp f i l l e r
javiv@nsi.UUCP (Javier Vilarroig Christensen.) (01/11/90)
In article <5850@sdcc6.ucsd.edu> bruno@sdcc10.ucsd.edu (Bruce W. Mohler) writes: >This doesn't work for me: > > char far *machine_id = (0xFFFFE); /* F000:FFFE */ > >It doesn't work to express the address in the format that >it is in the comment. I've tried swapping 'char' and 'far', > >Any suggestions? This must be fairly easy (its easy to make In Xenix 286 you must use the -Me flag to enable de "far" keyword. Thew Xenix compiler is from Microsoft, it's posibble to put it in your compiler. -- +------------------------------------+-------------------------------------+ | Javier Vilarroig Christensen | PHONE: 34 3 210-33-55 (VOICE) | | NEXUS Servicios de Informacion S.L.| 34 3 214-72-62 (DATA) | +------------------------------------+-------------------------------------+ | SMAIL: Travesera de Dalt 104 Ent. 5| EUNET: javiv@nsi.es | | 08024 - Barcelona - Spain | javiv@nexus.nsi.es | +------------------------------------+-------------------------------------+