OVL117.LST 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. Listing:
  2. 1 (*$N,A-,V-*)
  3. 2 IMPLEMENTATION MODULE Ovl117;
  4. 3 (* Copyright (C) 1987-1992 Clarion Software Corporation *)
  5. 4
  6. 5
  7. 6 IMPORT Str,FIO,Storage,SYSTEM,Lib;
  8. 7
  9. 8 PROCEDURE (*$S+ stack check for safety*) Load( n:CARDINAL );
  10. 9
  11. 10 TYPE bp=POINTER TO SHORTCARD;
  12. ***** ^ not supported yet
  13. 11 LONG = ARRAY [0..MAX(CARDINAL)-1] OF BYTE;
  14. ***** ^ undeclared identifier
  15. ***** ^ not supported yet
  16. ***** ^ not supported yet
  17. ***** ^ undeclared identifier
  18. 12
  19. 13 VAR
  20. 14 f:CARDINAL; (* file handle *)
  21. 15 s:CARDINAL; (* segment for overlay *)
  22. 16 segsize:CARDINAL; (* in paras *)
  23. 17
  24. 18 header:RECORD
  25. 19 Alloc: LONGCARD; (* total size *)
  26. ***** ^ undeclared identifier
  27. 20 Init: LONGCARD; (* size of initialised part *)
  28. ***** ^ undeclared identifier
  29. 21 nifix: CARDINAL; (* number of patches in loaded overlay *)
  30. 22 nefix: CARDINAL; (* number of patches in other overlays *)
  31. 23 resvd: ARRAY[0..3] OF CHAR; (* Can be used for validity check *)
  32. ***** ^ not supported yet
  33. ***** ^ not supported yet
  34. 24 END;
  35. ***** ^ not supported yet
  36. 25
  37. 26 Locseg:CARDINAL;
  38. 27 Target:CARDINAL;
  39. 28
  40. 29 tmp:CARDINAL;
  41. 30 atmp:ADDRESS;
  42. ***** ^ undeclared identifier
  43. 31 count:LONGCARD;
  44. ***** ^ undeclared identifier
  45. 32 base:CARDINAL;
  46. 33 chunk:CARDINAL;
  47. 34 dummy:CARDINAL;
  48. 35
  49. 36 fixbufseg:CARDINAL;
  50. 37 fixbufoff:CARDINAL;
  51. 38 fixbufcount:CARDINAL;
  52. 39 fixbuf:ARRAY [1..5*200H] OF SHORTCARD;
  53. ***** ^ not supported yet
  54. ***** ^ not supported yet
  55. 40
  56. 41 Filename:ARRAY[1..50] OF CHAR;
  57. ***** ^ not supported yet
  58. ***** ^ not supported yet
  59. 42 Ext:ARRAY[0..3] OF CHAR;
  60. ***** ^ not supported yet
  61. ***** ^ not supported yet
  62. 43
  63. 44 PROCEDURE chkread( buf:ADDRESS; count:CARDINAL );
  64. ***** ^ undeclared identifier
  65. 45 VAR tmp:POINTER TO LONG;
  66. ***** ^ not supported yet
  67. 46 BEGIN
  68. 47 tmp := buf;
  69. ***** ^ not supported yet
  70. ***** ^ not supported yet
  71. 48 IF FIO.RdBin(f, tmp^, count ) <> count THEN HALT END;
  72. ***** ^ not supported yet
  73. ***** ^ not supported yet
  74. ***** ^ not supported yet
  75. ***** ^ not supported yet
  76. ***** ^ undeclared identifier
  77. 49 END chkread;
  78. ***** ^ not supported yet
  79. 50
  80. 51 BEGIN
  81. 52 IF (Seg[n]<>MAX(CARDINAL)) THEN RETURN END ; (* Already loaded *)
  82. ***** ^ undeclared identifier
  83. ***** ^ not supported yet
  84. ***** ^ undeclared identifier
  85. ***** ^ not supported yet
  86. 53 Ext := '.ov ';
  87. ***** ^ not supported yet
  88. ***** ^ not supported yet
  89. 54 Ext[3] := CHAR( ORD('0') + n );
  90. ***** ^ not supported yet
  91. ***** ^ not supported yet
  92. ***** ^ undeclared identifier
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. 55 Str.Concat( Filename, Path, Ext );
  96. ***** ^ not supported yet
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. ***** ^ undeclared identifier
  100. ***** ^ not supported yet
  101. 56 f := FIO.Open(Filename);
  102. ***** ^ not supported yet
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. 57 chkread(ADR(header),SIZE(header));
  106. ***** ^ not supported yet
  107. ***** ^ undeclared identifier
  108. ***** ^ not supported yet
  109. ***** ^ undeclared identifier
  110. ***** ^ not supported yet
  111. 58
  112. 59 segsize := CARDINAL( ( header.Alloc + 15 ) DIV 16 );
  113. ***** ^ not supported yet
  114. ***** ^ not supported yet
  115. ***** ^ not supported yet
  116. 60
  117. 61 Storage.HeapAllocate( Storage.MainHeap, atmp, segsize );
  118. ***** ^ not supported yet
  119. ***** ^ not supported yet
  120. ***** ^ not supported yet
  121. ***** ^ not supported yet
  122. ***** ^ not supported yet
  123. ***** ^ not supported yet
  124. 62 s := SYSTEM.Seg(atmp^);
  125. ***** ^ not supported yet
  126. ***** ^ not supported yet
  127. ***** ^ not supported yet
  128. 63
  129. 64 Seg[n] := s;
  130. ***** ^ undeclared identifier
  131. ***** ^ not supported yet
  132. 65 Size[n] := segsize;
  133. ***** ^ undeclared identifier
  134. ***** ^ not supported yet
  135. 66
  136. 67 tmp := s;
  137. 68 count := header.Init;
  138. ***** ^ not supported yet
  139. ***** ^ not supported yet
  140. ***** ^ not supported yet
  141. 69
  142. 70 IF count > 0FFF0H THEN
  143. ***** ^ not supported yet
  144. 71 chkread( [tmp:0], 0FFF0H );
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. ***** ^ not supported yet
  148. 72 DEC(count,0FFF0H);
  149. ***** ^ undeclared identifier
  150. ***** ^ not supported yet
  151. ***** ^ not supported yet
  152. 73 INC(tmp, 0FFFH );
  153. ***** ^ undeclared identifier
  154. ***** ^ not supported yet
  155. 74 END;
  156. 75
  157. 76 WHILE count > 0F000H DO
  158. ***** ^ not supported yet
  159. 77 chkread( [tmp:0], 0F000H );
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. ***** ^ not supported yet
  163. 78 DEC(count,0F000H);
  164. ***** ^ undeclared identifier
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. 79 INC(tmp, 0F00H );
  168. ***** ^ undeclared identifier
  169. ***** ^ not supported yet
  170. 80 END;
  171. 81
  172. 82 chkread( [tmp:0], CARDINAL(count) );
  173. ***** ^ not supported yet
  174. ***** ^ not supported yet
  175. ***** ^ not supported yet
  176. 83
  177. 84 WHILE ( header.nifix <> 0 ) OR ( header.nefix <> 0 ) DO
  178. ***** ^ not supported yet
  179. ***** ^ not supported yet
  180. ***** ^ not supported yet
  181. ***** ^ not supported yet
  182. 85 fixbufcount := FIO.RdBin( f, fixbuf, SIZE(fixbuf) );
  183. ***** ^ not supported yet
  184. ***** ^ not supported yet
  185. ***** ^ not supported yet
  186. ***** ^ undeclared identifier
  187. ***** ^ not supported yet
  188. 86 fixbufseg := SYSTEM.Seg(fixbuf);
  189. ***** ^ not supported yet
  190. ***** ^ not supported yet
  191. ***** ^ not supported yet
  192. 87 fixbufoff := SYSTEM.Ofs(fixbuf);
  193. ***** ^ not supported yet
  194. ***** ^ not supported yet
  195. ***** ^ not supported yet
  196. 88 REPEAT
  197. 89 tmp := VAL(CARDINAL,[fixbufseg:fixbufoff bp]^);
  198. ***** ^ undeclared identifier
  199. ***** ^ not supported yet
  200. ***** ^ not supported yet
  201. 90 INC(fixbufoff);
  202. ***** ^ undeclared identifier
  203. ***** ^ not supported yet
  204. 91 Locseg := [fixbufseg:fixbufoff]^;
  205. ***** ^ not supported yet
  206. ***** ^ not supported yet
  207. 92 INC(fixbufoff,2);
  208. ***** ^ undeclared identifier
  209. ***** ^ not supported yet
  210. 93 Target := [fixbufseg:fixbufoff]^;
  211. ***** ^ not supported yet
  212. ***** ^ not supported yet
  213. 94 INC(fixbufoff,2);
  214. ***** ^ undeclared identifier
  215. ***** ^ not supported yet
  216. 95
  217. 96 base := Seg[ tmp DIV 16 ];
  218. ***** ^ undeclared identifier
  219. ***** ^ not supported yet
  220. 97 tmp := tmp MOD 16;
  221. 98 IF header.nefix <> 0 THEN
  222. ***** ^ not supported yet
  223. ***** ^ not supported yet
  224. 99 DEC(header.nefix);
  225. ***** ^ undeclared identifier
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. 100 IF base <> CARDINAL(-1) THEN
  229. ***** ^ not supported yet
  230. 101 [ Locseg+base : tmp ]^ := Target + s;
  231. ***** ^ not supported yet
  232. ***** ^ not supported yet
  233. 102 END;
  234. 103 ELSE
  235. 104 DEC(header.nifix);
  236. 105 IF base <> CARDINAL(-1) THEN
  237. 106 [ Locseg + s : tmp ]^ := Target + base;
  238. 107 END;
  239. 108 END;
  240. 109 DEC(fixbufcount,5);
  241. 110 UNTIL fixbufcount = 0;
  242. 111 END;
  243. 112
  244. 113 FIO.Close(f);
  245. 114
  246. 115 END Load;
  247. 116
  248. 117 PROCEDURE UnLoad( n:CARDINAL );
  249. 118 VAR a:ADDRESS;
  250. 119 BEGIN
  251. 120 IF (n<>0) AND ( Seg[n]<>MAX(CARDINAL) ) THEN
  252. 121 a := [Seg[n]:0];
  253. 122 Storage.HeapDeallocate( Storage.MainHeap, a, Size[n] );
  254. 123 Seg[n] := MAX(CARDINAL);
  255. 124 END ;
  256. 125 END UnLoad;
  257. 126
  258. 127 PROCEDURE (*$S-*) Init;
  259. 128 VAR i:CARDINAL;
  260. 129 BEGIN
  261. 130 FOR i := 0 TO 9 DO
  262. 131 Seg[i] := MAX(CARDINAL);
  263. 132 END;
  264. 133 Seg[0] := Lib.PSP+10H;
  265. 134 END Init;
  266. 135
  267. 136 BEGIN
  268. 137 Path := 'OMAIN' ; (* Base mame of overlay files *)
  269. 138 Init;
  270. 139 END Ovl117.
  271. 130 errors