|
DataMuseum.dkPresents historical artifacts from the history of: RC3500 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC3500 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 16128 (0x3f00) Types: TextFileVerbose Names: »lmitxt078«
└─⟦2c55ea56f⟧ Bits:30001844 SW-save af projekt 1000, Alarm-system └─⟦093e2ad1c⟧ └─⟦this⟧ »lmitxt078«
;; ;; lmitxt078, set instructions ;; ; ; ;; all the set instructions, except setcr, share a common ;; code part, which takes care of: ;; 1. calculation of the address and length of the setoperand2 ;; 2. calculation of the address and length of the setoperand1 ;; 3. fetch of the next words from the setoperands ;; 4. finishing of the setinstructions ; ;; the setinstructions are interruptable by higher priority ;; interrupts. if a setinstruction is interrupted, then the ;; internal variables are stored on top of the stack, and ;; the bit "resume instruction" in the registerset is set ;; equal to one. when resuming an interrupted setinstruction ;; the above mentioned point 1 and 2 are replaced by fetching ;; the internal variables. ; ;; after execution of point 1 and 2 it is checked that the ;; lengths are even. at that time a preliminary ;; lastused is also calculated, and it should be tested that ;; there is room enough in the stack. this preliminary lastused ;; will not be changed during the execution of the setinstruction, ;; and it will be high enough, so that the internal variables ;; can be stored in the stack without increasing this lastused. ;; the final lastused will be calculated, when the setinstruction ;; is finished. .p ; ;; parameters and result of the setinstructions: ;; ;; setun, setin, setdi: ;; entry: set1, length1, set2, length2 ;; exit: resultingset, resultinglength ;; ;; seteq, setsb, setsp: ;; entry: set1, length1, set2, length2 ;; exit: boolean ;; ;; setst: ;; entry: address1, set2, length2 ;; exit: ;; ;; setre: ;; entry: address2, length2 ;; exit: set2, length2 ;; ;; revsm: ;; entry: address2, length2 ;; exit: set2 ;; ;; setad: ;; entry: set2, length2, newlength ;; exit: resultingset, newlength ;; ;; setcr: ;; entry: from, to ;; exit: resultingset, resultinglength .p ; ;; the slice registers are used as follows during execution ;; of the setinstructions: ;; ;; w0 counter: counts the byteno(incremented by 2) of ;; the wordno of the set. ;; w21 address1: current address of the resulting set, and ;; of setoperand1 in case of dyadic setinstructions ;; (f. i. setun and seteq) ;; w3 setop1: the next word of set1, and the next word of ;; the resulting set. ;; w4 setop2: the next word of set2. ;; w65 address2: current addres of setoperand2. ;; in case of setcr w5 and w6 are used as follows: ;; w5 from: start of the interval, which defines the set. ;; w6 to: end of the interval, which defines the set. ;; w7 control bits: a bitmask, that controls the microprogram ;; flow of the setinstruction(for further explanation, see ;; below). ;; w10 length1 ( newlength in case of setad, zero if unused) ;; w11 length2 ;; during the above mentioned point1 and 2 the registers w3 and w4 ;; are temporaryly used instead of the registers w5 and w6. .p ; ;; description of the control bits: ;; ;; the control bits, which reside in w7 are used by the common code ;; part to control the microprogram flow. the bits are used as ;; follows: ;; ;; part: 1 2 2 2 3 3 4 4 1 ;; bit 8 9 10 11 12 13 14 15 7 hex ;; ;; setun: ;; setin: ;; setdi: . 1 1 . . 1 1 . . 66 ;; ;; seteq: ;; setsb: ;; setsp: . 1 1 . . 1 . 1 . 65 ;; ;; revsm: . . . . . . 1 1 1 103 ;; ;; setre: . . . . . . 1 . 1 102 ;; ;; setst: . 1 . . . . . . . 40 ;; ;; setad: 1 . . . . . 1 . . 82 ;; ;; ;; setcr: 1 . . 1 1 . 1 . 1 19a ;; ;; the bits are used in parts 1 thru 4 of the common code part ;; as indicated above. .p ; ;; part 1, calculate the address and length of setoperand2. ; prepset: ; q:=10,, ; zd1 and q,s, ; zro:=not resume instruction w1:=c:slu,,cjp not zro prepset10; c:=0; c,w1 is used to calculate the preliminary lu ; if resume then jump q:=zd1 ior q,, ; resume:=true zd1:=q,, ; w0:=0,,cjs readlucq ; w7,w10:=0,s, ; length1:=0; w11:=q,,cjp not b15 prepset2; jump if not revsm and not setre and not setcr; w4:=w11,,cjs readlucq ; w7,w3:=q,s, ; w4:=w11; w3:=readlucq; bus:=w4,s,cjp b0 prepset1 ; jump if setcr w3:=w3--,,cjs readlucq ; w3:=disp2-1 w1:=c:w1+w11,,cjp b1 nillerr; w4:=q,,cjp prepset4 ; w4:=base2 ; prepset1: ;; setcr ;; w3=from, w4=to bus:=w3,s,cjp b0 prepset1b ; if to<0 or from>to then w3--w4,s,cjp not b0 prepset1a; length2:= 0 (*empty set*) w3:=,,cjp prepset1c ; else if from<0 then from:= 0; prepset1a: ; ,,cjp not acy prepset1c ; prepset1b: ; w11:=,,cjp prepset4 ; prepset1c: ; w11:=c:w11+10,, ; w11:=to+16 ir:=2,q:=w1-2,,push 2 ; prepare rotate c:=7fc,w11:=>w11 and 7fc,,rfct ; length2:= to // 16 * 2 + 2 ; w1:=c:w11+q,,cjp prepset4 ; c,w1:=newlu ; prepset2: ;; setdyadic, setst, setad w4:=slb,,cjp not b0 prepset3; base2:=slb; jump if not setad w10:=w11,,cjs readlucq ; length1:=newlength w2:=w10-q,s, ; length2:=readlucq ; acy:=newlength >= length2 w11:=q,,cjp not acy prepset3; jump if not newlength >= length2 w1:=w1+w2,, ; increment preliminary lu ; prepset3: ; slu:=slu-w11,, ; skip over set2 w3:=slu,, ; disp2:= the beginning of set2 .p ; ;; part 2, calculation of the address and length of setoperand1 ; prepset4: ;; read the second operand ;; c,w1 + setworklen = preliminary lu ;; w7= control bits ;; w10=if setad then newlength else 0 ;; w43=if setcr then (to,from) else address2 ;; w11=length2 ;; w0=0 ; ;; stack overflow is tested now ,,cjp cry stackerror ; overflow into next memory module q:=w1+setworklen,s, ; q:=preliminary lu ,,cjp acy stackerror ; overflow into next memory module zd0-q,s, ; w7:=w7+w7,s,cjp not acy stackerror; overflow if not lm>=preliminary lu ; set preliminary lu zd:=q,,cjp b0 prepset6 ; jump if setdyadic or setst ; prepset5: ; w2:=slb,, ; address1:=lastused w1:=slu,,cjp prepset8 ; ; prepset6: ;; setdyadic or setst ,,cjs readlucq ; w7,s, ; w1:=q--,,cjp b1 prepset7 ; jump if setdyadic ,,cjs readlucq ; w2:=q,,cjp not b1 prepset8 ; w21:=address1 ,,cjp nillerr ; ; prepset7: ;; setdyadic w10:=q,, ; length1:=readlucq slu:=slu-w10,,cjp prepset5 ; skip over set1 ; prepset8: ; w7:=<w7+w7,, ; w7:=w7+w7,, ; w10 ior w11,s, ; b15 means that the addresses are odd q:=setodde,, ; w5:=w3,,cjpp b15 xept ; jump if exception w6:=w4,,crtn ; w65:=w43 ; prepset10: ;; resume the instruction after interrupt w7:=<w7+w7,, ; w7:=<w7+w7,,cjs readlucq ; w11:=q,,cjs readlucq ; w10:=q,,cjp stgetadbc ; .p ; ;; part 3 fetch of the next words from the setoperands ; getsetop: ; w0-w10,s, ; acy:= w0>=w10 w0-w11,s,cjp not acy getsetop1; ,,cjp acy setfin ; fin getsetop1: ; w0:=w0+2,, ; counter:=counter+2 w7+w7,s, ; status of control bits w11-w0,s,cjp not acy getsetop3; jump if not setcr ;; setcr w4:=w0-2,,push 2 ; w4:=w4+w4,,rfct ; w4:=bitno w3:=0,,push 0f ; w3:=the next bitword of the set w3:=w3+w3,, ; shift w3 w4-w5,s, ; acy:=bitno>=from w6-w4,s,cjp not acy getsetop2; acy:=t0>=bitno ,,cjp not acy getsetop2 ; w3:=w3++,, ; set a bit getsetop2: ; w4:=w4++,,rfct ; loop w4:=0,,crtn ; ; getsetop3: ;; not setcr ;; acy: length2>=counter w8:=w0,, ; w4:=0,,cjp not acy getsetop3a; ,,cjs readonext ; w4:=q,, ; getsetop3a: ; w7+w7,s, ; w3:=,,cjp not b0 getsetop4 ; jump if not dyadic ;; ;; fetch setoperand1 ;; w10-w8,s, ; ,,cjp not acy getsetop4 ; jump if length1>=counter w1:=w1++,,cjs reado12 ; w1:=w1--,, ; w3:=q,, ; ; getsetop4: ; w0:=w8,,crtn ; .p ; putsetop: ; ir:=,,cjs writenext ; syncronize itr settestitr: ; int,,h ,cjs testint1 ; w4:=w2,,crtn zro ; return if no interrupt ; ;; interrupt w8:=w1,, ; save w21 w1:=zd,, ; w2:=zd2,, ; w21:=lastused w1:=w1-setworklen,, ; w3:=w4,,cjs writenext ; w3:=w8++,,cjs writenext ; write the internal variables w3:=w6,,cjs writenext ; to the top of stack w3:=w5++,,cjs writenext ; w3:=w0,,cjs writenext ; w3:=w10,,cjs writenext ; w3:=w11,,cjs writenext ; ,,cjpp sfetch ; ; advance: ; w1:=w1+2,, ; ,,cjp settestitr ; .p ; ;; part 4, finishing of the setinstructions ; setfin: ; w7:=<w7+w7,,loop ; w7,s, ; w3:=w10,,cjp b0 setfin2 ; jump if setresult on top of stack ; ;; no set result on top of stack ,,cjp not b1 setfin1 ; jump if not boolean result ; ;; boolean result w3:=1,, ; result:=true w1:=w1-w0,,cjp setfin3 ; ; setfin1: ;; setst w1:=w5-4,, ; unstack w1:=w1-w11,,cjp setfin4 ; ; setfin2: ;; setresult on top of stack w10-w11,s,cjp b1 setfin4 ; jump if revsm ,,cjp acy setfin3 ; w3:=w11,, ; w3:=max( length1, length2 ) ; setfin3: ; ,,cjs writenext ; write length or boolean result ; setfin4: ; q:=zd1,, ; q:=q clr 10,, ; resume instruction:=false zd1:=q,, ; zd:=w1,,cjs setslice ; update lastused sic:=sic++,,cjp fetch ; ; setfalse: ; w3:=0,, ; w0:=w0-2,, ; counter:=counter-2 w1:=w1-w0,,cjp setfin3 ; .p ; .instruction setun ; set union bus:=66,,, ; setun0: ; w7:=swp,,cjs prepset ; setun1: ; ,,cjs getsetop ; w3:=w3 ior w4,,cjs putsetop; ,,cjp setun1 ; ; .instruction setin ; set inclusion bus:=66,,, ; w7:=swp,,cjs prepset ; setin1: ; ,,cjs getsetop ; w3:=w3 and w4,,cjs putsetop; ,,cjp setin1 ; ; .instruction setdi ; set difference bus:=66,,, ; w7:=swp,,cjs prepset ; setdi1: ; ,,cjs getsetop ; w3:=w3 clr w4,,cjs putsetop; ,,cjp setdi1 ; ; .instruction seteq ; set equal bus:=65,,, ; w7:=swp,,cjs prepset ; seteq1: ; ,,cjs getsetop ; w3-w4,s, ; ,,cjp not zro setfalse ; ,,cjs advance ; ,,cjp seteq1 ; ; .instruction setsb ; set subset bus:=65,,, ; w7:=swp,,cjs prepset ; setsb1: ; ,,cjs getsetop ; w3 clr w4,s, ; ,,cjp not zro setfalse ; ,,cjs advance ; ,,cjp setsb1 ; ; .instruction setsp ; set superset bus:=65,,, ; w7:=swp,,cjs prepset ; setsp1: ; ,,cjs getsetop ; w4 clr w3,s, ; ,,cjp not zro setfalse ; ,,cjs advance ; ,,cjp setsp1 ; ; .instruction setcr ; set create q:=19a,, ; q,,cjp setun0 ; ; .instruction setst ; set store q:=40,, ; q,,cjp setun0 ; ; ;;.instruction setre ; set retreive ;; q:=102 ;; q, cjp setun0 ; ;;.instruction revsm ; retreive value stack multiple ;; q:=103 ;; q, cjp setun0 .p ; .instruction setad ; set adjust bus:=82,,, ; w7:=swp,,cjs prepset ; setad1: ; ,,cjs getsetop ; w10-w0,s,cjs setad2 ; acy:=length1>=counter ,,cjp setad1 ; setad2: ; w3:=w4,,cjp acy putsetop ; putsetop if length1>=counter w11-w0,s, ; zro:=last iteration w4,s,cjp not zro setad3 ; w11:=0,, ; make sure that length1 >= length2 when finishing setad3: ; ,,cjp zro settestitr ; q:=setade,, ; ,,cjpp xept ; exception: the set can not be truncated .p ; ;; the instruction settm does not use the common set ;; code part. it is not interruptable ; .instruction settm ; set test membership ,,cjs readlucq ; w7:=q,, ; w7:=length of the set slu:=slu-q,,cjs readlucq ; skip over the set ir:=0f,w1:=q and 0f,, ; w1:=position in the word; prepare rotate w0:=c:q+10,, ; w5:=slu,,push 2 ; c:=7fc,w0:=>w0 and 7fc,,rfct ; w0:=wordno c:w7-w0,, ; cry:= w7>=w0 w5:=w5+w0,,cjp not cry arit2boo; jump if set too short w6:=slb,,cjs readonext ; w3:=q,, ; w3:= the word set rc:=w1,, ; w3:=<c<w3,,rpct k ; cry:=the element is a member of the set ir:=,,cjp arit2boo ; ;; ;; end of lmitxt078 ;; .p ; «eof»