10
20
30
40
50
60
70
80 :
90 INPUT"Display command: (lpS) "cmd$:IFcmd$="":cmd$="lpS"
100 INPUT"Manual files dir: (%.Docs) "dir$:IFcmd$="":cmd$="%.Docs"
110 INPUT"Command to save: (%.Man) "save$:IFsave$="":save$="%.Man"
120 DIM mcode% &1FF:load%=&FFFF0900:ptr=&A8
130 OSARGS=&FFDA:OSFILE=&FFDD:OS_CLI=&FFF7
140 FOR P=0 TO 1
150 P%=load%:O%=mcode%
160 [OPT P*2+4
170 .Load
180 EQUW ItemPath:EQUW ItemPath:EQUW &FFFF:EQUB 0
190 .Info
200 EQUW ItemPath :\ Control block overlaps code
210 .start%
220 LDX #ptr:LDY #0:LDA #1:JSR OSARGS
230 LDA (ptr),Y:CMP #13:BEQ ManNoItem
240 INY:LDA (ptr),Y:DEY:CMP #ASC" ":BNE GetItemText
250 LDA (ptr),Y:STA ItemText :\ Prefix section number
260 .SkipSpace
270 INY:LDA (ptr),Y
280 CMP #ASC" ":BEQ SkipSpace
290 .GetItemText
300 LDX #1:LDA (ptr),Y:STA ItemDir
310 .Loop
320 LDA (ptr),Y:CMP #ASC"(":BNE PutChar
330 INY:LDA (ptr),Y:STA ItemText :\ Postfix section number
340 LDA #13
350 .PutChar
360 STA ItemText,X:INX:INY
370 CMP #13:BNE Loop
380 .ManNoItem
390 LDX #Info AND 255:LDY #Info DIV 256
400 LDA #5:JSR OSFILE
410 LDX Info+5:INX:BNE ManCommand :\ Load<>&FFxxxxxx
420 LDX Info+4:INX:BNE ManCommand :\ Load<>&FFFFxxxx
430 LDX Info+3:CPX #&C0:BNE ManCommand :\ Load<>&FFFFC0xx
440 LDA Info+11:ORA Info+12:ORA Info+13 :\ Length>255?
450 BNE ManCommand
460 LDX #Load AND 255:LDY #Load DIV 256
470 LDA #255:JSR OSFILE:LDX #255
480 .ManCommand
490 LDX #255
500 .ManCmdLp
510 INX:LDA ItemCmd,X:STA &100,X :\ Copy command onto stack
520 CMP #32:BCS ManCmdLp :\ as *lpS loads on top of me
530 LDA #13:STA &100,X :\ Ensure terminating <cr>
540 LDX #0:LDY #1:JMP OS_CLI
550 :
560 .ItemCmd :EQUS cmd$+" " :\ "lpS "
570 .ItemPath:EQUS dir$+"." :\ "$Docs.ManPages."
580 .ItemDir :EQUS "M."
590 .ItemText:EQUS "#Man":EQUB 13
600 EQUS "v0.30*******"
610 :
620 ]:NEXT
630 PRINT"Saving ";save$;
640 save$="*Save "+save$+" "+STR$~mcode%+" "+STR$~O%+" "+STR$~(start%OR&FFFF0000)+" "+STR$~load%
650 OSCLIsave$:PRINT