-;_ minit.asm\r
-; Written by Walter Bright\r
-; Digital Mars\r
-; http://www.digitalmars.com/d/\r
-; Placed into the Public Domain\r
-\r
-include macros.asm\r
-\r
-ifdef _WIN32\r
- DATAGRP EQU FLAT\r
-else\r
- DATAGRP EQU DGROUP\r
-endif\r
-\r
-; Provide a default resolution for weak extern records, no way in C\r
-; to define an omf symbol with a specific value\r
-public __nullext\r
-__nullext equ 0\r
-\r
- extrn __moduleinfo_array:near\r
-\r
-; This bit of assembler is needed because, from C or D, one cannot\r
-; specify the names of data segments. Why does this matter?\r
-; All the ModuleInfo pointers are placed into a segment named 'FM'.\r
-; The order in which they are placed in 'FM' is arbitrarily up to the linker.\r
-; In order to walk all the pointers, we need to be able to find the\r
-; beginning and the end of the 'FM' segment.\r
-; This is done by bracketing the 'FM' segment with two other, empty,\r
-; segments named 'FMB' and 'FME'. Since this module is the only one that\r
-; ever refers to 'FMB' and 'FME', we get to control the order in which\r
-; these segments appear relative to 'FM' by using a GROUP statement.\r
-; So, we have in memory:\r
-; FMB empty segment\r
-; FM contains all the pointers\r
-; FME empty segment\r
-; and finding the limits of FM is as easy as taking the address of FMB\r
-; and the address of FME.\r
-\r
-; These segments bracket FM, which contains the list of ModuleInfo pointers\r
-FMB segment dword use32 public 'DATA'\r
-FMB ends\r
-FM segment dword use32 public 'DATA'\r
-FM ends\r
-FME segment dword use32 public 'DATA'\r
-FME ends\r
-\r
-; This leaves room in the _fatexit() list for _moduleDtor()\r
-XOB segment dword use32 public 'BSS'\r
-XOB ends\r
-XO segment dword use32 public 'BSS'\r
- dd ?\r
-XO ends\r
-XOE segment dword use32 public 'BSS'\r
-XOE ends\r
-\r
-DGROUP group FMB,FM,FME\r
-\r
- begcode minit\r
-\r
-; extern (C) void _minit();\r
-; Converts array of ModuleInfo pointers to a D dynamic array of them,\r
-; so they can be accessed via D.\r
-; Result is written to:\r
-; extern (C) ModuleInfo[] _moduleinfo_array;\r
-\r
- public __minit\r
-__minit proc near\r
- mov EDX,offset DATAGRP:FMB\r
- mov EAX,offset DATAGRP:FME\r
- mov dword ptr __moduleinfo_array+4,EDX\r
- sub EAX,EDX ; size in bytes of FM segment\r
- shr EAX,2 ; convert to array length\r
- mov dword ptr __moduleinfo_array,EAX\r
- ret\r
-__minit endp\r
-\r
- endcode minit\r
-\r
- end\r
+;_ minit.asm
+; Written by Walter Bright
+; Digital Mars
+; http://www.digitalmars.com/d/
+; Placed into the Public Domain
+
+include macros.asm
+
+ifdef _WIN32
+ DATAGRP EQU FLAT
+else
+ DATAGRP EQU DGROUP
+endif
+
+; Provide a default resolution for weak extern records, no way in C
+; to define an omf symbol with a specific value
+public __nullext
+__nullext equ 0
+
+ extrn __moduleinfo_array:near
+
+; This bit of assembler is needed because, from C or D, one cannot
+; specify the names of data segments. Why does this matter?
+; All the ModuleInfo pointers are placed into a segment named 'FM'.
+; The order in which they are placed in 'FM' is arbitrarily up to the linker.
+; In order to walk all the pointers, we need to be able to find the
+; beginning and the end of the 'FM' segment.
+; This is done by bracketing the 'FM' segment with two other, empty,
+; segments named 'FMB' and 'FME'. Since this module is the only one that
+; ever refers to 'FMB' and 'FME', we get to control the order in which
+; these segments appear relative to 'FM' by using a GROUP statement.
+; So, we have in memory:
+; FMB empty segment
+; FM contains all the pointers
+; FME empty segment
+; and finding the limits of FM is as easy as taking the address of FMB
+; and the address of FME.
+
+; These segments bracket FM, which contains the list of ModuleInfo pointers
+FMB segment dword use32 public 'DATA'
+FMB ends
+FM segment dword use32 public 'DATA'
+FM ends
+FME segment dword use32 public 'DATA'
+FME ends
+
+; This leaves room in the _fatexit() list for _moduleDtor()
+XOB segment dword use32 public 'BSS'
+XOB ends
+XO segment dword use32 public 'BSS'
+ dd ?
+XO ends
+XOE segment dword use32 public 'BSS'
+XOE ends
+
+DGROUP group FMB,FM,FME
+
+ begcode minit
+
+; extern (C) void _minit();
+; Converts array of ModuleInfo pointers to a D dynamic array of them,
+; so they can be accessed via D.
+; Result is written to:
+; extern (C) ModuleInfo[] _moduleinfo_array;
+
+ public __minit
+__minit proc near
+ mov EDX,offset DATAGRP:FMB
+ mov EAX,offset DATAGRP:FME
+ mov dword ptr __moduleinfo_array+4,EDX
+ sub EAX,EDX ; size in bytes of FM segment
+ shr EAX,2 ; convert to array length
+ mov dword ptr __moduleinfo_array,EAX
+ ret
+__minit endp
+
+ endcode minit
+
+ end