home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / asmutl / asmlib1.lbr / PORTSET.AYM / PORTSET.AYM
Encoding:
Text File  |  1994-05-31  |  1.1 KB  |  51 lines

  1. ;----------------------------------------------------------------
  2. ;        This is a module in the ASMLIB library.
  3. ;
  4. ; This module simply takes the pointer in DE as the start of a data
  5. ; table of bytes to be sent to a peripheral I/O device (chip). This
  6. ; code was taken from the CP/M manual for initializing a SIO chip.
  7. ; The table is expected to be in the following format...
  8. ;
  9. ; TABLE:
  10. ;    db    n            ; number of elements / lines /ports
  11. ;    db    num$bytes,port$number,b1,b2,....,bx
  12. ;       "    "    "    "    "    "
  13. ;       db    num$bytesn,port$numbern,b1,b2,....,bx
  14. ;    db    00            ; no bytes = end.
  15. ;
  16. ;        Written        R.C.H.        25/8/83
  17. ;        Last Update    R.C.H.        22/10/83
  18. ;----------------------------------------------------------------
  19. ;
  20.     name      'portset'
  21.     public    portset
  22.     maclib    z80
  23. ;
  24. portset:
  25.     push    psw
  26.     push    b
  27.     push    d        ; Save DE
  28.     xchg
  29. stream$out:
  30.     mov    a,m
  31.     ora    a
  32.     jrz    portend        ; return if no table
  33.     mov    b,a        ; load the number of bytes to send.
  34.     inx    h
  35.     mov    c,m        ; load the port number into C
  36.     inx    h        ; point to data for this port now
  37.     outir
  38.     jr    stream$out
  39. ;
  40. portend:
  41.     xchg            ; Restore HL
  42.     pop    d
  43.     pop    b
  44.     pop    psw
  45.     ret
  46. ;
  47.     end
  48.  
  49.  
  50.  
  51.