home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1989-08-17 | 3.6 KB | 176 lines |
- Set Buffer 75
- '
- ' Full Screen Simple Text Reader.
- ' Gal-on Broner 1991.
- '
- Break Off
- PATHNAME$="Amoner005:Editor/"
- DISKNAME$="Amoner005:"
- UPPER_LINE=1
- Screen Open 0,640,200,2,Hires
- Colour 0,$0
- Colour 1,$FFF
- Cls 0 : Ink 1
- Curs Off
- Dim LINES$(1000)
- Global LINES$(),PATHNAME$,LINE_NUMBER
- FILEFROMDISK
- Rem Create display board.
- Wind Open 1,0,16,80,20
- Window 0
- Clw
- Under On
- Print "Amore / By Gal-on Broner - Barbarian Minds 1991. / Ver 0.4"
- Under Off
- Rem Calculate current display limits.
- CALC:
- Window 1
- Clw
- UPPER_FILE=False
- LOWER_FILE=False
- If UPPER_LINE=<1
- UPPER_LINE=1
- UPPER_FILE=True
- End If
- LOWER_LINE=UPPER_LINE+18
- If LOWER_LINE=>LINE_NUMBER
- LOWER_LINE=LINE_NUMBER
- LOWER_FILE=True
- End If
- Rem Display The current Page
- For DISPLAY=UPPER_LINE To LOWER_LINE
- Print LINES$(DISPLAY)
- Next DISPLAY
- Gosub LINE_CHAR
- Rem Get the Key press.
- KEY_PRESS:
- BUTTON$="" : Repeat : BUTTON$=Inkey$ : Until BUTTON$<>""
- BUTTON$=Upper$(BUTTON$)
- If(BUTTON$=Chr$(32)) or(BUTTON$="F") : Rem Page Advance Forward
- If LOWER_FILE
- Gosub BUTTOM_TEXT
- Goto KEY_PRESS
- Else
- Add UPPER_LINE,19
- Goto CALC
- End If
- End If
- If BUTTON$=Chr$(13) : Rem Line Advance Forward
- If LOWER_FILE
- Gosub BUTTOM_TEXT
- Goto KEY_PRESS
- Else
- Inc UPPER_LINE
- Goto CALC
- End If
- End If
- If BUTTON$="B" : Rem Page advance Backward
- If UPPER_FILE
- Gosub UPPER_TEXT
- Goto KEY_PRESS
- Else
- Add UPPER_LINE,-19
- Goto CALC
- End If
- End If
- If BUTTON$="H" : Rem Help.
- HELP
- BUTTON$="" : Repeat : BUTTON$=Inkey$ : Until BUTTON$<>""
- Goto CALC
- End If
- If BUTTON$=Chr$(27) : Rem Esc pressed, Quit.
- Run DISKNAME$+"Autoexec.Amos"
- End If
- Goto KEY_PRESS
- '
- '----------------------------------------------------------------------
- '
- Rem ************
- Rem * Routines *
- Rem ************
- Rem Display line Char
- LINE_CHAR:
- Window 0
- CLEAN[23]
- Locate 1,23
- Under On
- Print "Amore";
- Under Off
- Print " - ";LOWER_LINE;" / ";LINE_NUMBER;
- Locate 60,23 : Print "Press h for help";
- Window 1
- Return
- Rem buttom of text
- BUTTOM_TEXT:
- Gosub LINE_CHAR
- Window 0
- Inverse On
- Locate 30,23
- Print "Bottom of File";
- Inverse Off
- Window 1
- Return
- Rem top of text
- UPPER_TEXT:
- Gosub LINE_CHAR
- Window 0
- Inverse On
- Locate 30,23
- Print "Top of File";
- Inverse Off
- Window 1
- Return
- '
- '---------------------------------------------------------------------
- '
- Rem **************
- Rem * Procedures *
- Rem **************
- Procedure FILEFROMDISK
- Rem
- Rem First We get the file name we need to view.
- Rem
- Open In 1,PATHNAME$+"Filename.dat"
- Input #1,FILENAME$
- Close 1
- Rem
- Rem On error comes to capture the End of file.
- Rem
- On Error Goto FILEEND
- FIN=0
- Rem On Error Goto FILEEND
- Rem
- Rem Now lets get the file
- Rem
- Set Input 10,-1
- Print "Reading File: ";PATHNAME$+FILENAME$
- Open In 1,PATHNAME$+FILENAME$
- LINE_NUMBER=1
- Do
- Line Input #1,LINES$(LINE_NUMBER)
- Inc LINE_NUMBER
- Locate 0,1 : Print "Processing Line: ";LINE_NUMBER
- If FIN=1 Then Goto FINISHED_READING
- Loop
- FILEEND:
- FIN=1
- Resume Next
- FINISHED_READING:
- Close 1
- End Proc
- Procedure CLEAN[ROW]
- Locate 0,ROW
- Print Space$(80);
- End Proc
- Procedure HELP
- Clw
- Print : Print : Print "This is version 0.4 of Amore."
- Print "Valid keys are:" : Print
- Print " <Space> / F Page Forward"
- Print " <Return> Line Forward"
- Print " B Page Backward"
- Print " <ESC> End Amore"
- Print
- Print
- Print "Press Any Key..."
- End Proc