home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 153_01 / newslet.216 < prev    next >
Text File  |  1985-03-10  |  9KB  |  187 lines

  1.  
  2.                            PC-SIG #216 
  3.  
  4.      Thi≤ flopp∙ contain≤ ß se⌠ oµ utilit∙ routines¼ batcΦ files¼ ì
  5. anΣ program≤ tha⌠ ╔ wrotσ whilσ learninτ abou⌠ thσ IBM-P├ anΣ thσ ì
  6. "Có programminτ lanquage«  Sincσ thi≤ wa≤ ß learninτ experiencσ ì
  7. fo≥ mσ ╔ wil∞ no⌠ guaranteσ tha⌠ the∙ arσ efficien⌠ o≥ buτ freσ ì
  8. thougΦ ╔ havσ trieΣ ver∙ harΣ t∩ makσ theφ tha⌠ way«    ╔ woulΣ ì
  9. bσ mos⌠ interesteΣ iε an∙ addition≤ o≥ improvement≤ tha⌠ anyonσ ì
  10. migh⌠ makσ t∩ thesσ routines.
  11.  
  12.    Als∩ notσ tha⌠ thesσ routine≤ werσ writteε iε thσ followinτ ì
  13. environment:
  14.  
  15.         IBM-PC        256K        Monochrome screen
  16.         Epson MX-100 parallel printer
  17.         2 Serial ports
  18.         2 DS/SD floppy disk drives
  19.  
  20.      Somσ oµ thesσ routine≤ havσ beeε porteΣ t∩ thσ IBM-P├ azteπ ì
  21. "Có unde≥ Concurren⌠ CP/═ anΣ t∩ ß VA╪ 11/78░ unde≥ VM╙ witΦ ì
  22. minima∞ modifications«  Obviousl∙ thσ DO╙ function≤ anΣ 808╕ ì
  23. assemble≥ routine≤ didn'⌠ por⌠ wel∞ bu⌠ thσ "Có codσ needeΣ ì
  24. almos⌠ n∩ changes.
  25.  
  26.  
  27.                 LEIG╚ CUTHBERTSON
  28.                 1868 S. PERRY WAY
  29.                 DENVER, CO  80219
  30.  
  31.                                 April 1984
  32.     
  33. notes about some of the files on this disk -
  34.  
  35. *.C and *.ASM files
  36.  
  37.      The∙ arσ utilit∙ subroutine≤ writteε iε MICROSOF╘ "C"«  ì
  38. Thesσ utilitie≤ includσ ß men⌡ system¼ curso≥ anΣ screeε contro∞ ì
  39. (usinτ DO╙ o≥ direc⌠ t∩ BIOS)¼ juliaε anΣ gregoriaε date/timσ ì
  40. routines¼ anΣ "Có callablσ assemble≥ routine≤ tha⌠ issuσ BIO╙ ì
  41. interrupts«  NOT┼ - thσ DO╙ curso≥ anΣ screeε contro∞ utilitie≤ ì
  42. requirσ DEVICE=ANSI.SY╙ commanΣ linσ bσ iε thσ CONFIG.SY╙ file«  ì
  43. Thσ BIO╙ curso≥ anΣ screeε control≤ d∩ no⌠ requirσ this.
  44.  
  45.  
  46. communications program (IBMTTY.C)
  47.  
  48.      Thi≤ prograφ i≤ ß termina∞ emulation/communication≤ prograφ ì
  49. writteε iε MICROSOF╘ "C"«  I⌠ i≤ usablσ bu⌠ no⌠ recommendeΣ fo≥ ì
  50. usσ becousσ oµ use≥ unfriendlynes≤ anΣ ß higΦ erro≥ rate«  It≤ ì
  51. maiε reasoε fo≥ inclusioε i≤ a≤ aε examplσ oµ usσ oµ thσ variou≤ ì
  52. utilit∙ subroutine≤ iε thσ \uti∞ subdirectory«  I⌠ als∩ provide≤ ì
  53. aε examplσ oµ direc⌠ contro∞ oµ thσ IB═ seria∞ communication≤ ì
  54. board.
  55. è
  56. Batch files (*.BAT)
  57.  
  58.      Thesσ batcΦ file≤ emulatσ somσ oµ thσ mos⌠ commoε UNI╪ ì
  59. command≤ oε thσ IBM-PC«  Thσ compile≥ anΣ linke≥ batcΦ file≤ arσ ì
  60. se⌠ u≡ fo≥ thσ MICROSOF╘ "Có compile≥ anΣ linker«  T∩ usσ thesσ ì
  61. batcΦ file≤ i⌠ i≤ recommendeΣ t∩ se⌠ u≡ ß PAT╚ commanΣ iε ì
  62. AUTOEXEC.BA╘ t∩ includσ thi≤ subdirector∙ anΣ thσ compile≥ ì
  63. subdirector∙ iε thσ searcΦ path«  
  64.      ex« (A╛ PAT╚ a:\;a:\unix;a:\compiler).
  65.  
  66.  
  67.  
  68.                               **¬ biosio.asφ ***
  69.  
  70. MICROSOF╘ "Có callablσ 808╕ assembl∙ routine≤ tha⌠ interfacσ ì
  71. directl∙ witΦ thσ basiπ I/╧ systeφ (BIOS).
  72.  
  73.  
  74.                              **¬ KEYBOAR─ I/╧ ***
  75. π ╜ keyrd()╗        ReaΣ ß keyboarΣ entr∙ - wai⌠ fo≥ entr∙ iµ onσ no⌠ ready.
  76. iret ╜ keyhit()╗    Seσ iµ therσ i≤ ß characte≥ iε thσ keyboarΣ buffer.
  77. iret = keyshif();   See what the shift key status is.
  78.  
  79.  
  80.                               *** VIDEO I/O ***
  81. biosini(stype);        Initialize screen I/O using the BIOS set mode call
  82. biosset(irow,icol); Set the current cursor position.
  83. iret = biospos();   Return the current cursor postion.
  84. biosup(numlines,trow,tlcol,brow,brcol,fchar);
  85.     ááááááááááááScroll the screen up within a defined window.
  86. biosdwn(numlines,trow,tlcol,brow,brcol,fchar);
  87.     ááááááááááááScroll the screen down within a defined window.
  88. iret=biosrca();    ááááRead the contents of a given screen cell.
  89. bioswca(char,count,att)╗ Writσ ß characte≥ t∩ thσ screeε - witΦ attributes.
  90. bioswc(char,count);áWrite a character to the screen - no attributes.
  91. bioswd(irow,icol);ááWrite a dot in graphics mode.
  92. biostty(c);    ááááWritσ ß characte≥ t∩ thσ screeε usinτ thσ BIO╙ asciΘ ì
  93. ááááááááááááááááááááteletypσ call«  Thσ teletypσ cal∞ wil∞ senΣ cr/lµ iµ ì
  94. áááááááááááááááááááácolumε 7╣ i≤ writteε t∩ (0-79)«  I⌠ wil∞ scrol∞ thσ screeε ì
  95. ááááááááááááááááááááu≡ iµ ro≈ 2┤ (0-24⌐ columε 7╣ i≤ writteε to«  I⌠ wil∞ als∩ ì
  96. áááááááááááááááááááábee≡ thσ bel∞ iµ ^τ i≤ receiveΣ anΣ providσ ß destructivσ ì
  97. áááááááááááááááááááábackspace.
  98. iret = bioscur();áááReturn the current video state of the screen.
  99.  
  100.  
  101.                          *** communications port ***
  102. iret = comini(port,params);   Initialize the communications port.
  103. iret = comout(port,c);   Write a character to the communications port.
  104.  
  105. c = comin(port);ááááReaΣ ß characte≥ froφ thσ communication≤ port«  Wait≤ fo≥ ì
  106. áááááááááááááááááááácharacte≥ iµ onσ i≤ no⌠ ready«  Seσ \comm\ibmtty.π fo≥ ì
  107. ááááááááááááááááááááexamplσ oµ pollinτ comφ por⌠ fo≥ characte≥ withou⌠ wait.
  108. iret = comstat(port)╗    Checδ thσ linσ anΣ modeφ status
  109. è
  110.             *** io.asm ***
  111.      IBM-P├ 808╕ assembl∙ fo≥ interfacσ witΦ microsof⌠ "Có unde≥ ì
  112. PC-DO╙ "Có callablσ subroutine≤ tha⌠ providσ absolutσ pointe≥ ì
  113. addressing«  Pointer≤ withiε ß IBM-P├ microsof⌠ "Có prograφ arσ ì
  114. relativσ t∩ thσ star⌠ oµ thσ program≤ datß segment«  Thesσ ì
  115. subroutine≤ providσ ß mechanisφ t∩ addres≤ absolutσ memor∙ ì
  116. locations«  SupplieΣ b∙ microsof⌠ - commenteΣ b∙ L« Cuthbertson¼ ì
  117. Apri∞ 1984
  118.  
  119. c = readabs(loc);   Read an absolute memory location.
  120. writeabs(loc,c);    Write an absolute memory location.
  121.  
  122.  
  123. scontrol.Φ     Heade≥ filσ useΣ b∙ thσ screeε anΣ keyboarΣ contro∞ librar∙ ì
  124. ááááátha⌠ define≤ thσ variou≤ commands«  Thσ extendeΣ screeε anΣ keyboarΣ ì
  125. ááááádevicσ drive≥ mus⌠ bσ configureΣ int∩ DO╙ beforσ thesσ command≤ wil∞ ì
  126. áááááwork«                                                        */
  127.  
  128. curup.c        Moves the cursor up y relative lines.
  129. curdown.π      Movσs thσ curso≥ dowε ∙ relativσ lines«ì
  130. curfor.c       Moves the cursor forward x relative columns.
  131. curback.π      Movσs thσ curso≥ backwarΣ ° relativσ columns«
  132. cursor.π       Movσs thσ curso≥ t∩ ß specifiπ r,π co-ordinate«
  133. reads.π        Read≤ ß strinτ froφ stdin«  Return≤ thσ numbe≥ oµ character≤ ì
  134. áááááentereΣ includinτ thσ NUL╠ byte« 
  135. readc.π        Read≤ ß characte≥ t∩ thσ screeε usinτ ß DO╙ function«  
  136. writec.π       Write≤ ß characte≥ t∩ thσ screeε usinτ ß DO╙ function« 
  137. writes.π       Writσs ß strinτ t∩ stdout«
  138. eline.c        Erases a line of the screen.
  139. ááááá               0 = Erase from cursor to end of line.
  140. ááááá               1 = Erase from start of screen to cursor.
  141. ááááá               2 = Erase entire line containing cursor.
  142. scrinit.π      Initialize≤ thσ screeε anΣ keyboarΣ contro∞ arrays«  Currentl∙ ì
  143. ááááái≤ onl∙ ß dumm∙ functioε gettinτ it≤ informatioε froφ ß heade≥ filσ ì
  144. ááááá(scontrol.h).
  145. scratt.π       Turn≤ oε anΣ ofµ iε ß togglσ switcΦ manne≥ variou≤ screeε ì
  146. áááááattribute≤ sucΦ a≤ BOLD¼ blink¼ reversσ video¼ etc«  ì
  147. frame.π        Draw≤ ß bo° giveε thσ uppe≥ lef⌠ corne≥ anΣ thσ lowe≥ righ⌠ ì
  148. ááááácorner«  Use≤ thσ extendeΣ characte≥ se⌠ - graphic≤ boarΣ no⌠ needed«  ì
  149. áááááUse≤ direc⌠ BIO╙ calls«  ì
  150. getline.π      Read≤ ß recorΣ froφ ß filσ int∩ ß string«  Return≤ thσ lengtΦ ì
  151. áááááoµ thσ strinτ includinτ thσ NULL¼ aε EO╞ iµ EO╞ i≤ reached¼ o≥ ß -▒ iµ aε ì
  152. áááááerro≥ occured.
  153.  
  154.  
  155. dosdate.asφ    Microsof⌠ "Có callablσ 808╕ assembl∙ routinσ tha⌠ use≤ ß DO╙ ì
  156. áááááfunctioε cal∞ t∩ obtaiε anΣ returε thσ month¼ day¼ anΣ yea≥ a≤ integers.
  157. jtog.π         Convert≤ ß juliaε datσ (▒ ╜ 1s⌠ da∙ AD⌐ int∩ ß gregoriaε datσ ì
  158. áááááiε thσ forma⌠ mm/dd/yy«  
  159. jtoj.π         Return≤ thσ juliaε datσ (▒ ╜ 1s⌠ da∙ AD⌐ associateΣ witΦ thσ ì
  160. ááááájuliaε datσ iε thσ forφ (yddd)«  
  161. gtoj.π         Return≤ thσ juliaε datσ (▒ ╜ 1s⌠ da∙ AD⌐ associateΣ witΦ ß ì
  162. ááááágregoriaε datσ iε thσ forφ mm/dd/yy«  
  163. weekday.π      Determine≤ thσ da∙ oµ thσ weeδ ß giveε gregoriaε datσ fall≤ on« ìècvtdate.π      Check≤ anΣ convert≤ ß "packedó gregoriaε datσ (1/1/83⌐ int∩ it≤ ì
  164. ááááá"expandedó forφ (01/01/83)«  ì
  165.  
  166.  
  167. ibmtty.π       Termina∞ emulatioε prograφ witΦ filσ uploaΣ anΣ downloaΣ ì
  168. ááááácapabilities«  OptimizeΣ t∩ communicatσ witΦ ß DE├ VA╪ 11/780«
  169.  
  170.  
  171. mencon.π       Open≤ ß men⌡ filσ anΣ displa∙ i⌠ oε thσ screen«  Return≤ thσ ì
  172. ááááánumbe≥ oµ entr∙ field≤ founΣ oε thσ men⌡ (nfield⌐ o≥ -▒ iµ aε erro≥ ì
  173. áááááoccured«  Place≤ thσ r,π coordinate≤ oµ thσ entr∙ field≤ withiε thσ ì
  174. ááááágloball∙ declareΣ rπ array.
  175. ááááá     T∩ builΣ ß menu¼ usσ thσ tex⌠ edito≥ t∩ creatσ ß filσ calleΣ ì
  176. áááááxxxx.mn⌡   Thi≤ filσ contain≤ thσ men⌡ tes⌠ a≤ i⌠ shoulΣ appea≥ oε thσ ì
  177. áááááscreen«  Thσ screeε i≤ no⌠ automaticall∙ eraseΣ wheε menu≤ arσ displayeΣ ì
  178. ááááát∩ allo≈ fo≥ overlaying«  CommanΣ line≤ contro∞ thσ variou≤ displa∙ ì
  179. áááááparameters«  Seσ \comm\comm.mn⌡ fo≥ ß men⌡ tex⌠ examplσ anΣ ì
  180. ááááá\comm\ibmtty.π fo≥ ß men⌡ cal∞ example«  
  181. chosit.π       Display≤ ß menu¼ promp⌠ fo≥ ß response¼ anΣ validate«  Call≤ ì
  182. áááááfunctioε mencoε t∩ displa∙ thσ menu«  ì
  183.  
  184. pause.π        Cause≤ ß prograφ t∩ appea≥ t∩ pausσ fo≥ ß giveε perioΣ oµ time«  ì
  185. áááááUse≤ thσ systeφ clocδ fo≥ timing«  Accuratσ t∩ 1/100'≤ oµ ß second.
  186.  
  187.