1 ! STOMAC.BAS convert .S to .MAC 10 extend 900 dim #9, buffer$(1000) = 128 & \ dim llabel%(255) & \ dim lnumb%(255) & 1000 print "Convert .S to .MAC" & \ open "stomac.tmp" for output as file 9% & \ esc$ = chr$(155%) & \ zero% = ascii("0") & \ nine% = ascii("9") & \ slash% = ascii("/") & \ c.tab% = 9% & \ c.f% = ascii("f") & \ c.b% = ascii("b") & 1100 on error goto 0 & \ input "Source"; source$ & \ input "Destination"; dest$ & 1200 while 1% & 1210 on error goto 1250 & \ input "File"; infile$ & 1220 open source$ + infile$ + ".s/mo:8192" for input as file 1% & \ goto 1300 & 1250 if erl = 1210 then & resume 32767 if err = 11% & \ print "Error "; err; "when reading filename" & \ resume 1210 & 1260 print "Can't open "; infile$; ", error "; err & \ resume 1210 & 1300 lcount% = 0% & \ lnindex% = 0% & \ label% = 0% & \ while fngetline% & \ lcount% = lcount% + 1% & \ buffer$(lcount%) = inline$ & \ i% = ascii(inline$) & \ if i% >= zero% and i% <= nine% then & lnindex% = lnindex% + 1% & \ label% = label% + 10% & \ llabel%(lnindex%) = i% & \ lnumb%(lnindex%) = label% & 1310 next & 1320 close 1% & 1410 open dest$ + infile$ + ".mac" for output as file 2% & \ lnptr% = 0% & \ print #2%, ".iif ndf rsx rsx = 1 ;Assume RSX" & \ print #2%, " .enabl lc,gbl" & \ print #2%, " .title "; infile$ & \ print #2%, " .ident /00001/" & \ print #2% & \ print #2%, ";+" & \ print #2%, ";" & \ print #2%, "; Calling sequence:" & \ print #2%, ";" & \ print #2%, "; ?" & \ print #2%, ";" & \ print #2%, "; Description" & \ print #2%, ";" & \ print #2%, "; ?" & \ print #2%, ";" & \ print #2%, "; Bugs" & \ print #2%, ";" & \ print #2%, ";-" & \ print #2%, ";" & \ print #2%, "; Edit history" & \ print #2%, "; 000001 05-Mar-80 MM Initial edit" & \ print #2%, ";" & \ print #2%, "" & 1420 for ocount% = 1% to lcount% & \ work$ = buffer$(ocount%) & \ if ascii(work$) = slash% then & print #2%, ";"; right(work$, 2%) & \ goto 2010 & 1430 iscomment% = instr(1%, work$, " /") & \ iscomment% = instr(1%, work$, " /") if iscomment% = 0% & \ if iscomment% <> 0% then & comment$ = right(work$, iscomment% + 2%) & \ work$ = left(work$, iscomment%) & 1440 goto 2000 if len(work$) = 0% & \ temp% = fnfix%("$", "#") & \ temp% = fnfix%("'%", esc$) & \ temp% = fnfix%("%", "/") & \ temp% = fnfix%(esc$, "'%") & \ temp% = fnfix%("|", "!") & \ temp% = fnfix%(" *", " @") & \ temp% = fnfix%(",*", ",@") & \ temp% = fnfix%(" *", " @") & \ temp% = fnfix%("r0,__csav", "r5,csv$") & \ temp% = fnfix%("__csav", "csv$") & \ temp% = fnfix%("__cret", "cret$") & \ temp% = fnfix%("_", "$") & \ temp% = fnfix%("12(r5)", "c$pmtr+0(r5)") & \ temp% = fnfix%("14(r5)", "c$pmtr+2(r5)") & \ temp% = fnfix%("16(r5)", "c$pmtr+4(r5)") & \ temp% = fnfix%("20(r5)", "c$pmtr+6(r5)") & \ temp% = fnfix%("#'\b", "#8.") & \ temp% = fnfix%("#'\t", "#9.") & \ temp% = fnfix%("#'\n", "#10.") & \ temp% = fnfix%("#'\f", "#12.") & \ temp% = fnfix%("#'\r", "#13.") & \ temp% = fnfix%("#'\", "#") & \ temp% = fnfix%("#8", "#8.") & \ temp% = fnfix%("#9", "#9.") & 1450 i% = ascii(work$) & \ if i% >= zero% and i% <= nine% and mid(work$, 2%, 1%) = ":" then & lnptr% = lnptr% + 1% & \ print #2%, num1$(lnumb%(lnptr%)) + "$:" & \ work$ = right(work$, 3%) & \ goto 2000 if len(work$) = 0% & 1460 i% = instr(1%, work$, ": ") & \ temp$ = left(work$, i%) & \ j% = instr(1%, temp$, " ") & \ j% = instr(1%, temp$, " ") if j% = 0% & \ i% = 0% if j% > 0% & \ if i% > 0% then & print #2%, temp$; & \ work$ = right(work$, i%+1%) & 1500 goto 2000 if left(work$, 2%) <> " b" & \ i% = instr(3%, work$, " ") & \ goto 2000 if i% = 0% & \ print #2%, left(work$, i%); & \ work$ = right(work$, i%+1%) & \ i% = ascii(work$) & \ what% = ascii(right(work$, 2%)) & \ goto 2000 if i% < zero% or i% > nine% or & (what% <> c.f% and what% <> c.b%) & \ work$ = right(work$, 3%) & 1600 goto 1650 if what% = c.f% & \ for j% = lnptr% to 1% step -1% & \ goto 1700 if llabel%(j%) = i% & 1610 next j% & \ print "back scan label bug, line = "; buffer$(ocount%) & \ stop & \ work$ = buffer$(ocount%) & \ goto 2000 & 1650 for j% = lnptr% + 1% to lnindex% & \ goto 1700 if llabel%(j%) = i% & 1660 next j% & \ print "forward scan label bug, line = "; buffer$(ocount%) & \ stop & \ work$ = buffer$(ocount%) & \ goto 2000 & 1700 print #2%, num1$(lnumb%(j%)) + "$"; & 2000 print #2%, work$; & \ print #2%, ";"; comment$; if iscomment% <> 0% & \ print #2% & 2010 next ocount% & 2020 print #2%, " .end" & 2030 close 2% & 2990 next & 4000 def fnfix%(arg$, rep$) & \ temp$ = "" & \ while 1% & \ fix.i% = instr(1%, work$, arg$) & \ goto 4080 if fix.i% = 0% & \ temp$ = temp$ + left(work$, fix.i% - 1%) + rep$ & \ work$ = right(work$, fix.i% + len(arg$)) & 4010 next & 4080 work$ = temp$ + work$ & 4090 fnend & & 4100 def fngetline% & \ on error goto 4150 & \ input line #1%, inline$ & \ inline$ = cvt$$(inline$, 1%+4%+128%) & \ fngetline% = 1% & \ goto 4180 & 4150 resume 4160 & 4160 fngetline% = 0% & 4180 on error goto 0 & 4190 fnend & 32767 end