;PC - Doucument reporter. (C) PC 16/5/1988 ;03/08/91 Default to reading *.* files, not *.doc const maxd=1024,blen=512 ;BLEN >= 256 var cd,m,mad,loc,wordstar,ds var32 topscr,botscr,fseek,secondline,fad,atemp fbuf ? blen #include fsort.fi on error { print bios error msg "\dos.err" print bios "!" terminate } proc clear_bot { colour 7 scroll 0,20,79,24,0 cursor 20,0 locate 20,0 } proc show_ws { colour 7 locate 2,70:print " WS "; if wordstar=255 then print "OFF "; else print "ON "; } function fill_buffer { fill blen/2 from fbuf with 1a1ah read_len=read #1,blen to fbuf return fbuf } proc get_eof { seek #1,eof rax=reg ax:rdx=reg dx topscr=rax+rdx*65536 ;Current address for TOPSCR. } proc backline(clines) { const backlen=160 repeat clines { fad=topscr-backlen if (high fad)<0 then topscr=0:return seek #1,fad fill backlen/2+1 from fbuf with 1a1ah read_len=read #1,backlen to fbuf m=fbuf atemp=fad next_line13: col=0 back_loop: c=peekb m:m++ if c>31 then { back_print: col++ if col<80 then goto back_loop c=13 } if c=26 then goto next_backline if c=13 then { ad32=m-fbuf topscr=atemp atemp=fad+ad32 goto next_line13 } if c<>9 then goto back_print col=(col and 248)+8 goto back_loop next_backline: } } proc position(addr) { px=addr mod 6 py=addr/6 locate 3+py,px*13+1 } proc pos_colour(colc) { repeat 2 video[locpos+1]b=colc:locpos+=2 while video[locpos-2]b<>' ' video[locpos+1]b=colc:locpos+=2 cursor 3+py,px*13+2 } function get_char { if m>=(fbuf+blen) then { m=fill_buffer } else m++ return peekb m } proc get_files { xd=ffind while peekb xd print bios chr peekb xd;:xd++ print bios " "; #errors off find first ffind goto entry while cd=(fbuf+blen) then m=fill_buffer c=peekb m:m++:pagelen++ if c>31 then { print_char: col++:print chr c and wordstar; if col<80 then goto loop_prt c=13 ; Start new line. } if c=26 then print "";:eof_flag=1:goto fill_end if c=13 then { if col<80 then fill (80-col) from video|locpos with 0720h goto next_line } if c=10 then goto loop_prt ; Skip printing this character. if c<>9 then goto print_char ncol=(col and 248)+8 repeat ncol-col print " "; col=ncol goto loop_prt next_line: next y fill_end: fl=19*160-locpos if fl>0 then fill fl/2 from video|locpos with 0720h botscr=topscr+pagelen wait_eof: wait for keypressed s=scan if s=45 then goto abort ; X to abort. if s=1 then goto finish_display if s=17 then { wordstar=wordstar xor 128 show_ws goto next_display } if s=71 then topscr=0:goto next_display if s=72 then backline(1):goto next_display if s=73 then backline(16):goto next_display if eof_flag then goto wait_eof if s=79 then get_eof:backline(15):goto next_display if s=80 then topscr=secondline:goto next_display ;if s=81 then do nothing, default is view next page. topscr=botscr next_display: } finish_display: close #1 } proc print_file { open_file cursor 20,0:print bios "Press ESC to abort printing. " m=fbuf+blen print_line: col=0 print_loop: if m>=(fbuf+blen) then m=fill_buffer c=peekb m:m++ if c>31 then { lprint_char: col++:lprint chr c and wordstar; goto print_loop } if c=26 then lprint ff;:goto print_end if c=13 then { lprint if key=27 then goto print_end goto print_line } if c=10 then goto print_loop ; Skip printing this character. if c<>9 then goto lprint_char ncol=(col and 248)+8 repeat ncol-col lprint " "; col=ncol goto print_loop print_end: close #1 } proc ddir(mad) { mad*=13 mn=0 while (mn<96) and ((mad/13)' ' { pokeb a,ucase c a++ if a>=str_end then error 13 c=get_char } gf_execute: pokeb a,0 get_files if cdcd-1 then loc=cd-1 if (loc(drawloc+95)) then goto redis } abort: clear_bot terminate ffind: fname '*.*' space 29 ;Total length=32 str_end: