home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.development      Operating system development chatter      4,255 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,577 of 4,255   
   mutazilah@gmail.com to All   
   16-bit absolute addresses   
   10 Dec 22 07:20:41   
   
   From: muta...@gmail.com   
      
   If you want to point to video memory, you   
   can hardcode an address by going:   
      
   char *x = (char *)0xb8000000;   
      
   even though you only want 0xb8000.   
      
   And you can encapsulate that in a macro   
      
   char *x = MK_FP(0xb800, 0x0).   
      
   But with huge memory model you should instead   
   be able to code:   
      
   char *x = NULL;   
      
   x += 0xb8000UL;   
      
   ie you have a nice address, finally.   
      
   I'm wondering whether syntax like that should   
   always be used, so even in PM32, instead of   
   doing:   
      
   char *x = (char *)0xb8000;   
      
   you instead go:   
      
   char *x = NULL;   
   x += 0xb8000UL;   
      
   and have code that is portable regardless of which x86   
   processor you are using.   
      
   Or put the above into a macro.   
      
   I'm not sure you can even doing arithmetic on a NULL   
   pointer officially.   
      
   Any suggestions?   
      
   I guess addresses should be obtained from a syscall   
   in the first place instead of hardcode though.   
      
   But the case I really want to do it in is the bootloader,   
   and I need a start address of 0x10600. I'm planning   
   on switching my bootloader to huge memory model   
   (currently it is tiny).   
      
   I'm also thinking of writing an exe2flat that takes an   
   arbitrary executable and "loads" it to a particular   
   address instead of being dependent on the linker to   
   support such a facility.   
      
   And I'll also initialize BSS in that process, as I think   
   the location of BSS can be determined by getting   
   the "minsize" from the executable header and subtracting   
   the stack length.   
      
   Any thoughts on that too?   
      
   Thanks. Paul.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca