10
20
30 :
40 path$="Comm100\"
50 base$=path$+"Communicator-rom"
60 ext$ ="-100.rom"
70 bas$ ="."
80 dest$=path$+"Modules\"
90 prog$=path$+"Programs\"
100 :
110 list%=TRUE*0
120 DIM mem% 255
130 ON ERROR PRINT:REPORT:CLOSE#0:PRINT:END
140 :
150 base0%=0
160 FOR rom%=0 TO 3
170 in$=base$+STR$rom%+ext$
180 in%=OPENIN(in$):IF in%:PROCexamine:base0%=base0%+EXT#in%:CLOSE#in%:in%=0
190 NEXT rom%
200 IF list%=0:END
210 PRINT SPC34;"| | | | | |"
220 PRINT SPC34;"| | | | | +---- Reserved"
230 PRINT SPC34;"| | | | +---- Reserved"
240 PRINT SPC34;"| | | +---- Module flags"
250 PRINT SPC34;"| | +---- Module flags"
260 PRINT SPC34;"| +---- &01=Task, &02=Printer Driver"
270 PRINT SPC34;"+---- &80=BAS, &40=DEV, &20=FS, &08=CODE, &02=BANK, &01=POS"
280 END
290 :
300 DEFPROCexamine
310 base%=0
320 REPEAT:PROCmodule:UNTIL base%>=EXT#in%:ENDPROC
330 :
340 DEFPROCmodule
350 PTR#in%=base%
360 FOR A%=0 TO 255:mem%?A%=BGET#in%:NEXT A%:
370 size%=(mem%!3 AND &FFFFFF)+2
380 version$=STR$~mem%?7+"."+FNh0(mem%?6,2)
390 flag%=mem%?8
400 title$="":A%=14:IF mem%?A%:REPEAT:title$=title$+CHR$(mem%?A%):A%=A%+1:UNTILmem%?A%=0
410 help$="" :A%=A%+1:IF mem%?A%:REPEAT:help$=help$+CHR$(mem%?A%):A%=A%+1:UNTILmem%?A%=0
420 cmds$="":A%=INSTR(title$,"/"):IF A%:cmds$=MID$(title$,A%+1):title$=LEFT$(title$,A%-1)
430 code%=A%+1:entry%=(mem%!1 AND &FFFF)+3
440 IF mem%?0<>&82:title$="<none>":help$="<none>":cmds$="<none>":size%=256
450 IF list%:PROClist:ENDPROC
460 PRINT "Address: ";FNh0(base0%+base%,6);"+";FNh0(size%,4)
470 PRINT "Title: "title$
480 PRINT "Version: "version$
490 PRINT "Commands: "cmds$
500 PRINT "Help: "help$
510 PRINT "Flags: ";:FOR A%=8 TO 13:PRINTFNh0(mem%?A%,2);" ";:NEXT:PRINT
520 PRINT "D/S/B/ret";:K%=(GETAND&DF):PRINTCHR$13;SPC10;CHR$13;
530 IF K%=ASC"D":PROCdump
540 IF K%=ASC"S":PROCsave
550 IF K%=ASC"B":PROCbasic
560 PRINT
570 base%=(base%+size%+255) AND -256
580 ENDPROC
590 :
600 DEFPROClist
610 title$=LEFT$(title$,INSTR(title$+"/","/")-1)
620 PRINT FNh0(base0%+base%,6);"+";FNh0(size%,4);
630 PRINT " ";title$;SPC(15-LENtitle$);SPC(5-LENversion$);version$;" ";
640 FOR A%=8 TO 13:PRINTFNh0(mem%?A%,2);" ";:NEXT:A$=""
650 IF mem%?9 AND &01:A$=A$+" TASK" ELSE A$=A$+" "
660 IF mem%?9 AND &02:A$=A$+" VPD" ELSE A$=A$+" "
670 IF mem%?8 AND &80:A$=A$+" BAS" ELSE A$=A$+" "
680 IF mem%?8 AND &40:A$=A$+" DEV" ELSE A$=A$+" "
690 IF mem%?8 AND &20:A$=A$+" FS" ELSE A$=A$+" "
700 IF mem%?8 AND &08:A$=A$+" CODE" ELSE A$=A$+" "
710 IF mem%?8 AND &02:A$=A$+" BANK" ELSE A$=A$+" "
720 IF mem%?8 AND &01:A$=A$+" POS" ELSE A$=A$+" "
730 IF mem%?0<>&82:A$=""
740 PRINT A$
750 base%=(base%+size%+255) AND -256
760 ENDPROC
770 :
780 DEFPROCdump
790 FOR A%=0 TO 255 STEP 16:PRINTFNh0(A%,4);" ";
800 FOR B%=A% TO A%+15:PRINTFNh0(mem%?B%,2);" ";:NEXT B%
810 FOR B%=A% TO A%+15:PRINTFNc(mem%?B%);:NEXT B%
820 PRINT
830 NEXT A%
840 ENDPROC
850 :
860 DEFPROCsave
870 IF mem%?0<>&82:title$=FNh0(base0%+base%,6)
880 PRINT"Saving ";title$;
890 IF dest$<>"":PROCcdir(dest$)
900 PTR#in%=base%
910 out%=OPENOUT(dest$+title$+bas$)
920 FOR A%=1 TO size%:BPUT#out%,BGET#in%:NEXT A%
930 CLOSE#out%:PRINT
940 ENDPROC
950 :
960 DEFPROCbasic
970 IF (flag%AND&80)=0 OR flag%=&FF:ENDPROC
980 A%=entry%:REPEAT:A%=A%+1:UNTILmem%?A%=&62:A%=A%+1:code%=A%+2+(mem%!A% AND &FFFF)
990 PRINT"Saving ";title$;
1000 IF prog$<>"":PROCcdir(prog$)
1010 PTR#in%=base%+code%
1020 out%=OPENOUT(prog$+title$+bas$)
1030 FOR A%=code% TO size%:BPUT#out%,BGET#in%:NEXT A%
1040 CLOSE#out%:PRINT
1050 ENDPROC
1060 :
1070 DEFFNc(A%):A%=A%AND127:IFA%<32ORA%=127:="."ELSE=CHR$A%
1080 DEFFNh0(A%,N%)=RIGHT$("0000000"+STR$~A%,N%)
1090 DEFPROCcdir(A$)
1100 LOCAL ERROR:ON ERROR LOCAL ENDPROC
1110 OSCLI "MKDIR "+A$
1120 ENDPROC