>ScrMan/src v0.40  Display manual pages % Syntax: *Man (
) ($ Syntax: *Man (
) 2 Man Item -> I.#Item < Man 1 Item -> I.1Item F Man Item(1) -> I.1Item P: ZH"Manual files dir: (%.ManPages) "path$:path$="":path$="%.ManPages" dC"Command to save: (%.Man) "save$:save$="":save$="%.Man" npath$<>"":path$=path$+"." x: 7OSFIND=&FFCE:OSBGET=&FFD7:OSARGS=&FFDA:OSRDCH=&FFE0 7OSNEWL=&FFE7:OSWRCH=&FFEE:OSWORD=&FFF1:OSBYTE=&FFF4 ) mcode% &240:load%=&FFFF0900:max%=10 ) path$>max%:load%=load%-path$+max% : lptr=&A8 channel=&A8:height=&A9 !column=&AA:format=&AB:ptr=&AC : P=0 1 O%=mcode%:P%=load% [OPT P*2+4 5EQUB 23:.block:EQUB 255 :\ 23 block ?.ItemFilename:EQUS path$ :\ eg "$Docs.ManPages." .ItemDir :EQUS "M." %.ItemName :EQUS "#Man":EQUB 13 ": , .exec% 6;LDY #0:LDX #lptr:LDA #1:JSR OSARGS :\ Get command line @%LDA (lptr),Y:CMP #13:BEQ OpenItem J0TAX:INY:LDA (lptr),Y:CMP #" ":BNE NoSection T6STX ItemName:INY :\ *man n item ^.SkipSpace h0LDA (lptr),Y:INY:CMP #" ":BEQ SkipSpace:TAX r.NoSection |STX ItemDir:DEY:LDX #1 .GetItemName =LDA (lptr),Y:INY:STA ItemName,X :\ Copy into filename CMP #"(":BEQ GetSection INX:CPX #20:BCS OpenItemCR CMP #13:BNE GetItemName BEQ OpenItem .GetSection 7LDA (lptr),Y:STA ItemName :\ *man item(n) .OpenItemCR LDA #13:STA ItemName,X  .OpenItem LDX #ItemFilename 255 LDY #ItemFilename 256 LDA #&40:JSR OSFIND #TAY:BEQ errNotFound:STA channel +JSR OSBGET:CMP #":":BNE DisplayRestart & LDX #0 0.RedirectLp :+STA ItemFilename,X:CMP #" ":BCC ReOpen D!INX:JSR OSBGET:BCC RedirectLp N .ReOpen XLDA #13:STA ItemFilename,X bJSR Close:JMP OpenItem l.errNotFound v+BRK:EQUB 214:EQUS "Entry not found":BRK  .msgMore EQUS ">EROM" : .DisplayRestart ?LDX #1:LDA #4:JSR OSBYTE :\ Cursor keys give II @LDX #9:LDA #160:JSR OSBYTE :\ Get screen dimensions #TXA:STA height:LSR A:STA column 3LDY channel:LDA #0:JSR CallArgs:SEC :\ Read PTR 8LDA ptr+1:SBC column:STA ptr+1 :\ Move PTR back LDA ptr+2:SBC #0:STA ptr+2 LDA ptr+3:SBC #0:STA ptr+3 BCS MoveBack:LDX #3:LDA #0  .MoveZero FSTA ptr,X:DEX:BPL MoveZero :\ Before start, move to start  .MoveBack 2PHP:LDA #1:JSR CallArgs :\ Set PTR  EPLP:BCC Redisplay :\ Display from start of file *.ScanForCR 4BJSR OSBGET:CMP #10:BEQ Redisplay :\ Scan to start of a line >BCMP #13:BNE ScanForCR :\ Scan to start of a line H.Redisplay R;LDX #0:STX format:INX:STX column :\ Initial settings \@LDX height:LSR height :\ Start with whole page f: p%\ X =initial number of lines z \ height =lines to scroll by !\ channel=handle of open file \ column =print column "\ format =character formatting : .DisplayLp (LDY channel:JSR OSBGET:BCS EndOfFile $JSR Output:TXA:BNE DisplayLp:CLC .EndOfFile PHP:LDX #4  .MoreLp1 ,LDA msgMore,X:JSR OSWRCH:DEX:BPL MoreLp1 JSR OSRDCH:PHP:PHA LDX #4:LDA #127  .MoreLp2 JSR OSWRCH:DEX:BPL MoreLp2 PLA:PLP:BCS Escape $ #&DF:CMP #"Q":BEQ Quit .PLP: #"B":BEQ Back 8 #201:BEQ Back B?BCS EndOfFile :\ Can't move if at EOF L?LDX height:BNE DisplayLp :\ Do another half-page V .Back `.LDA #12:JSR OSWRCH :\ CLS j?JMP DisplayRestart :\ Display a page again t: ~ .Escape LDA #126:JSR OSBYTE  .Quit  PLP:LDX #0:LDA #4:JSR OSBYTE  .Close !LDA #0:LDY channel:JMP OSFIND  .CallArgs LDX #ptr:JMP OSARGS :  .Extend JSR OSBGET: #&DF CMP #"B":BEQ Toggle CMP #"I":BNE Return \ _ = &1C = %00011100  \ B = &42/&62 = %01x00010 \ I = &49/&69 = %01x01001 &\ b2=underline, b1=bold, b0=italic ( .Toggle 2 #7: format:STA format:RTS <.CR F$LDA #1:STA column:DEX:JMP OSNEWL P.TAB ZLDA #32:JSR Display dLDA column: #7:BNE TAB n .Return xRTS  .Plain @JMP OSWRCH :\ Print plain character :  .Output CMP #" ":BCS Display CMP #9:BEQ TAB CMP #10:BEQ CR CMP #13:BEQ CR CMP #28:BEQ Toggle CMP #29:BEQ Extend CMP #26:BNE Return  LDA #" "  .Display #INC column:LDY format:BEQ Plain STA block:TXA:PHA %LDX #block 255:LDY #block 256 "DLDA #10:JSR OSWORD :\ Read character definition ,: 6&\ b2=underline, b1=bold, b0=italic @>LDA format:LSR A:BCC CheckBold :\ Skip if not italics J: T:LSR block+1:LSR block+2 :\ Slant character ^'ASL block+6:ASL block+7:ASL block+8 h: r.CheckBold |;LSR A:BCC CheckUnder:PHA:LDX #8 :\ Skip if not bold  .BoldLp ;LDA block,X:ASL A:A block,X :\ Thicken character STA block,X:DEX:BNE BoldLp PLA : .CheckUnder LSR A:BCC OutputChar ;LDA #255:STA block+8 :\ Add an underline : .OutputChar (LDX #255:STX block+0:STX block+9:INX  .OutputLp LDA block-1,X:JSR OSWRCH INX:CPX #11:BCC OutputLp PLA:TAX:RTS : &\EQUS "v0.40",&B00-P%) 0] : P%>&B00:"Code overrun": D"Saving ";save$; NRsave$="*Save "+save$+" "+~mcode%+" "+~O%+" "+~(exec%&FFFF0000)+" "+~load% X save$: