William Chops" Westfield" wrote: > /* > * Our console uart is memory mapped > */ > struct uart_type *console = (struct uart_type *)0x801000; I guess this defines CONSOLE as a pointer to a record of type UART_TYPE and sets the pointer pointing to address 801000h? A comment or two would help. Anyway to show the flavor I created a whole program in Pascal that pretends to use memory mapped hardware registers, which I think was your point. I also wrote it more in the style and naming convetions I would have written such a thing: program x; const adr_uart = 16#801000; {address of memory mapped UART registers} type uart_p_t = ^uart_t; uart_t = record {memory mapped UART hardware layout} stuff: integer32; morstuff: integer32; end; var console_p: uart_p_t; {points to console output HW registers} begin console_p := uart_p_t(adr_uart); {point to the console output regs} console_p^.stuff := 27; {send value to console} end. I did a whole program so that I could actually build it to make sure I didn't mess up something. This program builds and runs on Windows. Not surprisingly is results in a popup about the program performing a illegal operation when run. Since my Pascal is implemented as a source to source translator and the output is for MSVC on Windows, this also created a temporary C file: extern void string_cmline_set ( int, char *, char *); /***************************** ** ** Start of program X. */ #define adr_uart_k 8392704 typedef struct uart_t { int stuff; int morstuff; } uart_t; typedef uart_t *uart_p_t; __declspec(dllexport) int main ( int argc, char * argv) { static uart_p_t console_p; static int int_1 = 8392704; /* ** Executable code for program X. */ string_cmline_set (argc, argv, "x"); console_p = *(void * *)&int_1; /* 8392704 */ console_p->stuff = 27; return 0; #undef adr_uart_k } Ignore the STRING_CMLINE_SET stuff. That is implicit initialization added to the start of all top level programs in my environment on Windows. The __DECLSPEC is unique to the Windows target platform. Also keep in mind that the above C was written by a machine for a machine, so its appearance and style may look a bit strange and awkward, and it should really be judged by the machine code a reasonable C compiler would produce from it. > Please provide a pascal example that works with at least two different > vendors' pascal compilers. No, you're missing the point again. We're talking about computer science concepts, not particular implementations. The point is that what you want to do is possible in a more tightly typed language like Pascal. A single instance is proof enough. Anyone can install my Windows host build environment and verify this for themselves if they think I'm cooking the data somehow. > but I think it's a fine example of exactly the sort of thing that > caused less dangerous languages to be dismissed from consideration for > "systems" programming. I don't see why. A variant of Pascal (call it Pascal-like if you prefer) was used to write the Apollo Aegis operating system. Someone else pointed out that a similar language was used to write the original Apple OS. People seem to forget that tight type checking only means that typing rules are enforced unless you explicitly say otherwise, as I did in using the data type UART_P_T as a "type transfer function" in the first executable statement. I could have also used UNIV_PTR instead, but that would have turned off more type checking than necessary. UNIV_PTR is roughly like a C void*. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist