home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM 1995 Fall / PD-ROM F95.toast / Programming / Programming Languages / PC Basic ƒ / PCBASIC MPW version / PCBASIC Demo / PCBASICDemo.b < prev    next >
Encoding:
Text File  |  1992-02-22  |  3.8 KB  |  144 lines  |  [TEXT/ttxt]

  1. 1    '  PCDemo, a demonstration program for PCBASIC
  2.  
  3. 10   ' Set up Feature menu items as vectors
  4.  
  5.      KEY(1) ON : ON KEY(1) GOSUB IntlText
  6.      KEY(2) ON : ON KEY(2) GOSUB IBMText
  7.      KEY(3) ON : ON KEY(3) GOSUB FKeyText
  8.      KEY(4) ON : ON KEY(4) GOSUB DLogText
  9.      KEY(5) ON : ON KEY(5) GOSUB MouseText
  10.      KEY(6) ON : ON KEY(6) GOSUB BigText
  11.      KEY(7) ON : ON KEY(7) GOSUB StrongText
  12.  
  13. 20   ' Set up Order menu vector
  14.      FILES MENU ON  : ON FILES MENU GOSUB 800
  15.  
  16.      ' Let Apple-period start Debugger
  17.      BREAK ON : ON BREAK GOSUB Debugger
  18.  
  19.      ' Show intro and wait for operator
  20.      GOSUB IntroText
  21.      
  22. 50   ' Wait for a function key
  23. 55   GOTO 50
  24.  
  25. IntlText ' Text for International
  26.     RESTORE #501   ' Point to text in resource file
  27.     GOTO 1000       ' Display text on the screen
  28. IBMText ' Text for     IBM Compatible
  29.     RESTORE #502 : GOTO 1000
  30. FKeyText ' Text for Menus and Function Keys
  31.     RESTORE #503 : GOTO 1000
  32. DlogText ' Text for Dialog and Alert Boxes
  33.     RESTORE #504 : GOTO 1000
  34. MouseText ' Text for Mouse and Editing
  35.     RESTORE #505 : GOTO 1000
  36. BigText ' Text for Large Programs and Data
  37.     RESTORE #506 : GOTO 1000
  38. StrongText ' Text for Industrial Strength
  39.     RESTORE #507 : GOTO 1000
  40. IntroText ' Text for Introduction
  41.     RESTORE #508 : GOTO 1000
  42.  
  43. 800 ' Order menu subroutine
  44.     LOCATE  ,,2        ' Initialize cursor to an arrow
  45.     Item%= FILES(0) ' Which item in order menu ?
  46.     IF Item%=0 THEN RETURN    ' All done ?
  47.     IF Item%=3 THEN 9999      ' Quit program
  48.  
  49. IF ITEM%=4 THEN 5000
  50.     ' Start order dialog
  51.     DIALOG(501,8+Item%)=1     ' Preset Buy or Information button
  52.     ' Let operator press a button
  53.     GOSUB 810                
  54.     ' Close the dialog
  55.     CLOSE #501              ' Close the dialog
  56.     GOTO 800
  57.  
  58. 810 ' Print, Save or Cancel ?
  59.     
  60.     IF DIALOG(501,11) THEN 830       ' PRINT ?
  61.     IF DIALOG(501,12) THEN 820       ' SAVE ?
  62.     IF DIALOG(501,13) THEN RETURN   ' CANCEL ?
  63.     
  64.     GOTO 810
  65.  
  66. 820 ' Save
  67.     OPEN "Mail List" FOR APPEND AS 1
  68.     FOR I%=2 TO 6
  69.     Item$=DIALOG$(501,I%)     ' Read text from dialog box
  70.     PRINT #1, Item$
  71.     NEXT
  72.  
  73.     ' Get system and order buttons from dialog box
  74.     IF DIALOG(501,7)=1 THEN PRINT#1, "StandAlone " ;
  75.     IF DIALOG(501,8)=1 THEN PRINT#1, "MPW " ;
  76.     IF DIALOG(501,9)=1 THEN PRINT#1, "Manual " ELSE PRINT#1, "Disk "
  77.     CLOSE #1              ' Close the file
  78.     RETURN
  79.     
  80. 830 ' Print
  81.  
  82.      OPEN "LPT2:" AS #2
  83.      PRINT #2,  "Pterodactyl Software"
  84.      PRINT #2,  "200 Davey Glen Rd #416"
  85.      PRINT #2,  "Belmont CA 94002"
  86.      PRINT #2,  " "
  87.      PRINT #2,  " Please send a ";
  88.      IF DIALOG(501,9)=1 THEN PRINT#2, "manual. Enclosed is $50." ELSE PRINT#2,"disk." 
  89.      PRINT #2,  " "
  90.      FOR I%=2 TO 6
  91.      Item$=DIALOG$(501,I%)     ' Read text from dialog box
  92.      PRINT #2, Item$
  93.      NEXT
  94.      PRINT#2,CHR$(12);            ' Form Feed
  95.      CLOSE #2                    ' Close the Printer
  96.      RETURN
  97.  
  98. 1000 ' Display text on screen
  99.      LOCATE #132 ' Show Watch cursor
  100.      CLS
  101.      READ OneLine$
  102.      WHILE OneLine$ <> "END"
  103. 1010 ? OneLine$
  104.      READ OneLine$
  105.      WEND
  106.      LOCATE #300 ' Show custom cursor
  107.      RETURN
  108.  
  109. 9999 ' Exit the PCDemo Program
  110.      END
  111. '
  112. DEBUGGER
  113. '
  114. 5000 ' Break
  115.      BreakPoint$ = STR$(BreakPoint%)
  116.      DIALOG$(650,6) = BreakPoint$
  117.      DIALOG(650,6) = LEN(BreakPoint$)
  118.      DIALOG$(650,7) = "Current Line ="+STR$(TRON(0))
  119.      DIALOG$(650,8) = "OneLine$="+OneLine$
  120.      DIALOG$(650,9) = "Item%="+STR$(Item%)
  121. 5005 ' Wait for a button
  122.      DebugChoice% = DIALOG #650
  123.      BreakPoint% = VAL%(DIALOG$(650,6))
  124.      ON DebugChoice% GOTO 5010,5020,5030
  125.      GOTO 5005
  126. 5010 ' Step
  127.      DIALOG(650,1) = 0
  128.      ON TRON GOSUB 5000
  129.      TRON 
  130.      RETURN
  131. 5020 ' Go till break
  132.      ON TRON GOSUB 5050
  133.      CLOSE 650
  134.      TRON 
  135.      RETURN
  136. 5030 ' Quit Debugger
  137.      ON TRON GOSUB 0
  138.      CLOSE 650
  139.      TROFF 
  140.      RETURN
  141. 5050 ' Check for break
  142.     IF BreakPoint%<>TRON(0) THEN TRON : RETURN ELSE 5000
  143.  
  144.