head_em.s 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. ! EM runtime start-off for the Bleasdale 68000 system
  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. ! Bleasdale puts the argument and environment vectors
  24. ! themselves on top of the stack, instead of POINTERS
  25. ! to these vectors. We get things right here.
  26. move.l 4(sp),a0
  27. clr.l -4(a0)
  28. move.l sp,a0
  29. sub.l #8,sp
  30. move.l (a0),(sp)
  31. add.l #4,a0
  32. move.l a0,4(sp)
  33. 1:
  34. tst.l (a0)+
  35. bne 1b
  36. move.l 4(sp),a1
  37. cmp.l (a1),a0
  38. blt 2f
  39. sub.l #4,a0
  40. 2:
  41. move.l a0,8(sp)
  42. ! Now the stack contains an argc (4 bytes), argv-pointer and
  43. ! envp pointer.
  44. add.l #2,sp !convert argc from 4-byte to 2-byte
  45. jsr __m_a_i_n
  46. add #010,sp
  47. EXIT:
  48. move.w d0,-(sp)
  49. jsr __exit
  50. .sect .data
  51. begdata:
  52. hol0:
  53. .lino:
  54. .data2 0,0 ! lino
  55. .filn:
  56. .data4 0 ! filn
  57. .reghp:
  58. .data4 endbss
  59. .limhp:
  60. .data4 endbss
  61. .trppc:
  62. .data4 0
  63. .trpim:
  64. .data2 0
  65. .sect .bss
  66. begbss: !initialization is not needed because ALL entries are in zero space!