library_routines.s 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. OPEN_LIBRARY EQU -408
  2. CLOSE_LIBRARY EQU -414
  3. EXEC EQU 4
  4. *Library routines
  5. *****************************************
  6. ****** OPEN LIBRARYS ****
  7. *****************************************
  8. open_librarys
  9. moveq #0,d0
  10. bsr open_intuition_library
  11. tst.l d0
  12. beq.s error_and_exit
  13. bsr open_dos_library
  14. tst.l d0
  15. beq.s error_and_exit
  16. error_and_exit
  17. moveq #-1,d0
  18. rts
  19. exit_without_error
  20. rts
  21. *****************************************
  22. ****** CLOSE LIBRARYS ****
  23. *****************************************
  24. close_librarys
  25. bsr close_intuition_library
  26. bsr close_dos_library
  27. rts
  28. *****************************************
  29. ****** OPEN INTUITION LIBRARY ****
  30. *****************************************
  31. open_intuition_library
  32. move.l EXEC,a6
  33. moveq #0,d0 ;library version
  34. lea intuition_library_name,a1
  35. jsr OPEN_LIBRARY(A6)
  36. move.l d0,intuition_library
  37. rts
  38. *****************************************
  39. ****** OPEN DOS LIBRARY ****
  40. *****************************************
  41. open_dos_library
  42. move.l EXEC,a6
  43. lea dos_library_name,a1
  44. moveq #0,d0 ;library version
  45. jsr OPEN_LIBRARY(A6)
  46. move.l d0,dos_library
  47. rts
  48. *****************************************
  49. ****** CLOSE DOS LIBRARY ****
  50. *****************************************
  51. close_dos_library
  52. tst.l dos_library
  53. beq.s cant_close_dos_library
  54. move.l EXEC,a6
  55. move.l dos_library,a1
  56. jsr CLOSE_LIBRARY(a6)
  57. cant_close_dos_library
  58. rts
  59. *****************************************
  60. ****** CLOSE INTUITION LIBRARY ****
  61. *****************************************
  62. close_intuition_library
  63. tst.l intuition_library
  64. beq.s cant_close_intuition_library
  65. move.l EXEC,a6
  66. move.l intuition_library,a1
  67. jsr CLOSE_LIBRARY(a6)
  68. cant_close_intuition_library
  69. rts
  70. *library names
  71. intuition_library_name
  72. dc.b "intuition.library",0
  73. EVEN
  74. dos_library_name
  75. dc.b "dos.library",0
  76. EVEN
  77. *library pointers
  78. intuition_library
  79. dc.l 0
  80. dos_library
  81. dc.l 0