home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 42 / af042b.adf / Extras.lha / Dataflex.AMOS / Dataflex.amosSourceCode < prev    next >
AMOS Source Code  |  1992-02-21  |  16KB  |  680 lines

  1. Set Buffer 30
  2. ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. '                                 Dataflex 
  4. '
  5. '              A simple card file indexer written in AMOS by 
  6. '
  7. '                              Peter J.Hickman 
  8. '
  9. ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  10. '    
  11. ' File Format
  12. '
  13. ' Number of current pages (up to 100) are contained in the first word. 
  14. '
  15. ' Each page uses 344 bytes.  
  16. '
  17. ' The first 14 bytes contain the title of the card.
  18. ' The second 30 bytes contain the first line of text.
  19. ' The third 30 bytes contain the second line of text.  
  20. '  "    "   "    "      "     "     "     "   "   "
  21. '
  22. ' Variables  
  23. ' ~~~~~~~~~    
  24. ' NPAGES=Number of PAGES currently filled
  25. ' PAGENUM=Currently displayed page 
  26. ' POS=The position (in bytes) of the cursor within the current page. 
  27. ' TX=X position in pixels for text cursor
  28. ' TY=Y position in pixels for text cursor
  29. ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
  30. '
  31. ' Define main & Global Variables 
  32. '
  33. NPAGES=1
  34. PAGENUM=1
  35. TX=40
  36. TY=67
  37. POS=0
  38. INP$=" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!�$%^&*()?/.><,#@:;}]{[|\+=_-0123456789~'`"+Chr$(34)
  39. Global NPAGES,PAGENUM,TX,TY,INP$,POS
  40. '
  41. HOUSE_KEEP
  42. '
  43. TITLE_SCR
  44. '
  45. MAIN_SCR
  46. '
  47. DISPLAY_PAGE[1]
  48. '
  49. Repeat 
  50.    Repeat 
  51.       K$=""
  52.       SCAN=0
  53.       SSHIFT=0
  54.       K$=Inkey$
  55.       SCAN=Scancode
  56.       SSHIFT=Key Shift
  57.       If Mouse Zone>0 and Mouse Key>0
  58.          On(Mouse Zone) Proc _LOAD,_SAVE,_PRINT,_SEARCH,_INSERT,_DELETE,_SORT,_DOWN,_UP
  59.       End If 
  60.       If SCAN>=80 and SCAN<=86
  61.          On(SCAN-79) Proc _LOAD,_SAVE,_PRINT,_SEARCH,_INSERT,_DELETE,_SORT
  62.          SCAN=0
  63.       End If 
  64.    Until K$<>"" or SCAN<>0
  65.    '
  66.    ' Up and down movement 
  67.    If Instr(INP$,K$)
  68.       PT_CHAR[K$]
  69.    Else 
  70.       '
  71.       '
  72.       ' Special control keyboard shortcuts 
  73.       '
  74.       '
  75.       If SCAN=78 and SSHIFT=8
  76.          _UP
  77.       End If 
  78.       If SCAN=79 and SSHIFT=8
  79.          _DOWN
  80.       End If 
  81.       If SSHIFT=0
  82.          '
  83.          '
  84.          ' general cursor movement
  85.          '
  86.          '
  87.          If SCAN=95
  88.             _SORT
  89.          End If 
  90.          If SCAN=68 and TY<190
  91.             TX=40
  92.             If TY=67
  93.                TY=80
  94.             Else 
  95.                Add TY,11
  96.             End If 
  97.             D0_CUR
  98.          End If 
  99.          If SCAN=77 and TY<190 and TY<>67
  100.             Add TY,11
  101.             D0_CUR
  102.          End If 
  103.          If SCAN=76 and TY=80
  104.             If TX>144
  105.                TX=144
  106.             End If 
  107.             TY=67
  108.             D0_CUR
  109.          End If 
  110.          If SCAN=77 and TY=67
  111.             TY=80
  112.             D0_CUR
  113.          End If 
  114.          If SCAN=76 and TY>80
  115.             Add TY,-11
  116.             D0_CUR
  117.          End If 
  118.          '
  119.          ' Left and right movement
  120.          If SCAN=78 and TX<144 and TY=67
  121.             Add TX,8
  122.             D0_CUR
  123.          End If 
  124.          If SCAN=79 and TX>40 and TY=67
  125.             Add TX,-8
  126.             D0_CUR
  127.          End If 
  128.          If SCAN=78 and TY>67 and TX<272
  129.             Add TX,8
  130.             D0_CUR
  131.          End If 
  132.          If SCAN=79 and TY>67 and TX>40
  133.             Add TX,-8
  134.             D0_CUR
  135.          End If 
  136.          If SCAN=65
  137.             DEL_CHAR
  138.          End If 
  139.       End If 
  140.    End If 
  141. Until False
  142. Procedure _LOAD
  143.    Bob 1,0,8,1
  144.    While Mouse Key>0 : Wend 
  145.    Bob Off 1
  146.    F$=Fsel$("*.DLX","","Select a cardfile to load")
  147.    If F$<>""
  148.       If Exist(F$)
  149.          INIT_FILE
  150.          Bload F$,Start(6)
  151.          DISPLAY_PAGE[1]
  152.       End If 
  153.    End If 
  154.    D0_CUR
  155. End Proc
  156. Procedure _SAVE
  157.    Bob 1,46,8,2
  158.    While Mouse Key>0 : Wend 
  159.    Bob Off 1
  160.    F$=Fsel$("*.DLX","","Select a cardfile to save")
  161.    If F$<>""
  162.       Bsave F$,Start(6) To Start(6)+(Deek(Start(6))*344)+2
  163.    End If 
  164.    D0_CUR
  165. End Proc
  166. Procedure _PRINT
  167.    Bob 1,92,8,3
  168.    While Mouse Key>0 : Wend 
  169.    Bob Off 1
  170.    REQUEST["Do you wish","to print?","YES","NO"]
  171.    If Param=1
  172.       REQUEST["Print how","much?","ALL","CARD"]
  173.       SIZE=Deek(Start(6))
  174.       Lprint 
  175.       Lprint 
  176.       If Param=1
  177.          For LOP1=1 To SIZE
  178.             PPAGE[LOP1]
  179.          Next LOP1
  180.       Else 
  181.          PPAGE[PAGENUM]
  182.       End If 
  183.    End If 
  184. End Proc
  185. Procedure _PRINT_TO_DISK
  186.    REQUEST["Do you wish","to ASC dump?","YES","NO"]
  187.    If Param=1
  188.       F$=Fsel$("","","")
  189.       If F$<>""
  190.          Open Out 2,F$
  191.          SIZE=Deek(Start(6))
  192.          Print #2,
  193.          Print #2,
  194.          For LOP1=1 To SIZE
  195.             DISKPAGE[LOP1]
  196.          Next LOP1
  197.          Close 
  198.       End If 
  199.    End If 
  200. End Proc
  201. Procedure PPAGE[NUM]
  202.    BASE=Start(6)+(344*(NUM-1))+2
  203.    Lprint "CARD";NUM
  204.    Lprint 
  205.    Lprint "|------------------------------|"
  206.    Lprint "|";
  207.    For LOP=0 To 13
  208.       Lprint Chr$(Peek(BASE+LOP));
  209.    Next LOP
  210.    Lprint "                |"
  211.    Lprint "|------------------------------|"
  212.    Lprint "|";
  213.    For LOP=0 To 329
  214.       Lprint Chr$(Peek(BASE+LOP+14));
  215.       If(LOP+1) mod 30=False
  216.          Lprint "|"
  217.          Lprint "|";
  218.       End If 
  219.    Next LOP
  220.    Lprint "------------------------------|"
  221.    Lprint 
  222.    Lprint 
  223. End Proc
  224. Procedure DISKPAGE[NUM]
  225.    BASE=Start(6)+(344*(NUM-1))+2
  226.    Print #2,"CARD";NUM
  227.    Print #2,
  228.    Print #2,"|------------------------------|"
  229.    Print #2,"|";
  230.    For LOP=0 To 13
  231.       Print #2,Chr$(Peek(BASE+LOP));
  232.    Next LOP
  233.    Print #2,"                |"
  234.    Print #2,"|------------------------------|"
  235.    Print #2,"|";
  236.    For LOP=0 To 329
  237.       Print #2,Chr$(Peek(BASE+LOP+14));
  238.       If(LOP+1) mod 30=False
  239.          Print #2,"|"
  240.          Print #2,"|";
  241.       End If 
  242.    Next LOP
  243.    Print #2,"------------------------------|"
  244.    Print #2,
  245.    Print #2,
  246. End Proc
  247. Procedure _SEARCH
  248.    Bob 1,138,8,4
  249.    While Mouse Key>0 : Wend 
  250.    Bob Off 1
  251.    REQUEST2["Search for","what?"]
  252.    WORD$=Param$
  253.    If WORD$<>""
  254.       BASE=Start(6)+2
  255.       BASEEND=Start(6)+(344*(Deek(Start(6))))+2
  256.       TEMP=Hunt(BASE To BASEEND,WORD$)
  257.       If TEMP>0
  258.          TEMP=TEMP-BASE
  259.          BPAGE=(TEMP/344)+1
  260.          DISPLAY_PAGE[BPAGE]
  261.          PAGENUM=BPAGE
  262.       Else 
  263.          Boom 
  264.          MESSAGE["Word not","found!!","CLICK HERE"]
  265.       End If 
  266.    End If 
  267. End Proc
  268. Procedure _INSERT
  269.    Bob 1,184,8,5
  270.    While Mouse Key>0 : Wend 
  271.    Bob Off 1
  272.    REQUEST["Insert a","card?","YES","NO"]
  273.    If Param=1
  274.       If Deek(Start(6))+1<100 and Deek(Start(6))>1
  275.          BASE=Start(6)+(344*(PAGENUM-1))+2
  276.          BASEEND=Start(6)+(344*(Deek(Start(6))))+2
  277.          NEWBASE=Start(6)+(344*(PAGENUM))+2
  278.          Copy BASE,BASEEND To NEWBASE
  279.          Doke Start(6),Deek(Start(6))+1
  280.          PAGE_FILL[PAGENUM]
  281.          DISPLAY_PAGE[PAGENUM]
  282.       End If 
  283.       If Deek(Start(6))+1=>100
  284.          Boom 
  285.          MESSAGE["Too many","cards!","CLICK HERE"]
  286.       End If 
  287.       If Deek(Start(6))=1
  288.          Boom 
  289.          MESSAGE["Not enough","cards!","CLICK HERE"]
  290.       End If 
  291.    End If 
  292. End Proc
  293. Procedure _DELETE
  294.    Bob 1,230,8,6
  295.    While Mouse Key>0 : Wend 
  296.    Bob Off 1
  297.    REQUEST["Do you wish","to delete?","YES","NO"]
  298.    If Param=1
  299.       REQUEST["Delete how","much?","ALL","CARD"]
  300.       If Param=1
  301.          INIT_FILE
  302.          DISPLAY_PAGE[1]
  303.       Else 
  304.          If Deek(Start(6))=1
  305.             MESSAGE["Not enough","Cards!","CLICK HERE"]
  306.          End If 
  307.          If Deek(Start(6))>1 and PAGENUM<Deek(Start(6))
  308.             BASE=Start(6)+(344*(PAGENUM))+2
  309.             BASEEND=Start(6)+(344*(Deek(Start(6))))+2
  310.             NEWBASE=Start(6)+(344*(PAGENUM-1))+2
  311.             Copy BASE,BASEEND To NEWBASE
  312.             Doke Start(6),Deek(Start(6))-1
  313.             DISPLAY_PAGE[PAGENUM]
  314.          Else 
  315.             If Deek(Start(6))>1 and PAGENUM=Deek(Start(6))
  316.                PAGE_FILL[PAGENUM]
  317.                Dec PAGENUM
  318.                Doke Start(6),Deek(Start(6))-1
  319.                DISPLAY_PAGE[PAGENUM]
  320.             End If 
  321.          End If 
  322.       End If 
  323.    End If 
  324. End Proc
  325. Procedure PAGE_FILL[NUM]
  326.    A$="    "
  327.    BASE=Start(6)+(344*(NUM-1))+2
  328.    Fill BASE To BASE+344,Leek(Varptr(A$))
  329. End Proc
  330. Procedure _DOWN
  331.    If PAGENUM>1
  332.       Dec PAGENUM
  333.       DISPLAY_PAGE[PAGENUM]
  334.    End If 
  335. End Proc
  336. Procedure _UP
  337.    If PAGENUM<99
  338.       Inc PAGENUM
  339.       If PAGENUM>Deek(Start(6))
  340.          Doke Start(6),PAGENUM
  341.       End If 
  342.       DISPLAY_PAGE[PAGENUM]
  343.    End If 
  344. End Proc
  345. Procedure CL0SE_SCRS
  346.    While Screen<>-1
  347.       Screen Close Screen
  348.    Wend 
  349. End Proc
  350. Procedure DEL_CHAR
  351.    If TX=40
  352.       If TY>80
  353.          Add TY,-11
  354.          TX=272
  355.          Text TX,TY," "
  356.          _POKEPAGE[32]
  357.          D0_CUR
  358.       Else 
  359.          If TY>67
  360.             TY=67
  361.             TX=144
  362.             Text TX,TY," "
  363.             _POKEPAGE[32]
  364.             D0_CUR
  365.          End If 
  366.       End If 
  367.    Else 
  368.       Add TX,-8
  369.       Text TX,TY," "
  370.       _POKEPAGE[32]
  371.       D0_CUR
  372.    End If 
  373. End Proc
  374. Procedure _POKEPAGE[CHAR]
  375.    BASE=Start(6)+(344*(PAGENUM-1))+2
  376.    POS=(TX-40)/8
  377.    If TY=80 Then Add POS,14
  378.    If TY=91 Then Add POS,44
  379.    If TY=102 Then Add POS,74
  380.    If TY=113 Then Add POS,104
  381.    If TY=124 Then Add POS,134
  382.    If TY=135 Then Add POS,164
  383.    If TY=146 Then Add POS,194
  384.    If TY=157 Then Add POS,224
  385.    If TY=168 Then Add POS,254
  386.    If TY=179 Then Add POS,284
  387.    If TY=190 Then Add POS,314
  388.    Poke BASE+POS,CHAR
  389. End Proc
  390. Procedure PT_CHAR[K$]
  391.    Text TX,TY,K$
  392.    '
  393.    _POKEPAGE[Asc(K$)]
  394.    '
  395.    '
  396.    If TY=67
  397.       If TX=144
  398.          TX=40
  399.          TY=80
  400.       Else 
  401.          Add TX,8
  402.       End If 
  403.    Else 
  404.       If TX<272
  405.          Add TX,8
  406.       Else 
  407.          If TX=272 and TY<190
  408.             TX=40
  409.             Add TY,11
  410.          End If 
  411.       End If 
  412.    End If 
  413.    D0_CUR
  414.    TEMP=Free
  415. End Proc
  416. Procedure WSET[T]
  417.    Timer=0
  418.    Clear Key 
  419.    Repeat 
  420.       TEMP1=Asc(Inkey$)
  421.    Until Mouse Key<>0 or TEMP1<>0 or Timer=>T
  422. End Proc
  423. Procedure TITLE_SCR
  424.    Unpack 13 To 0
  425.    Screen Hide 0
  426.    Palette $8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E
  427.    Screen Show 0
  428.    Fade 2,$8E,$444,$0,$BBB,$FFF,$FFF,$FFF,$FFF
  429.    Wait 15
  430.    WSET[5000]
  431.    Fade 2,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E
  432.    Wait 15
  433.    Screen Close 0
  434. End Proc
  435. Procedure MAIN_SCR
  436.    Unpack 14 To 0
  437.    Screen Hide 0
  438.    Palette $8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E,$8E
  439.    Screen Show 0
  440.    Fade 2,$8E,$444,$40D,$777,$27A,$8E,$AAA,$CCC,$BEF,$FFF,$3,$3D,$8D,$DD,$EEE,$0
  441.    Wait 15
  442.    Flash 12,"(533,4)(644,4)(844,4)(A44,4)(C44,4)(D44,4)(F44,4)(F77,4)(F99,8)(F77,4)(D44,4)(C44,4)(A44,4)(844,4)(644,4)(533,4)"
  443.    Ink 15,9
  444.    Reserve Zone 13
  445.    For LOP=1 To 7
  446.       Read X1,Y1
  447.       Set Zone LOP,X1,Y1 To X1+43,Y1+28
  448.    Next LOP
  449.    Read X1,Y1,X2,Y2
  450.    Set Zone 8,X1,Y1 To X2,Y2
  451.    Read X1,Y1,X2,Y2
  452.    Set Zone 9,X1,Y1 To X2,Y2
  453.    Data 0,8
  454.    Data 46,8
  455.    Data 92,8
  456.    Data 138,8
  457.    Data 184,8
  458.    Data 230,8
  459.    Data 276,8
  460.    Data 2,108,29,136
  461.    Data 291,108,318,136
  462. End Proc
  463. Procedure HOUSE_KEEP
  464.    For LOP=2 To 12
  465.       Erase LOP
  466.    Next LOP
  467.    Erase 15 : Erase 16
  468.    CL0SE_SCRS
  469.    Colour Back $8E
  470.    INIT_FILE
  471. End Proc
  472. Procedure INIT_FILE
  473.    Erase 6
  474.    Reserve As Work 6,34202
  475.    A$="    "
  476.    Fill Start(6)+2 To Start(6)+Length(6),Leek(Varptr(A$))
  477.    ' number of pages
  478.    Doke Start(6),1
  479.    PAGENUM=1
  480.    NUMPAGES=1
  481. End Proc
  482. Procedure DISPLAY_PAGE[NUM]
  483.    NPAGES=Deek(Start(6))
  484.    Bob Off 
  485.    Update 
  486.    Autoback 0
  487.    Text 194,67,"   "
  488.    Text 240,67,"   "
  489.    Text 194,67,Str$(NUM)-" "
  490.    Text 240,67,Str$(Deek(Start(6)))
  491.    BASE=Start(6)+(344*(NUM-1))
  492.    X=40
  493.    For LOP=0 To 13
  494.       Text X,60+7,Chr$(Peek(BASE+LOP+2))
  495.       Add X,8
  496.    Next LOP
  497.    X=40
  498.    For LOP=0 To 29
  499.       Text X,80,Chr$(Peek(BASE+LOP+14+2))
  500.       Text X,91,Chr$(Peek(BASE+LOP+44+2))
  501.       Text X,102,Chr$(Peek(BASE+LOP+74+2))
  502.       Text X,113,Chr$(Peek(BASE+LOP+104+2))
  503.       Text X,124,Chr$(Peek(BASE+LOP+134+2))
  504.       Text X,135,Chr$(Peek(BASE+LOP+164+2))
  505.       Text X,146,Chr$(Peek(BASE+LOP+194+2))
  506.       Text X,157,Chr$(Peek(BASE+LOP+224+2))
  507.       Text X,168,Chr$(Peek(BASE+LOP+254+2))
  508.       Text X,179,Chr$(Peek(BASE+LOP+284+2))
  509.       Text X,190,Chr$(Peek(BASE+LOP+314+2))
  510.       Add X,8
  511.    Next LOP
  512.    Autoback 2
  513.    TX=40 : TY=67
  514.    Bob 1,TX,TY,9
  515.    POS=0
  516. End Proc
  517. Procedure D0_CUR
  518.    Bob 1,TX,TY,9
  519. End Proc
  520. Procedure REQUEST[TXT1$,TXT2$,BUT1$,BUT2$]
  521.    Bob Off 1
  522.    Update 
  523.    Ink 15,14
  524.    Get Cblock 1,100,78,130,64
  525.    Paste Bob 100,78,7
  526.    TXT1$=Left$(TXT1$,12)
  527.    TXT2$=Left$(TXT2$,12)
  528.    T1=Text Length(TXT1$)
  529.    T2=Text Length(TXT2$)
  530.    Text 111+((96-T1)/2),94,TXT1$
  531.    Text 111+((96-T2)/2),105,TXT2$
  532.    BUT1$=Upper$(Left$(BUT1$,4))
  533.    BUT2$=Upper$(Left$(BUT2$,4))
  534.    T1=Text Length(BUT1$)
  535.    T2=Text Length(BUT2$)
  536.    Text 116+((32-T1)/2),124,BUT1$
  537.    Text 171+((32-T2)/2),124,BUT2$
  538.    Set Zone 10,111,113 To 151,129
  539.    Set Zone 11,166,113 To 206,129
  540.    T$=""
  541.    Clear Key 
  542.    Repeat 
  543.       A=Mouse Zone
  544.       T$=Upper$(Inkey$)
  545.    Until(A>9 and Mouse Key) or(T$=Left$(BUT1$,1)) or(T$=Left$(BUT2$,1))
  546.    If T$=Left$(BUT1$,1) Then A=10
  547.    If T$=Left$(BUT2$,1) Then A=11
  548.    Add A,-9
  549.    If A=1
  550.       Bob 1,111,113,10
  551.    Else 
  552.       Bob 1,166,113,10
  553.    End If 
  554.    Bell 
  555.    Wait 2
  556.    Play 0,0
  557.    While Mouse Key>0 : Wend 
  558.    Bob Off 
  559.    Update 
  560.    Put Cblock 1,100,78
  561.    Ink 15,9
  562.    D0_CUR
  563. End Proc[A]
  564. Procedure REQUEST2[TXT1$,TXT2$]
  565.    Bob Off 1
  566.    Update 
  567.    Ink 15,14
  568.    Get Cblock 1,100,78,130,64
  569.    Paste Bob 100,78,8
  570.    TXT1$=Left$(TXT1$,12)
  571.    TXT2$=Left$(TXT2$,12)
  572.    T1=Text Length(TXT1$)
  573.    T2=Text Length(TXT2$)
  574.    Text 111+((96-T1)/2),94,TXT1$
  575.    Text 111+((96-T2)/2),105,TXT2$
  576.    NEW_INPUT
  577.    WORD$=Param$
  578.    Put Cblock 1,100,78
  579.    Ink 15,9
  580.    D0_CUR
  581.    Add A,-9
  582. End Proc[WORD$]
  583. Procedure NEW_INPUT
  584.    I$=""
  585.    Bob Off 
  586.    Ink 15,14
  587.    X=115
  588.    Text X,124,".........."
  589.    Bob 1,X,124,9
  590.    Clear Key 
  591.    Repeat 
  592.       K$=Inkey$
  593.       KEYSCAN=Scancode
  594.       If KEYSCAN=65 and Len(I$)>0
  595.          I$=Left$(I$,Len(I$)-1)
  596.          Add X,-8
  597.          Text X,124,"."
  598.          Bob 1,X,124,9
  599.       End If 
  600.       If Instr(INP$,K$) and Len(I$)<10
  601.          Text X,124,K$
  602.          I$=I$+K$
  603.          Add X,8
  604.          Bob 1,X,124,9
  605.       End If 
  606.    Until KEYSCAN=68
  607.    Bob Off 
  608.    Update 
  609. End Proc[I$]
  610. Procedure MESSAGE[TXT1$,TXT2$,BUT$]
  611.    Bob Off 1
  612.    Update 
  613.    Ink 15,14
  614.    Get Cblock 1,100,78,130,64
  615.    Paste Bob 100,78,8
  616.    TXT1$=Left$(TXT1$,12)
  617.    TXT2$=Left$(TXT2$,12)
  618.    T1=Text Length(TXT1$)
  619.    T2=Text Length(TXT2$)
  620.    Text 111+((96-T1)/2),94,TXT1$
  621.    Text 111+((96-T2)/2),105,TXT2$
  622.    BUT$=Left$(BUT$,11)
  623.    T1=Text Length(BUT$)
  624.    Text 115+((88-T1)/2),124,BUT$
  625.    Set Zone 10,111,113 To 206,129
  626.    Clear Key 
  627.    Repeat 
  628.       A=Mouse Zone
  629.    Until(A=10 and Mouse Key) or(Inkey$<>"")
  630.    Bob 1,108,112,11
  631.    Bell 
  632.    Wait 2
  633.    Play 0,0
  634.    While Mouse Key : Wend 
  635.    Bob Off 
  636.    Update 
  637.    Put Cblock 1,100,78
  638.    Ink 15,9
  639.    D0_CUR
  640. End Proc
  641. Procedure _SORT
  642.    Bob 1,276,8,12
  643.    While Mouse Key>0 : Wend 
  644.    Bob Off 1
  645.    NPAGES=Deek(Start(6))
  646.    If NPAGES>1
  647.       REQUEST["Sort, are","you sure?","YES","NO"]
  648.       If Param=1
  649.          Reserve As Work 7,34202
  650.          X$="    "
  651.          Fill Start(7)+2 To Start(7)+Length(7),Leek(Varptr(X$))
  652.          Dim A$(NPAGES-1)
  653.          For LOP=0 To NPAGES-1
  654.             BASE=Start(6)+(344*(LOP))+2
  655.             A$(LOP)=""
  656.             For LOP2=0 To 13
  657.                A$(LOP)=A$(LOP)+Chr$(Peek(BASE+LOP2))
  658.             Next LOP2
  659.             '
  660.             '
  661.             A$(LOP)=A$(LOP)+(Str$(LOP)-" ")
  662.          Next LOP
  663.          Sort A$(0)
  664.          Doke Start(7),Deek(Start(6))
  665.          For LOP=0 To NPAGES-1
  666.             NUM=Val(Mid$(A$(LOP),15,3))
  667.             BASE=Start(6)+(344*(NUM))+2
  668.             BASE2=Start(7)+(344*(LOP))+2
  669.             Copy BASE,BASE+344 To BASE2
  670.          Next LOP
  671.          Bank Swap 6,7
  672.          Erase 7
  673.          PAGENUM=1
  674.          MESSAGE["Cards are","now sorted.","CLICK HERE"]
  675.          DISPLAY_PAGE[1]
  676.       End If 
  677.    Else 
  678.       MESSAGE["Not enough","to sort!","CLICK HERE"]
  679.    End If 
  680. End Proc