gnore 5$: save $discon #rab1 $close #fab$work $discon #rab2 $close #fab$scwork mov #cutmap ,r1 mov #cutopen,r2 10$: tst @r1 ; see if this is the end of cutpaste beq 30$ ; files tst (r2)+ ; not end, is this one open now? beq 20$ ; no mov @r1 ,r3 ; yes, index to the channel map asl r3 ; words please $discon rablst(r3) ; disconnect access stream $close fablst(r3) ; simple 20$: tst (r1)+ ; next please br 10$ ; simple 30$: 100$: unsave return cretm1:: cretm2::mov #1 ,r0 return .sbttl help routines opnhlp::save ; save temp registers mov #fab$hl ,r2 ; tst o$ifi(r2) ; file already open? beq 5$ ; no $discon #rab$hl ; yes, close up please $close r2 ; ... 5$: mov sp ,r1 ; save stack pointer sub #100 ,sp ; allocate a filename buffer mov sp ,r3 ; and a pointer to buffer mov #hlpdef ,r2 ; copy the default string 10$: movb (r2)+ ,(r3)+ ; move a byte bne 10$ ; and do it again until a null dec r3 ; back up over the null mov 2+4(r1) ,r2 ; get address of filename 20$: movb (r2)+ ,(r3)+ ; and copy it until a null bne 20$ ; next dec r3 mov #hlptyp ,r2 ; stuff a filetype in 30$: movb (r2)+ ,(r3)+ ; ... bne 30$ ; mov sp ,r3 ; point back to the buffer mov r3 ,-(sp) ; setup to call strlen call strlen ; get the string length tst (sp)+ ; pop parameter mov #fab$hl ,r2 ; get the fab address $store r3,FNA,r2 ; stuff the filename in $store r0,FNS,r2 ; and the filename size $open r2 ; open it $fetch r0,STS,r2 ; and see if it worked bmi 90$ ; no mov #rab$hl ,r2 ; it's open, now connect rab $connec r2 ; ... $fetch r0,STS,r2 ; successfull ? bmi 90$ ; no mov #1 ,r0 ; yes, return success br 100$ ; exit 90$: mov r0 ,tedsyserror ; save error code clr -(sp) mov r3 ,-(sp) call putbin cmp (sp)+ ,(sp)+ clr r0 ; return(0) 100$: add #100 ,sp ; pop local buffer and exit unsave ; pop regs return ; exit .sbttl open/create file openfi::save mov sp ,r4 ; get pointer to arglist add #4*2 ,r4 ; got it mov #cfile ,r3 ; assume fileio ? cmpb 2(r4) ,indlun ; is that the case bne 10$ ; yes mov #cind ,r3 br 20$ ; open it 10$: cmpb 2(r4) ,inlun ; for reading ? beq 20$ ; yes call cre ; no, create the thing br 100$ 20$: call ope 100$: unsave return closef::save cmpb 2+4(sp) ,kblun beq 80$ mov #cfile ,r2 cmpb 2+4(sp) ,indlun bne 10$ mov #cind ,r2 10$: asl r2 mov rablst(r2),r3 $discon r3 mov fablst(r2),r3 $close r3 80$: mov #1 ,r0 100$: unsave return .sbttl open for read ope: asl r3 ; index into rab/fab mapping mov fablst(r3),r2 ; get the fab address mov rablst(r3),r3 ; get the rab address also mov @r4 ,-(sp) ; get filename length call strlen ; length tst (sp)+ ; pop arglist $store @r4,FNA,r2 ; stuff the filename address $store r0,FNS,r2 ; insert the filename size $store #FB$GET,FAC,r2 ; get access only $store #proxab,XAB,r2 ; find out file protection $open r2 ; open the file please $fetch r0,STS,r2 ; see if the open worked bmi 90$ ; failed $connec r3 ; connect access stream $fetch r0,STS,r3 ; see if that worked bmi 90$ ; no mov (r2),filesize ; save size of infile mov #1 ,r0 ; success br 100$ ; exit 90$: mov r0 ,tedsyserror ; save error and exit clr r0 ; flag failure 100$: return setmbc::save mov #rab$fi ,r3 mov #fab$fi ,r2 ;- cmpb cmdlun ,kblun ;- bne 100$ call pdpbuf $store r0,BPA ,r2 $store r1,MBC ,r3 mul #1000 ,r1 $store r1,BPS ,r2 100$: unsave return clrmbc::mov #rab$fi ,r0 $store #0,MBC ,r0 mov #fab$fi ,r0 $store #0,BPA ,r0 $store #0,BPS ,r0 return .sbttl create seq file cre: asl r3 ; index into rab/fab mapping mov fablst(r3),r2 ; get the fab address mov rablst(r3),r3 ; get the rab address also mov @r4 ,-(sp) ; get filename length call strlen ; length tst (PDPOPNMAC[.050036]PDPOPN.MAC[.050036]    X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddfsp)+ ; pop arglist clr (r2) ; clear filesize $store #FB$SEQ,ORG,r2 ; sequential file $store #FB$CR,RAT,r2 ; implied carriage control $store #FB$VAR,RFM,r2 ; variable $store #FB$PUT,FAC,r2 ; get access only $store @r4,FNA,r2 ; stuff the filename address $store r0,FNS,r2 ; insert the filename size cmpb systyp ,#4 ; RSTS/E ? bne 10$ ; no $store #FB$STM,RFM,r2 ; yes, default to stream ascii please $store #0,RAT,r2 ; ... 10$: $create r2 ; open the file please $fetch r0,STS,r2 ; see if the open worked bmi 90$ ; failed $connec r3 ; connect access stream $fetch r0,STS,r3 ; see if that worked bmi 90$ ; no mov #1 ,r0 ; success br 100$ ; exit 90$: mov r0 ,tedsyserror ; save error and exit clr r0 ; flag failure 100$: return .end