Pristine Ack-5.5
[Ack-5.5.git] / mach / m68020 / libsys / head_em.s
1 .define .lino,.filn
2 .define EXIT,BRK,WRITE
3 .define begtext,begdata,begbss
4 .define EARRAY,ERANGE,ESET,EIDIVZ,EHEAP,EILLINS,ECASE,EBADGTO
5 .define hol0,.reghp,.limhp,.trpim,.trppc
6 .sect .text
7 .sect .rom
8 .sect .data
9 .sect .bss
10
11
12
13 ! runtime startof for 68020 machine
14
15
16 LINO_AD = 0
17 FILN_AD = 4
18
19 EARRAY  = 0
20 ERANGE  = 1
21 ESET    = 2
22 EIDIVZ  = 6
23 EHEAP   = 17
24 EILLINS = 18
25 ECASE   = 20
26 EBADGTO = 27
27
28         .sect .text
29 begtext:
30         move.l  d0,(splimit)    ! load splimit with the initial stack limit
31         sub.l   #8,sp
32         move.l  (8,sp),(sp)     ! argc
33         lea     (12,sp),a0
34         move.l  a0,(4,sp)       ! argv
35         move.l  a0,a1
36 1:
37         tst.l   (a0)+           ! null args term?
38         bne     1b
39         cmp.l   (a1),a0         ! end of 'argv[]' and in *argv[] strings?
40         blt     2f              ! skip if a0 is less than start of *argv[]
41         sub.l   #4,a0           ! else backup one to set env = 0 (NULL)
42 2:
43         move.l  a0,(8,sp)       ! env
44 !       move.l  a0, environ     ! indir is 0 if no env; not 0 if env
45 !       jsr     (initfpu)       ! call to dummy floating point init routine
46         jsr     (__m_a_i_n)
47         move.l  d0,(sp)         ! no stack cleanup needed
48 EXIT:
49         jsr     (__exit)
50
51 WRITE:
52         jmp     (__write)
53 BRK:
54         jmp     (__brk)
55
56         .sect .data
57 begdata:
58 splimit:
59         .data4 0                ! may be at virtual address 0 with no problem
60 hol0:
61 .lino:
62         .data4  0       ! lino
63 .filn:
64         .data4  0       ! filn
65 .reghp:
66         .data4  endbss
67 .limhp:
68         .data4  endbss
69 .trppc:
70         .data4  0
71 .trpim:
72         .data4  0       ! USED TO BE 2 BYTES; IS THIS RIGHT?
73
74
75         .sect .bss
76 begbss: !initialization is not needed because ALL entries are in zero space!