home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
051-075
/
apd064
/
scrolist.amos
/
scrolist.amosSourceCode
Wrap
AMOS Source Code
|
1990-10-31
|
4KB
|
124 lines
Rem **************************************
Rem * AMOS : Scrolling List by *
Rem * G.Lancaster *
Rem **************************************
Rem * NOTE: This program uses the data *
Rem * file SCROLIST.DAT on this disk for *
Rem * the demo. It is just a normal ASCII*
Rem * file. Feel free to mess around! *
Rem **************************************
Rem * Need help? Want to swap ideas? *
Rem * Drop me a line at this address; *
Rem * *
Rem * Gareth Lancaster *
Rem * 40, Appleby Gardens *
Rem * Dunstable *
Rem * Bedfordshire *
Rem * LU6 3DB *
Rem * *
Rem **************************************
Screen Open 0,320,256,32,Lowres : Dim A$(50)
Paper 0 : Pen 15 : Cls
Global A$(),G,POSITION,COI,POS
POSITION=1 : POS=1
Locate 16,4 : Print "INSTRUCTIONS"
Locate 16,5 : Print "~~~~~~~~~~~~"
Locate 16,7 : Print "Joy UP = scroll up"
Locate 16,8 : Print "Joy DOWN = scroll down"
Locate 16,9 : Print "Joy LEFT = go to top"
Locate 16,10 : Print "Joy RIGHT = go to bottom"
Locate 16,11 : Print "Joy FIRE = choose"
Locate 16,13 : Print "Also you can use cursor"
Locate 16,14 : Print "keys with 'RETURN' to"
Locate 16,15 : Print " choose"
Locate 16,17 : Print "Check source for hints!"
Locate 16,18 : Print "Press Q to quit program"
Rem **************************************
Rem * To call; *
Rem * ~~~~~~~~ *
Rem * SCROLIST[l,i,x,y,b,m] *
Rem * ~~~~~~~~~~~~~~~~~~~~~ *
Rem * l = length of string (size of box) *
Rem * i = number of items on screen *
Rem * x = x position on screen *
Rem * y = y position on screen *
Rem * b = border 1 = yes : other = no *
Rem * m = method for highlight *
Rem * 1 = different ink colour *
Rem * 2 = invert choice *
Rem * 3 = shade all but choice *
Rem * 4 = under line choice *
Rem **************************************
LOPSC:
SCROLIST[9,15,5,5,1,2]
Locate 5,22 : Cline : Print "YOUR CHOICE: ";A$(COI)
Goto LOPSC
Procedure SCROLIST[LGTH,ITEMS,LOCX,LOCY,BORD,METHOD]
Open In 1,"scrolist.dat"
For F=1 To 50
If Eof(1) Then F=F-1 : Close 1 : Goto LABEL
Input #1,B$
A$(F)=B$
Next F
LABEL:
Curs Off
For G=1 To F
If Len(A$(G))<LGTH Then A$(G)=A$(G)+Space$(LGTH-Len(A$(G)))
If Len(A$(G))>LGTH Then A$(G)=Mid$(A$(G),1,LGTH)
Next G
G=F
If BORD=1 Then BORDPRINT[LOCX-1,LOCY-1,LGTH+2,ITEMS+2,1]
LABEL2:
For F=POSITION To POSITION+ITEMS
If METHOD=3 Then Shade On
Locate LOCX,LOCY+(F-POSITION)-1
If F=POSITION+POS-1 Then Gosub METHODPEN : Print A$(F) : Pen 15 : Paper 0 : If METHOD=3 : Shade On : End If : Under Off : Goto 2
Print A$(F)
2 Next F
1 Q$=Inkey$
SAC=Scancode
If Upper$(Q$)="Q" Then Run "autoexec.amos"
If Q$=Chr$(30) Then Gosub ROUT1 : Goto LABEL2
If Jup(1) and Fire(1)=0 Then Gosub ROUT1 : Goto LABEL2
If Q$=Chr$(31) Then Gosub ROUT2 : Goto LABEL2
If Jdown(1) and Fire(1)=0 Then Gosub ROUT2 : Goto LABEL2
If Q$=Chr$(13) Then COI=POS+POSITION-1 : Pop Proc
If Fire(1) and Jup(1)=0 and Jdown(1)=0 Then COI=POS+POSITION-1 : Pop Proc
If Q$=Chr$(28) Then POSITION=G-ITEMS : POS=ITEMS+1 : Goto LABEL2
If Jright(1) and Fire(1)=0 Then POSITION=G-ITEMS : POS=ITEMS+1 : Goto LABEL2
If Q$=Chr$(29) Then POSITION=1 : POS=1 : Goto LABEL2
If Jleft(1) and Fire(1)=0 Then POSITION=1 : POS=1 : Goto LABEL2
Goto 1
ROUT1:
If POS>1 Then POS=POS-1 : Return
If POSITION>1 Then POSITION=POSITION-1 : Return
Return
ROUT2:
If POS<ITEMS+1 Then POS=POS+1 : Return
If POSITION<G-ITEMS Then POSITION=POSITION+1 : Return
Return
METHODPEN:
If METHOD=1 Then Pen 4 : Return
If METHOD=2 Then Paper 15 : Pen 0 : Return
If METHOD=3 Then Shade Off : Return
If METHOD=4 Then Under On : Return
Pen 4 : Return
End Proc
Procedure BORDPRINT[CX,CY,CL,CI,CO]
Pen CO
Locate CX,CY-1 : Print Chr$(136);
For F=1 To CL-2
Print Chr$(137);
Next F
Print Chr$(138)
For F=CY+1 To CY+CI-1
Locate CX,F-1 : Print Chr$(139)
Locate CX+CL-1,F-1 : Print Chr$(139)
Next F
Locate CX,CY+CI-1 : Print Chr$(140);
For F=1 To CL-2
Print Chr$(137);
Next F
Print Chr$(141)
Pen 15
End Proc