home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 6433 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: mail2news.demon.co.uk!gate.demon.co.uk
  2. From: Justin Lane <justin@redalert.demon.co.uk>
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Help with parallel port programming...
  5. Date: Thu, 28 Mar 96 00:35:00 GMT
  6. Organization: Private Node
  7. Message-ID: <9603280035.AA000cs@redalert.demon.co.uk>
  8. References: <4ihu64$1s5@kira.cc.uakron.edu> <31513E38.7885@fs1.ee.man.ac.uk> <4j9sfh$11k0@baggins.cc.flinders.edu.au>
  9. X-NNTP-Posting-Host: gate.demon.co.uk
  10. X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
  11. X-Mail2News-Path: relay-1.mail.demon.net!gate.demon.co.uk
  12.  
  13. Daniel J. O'Connor (doconnor@sybil.ist.flinders.edu.au) wrote:
  14. : Christos Dimitrakakis (mbge4cd1@fs1.ee.man.ac.uk) wrote:
  15. : : You have to configure the parallel port for output before writing
  16. : : and for input before reading, otherwise it will not work.
  17. : : You can set it for input by :
  18. : : First put the address at a register
  19. : : LEA $bfe101,a1
  20. : : set for input:
  21. : : MOVE.b (a1),0
  22. : : set for output
  23. : : MOVE.b (a1),255
  24. : You should ALSO allocate the parallel port resource before playing
  25. : with it, otherwise someones print jobs will stomp all over you...
  26. : I have some code in C as well which does all this stuff :) There is
  27. : also some on aminet you might want to look at...
  28. : Seeya
  29. : Darius
  30. : ~~~~~~
  31. It is probably a good idea to allocate the resource if your code is going to
  32. run with the OS but there is no need to bother if you kill the OS off.
  33. BTW the assembler example looks a bit 8086'ish ie. destination, source
  34. operands.  The example move.b is moving from the contents of the memory 
  35. address pointed at by register a1 to memory location 0 and 255.
  36. The CIA locations appear to be wrong.
  37.  
  38. move.b #%11110000,$bfe301 ; bits 7-4 = output and bits 3-0 = input (DDRB)
  39. move.b $bfe101,D0 ; read contents of parallel port (PRB) regardless of state
  40.                   ; of the Data Direction Register for port B $bfe301
  41. move.b D0,$bfe101 ; write contents of d0 to parallel port (PRB) only bits
  42.                   ; set for output will be set
  43.