Difference between revisions of "User:Alex farlie/16 Bit compilers"

From ReactOS Wiki
Jump to: navigation, search
(Created page with "Per Borland C 4.5 16 BIT DOS Models Tiny (I.E .COM model) : * Single _TEXT, _ DATA and _BSS of up to 64K (all code into single _TEXT if it fits. * DS=SS=CS * HEAP grows upw...")
 
(Rerturn is RETf)
Line 11: Line 11:
  
 
Small:
 
Small:
* Seperate _TEXT,  single _ DATA and BSS of up to 64K  
+
* Single _TEXT (64K) ,  single _ DATA and BSS of up to 64K  
 
* DS=SS
 
* DS=SS
* Local HEAP grows upward from top of BSS
+
* Local HEAP grows upward from top (+1) of BSS
 
* STACK grows downward from top of DS=SS segement (up to 64K)
 
* STACK grows downward from top of DS=SS segement (up to 64K)
 
* Far HEAP grows upward beyond from the top of DS (+1)
 
* Far HEAP grows upward beyond from the top of DS (+1)
Line 20: Line 20:
 
* Multiple _TEXT (one per source/object file), single _DATA and _BSS
 
* Multiple _TEXT (one per source/object file), single _DATA and _BSS
 
* DS=SS
 
* DS=SS
* Local HEAP grows upward from top of BSS
+
* Local HEAP grows upward from top (+1) of BSS
 
* STACK grows downward from top of DS=SS segement (up to 64K)
 
* STACK grows downward from top of DS=SS segement (up to 64K)
 
* Far HEAP grows upward beyond top of DS (+1)
 
* Far HEAP grows upward beyond top of DS (+1)
Line 61: Line 61:
 
       move sp,bp
 
       move sp,bp
 
       pop  bp  
 
       pop  bp  
       RET <x>  / x is depndent on calling convention but should match sizeof(locals+args)
+
       RETF <x>  / x is depndent on calling convention but should match sizeof(locals+args)
 
</pre></code>
 
</pre></code>
  
  
 
Windows 16 bit is different..
 
Windows 16 bit is different..

Revision as of 13:58, 9 September 2015

Per Borland C 4.5

16 BIT DOS Models

Tiny (I.E .COM model) :

  • Single _TEXT, _ DATA and _BSS of up to 64K (all code into single _TEXT if it fits.
  • DS=SS=CS
  • HEAP grows upward from top of _BSS
  • STACK grows downward from top of segment (up to 64K)
  • Initial SP is top of DS=SS=CS

Small:

  • Single _TEXT (64K) , single _ DATA and BSS of up to 64K
  • DS=SS
  • Local HEAP grows upward from top (+1) of BSS
  • STACK grows downward from top of DS=SS segement (up to 64K)
  • Far HEAP grows upward beyond from the top of DS (+1)

Medium:

  • Multiple _TEXT (one per source/object file), single _DATA and _BSS
  • DS=SS
  • Local HEAP grows upward from top (+1) of BSS
  • STACK grows downward from top of DS=SS segement (up to 64K)
  • Far HEAP grows upward beyond top of DS (+1)

Compact:

  • Single _TEXT, single DATA and _BSS
  • DS!=SS
  • HEAP is "far" above STACK
  • STACK grows downward from top of SS ( base of SS is uninitialised)
  • HEAP grows upwards from beyond the stack.

Large:

  • Multiple _TEXT (one for each source file), single DATA and _BSS
  • DS!=SS
  • HEAP is "far" above STACK
  • STACK grows doward from top of SS ( base of SS is uninitialised)
  • HEAP grows upwards from beyond the stack.

Huge:

  • Multiple _TEXT (one for each source file), multiple _DATA (No _BSS noted).
  • DS!=SS
  • HEAP is "far" above STACK
  • STACK grows downward from top of SS (base of SS is unitialised).
  • HEAP grows upward from beyond the stack.

In the larger models do NOT assume any "data" stored in CS is valid.

Functions should use something like this if FAR

.prolog push bp 
        mov bp,sp 
        sub sp, <local stack needed>
        (register saves)
       
        (module code)
     
.epilog
       (register restores)
       move sp,bp
       pop  bp 
       RETF <x>  / x is depndent on calling convention but should match sizeof(locals+args)


Windows 16 bit is different..