DataMuseum.dk

Presents historical artifacts from the history of:

RC4000/8000/9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC4000/8000/9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦4fc0be098⟧ TextFile

    Length: 213504 (0x34200)
    Types: TextFile
    Names: »mon8part2«

Derivation

└─⟦a8311e020⟧ Bits:30003039 RC 8000 Monitor Kildetekst
    └─⟦9ab0fc1ed⟧ 
        └─⟦this⟧ »mon8part2« 

TextFile

 5677  4862  
 5677  4862  
 5677  4862  \f


 5677  4862  ; segment 3: external processes
 5678  4862  
 5678  4862  s. k = k, h132
 5679  4862  w.b127=k, g70, k=k-2
 5680  4862  
 5680  4862  m.
 5680  4862                  driver proc save area - g,b names, reg dump (18, 16 hw)

 5681  4862  
 5681  4862  ; common driver central logic
 5682  4862  ; compatible with old conventions
 5683  4862  
 5683  4862  ; save area for std g-names, b-names
 5684  4862  b086: 0,r.5            ; g20, g21, g22, g23, g24
 5685  4872       0, r.3            ; b18, b19, work
 5686  4878       b085              ; b20 = address of wait-next action
 5687  4880  
 5687  4880  ; interrupt routine
 5688  4880  b087:0, r.a180>1       ; save area for registers
 5689  4896       al. w1     b086.  ;
 5690  4898       rl  w3  x1        ;    print the whole save area and the registers
 5691  4900       jd         1<11+34;
 5692  4902       al  w1  x1+2      ;
 5693  4904       se. w1     b087.+a180;
 5694  4906       jl.       -8      ;
 5695  4908       rl. w3     b087.+10;   w3 := old ic + 2;
 5696  4910       bz  w0  x3-2      ;
 5697  4912       jd         1<11+28;    print(instruction code incl regs);
 5698  4914       bl  w0  x3-1      ;
 5699  4916       jd         1<11+28;    print(address part);
 5700  4918       bl  w0  x3-2      ;
 5701  4920  h.   se  w0  ,  ks     ;    if instruction = <ks> then
 5702  4922  w.   jl.        b085.  ;
 5703  4924       dl. w1     b087.+2;      restore all registers
 5704  4926       dl. w3     b087.+6;
 5705  4928       xl.        b087.+9;
 5706  4930       jd.       (b087.+10;     and return disabled;
 5707  4932                         ;    else goto wait next;
 5708  4932  
 5708  4932  b. e10, r5 w.
 5709  4932  b. i0 w.
 5710  4932  
 5710  4932  r5:  am         5-3    ; result 5:
 5711  4934  r3:  am         3-2    ; result 3:
 5712  4936  r2:  am         2-1    ; result 2:
 5713  4938  r1:  am         1-0    ; result 1:
 5714  4940  r0:  al  w0     0      ; result 0: finis the call:
 5715  4942  e0:                    ; finis with prepared result:
 5716  4942  
 5716  4942  ; entry: w0=result
 5717  4942       al. w1     0      ;    answer area := dummy;
 5718  4944  e1:  rl. w2     i0.    ;    mess buff addr := saved mess buf;
 5719  4946       jd         1<11+22;    send answer;
 5720  4948  
 5720  4948  b085:al  w2     0      ; wait next:
 5721  4950       jd         1<11+24;    wait event;
 5722  4952  b088:am        (0)     ;    result: 0=message, 1=answer,
 5723  4954       jl.       +2      ;            2=interrupt, 4=immediate message
 5724  4956       jl.        e2.    ;+2: message or answer:
 5725  4958       jd      x2        ;+4: interrupt: goto service address;
 5726  4960                         ;+6: immediate message:
 5727  4960  ; immediate message is a call of
 5728  4960  ;   initialize process
 5729  4960  ;   reserve process
 5730  4960  ;   release process
 5731  4960       rs. w2     i0.    ;    save(buf);
 5732  4962       rl  w0  x2+8      ;    switch := operation(buf);
 5733  4964       rl  w1  x2+6      ;    internal := sender(buf);
 5734  4966       sh  w1     0      ;    if sender <= 0 then
 5735  4968       jl.        e0.    ;      goto finis, undef result; (call is regretted)
 5736  4970  
 5736  4970       ac  w2 (x2+4)     ;    proc := -receiver(buf);
 5737  4972       al  w2  x2-1      ;    (i.e. positive, even)
 5738  4974  
 5738  4974       am        (0)     ;
 5739  4976       jl.      (+2)     ;    goto case switch of:
 5740  4978           e5            ; switch=0: initialize process
 5741  4980           e6            ; switch=2: reserve process
 5742  4982           r0            ; switch=4: release process ( finis the call )
 5743  4984  
 5743  4984  i0:  0                 ; saved message buffer address
 5744  4986  
 5744  4986  ; message or answer:
 5745  4986  ; entry: w0=result from wait event, w2=buf
 5746  4986  e2:  rl  w1  x2+6      ;    sender := sender(buf);
 5747  4988       jd         1<11+26;    get event(buf); (buffer contents is irrell if answer)
 5748  4990       se  w0     1      ;    if result from wait event = 0 then
 5749  4992       jl.        e3.    ;      goto message;
 5750  4994  
 5750  4994  ; answer:
 5751  4994  ; entry: w0=1, w1=sender
 5752  4994  ; skip the answer, unless message originated from a terminal
 5753  4994       sl  w0 (x1+a10)   ;    if kind(sender) = 0 then
 5754  4996       jl.        b085.  ;      goto wait next; (maybe testoutput message...)
 5755  4998  
 5755  4998       bz  w3  x1+a71+1  ;
 5756  5000       al  w3  x3+1      ;    increase(attention buffer claim(terminal));
 5757  5002       hs  w3  x1+a71+1  ;
 5758  5004       jl.        b085.  ;    goto wait next;
 5759  5006  
 5759  5006  ; message:
 5760  5006  ; entry: w1=sender, w2=buf
 5761  5006  e3:  rl  w3     b1     ;    w3 := cur;
 5762  5008       bz  w0  x3+a19    ;    increase (bufclaim(cur));
 5763  5010       ba. w0     1      ;
 5764  5012       hs  w0  x3+a19    ;    i.e. unclaim the buffer again...
 5765  5014       ac  w3 (x2+4)     ;    proc := -receiver(buf); (positive)
 5766  5016       rs  w3  x2+4      ;    receiver(buf) := proc  (i.e. positive);
 5767  5018       ds  w3     b19    ;    save(buf,proc) in std locations;
 5768  5020  
 5768  5020  ; before exit to the different drivers, the registers contain:
 5769  5020  ;  w0=undef, w1=sender, w2=buf, w3=proc
 5770  5020  
 5770  5020       am     (x3+a10)   ;
 5771  5022       jd.      (+2)     ;    goto case kind(proc) of:
 5772  5024       h3                ;  (0: internal process
 5773  5026       h4                ;   2: interval clock
 5774  5028       h5                ;   4: backing store area
 5775  5030       g2                ;   6:
 5776  5032       g2                ;   8:
 5777  5034       g2                ;  10:
 5778  5036       g2                ;  12:
 5779  5038       g2                ;  14:
 5780  5040       g2                ;  16:
 5781  5042       g2                ;  18:
 5782  5044       g2                ;  20:
 5783  5046       g2                ;  22:
 5784  5048       g2                ;  24:
 5785  5050       g2                ;  26:
 5786  5052       g2                ;  28:
 5787  5054       g2                ;  30:
 5788  5056       g2                ;  32:
 5789  5058       g2                ;  34:
 5790  5060       g2                ;  36:
 5791  5062       g2                ;  38:
 5792  5064       g2                ;  40:
 5793  5066       g2                ;  42:
 5794  5068       g2                ;  44:
 5795  5070       g2                ;  46:
 5796  5072       g2                ;  48:
 5797  5074       g2                ;  50:
 5798  5076       g2                ;  52:
 5799  5078       h7                ;  54: errorlog process
 5800  5080       h22               ;  56: remoter process
 5801  5082       g2                ;  58:
 5802  5084       g2                ;  60:
 5803  5086       h6                ;  62: disc (logical- and physical disc)
 5804  5088       h3                ;  64: pseudo process
 5805  5090       g2                ;  66:
 5806  5092       g2                ;  68:
 5807  5094       g2                ;  70:
 5808  5096       h72               ;  72: rc8602 (sscir)
 5809  5098       h74               ;  74: rc8602 (isrpy)
 5810  5100       h76               ;  76: rc8601 (sscir)
 5811  5102       h78               ;  78: rc8601 (isrpy)
 5812  5104       h80               ;  80: mainproc(fpa)
 5813  5106       g2                ;  82: hostproc(fpa)
 5814  5108       h84               ;  84: subproc(fpa)
 5815  5110       g2                ;  86: receiver(fpa)
 5816  5112       g2                ;  88: transmitter(fpa)
 5817  5114       h90               ;  90: host);
 5818  5116  
 5818  5116  h3=g6                  ; internal process, pseudo process
 5819  5116  g2=g3                  ; not defined
 5820  5116  
 5820  5116  e.                     ; end common part of central logic
 5821  5116  
 5821  5116  ; initialize and reserve process:
 5822  5116  ; entry conditions: w0 = switch, w1 = internal, w2 = proc
 5823  5116  
 5823  5116  b. i51 w.
 5824  5116  e5:                    ; initialize process:  switch = 0
 5825  5116  e6:  rs. w0     i9.    ; reserve process:     switch = 2
 5826  5118       am     (x2+a10)   ;
 5827  5120       jl.    (2)        ;    goto case kind(proc) of:
 5828  5122       i30               ;  (0: internal process,
 5829  5124       i31               ;   2: interval clock,
 5830  5126       i11               ;   4: backing store area,
 5831  5128       r3                ;   6:
 5832  5130       r3                ;   8:
 5833  5132       r3                ;  10:
 5834  5134       r3                ;  12:
 5835  5136       r3                ;  14:
 5836  5138       r3                ;  16:
 5837  5140       r3                ;  18:
 5838  5142       r3                ;  20:
 5839  5144       r3                ;  22:
 5840  5146       r3                ;  24:
 5841  5148       r3                ;  26:
 5842  5150       r3                ;  28:
 5843  5152       r3                ;  30:
 5844  5154       r3                ;  32:
 5845  5156       r3                ;  34:
 5846  5158       r3                ;  36:
 5847  5160       r3                ;  38:
 5848  5162       r3                ;  40:
 5849  5164       r3                ;  42:
 5850  5166       r3                ;  44:
 5851  5168       r3                ;  46:
 5852  5170       r3                ;  48:
 5853  5172       r3                ;  50:
 5854  5174       r3                ;  52:
 5855  5176       r3                ;  54:
 5856  5178       i34               ;  56: remoter process
 5857  5180       r3                ;  58:
 5858  5182       r3                ;  60:
 5859  5184       i17               ;  62: disc (logical- and physical discs)
 5860  5186       i30               ;  64: pseudo processes
 5861  5188       r3                ;  66:
 5862  5190       r3                ;  68:
 5863  5192       r3                ;  70:
 5864  5194       i51               ;  72: rc8602 (sscir) (reservation not allowed )
 5865  5196       r3               ;  74: rc8602 (isrpy) (does not exist)
 5866  5198       i48               ;  76: rc8601 (sscir)
 5867  5200       i48               ;  78: rc8601 (isrpy)
 5868  5202       i36               ;  80: mainproc(fpa)
 5869  5204       i37               ;  82: hostproc(fpa)
 5870  5206       i38               ;  84: subproc(fpa)
 5871  5208       i39               ;  86: receiver(fpa)
 5872  5210       i40               ;  88: transmitter(fpa)
 5873  5212       i41               ;  90: host);
 5874  5214  
 5874  5214  i9:  0                 ; saved switch
 5875  5216  
 5875  5216  i11:                   ; backing store area:
 5876  5216       jl  w3     d102   ;    check user(internal, proc);
 5877  5218       jl.        r3.    ;+2   not user: goto result 3;
 5878  5220       jl  w3     d113   ;    check any reserver(internal, proc);
 5879  5222       jl.        r1.    ;+2   other reserver: goto result 1;
 5880  5224       jl.        r0.    ;+4   internal is reserver: goto result 0;
 5881  5226       rl. w0     i9.    ;
 5882  5228       sn  w0     0      ;    if initialize then
 5883  5230       jl.        r0.    ;      goto result 0;
 5884  5232       dl  w0  x2+a49    ;    w3w0 := interval(proc);
 5885  5234       al  w3  x3+1      ;
 5886  5236       sh  w0 (x1+a44)   ;    if upper(proc) > upper(max(internal)) or
 5887  5238       sh  w3 (x1+a44-2) ;       lower(proc) < lower(max(internal)) then
 5888  5240       jl.        r2.    ;      goto result 2;
 5889  5242       jl.        r0.    ;    goto include reserver;
 5890  5244  
 5890  5244  i36:                   ; mainproc(fpa):
 5891  5244       jl  w3     d102   ;    check user(internal, proc);
 5892  5246       jl.        r2.    ;+2   not user: goto result 2;
 5893  5248       rl. w0     i9.    ; if initialize then
 5894  5250       sn  w0      0     ; return 
 5895  5252       jl.        r0.    ; else
 5896  5254       jl  w3     d113   ;    check any reserver(internal, proc);
 5897  5256       jl.        r1.    ;+2   other reserver: goto result 1;
 5898  5258       jl.        r0.    ;+4   internal is reserver: goto result 0;
 5899  5260                         ;+6
 5900  5260       rl  w3     b3     ;
 5901  5262  i50: al  w3  x3+2      ;   for dev:=0 step 1 until found do
 5902  5264       se  w2  (x3)      ;     if proc(dev)=proc then found;
 5903  5266       jl.        i50.   ;
 5904  5268       rs. w3     i46.   ;
 5905  5270       rl  w2  x3+2      ;   rec:=proc(dev+1);
 5906  5272       jl  w3     d113   ;    check any reserver(internal, rec);
 5907  5274       jl.        r1.    ;+2    other reserver:  goto result 1;
 5908  5276       am         0      ;+4    internal is already reserver:
 5909  5278       rl. w3     i46.   ;
 5910  5280       rl  w2  x3+4      ;   trm:=proc(dev+2);
 5911  5282       jl  w3     d113   ;   check any reserver(internal,trm);
 5912  5284       jl.        r1.    ;   if other reserver then goto result 1;
 5913  5286       am         0      ;   if already res. then goto result 0;
 5914  5288       jl.        i49.   ;   goto set result;
 5915  5290  
 5915  5290  i39:                   ; receiver(fpa):
 5916  5290  i40:                   ; transmitter(fpa):
 5917  5290       jl  w3     d102   ;    check user(internal, proc);
 5918  5292       jl.        r2.    ;+2   not user: goto result 2;
 5919  5294       rl. w0     i9.    ; if initialize then
 5920  5296       sn  w0      0     ; return
 5921  5298       jl.        r0.    ; else
 5922  5300       jl  w3     d113   ;    check any reserver(internal, proc);
 5923  5302       jl.        r1.    ;+2   other reserver: goto result 1;
 5924  5304       jl.        r0.    ;+4   internal is reserver: goto result 0;
 5925  5306                         ;+6
 5926  5306       rl  w2  x2+a50    ;   main:=main(proc);
 5927  5308       jl  w3     d113   ;    check any reserver(internal, main);
 5928  5310       jl.        r1.    ;+2    other reserver:  goto result 1;
 5929  5312       am         0      ;+4    internal is already reserver:
 5930  5314       jl.        i49.   ;   goto setresult;
 5931  5316  
 5931  5316  i29:                   ; reserve:
 5932  5316       jl  w3     d113   ;    check any reserver(internal, proc);
 5933  5318       jl.        r1.    ;+2   other reserver: goto result 1;
 5934  5320       jl.        r0.    ;+4   internal is reserver: goto result 0;
 5935  5322                         ;+6
 5936  5322  i49: al  w0     0      ; setresult:  result := 0;
 5937  5324       al. w1     1      ;    w1 := odd, i.e. transform initialize to reserve;
 5938  5326       jl.        e1.    ;    goto include reserver;
 5939  5328  
 5939  5328  i38:                   ; subproc(scc):
 5940  5328       jl  w3     d102   ;    check user(internal, proc);
 5941  5330       jl.        r2.    ;+2    not user:  goto result 2;
 5942  5332       jl  w3     d113   ;    check any reserver(internal, proc);
 5943  5334       jl.        r1.    ;+2    other reserver:  goto result 1;
 5944  5336       am                ;+4    internal is already reserver:
 5945  5338       al  w3     1      ;    external state(proc) := initialized;
 5946  5340       hs  w3  x2+a56+1  ;
 5947  5342       rl. w0     i9.    ;
 5948  5344       bl  w3  x2+a63    ;    if subkind(proc) <> typewriter
 5949  5346       sn  w0     0      ;      or reserve process then
 5950  5348       se  w3     8      ;
 5951  5350       am         1      ;      make w1 odd;  i.e. indicate reserve...
 5952  5352       al. w1     0;here ;    else w1 = even;
 5953  5354       al  w0     0      ;    result := 0;
 5954  5356       jl.        e1.    ;    goto include reserver;
 5955  5358  
 5955  5358  i17:                   ; disc driver:
 5956  5358       jl  w3     d102   ;   check user(internal,proc);
 5957  5360       jl.        r2.    ;   if not user then goto result 2;
 5958  5362       rl. w0     i9.    ; if initialize then
 5959  5364       sn  w0      0     ; return else
 5960  5366       jl.        r0.    ;
 5961  5368       jl  w3     d113   ;   check any reserver(internal,proc);
 5962  5370       jl.        r1.    ;   if other reserver then goto result 1;
 5963  5372       jl.        r0.    ;   if already res. then goto result 0;
 5964  5374       rl  w0  x2+a50    ;     main:= mainproc.proc;
 5965  5376       sn  w0     0      ;     if main <> 0 then
 5966  5378       jl.        i42.   ;     begin c. logical driver;
 5967  5380       rl  w2      0     ;
 5968  5382       jl  w3     d113   ;       check any reserver(internal,main);
 5969  5384       jl.        r1.    ;       if other res. then goto result 1;
 5970  5386       jl.        r0.    ;       if already res. then goto result 0;
 5971  5388       jl.        i49.   ;     end else
 5972  5390  i42: rs. w2     i46.   ;     begin c. physical driver;
 5973  5392       rl  w2     b4     ;       i:= addr of 1st device in nametab;
 5974  5394  i43: rs. w2     i47.   ;       repeat
 5975  5396       rl  w2  x2+0      ;         proc:= nametable(i);
 5976  5398       rl  w3  x2+a10    ;
 5977  5400       rl  w0  x2+a50    ;
 5978  5402       sn  w3     62     ;         if kind.proc = 62
 5979  5404       se. w0    (i46.)  ;         and mainproc.proc = main then
 5980  5406       jl.        i44.   ;         begin c. logical driver;
 5981  5408       jl  w3     d113   ;           check any res.(internal,proc);
 5982  5410       jl.        r1.    ;           if other then goto result 1;
 5983  5412       jl.        i44.   ;         end;
 5984  5414  i44: am.       (i47.)  ;
 5985  5416       al  w2     2      ;         i:= i + 2
 5986  5418       se  w2    (b5)    ;       until i = 1st area in nametable;
 5987  5420       jl.        i43.   ;     end;
 5988  5422       jl.        i49.   ; end;
 5989  5424                         ;
 5990  5424  i46: 0                 ; saved mainproc
 5991  5426  i47: 0                 ; saved nametable address
 5992  5428  
 5992  5428  i48:                   ; rc8601:
 5993  5428       jl  w3  d102      ;  check user(internal, proc);
 5994  5430       jl.     r2.       ;     not user: goto result2;
 5995  5432       jl  w3  d113      ;   check any reserver(internal, proc);
 5996  5434       jl.     r1.       ;     other reserver: goto result1;
 5997  5436       am                ;     allready reserver:
 5998  5438       jl.     i49.      ;   goto deliver answer;
 5999  5440  
 5999  5440  i30 = e0               ; internal process
 6000  5440                         ; pseudo process
 6001  5440  
 6001  5440  i31 = e0               ; interval clock
 6002  5440  i34 = e0               ; remoter process
 6003  5440  i37 = e0               ; subhost process
 6004  5440  i41 = e0               ; host process
 6005  5440  i51=e0           ; rc8602
 6006  5440  
 6006  5440  e.                     ; end of initialize/reserve process
 6007  5440  e.                     ; end of driver central logic
 6008  5440  
 6008  5440  \f


 6008  5440  ; pej 23.01.78    clock driver
 6009  5440  
 6009  5440  ; -----------------------------------------------------------------
 6010  5440  
 6010  5440  ;              c l o c k   d r i v e r   c o d e
 6011  5440  
 6011  5440  ; -----------------------------------------------------------------
 6012  5440  
 6012  5440  ; this section contains the code executed by driverproc for
 6013  5440  ; processing messages to the clockdriver and for executing other
 6014  5440  ; actions related to the real time clock.
 6015  5440  ;
 6016  5440  ; messages have the following format:
 6017  5440  ;
 6018  5440  ; delay                  0<12+mode
 6019  5440  ;                        seconds   or   interval(0:23)
 6020  5440  ;                                       interval(24:47)
 6021  5440  ;
 6022  5440  ; wait for clockchange   2<12+mode
 6023  5440  ;                        seconds   or   interval(0:23)
 6024  5440  ;                                       interval(24:47)
 6025  5440  ;
 6026  5440  ; wait for power restart 4<12+mode
 6027  5440  ;                        seconds   or   interval(0:23)
 6028  5440  ;                                       interval(24:47)
 6029  5440  ;
 6030  5440  ; a maximum delay is specified by seconds or interval equal to -1.
 6031  5440  ;
 6032  5440  ; mode consists of a sum of one or more of following values:
 6033  5440  ;
 6034  5440  ;   2   time interval in 0.1 msecs. if not used then seconds.
 6035  5440  ;   4   real time delay, i.e. the message is returned when the
 6036  5440  ;       clock reaches the value:
 6037  5440  ;         curr value of real time clock + delay
 6038  5440  ;       if not used, an effective delay is specified, i.e. the
 6039  5440  ;       message will be returned when it has been in the event
 6040  5440  ;       queue as long as specified.
 6041  5440  ;
 6042  5440  ; the answer has the following format:
 6043  5440  ;   statusword, bit0 = intervention (see below)
 6044  5440  ;   0
 6045  5440  ;   0
 6046  5440  ;
 6047  5440  ; messages received are linked to the clock process in ascending
 6048  5440  ; order with respect to calculated time for expiration of delay.
 6049  5440  ; at each clock interrupt the queue is scanned and messages which
 6050  5440  ; have reached the expiration time are returned. also at each
 6051  5440  ; clock interrupt the timeout queue of devices is scanned.
 6052  5440  ; timers which have run out cause the clock to reset the device
 6053  5440  ; with timeout status.
 6054  5440  ;
 6055  5440  ; after power restart all devices are reset with power restart
 6056  5440  ; result and messages waiting for power restart are returned with
 6057  5440  ; status intervention.
 6058  5440  ;
 6059  5440  ; after a change of clock (monitor procedure set clock) messages
 6060  5440  ; waiting for clockchange are returned with status intervention.
 6061  5440  ; the same is performed at mode 4-messages if the new clockvalue
 6062  5440  ; exceeds the calculated expiration time. messages not using mode
 6063  5440  ; 4 will have the expected expiration time adjusted according to
 6064  5440  ; the clockchange and the entire message queue is resorted.
 6065  5440  
 6065  5440  
 6065  5440  
 6065  5440  m.
 6065  5440                  monclock (monitor interval clock driver)

 6066  5440  
 6066  5440  
 6066  5440  b. i10, j60, a0=1<23, w. ; block including clock driver
 6067  5440  \f


 6067  5440  ; pej 23.01.78    clock driver
 6068  5440  
 6068  5440  ; m e s s a g e   r e c e i v e d
 6069  5440  ; ---------------------------------------------------------------
 6070  5440  ;
 6071  5440  ; this routine is entered when driverproc receives a message for
 6072  5440  ; the clock. the message is checked and time (clockvalue) for
 6073  5440  ; expiration of delay is inserted into the buffer.
 6074  5440  h4  : dl. w1     i0.    ;   c. w2 = curr buf;
 6075  5442        jl  w3     g16    ;   check operation(mode mask,oper mask);
 6076  5444        rs. w2     i8.    ; save received buffer
 6077  5446        rl  w1     b19    ; check for clockchange c.w1=cur receiver
 6078  5448        jl. w3     j24.   ; 
 6079  5450        rl. w2     i8.    ; restore buffer
 6080  5452        dl  w0  x2+a152   ;   delay:= interval(0:47).curr buf;
 6081  5454        bz  w1  x2+a150+1 ;
 6082  5456        sz  w1     2.10   ;   if time in secs.mode.curr buf then
 6083  5458        jl.        j10.   ;   begin
 6084  5460        al  w0  x3+0      ;     seconds:= delay(0:23);
 6085  5462        sn  w0    -1      ;     if seconds = -1 then goto maxdelay
 6086  5464        jl.        j14.   ;     else delay:= seconds * 10000;
 6087  5466        wm. w0     i1.    ;   end;
 6088  5468  j10 : sl  w3     0      ;   if delay >= 0
 6089  5470        sl  w3     52     ;   and delay <= 872415231 then
 6090  5472        jl.        j12.   ;   begin c. 24 hrs + 841.5231 secs;
 6091  5474        sn  w0     0      ;     if delay = 0 then
 6092  5476        se  w3     0      ;     begin
 6093  5478        jl.        j16.   ;       bytes:= chars:= 0; goto result 1;
 6094  5480        ds  w3     g22    ;     end;
 6095  5482        jl         g7     ;   end
 6096  5484  j12 : sn  w3    -1      ;   else
 6097  5486        se  w3    -1      ;   if delay <> -1
 6098  5488        jl         g5     ;   then goto result 3
 6099  5490  j14 : dl. w0     i2.    ;   else
 6100  5492        ss  w0     b13+2  ; maxdelay: delay:= max clock val - time;
 6101  5494  j16 : aa  w0     b13+2  ;
 6102  5496        ds  w0  x2+a152   ;   time.curr buf:= delay + time;
 6103  5498  
 6103  5498  ; insert the messagebuffer in eventqueue of the driver (the event
 6104  5498  ; queue is sorted after delay expiration time) and continue at
 6105  5498  ; waitnext in driverproc. please note that the messagebuffer is
 6106  5498  ; not claimed.
 6107  5498        rl  w3     b20    ;
 6108  5500        jl.        j50.   ;   insert buf(curr buf);
 6109  5502  \f


 6109  5502  ; pej 23.01.78    clock driver
 6110  5502  
 6110  5502  ; i n t e r r u p t   r e c e i v e d
 6111  5502  ; ---------------------------------------------------------------
 6112  5502  ;
 6113  5502  ; this routine is entered when driverproc receives an interrupt
 6114  5502  ; operation for the clock.
 6115  5502  ;
 6116  5502  ; if a power restart has been executed, all devices are reset
 6117  5502  ; and messages queued to wait for power restart returned.
 6118  5502  c35 : al  w0     0      ;   c. w1 = curr receiver;
 6119  5504        al. w3     j38.   ; set continue adr
 6120  5506        rx  w0     b75    ;   p:= after power; after power:= 0;
 6121  5508        sn  w0     0      ;   if p <> 0 then
 6122  5510        jl.        j24.   ;   begin
 6123  5512        rl  w2     b67    ;     entry:= 1st controller tab entry;
 6124  5514  j18 : rl  w3  x2+a311   ;     repeat
 6125  5516        rl  w1  x3+a235-a230;     device:=
 6126  5518        al  w0     0      ;       deviceaddr.proc.entry;
 6127  5520        jd         1<11+2 ;       reset device(device,power);
 6128  5522        al  w2  x2+a314   ;       entry:= entry + entry length
 6129  5524        se  w2    (b68)   ;     until entry = top entry;
 6130  5526        jl.        j18.   ;
 6131  5528        rl  w1     b19    ;     buf:=
 6132  5530        al  w2  x1+a54    ;     addr of mess q head.curr receiver;
 6133  5532  j20 : rl  w2  x2+a140   ; rep: buf:= next.buf;
 6134  5534  j22 : al. w3     j38.   ; prepare continue adr
 6135  5536        sn  w2  x1+a54    ; rep1: if buf<>addr mqhead.curr rec then
 6136  5538        jl.        j24.   ;     begin
 6137  5540        bz  w0  x2+a150   ;       if operation.buf <> 4
 6138  5542        se  w0     4      ;       then goto rep;
 6139  5544        jl.        j20.   ;       deliver intervention(buf);
 6140  5546        al. w3     j22.   ;       goto rep1;
 6141  5548        jl.        j51.   ;     end;
 6142  5550                          ;   end;
 6143  5550  \f


 6143  5550  ; pej 23.01.78    clock driver
 6144  5550  
 6144  5550  ; if the clock has been changed some messages may be returned
 6145  5550  ; (those waiting for clockchange and those waiting in real time
 6146  5550  ; delay). expiration time in messages waiting in effective time
 6147  5550  ; delay is adjusted and the message queue is resorted.
 6148  5550  ; called when a message or an interrupt is received
 6149  5550  ; called with w1=cur receiver  and w3 holding the return adr
 6150  5550  j24 : rl  w0     b15    ;   c. w1 = curr receiver;
 6151  5552        lo  w0     b15+2  ;
 6152  5554        sn  w0     0      ;   if clockchange <> 0 then
 6153  5556        jl         x3     ;   begin
 6154  5558        rs. w3     i9.    ; save return adr
 6155  5560        al  w2  x1+a54    ;
 6156  5562        sn  w2 (x1+a54)   ;     if mess q.curr rec -,empty then
 6157  5564        jl.        j36.   ;     begin
 6158  5566        dl  w0  x1+a55    ;       help q head:=
 6159  5568        ds. w0     i4.    ;       mess q head.curr receiver;
 6160  5570        rs  w2  x1+a54    ;
 6161  5572        rs  w2  x1+a55    ;       mess q head.curr receiver:= empty;
 6162  5574        al. w0     i3.    ;       next.last.help q head:=
 6163  5576        rs. w0    (i4.)   ;       addr of help q head;
 6164  5578        rl. w2     i3.    ;       buf:= next.help q head;
 6165  5580        rs  w0  x2+2      ;       last.buf:= addr of help q head;
 6166  5582  j26 : sn. w2    (i5.)   ; rep:  if buf <> addr of help q head then
 6167  5584        jl.        j36.   ;       begin
 6168  5586        bz  w0  x2+a150   ;
 6169  5588        se  w0     2      ;         if operation.buf = 2 then
 6170  5590        jl.        j30.   ;         begin
 6171  5592  j28 : jl. w3     j51.   ; send:     deliver intervention(buf);
 6172  5594        jl.        j26.   ;           goto rep;
 6173  5596  j30 : dl  w0  x2+a152   ;         end;
 6174  5598        bz  w1  x2+a150+1 ;
 6175  5600        so  w1     2.100  ;         if real time.mode.buf then
 6176  5602        jl.        j32.   ;         begin
 6177  5604        ss  w0     b13+2  ;           if time > time.buf
 6178  5606        sx         2.1    ;           then goto send;
 6179  5608        jl.        j34.   ;         end
 6180  5610        jl.        j28.   ;         else
 6181  5612  j32 : sn. w3    (i7.)   ;
 6182  5614        se. w0    (i2.)   ;         if time.buf <> max clock val
 6183  5616        aa  w0     b15+2  ;         then time.buf:= time.buf
 6184  5618        ds  w0  x2+a152   ;                         + clockchange;
 6185  5620  j34 : rl  w0  x2+0      ;         next:= next.buf;
 6186  5622        rs. w0     i6.    ;
 6187  5624        jl  w3     d5     ;         remove(buf); c. from help q;
 6188  5626        jl. w3     j50.   ;         insert buf(buf);
 6189  5628        rl. w2     i6.    ;         buf:= next;
 6190  5630        jl.        j26.   ;         goto rep;
 6191  5632                          ;       end;
 6192  5632  j36 : ld  w0    -100    ;     end;
 6193  5634        ds  w0     b15+2  ;     clockchange:= 0;
 6194  5636        rl  w1     b19    ;   end;
 6195  5638        jl.      (i9.)    ;
 6196  5640  \f


 6196  5640  \f


 6196  5640  ; pej 23.01.78    clock driver
 6197  5640  
 6197  5640  ; scan the message queue and return buffers with delays expired.
 6198  5640  j38 : rl  w2  x1+a54    ;   c. w1 = curr receiver;
 6199  5642        sn  w2  x1+a54    ; rep: buf:= next.mess q head.curr rec;
 6200  5644        jl.        j40.   ;   if buf = addr of mess q head.curr rec
 6201  5646        dl  w0  x2+a152   ;   then goto check timeouts;
 6202  5648        ss  w0     b13+2  ;
 6203  5650        sx         2.1    ;   if time < time.buf
 6204  5652        jl.        j40.   ;   then goto check timeouts;
 6205  5654        rs  w2     b18    ;   curr buf:= buf;
 6206  5656        al. w3     j38.   ;   no operation; c. result 1, status 0;
 6207  5658        jl         g26    ;   goto rep;
 6208  5660  
 6208  5660  ; scan the timeout queue of devices and reset with timeout result
 6209  5660  ; for timers which have run out. return to waitnext in driverproc.
 6210  5660  j40 : dl  w2     b13+2  ; check timeouts:
 6211  5662        dl  w0     b70+2  ;   timeused:= time - last inspected;
 6212  5664        ds  w2     b70+2  ;   last inspected:= time;
 6213  5666        ss  w2     0      ;   if timeused >= 1<24
 6214  5668        se  w1     0      ;   then timeused:= maximum;
 6215  5670        al  w2    -1      ;   c. timeused is unsigned integer;
 6216  5672        al  w3     b69    ;   dev:= addr of timeout q head;
 6217  5674  j42 : rl  w3  x3+0      ; rep: dev:= next.dev;
 6218  5676  j44 : sn  w3     b69    ; rep1: if dev = addr of timeout q head
 6219  5678        je        (b20)   ;   then goto waitnext; c. in driverproc;
 6220  5680        rl  w0  x3-a242+a244;
 6221  5682        ws  w0     4      ;   timer.dev:=
 6222  5684        rs  w0  x3-a242+a244; timer.dev - timeused;
 6223  5686        sx         2.1    ;   if timer.dev was > timeused
 6224  5688        jl.        j42.   ;   then goto rep; c. unsigned comparison;
 6225  5690        rl  w1  x3-a242+a235; device:= deviceaddr.timeout op;
 6226  5692        rl  w3  x3+0      ;   dev:= next.dev;
 6227  5694        al  w0     1      ;
 6228  5696        jd         1<11+2 ;   reset device(device,timeout);
 6229  5698        jd.        j44.   ;   goto rep1;
 6230  5700  
 6230  5700  ; variables
 6231  5700        a0>0+a0>2+a0>4    ; operation and mode masks
 6232  5702  i0  : a0>0+a0>2+a0>4+a0>6
 6233  5704  i1  : 10000             ; constant 10000
 6234  5706  i7  : 8.37777777        ; max clock value (doubleword)
 6235  5708  i2  : 8.77777777        ; 
 6236  5710  i3  : 0                 ; doubleword used for help q head
 6237  5712  i4  : 0                 ;
 6238  5714  i5  : i3                ; addr of help q head
 6239  5716  i6  : 0                 ; work, saved buf in loop
 6240  5718  i8  : 0                 ; saved buffer from message received
 6241  5720  i9  : 0                 ; return adr for j24
 6242  5722  \f


 6242  5722  ; pej 23.01.78    clock driver
 6243  5722  
 6243  5722  ; procedure insert buf(buf);
 6244  5722  ; ---------------------------------------------------------------
 6245  5722  ; inserts a messagebuffer in the eventqueue in front of a buffer
 6246  5722  ; with higher delay expiration time.
 6247  5722  ;
 6248  5722  ; registers: call              exit
 6249  5722  ; w0                           destroyed
 6250  5722  ; w1                           destroyed
 6251  5722  ; w2         buf               unchanged
 6252  5722  ; w3         link              destroyed
 6253  5722  ;
 6254  5722  ; entry: j50; return: link+0
 6255  5722  b. i3 w.
 6256  5722  j50 : rl  w1     b19    ; insert buf:
 6257  5724        al  w1  x1+a54    ;   elem:= endq:=
 6258  5726        rs. w1     i0.    ;   addr of mess q head.curr receiver;
 6259  5728        rs. w3     i1.    ;
 6260  5730  i2  : rl  w1  x1+0      ; rep: elem:= next.elem;
 6261  5732        sn. w1    (i0.)   ;   if elem <> endq
 6262  5734        jl.        i3.    ;
 6263  5736        dl  w0  x2+a152   ;
 6264  5738        ss  w0  x1+a152   ;
 6265  5740        sx         2.1    ;   and time.buf <= time.elem
 6266  5742        jl.        i2.    ;   then goto rep;
 6267  5744  i3  : rl. w3     i1.    ;
 6268  5746        jl         d6     ;   link(elem,buf); c. return from there;
 6269  5748  
 6269  5748  
 6269  5748  
 6269  5748  ; procedure deliver intervention(buf)
 6270  5748  ; ---------------------------------------------------------------
 6271  5748  ; the procedure answers buf with status intervention and returns
 6272  5748  ; with the value of next.buf at calltime.
 6273  5748  ;
 6274  5748  ; registers: call              exit
 6275  5748  ; w0                           destroyed
 6276  5748  ; w1                           curr receiver
 6277  5748  ; w2         buf               next.buf
 6278  5748  ; w3         link              destroyed
 6279  5748  ;
 6280  5748  ; entry: j51; return: link+0
 6281  5748  j51 : rs. w3     i1.    ; deliver intervention:
 6282  5750        rs  w2     b18    ;   curr buf:= buf;
 6283  5752        rl  w0  x2+0      ;
 6284  5754        rs. w0     i0.    ;   save next.buf;
 6285  5756        rl  w0     g49    ;
 6286  5758        rs  w0     g20    ;   status.i/o answer:= bit 0;
 6287  5760        al  w0     1      ;   result:= 1;
 6288  5762        al  w1     0      ;   bytes:= characters:= 0;
 6289  5764        jl  w3     g28    ;   no operation;
 6290  5766        rl. w2     i0.    ;   w2:= saved next.buf;
 6291  5768        jl.       (i1.)   ;   return;
 6292  5770  
 6292  5770  ; variables
 6293  5770  i0  : 0                 ; for saving next.buf or endq
 6294  5772  i1  : 0                 ; saved link
 6295  5774  e.
 6296  5774  
 6296  5774  e.                      ; end of block containing clock driver
 6297  5774  \f


 6297  5774  
 6297  5774  
 6297  5774  ; remoter process.
 6298  5774  ; jr 79.02.28
 6299  5774  
 6299  5774  m.
 6299  5774                  remoter

 6300  5774  
 6300  5774  b.i4,j4 w.
 6301  5774  
 6301  5774  h22: al  w1  x3+a54    ; remoter:
 6302  5776       jl  w3  d6        ;   link event(event queue(proc), buf);
 6303  5778       rl  w1  b3        ;
 6304  5780  j0:  al  w1  x1+2      ;   for dev:=first dev in name table until last do
 6305  5782       sl  w1 (b5)       ;    begin
 6306  5784       jl     (b20)      ;
 6307  5786       rl  w3  x1        ;     proc:=proc(dev);
 6308  5788       rl  w0  x3+a10    ;     kind:=kind(proc);
 6309  5790       sn  w0  18        ;     main:=main(proc);
 6310  5792       jl.     j1.       ;     if kind=18
 6311  5794       rl  w2  x3+a50    ;     or (kind=84,85 and main<>0 and subkind=18) then
 6312  5796       se  w0  84        ;
 6313  5798       sn  w0  85        ;
 6314  5800       sn  w2  0         ;
 6315  5802       jl.     j0.       ;
 6316  5804       bl  w2  x3+a63    ;
 6317  5806       se  w2  18        ;
 6318  5808       jl.     j0.       ;
 6319  5810  j1:  rl  w2  x3+a70    ;       if state(proc)=2 then
 6320  5812       se  w2  2         ;         answer(0):=0;
 6321  5814       jl.     j0.       ;         answer(2):=proc;
 6322  5816       al  w2  0         ;         deliver result(1);
 6323  5818       ds  w3  g21       ;         goto exit;
 6324  5820       jl  w3  g18       ;     end;
 6325  5822       jl     (b20)      ; exit: return;
 6326  5824  e.
 6327  5824  ; errorlog process
 6328  5824  ; hsi 80.07.22
 6329  5824  m.
 6329  5824                  errorlog process

 6330  5824  b. i10, j10 w.
 6331  5824  i0=1<23
 6332  5824      i0>19
 6333  5826  j0: i0>0
 6334  5828  i1: 1<12
 6335  5830  h7:  al  w0  0            ; reset interrupt adr. (set by remove process)
 6336  5832       rs  w0  x3+a56       ;
 6337  5834  
 6337  5834  
 6337  5834       dl. w1  j0.          ; check operation
 6338  5836       jl  w3  g16          ; 
 6339  5838       rl  w2  b18          ; if buffer size < max record size
 6340  5840       rl  w1  x2+a150      ;
 6341  5842       ws. w1  i1.          ;
 6342  5844       rs  w1  x2+a150      ; make operation even. ( allowing it to be regertted)
 6343  5846       rl  w1  x2+a151      ; then send answer: unintelligble
 6344  5848       al  w1  x1+74        ; 
 6345  5850       sh  w1  (x2+a152)    ; else link operation and retur to driverproc
 6346  5852       jl.     j1.       ;
 6347  5854       ld  w1  -100         ; buffer too small : send answer
 6348  5856       ds  w1  g22          ;
 6349  5858       al  w1  8            ;
 6350  5860       rs  w1  g20          ; status: 1 shift 3
 6351  5862       jl      g5           ;
 6352  5864   j1: jl  w3  g17          ; link up (return if first in queue )
 6353  5866       rl  w0  x2+a153     ; if first in queue then
 6354  5868       rs  w0  b32          ; set pd of special watched receiver
 6355  5870       jl      (b20)        ; return via wait event in driverproc
 6356  5872  e.
 6357  5872  
 6357  5872  ; rc8601 driver.
 6358  5872  ; jr, 78.04.28
 6359  5872  
 6359  5872  c.(:a80>11a.1:)-1
 6360  5872  
 6360  5872  m.
 6360  5872                  rc8601/02 (cdc1604/gier emulator)

 6361  5872  
 6361  5872  b.i15,m6,p6,s6 w.
 6362  5872  
 6362  5872  ; the rc8601 and rc8602 are a rc800 cpu used for emulating the cdc 1604 and gier.
 6363  5872  ; the device responds two devicenumbers, and it is then controlled
 6364  5872  ; from two external processes -
 6365  5872  ;   sscir, stop-start control and io-request,
 6366  5872  ; and
 6367  5872  ;   isrpy, io-status reply.
 6368  5872  ; these processes are working totally independent, but as they should be
 6369  5872  ; driven in almost the same way they are using the same driver-code.
 6370  5872  ;
 6371  5872  ; the processes accept the operations-
 6372  5872  ;   sscir :  sense         0<12+0   , dummy    , dummy
 6373  5872  ;            autoload      1<12+0   , base addr, dummy (rc8601)
 6374  5872  ;                          1<12+0   , first    , last  (rc8602)
 6375  5872  ;            restart       2<12+0   , dummy    , dummy
 6376  5872  ;                          3<12+0   , first    , last  (rc8602)
 6377  5872  ;   isrpy:  (sense         0<12+0   , dummy    , dummy
 6378  5872  ;only rc8601(stop          2<12+0   , dummy    , dummy
 6379  5872  ;           (ready         4<12+mode, dummy    , dummy    , channelnumber
 6380  5872  ; where
 6381  5872  ;   base addr-448, base addr+131072 must be inside the sender process,
 6382  5872  ;   and channelnumber <256,
 6383  5872  ; and
 6384  5872  ;   mode holds any combination of the mode bits
 6385  5872  ;            1<0        channel ready
 6386  5872  ;            1<1        equipment ready
 6387  5872  ;            1<2        equipment error
 6388  5872  ;
 6389  5872  ; the format of the answer-
 6390  5872  ;   event status
 6391  5872  ;   function
 6392  5872  ;   unitno<18+exf addr (only autoload)
 6393  5872  ;  (io-result)
 6394  5872  ; where
 6395  5872  ;   event status is the status delivered from the hardware,
 6396  5872  ; and
 6397  5872  ;   function     -2  power up
 6398  5872  ;                -1  monitor timeout
 6399  5872  ;                 0  stopped
 6400  5872  ;                 1  ok after immidiate operation
 6401  5872  ;                 2  error stop
 6402  5872  ;                 3  exfer request
 6403  5872  ;
 6404  5872  ; format of the privat part of the process description-
 6405  5872  
 6405  5872  s0=a56+2               ; current sender ident. bit
 6406  5872  s1=s0+2                ; state
 6407  5872  s2=s1+2                ; stopped(sender) (only sscir)
 6408  5872  
 6408  5872  ; state -
 6409  5872  ;   0    device ready
 6410  5872  ;   2    sscir busy with sense operation
 6411  5872  ;   4    sscir busy with autoload operation
 6412  5872  ;   6    sscir busy with rc8601 restart operation
 6413  5872  ;   8    sscir busy with rc8602 restart operation
 6414  5872  ;   10   isrpy busy with sense operation
 6415  5872  ;   12   isrpy busy with stop operation
 6416  5872  ;   14   isrpy busy with ready operation
 6417  5872  ;
 6418  5872  ; stopped -
 6419  5872  ;   =  0    running
 6420  5872  ;   <> 0    stopped
 6421  5872  ;
 6422  5872  ; parameters:
 6423  5872  
 6423  5872  p0=76                  ; kind of sscir process
 6424  5872  p1=78                  ; kind of isrpy process
 6425  5872  
 6425  5872  p2=-448                ; rel first (start of sim area relative to base addr)
 6426  5872  p3=131072              ; rel last (last of sim area relative to base addr)
 6427  5872  
 6427  5872  ; channelprogram:
 6428  5872  
 6428  5872  i0:  0<12+0<8+0        ; address code (sender), operation
 6429  5874       0                 ; base addr
 6430  5876       0                 ; channelnumber
 6431  5878  
 6431  5878           15<8          ; stop
 6432  5880       0                 ; dummy
 6433  5882  i11: 0                 ; timeout (in units of 0.1 millisec)
 6434  5884  
 6434  5884  
 6434  5884  i1:  p3                ;
 6435  5886       a0=1<23
 6436  5886       a0>0+a0>1+a0>2+a0>3    ; mask0
 6437  5888  i2:  a0>0              
 6438  5890       a0>0+a0>2+a0>4    ; mask1
 6439  5892  i3:  a0>0
 6440  5894       a0>0+a0>2+a0>4    ; mask2
 6441  5896  i4:  a0>1+a0>2+a0>3+a0>4+a0>5+a0>6+a0>7+a0>8+a0>9+a0>10+a0>11+a0>12+a0>13+a0>14+a0>15
 6442  5898  
 6442  5898  ; table concerning channel program.
 6443  5898  
 6443  5898  i5=k-2,  2<12+0<8, 0<12+1<8, 0<12+3<8, 0<12+1<8, 2<12+0<8, 0<12+1<8, 0<12+3<8
 6444  5912  i6=k-2,        12,        0,        1,        0,       12,        1, i7:    0
 6445  5926  i12: 120*10000         ; timeout f. 8601
 6446  5928  i13:  15*10000         ; timeout f. 8602
 6447  5930  
 6447  5930  ; dummy status area.
 6448  5930  i8:  0, r.4            ;
 6449  5938  
 6449  5938  i9:  1<3               ;
 6450  5940  
 6450  5940  ; start.
 6451  5940  b.j6 w.
 6452  5940  h76: jl  w3  g15       ; start(sscir): check reservation;
 6453  5942  h72: bz  w3  x2+8      ;   if rc8602 then skip user/reserver check;
 6454  5944       ls  w3  1         ;   index:=operation*2+2;
 6455  5946       al  w3  x3+2      ;
 6456  5948       jl.     j0.       ;   goto checkmess;
 6457  5950  
 6457  5950  h78: jl  w3  g15       ; start(isrpy): check reservation;
 6458  5952       bz  w3  x2+8      ;   index:=operation+10;
 6459  5954       al  w3  x3+10     ;   goto checkmess;
 6460  5956  
 6460  5956  ; check message.
 6461  5956  ; the message buffer is checked and the content is changed to -
 6462  5956  ;   mess+8   command, mode(mess)
 6463  5956  ;       +10  first address
 6464  5956  ;       +12  last address
 6465  5956  ;       +14  channelnumber(mess)
 6466  5956  ;       +16  address code<12+command<8+mode
 6467  5956  ;       +18  address
 6468  5956  ;       +20  character count
 6469  5956  ;       +22  index
 6470  5956  j0:                    ; checkmess:
 6471  5956       rs  w3  x2+22     ;   mess(22):=index;
 6472  5958       sl  w3  2         ;   if index<2
 6473  5960       sl  w3  14+1      ;   or index>14 or (isrpy and rc8602) then
 6474  5962  h74: jl      g5        ;     goto result3;
 6475  5964       jl.    (x3+i10.)  ;   goto case index of
 6476  5966  i10=k-2
 6477  5966       j1                ;     (check1,   2: sscir-sense
 6478  5968       j2                ;      check2,   4: sscir-autoload
 6479  5970       j4                ;      check4,   6: sscir-restart
 6480  5972       j2                ;      check2,   8: sscir-restart (rc8602)
 6481  5974       j1                ;      check1,  10: isrpy-sense
 6482  5976       j4                ;      check4,  12: isrpy-stop
 6483  5978       j3                ;      check3); 14: isrpy-ready
 6484  5980  
 6484  5980  j1:  al. w1  i8.       ; check1: addr:=addr(dummy status area);
 6485  5982       jl.     j5.       ;   goto cont;
 6486  5984  
 6486  5984  j2:  rl  w1  b19       ; check2:
 6487  5986       rl  w0  x1+a10    ;
 6488  5988       se  w0  p0        ;   if proc=rc8601 then
 6489  5990       jl.     j6.       ;
 6490  5992       al  w0  1         ;     size:=1;
 6491  5994       rs. w0  x3+i6.    ;
 6492  5996       rl  w1  x2+10     ;
 6493  5998       al  w0  x1+p2     ;
 6494  6000       wa. w1  i1.       ;     first:=first(mess)+rel first;
 6495  6002       ds  w1  x2+12     ;     last:=first(mess)+rel last;
 6496  6004       ws. w1  i1.       ;     addr:=first(mess);
 6497  6006       jl.     j5.       ;     goto cont;
 6498  6008  j6:  al  w1  2         ;   else
 6499  6010       wa  w1  x2+12     ;
 6500  6012       ws  w1  x2+10     ;     size:=2+last-first;
 6501  6014       al  w0  x1        ;
 6502  6016       ls  w0  -1        ;     size:=size.2*3;
 6503  6018       wa  w1  0         ;
 6504  6020       rs. w1  x3+i6.    ;
 6505  6022       rl  w1  x2+10     ;     addr:= first(mess)
 6506  6024       jl.     j5.       ;     goto cont;
 6507  6026  
 6507  6026  j3:  rl  w0  x2+14     ; check3:
 6508  6028       sl  w0  1         ;   if channelno<1
 6509  6030       sl  w0  1<8       ;   or channelno>=256 then
 6510  6032       jl      g5        ;     goto result3;
 6511  6034       rs. w0  i7.       ;   char count(10):=channelno;
 6512  6036  j4:  am     (x2+6)     ; check4:
 6513  6038       rl  w1  +a17      ;   addr:=first(core(sender));
 6514  6040       rs  w1  x2+10     ;   first address:=address;
 6515  6042       al  w0  x1+256    ;   last address:=address+max size(:max channelnumber);
 6516  6044       rs  w0  x2+12     ;
 6517  6046  
 6517  6046  ; w1: addr, w2: buffer, w3: index.
 6518  6046  j5:  rl. w0  x3+i5.    ; cont:
 6519  6048       ba  w0  x2+9      ;   command:=command(index)+mode(mess);
 6520  6050       ds  w1  x2+18     ;   mess(16:18):=command, addr;
 6521  6052       rl. w0  x3+i6.    ;   char count:=char count(index);
 6522  6054       rs  w0  x2+20     ;   mess(20):=char count;
 6523  6056       dl. w1  i2.       ;   mask:=mask0;
 6524  6058       sl  w3  10        ;   if index>=10 then
 6525  6060       dl. w1  i3.       ;     mask:=mask1;
 6526  6062       sl  w3  14        ;   if index>=14 then
 6527  6064       dl. w1  i4.       ;     mask:=mask2;
 6528  6066       jl  w3  g16       ;   check operation;
 6529  6068       rl  w1  b19       ;
 6530  6070       jl  w3  g17       ;   link operation;
 6531  6072                         ;   goto next;
 6532  6072  e.
 6533  6072  
 6533  6072  ; execute operation.
 6534  6072  b.j4 w.
 6535  6072  
 6535  6072  m0:  rl  w3  x2+a142   ; next:  get current sender
 6536  6074       sh  w3  0         ;   if -parent then
 6537  6076       ac  w3  x3        ;   sender := - sender
 6538  6078       rl  w3  x3+a14    ;   get ident(sender);
 6539  6080       rs  w3  x1+s0     ;   store current sender ident in device descr;
 6540  6082  
 6540  6082       rl  w3  x2+22     ;   get index;
 6541  6084       sl  w3  4         ;   if -,operation = sense
 6542  6086       sl  w3  10        ;   and kind(proc) = sscir (<=>index < 8) then
 6543  6088       jl.     j1.
 6544  6090       rl  w0  x1+s2
 6545  6092       se  w3  4         ;     if index(mess) = autoload then
 6546  6094       jl.     j0.
 6547  6096       lo  w0  x1+s0     ;     stopped(sender) := 0
 6548  6098       lx  w0  x1+s0
 6549  6100       rs  w0  x1+s2     ;   else
 6550  6102       jl.     j1.
 6551  6104  j0:  so  w0 (x1+s0)    ;   if stopped(sender) then
 6552  6106       jl.     j1.
 6553  6108       al  w0  0
 6554  6110       rs  w0  g20       ;     status (mess) := 0
 6555  6112       rs  w0  g21       ;       function(mess):=0;
 6556  6114           rs w0 g23     ;***
 6557  6116       jl.     m3.       ;       goto result1;
 6558  6118  j1:  rs  w3  x1+s1     ;   state:=index;
 6559  6120       al  w0  2.111<8   ;
 6560  6122       la. w0  x3+i5.    ;   operation(mess):=command;
 6561  6124       ls  w0  -8        ;
 6562  6126       hs  w0  x2+8      ;
 6563  6128  
 6563  6128  ; setup channelprogram.
 6564  6128       dl  w0  x2+18     ;   command(chpg):=command(mess);
 6565  6130       ds. w0  i0.+2     ;   addr(chpg):=addr(mess);
 6566  6132       rl  w0  x2+20     ;   char count(chpg):=char count(mess);
 6567  6134       rs. w0  i0.+4     ;
 6568  6136       rl  w3  b19        ;
 6569  6138       rl  w3  x3+a10     ; timeout:
 6570  6140       rl. w0  i12.       ;
 6571  6142       se  w3  p0         ; if kind(rec) = rc8601 then
 6572  6144       sn  w3  p1         ; timeout:= 120 m.sec else
 6573  6146       jl.     j2.        ; timeout:= 15 m.sec;
 6574  6148       rl. w0  i13.       ;
 6575  6150  j2:  rs. w0  i11.
 6576  6152  
 6576  6152  ; start channelprogram.
 6577  6152  ; if the device is isrpy the device addr in the call must have value
 6578  6152  ; io device number + 1.
 6579  6152       rl  w3  x1+a235   ;     iodev addr:=iodev addr(proc);
 6580  6154       al  w0  1<2+1     ;   function select:=start chpg, standard return;
 6581  6156       al. w1  i0.       ;   start:=start of chpg;
 6582  6158       jd      1<11+100  ;   start io;
 6583  6160           rs w0 g23     ;***
 6584  6162       se  w0  2         ;   if io-result<>2 then
 6585  6164       jl.     m4.       ;     goto result3;
 6586  6166       ld  w0  -100      ; sender stopped:
 6587  6168       ds  w0  g21       ;   status, function:=0,0;
 6588  6170       jl.     m3.       ;   goto result1;
 6589  6172  e.
 6590  6172  
 6590  6172  
 6590  6172  ; after interrupt.
 6591  6172  b.j6 w.
 6592  6172  c38:                   ; service int(sscir):
 6593  6172  c39:                   ; service int(isrpy):
 6594  6172       rl  w0  x1+s1     ;
 6595  6174       sn  w0  0         ;   if state=0 then
 6596  6176       jl.     j3.       ;     goto get next;
 6597  6178       rl  w3  x1+a230+6 ;
 6598  6180       rl  w0  x1+a230+2 ;   status(answer):=event status(std status);
 6599  6182       ds  w0  g21       ;   function(answer):=rem char count(std status);
 6600  6184       rl  w3  x1+a230+4 ;   unitno<18+exf addr(answer):=curr status(std status);
 6601  6186       rs  w3  g22       ;
 6602  6188       rl  w3  x1+a244   ;
 6603  6190           rs w3 g23     ;***
 6604  6192       se  w3  0         ;   if io-result<>ok then
 6605  6194       jl.     j0.       ;     goto error;
 6606  6196       se  w0  2         ;   if function=2 then
 6607  6198       jl.     m3.
 6608  6200       rl  w0  x1+s2     ;     stopped(sender):= 1;
 6609  6202       lo  w0  x1+s0
 6610  6204       rs  w0  x1+s2
 6611  6206  
 6611  6206  ; return answer to sender of messsage.
 6612  6206  m3:  am      1-3       ; result1: result:=1;
 6613  6208  m4:  am      3-4       ; result3: result:=3;
 6614  6210  m5:  al  w0  4         ; result4: result:=4;
 6615  6212           rl w3 x2+16   ;***
 6616  6214           rs w3 g24     ;***
 6617  6216       jl  w3  g19       ;   deliver result;
 6618  6218       al  w0  0         ;
 6619  6220       rs  w0  x1+s1     ;   state:=ready;
 6620  6222  j3:  jl  w3  g25       ; getnext: next operation;
 6621  6224       jl.     m0.       ;   goto next;
 6622  6226  
 6622  6226  ; after io-error.
 6623  6226  j0:  rl  w0  x1+s2     ; error:
 6624  6228       lo  w0  x1+s0     ;   stopped(sender):= 1;
 6625  6230       rs  w0  x1+s2
 6626  6232       sn  w3  6         ;   if io-result=6 then
 6627  6234       jl.     j2.       ;     goto power up;
 6628  6236       se  w3  3         ;   if io-result<>3 then
 6629  6238       jl.     m5.       ;     goto result4;
 6630  6240  j1:  am      -1+2      ; timeout: function:=-1;
 6631  6242  j2:  al  w0  -2        ; power up: function:=-2;
 6632  6244       al  w3  0         ;
 6633  6246       ds  w0  g21       ;   status:=0;
 6634  6248       jl.     m3.       ;   goto result1;
 6635  6250  e.
 6636  6250  
 6636  6250  e.                     ; end of rc8601.
 6637  6250  
 6637  6250  z.
 6638  6250  
 6638  6250  h72=g2, h74=g2, h76=g2, h78=g2
 6639  6250  
 6639  6250  
 6639  6250  \f


 6639  6250  
 6639  6250  m.
 6639  6250                  mondisc - disc driver

 6640  6250  
 6640  6250  b.i30 w.
 6641  6250  i0=82 02 08, i1=14 00 00
 6642  6250  
 6642  6250  ; if newtime (i0,i1) > oldtime (a133,a134) then oldtime:=newtime;
 6643  6250  c.i0-a133
 6644  6250    c.i0-a133-1, a133=i0, a134=i1, z.
 6645  6250    c.i1-a134-1,          a134=i1, z.
 6646  6250  z.
 6647  6250  
 6647  6250  i10=i0, i20=i1
 6648  6250  
 6648  6250  i15=i10/100000 , i10=i10-i15*100000 , i25=i20/100000 , i20=i20-i25*100000 
 6649  6250  i14=i10/10000  , i10=i10-i14*10000  , i24=i20/10000  , i20=i20-i24*10000 
 6650  6250  i13=i10/1000   , i10=i10-i13*1000   , i23=i20/1000   , i20=i20-i23*1000
 6651  6250  i12=i10/100    , i10=i10-i12*100    , i22=i20/100    , i20=i20-i22*100
 6652  6250  i11=i10/10     , i10=i10-i11*10     , i21=i20/10     , i20=i20-i21*10
 6653  6250  
 6653  6250  i2:  <:                              date  :>
 6654  6274       (:i15+48:)<16+(:i14+48:)<8+46
 6655  6276       (:i13+48:)<16+(:i12+48:)<8+46
 6656  6278       (:i11+48:)<16+(:i10+48:)<8+32
 6657  6280  
 6657  6280       (:i25+48:)<16+(:i24+48:)<8+46
 6658  6282       (:i23+48:)<16+(:i22+48:)<8+46
 6659  6284       (:i21+48:)<16+(:i20+48:)<8+ 0
 6660  6286  
 6660  6286  i3:  al. w0  i2.       ; write date:
 6661  6288       rs  w0  x2+0      ;   first free:=start(text);
 6662  6290       al  w2  0         ;
 6663  6292       jl      x3        ;   return to slang(status ok);
 6664  6294  
 6664  6294       jl.     i3.       ;
 6665  6296  e.
 6666  6296  j.
 6666  6250                                date  82.02.08 14.00.00

 6667  6250  
 6667  6250  
 6667  6250  ; ---------------------------------------------------------------
 6668  6250  
 6668  6250  ;                 d i s c   d r i v e r   c o d e
 6669  6250  ;                            (dsc 801)
 6670  6250  ;
 6671  6250  ;                a r e a   p r o c e s s   c o d e
 6672  6250  
 6672  6250  ; ---------------------------------------------------------------
 6673  6250  
 6673  6250  ; this section contains the code executed by driverproc for pro-
 6674  6250  ; cessing messages to an area process or a disc driver.
 6675  6250  ;
 6676  6250  ; messages have the following format:
 6677  6250  ;
 6678  6250  ; sense          0<12 + mode         initialize 2<12
 6679  6250  ;                irrel                          no of heads
 6680  6250  ;                irrel                          disp. on odd cyl.
 6681  6250  ;                irrel                          disctype
 6682  6250  ;
 6683  6250  ; clean track    6<12 + mode         position   8<12 + mode
 6684  6250  ;                irrel                          irrel
 6685  6250  ;                irrel                          irrel
 6686  6250  ;                segment no                     segment no
 6687  6250  ;
 6688  6250  ; read           3<12 + mode         write      5<12 + mode
 6689  6250  ;                first address                  first address
 6690  6250  ;                last address                   last address
 6691  6250  ;                first segment no               first segment no
 6692  6250  ;
 6693  6250  ; get statistics 9<12 
 6694  6250  ;                first address
 6695  6250  ;                last address
 6696  6250  ;                irrel
 6697  6250  ;
 6698  6250  ; set regretted  10<12                continue  12<12   ; (used by testprograms) 
 6699  6250  ;                irrel                          irrel
 6700  6250  ;                irrel                          irrel
 6701  6250  ;                irrel                          irrel
 6702  6250  ; mode consists of a sum of one or more of following values:
 6703  6250  ;
 6704  6250  ; transput mode     0 transput of data
 6705  6250  ;                   1 transput of address marks
 6706  6250  ; error recovery    0 repeat at error
 6707  6250  ;                   2 do not repeat at error
 6708  6250  ; requeue           4 answer message after best repetitions
 6709  6250  ;                   0 requeue message after best repetitions
 6710  6250  ;                     and try later again
 6711  6250  ; read after write  0 no read after write
 6712  6250  ;                   8 read after write mode
 6713  6250  ;
 6714  6250  ; disctype 0 = dsm801, disctype 1 = dsm802 with variable offset.
 6715  6250  ;
 6716  6250  ; the answer to a message has the following format:
 6717  6250  ;
 6718  6250  ;                statusword
 6719  6250  ;                0 or number of bytes transferred
 6720  6250  ;                0 or number of chars transferred
 6721  6250  ;                i/o result, from start i/o
 6722  6250  ;                current status from controller
 6723  6250  ;                event status from controller
 6724  6250  ;                technical status from controller
 6725  6250  ;
 6726  6250  ; the following bits may be set in a statusword:
 6727  6250  ;
 6728  6250  ; bit  0 intervention, no disc driver at area process message
 6729  6250  ; bit  1 parity      , event status bit 1 or 4 (data-, hard err.)
 6730  6250  ; bit  2 sync.error  , event status bit 5 (position error)
 6731  6250  ; bit  3 data overrun, event status bit 3 (data overrun)
 6732  6250  ; bit  4 blocklength , buffer too small at get statistics
 6733  6250  ; bit  5 end medium  , 1st segm outside or curr stat b5 (seek err)
 6734  6250  ; bit 11 discerror   , requeue mode = 4 and repetitions < max
 6735  6250  ;
 6736  6250  ; the message may be sent to an area process, a logical disc
 6737  6250  ; driver (one physical disc may be split into more logical devi-
 6738  6250  ; ces) or to a physical disc driver. in either case the message is
 6739  6250  ; linked to the physical driver unless it concerns an area on a
 6740  6250  ; remote disc, in which case the code for processing such messages
 6741  6250  ; is entered.
 6742  6250  ;
 6743  6250  ; initialize, clean track, and write addr mark can only be sent to
 6744  6250  ; a reserved physical disc driver. get statistics can only be sent
 6745  6250  ; to a disc driver.
 6746  6250  ;
 6747  6250  ; segment numbers in message correspond to absolute segments
 6748  6250  ; when sent to a physical driver, to segmentno relative to start
 6749  6250  ; of logical disc when sent to a logical driver, and relative
 6750  6250  ; to areastart when sent to an area process.
 6751  6250  ;
 6752  6250  ; before linking the message to the physical disc driver it is
 6753  6250  ; reformatted and will contain sufficient information for exe-
 6754  6250  ; cuting the first part of the transfer corresponding to the
 6755  6250  ; largest number of consecutive segments starting at first seg-
 6756  6250  ; ment wanted. the buffer is updated at each portion of conse-
 6757  6250  ; cutive segments transferred until the entire number of segments
 6758  6250  ; have been transferred.
 6759  6250  ;
 6760  6250  ; when the message is linked to the physical driver it is not
 6761  6250  ; possible to see if it was sent to an area process or directly
 6762  6250  ; to a driver. however, when sent to a driver, all segments
 6763  6250  ; wanted can be processed in the first transfer, whereas an
 6764  6250  ; area process message may be processed in more transfers as
 6765  6250  ; the slices of an area need not be consecutive.
 6766  6250  ;
 6767  6250  ; the driver will automatically examine the number of heads on
 6768  6250  ; the disc, the displacement of sector zero on odd cylinders,
 6769  6250  ; and the disctype (dsm801-2) when the first message (after
 6770  6250  ; intervention) is received unless this first message is the
 6771  6250  ; initialize message.
 6772  6250  \f


 6772  6250  
 6772  6250  
 6772  6250  ; pej 04.10.77    disc driver, contents
 6773  6250  
 6773  6250  ; c o n t e n t s
 6774  6250  ; ---------------------------------------------------------------
 6775  6250  
 6775  6250  ; definitions
 6776  6250  ; -----------
 6777  6250  ;
 6778  6250  ; constant definitions
 6779  6250  ; format of transformed message
 6780  6250  ; process description format
 6781  6250  ;
 6782  6250  ; main routines ( in sequential order)
 6783  6250  ; -------------
 6784  6250  ;
 6785  6250  ; message received by area process
 6786  6250  ; message received by disc driver
 6787  6250  ; link message to disc driver
 6788  6250  ; message not accepted
 6789  6250  ;
 6790  6250  ; process next message
 6791  6250  ; start device
 6792  6250  ;
 6793  6250  ; interrupt received
 6794  6250  ; successful transfer
 6795  6250  ; deliver answer routines
 6796  6250  ;
 6797  6250  ; error routine
 6798  6250  ;
 6799  6250  ; procedures (in alphabetical order)
 6800  6250  ; ----------
 6801  6250  ;
 6802  6250  ; check area process
 6803  6250  ; check message
 6804  6250  ; clean
 6805  6250  ; compound status
 6806  6250  ; copy statistics
 6807  6250  ; correct data
 6808  6250  ; initialize disc
 6809  6250  ; prepare consecutive segments
 6810  6250  ; setup channel program and start
 6811  6250  ; set errorkind
 6812  6250  ; set result and status
 6813  6250  ; transform first segment
 6814  6250  ; update buf
 6815  6250  ; update buf on error
 6816  6250  ; update on corrected error
 6817  6250  ; update retryinformation
 6818  6250  
 6818  6250  b. j170, m10, p50, q70 ; disc driver and area process
 6819  6250  \f


 6819  6250  
 6819  6250  
 6819  6250  ; pej 30.09.77    disc driver, constant definitions
 6820  6250  
 6820  6250  ; c o n s t a n t   d e f i n i t i o n s
 6821  6250  ; ---------------------------------------------------------------
 6822  6250  
 6822  6250  ; operation codes, control = even, transput = odd codes. if the
 6823  6250  ; codes are changed, also a table in proc setup channel program
 6824  6250  ; and start must be changed as well as error segment table
 6825  6250  ; updating in action 7a of error actions and proc. update buf.
 6826  6250  q30 = 0                 ; sense
 6827  6250  q31 = 2                 ; initialize
 6828  6250  q32 = 3                 ; read
 6829  6250  q33 = 5                 ; write
 6830  6250  q34 = 6                 ; clean track
 6831  6250  q35 = 8                 ; position
 6832  6250  q36 = 9                 ; get statistics
 6833  6250  q39 = 10                ; set regretted
 6834  6250  q38 = 12                ; continue
 6835  6250  
 6835  6250  ; mode codes
 6836  6250  q40 =     1             ; transput mode, = addr mark mode
 6837  6250  q41 = 1 < 1             ; error recovery, = no repetition
 6838  6250  q42 = 1 < 2             ; requeue, = do not reque
 6839  6250  q43 = 1 < 3             ; read after write, = true
 6840  6250  
 6840  6250  ; segment units
 6841  6250  q50 = 8                 ; no of bytes per addr mark
 6842  6250  q51 = 12                ; -  -  chars -   -    -
 6843  6250  q52 = 512               ; -  -  bytes -   data segment
 6844  6250  q53 = 768               ; -  -  chars -   -    -
 6845  6250  
 6845  6250  ; process kinds
 6846  6250  q60 = 84                ; subproc
 6847  6250  q61 = 62                ; disc driver
 6848  6250  
 6848  6250  ; power restart parameters (time units: 0.1 msec)
 6849  6250  q10 =  1 * 1000 * 10    ; time between sense in power rest. loop
 6850  6250  q11 = 40 * 1000 * 10    ; maxtime to become ready at power rest.
 6851  6250  q12 = q10               ; -       -  -      -     -  -     down
 6852  6250  q13 = q11 / q10 + 1     ; no of times to sense at power restart
 6853  6250  q14 = q12 / q10 + 1     ; no of times to sense at power down
 6854  6250  q15 = 10                ; no of times to repeat at data overrun
 6855  6250  
 6855  6250  ; no of times to repeat at error
 6856  6250  ; repeats = 3           ; not defined as a constant due to imple-
 6857  6250                          ; mentation details. to change strategy,
 6858  6250                          ; correct proc update retryinformation
 6859  6250                          ; and action 8a and 10 in error routine.
 6860  6250  
 6860  6250  ; assembly options
 6861  6250  q0  = (:a80>1a.1:)-1    ; disc driver included, 0=yes, -1=no
 6862  6250  q1  = (:a82>1a.1:)-1    ; statistics included, 0=yes, -1=no
 6863  6250  q2  = 10                ; no of entries in error segment table
 6864  6250  \f


 6864  6250  
 6864  6250  ; pej 04.10.77    disc driver, format of transformed message
 6865  6250  
 6865  6250  ; f o r m a t   o f   t r a n s f o r m e d   m e s s a g e
 6866  6250  ; ---------------------------------------------------------------
 6867  6250  
 6867  6250  ; format of messagebuffer when linked to driver (after checking)
 6868  6250  m0  = a145, m1 = m0+1   ; operation      , mode
 6869  6250  m2  = m1+1,             ; first address
 6870  6250  m3  = m2+2              ; last address
 6871  6250  m4  = m3+2              ; first segment
 6872  6250  m5  = m4+2, m6 = m5+1   ; no of segments , retryinformation
 6873  6250  m7  = m6+1              ; next segment
 6874  6250  m8  = m7+2, m9 = m8+1   ; segments wanted, remaining segments
 6875  6250  m10 = m9+1              ; device
 6876  6250  ; operation  : not changed
 6877  6250  ; mode       : not changed
 6878  6250  ; firstaddr  : in curr transfer
 6879  6250  ; lastaddr   : not changed, used by start i/o for checking
 6880  6250  ; first segm : in curr transfer, rel. to start of disc
 6881  6250  ; no of segms: in curr transfer
 6882  6250  ; retryinf   : at read data, read addr mark:
 6883  6250  ;                 modeindex<8 + offsetindex<3 + tries
 6884  6250  ;                 modeindex  : index to modetable
 6885  6250  ;                 offsetindex: index to offset table
 6886  6250  ;                 tries      : no of tries at given modeindex
 6887  6250  ;                              and offset index
 6888  6250  ;              at read after write:
 6889  6250  ;                 writetries<3 + readtries
 6890  6250  ;                 writetries: no of times write has been tried
 6891  6250  ;                 readtries : no of times read has been tried
 6892  6250  ;                             after a write
 6893  6250  ;              at other operations:
 6894  6250  ;                 no of times the transfer has been tried
 6895  6250  ; next segm  : will be first segment in next transfer
 6896  6250  ; segms want : total no of segments wanted by sender
 6897  6250  ; rem segms  : no of segments remaining to be transferred
 6898  6250  ; device     : addr of disc driver containing sliceinformation
 6899  6250  ;              and physical segment no of first segment
 6900  6250  \f


 6900  6250  
 6900  6250  ; pej 04.10.77    disc driver, proc descr format
 6901  6250  
 6901  6250  ; p r o c e s s   d e s c r i p t i o n   f o r m a t
 6902  6250  ; ---------------------------------------------------------------
 6903  6250  
 6903  6250  ; variables required for physical and logical disc.
 6904  6250      ; a250    ; driver descr addr
 6905  6250      ; a48     ; interval
 6906  6250      ; a49     ; -
 6907  6250      ; a10     ; kind
 6908  6250      ; a11     ; name
 6909  6250  p2  = a50     ; mainproc, phys.=0, log.=addr of physical
 6910  6250      ; a52     ; reserver
 6911  6250      ; a53     ; users
 6912  6250      ; a54     ; next message
 6913  6250      ; a55     ; last message
 6914  6250      ; a56     ; regretted, often called interrupt address
 6915  6250      ; a70     ; not used
 6916  6250  p0  = a71     ; chaintable
 6917  6250  p1  = a72     ; slicelength
 6918  6250  p3  = p1+2    ; first segment, phys.=0, log.= segm no of log. 0
 6919  6250  p4  = p3+2    ; no of segments, phys.=on disc, log.=on log. disc
 6920  6250  
 6920  6250  ; disc characteristics (only required for physical disc).
 6921  6250  p6  = p4+2    ; no of segments per track
 6922  6250  p7  = p6+2    ; flags, used in address marks
 6923  6250  p8  = p7+2    ; no of segments per cylinder (set by driver)
 6924  6250  p10 = p8      ; cylinder, used during define disc
 6925  6250  p9  = p8+2    ; displ. of sector 0 on odd cyl. (set by driver)
 6926  6250  p11 = p9      ; head, used during define disc
 6927  6250  p5  = p9+2    ; disctype, 0=dsm801, 1=dsm802 (var.offset)
 6928  6250  
 6928  6250  ; variables concerning state of disc (only physical disc).
 6929  6250  p12 = p5+2    ;state, 0=after intervention, 1=defining disc,
 6930  6250                ;   2=ready
 6931  6250  p13 = p12+2   ; transfer state, kind of transfer in progress
 6932  6250                ;   bit 0 = idle (initial state)
 6933  6250                ;       1 = define disc
 6934  6250                ;       2 = power restart
 6935  6250                ;       3 = sense
 6936  6250                ;       4 = position
 6937  6250                ;       5 = clean track
 6938  6250                ;       6 = read data
 6939  6250                ;       7 = read addr mark
 6940  6250                ;       8 = write data
 6941  6250                ;       9 = write addr mark
 6942  6250                ;      10 = read after write data
 6943  6250                ;      11 = read after write addr mark
 6944  6250  p14 = p13+2   ; initdisc, 1=init at next start, 0=no
 6945  6250  p15 = p14+1   ; retryinformation, used at driver initiated
 6946  6250                ;   transfers; see m6 of message buffer
 6947  6250  
 6947  6250  ; areas used by channelprograms (only physical disc).
 6948  6250  p16 = p15+1   ; statusarea1, statusarea for first sense
 6949  6250                ; +0 : channel program counter
 6950  6250                ; +2 : remaining bytecount
 6951  6250                ; +4 : current status
 6952  6250                ; +6 : event status
 6953  6250                ; +8 : last read addr mark (4 words)
 6954  6250                ; +16: ecc, error correction information (2 words)
 6955  6250                ; +20: technical status
 6956  6250  p18 = p16+22  ; statusarea2, statusarea for second sense, for-
 6957  6250                ;   matted as statusarea1
 6958  6250  p22 = p18+8   ; addr mark, input area at define disc (4 words)
 6959  6250  p36 = p18+16  ; actionkey, used in error actions
 6960  6250  p37 = p18+18  ; actionindex, used in error actions
 6961  6250  p38 = p18+20  ; write ok, used at read after write error
 6962  6250  p20 = p18+22  ; seek parameter
 6963  6250                ; +0: cylinder<8 + head
 6964  6250                ; +2: sector<16 + flags
 6965  6250  p21 = p20+4   ; setmode parameter, bit16-17:strobe,
 6966  6250                ;   bit18-19:offset, bit20-23:offset magnitude
 6967  6250                ;   (set to zero if strobe-offset not used)
 6968  6250  
 6968  6250  ; other variables (only physical disc).
 6969  6250  p31 = p21+2   ; +0: curr status  (sum of all statusareas)
 6970  6250                ; +2: event status (-   -  -   -          )
 6971  6250  p33 = p31+4   ; technical status (-   -  -   -          )
 6972  6250  p34 = p33+2   ; compound status, formed from p31,p32,i/o result
 6973  6250  p35 = p34+2   ; segment unit in curr transfer:
 6974  6250                ; +0: bytes per segment
 6975  6250                ; +2: chars per segment
 6976  6250  
 6976  6250  ; statistical information (only physical disc).
 6977  6250  p40 = p35+4   ; no of transfers
 6978  6250  p41 = p40+2   ; no of transfers not successful in first attempt
 6979  6250                ;   (intervention, power restart, power down,
 6980  6250                ;    write protect are not counted)
 6981  6250  p42 = p41+2   ; no of errors corrected by ecc without repetition
 6982  6250  p43 = p42+2   ; no of errors corrected within 3 retries
 6983  6250                ; strobe offset table, no of errors corrected by:
 6984  6250  p44 = p43+2   ;   strobe 0 & offset n , strobe 0 & offset p
 6985  6250                ;                       , strobe l & offset 0
 6986  6250                ;   strobe l & offset n , strobe l & offset p
 6987  6250                ;                       , strobe e & offset 0
 6988  6250                ;   strobe e & offset n , strobe e & offset p
 6989  6250                ;   (e=early, l=late, p=positive, n=negative)
 6990  6250  p45 = p44+10  ; no of errors corrected by offset magnitude  -,  1
 6991  6250                ;                                             2,  3
 6992  6250                ;                                             4,  5
 6993  6250                ;                                             .   .
 6994  6250                ;                                             .   .
 6995  6250                ;                                            14, 15
 6996  6250                ;   (first byte not used, magnitude 0 unexistent)
 6997  6250  p47 = p45+16  ; counters for compound status bit  0, 1
 6998  6250                ;                                   2, 3
 6999  6250                ;                                   .  .
 7000  6250                ;                                   .  .
 7001  6250                ;                                  22,23
 7002  6250  p48 = p47+24  ; counters for technic. status bit  0, 1
 7003  6250                ;                                   2, 3
 7004  6250                ;                                   .  .
 7005  6250                ;                                   .  .
 7006  6250                ;                                  22,23
 7007  6250  p46 = p48+24  ; table of error segments, an entry contains
 7008  6250                ; +0: segment no. (physical)
 7009  6250                ; +2: no of reads ok   +3: no of reads with rep.
 7010  6250                ; +4: no of writes ok  +5: no of writes with rep.
 7011  6250  p50=p46+q2*6-p40; size of statistics in bytes
 7012  6250  
 7012  6250  ; ***** please note that:
 7013  6250  ;       - declarations of p10 and p8 are equal.
 7014  6250  ;       - declarations of p11 and p9 are equal.
 7015  6250  ;       - p22, p36, p37, and p38 are declared inside p18.
 7016  6250  ;       conflicts in use will not occur as overlapping locations
 7017  6250  ;       are not used simultanously.
 7018  6250  \f


 7018  6250  
 7018  6250  
 7018  6250  ; pej 21.09.77    area process, message received
 7019  6250  
 7019  6250  ; m e s s a g e   r e c e i v e d   b y   a r e a   p r o c e s s
 7020  6250  ; ---------------------------------------------------------------
 7021  6250  
 7021  6250  m.
 7021  6250                  area process

 7022  6250  
 7022  6250  ; this routine is entered when driverproc receives a message for
 7023  6250  ; an area process. curr receiver (b19) = area process descr.
 7024  6250  
 7024  6250  b. i10 w.               ; block containing area proc driver
 7025  6250  
 7025  6250  ; check if sender ok and if specified operation legal.
 7026  6250  h5  : bz  w0  x2+m0     ; area process: c. w2 = curr buf;
 7027  6252        sn  w0     q33    ;   if operation.curr buf = output
 7028  6254        am         g15-g14;   then check reservation
 7029  6256        jl  w3     g14    ;   else check user;
 7030  6258        dl. w1     i0.    ;
 7031  6260        jl  w3     g16    ;   check operation(oper mask,mode mask);
 7032  6262  
 7032  6262  ; check the area process.
 7033  6262        jl. w3     j1.    ;   check area process;
 7034  6264        jl.        j37.   ;   if area segms < 0 then goto outside;
 7035  6266        jl.        j35.   ;   if no doc then goto doc not found;
 7036  6268  
 7036  6268  ; now curr receiver = disc driver (physical or logical). check
 7037  6268  ; if the disc is a remote disc or that disc driver included.
 7038  6268        rs  w1  x2+m7     ;   save area process addr in curr buf;
 7039  6270        rl  w0  x3+a10    ;
 7040  6272        la  w0     g50    ;
 7041  6274        se  w0     q60    ;   if kind.curr receiver = subproc then
 7042  6276        jl.        i10.   ;   begin c. remote disc;
 7043  6278        rs  w1  x3+a56    ;      interrupt addr.curr rec:= area proc;
 7044  6280        jl.       (2), h84;      goto subproc driver;
 7045  6284  i10 :                   ;   end;
 7046  6284        c.        -q0-1   ;   if disc driver not included
 7047  6284        jl         g3     ;   then goto result 5; c. unknown;
 7048  6284        z.                ;
 7049  6284        c.         q0     ;
 7050  6284  
 7050  6284  ; check contents of the message
 7051  6284        rl  w0  x1+a61    ;   top:= no of segments.area proc;
 7052  6286        al  w1     q52    ;   bytes:= no of bytes in data segments;
 7053  6288        jl. w3     j2.    ;   check message(top,bytes);
 7054  6290        jl.        j37.   ;   if outside then goto outside;
 7055  6292  
 7055  6292  ; convert first segment into a segment no relative to discstart
 7056  6292  ; and prepare first portion of consecutive segments
 7057  6292        bz  w0  x2+m0     ;
 7058  6294        sn  w0     q30    ;   if operation.curr buf <> sense then
 7059  6296        jl.        j30.   ;   begin
 7060  6298        rl  w1  x2+m7     ;     area proc:= saved area proc;
 7061  6300        jl. w3     j3.    ;     transform first segm(area proc);
 7062  6302        bz  w0  x2+m0     ;
 7063  6304        se  w0     q35    ;     if operation.curr buf <> position
 7064  6306        jl. w3     j4.    ;     then prepare consec segms(curr rec);
 7065  6308                          ;   end;
 7066  6308        jl.        j30.   ;   goto link message;
 7067  6310        z.                ;
 7068  6310  
 7068  6310  ; legal mode combinations:
 7069  6310  ;          read after write
 7070  6310  ;              requeue
 7071  6310  ;                  error recovery
 7072  6310  i1  = a0>(:        q41:)
 7073  6310  i2  = a0>(:    q42    :)
 7074  6310  i3  = a0>(:    q42+q41:)
 7075  6310  i4  = a0>(:q43        :)
 7076  6310  i5  = a0>(:q43    +q41:)
 7077  6310  i6  = a0>(:q43+q42    :)
 7078  6310  i7  = a0>(:q43+q42    :)
 7079  6310  
 7079  6310  ; oper and mode masks for area process message
 7080  6310        a0>q30+a0>q32+a0>q33+a0>q35
 7081  6312                          ; oper mask: sense, read, write, pos.
 7082  6312  i0  : a0>0+i1+i2+i3+i4+i5+i6+i7
 7083  6314                          ; mode mask: no addr mark transput
 7084  6314  
 7084  6314  e.                      ; end of area process driver
 7085  6314  \f


 7085  6314  ; pej 21.09.77    disc driver, message received
 7086  6314  
 7086  6314  ; m e s s a g e   r e c e i v e d   b y   d i s c   d r i v e r
 7087  6314  ; ---------------------------------------------------------------
 7088  6314  
 7088  6314  b. i50 w.               ; block including disc driver
 7089  6314  h6  :                   ;
 7090  6314                          ;
 7091  6314        c.         q0     ;
 7092  6314  m.
 7092  6314                  dsc 801

 7093  6314  
 7093  6314  ; this routine is entered when driverproc receives a message for
 7094  6314  ; a disc driver. curr receiver (b19) = (logical or physical) disc
 7095  6314  ; driver process description.
 7096  6314  
 7096  6314  ; check if sender ok and if specified operation legal
 7097  6314        bz  w0  x2+m0     ; disc driver: c. w2 = curr buf;
 7098  6316        sn  w0     q33    ;   if operation.curr buf = output
 7099  6318        jl.        j20.   ;
 7100  6320        se  w0     q31    ;   or operation.curr buf = initialize
 7101  6322        sn  w0     q34    ;   or operation.curr buf = clean track
 7102  6324  j20 : am         g15-g14;   then check reservation
 7103  6326        jl  w3     g14    ;   else check user;
 7104  6328        dl. w1     i0.    ;   use oper/mode mask for phys. driver;
 7105  6330        am        (b19)   ;
 7106  6332        rl  w3     p2     ;
 7107  6334        sn  w3     0      ;   if mainproc.curr receiver <> 0 then
 7108  6336        jl.        j25.   ;   begin c. logical disc driver;
 7109  6338        rl. w0     i1.    ;     use oper mask for logical driver;
 7110  6340        bz  w3  x2+m0     ;     if operation.curr buf = output
 7111  6342        sn  w3     q33    ;     then use  mode mask for output;
 7112  6344        rl. w1     i2.    ;   end;
 7113  6346  j25 : jl  w3     g16    ;   check operation(oper mask,mode mask);
 7114  6348  ; check if message is continnue.
 7115  6348  ; such a message should not be linked up to the physical driver.
 7116  6348  ; if regretted is set by the command "set regretted " the message 
 7117  6348  ; is answered ok and the physical disc is started in rutine process
 7118  6348  ; next message. otherwise the message is answered with result 3 and 
 7119  6348  ; and no action is performed.
 7120  6348  
 7120  6348        bz  w3  x2+m0     ; if operation.curr buf = continue then
 7121  6350        se  w3     q38    ; begin
 7122  6352        jl.        j28.   ; if regretted not set by "set regret"
 7123  6354        am        (b19)   ; ( regretted.curr receiver=3)
 7124  6356        rl  w1    +a56    ; then deliver result 3 else
 7125  6358        se  w1     3      ; deliver result 1 and continue with 
 7126  6360        jl         g5     ; process next message
 7127  6362        jl.        j101.  ; end 
 7128  6364  
 7128  6364  ; check contents of the message
 7129  6364  j28 : bz  w0  x2+m1     ;
 7130  6366        al  w1     q52    ;   if transput mode.curr buf = 0
 7131  6368        sz  w0     q40    ;   then bytes:= bytes in data segments
 7132  6370        al  w1     q50    ;   else bytes:= bytes in addr marks;
 7133  6372        am        (b19)   ;
 7134  6374        rl  w0     p4     ;   top:= no of segments.curr receiver;
 7135  6376        jl. w3     j2.    ;   check message(top,bytes);
 7136  6378        jl.        j37.   ;   if outside then goto outside;
 7137  6380        jl.        j30.   ;   goto link message;
 7138  6382  
 7138  6382  ; legal mode combinations:
 7139  6382  ;          read after write
 7140  6382  ;              requeue
 7141  6382  ;                  error recovery
 7142  6382  ;                      transput of addr marks
 7143  6382  i3  = a0>(:            q40:)
 7144  6382  i4  = a0>(:        q41    :)
 7145  6382  i5  = a0>(:        q41+q40:)
 7146  6382  i6  = a0>(:    q42        :)
 7147  6382  i7  = a0>(:    q42    +q40:)
 7148  6382  i8  = a0>(:    q42+q41    :)
 7149  6382  i9  = a0>(:    q42+q41+q40:)
 7150  6382  i10 = a0>(:q43            :)
 7151  6382  i11 = a0>(:q43        +q40:)
 7152  6382  i12 = a0>(:q43    +q41    :)
 7153  6382  i13 = a0>(:q43    +q41+q40:)
 7154  6382  i14 = a0>(:q43+q42        :)
 7155  6382  i15 = a0>(:q43+q42    +q40:)
 7156  6382  i16 = a0>(:q43+q42+q41    :)
 7157  6382  i17 = a0>(:q43+q42+q41+q40:)
 7158  6382  
 7158  6382  ; get statistics operation only allowed if statistics wanted
 7159  6382  c. q1                   ;
 7160  6382  i18 = a0>q36            ; statistics wanted
 7161  6382  z.                      ;
 7162  6382  c. -q1-1                ;
 7163  6382  i18 = 0                 ; statistics not wanted
 7164  6382  z.                      ;
 7165  6382  
 7165  6382  ; oper and mode masks for disc driver message
 7166  6382  
 7166  6382  ; op: sense  init.  read   write  clean  pos.   stat.  regr.   cont.
 7167  6382  i1  : a0>q30       +a0>q32+a0>q33       +a0>q35+i18; logical
 7168  6384        a0>q30+a0>q31+a0>q32+a0>q33+a0>q34+a0>q35+i18+a0>q39+a0>q38; physical
 7169  6386      ; physical driver modes (all):
 7170  6386  i0  : a0>0+i3+i4+i5+i6+i7+i8+i9+i10+i11+i12+i13+i14+i15+i16+i17
 7171  6388      ; logical driver modes at output (all except addrmarks):
 7172  6388  i2  : a0>0   +i4   +i6   +i8   +i10    +i12    +i14    +i16
 7173  6390  \f


 7173  6390  
 7173  6390  \f


 7173  6390  ; pej 22.09.77    disc driver, link message
 7174  6390  
 7174  6390  ; l i n k   m e s s a g e   t o   d i s c   d r i v e r
 7175  6390  ; ---------------------------------------------------------------
 7176  6390  
 7176  6390  ; this routine is entered when a message received by an area
 7177  6390  ; process or a disc driver has been checked. the message is
 7178  6390  ; linked to the physical disc driver and curr receiver will
 7179  6390  ; be changed accordingly.
 7180  6390  ; 
 7181  6390  ; please note that the buffer is not claimed by the driver during
 7182  6390  ; the processing. the claiming takes place when the answer is re-
 7183  6390  ; turned, see procedure deliver result.
 7184  6390  
 7184  6390  ; change curr receiver into physical driver.
 7185  6390  j30 : rl  w1     b19    ; link message: c. w2 = curr buf;
 7186  6392        rs  w1  x2+m10    ;   device.curr buf:= curr receiver;
 7187  6394        rl  w1  x1+p2     ;   if mainproc.curr receiver <> 0 then
 7188  6396        sn  w1     0      ;   begin c. curr rec = logical driver;
 7189  6398        jl.        j32.   ;     curr receiver:= mainproc.curr rec;
 7190  6400        rs  w1     b19    ;   end;
 7191  6402  
 7191  6402  ; link the message by calling procedure link operation which
 7192  6402  ; will continue in case the driver is idle or otherwise will
 7193  6402  ; jump to waitnext in driver proc.
 7194  6402  j32 : jl  w3     g17    ;   link operation(curr buf);
 7195  6404        jl.        j50.   ;   goto process next message;
 7196  6406        z.                ;
 7197  6406  \f


 7197  6406  ; pej 22.09.77    disc driver, message not accepted
 7198  6406  
 7198  6406  ; m e s s a g e   n o t   a c c e p t e d
 7199  6406  ; ---------------------------------------------------------------
 7200  6406  
 7200  6406  ; the routines are entered when a message received by an area
 7201  6406  ; process or a disc driver can not be accepted. the message
 7202  6406  ; is answered and continuation takes place at waitnext in driver
 7203  6406  ; proc.
 7204  6406  
 7204  6406  j35 : rl  w0     g49    ; document not found:
 7205  6408        jl.        j41.   ;   status:= bit 0; c. intervention;
 7206  6410  
 7206  6410  j37 : rl  w0     g62    ; outside:
 7207  6412                          ;   status:= bit 5; c. end medium;
 7208  6412  
 7208  6412  j41 : rs  w0     g20    ;   status.i/o answer:= status; c. w0;
 7209  6414        ld  w1    -100    ;   bytes.i/o answer:=
 7210  6416        ds  w1     g22    ;   chars.i/o answer:= 0;
 7211  6418        jl         g7     ;   goto result 1; c. cont. at waitnext;
 7212  6420  \f


 7212  6420  
 7212  6420  ; pej 20.09.77    disc driver, check area process
 7213  6420  
 7213  6420  ; procedure check area process
 7214  6420  ; ---------------------------------------------------------------
 7215  6420  ;
 7216  6420  ; the procedure performs:
 7217  6420  ; - checks if no of segments.curr receiver (= area proc) >= 0.
 7218  6420  ; - searches for document.curr receiver if device addr.curr
 7219  6420  ;   receiver = 0 and initializes device addr.curr receiver.
 7220  6420  ; - changes curr receiver to device addr.curr receiver .
 7221  6420  ;    (i.e. to disc driver).
 7222  6420  ;
 7223  6420  ; registers: call              exit
 7224  6420  ; w0                           destroyed
 7225  6420  ; w1                           area proc (= curr receiver at call)
 7226  6420  ; w2                           curr buf
 7227  6420  ; w3         link              curr receiver
 7228  6420  ;
 7229  6420  ; entry    : j1
 7230  6420  ;
 7231  6420  ; return   : link+0: no of segments.area proc < 0
 7232  6420  ;            link+2: document not found
 7233  6420  ;            link+4: normal return
 7234  6420  b. i2 w.
 7235  6420  j1  : rs. w3     i0.    ; check area proc: save link;
 7236  6422        rl  w1     b19    ;
 7237  6424        rl  w3  x1+a61    ;
 7238  6426        sh  w3    -1      ;   if no of segms.curr receiver < 0
 7239  6428        jl.       (i0.)   ;   then outside return; c. link;
 7240  6430        rl  w3  x1+a50    ;
 7241  6432        se  w3     0      ;   if device addr.curr receiver = 0 then
 7242  6434        jl.        i1.    ;   begin
 7243  6436        al  w2  x1+a62    ;     name:= document.curr receiver;
 7244  6438        dl  w1     d72    ;     base:= max interval;
 7245  6440        jl  w3     d71    ;     search name(name,entry,base);
 7246  6442        rl  w1     b19    ;
 7247  6444        sn  w3    (b7)    ;     if entry = nametable end
 7248  6446        jl.        i2.    ;     then goto doc not found return;
 7249  6448        rl  w3  x3+0      ;     device addr.curr receiver:=
 7250  6450        rs  w3  x1+a50    ;     core(entry);
 7251  6452  i1  : rl  w2     b18    ;   end;
 7252  6454        rs  w3     b19    ;   curr receiver:=device addr.curr receiver;
 7253  6456        am.       (i0.)   ;
 7254  6458        jl         4      ;   normal return; c. link+4;
 7255  6460  i2  : am.       (i0.)   ; doc not found return;
 7256  6462        jl         2      ;   goto link+2;
 7257  6464  
 7257  6464  ; variables
 7258  6464  i0  : 0                 ; saved link
 7259  6466  e.
 7260  6466        c.         q0     ;
 7261  6466  \f


 7261  6466  ; pej 21.09.77    disc driver, check message
 7262  6466  
 7262  6466  ; procedure check message(top segment,bytes per segment)
 7263  6466  ; ---------------------------------------------------------------
 7264  6466  ; top segment      : highest allowed segment no + 1.
 7265  6466  ; bytes per segment: no of bytes to be transferred per segment.
 7266  6466  ;
 7267  6466  ; the procedure performs:
 7268  6466  ; - zeroizes retryinformation.curr buf.
 7269  6466  ; - checks that 0 <= first segment.curr buf < top segment (not
 7270  6466  ;   for sense, initialize, get statistics).
 7271  6466  ; - sets segms wanted.curr buf and remaining segms.curr buf
 7272  6466  ;   and no of segments.curr buf to:
 7273  6466  ;   (lastaddr.curr buf + 2 - firstaddr.curr buf)/bytes per segm.
 7274  6466  ;   (undefined for sense, initialize, get statistics).
 7275  6466  ;
 7276  6466  ; registers: call              exit
 7277  6466  ; w0         top segment       destroyed
 7278  6466  ; w1         bytes per segm.   unchanged
 7279  6466  ; w2         curr buf          unchanged
 7280  6466  ; w3         link              destroyed
 7281  6466  ;
 7282  6466  ; entry    : j2
 7283  6466  ;
 7284  6466  ; return   : link+0: first segment.curr buf outside limits
 7285  6466  ;            link+2: normal return
 7286  6466  b. i2  w.
 7287  6466  j2  : rs. w3     i0.    ; check message: save link;
 7288  6468        al  w3     0      ;
 7289  6470        hs  w3  x2+m6     ;   retryinformation.curr buf:= 0;
 7290  6472        rl  w3  x2+m4     ;
 7291  6474        sl  w3     0      ;   if first segment.curr buf >= 0
 7292  6476        sl  w3    (0)     ;   and first segm.curr buf < top segment
 7293  6478        jl.        i2.    ;   then
 7294  6480        rl  w3  x2+m3     ;   begin
 7295  6482        al  w3  x3+2      ;     segments wanted:=
 7296  6484        ws  w3  x2+m2     ;     (lastaddr.curr buf + 2
 7297  6486        al  w2     0      ;      - first addr.curr buf)
 7298  6488        wd  w3     2      ;     / bytes per segment;
 7299  6490        rl  w2     b18    ;     segments possible:=
 7300  6492        ws  w0  x2+m4     ;     top segment - first segm.curr buf;
 7301  6494        sh  w0  x3+0      ;
 7302  6496        rl  w3     0      ;     s:= min(segms wanted,segms poss.);
 7303  6498        hs  w3  x2+m5     ;     no of segments.curr buf:=
 7304  6500        hs  w3  x2+m8     ;     segments wanted.curr buf:=
 7305  6502        hs  w3  x2+m9     ;     remaining segments.curr buf:= s;
 7306  6504  i1  : am.       (i0.)   ; normal: normal return; c. link+2;
 7307  6506        jl         2      ;   end
 7308  6508  i2  : bz  w3  x2+m0     ;   else
 7309  6510       se  w3  q39       ; if operation.curr = set regret or
 7310  6512        sn  w3     q30    ;    operation.curr buf = sense
 7311  6514        jl.        i1.    ;
 7312  6516        se  w3     q31    ;   or operation.curr buf = initialize
 7313  6518        sn  w3     q36    ;   or operation.curr buf = get statist.
 7314  6520        jl.        i1.    ;   then goto normal
 7315  6522        jl.       (i0.)   ;   else outside return; c. link+0;
 7316  6524  
 7316  6524  ; variables
 7317  6524  i0  : 0                 ;
 7318  6526  e.
 7319  6526  \f


 7319  6526  ; pej 21.09.77    disc driver, transform first segment
 7320  6526  
 7320  6526  ; procedure transform first segment(area process)
 7321  6526  ; ---------------------------------------------------------------
 7322  6526  ; area process: addr of area proc which received curr buf.
 7323  6526  ;
 7324  6526  ; the procedure performs:
 7325  6526  ; - transforms first segment.buf from being a segment no relative
 7326  6526  ;   to bs-area start into being a segment no relative to start
 7327  6526  ;   of (physical or logical) disc.
 7328  6526  ;
 7329  6526  ; registers: call              exit
 7330  6526  ; w0                           destroyed
 7331  6526  ; w1         area process      curr receiver
 7332  6526  ; w2         curr buf          unchanged
 7333  6526  ; w3         link              destroyed
 7334  6526  ;
 7335  6526  ; entry    : j3
 7336  6526  ;
 7337  6526  ; return   : link+0
 7338  6526  b. i0 w.
 7339  6526  j3  : rs. w3     i0.    ; transform first segment: save link;
 7340  6528        al  w3     0      ;
 7341  6530        rl  w0  x2+m4     ;   no of slices:=
 7342  6532        am        (b19)   ;   first segment.curr buf
 7343  6534        wd  w0     p1     ;   / slicelength.curr receiver;
 7344  6536        rs  w3  x2+m4     ;   first segment.curr buf:= remainder;
 7345  6538        rl  w2  x1+a60    ;   index:=
 7346  6540        rl  w1     b19    ;   first slice.area proc
 7347  6542        wa  w2  x1+p0     ;   + chaintable.curr receiver;
 7348  6544        jl  w3     d74    ;   follow chain(noof slices,index,slice);
 7349  6546        ws  w2  x1+p0     ;   slice:= slice - chaintable.curr rec;
 7350  6548        al  w0  x2+0      ;
 7351  6550        rl  w2     b18    ;
 7352  6552        wm  w0  x1+p1     ;   first segment.curr buf:=
 7353  6554        wa  w0  x2+m4     ;   slice * slicelength.curr receiver
 7354  6556        rs  w0  x2+m4     ;   + first segment.curr buf;
 7355  6558        jl.       (i0.)   ;   return;
 7356  6560  
 7356  6560  ; variables
 7357  6560  i0  : 0                 ; saved link
 7358  6562  e.
 7359  6562  \f


 7359  6562  ; pej 21.09.77    disc driver, prepare consecutive segments
 7360  6562  
 7360  6562  ; procedure prepare consecutive segments(proc)
 7361  6562  ; ---------------------------------------------------------------
 7362  6562  ; proc: addr of disc proc descr containing sliceinformation.
 7363  6562  ;
 7364  6562  ; the procedure performs:
 7365  6562  ; - initializes no of segments.curr buf by the largest possible
 7366  6562  ;   number of adjecent segments which can be transferred from
 7367  6562  ;   first segment.curr buf and on.
 7368  6562  ; - sets next segment.curr buf to a value which may be used as
 7369  6562  ;   first segment in the next call of this procedure.
 7370  6562  ;
 7371  6562  ; note: must only be called in connection with message origi-
 7372  6562  ;       nating from an area process.
 7373  6562  ;
 7374  6562  ; registers: call               exit
 7375  6562  ; w0                            destroyed
 7376  6562  ; w1         proc               unchanged
 7377  6562  ; w2         curr buf           unchanged
 7378  6562  ; w3         link               destroyed
 7379  6562  ;
 7380  6562  ; entry    : j4
 7381  6562  ;
 7382  6562  ; return   : link+0
 7383  6562  b. i3 w.
 7384  6562  j4  : rs. w3     i0.    ; prepare consecutive segments:
 7385  6564        bz  w3  x2+m9     ;   save link;
 7386  6566        rs. w3     i1.    ;   remaining:= remaining segms.curr buf;
 7387  6568        rl  w3  x2+m4     ;
 7388  6570        al  w2     0      ;   slice:= first segment.curr buf
 7389  6572        wd  w3  x1+p1     ;           / slicelength.proc
 7390  6574        wa  w3  x1+p0     ;           + chaintable.proc;
 7391  6576        ws  w2  x1+p1     ;   segments possible:= slicelength.proc
 7392  6578        ac  w0  x2+0      ;   - first segm.curr buf mod slicel.proc;
 7393  6580  i2  : bl  w2  x3+0      ;   while core(slice) = 1
 7394  6582        sn  w2     1      ;   and segments possible < remaining do
 7395  6584        sl. w0    (i1.)   ;   begin
 7396  6586        jl.        i3.    ;     slice:= slice + 1;
 7397  6588        al  w3  x3+1      ;     segments possible:=
 7398  6590        wa  w0  x1+p1     ;     segments possible+slicelength.proc;
 7399  6592        jl.        i2.    ;   end;
 7400  6594  i3  : ba  w3  x3+0      ;
 7401  6596        ws  w3  x1+p0     ;   next segment.curr buf:=
 7402  6598        wm  w3  x1+p1     ;   (slice + core(slice) - chaintab.proc)
 7403  6600        rl  w2     b18    ;   * slicelength.proc;
 7404  6602        rs  w3  x2+m7     ;
 7405  6604        sl. w0    (i1.)   ;   if segments possible >= remaining
 7406  6606        rl. w0     i1.    ;   then segments possible:= remaining;
 7407  6608        hs  w0  x2+m5     ;   no of segms.curr buf:= segms possible;
 7408  6610        jl.       (i0.)   ;   return;
 7409  6612  
 7409  6612  ; variables
 7410  6612  i0  : 0                 ; saved link
 7411  6614  i1  : 0                 ; remaining (from rem.segms.curr buf)
 7412  6616  e.
 7413  6616  \f


 7413  6616  
 7413  6616  ; pej 04.10.77    disc driver, proc copy statistics
 7414  6616  
 7414  6616  ; procedure copy statistics(result,words)
 7415  6616  ; ---------------------------------------------------------------
 7416  6616  ; result: see proc copy to buffer.
 7417  6616  ; words : no of words copied.
 7418  6616  ;
 7419  6616  ; the procedure performs:
 7420  6616  ; - copies the number of words specified in curr buf from
 7421  6616  ;   statistics of curr receiver.
 7422  6616  ; - zeroizes the statistics area if copy ok.
 7423  6616  ;
 7424  6616  ; registers: call              exit
 7425  6616  ; w0                           result if result <> ok return
 7426  6616  ; w1         curr receiver     destroyed
 7427  6616  ; w2         curr buf          curr receiver if normal return
 7428  6616  ; w3         link              words if normal return
 7429  6616  ;
 7430  6616  ; entry    : j5
 7431  6616  ;
 7432  6616  ; return   : link+0: not enough room in buf for statistics
 7433  6616  ;            link+2: result <> ok
 7434  6616  ;            link+4: normal return
 7435  6616  c. q1
 7436  6616  b. i8 w.
 7437  6616  j5  : al  w0     2      ; copy statistics:
 7438  6618        wa  w0  x2+m3     ;   bytes:= 2 + lastaddr.curr buf
 7439  6620        ws  w0  x2+m2     ;           - firstaddr.curr buf;
 7440  6622        la  w0     g50    ;   make bytes even;
 7441  6624        sl  w0     p50    ;   if bytes < length of statistics
 7442  6626        jl.        i2.    ;
 7443  6628        jl      x3+0      ;   then no room return;
 7444  6630  i2  : al  w3  x3+2      ;   link:= link + 2;
 7445  6632        rs. w3     i0.    ;   save link;
 7446  6634        rs. w0     i1.    ;   save bytes;
 7447  6636        al  w1  x1+p40    ;   first:= addr of statistics.curr rec;
 7448  6638        rs. w1     i6.     ;
 7449  6640        wa  w1     0       ;
 7450  6642        al  w1  x1-2       ;
 7451  6644        rs. w1     i7.     ;
 7452  6646        al. w1     i5.     ;
 7453  6648        jd         1<11+84 ;
 7454  6650        se  w0     0      ;   if result <> 0
 7455  6652        jl.       (i0.)   ;   then return; c. link + 2;
 7456  6654        rl  w2     b19    ;
 7457  6656        al  w1  x2+p40    ;   i:= addr of statistics.curr rec;
 7458  6658        al  w3  x1+p50    ;
 7459  6660        al  w0     0      ;   repeat
 7460  6662  i3  : rs  w0  x1+0      ;     curr receiver(i):= 0;
 7461  6664        al  w1  x1+2      ;     i:= i + 2
 7462  6666        se  w1  x3+0      ; 
 7463  6668        jl.        i3.    ;   until i = top of statistics;
 7464  6670        al  w0    -1      ;   entry:= 1st error segment.curr rec;
 7465  6672        al  w3  x2+p46    ;   repeat
 7466  6674  i4  : rs  w0  x3+0      ;     segment no.entry:= -1;
 7467  6676        al  w3  x3+6      ;     entry:= entry + 1
 7468  6678        se  w3  x2+p46+q2*6;
 7469  6680        jl.        i4.    ;   until entry = top entry;
 7470  6682        rl. w3     i1.    ;
 7471  6684        ls  w3    -1      ;   words:= bytes / 2;
 7472  6686        am.       (i0.)   ;
 7473  6688        jl         2      ;   return; c. link + 4;
 7474  6690  
 7474  6690  ; variables
 7475  6690  i0  : 0                 ; saved link
 7476  6692  i1  : 0                 ; saved bytes
 7477  6694  
 7477  6694  i5:   2<1+1              ; function
 7478  6696  i6:   0                  ; first
 7479  6698  i7:   0                  ; last
 7480  6700        0                  ; relative
 7481  6702  e.
 7482  6702  z.
 7483  6702  
 7483  6702  \f


 7483  6702  
 7483  6702  ; pej 30.09.77    disc driver, initialize disc
 7484  6702  
 7484  6702  ; procedure initialize disc
 7485  6702  ; ---------------------------------------------------------------
 7486  6702  ;
 7487  6702  ; the procedure performs:
 7488  6702  ; - sets no of segments per cylinder and displacement of sector
 7489  6702  ;   zero on odd cylinders and the disctype in the driver process
 7490  6702  ;   description from information supplied in curr buf.
 7491  6702  ; - sets state.curr receiver to ready indicating that define disc
 7492  6702  ;   should not be executed.
 7493  6702  ; - sets initdisc.curr receiver = 1.
 7494  6702  ;
 7495  6702  ; registers: call              exit
 7496  6702  ; w0                           destroyed
 7497  6702  ; w1         curr receiver     unchanged
 7498  6702  ; w2         curr buf          unchanged
 7499  6702  ; w3         link              destroyed
 7500  6702  ;
 7501  6702  ; entry    : j6
 7502  6702  ;
 7503  6702  ; return   : link+0
 7504  6702  b. i0 w.
 7505  6702  j6  : rs. w3     i0.    ; initialize disc:
 7506  6704        rl  w0  x2+m2     ;
 7507  6706        wm  w0  x1+p6     ;   no of segments per cyl.curr rec:=
 7508  6708        rs  w0  x1+p8     ;   no of heads.curr buf
 7509  6710        rl  w0  x2+m3     ;   * no of segments per track.curr rec;
 7510  6712        rs  w0  x1+p9     ;   displacement.curr rec:= disp.curr buf;
 7511  6714        rl  w0  x2+m4     ;   disctype.curr receiver:=
 7512  6716        rs  w0  x1+p5     ;   disctype.curr buf;
 7513  6718        al  w0     2      ;
 7514  6720        rs  w0  x1+p12    ;   state.curr receiver:= ready;
 7515  6722        al  w0     1      ;
 7516  6724        hs  w0  x1+p14    ;   initdisc.curr receiver:= 1;
 7517  6726        jl.       (i0.)   ;   return;
 7518  6728  
 7518  6728  ; variables
 7519  6728  i0  : 0                 ; saved link
 7520  6730  e.
 7521  6730  \f


 7521  6730  
 7521  6730  ; pej 19.09.77    disc driver, setup channelprogram and start
 7522  6730  
 7522  6730  ; procedure setup channel program and start(kind,result);
 7523  6730  ; ---------------------------------------------------------------
 7524  6730  ; kind  : 0 : setup channel pg according to curr buf.
 7525  6730  ;         q39: define disc, setup read.       (has no connection to
 7526  6730  ;         q39+2: power rest., setup sense.     the commands set regretted and continue )
 7527  6730  ; result: result from procedure start i/o.
 7528  6730  ;
 7529  6730  ; the procedure performs:
 7530  6730  ; - sets up a channelprogram according to either the contents
 7531  6730  ;   of curr buf, a channel program for reading addr mark at
 7532  6730  ;   define disc or a channel program for sensing the disc at
 7533  6730  ;   power restart.
 7534  6730  ;
 7535  6730  ;   please note that if a channelprogram for reading or writing
 7536  6730  ;   is set up according to curr buf, and no of segments.curr buf
 7537  6730  ;   equals zero then firstaddr.curr buf is not used in the
 7538  6730  ;   transfer command as procedure update buf on error may have
 7539  6730  ;   incremented firstaddr.curr buf beyond lastaddr.curr buf.
 7540  6730  ;   instead, to avoid result 3 from start i/o, the transfer
 7541  6730  ;   command will contain a first address pointing into drivers
 7542  6730  ;   process description.
 7543  6730  ; - calls procedure start i/o to start the transfer. the device
 7544  6730  ;   is reset if initdisc.curr receiver <>0, and initdisc:= 0.
 7545  6730  ; - sets segment units.curr receiver at read or write to
 7546  6730  ;   bytes-chars per segment.
 7547  6730  ; - zeroizes remaining bytes, curr status, event status, and
 7548  6730  ;   technical status in the two statusareas.
 7549  6730  ; - zeroizes setmode param.curr receiver if setmode is not used
 7550  6730  ;   (read, write, clean, position).
 7551  6730  ; - continues at waitnext in driver proc if the device is started
 7552  6730  ;   or, if not, returns with a result (see proc start i/o).
 7553  6730  ;
 7554  6730  ; registers: call              exit
 7555  6730  ; w0                           result
 7556  6730  ; w1         kind              channel pg start
 7557  6730  ; w2                           0 or buf
 7558  6730  ; w3         link              device address
 7559  6730  ;
 7560  6730  ; entry    : j0
 7561  6730  ; 
 7562  6730  ; return   : waitnext if ok
 7563  6730  ;            link+0 if error
 7564  6730  
 7564  6730  b. c74, i110, l1, n10 w.
 7565  6730  \f


 7565  6730  ; pej 19.09.77    disc driver, setup channelprogram and start
 7566  6730  
 7566  6730  j0  :                   ; setup channel program and start:
 7567  6730        rs. w3     i0.    ;   save link;
 7568  6732  
 7568  6732  ; initialize according to most frequently used channel pg
 7569  6732        rl. w0     i4.    ;   command.mode.channel pg:= noop;
 7570  6734        rs. w0     c1.    ;   c. do not use strobe-offset;
 7571  6736        rl. w0     i5.    ;   command.first stop.channel pg:= stop;
 7572  6738        rs. w0     c5.    ;   c. not read after write;
 7573  6740        al. w0     c2.    ;
 7574  6742        rs. w0     i1.    ;   startaddr:= first seek.channel pg;
 7575  6744        rl  w2     b18    ;
 7576  6746        sn  w1     0      ;   if kind = 0
 7577  6748        bz  w1  x2+m0     ;   then kind:= operation.curr buf;
 7578  6750        la  w1     g50    ;
 7579  6752        wm  w1     g48    ;   i:= (kind >> 1) << 1 * 3;
 7580  6754        dl. w0  x1+l0.    ;   command.first transfer.channel pg:=
 7581  6756        rs. w3     c3.    ;   operation table(i);
 7582  6758        am        (b19)   ;   transfer state.curr receiver:=
 7583  6760        rs  w0     p13    ;   operation table(i + 2);
 7584  6762        rl. w0  x1+l1.    ;
 7585  6764        rs. w0     i2.    ;   actionaddr:= operation table(i + 4);
 7586  6766  
 7586  6766  ; enter next action with w1 = curr receiver, w2 = curr buf
 7587  6766  i20:  rl  w1     b19    ; central action: w1:= curr receiver;
 7588  6768        rl  w2     b18    ;   w2:= curr buf;
 7589  6770        am.       (i2.)   ;   actionaddr:= actionaddr + 1;
 7590  6772        al  w3     1      ;
 7591  6774        rs. w3     i2.    ;
 7592  6776        ba  w3  x3        ;
 7593  6778        jl      x3        ;   goto actiontable(actionaddr);
 7594  6780  
 7594  6780  ; actiontable
 7595  6780  h.  ;  0   1   2   3   4   5   6   7   8   9   10
 7596  6780  i101:                             n7.,    n9.      ; sense
 7597  6782  i102: n0.,    n2.,        n5.,        n8.,    n10. ; read
 7598  6787  i103: n0.,    n2.,            n6.,    n8.,    n10. ; write
 7599  6792  i104: n0.,        n3.,                n8.,n9.      ; clean
 7600  6796  i105: n0.,                            n8.,n9.      ; position
 7601  6799  i106:     n1.,        n4.,            n8.,n9.      ; define disc
 7602  6803  i107:                             n7.,    n9.      ; power rest.
 7603  6805  w.
 7604  6806  \f


 7604  6806  ; pej 19.09.77    disc driver, setup channelprogram and start
 7605  6806  
 7605  6806  ; action 0, calculate seekinformation (read,write,clean,pos.).
 7606  6806  n0  : rl  w0  x2+m4     ; action 0:
 7607  6808        am     (x2+m10)   ;   s:= first segment.curr buf
 7608  6810        wa  w0     p3     ;   + first segment.device.curr buf;
 7609  6812        ld  w3    -100    ;
 7610  6814        rs  w3  x1+p21    ;   setmode param.curr receiver:= 0;
 7611  6816        wd  w0  x1+p8     ;   cyl:= s / segments per cyl.curr rec;
 7612  6818                          ;   r:= s mod segments per cyl.curr rec;
 7613  6818        wd  w3  x1+p6     ;   head:= r / segms per track.curr rec;
 7614  6820                          ;   sect:= r mod segms per track.curr r;
 7615  6820        sz  w0     2.1    ;   if cyl odd
 7616  6822        wa  w2  x1+p9     ;   then sect:=
 7617  6824        sl  w2 (x1+p6)    ;   (sect + displacement.curr receiver)
 7618  6826        ws  w2  x1+p6     ;   mod segments per track.curr receiver;
 7619  6828  i25:  ls  w0     8      ; insert seekinformation:
 7620  6830        wa  w3     0      ;   c. w0=cyl,w1=curr,w2=sect,w3=head;
 7621  6832        rs  w3  x1+p20    ;   seek param(0).curr receiver:=
 7622  6834        ls  w2     16     ;   cyl << 8 + head;
 7623  6836        wa  w2  x1+p7     ;   seek param(2).curr receiver:=
 7624  6838        rs  w2  x1+p20+2  ;   sect < 16 + flags.curr receiver;
 7625  6840        jl.        i20.   ;   goto central action;
 7626  6842  
 7626  6842  ; action 1, calculate transfer - and seekinformation (define disc)
 7627  6842  n1  : al  w3     p22    ; action 1:
 7628  6844        al  w0     q51    ;   first addr.1st transfer.channel pg:=
 7629  6846        ds. w0     c34.   ;   addr mark.curr receiver;
 7630  6848        rl  w0  x1+p10    ;   charcount.1st transfer.ch pg:=chars;
 7631  6850        rl  w3  x1+p11    ;   cyl:= define disc cyl.curr receiver;
 7632  6852        rl  w2  x1+p6     ;   head:= define disc head.curr rec;
 7633  6854        al  w2  x2-1      ;   sect:= segms per track.curr rec - 1;
 7634  6856        jl.        i25.   ;   goto insert seekinformation;
 7635  6858  
 7635  6858  ; action 2, calculate transferinformation (read,write).
 7636  6858  n2  : dl. w0     i10.   ; action 2:
 7637  6860        ds  w0  x1+p35+2  ;   segment units.curr receiver:=
 7638  6862        bz  w0  x2+m1     ;   chars-bytes per data segment;
 7639  6864        so  w0     q40    ;   if transput mode.curr buf = 1 then
 7640  6866        jl.        i30.   ;   begin c. addr mark mode;
 7641  6868        rl. w0     c3.    ;
 7642  6870        lo. w0     i8.    ;     command.1st transfer.channel pg:=
 7643  6872        rs. w0     c3.    ;     command.1st transfer.channel pg
 7644  6874        rl  w0  x1+p13    ;     +modif;
 7645  6876        ls  w0     -1     ;     transfer state.curr receiver:=
 7646  6878        rs  w0  x1+p13    ;     transfer state.curr receiver >> 1;
 7647  6880        dl. w0     i9.    ;     segment units.curr receiver:=
 7648  6882        ds  w0  x1+p35+2  ;     chars-bytes per addr mark;
 7649  6884                          ;   end;
 7650  6884  i30 : bz  w0  x2+m5     ;
 7651  6886        wm  w0  x1+p35+2  ;   charcount.1st transfer.channel pg:=
 7652  6888        rs. w0     c34.   ;   chars * no of segments.curr buf;
 7653  6890        rl  w1  x2+m2     ;   firstaddr.1st transfer.channel pg:=
 7654  6892        rs. w1     c32.   ;   firstaddr.curr buf;
 7655  6894        se  w0     0      ;   if charcount.1st transfer.ch pg=0 then
 7656  6896        jl.        i20.   ;   begin c. see procedure description;
 7657  6898        rl. w0     c3.    ;
 7658  6900        lo. w0     i11.   ;     addrcode.1st transfer.channel pg:=
 7659  6902        rs. w0     c3.    ;     drivers process;
 7660  6904        al  w0     p20    ;     firstaddr.1st transfer.channel pg:=
 7661  6906        rs. w0     c32.   ;     rel of seek param;
 7662  6908        jl.        i20.   ;   end;
 7663  6910                          ;   goto central action;
 7664  6910  
 7664  6910  ; action 3, insert dummy transfer information (clean track).
 7665  6910  n3  : dl. w1     c24.   ; action 3:
 7666  6912        ds. w1     c34.   ;   parameters.1st transfer.channel pg:=
 7667  6914                          ;   parameters.1st seek.channel pg;
 7668  6914                          ;   c. because of checking in start i-o;
 7669  6914        jl.        i20.   ;   goto central action;
 7670  6916  
 7670  6916  ; action 4, test if strobe-offset used (define disc).
 7671  6916  n4  : bz  w3  x1+p15    ; action 4:
 7672  6918                          ;   retryinf:= retryinf.curr receiver;
 7673  6918        jl.        i35.   ;   goto test mode;
 7674  6920  
 7674  6920  ; action 5, test if strobe-offset used (read).
 7675  6920  n5  : bz  w3  x2+m6     ; action 5: retryinf:= retryinf.curr buf;
 7676  6922                          ; test mode: c. ac3 = retryinf;
 7677  6922  i35 : sh  w3     2.111  ;   if retryinf(0:20) = 0
 7678  6924        jl.        i20.   ;   then goto central action;
 7679  6926        rl. w0     i6.    ;
 7680  6928        rs. w0     c1.    ;   command.mode.channel pg:= setmode;
 7681  6930        ls  w3    -3      ;
 7682  6932        rl. w2     i3.    ;
 7683  6934        la  w2     6      ;   i:= modeindex.retryinf;
 7684  6936        ls  w3    -5      ;   i1:= offset index.retryinf;
 7685  6938        al  w3  x3-1      ;
 7686  6940        bz. w0  x3+q20.   ;
 7687  6942        ba. w0  x2+q21.   ;   setmode param.curr receiver:=
 7688  6944        rs  w0  x1+p21    ;   modetable(i-1)+ offsettable(i1);
 7689  6946        jl.        i20.   ;   goto central action;
 7690  6948  
 7690  6948  ; action 6, test if read after write (write).
 7691  6948  n6  : bz  w3  x2+m1     ; action 6:
 7692  6950        so  w3     q43    ;   if -, read after write.mode.curr buf
 7693  6952        jl.        i20.   ;   then goto central action;
 7694  6954        rl  w0  x1+p13    ;
 7695  6956        ls  w0    -2      ;   transfer state.curr receiver:=
 7696  6958        rs  w0  x1+p13    ;   transfer state.curr receiver >> 2;
 7697  6960        rl. w0     i4.    ;
 7698  6962        rs. w0     c5.    ;   command.1st stop.channel pg:= noop;
 7699  6964        rl. w0     i7.    ;   command:= read with no transfer;
 7700  6966        sz  w3     q40    ;   if transput mode.curr buf = 1
 7701  6968        rl. w0     i7.    ;*  then command:= command + modif;
 7702  6970        rs. w0     c7.    ;   command.2nd transfer.channel pg:=
 7703  6972                          ;   command;
 7704  6972        dl. w0     c34.   ;   parameters.2nd transfer.channel pg:=
 7705  6974        ds. w0     c74.   ;   parameters.1st transfer.channel pg;
 7706  6976        se  w0     0      ;   if charcount.2nd transfer.ch pg=0 then
 7707  6978        jl.        j37.   ;
 7708  6980        rl. w0     c7.    ;   addrcode.2nd transfer.channel pg:=
 7709  6982        lo. w0     i11.   ;   drivers process;
 7710  6984        rs. w0     c7.    ;   c. see action 2;
 7711  6986  i37 : bz  w0  x2+m6     ;
 7712  6988        al  w3     0      ;   c. test if write is to be skipped;
 7713  6990        sz  w0     2.111  ;   if readtries.retryinf.curr buf <> 0
 7714  6992        rs. w3     c34.   ;   then charcount.1st transfer.channel pg
 7715  6994        jl.        i20.   ;   := 0;
 7716  6996                          ;   goto central action;
 7717  6996  
 7717  6996  ; action 7, determine startaddress (sense,power restart).
 7718  6996  n7  : bz  w0  x1+p14    ; action 7:
 7719  6998        al. w3     c4.    ;   startaddr:= 1st sense.channel pg;
 7720  7000        se  w0     0      ;   if initdisc.curr receiver <> 0
 7721  7002        al. w3     c3.    ;   then startaddr :=
 7722  7004        rs. w3     i1.    ;   1st transfer.channel pg; c. init;
 7723  7006        jl.        i20.   ;   goto central action;
 7724  7008  
 7724  7008  ; action 8, determine startaddr (read,write,clean,pos,define).
 7725  7008  n8  : bz  w0  x1+p14    ; action 8:
 7726  7010        al. w3     c0.    ;
 7727  7012        se  w0     0      ;   if initdisc.curr receiver <> 0
 7728  7014        rs. w3     i1.    ;   then startaddr:= init.channel pg;
 7729  7016        jl.        i20.   ;   goto central action;
 7730  7018  
 7730  7018  ; action 9, perform start with buf = 0 (all except read,write)
 7731  7018  n9  : al  w2     0      ; action 9: buf:= 0;
 7732  7020        jl.        i40.   ;   goto start;
 7733  7022  
 7733  7022  ; action 10, perform start with buf = curr buf:
 7734  7022  n10 :                   ; action 10: c. buf = curr buf;
 7735  7022  
 7735  7022  ; call start i/o to start the transfer. w1,w2 = curr rec.,buf.
 7736  7022  i40 : ld  w0    -100    ; start:
 7737  7024        ds  w0  x1+p16+4  ;   zeroize rembytes, curr status,
 7738  7026        rs  w0  x1+p16+6  ;     event status, technical status
 7739  7028        rs  w0  x1+p16+20 ;     in statusarea1.curr receiver
 7740  7030        ds  w0  x1+p18+4  ;     and statusarea2.curr receiver;
 7741  7032        rs  w0  x1+p18+6  ;
 7742  7034        rs  w0  x1+p18+20 ;
 7743  7036        hs  w0  x1+p14    ;   initdisc.curr receiver:= 0;
 7744  7038        al  w0     1<2+1  ;   + std exit + start channel pg;
 7745  7040        rl  w3  x1+a235   ;   device addr:= device addr.curr rec;
 7746  7042        rl. w1     i1.    ;
 7747  7044        jd         1<11+100;  start i/o(func,startad,buf,devicead);
 7748  7046        jl.       (i0.)   ;   return;
 7749  7048  
 7749  7048  ; pej 19.09.77    disc driver, setup channelprogram and start
 7750  7048  
 7750  7048  ; variables
 7751  7048  i0  : 0                 ; saved link
 7752  7050  i1  : 0                 ; start addr, in channel pg
 7753  7052  i2  : 0                 ; action addr, index to actiontable
 7754  7054  i3  : 2.11111           ; for masking out offsetindex.retryinf
 7755  7056  i4  : 4095              ; channel pg command = noop
 7756  7058  i5  : 15<8              ;                    = stop
 7757  7060  i6  : 4<12+2<8+1        ;                    = setmode
 7758  7062  i7  : 4095              ;*                   = read, no transfer
 7759  7064  i8  : 1                 ; modifier for addr mark (read,write)
 7760  7066        q50               ;                   bytes per addr mark
 7761  7068  i9  : q51               ; segment unit: +0: chars per addr mark
 7762  7070        q52               ;                   bytes per data segm
 7763  7072  i10 : q53               ; segment unit: +0: chars per data segm
 7764  7074  i11 : 4<12              ; addrcode = drivers process
 7765  7076  
 7765  7076  ; operation table.
 7766  7076  ; the table contains: +0: command for 1st transfer.channel pg
 7767  7076  ;                     +2: transfer state
 7768  7076  ;                     +4: action table base
 7769  7076  ; a row in the table is indexed by: (operation>1)<1*3
 7770  7076  ;   addrcode+command+modif, state, actionbase
 7771  7076  i100: 0<12  +  6<8  +  0,l0:1<20,l1:i101-1   ; + 0: sense
 7772  7082        0<12  +  1<8  +  0  , 1<17 ,  i102-1   ; + 6: read
 7773  7088        0<12  +  3<8  +  0  , 1<15 ,  i103-1   ; +12: write
 7774  7094        4<12  +  3<8  +  3  , 1<18 ,  i104-1   ; +18: clean track
 7775  7100                     4095   , 1<19 ,  i105-1   ; +24: position
 7776  7106        4<12  +  1<8  +  1  , 1<22 ,  i106-1   ; +30: define disc
 7777  7112        0<12  +  6<8  +  0  , 1<21 ,  i107-1   ; +36: power restart
 7778  7118  ;              1 read
 7779  7118  ;                      0 data
 7780  7118  ;                      1 addr mark
 7781  7118  ;              3 write
 7782  7118  ;                      0 data
 7783  7118  ;                      1 addr mark
 7784  7118  ;                      3 clean
 7785  7118  ;              6 init
 7786  7118  ;     0 data area in senders process
 7787  7118  ;     4 data area in drivers process descr
 7788  7118  \f


 7788  7118  ; pej 19.09.77    disc driver, channel program
 7789  7118  
 7789  7118  ; c h a n n e l   p r o g r a m
 7790  7118  
 7790  7118  ;                                 addrcode  command  params
 7791  7118  
 7791  7118  ; init after error
 7792  7118  c0  :       6<8   ; init          irrel     init
 7793  7120        0           ;                                  irrel
 7794  7122        0           ;                                  irrel
 7795  7124  
 7795  7124  ; normal starting point
 7796  7124  c2  : 4<12+ 2<8   ; 1st seek      device    seek
 7797  7126  c22 : p20         ;                                  paramaddr
 7798  7128  c24 : 6           ;                                  charcount
 7799  7130  c1  : 4<12+ 2<8+1 ; mode          device    setmode
 7800  7132        p21         ;                                  paramaddr
 7801  7134        3           ;                                  charcount
 7802  7136  c3  : 0           ; 1st transfer
 7803  7138  c32 : 0           ;
 7804  7140  c34 : 0           ;
 7805  7142  c4  : 4<12+ 0<8   ; 1st sense     device    sense
 7806  7144        p16         ;                                  statusarea1
 7807  7146        33          ;                                  max charcount
 7808  7148  
 7808  7148  ; stop unless read after write
 7809  7148  c5  :      15<8   ; 1st stop      irrel     stop
 7810  7150        0           ;                                  irrel
 7811  7152        40000       ;                                  timer, 0.1 ms
 7812  7154  
 7812  7154  ; checkread
 7813  7154  c6  : 4<12+ 2<8   ; 2nd seek      device    seek
 7814  7156        p20         ;                                  paramaddr
 7815  7158        6           ;                                  charcount
 7816  7160  c7  : 0           ; 2nd transfer
 7817  7162  c72 : 0           ;
 7818  7164  c74 : 0           ;
 7819  7166  c8  : 4<12+ 0<8   ; 2nd sense     device    sense
 7820  7168        p18         ;                                  statusarea2
 7821  7170        33          ;                                  max charcount
 7822  7172  
 7822  7172  ; stop
 7823  7172  c9  :      15<8   ; 2nd stop      irrel     stop
 7824  7174        0           ;                                  irrel
 7825  7176        40000       ;                                  timer, 0.1 ms
 7826  7178  
 7826  7178  e.
 7827  7178  \f


 7827  7178  
 7827  7178  ; pej 22.09.77    disc driver, process next message
 7828  7178  
 7828  7178  ; p r o c e s s   n e x t   m e s s a g e
 7829  7178  ; ---------------------------------------------------------------
 7830  7178  
 7830  7178  ; this routine is entered when the next message is to be proces-
 7831  7178  ; sed by the disc driver. the routine is entered either from link
 7832  7178  ; message routine (driver able to process a received message
 7833  7178  ; immediately) or when an answer to a processed message has been
 7834  7178  ; delivered and more messages are queued to the driver. curr buf
 7835  7178  ; contains addr of buffer to be processed.
 7836  7178  
 7836  7178  ; check if message is get statistics message
 7837  7178                          ; process next message:
 7838  7178  j50 : al  w0     0      ;   c. w1 = curr receiver, w2 = curr buf;
 7839  7180        hs  w0  x1+p15    ;   retryinf.curr receiver:= 0;
 7840  7182        bz  w0  x2+m0     ;
 7841  7184        c.         q1     ;   if statistics wanted
 7842  7184        se  w0     q36    ;   and operation.curr buf = get stat then
 7843  7186        jl.        j52.   ;   begin
 7844  7188        jl. w3     j5.    ;     copy statistics(result,words);
 7845  7190        jl.        j90.   ;     if no room then goto deliv. blockl;
 7846  7192        jl.        j102.  ;     if -, ok then goto status/segms 0;
 7847  7194        jl.        j94.   ;     goto deliver words wanted;
 7848  7196        z.                ;   end;
 7849  7196  
 7849  7196  ; check if message is initialize message
 7850  7196  j52 : se  w0     q31    ;   if operation.curr buf = init then
 7851  7198        jl.        j53.   ;   begin
 7852  7200        jl. w3     j6.    ;     initialize disc;
 7853  7202        jl.        j101.  ;     goto deliver size zero;
 7854  7204                          ;   end;
 7855  7204  
 7855  7204  
 7855  7204  ; check if message is set regretted
 7856  7204  j53 : se  w0     q39    ;   if operation.curr buf = set regretted then
 7857  7206        jl.        j55.   ;   begin
 7858  7208        al  w0     3      ;     set regretted.curr receiver = 3
 7859  7210        rs  w0  x1+a56    ;     deliver result 1
 7860  7212        al  w0  0         ;
 7861  7214        rs  w0  g20       ; deliver status 0
 7862  7216  
 7862  7216        jl         g7     ;   end
 7863  7218  \f


 7863  7218  ; pej 22.09.77    disc driver, start device
 7864  7218  
 7864  7218  ; s t a r t   d e v i c e
 7865  7218  ; ---------------------------------------------------------------
 7866  7218  
 7866  7218  ; this routine is executed to start the device and is entered
 7867  7218  ; from process next message routine or when an operation is to
 7868  7218  ; be repeated. the disc is started according to the contents of
 7869  7218  ; curr buffer.
 7870  7218  ;
 7871  7218  ; if the disc is not yet defined (state.curr receiver <> ready)
 7872  7218  ; then a special transfer is activated to check number of heads
 7873  7218  ; and displacement of sector zero on odd cylinders. curr buf is
 7874  7218  ; left in the head of the queue and will be processed when the
 7875  7218  ; disc has been defined. regretted.curr receiver will be odd
 7876  7218  ; during define disc so as to avoid a start (this might happen if
 7877  7218  ; curr buf is regretted and the queue turns empty).
 7878  7218  ;
 7879  7218  ; continuation takes place at waitnext in driverproc.
 7880  7218  
 7880  7218  ; set up channel program for contents of curr buf
 7881  7218  j55 : rl  w1     b19    ; start:
 7882  7220        rl  w0  x1+p12    ;
 7883  7222        se  w0     2      ;   if state.curr receiver = ready then
 7884  7224        jl.        j57.   ;   begin
 7885  7226        c.         q1     ;     if statistics wanted
 7886  7226        am     (x1+p40)   ;
 7887  7228        al  w0     1      ;     then no of transfers.curr rec:=
 7888  7230        rs  w0  x1+p40    ;     no of transfers.curr rec + 1;
 7889  7232        z.                ;
 7890  7232        al  w1     0      ;     kind:= 0; c. use curr buf;
 7891  7234        jl. w3     j0.    ;     setup channel pg and start(kind);
 7892  7236        se  w0     3      ;     if result <> 3
 7893  7238        jl.        j101.  ;     then goto deliver size zero
 7894  7240        jl.        j99.   ;     else goto deliver unintilligible;
 7895  7242                          ;   end;
 7896  7242  
 7896  7242  ; setup channel program for define disc
 7897  7242  j57 : se  w0     0      ;   if state.curr rec = after interv then
 7898  7244        jl.        j59.   ;   begin
 7899  7246        rs  w0  x1+p10    ;     define disc cyl.curr receiver:= 0;
 7900  7248        rs  w0  x1+p11    ;     define disc head.curr receiver:= 0;
 7901  7250        hs  w0  x1+p15    ;     retryinformation.curr receiver:= 0;
 7902  7252        al  w0     1      ;     state.curr receiver:= defining disc;
 7903  7254        rs  w0  x1+p12    ;     regretted.curr receiver:= 1;
 7904  7256        rs  w0  x1+a56    ;     disctype.curr receiver:= 1;
 7905  7258        rs  w0  x1+p5     ;     initdisc.curr receiver:= 1;
 7906  7260        hs  w0  x1+p14    ;   end;
 7907  7262  j59 : al  w1     q39    ;
 7908  7264        jl. w3     j0.    ;   setup channel pg and start(kind);
 7909  7266  \f


 7909  7266  ; pej 26.09.77    disc driver, interrupt received
 7910  7266  
 7910  7266  ; i n t e r r u p t   r e c e i v e d
 7911  7266  ; ---------------------------------------------------------------
 7912  7266  ;
 7913  7266  ; this routine is entered when driver proc receives an interrupt
 7914  7266  ; operation for a disc driver. the i/o result stored in the
 7915  7266  ; device description indicates the event leading to generation of
 7916  7266  ; the interrupt operation:
 7917  7266  ;
 7918  7266  ; i/o result 0: normal termination, interrupt from device.
 7919  7266  ;            1: bus reject, busy  , device not started.
 7920  7266  ;            2: bustimeout, discon, -      -   -
 7921  7266  ;            3: software timeout  , software generated.
 7922  7266  ;            4: abnormal terminat., interrupt from device.
 7923  7266  ;            5: wait pg. terminat., -         -    -
 7924  7266  ;            6: power restart     , software generated.
 7925  7266  
 7925  7266  ; form the compoundstatus from i/o result and all statuswords
 7926  7266  ; (curr status, event status) generated by the device.
 7927  7266  c34 : rl  w3     b19    ; interrupt received:
 7928  7268        rl  w0  x3+a230   ;   if channel pg count.std status = 0
 7929  7270        sn  w0     0      ;   then
 7930  7272        am      p16+6-a233;   curr-event:= curr-event.statusarea1
 7931  7274        dl  w1  x3+a233   ;   else curr-event:=curr-event.stdstatus;
 7932  7276        lo  w0  x3+p16+4  ;   curr:= curr or curr.statusarea1;
 7933  7278        lo  w1  x3+p16+6  ;   event:= event or event.statusarea1;
 7934  7280        rl  w2  x3+p16+20 ;   tech:= techn status.statusarea1;
 7935  7282        lo  w0  x3+p18+4  ;   curr:= curr or curr.statusarea2;
 7936  7284        lo  w1  x3+p18+6  ;   event:= event or event.statusarea2;
 7937  7286        lo  w2  x3+p18+20 ;   tech:= tech or tech.statusarea2;
 7938  7288        ds  w1  x3+p31+2  ;   curr-event.curr rec:= curr-event;
 7939  7290        rs  w2  x3+p33    ;   technical status.curr rec:= tech;
 7940  7292        jl. w3     j8.    ;   compoundstatus(curr,event,compound);
 7941  7294        rs  w0  x1+p34    ;   compound status.curr rec:= compound;
 7942  7296  
 7942  7296  ; check if compound status is ok with respect to actual transfer.
 7943  7296        rl  w3  x1+p13    ;
 7944  7298        ls  w3    -1      ;   i:= transfer state.curr rec >> 1;
 7945  7300        ns. w3     3      ;   sh:= no of shifts to normalize i;
 7946  7302        ac  w3  ; -sh     ;
 7947  7304        ls  w3     2      ;   sh:= sh * 4;
 7948  7306        rl  w2     b18    ;   c. w1 = curr rec, w2 = curr buf;
 7949  7308        sz. w0 (x3+i20.)  ;   if compound and table(sh) <> 0
 7950  7310        jl.        j125.  ;   then goto error
 7951  7312        jl.    (x3+i21.)  ;   else goto table(sh+2);
 7952  7314  
 7952  7314  ; table to determine if transfer was successful. an entry corre-
 7953  7314  ; sponds to a transfer state and contains:
 7954  7314  ; +0: mask which anded to compound status must give zero.
 7955  7314  ; +2: addr where to continue.
 7956  7314  ;     mask        addr    transfer state
 7957  7314  i20 :  -1 , i21 : j125  ; bit  0, idle (will always go to error)
 7958  7318        i23 ,       j85   ;      1, define disc
 7959  7322        i25 ,       j87   ;      2, power restart
 7960  7326        i23 ,       j75   ;      3, sense
 7961  7330        i23 ,       j75   ;      4, position
 7962  7334        i24 ,       j75   ;      5, clean track
 7963  7338        i23 ,       j77   ;      6, read data
 7964  7342        i23 ,       j77   ;      7, read addr mark
 7965  7346        i24 ,       j77   ;      8, write data
 7966  7350        i24 ,       j77   ;      9, write addr mark
 7967  7354        i24 ,       j77   ;     10, read after write data
 7968  7358        i24 ,       j77   ;     11, read after write addr mark
 7969  7362  
 7969  7362  ; masks, normal term (bit 19) not checked. must be 1.
 7970  7362  i23 = 8.77617757        ; input ok, bits not checked: 8,9,10
 7971  7362                          ;  (write protect, high density, mode)
 7972  7362  i24 = 8.77737757        ; output ok, bits not checked: 9
 7973  7362                          ;  (high density)
 7974  7362  i25 = 8.37617757        ; power ok, bits not checked: 0,8,9,10
 7975  7362                          ;  (intervention, write protect, high
 7976  7362                          ;   density, mode)
 7977  7362  \f


 7977  7362  ; pej 26.09.77    disc driver, successful transfer
 7978  7362  
 7978  7362  ; s u c c e s s f u l   t r a n s f e r
 7979  7362  ; ---------------------------------------------------------------
 7980  7362  
 7980  7362  ; these routines are entered when a transfer is regarded success-
 7981  7362  ; ful. w1 = curr receiver, w2 = curr buf.
 7982  7362  
 7982  7362  ; c o n t r o l   s u c c e s s f u l
 7983  7362  j75 : rl  w0  x1+a56    ; control ok:
 7984  7364        se  w0     0      ;   if regretted.curr receiver
 7985  7366        jl.        j110.  ;   then goto examine queue;
 7986  7368        c.         q1     ;   if statistics wanted
 7987  7368        bz  w0  x2+m6     ;
 7988  7370        se  w0     0      ;   and retryinf.curr buf <> 0
 7989  7372        jl. w3     j17.   ;   then update on corrected error;
 7990  7374        z.                ;
 7991  7374        jl.        j101.  ;   goto deliver size zero;
 7992  7376  
 7992  7376  ; t r a n s p u t   s u c c e s s f u l
 7993  7376  j77 : al  w0     0      ; transput ok:
 7994  7378        sn  w0 (x1+p16+2) ;   if rembytes.statusarea1.curr rec <> 0
 7995  7380        se  w0 (x1+p18+2) ;   or rembytes.statusarea2.curr rec <> 0
 7996  7382        jl.        j125.  ;   then goto error;
 7997  7384        al  w3     1      ;
 7998  7386        rl  w0  x1+p21    ;   if setmode param.curr receiver <> 0
 7999  7388        se  w0     0      ;   then initdisc.curr receiver:= 1;
 8000  7390        hs  w3  x1+p14    ;   c. force heads back to nominal pos;
 8001  7392        c.         q1     ;   if statistics wanted
 8002  7392        bz  w0  x2+m6     ;
 8003  7394        se  w0     0      ;   and retryinf.curr buf <> 0
 8004  7396        jl. w3     j16.   ;   then update on corrected error;
 8005  7398        z.                ;
 8006  7398        bz  w0  x2+m5     ;   segments:= no of segments.curr buf;
 8007  7400        jl. w3     j11.   ;   update buf(segments,bytes);
 8008  7402  
 8008  7402  ; check if more segments are to be transferred at transput
 8009  7402  j80 : bz  w0  x2+m9     ;
 8010  7404        sn  w0     0      ;   if remaining segms.curr buf = 0
 8011  7406        jl.        j103.  ;   then goto deliver wanted;
 8012  7408        al  w0     0      ;   c. jumps always at direct disc msg;
 8013  7410        hs  w0  x2+m6     ;   retryinformation.curr buf:= 0;
 8014  7412        rl  w0  x2+m7     ;   first segment.curr buf:=
 8015  7414        rs  w0  x2+m4     ;   next segment.curr buf;
 8016  7416        rl  w1  x2+m10    ;   proc:= device.curr buf;
 8017  7418        jl. w3     j4.    ;   prepare consecutive segms(proc);
 8018  7420        jl.        j55.   ;   goto start;
 8019  7422  
 8019  7422  ; d e f i n e   d i s c   s u c c e s s f u l
 8020  7422  j85 : rl  w0  x1+p16+2  ; define disc ok:
 8021  7424        se  w0     0      ;   if rembytes.statusarea1.curr rec <> 0
 8022  7426        jl.        j125.  ;   then goto error;
 8023  7428        rl  w0  x1+p34    ;   type:=
 8024  7430        ls  w0    -14     ;   hi dens.compound status.curr rec;
 8025  7432        la  w0     g3     ;   c. 0=dsm801, 1=dsm802;
 8026  7434        rs  w0  x1+p5     ;   disctype.curr receiver:= type;
 8027  7436        al  w0     1      ;   initdisc.curr receiver:= 1;
 8028  7438        hs  w0  x1+p14    ;   c. ensures nominal head position;
 8029  7440        wa  w0  x1+p11    ;   define disc head.curr receiver:=
 8030  7442        rs  w0  x1+p11    ;   define disc head.curr receiver + 1;
 8031  7444        al  w3     8.377  ;   c. test if last addr mark on cylind.;
 8032  7446        sz  w3 (x1+p22+4) ;   if nexthead.addrmark.curr rec <> 0
 8033  7448        jl.        j55.   ;   then goto start;
 8034  7450        wm  w0  x1+p6     ;   segments per cyl.curr receiver:=
 8035  7452        rs  w0  x1+p8     ;   define disc head.curr receiver
 8036  7454        rl  w0  x1+p22+6  ;   * segments per track.curr receiver;
 8037  7456        ls  w0    -16     ;   displacement.curr receiver:=
 8038  7458        rs  w0  x1+p9     ;   next sector.addrmark.curr receiver;
 8039  7460        al  w0     2      ;   c. sector 0 on odd cylinders;
 8040  7462        rs  w0  x1+p12    ;   state.curr receiver:= ready;
 8041  7464        jl.        j110.  ;   goto examine queue;
 8042  7466  
 8042  7466  ; p o w e r   r e s t a r t   s u c c e s s f u l
 8043  7466  j87 : rl  w0  x1+p12    ; power restart ok:
 8044  7468        sn  w0     1      ;   if state.curr rec = defining disc
 8045  7470        al  w0     0      ;   then state.curr rec:= after interven;
 8046  7472        rs  w0  x1+p12    ;   c. resume define disc from beginning;
 8047  7474        jl.        j110.  ;   goto examine queue;
 8048  7476  \f


 8048  7476  ; pej 26.09.77    disc driver, deliver answer
 8049  7476  
 8049  7476  ; d e l i v e r   a n s w e r   r o u t i n e
 8050  7476  ; ---------------------------------------------------------------
 8051  7476  
 8051  7476  ; these routines are entered to deliver the answer to a processed
 8052  7476  ; message. upon delivering the answer it is examined if more
 8053  7476  ; messages are queued to the driver. if so, next message is pro-
 8054  7476  ; cessed, and if not, idle state is entered and a wait program
 8055  7476  ; is started. p35+0 and p35+2 contains bytes/chars per segment.
 8056  7476  
 8056  7476  ; result 1, status blocklength, bytes 0.
 8057  7476  j90 : dl. w1     i27.   ; deliver blocklength:
 8058  7478        al  w3     0      ;   result:= 1; status:= bit4;
 8059  7480        jl.        j106.  ;   segments:= 0; goto deliver;
 8060  7482  
 8060  7482  ; result 1, status discerror, bytes = what was transferred.
 8061  7482  j92 : dl. w1     i28.   ; deliver discerror: result:= 1;
 8062  7484        rl  w2     b18    ;   status:= bit11;
 8063  7486        jl.        j97.   ;   goto deliver transferred;
 8064  7488  
 8064  7488  ; result 1, status 0, words contained in ac3
 8065  7488  j94 : al  w0     2      ; deliver words wanted: c. w2=curr rec;
 8066  7490        al  w1     3      ;   bytes:= 2; chars:= 3;
 8067  7492        ds  w1  x2+p35+2  ;   c. w3 = words == segments;
 8068  7494        jl.        j104.  ;   goto deliver ok;
 8069  7496  
 8069  7496  ; result 4, status 0, bytes=what was transferred
 8070  7496  j95 : al  w0     4      ; deliver spurious:
 8071  7498        al  w1     0      ;   result:= 4; status:= 0;
 8072  7500        rl  w2     b18    ;   w2:= curr buf;
 8073  7502        jl.        j97.   ;   goto deliver transferred;
 8074  7504  
 8074  7504  ; result, status corresp. to compound, bytes=what was transferred
 8075  7504  j96 :                   ; deliver error:
 8076  7504        jl. w3     j10.   ;   set result and status(result,status);
 8077  7506  j97 : bz  w3  x2+m8     ; deliver transferred: c. w2 = curr buf;
 8078  7508        bs  w3  x2+m9     ;   segments:= segments wanted.curr buf
 8079  7510        bz  w2  x2+m0     ;   - remaining segments.curr buf;
 8080  7512        so  w2     2.1    ;   if operation.curr buf = control
 8081  7514        al  w3     0      ;   then segments:= 0;
 8082  7516        jl.        j106.  ;   goto deliver;
 8083  7518  
 8083  7518  ; result 1, 2, 3, status 0, bytes 0.
 8084  7518  j99 : am         3-2    ; deliver unintelligible:
 8085  7520  j100: am         2-1    ; deliver rejected       :
 8086  7522  j101: al  w0     1      ; deliver size zero      :
 8087  7524  j102: al  w1     0      ; deliver status and segms zero:
 8088  7526        al  w3     0      ;   status:= 0; segments:= 0;
 8089  7528        jl.        j106.  ;   goto deliver;
 8090  7530  
 8090  7530  ; result 1, status 0, bytes = what was wanted.
 8091  7530  j103:                   ; deliver wanted; c. w2 = curr buf;
 8092  7530        bz  w3  x2+m8     ;   segment:= segments wanted.curr buf;
 8093  7532  j104: dl. w1     i29.   ; deliver ok: result:= 1; status:= 0;
 8094  7534  
 8094  7534  ; deliver the answer, w0=result, w1=status, w3=segments.
 8095  7534  j106: rs  w1     g20    ; deliver:
 8096  7536        rl  w1     b19    ;   status.i/o answer:= status;
 8097  7538        rs  w3     g21    ;
 8098  7540        wm  w3  x1+p35    ;
 8099  7542        rx  w3     g21    ;   bytes.i/o answer:= segments * bytes;
 8100  7544        wm  w3  x1+p35+2  ;
 8101  7546        rs  w3     g22    ;   chars.i/o answer:= segments * chars;
 8102  7548        rl  w2  x1+a244   ;   file.i/o answer:= i/o result.curr rec;
 8103  7550        rl  w3  x1+p31    ;   block.i/o answer:=
 8104  7552        ds  w3     g24    ;   curr status.curr receiver;
 8105  7554        rl  w2  x1+p31+2  ;   curr buf(18:19):= event stat.curr rec;
 8106  7556        rl  w3  x1+p33    ;   curr buf(20:21):= techn stat.curr rec;
 8107  7558        am        (b18)   ;
 8108  7560        ds  w3     m8     ;
 8109  7562        rs  w0  x1+p35    ;   save result;
 8110  7564  ;  w0= result; b18 =buffer
 8111  7564        rl  w2  b18       ;  w2:=buffer
 8112  7566        rl  w1  x2+a141   ;  w1:= receiver.buf
 8113  7568        sh  w1  0         ; 
 8114  7570        ac  w1  x1        ;  w1:= absolute value of receiver
 8115  7572        sh  w1  6         ; 
 8116  7574        jl.     j107.     ; 
 8117  7576        rl  w3  x1+a10    ;  w3:= kind(rec);
 8118  7578        se  w3  4         ;  if area process then
 8119  7580        jl.     j107.     ;  begin
 8120  7582        rl  w3  g22       ; 
 8121  7584        sn  w0  1         ;  if bytes<>0 then
 8122  7586        sn  w3  0         ;  begin
 8123  7588        jl.     j107.     ; 
 8124  7590        bz  w3  x2+8      ;  if operation = write then
 8125  7592        se  w3  q33       ;    nooftiw:=nooftiw+1
 8126  7594        am      a412-a411 ;  else
 8127  7596        al  w3  x1+a411   ;    nooftir:=nooftir+1;
 8128  7598        rl  w2  x3        ; 
 8129  7600        al  w2  x2+1      ; 
 8130  7602        rs  w2  x3        ; 
 8131  7604  j107: jl  w3     g19    ;   deliver result(result);
 8132  7606  
 8132  7606  ; clean the driver in case of abnormal result.
 8133  7606        rl  w0  x1+p35    ;
 8134  7608        sl  w0     4      ;   if result > 3
 8135  7610        jl. w3     j14.   ;   then clean(result);
 8136  7612  
 8136  7612  ; examine if more messages are queued.
 8137  7612  j110: al  w0     0      ; examine queue: c. w1=curr receiver;
 8138  7614        rs  w0  x1+a56    ;   regretted.curr receiver:= 0;
 8139  7616        jl  w3     g64    ;   examine queue(queue empty);
 8140  7618        jl.        j112.  ;   if not queue empty
 8141  7620        jl.        j50.   ;   then goto process next message;
 8142  7622  
 8142  7622  ; queue is empty, start a wait program. continue at waitnext.
 8143  7622  j112: rl  w0     g49    ; start wait: c. w1 = curr receiver;
 8144  7624        rs  w0  x1+p13    ;   transfer state.curr receiver:= idle;
 8145  7626        rl  w3  x1+a235   ;   dev:= device descr.curr rec;
 8146  7628        al  w0     3<2+1  ;   start control + std exit;
 8147  7630        ld  w2    -100    ;   buf:= 0; timeout:= eternal;
 8148  7632        jd      1<11+100  ;   start i/o(func,timeout,buf,dev);
 8149  7634  \f


 8149  7634  
 8149  7634  ; pej 28.09.77    disc driver, error routine
 8150  7634  
 8150  7634  ; e r r o r   r o u t i n e
 8151  7634  ; ---------------------------------------------------------------
 8152  7634  
 8152  7634  ; this routine is entered when an interrupt not corresponding to
 8153  7634  ; a successful transfer has been received. the treatment of the
 8154  7634  ; error takes place by running through a number of actions, each
 8155  7634  ; action being executed as a function of the kind of error and
 8156  7634  ; the transfer state of the driver.
 8157  7634  ;
 8158  7634  ; if possible, the transfer is repeated. if the routine is entered
 8159  7634  ; due to power restart (or disc power down = possible power break
 8160  7634  ; in progress) a loop is entered to check if power comes up again,
 8161  7634  ; leaving a possible message being currently processed in the head
 8162  7634  ; of the queue.
 8163  7634  
 8163  7634  ; determine the kind of error
 8164  7634  j125: al  w0     1      ; error: c. w1 = curr receiver;
 8165  7636        hs  w0  x1+p14    ;   initdisc.curr receiver:= 1;
 8166  7638       jl  w2  (b31)        ; call errorlog
 8167  7640        jl. w3     j9.    ;   set errorkind(kind);
 8168  7642        wa  w0  x1+p13    ;   actionkey:=
 8169  7644        rs  w0  x1+p36    ;   errorkind + transfer state.curr rec;
 8170  7646        al  w0    -4      ;
 8171  7648        rs  w0  x1+p37    ;   actionindex:= -4;
 8172  7650  
 8172  7650  ; determine if next action is to be executed
 8173  7650  j130: rl  w1     b19    ; central action: w1:= curr receiver;
 8174  7652  j132: am     (x1+p37)   ; skip:
 8175  7654        al  w3     4      ;
 8176  7656        rs  w3  x1+p37    ;   action index:= actionindex + 4;
 8177  7658        rl  w0  x1+p36    ;
 8178  7660        la. w0  x3+i35.   ;   i:= table(actionindex) and actionkey;
 8179  7662        bz  w2     1      ; 
 8180  7664        sz  w0    (g51)   ;   if i(0:11) = 0
 8181  7666        sn  w2     0      ;   or i(12:23) = 0
 8182  7668        jl.        j132.  ;   then goto skip;
 8183  7670        rl  w2     b18    ;   goto table(actionindex + 2);
 8184  7672        jl.    (x3+i36.)  ;   c. with w1 = curr rec, w2 = curr buf;
 8185  7674  
 8185  7674  b. n25, o16 w.               ; block containing error actions
 8186  7674  
 8186  7674  ; table guiding the execution of actions. each entry contains:
 8187  7674  ; +0: transfer states < 12 + errorkinds
 8188  7674  ;     the action is executed if the actionkey (see above) anded
 8189  7674  ;     to this word gives nonzero in both bytes.
 8190  7674  ; +2: action address.
 8191  7674  ; ---------------------------------------------------------------
 8192  7674  ;       ----transfer states----        --error kinds--       actions
 8193  7674  ;                   read
 8194  7674  ;                       write          d a i p p t w d a o
 8195  7674  ;                           read aft.    f n o o i r a d t
 8196  7674  ;       i d p s p c d a d a d a        o t t w w m   t d h
 8197  7674  ;       d e o e o l a d a d a d        v   e e e e p a r e
 8198  7674  ;       l f w n s e t d t d t d        e d r r r o r     r
 8199  7674  ;       e i e s   a a r a r a r        r   v     u o e e
 8200  7674  ;         n r e   n                    r o   r d t t r r
 8201  7674  ; ---------------------------------------------------------------
 8202  7674  ;                              action 1                      vacant
 8203  7674  ;                              action 2                      vacant
 8204  7674  i35: 2.             1 1 1 1 0 0 <12+2. 1 1 1 1 1 1 1 1 1 1 , i36: n3
 8205  7678       2.                     1 1 <12+2. 1 1 1 1 1 1 1 1 1 1 ,      n4
 8206  7682       2.       1 1 1 0 0 0 0 0 0 <12+2.           1 0 1 1 1 ,      n5
 8207  7686       2.       1 1 1 1 1 1 1 1 1 <12+2.           1 0 1 1 1 ,      n6
 8208  7690       2.             1 0 0 0 0 0 <12+2.               1 0 0 ,      n7
 8209  7694  c. q1
 8210  7694       2.             1 1 1 1 1 1 <12+2.           1 0 1 1 1 ,      o7
 8211  7698  z.
 8212  7698       2.             1 1 0 0 0 0 <12+2.               1 1 0 ,      n8
 8213  7702       2.             1 1 0 0 0 0 <12+2.           1 0 0 0 0 ,      o8
 8214  7706       2.       1 1 1 1 1 1 1 0 0 <12+2.           1 0 1 1 1 ,      n9
 8215  7710       2.                     1 1 <12+2.           1 0 1 1 1 ,      n10
 8216  7714       2. 1 1 0 1 1 1 1 1 1 1 1 1 <12+2.         1 0 0 0 0 0 ,      n11
 8217  7718       2. 1 1 1 1 1 1 1 1 1 1 1 1 <12+2.       1 0 0 0 0 0 0 ,      n12
 8218  7722       2.     1 0 0 0 0 0 0 0 0 0 <12+2.           1 0 0 0 0 ,      n13
 8219  7726       2.     1 0 0 0 0 0 0 0 0 0 <12+2. 1 1 1 1 1 1 1 1 1 1 ,      n14
 8220  7730       2. 1 1 1 1 1 1 1 1 1 1 1 1 <12+2.     1 0 0 0 0 0 0 0 ,      n17
 8221  7734       2.           1 0 0 1 1 1 1 <12+2.             1 0 0 0 ,      n16
 8222  7738       2.       1 1 0 1 1 0 0 0 0 <12+2.             1 0 0 0 ,      o16
 8223  7742       2. 1 0 0 0 0 0 0 0 0 0 0 0 <12+2. 1 1 1 1 1 1 1 1 1 1 ,      n17
 8224  7746       2.   1 0 0 0 0 0 0 0 0 0 0 <12+2.                 1 0 ,      n18
 8225  7750       2.   1 0 0 0 0 0 0 0 0 0 0 <12+2. 1 1 1 1 1 1 1 1 1 1 ,      n19
 8226  7754       2. 1 1 1 1 1 1 1 1 1 1 1 1 <12+2.   1 0 0 0 0 0 0 0 0 ,      n20
 8227  7758       2. 1 1 1 1 1 1 1 1 1 1 1 1 <12+2. 1 0 0 0 0 0 0 0 0 0 ,      n21
 8228  7762       2. 1 1 1 1 1 1 1 1 1 1 1 1 <12+2. 1 1 1 1 1 1 1 1 1 1 ,      n22
 8229  7766  
 8229  7766  \f


 8229  7766  ; pej 28.09.77    disc driver, error routine
 8230  7766  
 8230  7766  ; action 3: update buf at error at read or simple write.
 8231  7766  ; tr.state: read data, read addr m, write data, write addr m
 8232  7766  ; err.kind: any
 8233  7766  n3  : al  w2  x1+p16    ;   area:= statusarea1.curr receiver;
 8234  7768        al. w3     j130.  ;   update buf on err(area,bytes,chars);
 8235  7770        jl.        j12.   ;   goto central action;
 8236  7772  
 8236  7772  ; action 4: update buf at read after write error.
 8237  7772  ; tr.state: read after write data, read after write addr m.
 8238  7772  ; err.kind: any
 8239  7772  n4  : al  w0     0      ;   c. test if first transfer (write) ok;
 8240  7774        rs  w0  x1+p38    ;   write ok:= 0; c. see action 10;
 8241  7776        se  w0 (x1+p16)   ;   if chan pg count.status1.curr rec = 0
 8242  7778        se  w0 (x1+p16+2) ;   or rembytes.statusarea1.curr rec <> 0
 8243  7780        jl.        j130.  ;   then goto central action; c. not ok;
 8244  7782        dl  w1  x1+p16+6  ;
 8245  7784        jl. w3     j8.    ;   compoundstatus(curr,event,compound);
 8246  7786        sz. w0    (i40.)  ;   if compound and output ok <> 0
 8247  7788        jl.        j130.  ;   then goto central action; c. not ok;
 8248  7790        rs  w1  x1+p38    ;   write ok:= <> 0; c. see action 10;
 8249  7792        al  w2  x1+p18    ;   area:= statusarea2.curr receiver;
 8250  7794        al. w3     j130.  ;   update buf on err(area,bytes,chars);
 8251  7796        jl.        j12.   ;   goto central action;
 8252  7798  
 8252  7798  ; action 5: repeatable error, test if control message regretted.
 8253  7798  ; tr.state: sense, position, clean track
 8254  7798  ; err.kind: timeout, data error, addr mark error, other error
 8255  7798  n5  : al  w0     0      ;
 8256  7800        sn  w0 (x1+a56)   ;   if regretted.curr receiver = 0
 8257  7802        jl.        j130.  ;   then goto central action
 8258  7804        jl.        j110.  ;   else goto examine queue;
 8259  7806  
 8259  7806  ; action 6: repeatable error, test if transfer may be repeated.
 8260  7806  ; tr.state: any, except idle, define disc, power restart
 8261  7806  ; err.kind: timeout, data error, addr mark error, other error
 8262  7806  n6  :                   ;
 8263  7806        c.         q1     ;   if statistics wanted then
 8264  7806        am     (x1+p41)   ;   begin
 8265  7808        al  w3     1      ;     count:= not successful.curr rec + 1;
 8266  7810        bz  w0  x2+m6     ;
 8267  7812        sn  w0     0      ;     if retryinf.curr buf = 0 then
 8268  7814        rs  w3  x1+p41    ;     not successful.curr rec:= count;
 8269  7816        z.                ;   end;
 8270  7816        bz  w0  x2+m1     ;
 8271  7818        sz  w0     q41    ;   if -, error recovery.mode.curr buf
 8272  7820        jl.        j96.   ;   then goto deliver error
 8273  7822        jl.        j130.  ;   else goto central action;
 8274  7824  
 8274  7824  ; action 7: data error at read, try to repair by ecc.
 8275  7824  ; tr.state: read data
 8276  7824  ; err.kind: data error
 8277  7824  n7  : jl. w3     j15.   ;   correct data;
 8278  7826        jl.        j130.  ;   if not corrected then goto cent act.;
 8279  7828        al  w0     1      ;   segments:= 1;
 8280  7830        rl  w1     b19    ;   c. one segment, the last, corrected;
 8281  7832        rl  w2     b18    ;
 8282  7834        jl. w3     j11.   ;   update buf(segments,bytes);
 8283  7836        c.         q1     ;   if statistics wanted then
 8284  7836        am     (x1+p42)   ;   begin
 8285  7838        al  w3     1      ;     count:= ecc corrected.curr rec + 1;
 8286  7840        bz  w0  x2+m6     ;
 8287  7842        sn  w0     0      ;     if retryinf.curr buf = 0
 8288  7844        rs  w3  x1+p42    ;     then ecc corrected.curr rec:= count
 8289  7846        se  w0     0      ;
 8290  7848        jl. w3     j16.   ;     else update on corrected error;
 8291  7850        z.                ;   end;
 8292  7850        al  w0     0      ;   if setmode param.curr rec = 0
 8293  7852        sn  w0 (x1+p21)   ;   then initdisc.curr rec:= 0;
 8294  7854        hs  w0  x1+p14    ;   c. init not necessary;
 8295  7856        hs  w0  x2+m6     ;   retryinf.curr buf:= 0;
 8296  7858        bz  w0  x2+m5     ;   c. check if entire transfer now ok;
 8297  7860        sn  w0     0      ;   if no of segments.curr buf = 0
 8298  7862        jl.        j80.   ;   then goto check if more
 8299  7864        jl.        j55.   ;   else goto start;
 8300  7866  
 8300  7866  ; action 7a, update table of error segments
 8301  7866  ; tr.state : read data, read addr m, write data, write addr m,
 8302  7866  ;            read after write data, read after write addr m
 8303  7866  ; err.kind : timeout, data error, addr mark error, other error
 8304  7866  o7  : c.         q1     ;   if statistics wanted then
 8305  7866        bz  w0  x2+m6     ;   begin
 8306  7868        se  w0     0      ;     if retryinf.curr buf <> 0
 8307  7870        jl.        j130.  ;     then goto central action;
 8308  7872        rl  w3  x2+m4     ;     c. already registrated;
 8309  7874        am     (x2+m10)   ;     segment:= first segment.curr buf
 8310  7876        wa  w3     p3     ;     + first segment.device.curr buf;
 8311  7878        al  w2  x1+p46    ;     entry:= 1st error segm.curr rec;
 8312  7880  j141: sl  w2  x1+p46+q2*6;    while entry <> top entry do
 8313  7882        jl.        j130.  ;     begin
 8314  7884        sh  w0 (x2+0)     ;       if segment no.entry < 0
 8315  7886        sn  w3 (x2+0)     ;       or segment no.entry = segment
 8316  7888        jl.        j143.  ;       then goto found; increase entry;
 8317  7890        al  w2  x2+6      ;     end;
 8318  7892        jl.        j141.  ;     goto central action; c. table full;
 8319  7894  j143: rs   w3  x2+0     ; found:
 8320  7896        am         (b18)  ;     segment no.entry:= segment;
 8321  7898        ba  w2     m0     ;     i:= operation.curr buf;
 8322  7900        bz  w1  x2+0      ;
 8323  7902        al  w1  x1+1      ;     entry(i):= entry(i) + 1;
 8324  7904        hs  w1  x2+0      ;
 8325  7906        jl.        j130.  ;   end;
 8326  7908        z.                ;   goto central action;
 8327  7908  
 8327  7908  ; action 8, data error or addr m error at read, use strobe-offset
 8328  7908  ; tr.state: read data, read addr mark
 8329  7908  ; err.kind: data error, addr mark error
 8330  7908  n8  : al  w1  x2+m6     ;   retryinf:= retryinf.curr buf;
 8331  7910        jl. w3     j13.   ;   update retryinformation(retryinf);
 8332  7912        jl.        j96.   ;   if no more tries goto deliver error;
 8333  7914        jl.        j147.  ;
 8334  7916        jl.        j145.  ;   if next offset magnitude used then
 8335  7918        jl.        j147.  ;   begin c. may buf be requeued;
 8336  7920  j145: rl  w2     b18    ;
 8337  7922        bz  w0  x2+m1     ;
 8338  7924        sz  w0     q42    ;     if requeue.curr buf = no requeue
 8339  7926        jl.        j92.   ;     then goto deliver discerror;
 8340  7928        jl  w3     d5     ;     c. remove and link the buf to q end;
 8341  7930        am        (b19)   ;     remove(curr buf);
 8342  7932        al  w1     a54    ;
 8343  7934        jl  w3     d6     ;     link(mess queue.curr rec,curr buf);
 8344  7936        rl  w1     b19    ;     goto examine queue;
 8345  7938        jl.        j110.  ;   end;
 8346  7940  j147: al  w0     2.10   ;   c. initdisc may be skipped if data
 8347  7942        rl  w1     b19    ;      error as the correct segment was
 8348  7944        la  w0  x1+p36    ;      read;
 8349  7946        sn  w0     0      ;   if actionkey and -, addr mark error
 8350  7948        hs  w0  x1+p14    ;   then initdisc.curr rec:= 0;
 8351  7950        jl.        j55.   ;   goto start;
 8352  7952  ; action 8a: timeout at read, simulate address mark error if
 8353  7952  ;            timeout is possibly caused by use of strobe -
 8354  7952  ;            offset (synchronization chars out of reach).
 8355  7952  ; tr.state : read data, read addr m
 8356  7952   
 8356  7952  ; err.kind : timeout
 8357  7952  o8:   bz  w3  x2+m6     ;
 8358  7954        sh  w3  2.111     ; if retryinf.curr buf <> strobe.offset
 8359  7956        jl.     j130.     ; used then goto central action;
 8360  7958        la. w3  i45.      ; c. force next offset magnitude;
 8361  7960        wa. w3  i44.      ; retryinf.curr buf:= last modeindex < 8
 8362  7962        hs  w3  x2+m6     ; +offset.retryinf.curr buf + maxtries;
 8363  7964        rl  w3  x1+p36    ; c. simulate addr mark error;
 8364  7966        al  w3  x3-2.10000; action key.cur rec:=
 8365  7968        al  w3  x3+2.10   ; action key.curr rec
 8366  7970        rs  w3  x1+p36    ; -timeout + addr m error;
 8367  7972        rl. w3  i43.      ; compound status.curr rec:=
 8368  7974        rs  w3  x1+p34    ; data err + hard err + abnorm term;
 8369  7976        jl.     n8.       ; goto action 8;
 8370  7978  
 8370  7978  ; action 9: error at control, read, simple write. repeat transfer
 8371  7978  ; tr.state: sense, position, clean track,
 8372  7978  ;           read data, read addr m, write data, write addr m
 8373  7978  ; err.kind: timeout, data error, addr mark error, other error
 8374  7978  n9  : al  w1  x2+m6     ;   retryinf:= retryinf.curr buf;
 8375  7980        jl. w3     j13.   ;   update retryinformation(retryinf);
 8376  7982        jl.        j96.   ;
 8377  7984        jl.        j96.   ;
 8378  7986        jl.        j96.   ;   if tries <= 3 then goto start
 8379  7988        jl.        j55.   ;   else goto deliver error;
 8380  7990  
 8380  7990  ; action 10: error at read after write, repeat transfer.
 8381  7990  ; tr.state : read after write data, read after write addr mark
 8382  7990  ; err.kind : timeout, data error, addr mark error, other error
 8383  7990  n10 : rl  w0  x1+p38    ;   c. see action 4 re. write ok;
 8384  7992        bz  w3  x2+m6     ;   r:= retryinformation.curr buf; c. w3;
 8385  7994        sn  w0     0      ;   if write ok then
 8386  7996        jl.        j150.  ;   begin c. repeat 2nd transfer (read);
 8387  7998        al  w3  x3+1      ;     readtries.r:= readtries.r + 1;
 8388  8000        so  w3     2.100  ;     if readtries.r <= 3 then goto rep;
 8389  8002        jl.        j151.  ;   end;
 8390  8004  j150: la. w3     i41.   ;   c. repeat 1st transfer (write);
 8391  8006        al  w3  x3+2.1000 ;   readtries.r:= 0; incr writetries.r;
 8392  8008        sz  w3     2.100<3;   if writetries.r > 3
 8393  8010        jl.        j96.   ;   then goto deliver error;
 8394  8012  j151: hs  w3  x2+m6     ; rep: retryinformation.curr buf:= r;
 8395  8014        jl.        j55.   ;   goto start;
 8396  8016  
 8396  8016  ; action 11: disc power down, enter power restart loop.
 8397  8016  ; tr.state : any, except power restart
 8398  8016  ; err.kind : power down
 8399  8016  n11 : am         q14-q13; power down:   n:= no of times to sense disc;
 8400  8018  
 8400  8018  ; action 12: power restart, enter power restart loop.
 8401  8018  ; tr.state : any
 8402  8018  ; err.kind : power restart
 8403  8018  n12 : al  w3     q13    ;   n:= no of times to sense disc;
 8404  8020        al  w0     0      ;
 8405  8022        sn  w0 (x1+p12)   ;   if state.curr rec = after intervent.
 8406  8024        jl.        n15.   ;   then goto intervention;
 8407  8026        al  w0     1      ;   regretted.curr receiver:= 1;
 8408  8028        rs  w0  x1+a56    ;   c. to prevent start if buf arrives;
 8409  8030        jl.        j154.  ;   goto power sense;
 8410  8032  
 8410  8032  ; action 13: sense disc in power restart loop.
 8411  8032  ; tr.state : power restart
 8412  8032  ; err.kind : timeout
 8413  8032  n13 : bz  w3  x1+p15    ;   n:= retryinformation.curr receiver;
 8414  8034        al  w3  x3-1      ;   n:= n - 1;
 8415  8036        sh  w3    -1      ;   if n < 0 then goto intervention;
 8416  8038        jl.        n15.   ; power sense: c. w3 = n;
 8417  8040  j154: hs  w3  x1+p15    ;   retryinformation.curr receiver:= n;
 8418  8042        al  w1     q39+2  ;   kind:= power restart;
 8419  8044        jl. w3     j0.    ;   setup channelprogram and start(kind);
 8420  8046                          ;   c. cont. at waitnext in driverproc;
 8421  8046  
 8421  8046  ; action 14: delay before next sense in power restart loop.
 8422  8046  ; tr.state : power restart
 8423  8046  ; err.kind : any
 8424  8046  n14 : rl  w3  x1+a235   ;   dev:= device descr.curr rec;
 8425  8048        al  w0     2<2+1  ;   function:= start wait, std exit;
 8426  8050        rl. w1     i42.   ;   timer:= time between sense in loop;
 8427  8052        al  w2     0      ;   buf:= 0;
 8428  8054        jd      1<11+100  ;   start i/o(function,timer,buf,dev);
 8429  8056                          ;   c. cont. at waitnext in driverproc;
 8430  8056  
 8430  8056  ; action 15: intervention.
 8431  8056  ; tr.state : any
 8432  8056  ; err.kind : intervention
 8433  8056  n15 : al  w0     5      ; intervention: result:= 5; c. unknown;
 8434  8058        jl. w3     j14.   ;   clean(result);
 8435  8060        jl        (b20)   ;   goto waitnext; c. in driver proc;
 8436  8062  
 8436  8062  ; action 16: write protect at output.
 8437  8062  ; tr.state : clean track, all write states
 8438  8062  ; err.kind : write protect
 8439  8062  n16 : jl.        j100.  ;   goto deliver rejected;
 8440  8064  
 8440  8064  ; action 16a: write protect at control, read. repeat transfer.
 8441  8064  ; tr.state  : sense, position, read data, read a m
 8442  8064  ; err.kind  : write protect
 8443  8064  o16 : al  w1  x2+m6     ;   retryinf:= retryinf.curr buf;
 8444  8066        jl. w3     j13.   ;   update retryinformation(retryinf);
 8445  8068        jl.        j95.   ;
 8446  8070        jl.        j95.   ;
 8447  8072        jl.        j95.   ;   if tries <= 3 then goto start
 8448  8074        jl.        j55.   ;   else goto deliver spurious;
 8449  8076  
 8449  8076  ; action 17: wait program terminated not because of intervention.
 8450  8076  ; tr.state : idle
 8451  8076  ; err.kind : any
 8452  8076  n17:  jl.     n11.      ; goto power down;
 8453  8078  
 8453  8078  ; action 18: addr mark error at define disc, use stobe-offset.
 8454  8078  ; tr.state : define disc
 8455  8078  ; err.kind : addr mark error
 8456  8078  n18 : al  w1  x1+p15    ;   retryinf:= retryinf.curr receiver;
 8457  8080        jl. w3     j13.   ;   update retryinformation(retryinf);
 8458  8082        jl.        j160.  ;   if no more tries possible then
 8459  8084        jl.        j55.   ;
 8460  8086        jl.        j55.   ;
 8461  8088        jl.        j55.   ;   begin c. try next even cylinder
 8462  8090  j160: rl  w1     b19    ;
 8463  8092        am     (x1+p10)   ;
 8464  8094        al  w0     2      ;     define disc cyl.curr rec:=
 8465  8096        rs  w0  x1+p10    ;     define disc cyl.curr rec + 2;
 8466  8098        al  w0     0      ;     define disc head.curr rec:= 0;
 8467  8100        rs  w0  x1+p11    ;     retryinformation.curr rec:= 0;
 8468  8102        hs  w0  x1+p15    ;   end;
 8469  8104        jl.        j55.   ;   goto start;
 8470  8106  
 8470  8106  ; action 19: error at define disc. repeat transfer.
 8471  8106  ; tr.state : define disc
 8472  8106  ; err.kind : any
 8473  8106  n19 : al  w1  x1+p15    ;   retryinf:= retryinf.curr receiver;
 8474  8108        jl. w3     j13.   ;
 8475  8110        jl.        j162.  ;
 8476  8112        jl.        j162.  ;
 8477  8114        jl.        j162.  ;
 8478  8116        jl.        j55.   ;   if tries <= 3 then goto start;
 8479  8118  j162: al  w0     4      ;   result:= 4; c. malfunction;
 8480  8120        jl. w3     j14.   ;   clean(result);
 8481  8122        al  w0     0      ;
 8482  8124        rs  w0  x1+p12    ;   state.curr rec:= after intervention;
 8483  8126        jl        (b20)   ;   goto waitnext; c. in driverproc;
 8484  8128    
 8484  8128  ; action 20: repeat transfer in data overrun loop
 8485  8128  ; tr.state : any
 8486  8128  ; err.kind : after data overrun
 8487  8128  n20 : al  w0     0      ;   
 8488  8130        rs  w0  x1+a56    ;   regretted.curr receiver:= 0;
 8489  8132        bz  w3  x1+p15    ;   n:= retryinf.curr receiver;
 8490  8134        al  w3  x3+1      ;   n:= n+1;
 8491  8136        sl  w3     q15    ;   if n > max no of retries
 8492  8138        jl.        j96.   ;      then goto deliver error
 8493  8140        hs  w3  x1+p15    ;      else begin
 8494  8142        jl.        j55.   ;             retryinf.curr receiver:= n;
 8495  8144                          ;             goto start;
 8496  8144                          ;           end;
 8497  8144    
 8497  8144  ; action 21: start wait in data overrun loop
 8498  8144  ; tr.state : any
 8499  8144  ; err.kind : data overrun
 8500  8144  n21 : bz  w0  x2+m1     ;
 8501  8146        sz  w0     q41    ;   if -,error recovery.mode.curr buf
 8502  8148        jl.        j96.   ;      then goto deliver error;
 8503  8150        al  w0     1      ;   regretted.curr receiver:= 1;
 8504  8152        rs  w0  x1+a56    ;   c. to prevent start if buf arrives
 8505  8154        al  w0     0      ; do not initialize
 8506  8156        rs  w0  x1+p14    ;
 8507  8158        rl  w3  x1+a235   ;   dev:= device descr.curr receiver;
 8508  8160        al  w1  x3        ;   timer:= (dev >> 5) << 9;
 8509  8162        ls  w1    -5      ;   c. (controller io no)*512;
 8510  8164        ls  w1     9      ;   c. to ensure diff. waiting periods for diff. devices
 8511  8166        al  w0     2<2+1  ;   function:= start wait, std exit;
 8512  8168        al  w2     0      ;   buf:= 0;
 8513  8170        jd      1<11+100  ;   start io(function,timer,buf,dev);
 8514  8172  
 8514  8172  ; action 22: final action, acts as a stopper.
 8515  8172  ; tr.state : any
 8516  8172  ; err.kind : any
 8517  8172  n22 : al  w0     4      ;   result:= 4; c. malfunction;
 8518  8174        jl. w3     j14.   ;   clean(result);
 8519  8176        jl.        j112.  ;   goto start wait;
 8520  8178  
 8520  8178  e.                      ; end of block containing error actions
 8521  8178  \f


 8521  8178  
 8521  8178  ; pej 04.10.77    disc driver, variables
 8522  8178  
 8522  8178  ; m o d e   t a b l e
 8523  8178  ; each entry contains strobe and offset information corre-
 8524  8178  ; sponding to bit 16-19 in a setmode parameter. modeindex in
 8525  8178  ; retryinformation - 1 is an index to the table.
 8526  8178  q23  = 3                ; first mode index in next round
 8527  8178  q24 = 8                 ; last modeindex
 8528  8178  h.                      ;     strobe  offset
 8529  8178  q20 : 2.0100<4          ; +0: late
 8530  8179        2.1000<4          ; +1: early
 8531  8180        2.0001<4          ; +2:         negative
 8532  8181        2.0010<4          ; +3:         positive
 8533  8182        2.0101<4          ; +4: late    negative
 8534  8183        2.0110<4          ; +5: late    positive
 8535  8184        2.1001<4          ; +6: early   negative
 8536  8185        2.1010<4          ; +7: early   positive
 8537  8186        -1                ; +8: top of table
 8538  8187  
 8538  8187  ; o f f s e t   t a b l e
 8539  8187  ; each entry contains offset magnitude corresponding to bit 20-23
 8540  8187  ; in a setmode parameter. offset index in retryinformation is
 8541  8187  ; an index to the table.
 8542  8187  q21 : 8,15,1,3,6,10,13,2,4,5,7,9,11,12,14 ; +0 - +14
 8543  8202        -1                                  ; +15: top entry
 8544  8203  w.
 8545  8204  
 8545  8204  ; variables
 8546  8204        1                 ;                    -2: result (1)
 8547  8206  i27 : 8.02000000        ; blocklength error: +0: status (bit 4)
 8548  8208        1                 ;            -2: result (1)
 8549  8210  i28 : 8.00010000        ; discerror: +0: status (bit 11)
 8550  8212        1                 ;     -2: result (1)
 8551  8214  i29 : 0                 ; ok: +0: status(0)
 8552  8216  i40 : i24               ; mask for zeroes in compound at output
 8553  8218  i41 : 2.11111000        ; mask for zeroizing readtries.retryinf
 8554  8220  i42 : q10               ; time between sense in power rest. loop
 8555  8222  i43:  1<22+1<19+1<8     ; compound status: data or hard err,abnorm term
 8556  8224  i44:  q24<8+3           ; last modeindex<8+maxtries(retry inf)
 8557  8226  i45:  2.000011111000    ; mask for zeroize modeindex or tries (retryinf)
 8558  8228  
 8558  8228  \f


 8558  8228  
 8558  8228  
 8558  8228  ; pej 26.09.77    disc driver, compound status
 8559  8228  
 8559  8228  ; procedure compoundstatus(curr status,event status,compound)
 8560  8228  ; ---------------------------------------------------------------
 8561  8228  ;
 8562  8228  ; the procedure performs:
 8563  8228  ; - creates a compound status word from curr status and event
 8564  8228  ;   status and i/o result from device descr, so that:
 8565  8228  ;
 8566  8228  ;   bit  0   intervention            event status bit  0
 8567  8228  ;        1   data error              -     -      -    1
 8568  8228  ;        2   (unused, = 0)
 8569  8228  ;        3   data overrun            -     -      -    3
 8570  8228  ;        4   hard error              -     -      -    4
 8571  8228  ;        5   position error          -     -      -    5
 8572  8228  ;        6   power low               curr  -      -    0
 8573  8228  ;        7   local                   -     -      -    1
 8574  8228  ;        8   write protect           -     -      -    8
 8575  8228  ;        9   high density            -     -      -    9
 8576  8228  ;       10   mode                    -     -      -   10
 8577  8228  ;       11   seek error              -     -      -    5
 8578  8228  ;       12   (unused, = 0)
 8579  8228  ;       13   power restart           i/o result        6
 8580  8228  ;       14   wait pg. terminated     -   -             5
 8581  8228  ;       15   abnormal termination    -   -             4
 8582  8228  ;       16    software timeout       -   -             3
 8583  8228  ;       17    bustimeout, disconn.   -   -             2
 8584  8228  ;       18   bus reject, busy        -   -             1
 8585  8228  ;       19   normal termination      -   -             0
 8586  8228  ;       20   bus com, error          event status bit 20
 8587  8228  ;       21   interrupt error         -     -      -   21
 8588  8228  ;       22   bustimeout              -     -      -   22
 8589  8228  ;       23   bus parity error        -     -      -   23
 8590  8228  ;
 8591  8228  ; registers: call              exit
 8592  8228  ; wo         curr status       compound status
 8593  8228  ; w1         event status      curr receiver
 8594  8228  ; w2                           destroyed
 8595  8228  ; w3         link              unchanged
 8596  8228  ;
 8597  8228  ; entry    : j8
 8598  8228  ;
 8599  8228  ; return   : link+0
 8600  8228  b. i1 w.
 8601  8228  j8  :                   ; compound status:
 8602  8228        rl  w2     0      ;   i:= curr status >> 6;
 8603  8230        ls  w2    -6      ;   c. bit(6:7):= bit(0:1), bit11:= bit5;
 8604  8232        lo  w2     0      ;   i:= i or curr status;
 8605  8234        la. w2     i0.    ;   i:= i and bit 6,7,8,9,10,11;
 8606  8236        la. w1     i1.    ;   mask out unused event status bits;
 8607  8238        lo  w1     4      ;   compound:= event status or i; c. w1;
 8608  8240        al  w0     2.10000;   i:= bit 19;
 8609  8242        am        (b19)   ;
 8610  8244        rl  w2     a244   ;   sh:= i-o result.curr receiver;
 8611  8246        ls  w0  x2+0      ;   i:= i shift sh; c. w0;
 8612  8248        lo  w0     2      ;   compound:= compound or i; c. w0;
 8613  8250        rl  w1     b19    ;
 8614  8252        jl      x3+0      ;
 8615  8254  
 8615  8254  ; variables
 8616  8254  i0  : 8.00770000        ; bit 6,7,8,9,10,11
 8617  8256  i1  : 8.67000017        ; bit 0,1,3,4,5,20,21,22,23
 8618  8258  e.
 8619  8258  \f


 8619  8258  ; pej 27.09.77    disc driver, set errorkind
 8620  8258  
 8620  8258  ; procedure set errorkind(errorkind)
 8621  8258  ; --------------------------------------------------------------
 8622  8258  ; errorkind: bit 14: data overrun
 8623  8258  ;                15: after data overrun
 8624  8258  ;                16: intervention
 8625  8258  ;                17: power restart
 8626  8258  ;                18: power down (disc power)
 8627  8258  ;                19: time out
 8628  8258  ;                20: write protect
 8629  8258  ;                21: data error
 8630  8258  ;                22: addr mark error
 8631  8258  ;                23: other error
 8632  8258  ;
 8633  8258  ; the procedure performs:
 8634  8258  ; - updates tables of compound status and technical statusbits
 8635  8258  ;   if statistics wanted.
 8636  8258  ; - sets the errorkind as a function of bits in compound status
 8637  8258  ;   and bits in statuswords stored by controller.
 8638  8258  ;
 8639  8258  ; registers: call              exit
 8640  8258  ; w0                           errorkind
 8641  8258  ; w1         curr receiver     unchanged
 8642  8258  ; w2                           compound status
 8643  8258  ; w3         link              destroyed
 8644  8258  ;
 8645  8258  ; entry    : j9
 8646  8258  ;
 8647  8258  ; return   : link+0
 8648  8258  
 8648  8258  b. i30 w.
 8649  8258  j9  : rs. w3     i10.   ; set errorkind: save link;
 8650  8260        c.         q1     ;   if statistics wanted then
 8651  8260        rl  w0  x1+p34    ;   begin
 8652  8262        rl  w2  x1+p33    ;     i:= 0;
 8653  8264        al  w3  x1+p47    ;     repeat
 8654  8266  i26 : sl  w0     0      ;       if compound(i).curr rec = 1
 8655  8268        jl.        i27.   ;
 8656  8270        al  w1     1      ;       then
 8657  8272        ba  w1  x3+0      ;       compound table(i).curr rec:=
 8658  8274        hs  w1  x3+0      ;       compound table(i).curr rec + 1;
 8659  8276  i27 : sl  w2     0      ;       if technical(i).curr rec = 1
 8660  8278        jl.        i28.   ;
 8661  8280        al  w1     1      ;       then
 8662  8282        ba  w1  x3+p48-p47;       technical table(i).curr rec:=
 8663  8284        hs  w1  x3+p48-p47;       technical table(i).curr rec + 1;
 8664  8286  i28 : al  w3  x3+1      ;
 8665  8288        ls  w0     1      ;
 8666  8290        ls  w2     1      ;       i:= i + 1
 8667  8292        sn  w0     0      ;     until compound(i+1:23) = 0 and
 8668  8294        se  w2     0      ;           technical(i+1:23) = 0;
 8669  8296        jl.        i26.   ;
 8670  8298        rl  w1     b19    ;
 8671  8300        z.                ;   end;
 8672  8300        rl  w2  x1+p34    ;   ac2:= compound status.curr rec;
 8673  8302        so. w2    (i6.)   ;   if data overrun then
 8674  8304        jl.        i29.   ;   begin
 8675  8306        sz  w2     8.200  ;     if timeout
 8676  8308        jl.        i15.   ;        then goto after data overrun
 8677  8310        jl.        i14.   ;        else goto data overrun;
 8678  8312  i29 :                   ;   end;
 8679  8312        rl  w3  x1+p16+6  ;   event:= event.statusarea 1.curr rec;
 8680  8314        sz. w2    (i0.)   ;   if compound and mask1 = 0
 8681  8316        jl.        i24.   ;
 8682  8318        so. w3    (i1.)   ;   and dataerr.event and harderr.event
 8683  8320        jl.        i24.   ;   then goto data error;
 8684  8322        jl.        i21.   ;
 8685  8324  i24 : rl  w0  x1+a233   ;   event:= event.std status.curr rec;
 8686  8326        sz. w2    (i2.)   ;   if compound and mask2 = 0
 8687  8328        jl.        i25.   ;
 8688  8330        rl  w3  x1+a230   ;
 8689  8332        se  w3     0      ;   and chan pg count.std status.curr rec
 8690  8334        bz  w3  x3-6+1    ;       <> 0
 8691  8336        ls  w3    -8      ;   and latest command executed = read
 8692  8338        sn  w3     1      ;
 8693  8340        so. w0    (i3.)   ;   and harderr.event and pos err.event
 8694  8342        jl.        i25.   ;
 8695  8344        jl.        i22.   ;   then goto addr mark error;
 8696  8346  i25 : sz  w2     8.2000 ;   if power restart.compound
 8697  8348        jl.        i17.   ;   then goto power restart;
 8698  8350        sz. w2    (i4.)   ;   if powlow.compound or discon.compound
 8699  8352        jl.        i18.   ;   then goto power low;
 8700  8354        sz  w2     8.200  ;   if timeout.compound
 8701  8356        jl.        i19.   ;   then goto timeout;
 8702  8358        sz. w2    (i5.)   ;   if interv.compound or local.compound
 8703  8360        jl.        i13.   ;   then goto check power up;
 8704  8362        sz. w2    (i7.)   ;   if write protect.compound
 8705  8364        jl.        i20.   ;   then goto write protect
 8706  8366        jl.        i23.   ;   else goto other error;
 8707  8368  i13:                    ; check power up:
 8708  8368        rl  w0     b75    ;   if power up not yet serviced
 8709  8370        se  w0     0      ;   by clockdriver
 8710  8372        jl.        i18.   ;   then goto power down
 8711  8374        jl.        i16.   ;   else goto intervention;
 8712  8376  i14 : am         512-256; data overrun   : set kind bit 14
 8713  8378  i15 : am         256-128; aft. data ov.  :              15
 8714  8380  i16 : am         128-64 ; intervention   :              16
 8715  8382  i17 : am          64-32 ; power restart  :              17
 8716  8384  i18 : am          32-16 ; power down     :              18
 8717  8386  i19 : am          16-8  ; time out       :              19
 8718  8388  i20 : am           8-4  ; write protect  :              20
 8719  8390  i21 : am           4-2  ; data error     :              21
 8720  8392  i22 : am           2-1  ; addr mark error:              22
 8721  8394  i23 : al  w0       1    ; other error    :              23;
 8722  8396        jl.       (i10.)  ;   return;
 8723  8398  
 8723  8398  ; variables
 8724  8398  i0  : 8.45613757        ; mask1, data error, mask for zeroes
 8725  8400  i1  : 8.22000000        ; bit 1,4
 8726  8402  i2  : 8.44613377        ; mask2, addr mark err, mask for zeroes
 8727  8404  i3  : 8.03000000        ; bit 4,5
 8728  8406  i4  : 8.00400100        ; bit 6,17
 8729  8408  i5  : 8.40200000        ; bit 0, 7
 8730  8410  i6  : 8.04000000        ; bit 3, data overrun
 8731  8412  i7  : 8.00100000        ; bit 8
 8732  8414  i10 : 0                 ; saved link
 8733  8416  e.
 8734  8416  \f


 8734  8416  
 8734  8416  ; pej 27.09.77    disc driver, set result and status
 8735  8416  
 8735  8416  ; procedure set result and status(result,status).
 8736  8416  ; --------------------------------------------------------------
 8737  8416  ; result: 4 if bit 16 in compound status (software timeout)
 8738  8416  ;           -  -   18 -  -        -      (bus reject, busy)
 8739  8416  ;           -  -   20 -  -        -      (communication error)
 8740  8416  ;           -  -   21 -  -        -      (interrupt error)
 8741  8416  ;           -  -   22 -  -        -      (bustimeout)
 8742  8416  ;           -  -   23 -  -        -      (bus parity error)
 8743  8416  ;           if no bits are set in status.
 8744  8416  ;         1 if bits are set in status.
 8745  8416  ; status: bit 1 (parity)      if bit1,4 in compound (data,hard)
 8746  8416  ;         bit 2 (sync.err)    -  -    5 -  -        (pos.error)
 8747  8416  ;         bit 3 (data overr.) -  -    3 -  -        (data overr.)
 8748  8416  ;         bit 5 (end med.)    -  -   11 -  -        (seek error)
 8749  8416  ;
 8750  8416  ; the procedure performs:
 8751  8416  ; - calculates result and status from compound status.
 8752  8416  ;
 8753  8416  ; registers: call              exit
 8754  8416  ; w0                           result
 8755  8416  ; w1                           status
 8756  8416  ; w2                           curr buf
 8757  8416  ; w3         link              unchanged
 8758  8416  ;
 8759  8416  ; entry    : j10
 8760  8416  ;
 8761  8416  ; return   : link+0
 8762  8416  b. i4 w.
 8763  8416  j10 : am        (b19)   ; set result and status:
 8764  8418        rl  w2     p34    ;
 8765  8420        sz. w2    (i0.)   ;   if compound and result 4 mask
 8766  8422        am         4-1    ;   then result:= 4
 8767  8424        al  w0     1      ;   else result:= 1;
 8768  8426        al  w1     0      ;   status:= 0;
 8769  8428        sz. w2    (i1.)   ;   if compound and seek error mask
 8770  8430        al  w1  x1+1<6    ;   then status:= status + end medium;
 8771  8432        sz. w2    (i2.)   ;   if compound and data/hard error mask
 8772  8434        al  w1  x1+1<10   ;   then status:= status + parity;
 8773  8436        sz. w2    (i3.)   ;   if compound and data overrun mask
 8774  8438        al  w1  x1+1<8    ;   then status:= status + data overrun;
 8775  8440        sz. w2    (i4.)   ;   if compound and position error mask
 8776  8442        al  w1  x1+1<9    ;   then status:= status + sync.error;
 8777  8444        sn  w1     0      ;   if status = 0
 8778  8446        al  w0     4      ;   then result:= 4;
 8779  8448        ls  w1     12     ;
 8780  8450        rl  w2     b18    ;   w2:= curr buf;
 8781  8452        jl      x3+0      ;   return;
 8782  8454  
 8782  8454  ; variables
 8783  8454  i0  : 8.00000257        ; result 4 mask, bit 16,18,20,21,22,23
 8784  8456  
 8784  8456  i1  : 8.00010000        ; seek error mask, bit 11
 8785  8458  i2  : 8.22000000        ; data/hard err mask, bit 1,4
 8786  8460  i3  : 8.04000000        ; data overrun mask, bit 3
 8787  8462  i4  : 8.01000000        ; pos.error mask, bit 5
 8788  8464  e.
 8789  8464  \f


 8789  8464  
 8789  8464  ; pej 26.09.77    disc driver, update buf
 8790  8464  
 8790  8464  ; procedure update buf(segments,bytes)
 8791  8464  ; ---------------------------------------------------------------
 8792  8464  ; segments: no of segments transferred.
 8793  8464  ; bytes   : no of bytes transferred per segment. must at calltime
 8794  8464  ;           be stored in p35.curr receiver.
 8795  8464  ;
 8796  8464  ; the procedure performs:
 8797  8464  ; - updates curr buf by segments:
 8798  8464  ;   first segment and firstaddr are incremented.
 8799  8464  ;   no of segments and remaining segments are decremented.
 8800  8464  ; - updates table of error segments (successful transfer) if sta-
 8801  8464  ;   tistics wanted and a segment in the table lies in the
 8802  8464  ;   interval given by first segment.curr buf and segments.
 8803  8464  ;
 8804  8464  ; registers: call              exit
 8805  8464  ; w0         segments          destroyed
 8806  8464  ; w1         curr receiver     unchanged
 8807  8464  ; w2         curr buf          unchanged
 8808  8464  ; w3         link              destroyed
 8809  8464  ;
 8810  8464  ; entry    : j11
 8811  8464  ;
 8812  8464  ; return   : link+0
 8813  8464  b. i4 w.
 8814  8464  j11 : rs. w3     i0.    ; update buf: save link;
 8815  8466        rl  w3  x2+m4     ;
 8816  8468        wa  w3     0      ;   first segment.curr buf:=
 8817  8470        rs  w3  x2+m4     ;   first segment.curr buf + segments;
 8818  8472        c.         q1     ;   if statistics wanted then
 8819  8472        rs. w0     i2.    ;   begin
 8820  8474        am     (x2+m10)   ;
 8821  8476        wa  w3     p3     ;     top:= first segment.curr buf
 8822  8478        rs. w3     i1.    ;     + first segment.device.curr buf;
 8823  8480        ws  w3     0      ;     first:= top - segments;
 8824  8482        al  w2  x1+p46-6  ;     entry:= 1st error segment.curr rec;
 8825  8484  i3  : al  w2  x2+6      ;     while segment no.entry >= 0 and
 8826  8486        rl  w0  x2+0      ;           entry <> top entry do
 8827  8488        sl  w0     0      ;     begin
 8828  8490        sl  w2  x1+p46+q2*6;      if segmentno.entry >= first
 8829  8492        jl.        i4.    ;       and segmentno.entry < top
 8830  8494        sl  w0    (6)     ;       then goto found;
 8831  8496        sl. w0    (i1.)   ;       entry:= entry + 1;
 8832  8498        jl.        i3.    ;     end; goto not found;
 8833  8500        am        (b18)   ; found:
 8834  8502        ba  w2     m0     ;     i:= operation.curr buf;
 8835  8504        bz  w3  x2-1      ;
 8836  8506        al  w3  x3+1      ;     entry(i-1):= entry(i-1) + 1;
 8837  8508        hs  w3  x2-1      ;
 8838  8510  i4  : rl  w2     b18    ; not found:
 8839  8512        rl. w0     i2.    ;
 8840  8514        z.                ;   end;
 8841  8514        bz  w3  x2+m5     ;
 8842  8516        ws  w3     0      ;   no of segments.curr buf:=
 8843  8518        hs  w3  x2+m5     ;   no of segments.curr buf - segments;
 8844  8520        bz  w3  x2+m9     ;
 8845  8522        ws  w3     0      ;   remaining segments.curr buf:=
 8846  8524        hs  w3  x2+m9     ;   rem segments.curr buf - segments;
 8847  8526        wm  w0  x1+p35    ;   b:= segments * bytes;
 8848  8528        wa  w0  x2+m2     ;   first addr.curr buf:=
 8849  8530        rs  w0  x2+m2     ;   first addr.curr buf + b;
 8850  8532        jl.       (i0.)   ;   return;
 8851  8534  
 8851  8534  ; variables
 8852  8534  i0  : 0                 ; saved link
 8853  8536  i1  : 0                 ; saved top (segment)
 8854  8538  i2  : 0                 ; saved param segments
 8855  8540  e.
 8856  8540  \f


 8856  8540  
 8856  8540  ; pej 28.09.77    disc driver, update buf on error
 8857  8540  
 8857  8540  ; procedure update buf on error(statusarea,bytes,chars)
 8858  8540  ; ---------------------------------------------------------------
 8859  8540  ; statusarea: addr of statusarea containing information about
 8860  8540  ;             a read or write operation.
 8861  8540  ; bytes     : see proc update buf.
 8862  8540  ; chars     : no of chars transferred per segment. must at call-
 8863  8540  ;             time be stored in p35+2.curr receiver.
 8864  8540  ;
 8865  8540  ; the procedure performs:
 8866  8540  ; - updates curr buf by calling proc update buf with segments
 8867  8540  ;   according to transferred segments using remaining bytes in
 8868  8540  ;   statusarea or, if statusarea undefined, then remaining bytes
 8869  8540  ;   in std statusarea provided it relates to a read or write
 8870  8540  ;   operation.
 8871  8540  ;   please note that, due to a controller error (never to be
 8872  8540  ;   corrected), remaining bytecount must be transformed as
 8873  8540  ;   follows:
 8874  8540  ;     if rem mod chars_per_segm <> 0
 8875  8540  ;     then rem:= rem - if data transfer then 65536 else 256
 8876  8540  ; - leaves curr buf unchanged if neither statusarea nor std sta-
 8877  8540  ;   tus area may be used.
 8878  8540  ; please note that if the error was of such a kind that the
 8879  8540  ; transfer specified in the channelprogram was completed
 8880  8540  ; (statusinformation etc. ok), but the channel program was
 8881  8540  ; not terminated normally (f.x. error during storing of std
 8882  8540  ; status), then this procedure may increment firstaddr.curr buf
 8883  8540  ; to a value equal to lastaddr.curr buf + 2.
 8884  8540  ;
 8885  8540  ; registers: call              exit
 8886  8540  ; w0                           destroyed
 8887  8540  ; w1         curr receiver     unchanged
 8888  8540  ; w2         statusarea        destroyed
 8889  8540  ; w3         link              destroyed
 8890  8540  ;
 8891  8540  ; entry    : j12
 8892  8540  ;
 8893  8540  ; return   : link+0
 8894  8540  b. i5 w.
 8895  8540  j12 : rs. w3     i0.    ; update buf on error: save link;
 8896  8542        rl  w0  x2+2      ;   rem:= rem bytecount.statusarea;
 8897  8544        rl  w3  x2+0      ;
 8898  8546        se  w3     0      ;   if chan pg count.status area = 0 then
 8899  8548        jl.        i1.    ;   begin c. statusarea undefined;
 8900  8550        rl  w3  x1+a230   ;
 8901  8552        se  w3     0      ;     if chan pg count.stdstatus.curr rec
 8902  8554        bz  w3  x3-6+1    ;        <> 0
 8903  8556        ls  w3    -8      ;
 8904  8558        se  w3     1      ;     (and last command executed = read
 8905  8560        sn  w3     3      ;      or last command executed = write)
 8906  8562        jl.        i2.    ;     then rem:= rembytes.stdstatus.curr
 8907  8564        jl.       (i0.)   ;     else return;
 8908  8566  i2  : rl  w0  x1+a231   ;
 8909  8568  i1  : rs. w0     i3.    ;   end;
 8910  8570        al  w3     0      ;   saved rem:= rem;
 8911  8572        wd  w0  x1+p35+2  ;   rem:= rem // chars;
 8912  8574        sn  w3     0      ;   if saved rem mod chars <> 0 then
 8913  8576        jl.        i5.    ;   begin
 8914  8578        rl. w0     i3.    ;
 8915  8580        rl  w2  x1+p35+2  ;
 8916  8582        se  w2     q53    ;     rem:= saved rem -
 8917  8584        am         2      ;     if chars = chars per data segm
 8918  8586        ws. w0     i4.    ;     then 65536 else 256;
 8919  8588        sh  w0    -1      ;     if rem < 0
 8920  8590        jl.       (i0.)   ;     then return; c. should be impossib;
 8921  8592        al  w3     0      ;     rem:= rem // chars;
 8922  8594        wd  w0     4      ;   end;
 8923  8596  i5  : ac  w0    (0)     ;
 8924  8598        rl  w2     b18    ;   segments:=
 8925  8600        ba  w0  x2+m5     ;   no of segments.curr buf - rem;
 8926  8602        rl. w3     i0.    ;   update buf(segments,bytes);
 8927  8604        jl.        j11.   ;   c.return from there;
 8928  8606  
 8928  8606  ;variables
 8929  8606  i0  : 0                 ; saved link
 8930  8608  i3  : 0                 ; for saving rem
 8931  8610  i4  : 65536             ; constant for correcting rem, +0: data
 8932  8612        256               ;                              +2: addr m
 8933  8614  e.
 8934  8614  \f


 8934  8614  
 8934  8614  ; pej 28.09.77    disc driver, update retryinformation
 8935  8614  
 8935  8614  ; procedure update retryinformation(retryinformation)
 8936  8614  ; ---------------------------------------------------------------
 8937  8614  ; retryinformation: addr of the byte containing retryinformation.
 8938  8614  ;                   bit 0- 3: modeindex
 8939  8614  ;                   bit 4- 8: offsetindex
 8940  8614  ;                   bit 9-11: tries
 8941  8614  ;
 8942  8614  ; the procedure performs:
 8943  8614  ; - increments tries.
 8944  8614  ; - increments modeindex if tries flows over and sets tries to 1.
 8945  8614  ; - increments offsetindex if modeindex flows over and sets mode-
 8946  8614  ;   index to first value and tries to 1. not performed if
 8947  8614  ;   variable offset impossible.
 8948  8614  ;
 8949  8614  ; registers: call              exit
 8950  8614  ; w0                           destroyed
 8951  8614  ; w1         retryinformation  destroyed
 8952  8614  ; w2                           destroyed
 8953  8614  ; w3         link              unchanged
 8954  8614  ;
 8955  8614  ; entry    : j13
 8956  8614  ;
 8957  8614  ; return   : link+0: no more tries possible
 8958  8614  ;            link+2: next stobe-offset combination
 8959  8614  ;            link+4: next offset magnitude
 8960  8614  ;            link+6: tries <= 3 (mode/offset index unchanged)
 8961  8614  b. i4 w.
 8962  8614  j13 : rs. w1     i4.    ; update retryinformation:
 8963  8616        bz  w1  x1+0      ;   r:= core(retryinformation)
 8964  8618        al  w1  x1+1      ;   tries.r:= tries.r + 1;
 8965  8620        hs. w1    (i4.)   ;   core(retryinformation):= r;
 8966  8622        so  w1     2.100  ;   if tries.r <= 3
 8967  8624        jl      x3+6      ;   then return; c. link+6;
 8968  8626        la. w1     i0.    ;   tries.r:= 1;
 8969  8628        al  w1  x1+i1     ;   modeindex.r:= modeindex.r + 1;
 8970  8630        hs. w1    (i4.)   ;   core(retryinformation):= r;
 8971  8632        al  w2  x1+0      ;
 8972  8634        ls  w2    -8      ;
 8973  8636        bl. w0  x2+q20.-1 ;
 8974  8638        se  w0    -1      ;   if modetable(modeindex.r) <> -1
 8975  8640        jl      x3+2      ;   then return; c. link+2;
 8976  8642        la. w1     i2.    ;
 8977  8644        ls  w1    -3      ;
 8978  8646        al  w1  x1+1      ;   i:= offsetindex + 1;
 8979  8648        bl. w0  x1+q21.   ;
 8980  8650        am        (b19)   ;
 8981  8652        rl  w2     p5     ;
 8982  8654        se  w2     0      ;   if disctype.curr receiver = 0
 8983  8656        sn  w0    -1      ;   or offset table(i) = -1
 8984  8658        jl      x3+0      ;   then return; c. link+0;
 8985  8660        ls  w1     3      ;   r:= modeindex for next round << 8
 8986  8662        al  w1  x1+i3     ;       + i << 3 + 1;
 8987  8664        hs. w1    (i4.)   ;   core(retryinformation):= r;
 8988  8666        jl      x3+4      ;   return; c. link + 4;
 8989  8668  
 8989  8668  ; variables
 8990  8668  i0  : 2.111111111000    ; mask for zeroizing tries
 8991  8670  i1  = 2.000100000001    ; mask for incrementing modeindex, tries
 8992  8670  i2  : 2.000011111000    ; mask for zeroizing modeindex, tries
 8993  8672  i3  = q23<8+1           ; modeindex for next round << 8 + tries
 8994  8672  i4  : 0                 ; saved param retryinformation
 8995  8674  e.
 8996  8674  \f


 8996  8674  
 8996  8674  ; pej 30.09.77    disc driver, clean
 8997  8674  
 8997  8674  ; procedure clean(result)
 8998  8674  ; ---------------------------------------------------------------
 8999  8674  ; result: result to be used as parameter to deliver result.
 9000  8674  ;
 9001  8674  ; the procedure performs:
 9002  8674  ; - returns all messages queued to the driver with above
 9003  8674  ;   mentioned result.
 9004  8674  ; - zeroizes regretted.curr receiver.
 9005  8674  ; - sets transfer state.curr receiver idle.
 9006  8674  ; - if result = 5 (unknown) then state.curr receiver is set to
 9007  8674  ;   after intervention, the name of curr receiver is zeroized
 9008  8674  ;   and so is device address in all areaprocesses referring
 9009  8674  ;   to curr receiver. the same is performed on eventual logical
 9010  8674  ;   disc drivers referring to current receiver.
 9011  8674  ;
 9012  8674  ; registers: call               exit
 9013  8674  ; w0         result             destroyed
 9014  8674  ; w1                            curr receiver
 9015  8674  ; w2                            destroyed
 9016  8674  ; w3         link               destroyed
 9017  8674  ;
 9018  8674  ; entry    : j14
 9019  8674  ;
 9020  8674  ; return   : link+0
 9021  8674  b. i7 w.
 9022  8674  j14 : ds. w0     i1.    ; clean: save link, result;
 9023  8676        rl  w1     b19    ;
 9024  8678        rl  w2     g49    ;
 9025  8680        rs  w2  x1+p13    ;   transfer state.curr rec:= idle;
 9026  8682        al  w2     0      ;
 9027  8684        rs  w2  x1+a56    ;   regretted.curr rec:= 0;
 9028  8686        rs  w2     g20    ;   status.i/o answer:= 0;
 9029  8688        rs  w2     g21    ;   bytes.i/o answer:= 0;
 9030  8690        rs  w2     g22    ;   chars.i/o answer:= 0;
 9031  8692  i2  : rl  w2  x1+a54    ;   while next message.curr rec <>
 9032  8694        sn  w2  x1+a54    ;         addr of next message.curr rec do
 9033  8696        jl.        i3.    ;   begin
 9034  8698        rs  w2     b18    ;     curr buf:= next message.curr rec;
 9035  8700        jl  w3     g19    ;     deliver result(result);
 9036  8702        rl. w0     i1.    ;
 9037  8704        jl.        i2.    ;   end;
 9038  8706  i3  : se  w0     5      ;   if result <> 5
 9039  8708        jl.       (i0.)   ;   then return;
 9040  8710        al  w0     0      ;
 9041  8712        rs  w0  x1+p12    ;   state.curr rec:= after intervention;
 9042  8714        rl  w1     b4     ;   proci:= addr of 1st device.nametable;
 9043  8716  i4  : rs. w1     i1.    ;   repeat
 9044  8718        rl  w1  x1+0      ;     proc:= nametable(proci);
 9045  8720        rl  w3  x1+a10    ;
 9046  8722        rl  w0  x1+p2     ;
 9047  8724        sn  w0    (b19)   ;     if (mainproc.proc = curr receiver
 9048  8726        se  w3     q61    ;          and kind.proc = disc)
 9049  8728        sn  w1    (b19)   ;      or proc = curr receiver then
 9050  8730        jl.        i5.    ;      begin
 9051  8732        jl.        i7.    ;
 9052  8734  i5  : al  w0     0      ;
 9053  8736        rs  w0  x1+a11    ;        name(0).proc:= 0;
 9054  8738        rs  w0  x1+a52    ;        reserver.proc:= 0;
 9055  8740        rl  w3     b5     ;        areai:= first areaproc.nametable;
 9056  8742  i6  : rl  w2  x3+0      ;        repeat area:= nametable(areai);
 9057  8744        sn  w1 (x2+a50)   ;          if device addr.area:= proc
 9058  8746        rs  w0  x2+a50    ;          then device addr.area:= 0;
 9059  8748        al  w3  x3+2      ;          areai:= areai + 2
 9060  8750        se  w3    (b6)    ;
 9061  8752        jl.        i6.    ;        until areai = first internal;
 9062  8754  i7  : am.       (i1.)   ;      end;
 9063  8756        al  w1     2      ;      proci:= proci + 2
 9064  8758        se  w1    (b5)    ;
 9065  8760        jl.        i4.    ;   until proci = first area proc;
 9066  8762        rl  w1     b19    ;
 9067  8764        jl.       (i0.)   ;
 9068  8766  
 9068  8766  ; variables
 9069  8766  i0  : 0                 ; saved link
 9070  8768  i1  : 0                 ; saved result, proci in loop
 9071  8770  e.
 9072  8770  \f


 9072  8770  
 9072  8770  ; pej 04.10.77    disc driver, procedure correct data
 9073  8770  
 9073  8770  ; procedure correct data
 9074  8770  ; ---------------------------------------------------------------
 9075  8770  ;
 9076  8770  ; the procedure performs:
 9077  8770  ; - checks if the error correction information stored in status-
 9078  8770  ;   area1 of curr receiver may be used for correcting the data 
 9079  8770  ;   segment pointed to by first addr.curr buf.
 9080  8770  ; - performs the correction by copying the bad word(s)
 9081  8770  ;   from the buffer and back again after having corrected them.
 9082  8770  ;   the copying is performed by calling a monitor procedure.
 9083  8770  ;   two words are copied unless the errorburst starts in the
 9084  8770  ;   base word or last word of the segment.
 9085  8770  ;
 9086  8770  ; registers: call              exit
 9087  8770  ; w0                           destroyed
 9088  8770  ; w1         curr receiver     destroyed
 9089  8770  ; w2                           curr buf if corrected
 9090  8770  ; w3         link              destroyed
 9091  8770  ;
 9092  8770  ; entry    : j15
 9093  8770  ;
 9094  8770  ; return   : link+0: data not corrected
 9095  8770  ;            link+2: data corrected
 9096  8770  b. i25 w.
 9097  8770  j15 : rs. w3     i0.    ; correct data: save link;
 9098  8772        al  w2  x1+p16+16 ;   addr:=
 9099  8774        ld  w1    -100    ;   addr of ecc inf.statusarea1.curr rec;
 9100  8776        ds. w1     i2.    ;   sum:= 0;
 9101  8778        jl. w3     i16.   ;   sum:= sum
 9102  8780        21                ;         + (21 - char0.addr)
 9103  8782        452387            ;         * 452387;
 9104  8784        jl. w3     i16.   ;   sum:= sum
 9105  8786        88                ;         + (88 - char1.addr)
 9106  8788        72358             ;         * 72358;
 9107  8790        jl. w3     i16.   ;   sum:= sum
 9108  8792        12                ;         + (12 - char2.addr)
 9109  8794        315238            ;         * 315238;
 9110  8796        al  w2  x2+2      ;   c. now eccinf(0) = 0; addr:= addr + 2;
 9111  8798        jl. w3     i16.   ;   sum:= sum
 9112  8800        22                ;         + (22 - char0.addr)
 9113  8802        330902            ;         * 330902;
 9114  8804        wd. w1     i3.    ;   c. now eccinf(2) = err pattern << 8;
 9115  8806        al  w1  x1+1      ;   bitdisp:=
 9116  8808        wm. w1     i3.    ;   (sum // 585442 + 1) * 585442
 9117  8810        ws. w1     i2.    ;   - sum - 56 + 16;
 9118  8812        al  w0  x1-56+16  ;   c. is now base for error pattern;
 9119  8814        sl. w0    (i5.)   ;   if bitdisp outside segment
 9120  8816        jl.       (i0.)   ;   then not corrected return; c. link+0;
 9121  8818        sh  w0     0      ;   if bitdisp <= 0
 9122  8820        jl.        i15.   ;   then goto corrected;
 9123  8822        rl  w2     0      ;   c. error entirely in checkcharacters;
 9124  8824        al  w2  x2+11     ;
 9125  8826        al  w1     0      ;   bytedisp:=
 9126  8828        wd. w2     i6.    ;   (bitdisp + 11) / 12; c. w2;
 9127  8830        al  w3     0      ;
 9128  8832        wd. w0     i8.    ;
 9129  8834        al  w3  x3-24     ;   sh:= -24 + (bitdisp mod 24);
 9130  8836        sn  w3    -24     ;   if sh = - 24
 9131  8838        al  w3     0      ;   then sh:= 0;
 9132  8840        rs. w3     i9.    ;   save sh;
 9133  8842        al  w0     q52    ;
 9134  8844        ws  w0     4      ;   relative:=
 9135  8846        la  w0     g50    ;   even (segment size - bytedisp); c.w0;
 9136  8848        al. w1     i10.   ;   c. relative to firstaddr.curr buf;
 9137  8850        al. w3     i11.   ;   first:= first bad; last:= second bad;
 9138  8852        se  w0    -2      ;   if relative = -2 then
 9139  8854        jl.        i17.   ;   begin c. only one word;
 9140  8856        al  w0     0      ;     relative:= 0; first:= last;
 9141  8858        al  w1  x3+0      ;   end;
 9142  8860  i17 : sn  w0     q52-2  ;   if relative = segmentsize - 2
 9143  8862        al  w3  x1+0      ;   then last:= first; c. only 1 word;
 9144  8864        rl  w2     b18    ;   buf:= curr buf;
 9145  8866        rs. w1     i21.   ;   save first
 9146  8868        rl. w1     i25.   ;   store mode.call
 9147  8870        rs. w1     i20.   ;
 9148  8872  
 9148  8872        ds. w0     i23.   ;   save relative,last
 9149  8874        al. w1     i20.   ;   w1:= parameter address
 9150  8876        jd         1<11+84;   general copy(params,buf)
 9151  8878        se  w0     0      ;   if result <> 0
 9152  8880        jl.       (i0.)   ;   then not corrected return; c. link+0;
 9153  8882        am        (b19)   ;   c. align the err pattern to error;
 9154  8884        rl  w3     p16+18 ;   w3:= eccinf(2).statusarea1.curr rec;
 9155  8886        al  w0     0      ;   w0:= 0;
 9156  8888        ld. w0    (i9.)   ;   w3w0:= w3w0 shift sh;
 9157  8890        lx. w3     i10.   ;   first bad:= first bad xor w3;
 9158  8892        lx. w0     i11.   ;   second bad:= second bad xor w0;
 9159  8894        ds. w0     i11.   ;
 9160  8896        rl. w1     i24.   ;   change function in parameter list(from=curr,to=buf)
 9161  8898        rs. w1     i20.   ;
 9162  8900        al. w1     i20.   ;   w1:= parameter address
 9163  8902        jd         1<11+84;   general copy(params,buf)
 9164  8904        se  w0     0      ;   if result <> 0
 9165  8906        jl.       (i0.)   ;   then not corrected return; c. link+0;
 9166  8908  i15 : am.       (i0.)   ; corrected:
 9167  8910        jl         2      ;   return; c. link + 2;
 9168  8912  
 9168  8912  ; routine for updating sum. the routine performs:
 9169  8912  ;   sum:= sum + (k - (core(addr) shift (-16)) * m
 9170  8912  ;   core(addr):= core(addr) shift 8
 9171  8912  ; registers: call w2=addr, w3=link
 9172  8912  ;            exit w0w1=sum (also stored in i1i2), w2,w3=unch
 9173  8912  ; call     : jl. w3  i16.
 9174  8912  ;            k             link+0
 9175  8912  ;            m             link+2
 9176  8912  ;            returnpoint   link+4
 9177  8912  i16 : rl  w1  x2+0      ; update sum:
 9178  8914        al  w0     0      ;   w1:= core(addr); w0:= 0;
 9179  8916        ld  w1     8      ;   w0w1:= w0w1 shift 8;
 9180  8918        rs  w1  x2+0      ;   core(addr):= w1;
 9181  8920        sz  w0     8.200  ;   if char in w0 negative
 9182  8922        jl.       (i0.)   ;   then not corrected return;
 9183  8924        rl  w1  x3+0      ;
 9184  8926        ws  w1     0      ;   w1:= k - w0;
 9185  8928        wm  w1  x3+2      ;   w0w1:= w1 * m;
 9186  8930        aa. w1     i2.    ;   w0w1:= sum:= sum + w0w1;
 9187  8932        ds. w1     i2.    ;
 9188  8934        jl      x3+4      ;   return;
 9189  8936  
 9189  8936  ; variables
 9190  8936  i0  : 0                 ; saved link
 9191  8938  i1  : 0                 ; double word for sum
 9192  8940  i2  : 0                 ; -      -
 9193  8942  i3  : 585442            ; constant used in calculations
 9194  8944  i6  : 12                ; -        -    -  -
 9195  8946  i8  : 24                ; -        -    -  -
 9196  8948  i5  : q53*8+16          ; largest bitdisplacement + 1 + 16
 9197  8950  i9  : 0                 ; saved sh (shifts to align err pattern)
 9198  8952  i10 : 0                 ; to receive first bad word
 9199  8954  i11 : 0                 ; -  -       2nd   -   -
 9200  8956    
 9200  8956  ; parameters for general copy:
 9201  8956  i20 : 2<1+0             ; function(pair<1+mode),init: from=buf,to=curr
 9202  8958  i21 : 0                 ; first
 9203  8960  i22 : 0                 ; last
 9204  8962  i23 : 0                 ; relative
 9205  8964    
 9205  8964  i24 : 2<1+1             ; function(from=curr,to=buf)
 9206  8966  i25 : 2<1+0             ; function(from=buf,to=curr)
 9207  8968  e.
 9208  8968  \f


 9208  8968  
 9208  8968  ; pej 17.11.77    disc driver, update on corrected error
 9209  8968  
 9209  8968  ; procedure update on corrected error
 9210  8968  ; ---------------------------------------------------------------
 9211  8968  ;
 9212  8968  ; the procedure performs:
 9213  8968  ; - updates statistics concerning an error which has been
 9214  8968  ;   corrected either by incrementing the counter for errors
 9215  8968  ;   corrected within 3 retries (setmode param.curr receiver = 0)
 9216  8968  ;   or by incrementing a counter in the tables for errors
 9217  8968  ;   corrected by strobe-offset.
 9218  8968  ;
 9219  8968  ; registers: call              exit
 9220  8968  ; w0                           destroyed
 9221  8968  ; w1         curr receiver     unchanged
 9222  8968  ; w2                           unchanged
 9223  8968  ; w3         link              destroyed
 9224  8968  ;
 9225  8968  ; entry    : j16  -  used at transput
 9226  8968  ;            j17  -  used at control
 9227  8968  ; return   : link + 0
 9228  8968  c. q1
 9229  8968  b. i3 w.
 9230  8968  j16 : rl  w0  x1+p21    ; update on corrected transput error:
 9231  8970        se  w0     0      ;   if setmode param.curr rec = 0 then
 9232  8972        jl.        i1.    ;   begin
 9233  8974  j17 : am     (x1+p43)   ; update on corrected control error:
 9234  8976        al  w0     1      ;     corrected in 3 tries.curr rec:=
 9235  8978        rs  w0  x1+p43    ;     corrected in 3 tries.curr rec + 1;
 9236  8980        jl      x3+0      ;   end else
 9237  8982  i1  : rs. w3     i0.    ;   begin c. strobe-offset used;
 9238  8984        ls  w0    -4      ;     i:= setmode param(16:19).curr rec;
 9239  8986        am        (0)     ;     c. strobe and offset;
 9240  8988        bz  w3  x1+p44-1  ;
 9241  8990        al  w3  x3+1      ;     strobe offset table(i-1).curr rec:=
 9242  8992        am        (0)     ;     strobe offset table(i-1).curr rec+1;
 9243  8994        hs  w3  x1+p44-1  ;     c. i-1 as value 1 is counted in
 9244  8996        rl  w0  x1+p21    ;        byte o;
 9245  8998        sz  w0     2.11<4 ;     if setmode param(18:19).curr rec =0
 9246  9000        jl.        i2.    ;     then
 9247  9002        jl.       (i0.)   ;     begin
 9248  9004  i2  : la. w0     i3.    ;     i:= setmode param(20:23).curr rec;
 9249  9006        am        (0)     ;     c. offset magnitude;
 9250  9008        bz  w3  x1+p45    ;
 9251  9010        al  w3  x3+1      ;     offset magn. table(i).curr rec:=
 9252  9012        am        (0)     ;     offset magn. table(i).curr rec + 1;
 9253  9014                          ;     end;
 9254  9014        hs  w3  x1+p45    ;   end;
 9255  9016        jl.       (i0.)   ;   return;
 9256  9018  
 9256  9018  ; variables
 9257  9018  i0  : 0                 ; saved link
 9258  9020  i3  : 2.1111            ; for masking out offset magnitude
 9259  9022  e.
 9260  9022  z.
 9261  9022  
 9261  9022  \f


 9261  9022  
 9261  9022  ; pej 04.10.77    disc driver, end of code
 9262  9022  
 9262  9022  z.e.                    ; end disc driver block
 9263  9022  
 9263  9022  e.                      ; end area process-disc driver block
 9264  9022  
 9264  9022  \f


 9264  9022  \f


 9264  9022  
▶EOF◀