home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / basic / QBINT.ZIP / INTDEMO.BAS (.txt) next >
Encoding:
QuickBASIC Tokenized Source  |  1991-08-26  |  28.0 KB  |  554 lines

  1. RegType
  2. flags
  3. @    INTERRUPTq
  4. intnumX
  5. inregZ
  6. outreg
  7. DosVer
  8.     DiskSpace
  9. DriveL
  10. UseDrive
  11. MuzKeyL
  12. BlinkBar(
  13. NumbChar.
  14. charK
  15. DosPrint
  16. WindowR
  17. Window.Stroll
  18. lines
  19.     BackColorA
  20. PrGraph~
  21. ScrMode
  22. Lmargin
  23. InRegs
  24. outregs
  25. NMALLOC4
  26. INCLUDEX
  27.     ErrHandle:
  28. SpcDrive
  29. DefDrive
  30. ErrRecy
  31. Demo.StrollWindow.
  32. Demo.WindowStroll
  33. RollWind<
  34. Demo.RollWindb
  35. menu.window
  36. border
  37.     CURSOROFF
  38. bottomv
  39. Plus.Window
  40. Text.Displaye
  41. Title
  42. colsu
  43. text.window
  44.     Demo.Main
  45.     MainInfo1
  46.     Demo.Help
  47. @    Plus.Help
  48. Plus.Display
  49. MainHelp
  50.     Plus.Main
  51. MainMenuList
  52. SPACEG
  53. enter
  54. TABKEY
  55. left-
  56. RIGHTe
  57. PgDnn
  58. PgUp.
  59. NULL6
  60. CTRLD
  61. CTRLG
  62. CTRLH[
  63. CTRLS#
  64. CTRLV
  65. BLACKH
  66. GREENX
  67. MAGENTA
  68. YELLOW
  69. WHITE
  70. BRIGHT
  71. FLASH
  72. BACKGROUND
  73. NORMAL6
  74. HILITE;
  75. FALSEX
  76. TRUEg
  77. CURSORON
  78. MOVELEFT
  79.     MOVERIGHT
  80. MOVEUP
  81. MOVEDOWN
  82. VERTICAL
  83.     HORIZONAL
  84. Nmenu
  85. PreMenuL
  86. Demo.AlarmX
  87. Demo.BlinkBar
  88. Demo.
  89. Demo.DefDrive
  90. Demo.DosPrint
  91. Demo.DosVer
  92. Demo.Muzkey
  93. Demo.PrGraph
  94. Demo.SpcDrive
  95. Demo.UseDrive
  96. @    Demo.Quit
  97. HelpBlinkBar1
  98. HelpDefDrive1
  99. TotalDrive
  100. CurDrive
  101. DriveNam
  102. Plus.Warningu
  103. HelpDosVer1
  104. HelpDosPrint1
  105. rapidly/
  106. changing"
  107. HelpMuzKey}
  108. HelpMuzKey1
  109. ErrNR
  110. HelpPrGraph1c
  111. HelpPrGraph29
  112. Graph8
  113. intpu
  114. intput
  115. SUBCALL
  116. HelpSpcDriveB
  117. Plus.WindInput
  118. BACKSPC
  119. Plus.Alarm
  120. Warninga
  121. Sbytes
  122.     PlaySwith
  123. elsee
  124. PlayOnC
  125. HelpUseDrivet
  126. HelpUseDrive1
  127. HelpUseDrive2
  128. HelpRollWindow1|    
  129. HelpRollWind1
  130. PreTopN
  131. Totalp
  132. HelpRollWind
  133. HLITE
  134. C1S32M
  135. F3R7M
  136. NL12M
  137. BU3P3
  138. C1BMO
  139. NL8H1L3E1L2F1L3G1M
  140. L1BF1P3g
  141. BR4C1M\
  142. BG1F2U3ME
  143. BR1P1
  144. BR1P3|
  145. C3H1M
  146. U1H2U4BM:    
  147. nDEFINTW    
  148. Alarm3
  149.     MainInfo2
  150. Plus.Error(
  151. CodeF    
  152. PrintError!    
  153.     DiskError}
  154. FatalErrorN    
  155. DeviceError
  156. Plus.
  157. RegTypeX9
  158. es/    @
  159. InterruptX
  160. InRegsX
  161. OutRegsX
  162. Valid
  163. Demo.GetFileDta
  164. HelpGetFileDtaG
  165. HelpGetFileDta1
  166. GetFileDta
  167. ErrCode
  168. FileDta
  169. FileDta.FileName
  170. FileType
  171. DosJunk
  172. Attr>
  173. DateR
  174. SizeO
  175. FileName
  176. DtaBufs
  177. FileListT
  178. MaxFile
  179. Counter
  180. Count]
  181. DirRow1h
  182. DirRow2p
  183. DirCol1
  184. DirCol2
  185.     FileCountW
  186. FileCounterU
  187. DirNum
  188. Plus.SelectWindow
  189. FNumy
  190. ListA
  191. itemn
  192. Items
  193. ItemLen^
  194. ItemWin
  195. FileNum+
  196. exidI
  197. Cursor%
  198. WinMax
  199. WinMin
  200.     PreCursor
  201. DOWNCursord
  202. UPCursor
  203. FilLen
  204. fileh
  205.     File.Attr@
  206. Attrib
  207. Plus.Filter
  208. AString
  209. Plus.SkipSpace
  210. Direc
  211. instr
  212.     GetDirSpe
  213. GetDirSpece
  214. TotalDirve
  215. GetFileDta3
  216. GetFileDta4
  217. HelpGetFileDta4-
  218. HelpGetFieDta2;
  219. HelpGetFileDta2
  220. which
  221. returns
  222. number
  223. repead0
  224. lSpec
  225. TempFile
  226. FilDtaN
  227. FilDta.FileName
  228. DriveNum
  229.     DriveSpec
  230. DirSpec
  231. NewDrive
  232. DriveAttrib
  233. NoMore
  234. DownArr
  235. UpArrF
  236. DownnArr
  237. LPathx
  238. TempP
  239. PathRow
  240. PathCol
  241. PathLen
  242. Lable
  243. HelpGetFileDta3
  244. FileCol
  245. Label
  246. PRINNT
  247. CheckDrive
  248. Plus.CheckDrive
  249. Plus.ErrDrive
  250. ErrDrive
  251. TempErr
  252. a:intplus.BI'
  253.  Include file for using INTPLUS.BAS
  254.  Definations from  QB.BI
  255.  Define the type needed for INTERRUPT
  256.  Define the type needed for INTERUPTX
  257.  Generate a software interrupt, loading all but the segment registers
  258.  Generate a software interrupt, loading all registerse
  259.  If you prefer to use QB.BI which has the similar definations as above:
  260.  --- Delete above lines, use '$INCLUDE: 'qb.bi' instead.
  261.   << Get current DOS version.>>I
  262.   << Get free space on specified drive >>q
  263.   << Change current default drive. Returns total logical drive Number. >>
  264.   << Get current default drive >>.
  265.   << Plays sound for each key user pressed and returns the key >>m
  266.   << Generate a blinking bar till user press a key. >>
  267.   << Print text$ use DOS function. >>r
  268.   << Stroll window in any mode using a DOS function >>
  269.   << Graphics screen dump to dot-matrix printer in mode 1 or 2 only >>
  270.   << Get file information from disk and store in FileDta >>r
  271.   << Get directory information>>
  272.    Define inregs and outregs for INTERRUPT use.n
  273.    Must also copy to the main module if you use this program
  274.    as a secondary module.m
  275.  INTDEMO.BAS: Demo for INTPLUS.BAS
  276.  Note: Must load INTPLUS.BAS together to use. Have the **
  277.  'INTPLUS.BI' included which has useful defines. * 
  278.  You also need to start QB with /L option to use **
  279.  a Quick library which has INTERRUPT routine(s). **
  280.  QB.QLB contains this routine
  281. * Declarations and definitions for keys 
  282.  If you wish to use any subroutines contained in INTDEMO.BAS,
  283.  | following constants must be included or properly defined otherwise.|
  284.  Define names similar to keyboard names with their equivalent key codes.
  285.  Define English names for color-specification numbers. Add BRIGHT to
  286.  any color to get bright version.p
  287.  Miscellaneous symbolic constantso
  288. --- Number of main memu items
  289. --- Error handler
  290. - Main Program start here 
  291. Press a key to continue:e
  292. - Error  Handler 
  293. Program abort on device or fatal error."7
  294. - Data Section 
  295.  "  This Demo demonstrates functions and"
  296.  " routines contained in INTPLUS.BAS."
  297.  "  'You may try them  on your own risk'"
  298.  "  I  wrote  this Demo  program in this"
  299.  " way  so I can practice  using  a good"
  300.  " programming style."
  301.  "  Routines in  this Demo are also very"
  302.  " useful.  They just need a little more"
  303.  " adjustments before you can use."
  304.  "  Feel free to use\modify any routines"
  305.  " in INPLUS.BAS and this demo."
  306.  " << FeedBacks: E-mail\GEnie, M.LEI1 >>"
  307.  "IBM-PCRT Search keyword:QTECH"
  308.  "SUB  BlinkBar"
  309.  "FUNCTION  DefDrive"
  310.  "SUB  DosPrint"
  311.  "FUNCTION  DosVer"
  312.  "FUNCTION  MuzKey"
  313.  "SUB  PrGraph"
  314.  "SUB  RollWindow"
  315.  "FUNCTION  SpcDrive"
  316.  "FUNCTION  UseDrive"
  317.  "SUB  GetFileDta"
  318.  "<<Quit Demo>>"
  319.  " Choose a sub or function for a demonstration:
  320.  "       Use up\down arrows then press <Return> to select a routine"
  321.  "       title name for demonstration."
  322.  "    BlinkBar(NumbChar, char) is a SUB which displays a blinking bar"
  323.  " rapidly changing Color until a key is pressed by user. "
  324.  " In demo >:      CALL BlinkBar(7 * 80, 178)"
  325.  "    DefDrive is a integer FUNCTION which returns a value represents"
  326.  " the current default drive."
  327.  " In demo >:      CurDrive = DefDrive"
  328.  "    DosVer is a integer FUNCTION returns a value which is the current"
  329.  " DOS version times 100."
  330.  " In demo >:      Ver% = DosVer%"
  331.   "$"
  332.  "    DosPrint(text$) is a SUB which invokes a DOS function to print a"
  333.  " text string."
  334.  " In demo >:      CALL DosPrint(Pr$)"
  335.  "    Muzkey$ is a string FUNCTION plays a different sound for each key"
  336.  " pressed before returning the value."
  337.  " In demo >:      Char$ = Muzkey$"
  338.  "    SUB PrGraph (ScrMode, Lmargin, c1, r1, c2, r2) prints graphics screen"
  339.  " images to EPSON or compatible dot-matrix printer in screen mode 1  or 2"
  340.  " In demo >:      CALL PrGraph(1, 1, 0, 0, 319, 199)"
  341.  "  In this demo, we will go on to display and to print a graph in screen"
  342.  "  mode 1. Portion  of the graphics screen can be selected by  specify"
  343.  "  range: c1, r1, c2, r2 parameters in PrGraph."
  344.  "  If your monitor does not support CGA mode 1 or you don't have a Epson"
  345.  "  or compatible DOT-MATRIX printer, you may press <ESC> to abort now."
  346.  "  FUNCTION SpcDrive! (Drive%) returns a SINGLE precision number which is"
  347.  " the free bytes availiable in drive specified by user. [Use with Caution]"
  348.  " In demo >:       Sbytes! = SpcDrive!(Drive)"
  349.  "  FUNCTION UseDrive (Drive%) sets new default drive and returns a
  350.  " integer value which is the number of total logical drives availiable."
  351.  " In demo >:       TotalDrive = UseDrive(Drive)"
  352.  "     Now you can check new default drive is set by"
  353.   " sending>: FILES with no parameters at the IMMEDIATE"
  354. 6  " window within QB environment"
  355. J  "$"
  356.   "  SUB RollWind (Lines, r1, c1, r2, c2, BackColor) stolls lines in"
  357.   " vertical direction in a window defined by r1,c1,r2,c2. Backcolor is"
  358. 8! " the color used to fill the new line(s). Lines :  positive means up"
  359. ! " , negative means down. >>In demo: CALL RollWind(1, 4, 16, 16, 64, 1)"
  360. ! "$"
  361. ! "  SUB GetFileDta (Spec$, DtaBuf AS FileType, ErrCode%) returns DtaBuf"
  362. D" " as a file information specified by Spec$. Use it in a loop continue to"
  363. " " call GetFileDta until ErrCode is not 0. FileType: see INTPLUS.BI."
  364. " "  FUNCTION GetDirSpec$ () returns current directory information"
  365. " "$"
  366. 6# "   GetFileDta simply returns file DTAs. Demo.GetFileDta "
  367. x# " demonstrates of how to use returned DTA in a program:"
  368. # "   Demo.GetFileDta repeatly calls GetFileDta to get list  of"
  369. $ " Filenames and stores them in a array which later passes to"
  370. ($ " Demo.SelectWindow."
  371. n$ "   Demo.SelectWindow is a function allows user to select a"
  372. $ " item from a window. When a item is select, it's returned as"
  373. $ " a valid array index number."
  374. $% "   Demo.GetFileDta gets the number, checks if the refered"
  375. j% " entry is a directory. If so, change to this directory and"
  376. % " repead above procedures. Otherwise, a file is selected."
  377. % "$"
  378. % "File Name:"
  379. Demo.RollWind
  380. Use up\down arrows
  381. Plus.Window
  382.    Display a window enclosed with (r1,c1,r2,c2)r
  383.    Border style is defined by "border", (see below).
  384.    1 : single bar, 2 : double bar ,3 : solid bar, 0 : clear window
  385.    others : CHR$(border) is used; 
  386. -  clear window
  387. Demo.Main
  388.    Functionn returns a valid main menu item selected by user
  389. - Display menu\help\etc. screensn
  390. << DEMO FOR INTPLUS.BAS >>:Introd    e
  391. Future QB uploads"e
  392.  d    d    d
  393. DEMOS"d    d!e
  394. -  The loop below respond to user`s key strokes.o
  395.  When <Enter> is pressed, menu been selected.r
  396. - get a key
  397. - if key length = 2
  398.  --- arrow key?e
  399. --- display menu cursor
  400. ---  menu been selected 
  401. ---  a wrong is pressed
  402. - return menu selected
  403. Plus.Display
  404.    Header: noneP
  405.    Call:   text.window
  406.    Update: 1/19/91
  407.    Update for INTDEMO (5/20/91) 
  408.    Comments: Must in the module contain DATAs that
  409.  contain texts to display.(Terminated by a "$") 
  410.    -- Display text in window, center Title$ if availiable
  411. Plus.Help
  412.    Display Help Screen
  413. Description"e
  414. Demo.BlinkBar
  415. Demo.DefDrive
  416. Returning value:    
  417. Your current default drive is 
  418. Demo.DosPrint
  419. Type line(s) of text below:"
  420. Print the string in DOS:
  421. Demo.DosVer
  422. Returning value:    
  423. Current DOS version is  
  424. Demo.Muzkey
  425. Type characters in the window below: [ESC to quit]
  426.  --- See Plus.WindInput
  427. Demo.PrGraph
  428. Current video mode does not support CGA.7
  429. PrGraph"d
  430. C1S32M+2,7F3R7M+2,-3NL12M+2,-6L3M+1,6BU3P3,1C1BM-2,4P1,1BM+2,-1M-2,-9NL8H1L3E1L2F1L3G1M-2,9M+1,-4M-2,-3L1BF1P3,1BR4C1M+1,2M+2,-1M-3,-1BM+4,1M+2,1M+1,-2M-3,1BG1F2U3M-2,1BR1P1,1BM-4,2M+3,-1M-2,3M-1,-2BR1P3,1BM+3,1P2,1BM-9,-6C3H1M-2,-1M-1,-4BM+4,6U1H2U4
  431. T E A"
  432. T i m e !"
  433. Adjust printer. Press a key to print:"
  434. Demo.SpcDrive
  435. Check space on which drive: ?"
  436. Invalid drive or Illegal input. Use A,B,C.."7
  437. There are 
  438.  free byes in Drive 
  439. Demo.UseDrive
  440. - Display Help
  441. - Get current driveo
  442. - Get total logical drive number
  443. Current default drive is :
  444. Select new default drive from ['A' to '"
  445. - Get a key and convert to upper caseu
  446. - Convert to drive numberC
  447. -- It's valid?
  448. - If not valid
  449. Invalid drive or Illegal input. Use A,B,C, etc..7
  450. - * Change to New Default drive
  451. Default drive has set to "
  452. Total numbers of logical drive is  "
  453. - A warning
  454. Note: UseDrivee
  455. Demo.Quit
  456. Plus.Warning
  457.    Display warning message and wait for a key is pressed
  458. Plus.WindInput
  459.  Get user Input in a window defined by (r1, c1, r2, c2).
  460.  Function returns a string. 
  461. -  Play sound for each key stroke?e
  462. -- no sound 
  463. Plus.Alarm
  464.    A replacement of BEEP.r
  465. Demo.GetFileDta
  466.  This demo can be used to get a file name from disk. Stored in FileName or
  467.  rename this routine as a function returns a file name as a string.
  468.  If you wish to use this procedure routine in your program:s
  469.   1.   Make sure pre-requested specifications are included:s
  470.  Intplus.BI, constants declared in IntDemo.BAS main module,  
  471.  etc...s
  472.   2.   Delete Help lines.S
  473.   3.   Following subroutines are needed. Copy\Move them to your program 
  474.  >> Demo.GetFileDta
  475.  --> this routine
  476.  >> Plus.Window
  477.  --> draw windows
  478.  >> Plus.Warning
  479.      --> display warning message
  480.  >> Plus.SelectWindow
  481.  --> select items from window
  482.  >> Routines in INTPLUS.BAS 
  483.   4.   Rename subroutines or make any adjustments needed.o
  484.   5.   Change variable values as needed:
  485.  MaxFile, FilLen, Window variables, etc.
  486.   6.   Make bigger changes only after you have got it running in your program.
  487. - initialize data 
  488. Maxmum file can get, changed it if neededm
  489. File name length = 13c
  490. Special attrib for drive
  491. -- Window location used by Plus.SelectWindow
  492. -- location to display selected path\file item
  493. - Arrays\other inits
  494. hold file namesN
  495. hold attribs
  496. -- get default drive
  497.    make legal drive name.
  498. --- Get Total drives availible
  499.  fill them into the filelist.t
  500.  These drive entries will 
  501.  always exist in FileList()e
  502.  and Attrib().
  503. - Help lines 
  504. -- Display help screen
  505. -- Display second help screeng
  506. How it worksd
  507. -- check drive door,
  508. -Main  procedure 
  509. - loop get file names and  store them in FileList()L
  510. - Get DTAt
  511. - Exit when Error occors or no more file can be stored
  512. - Increament file counts
  513. - Store FileName. Other file informations like
  514.  Date, time, etc also can be stored. See FileDta
  515.  for specificaitions. 
  516. - Store file attrib seperatly, Used later to determine if
  517.  selected file is actual a directory.S
  518. -- a path name, format it with a "\"
  519. -- A label, Get Lable$
  520. -- Decreace file count by 1, so it wont appear in FileList(),r
  521. -Display Path window 
  522. -- Note:  If lable is found previously, it is printed with help msg.
  523. - get directory informationn
  524. -- print directory information
  525. - Select file 
  526. - Examine selected filey
  527. --- it's a path name then change path 
  528. --- special coded, it's a drive, change drive 
  529. --- A real file name is found, then quit
  530. - Initialize these variables, and start again.
  531. - Make a complete file name
  532. - Simply print this file name. If you modify this procedure to
  533.  a function returns selected file name as a string, FileName$o
  534.  is what should be returned.
  535. Plus.SelectWindow
  536.    Returns a item number selected by user in a window.
  537.    CALL:
  538.  Plus.Window
  539.    UpDate:  5/21/91
  540.    Comments:Window  is specified by (r1,c1)-(r2,c2);
  541.  Items() is array of strings displayed in a window;
  542.  is maximum items in the array
  543.  Up/Down or PgUp/PgDown search are allowed; 
  544.  <esc> returns 0 or no item is selected;
  545.  <enter> returns selected item as a array index number
  546. -- more data indicaters
  547. -- displayed at frame;
  548. -- no more data indicater
  549. clear  window
  550. Plus.Filter
  551. Plus.ErrDrive
  552.  Check if a given drive is available
  553. Error using drive 
  554.