home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / asmutl / asmlib2.lbr / PORT.AYM / PORT.AYM
Encoding:
Text File  |  1994-05-31  |  896 b   |  46 lines

  1. ;----------------------------------------------------------------
  2. ; This is a module for PL/I-80 
  3. ;
  4. ; This module allows you to read and write directly to
  5. ; system ports.
  6. ;
  7. ; INPUT from a port.
  8. ;
  9. ; EXAMPLE:
  10. ; temp = portin('88'b4);    /* read a port, temp bit(8) */
  11. ;
  12. ;----------------------------------------------------------------
  13. ;
  14.     name    'port'
  15.     public    portin,portout
  16.     extrn    getp1
  17. ;
  18.     maclib    z80
  19. ;
  20. portin:
  21.     call    getp1
  22.     mov    c,e            ; load port number from E
  23.     inp    a
  24.     mov    h,a            ; copy to H, top bits
  25.     ret
  26. ;
  27. ;----------------------------------------------------------------
  28. ; Output to a port
  29. ; EXAMPLE:
  30. ;  call portout('88'b4,'55'b4);        /* send a 'U' to port 88 h */
  31. ;
  32. ;----------------------------------------------------------------
  33. ;
  34. portout:
  35.     call    getp1            ; port number
  36.     mov    c,e
  37. ; get value now
  38.     mov    a,m            ; Get data
  39.     outp    a
  40.     ret
  41.  
  42.     end
  43.  
  44.  
  45.