datdel.3 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <DEFINE OFFSET (VAR) <- <* <VALUE .VAR> 2> 1>>
  2. <TITLE DATREMOVE>
  3. <DECLARE ("VALUE" <OR FIX FALSE> ASYLUM FIX)>
  4. <PUSH TP* (AB)>
  5. <AOBJN AB* HERE -1>
  6. <PUSHJ P* DATA1>
  7. <JRST FINIS>
  8. <INTERNAL-ENTRY DATA1 2>
  9. <SUBM M* (P)>
  10. <MOVE A* -2(TP)> ; "THE ASYLUM"
  11. <MOVE B* <OFFSET MFDPAGE> (A)>
  12. <LSH B* 10> ; "ADDRESS OF MFD PAGE"
  13. <PUSH P* B>
  14. <ADDI B* ALLOCLOCK>
  15. <PUSH TP* <TYPE-WORD WORD>>
  16. <PUSH TP* B>
  17. <MCALL 1 DHLOCK> ; "HARD LOCK THE ALLOCATOR"
  18. <GETYP B* A>
  19. <CAIN B* <TYPE-CODE FALSE>>
  20. <JRST ALLOSE> ; "SORRY. ALREADY LOCKED"
  21. <MOVE A* -2(TP)>
  22. <MOVE B* <OFFSET ALLOCPAGE> (A)>
  23. <LSH B* 10> ; "ADDRESS OF ALLOCATION PAGE"
  24. <MOVE C* (B)> ; "AOBJN TO TABLE"
  25. <TRZ C* *776000*> ; "FLUSH HIGH BITS"
  26. <ADD C* B>
  27. <SKIPL C>
  28. <ERRUUO* <MQUOTE ALLOCATOR-MUNGED>>
  29. <PUSH P* C> ; " ** SAVED TOP OF ALLOCATION TABLE **"
  30. <SETZ> ; "USE 0 FOR BEST FIT"
  31. <MOVE D* (TP)> ; "ENTRY TO FLUSH BEGINS HERE"
  32. ALLOOP <CAMN D* 1(C)> ; "RIGHT ENTRY?"
  33. <JRST TBLWN1>
  34. ALFROB <ADD C* [<2 (2)>]> ; "TRY NEXT ENTRY"
  35. <JUMPL C* ALLOOP>
  36. TBLOSE <SUB P* [<2 (2)>]>
  37. <MOVE A* <MQUOTE '("NOT FOUND")>>
  38. <JRST ALLOS2>
  39. ; "COME HERE IF THERE IS A WINNING ENTRY CLOSE ENOUGH TO THE CORRECT SIZE
  40. TO MAKE IT A WINNER. IT IS ALREADY LOCKED."
  41. TBLWN1 <MOVE O* 1(C)> ; "O HAS WINNING BLOCK POINTER"
  42. <MOVEI A* 1(C)>
  43. <POP P* D> ; " ** RESTORED TOP OF ALLOC TABLE **"
  44. <PUSHJ P* BBLT> ; "REMOVE THIS TABLE ENTRY"
  45. <MOVE A* -2(TP)>
  46. <MOVE A* <OFFSET ALLOCPAGE> (A)>
  47. <LSH A* 10>
  48. <MOVEM D* (A)>
  49. <JRST ALWIN> ; "AND WIN"
  50. BBLT <SUBM M* (P)>
  51. <MOVEI B* 2(D)>
  52. <SUBI A* -1(B)> ; "BLT TABLE UP TWO LOCATIONS"
  53. <MOVE E* A>
  54. <HRLZS A>
  55. <HRR A* D>
  56. <ADDI A* -1(E)>
  57. <MOVEI C* (B)>
  58. <SUBI C* (A)>
  59. <ADDI C* -1(E)>
  60. <HRLI C* A>
  61. <POP A* @ C>
  62. <TLNE A* *777777*>
  63. <JRST HERE -2>
  64. <ADD D* [<2 (2)>]> ; "REST THE TABLE 2"
  65. <JRST MPOPJ>
  66. ALWIN <POP P* B> ; " ** RESTORED ADDRESS OF MFD **"
  67. <ADDI B* ALLOCLOCK>
  68. <PUSH TP* <TYPE-WORD WORD>>
  69. <PUSH TP* B>
  70. <PUSH P* O> ; "ADDRESS FOR WRITE"
  71. <MCALL 1 DUNLOCK> ; "UNLOCK THE ALLOCATION TABLE"
  72. ALWIN1 <MOVE D* -2(TP)>
  73. <MOVE B* <OFFSET ALLOCPAGE> (D)>
  74. <MOVE A* <TYPE-WORD FIX>>
  75. <POP P* B> ; "RESTORE WINNING ADDRESS"
  76. <SUB TP* [<4 (4)>]> ; "TASTE AND WINNAGE"
  77. <JRST MPOPJ>
  78. ; "VARIOUS LOSSAGES"
  79. ALLOSE <SUB P* [<1 (1)>]>
  80. <MOVE B* <MQUOTE (6)>>
  81. <JRST ALLOS2>
  82. ALLOS2 <MOVE A* <TYPE-WORD FALSE>>
  83. <SUB TP* [<4 (4)>]>
  84. <JRST MPOPJ>
  85.