head_em.s 1.3 KB

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