system.s 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. ******************************************************************************
  2. ; include dos_lib.i
  3. ;LIB_OPEN = -408
  4. xdef _set_up_disc
  5. _set_up_disc
  6. move.l 4,a6 exec base
  7. lea DOS_Name,a1 library to open
  8. jsr LIB_OPEN(a6)
  9. move.l d0,_mydosbase
  10. move.l _mydosbase,a6 get standard output handle
  11. jsr _LVOOutput(a6)
  12. move.l d0,_clihandle
  13. rts
  14. *****************************************************************************
  15. xdef _myload_file
  16. _myload_file
  17. movem.l d1-d7/a0-a6,-(sp)
  18. lea filestuff,a6
  19. mulu #12,d0
  20. adda.w d0,a6
  21. move.l 0(a6),d5 read screenfile
  22. move.l 4(a6),d6
  23. move.l 8(a6),d7
  24. move.l _mydosbase,a6
  25. move.l d5,d1 read map_file
  26. move.l #1005,d2 mode oldfile
  27. jsr _LVOOpen(a6) open
  28. move.l d0,d5 is now the file handle
  29. beq.s .fail
  30. move.l d5,d1 handle
  31. move.l d6,d2 buffer
  32. move.l d7,d3 length
  33. jsr _LVORead(a6) read the file
  34. move.l d5,d1 handle
  35. jsr _LVOClose(a6) close the file
  36. bra.s .end
  37. .fail
  38. move.l #'FAIL',d0
  39. .end
  40. movem.l (sp)+,d1-d7/a0-a6
  41. rts
  42. *****************************************************************************
  43. xdef _mysave_file
  44. _mysave_file
  45. movem.l d1-d7/a0-a6,-(sp)
  46. lea filestuff,a6
  47. mulu #12,d0
  48. adda.w d0,a6
  49. move.l 0(a6),d5 write screenfile
  50. move.l 4(a6),d6
  51. move.l 8(a6),d7
  52. move.l _mydosbase,a6
  53. move.l d5,d1 read map_file
  54. move.l #1006,d2 mode newfile
  55. jsr _LVOOpen(a6) open
  56. move.l d0,d5 is now the file handle
  57. beq.s .fail
  58. move.l d5,d1 handle
  59. move.l d6,d2 buffer
  60. move.l d7,d3 length
  61. jsr _LVOWrite(a6) read the file
  62. move.l d5,d1 handle
  63. jsr _LVOClose(a6) close the file
  64. bra.s .end
  65. .fail
  66. move.l #'FAIL',d0
  67. .end
  68. movem.l (sp)+,d1-d7/a0-a6
  69. rts
  70. *****************************************************************************
  71. ;DOS_Name dc.b 'dos.library',0
  72. even
  73. _mydosbase dc.l 0
  74. _clihandle dc.l 1
  75. ******************************************************************************
  76. filestuff
  77. dc.l _backscreen
  78. dc.l backscreen
  79. dc.l 32000
  80. _backscreen
  81. dc.b "DATA/QAZ.DAT",0
  82. even
  83. ******************************************************************************
  84. * convert long to alpha Tue Mar 27 10:36:17 1990 *
  85. ******************************************************************************
  86. ; a0-> destination string d0.l = number to convert, d1.l = no digits
  87. xdef _to_alpha
  88. _to_alpha
  89. move.w d1,d2
  90. add.w d2,d2 ;*2
  91. add.w d2,d2 ;*4
  92. neg.w d2
  93. lea decsize(pc,d2.w),a1 ;a1-> list of neggers
  94. subq.w #1,d1 ;for dbra
  95. ; move.w #1,d4
  96. .loop
  97. move.l (a1)+,d2 ;get negger
  98. moveq #'0',d3 ;this digit
  99. .iloop
  100. sub.l d2,d0
  101. bmi.s .digdun
  102. addq.b #1,d3 ;build digit
  103. bra.s .iloop
  104. .digdun
  105. add.l d2,d0
  106. tst.w d4 ;leading spaces. or not
  107. beq.s .not_leading
  108. cmp.b #'0',d3
  109. beq.s .still_leading
  110. moveq #0,d4
  111. bra.s .not_leading
  112. .still_leading
  113. moveq #' ',d3
  114. .not_leading
  115. move.b d3,(a0)+
  116. dbra d1,.loop
  117. ; clr.b (a0)
  118. rts
  119. dc.l 10000000
  120. dc.l 1000000
  121. dc.l 100000
  122. dc.l 10000
  123. dc.l 1000
  124. dc.l 100
  125. dc.l 10
  126. dc.l 1
  127. decsize ;label at end of table
  128. ******************************************************************************