$ > AsmPDP PDP11 Assembler v1.22 RA$=OS_GetEnv:Ver$="1.22":Win_TextIO:ftype%=&FFD:load%=-1:exec%=-1:AssemInit Wfmax%=10:word% 7,cache% 259,file$(fmax%),ptr%(fmax%):eol$=10:os%>31:eol$=13+10 ( [ []]]":exit(0): ZA$=" "+A$:A%=A$," -D"): dLA%:B%=A$," ",A%+2):C%=A$,"-",A%+2):B%=0C%=0C%>B%:PreLabel:A%=A%-1 n&A%=A$," -D",A%+1):A%=0:A$=A$,2) x5in$=cl("",0):out$=cl("",0):lst$=cl("",0):if%= =in$=""vb%:cpu$" Assembler v"Ver$;"/"+ver$,Ver$<>ver$) 6in$="":"Input file: "in$:"Output file: "out$ in$="":exit(0): ;debug%:" in$='"in$"'"'"out$='"out$"'"'"lst$='"lst$"'" Ein%=openin("",in$):in%=0:"File '"in$"' not found":exit(214): 4out$<>"":out$=f_name(out$):out%=openout(out$) 4lst$<>"":lst$=f_name(lst$):lst%=openout(lst$) U:" ";error$;part$,error$<>"");" ",error$<>"");"in "in$:CloseAll:exit(): >pass%=12:#in%=0:Line$="":P%=0:O%=0:L%=0:errs%=0:fnum%=0 (:if%=::AssemLine:pass%=2:Pass2 P%=P%+num%:O%=O%+num%:#in% 0if%:pass%=2:err("Missing #ENDIF in "+in$) Xfnum%=fnum%-1:fnum%>-1:in$=file$(fnum%):#in%:in%=openin("",in$):#in%=ptr%(fnum%) 4fnum%<0:pass%:lst("Errors: "+errs%):lst("") CloseAll:exit(errs%) 4out$<>"":f_settype(out$,ftype%):f_stamp(out$) "5out$<>"":load%<>-1:f_setaddr(out$,load%,exec%) ,2lst$<>"":f_settype(lst$,&FFF):f_stamp(lst$) 6exit(errs%) @ J+Pass2:num%>0:num%<256:cache%?num%=0 T)op%<>-1:cache%?1=op%256:?cache%=op% ^;num%:out%:L%=0P%"":err(error$+part$) | Cerr(A$):lst("****** "+A$):lst(""):errs%=errs%-(errs%<127): "Win_TextIO:os%<32<&FFFF: ,ș"GetStdHandle",-10@hfile%(1):*INPUT 1 -ș"GetStdHandle",-11@hfile%(2):*OUTPUT 2  CloseAll #in% =in%:in%:A%=in%:in%=0:#A% 'in0%=in0%:in0%:A%=in0%:in0%=0:#A% 'out%=out%:out%:A%=out%:out%=0:#A% 'lst%=lst%:lst%:A%=lst%:lst%=0:#A%   lst(A$):vb%:A$;:A$="": (lst%:#lst%,A$;:A$="":#lst%,eol$;  ݤvalue(V$):A%,B%,V% ;::=26:error$="Undefined label":=P%error$=$:=P% &#A%=V$,"$+"):A%=0:A%=V$,"$-") 0"A%=0:A%=V$,"+$"):A%:A%=A%+1 :"A%=0:A%=V$,"-$"):A%:A%=A%+1 D#A%:V$=V$,A%-1)+"P%"+V$,A%+1) N X[A%=V$,"'"):A%:V$,A%+2,1)="'":V$,"""")=0:V$=V$,A%-1)+×V$,A%+1,1)+V$,A%+3)A%=0 b A%=0 l vAA%=0:V$,"""")=0:A%=V$,"@"):A%:V$=V$,A%-1)+"&o"+V$,A%+1)  A%=0 .A%=V$,"&o"):A%=0:A%=V$,"&O"):A%=0:=V$ :V%=0:B%=A%+2 #:V%=(V%<<3)+V$,B%,1):B%=B%+1  V$,B%,1)<"0"V$,B%,1)>"7" V$=V$,A%)+~V%+V$,B%) #A%=V$,"&o"):A%=0:A%=V$,"&O")  A%=0 =V$ SetLabel C::=31:error$="Invalid label name":error$=$:Word$="": :Word$=".BYTE"Word$=".WORD":Word$="EQU"+Word$,2,1): !Word$=".BLKB":Word$="EQUM": gWord$=".ASCII"Word$=".ASCIIZ":Item$=""""+Item$,2,Item$-2)+""""+",0",A$,1)="Z"):Word$="EQUB":  %Word$=".ALIGN":ALIGN:Word$="": /Word$=".EVEN":op%=0:num%=(P%1):Word$="":  OLabel$,1)=".":Label$=Label$,2)Label$,1)=":":Label$=Label$,Label$-1) *7part$=" setting '"+Label$+"'":Label$="_BSS%":L%=P% 4;uc(Item$,4))<>"EQU ":Var_Assign(Label$,P%):word: >jLabel$,1)="$":Var_Assign(Label$,""""+value(Item$,5))+"""")Var_Assign(Label$,ävalue(Item$,5))) HWord$="": R$PreLabel:L$,V$:B%=0:B%=A$+1 \-L$=A$,A%+3,B%-A%-3):A$=A$,A%-1)+A$,B%) f5A%=L$,"="):A%:V$=L$,A%+1):L$=L$,A%-1)V$="-1" pVar_Assign(L$,V$): z4ݤo0(A%,N%):A$,B%,L%:A%<0:B%=2:A%=A%&7FFFFFFF ;A$=(A%7)+A$:A%=A%8:L%=L%+3:L%>27:=(A%+B%)+A$,N%) ݤuc(A$):B$:A$="":="" 5B$=B$+(A$((A$<"@")&DF)):A$=A$,2):A$="":=B$ \word:A%=Item$+" "," "):Label$=Item$,A%-1):Word$=uc(Label$):Item$=s(Item$,A%+1)): CEQU:byte%=1:Word$="EQUM":num%=value(Item$):Fill:Word$="": Ynum%=0:size%="SBW D",Word$,1))-1:size%=size%-(size%=0):byte%=size%:byte%>2:byte%=2 2:EQUItem:Item$=s(Item$,Item$+",",",")+1)) >Item$=""num%>252:num%>252:error$="Equate item too long" Word$="": EQUItem:type%= ':type%=type%+1:type%::,$ 6type%:cache%!num%=value(Item$):num%=num%+size%: qItem$,1)="""":A%=Item$,"""",2):A%:A$,A%+1,1)<>"+":A$=Item$,2,A%-2):Item$=Item$,A%+1)A$=value(Item$) +$(cache%+num%)=A$:num%=num%+A$:byte%=1  YALIGN:num%=(P%1):byte%=1:Item$<>"":num%=value(Item$):num%=((P%+num%)(-num%))-P% $ Fill: .=Fill:num%>0:num%<257:A%=0num%-1:cache%?A%=0::op%=0 8!num%<0:error$="Code overrun" B LJAssemLine:Item$="":Word$="":num%=0:op%=-1:error$="":part$="":byte%=1 VJLine$=#in%:Line$="":#in%>1:#in%=#in%-2:#in%<>#in%:Line$=#in% `GA%=Line$,9):A%:Line$=Line$,A%-1)+8-(A%-1)8," ")+Line$,A%+1) jA%=0:debug%:Line$ t:A%=Line$+";",";"):Text$=Line$,A%-1):Line$=Line$,A%) ~Item$=s(Text$):Item$="": #word:Word$,1)="#":Control:  if%: 6Word$,1)="."Word$,1)=":":SetLabel:Word$="": Word$,3)="EQU":EQU: #Word$="ORG":P%=value(Item$): Word$="ALIGN":ALIGN:  Assem:  Control Word$="#ENDIF":if%=if%2: Word$="#ELSE":if%=if%1: 'Word$="#IF":If(value(Item$)=0): Word$="#IFDEF":IfDef: 'Word$="#IFNDEF":IfDef:if%=if%1:  if%:  Word$="#INCLUDE":Include: "Word$="#ERROR":error$=Item$: (IWord$="#DEFINE":word:Item$="EQU "+Item$+"-1",Item$=""):SetLabel: 2 <If(A%):if%=if%*2+(A%1): FGIfDef:Item$,1)="$":V%=value("LEN("+Item$+")")V%=value(Item$) P0If(error$<>""=26):error$=error$,<>26): Z Include d-::error$="#include "+Item$+": "+$: n>Item$,1)="<":P$=fn_path(run$)+"lib"+d$P$=fn_path(in$) x,F$=Item$:"<""",F$,1)):F$=F$,2,F$-2) in0%=openin(P$,F$) ?in0%=0:Item$,1)="<":P$=fn_path(in$):in0%=openin(P$,F$) %in0%=0:P$="":in0%=openin(P$,F$) 3in0%=0:error$="#include "+Item$+" not found": 4file$(fnum%)=in$:ptr%(fnum%)=#in%:fnum%=fnum%+1 %#in%:in%=in0%:in0%=0:in$=P$+F$: ݤopenin(P$,A$):in0% E::(255)=&CC:A%=fn_path(A$):A$=A$,A%)+A$,A%+1),10)=0 &in0%=(P$+f_name(A$)):in0%:=in0% +A$=A$+s$+ext$:in0%=(P$+A$):in0%:=in0% A$=A$,A$-ext$-1) *A%=1A$:A$,A%,1)="\":A$,A%,1)="/" 2(A$,A%,1)&FE)=46:A$,A%,1)=(A$,A%,1)1) A%:=(P$+f_name(A$)) ݤopenout(A$):A$="":=0 A%=(A$):A%:=A% "/"Can't open '"A$"'":CloseAll:exit(192): ,=0 6&ݤfn_path(A$):A%,B%:A%=A$,":",2) @)B%=A%:A%=A$,d$,A%+1):A%=0:=A$,B%) JVݤf_name(A$):os%>31:A%,B%:B%=A%:A%=A$,"\",A%+1):A%=0:A$,".",B%)=0:A$=A$+"." T=A$ ^f_settype(A$,A%):os%>8: h"SetType "+A$+" "+~A%: rf_stamp(A$):os%>8: |"Stamp "+A$: f_setaddr(A$,L%,E%): OAssemInit:cpu$="PDP11":asm$="AsmPDP":ftype%=&1C5:ext$="mac":ver$="1.20": 1AssemList:lst(o0(P%,6)):num%:AssemList1 :byte%=2:lst(1+7*(3-((num%-1)6)/2-4*(num%=0))," ")) Fbyte%<>2:num%:((num%-1)7)>6:lst(""):(num%7)=0:lst(6," ")) *byte%<>2:lst(1+4*(7-(num%7))," ")) Text$<>"":lst(Text$) AA%=(24-Text$,24))(Text$<>""):A%:Line$<>"":lst(A%," ")) Line$<>"":lst(Line$) lst(""): NAssemList1:A%=0num%-11-(byte%=2):A%:(A%7)=0:lst(""):lst(6," ")) Hbyte%=2:lst(" "+o0(cache%!A%&FFFF,6))lst(" "+o0(cache%?A%,3)) :  Assem 7byte%=2:num%=2:Word$="BSS":L%=P%:_BSS%=P%:num%=0: 9A%="CLRCOMINCDECNEGADCSBCTSTRORROLASRASL",Word$,3)) &=A%:(A%-1)3=0:op%=5*8*8*8+(A%3)*8*8+byte+dd(Item$): 0$A%="MOVCMPBITBICBIS",Word$,3)) :=A%:(A%-1)3=0:op%=((A%+2)3)*8*8*8*8+byte+sd(Item$): D)A%="BPLBMIBHIBLSBVCBVSBCCBCS",Word$) NLA%=0:A%="BLO BHISBLOS",Word$):(A%-1)4=0:A%=(7-A%4)*3+1:A%=16:A%=10 X=A%:(A%-1)3=0:op%=(A%3)*256+1*8*8*8*8*8+disp(Item$): b/A%=0+0+0+"BR BNEBEQBGEBLTBGTBLE",Word$) l1A%:(A%-1)3=0:op%=(A%3)*256+disp(Item$): v+Word$="ADD":op%=6*8*8*8*8+sd(Item$): ,Word$="SUB":op%=14*8*8*8*8+sd(Item$): $A%="MUL DIV ASH ASHCXOR",Word$) AA%:(A%-1)4=0:op%=7*8*8*8*8+(A%4)*8*8*8+rd(Item$,A%<16): +Word$="JSR":op%=4*8*8*8+rd(Item$,0): 'Word$="JMP":op%=1*8*8+dd(Item$): (Word$="SWAB":op%=3*8*8+dd(Item$): /Word$="SXT":op%=6*8*8*8+7*8*8+dd(Item$): MWord$="RTS":A%=r(Item$):op%=2*8*8+A%:error$="Missing register",A%<0): )Word$="CSM":op%=7*8*8*8+dd(Item$): -Word$="EMT":op%=68*8*8*8+value(Item$): 4Word$="TRAP":op%=68*8*8*8+4*8*8+value(Item$): 3Word$="MARK":op%=6*8*8*8+4*8*8+value(Item$): .Word$="SPL":op%=2*8*8+3*8+value(Item$): %A%="MTPSMFPDMTPDMFPS",Word$,4))  EA%:(A%-1)4=0:op%=1*8*8*8*8*8+6*8*8*8+(A%4+4)*8*8+dd(Item$): A%="MFPIMTPI",Word$,4))  9A%:(A%-1)4=0:op%=6*8*8*8+(A%4+5)*8*8+dd(Item$): *XWord$="SOB":A%=Item$,","):op%=63*8*8*8+r(Item$,A%-1))*8*8+disp6(Item$,A%+1)): 46Word$,2)="CL":op%=160+"CV N N",Word$,3,1)): >6Word$,2)="SE":op%=176+"CV N N",Word$,3,1)): H9A%="HALT WAIT RTI BPT IOT RESETRTT MFPT ",Word$) RA%:(A%-1)5=0:op%=A%5: \Word$="CCC":op%=175: fWord$="SCC":op%=191: pWord$="NOP":op%=160: z$Word$="ADR"Word$="ADDR":ADR: $num%=0:error$="Unknown opcode": 2ݤbyte:Word$=4:(Word$,4,1)="B"):=8*8*8*8*8 )Word$<>3:error$="Bad opcode suffix" =0 3ADR:ab%:Word$="MOV":Item$="#"+Item$:Assem: *Line0$=Line$:Text0$=Text$:Item0$=Item$ FA%=Item0$,","):Word$="MOV":Item$="PC"+Item0$,A%):Assem:op0%=op% QA%=Item0$,","):Word$="ADD":Item$="#"+Item0$,A%-1)+"-$-2"+Item0$,A%):Assem Hnum%=num%+2:cache%!4=cache%!2:cache%?3=op%256:cache%?2=op%:op%=op0% ,Line$=Line0$:Text$=Text0$:Item$=Item0$: #ݤmr(A$):A%,m%,r%,v%:A$=s(A$)  A$,1)="(":A$,1)=")":m%=1 A$,1)="@":m%=1:A$=A$,2) $A$=2:r%=r(A$):r%>-1:=m%*8+r% FA$,1)="#":v%=value(A$,2))&FFFF:num%=num%+2:=(m%+2)*8+7+256*v% %A$,1)="+":m%=m%+2:A$=A$,A$-1) $"A$,2)="-(":m%=m%+4:A$=A$,2) .9A%=A$,"("):A%:A$,1)<>")":error$="Missing ')'":=-1 8,A%:r%=r(A$,A%+1,2)):A$=A$,A%-1)r%=7 B3A$<>"":v%=value(A$)&FFFF:m%=m%+6:num%=num%+2 L%r%=7:m%>5:v%=(v%-P%-num%)&FFFF V#r%<0:error$="Missing register" `=m%*8+r%+256*v% j&ݤr(A$):A%:A$=uc(A$):A$<>2:=-1 tA$="PC":=7 ~A$="SP":=6 A$,1)<>"R":=-1 A$,1)<"0"A$,1)>"7":=-1 =A$,1) Eݤsd(A$):A%,src%,dst%,n%:A%=A$,","):A%=0:error$="Missing ,":=0 =part$=" in source":n%=num%:src%=mr(A$,A%-1)):src%<0:=0 -n%<>num%:cache%!n%=src%256:src%=src%63 &error$="":part$=" in destination" *n%=num%:dst%=mr(A$,A%+1)):dst%<0:=0 -n%<>num%:cache%!n%=dst%256:dst%=dst%63 =64*src%+dst% Nݤrd(A$,f%):A%,r%,dst%,n%:n%=num%:A%=A$,","):A%=0:error$="Missing ,":=0 1f%:r%=r(s(A$,A%+1)))r%=r(s(A$,A%-1))) &r%<0:error$="Missing register":=0 /f%:dst%=mr(A$,A%-1))dst%=mr(A$,A%+1)) -n%<>num%:cache%!n%=dst%256:dst%=dst%63 =64*r%+dst% (Wݤdd(A$):A%,dst%,n%:n%=num%:dst%=mr(A$):n%<>num%:cache%!n%=dst%256:dst%=dst%63 2(A$,","):error$="Too many operands" < =dst% F]ݤdisp(A$):A%=(value(A$)-P%-2)/2:A%<-128A%>127:error$="":error$="Branch out of range" P =A%&FF Z\ݤdisp6(A$):A%=(value(A$)-P%-2)/2:A%<-32A%>31:error$="":error$="Branch out of range" d =A%&3F n:ݤOS_GetEnv:A$,A%,X%,Y%:X%=1:os%=((&FFF4)&FF00)256 xD!=&D7C1C7C5:run$=ARGV$(0):A%=1ARGC:A$=A$+ARGV$(A%)+" "::=A$ Mos%>31:>&FFFFF:X%256:ș"GetModuleFileName",0,X%,255:run$=$$X%:=@cmd$ CA%=&600-&7B00*(>&8000)-&3F00*(>&C000):!(-&100)=@%:A%=-&300 ;?(P-3)=0:A%=&100:<&FFFF:A%=-&300:!(+512)=@%:A%= cA$=$A%:=&8F00:run$=A$:ș16A$,,A%:ș72,"",A%:A$=A$,1+A$+" "," ",1+A$," "))):A$=0:A$=run$ SY%=-10:A$=" "+A$:A$=A$,2):A$<>32:A$=34:A%=A$,"""",2)+1A%=A$+" "," ") 9Y%:run$=A$,1-(A$=34),A%-1+2*(A$=34)):A$=A$,A%+1) :=A$ !os(A$):A$=42:A$A$:A$  Fexit(A%):"FX1,"+(A%255):quit$=quit$:A$=quit$:quit$="":os(A$) >&FFFFF:ȘA%  cݤcl(l$,n%):l$="":A$=s(A$):A$=34:A%=A$+" "" ",""" ",2):l$=A$,2,A%-2):A$=s(A$,A%+1)):=l$ "":A%=A$,l$):A%:A$=s(A$,A%-1)+A$,A$," ",A%)+1))+" ":= n%=0:l$<>"":= "%A%=" ",l$=32)+A$,l$):A%=0:="" ,'A$=A$,A%-1)+s(A$,A$," ",A%)+1)) 6Cl$=32:l$=A$,A%):A$=A$,A%-1):=l$,1-(l$=34),l$+2*(l$=34)) @PA$,A%,1)<>34:l$=A$,A%,A$+" "," ",A%)-A%):A$=A$,A%-1)+A$,A%+l$+1):=l$ JHl$=A$,A%+1,A$+" ",""" ",A%+1)-A%-1):A$=A$,A%-1)+A$,A%+l$+3):=l$ T/ݤs(A$):A$,1)=" ":A$=A$,2):A$,1)<>" " ^+A$,1)=" ":A$=A$,A$-1):A$,1)<>" " h=A$ r6Var_Assign(N$,V$):Var_%=Var_%:A%=2*(?(P-3)>0)-1 |DVar_%=0:B%:B%=P-4::B%=B%-1:B%?A%=13B%?(?B%+A%)=13:Var_%=B% 1N$>?Var_%-12:error$="Expression too long": -$(Var_%+4+A%)=N$+"="+&A0+"(V$):"+&E1:1 P:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!