1 ! This is the Modula-
2 run-time start-off routine. It
's job is to take the
2 ! arguments as put on the stack by EXEC, and to parse them and set them up the
3 ! way _m_a_i_n expects them.
5 .sect .text; .sect .rom; .sect .data; .sect .bss
7 .define begtext, begdata, begbss
17 .define m2rtso, hol0, __penviron, __penvp, __fpu_present
20 xor ebp, ebp ! clear for backtrace of core files
22 lea edx, 4(esp) ! argv
23 lea ecx, 8(esp)(eax*4) ! envp
25 ! Test if environ is in the initialized data area and is set to our
26 ! magic number. If so then it is not redefined by the user.
28 cmp ebx, __edata ! within initialized data?
30 testb bl, 3 ! aligned?
32 cmp (ebx), 0x53535353 ! is it our environ?
34 mov (__penviron), ebx ! _penviron = &environ;
35 0: mov ebx, (__penviron)
36 mov (ebx), ecx ! *_penviron = envp;
42 ! Test the EM bit of the MSW to determine if an FPU is present and
43 ! set __fpu_present if one is found.
45 testb al, 0x4 ! EM bit in MSW
46 setz (__fpu_present) ! True if not set
48 call __m_a_i_n ! run Modula-2 program
50 push eax ! push exit status
53 hlt ! force a trap if exit fails
56 .data4 0 ! Separate I&D: *NULL == 0
57 ! Also keeps the first string in the
58 ! program from appearing at location 0!
61 .data4 __penvp ! Pointer to environ, or hidden pointer
64 .comm __penvp, 4 ! Hidden environment vector
65 .comm __fpu_present, 4 ! FPU present flag
67 .extern endtext ! Force loading of end labels.