As promised, I've packed the ML routines used in the Easter present into this small text viewer.
It runs with a least an +8K RAM expander. However, as the whole text file is read into RAM, a bigger expansion might be necessary for larger texts. +24K allow for 512 lines (and are required to read the interview).
BROWSE consists of a ML library, which does line-based ASCII text output on the high resolution screen provided by MINIGRAFIK. This library is 'scripted' by a BASIC program:
Code: Select all
10 POKE55,0:POKE56,40:CLR:S=10240:AD=12288
11 DN=PEEK(186):IFPEEK(S)<>76THENSYS57809"CODE",DN,1:POKE780,0:SYS65493
12 INPUT"FILE";N$:OPEN2,DN,2,N$+",S,R":SYSS+12,AD,2:CLOSE2
13 A0=AD:A1=AD:A2=AD+23*40:A3=PEEK(167)+256*PEEK(168)
14 FORT=-40TO-1:READA:POKEAD+T,A:NEXT
15 POKE36879,27:POKE646,0:@ON:@CLR:SYSS,AD-40,23:SYSS+3,23:L=0
16 IFAD<A3ANDL<23THENSYSS,AD,L:AD=AD+40:L=L+1:GOTO16
17 GETA$
18 IFA$="{DOWN}"ANDA2<A3THENSYSS+6,0,22:SYSS,A2,22:A1=A1+40:A2=A2+40
19 IFA$="{UP}"ANDA1>A0THENA1=A1-40:A2=A2-40:SYSS+9,0,22:SYSS,A1,0
20 IFA$=" "THEN:@RETURN:END
21 GOTO17
22 DATA67,117,114,115,111,114,32,85,112,47,68,111,119,110,32,116,111,32,115,99
23 DATA114,111,108,108,46,32,83,80,65,67,69,32,116,111,32,113,117,105,116,46
24 :
25 REM ** MG BROWSE WRITTEN 2010-04-10 BY MICHAEL KIRCHER
The variable S=10240 defines the start of a jump table into 5 different routines:
SYSS,<adr>,<nr>
prints an ASCII string of 40 characters at <adr> to screen line <nr>.
SYSS+3,<nr>
inverts screen line <nr>. Within BROWSE, this is used to highlight the banner in the bottom line.
SYSS+6,<top>,<bottom>
SYSS+9,<top>,<bottom>
scroll the screen between screen lines <top>, and <bottom>. '+6' scrolls up, '+9' scrolls down. This is much faster than reprinting the whole screen, but the newly appearing line still must be printed with the first SYSS command above.
SYSS+12,<adr>,<nr>
This routine does the main work: it reads in the file with logical number <nr> into a memory buffer beginning at <adr>, formatted to 40 characters per line. The printable characters from 32 to 126 and the two codes 9 (TAB) and 10 (LF) are recognized; everything else is ignored. TABs are 8 characters wide.
Greetings,
Michael