head_em.s 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. ! 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. WRITE:
  44. jmp (__write)
  45. BRK:
  46. jmp (__brk)
  47. .sect .data
  48. begdata:
  49. splimit:
  50. .data4 0 ! may be at virtual address 0 with no problem
  51. hol0:
  52. .lino:
  53. .data4 0 ! lino
  54. .filn:
  55. .data4 0 ! filn
  56. .reghp:
  57. .data4 endbss
  58. .limhp:
  59. .data4 endbss
  60. .trppc:
  61. .data4 0
  62. .trpim:
  63. .data4 0 ! USED TO BE 2 BYTES; IS THIS RIGHT?
  64. .sect .bss
  65. begbss: !initialization is not needed because ALL entries are in zero space!