home *** CD-ROM | disk | FTP | other *** search
/ The Technocratic Times 2 / technocratic-times-2.adf / Page12 < prev    next >
Encoding:
Text File  |  1989-01-01  |  2.1 KB  |  63 lines

  1. You can use both assembler and basic to
  2. control the parallellport, but since it
  3. mostly is no need of a high speed, do I
  4. think is most comfortable to use basic,
  5. but  you  maybe  like  the challenge of
  6. asseblerprogramming.  It  is up to you.
  7. Anyway, in  this article will I stay on
  8. basic.  Now  let  us  walk through some
  9. little subroutines in basic:
  10. INIT:                    
  11.       POKE 12571136&,199 
  12.       POKE 12570624&,255  
  13.       POKE 12575489&,0   
  14. RETURN
  15. The  first  POKE  sets  the addressbits
  16. BUSY, POUT and SEL to be outputbits.The
  17. second POKE  selects  address $7, which
  18. lits the READY-LED. The Third POKE sets
  19. the parallellport for input.  After you
  20. have  called  this routine once after a
  21. power-on  can  you start the real work.
  22. Let's go on with reading from parallell
  23. port into the Amiga.
  24. READ:
  25.       POKE 12575489&,0
  26.       POKE 12570624&,248+Address
  27.       InData=PEEK(12574977&)
  28.       POKE 12570624&,255
  29. RETURN
  30.  
  31. The first POKE set the parallellport to
  32. input, with setting all the bits in the
  33. data  direction  register,  located  at
  34. address 12575489 to zero.If you instead
  35. set the bits to high, is the  parallell
  36. port set for output.The databits on the
  37. parallellport  can  also  be  set   for
  38. different directions, since the bits in
  39. the datadirection register  is controls
  40. one  bit  each  on  the  parallellport,
  41. indepentely of each other,but this will
  42. NOT be used in this project.  It is for
  43. example used to get a fast twodirection 
  44. datatalk,  with   a   nibble   in  each
  45. direction. The second POKE in the Read-
  46. routine is  used  to select the address
  47. of the  IC  you want to read from, i.e.
  48. write  to  the adressbits. The variable
  49. "Address" is an integer value between 0
  50. and 7.  The PEEK command reads the data
  51. from the parallellport,which is located
  52. on address 12574977 in your Amiga.  The
  53. last POKE is  used to lit the READY-LED
  54. when the reading is done,  by selecting
  55. address $7 (248+7=255). Now let's go on
  56. with see how to write to the parallell-
  57. port: WRITE:
  58.             POKE 12570624&,248+Address
  59.             POKE 12575489&,255
  60.             POKE 12574977&,OutData
  61.             POKE 12570624&,255
  62.       RETURN
  63.