home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / C128CPM / SGTOOL11.ARC / LIBC128.ARC / VDCIO.AS < prev    next >
Encoding:
Text File  |  1993-07-25  |  1.1 KB  |  52 lines

  1. ;SG C Tools 1.1
  2.  
  3. ;(C) 1993 Steve Goldsmith
  4. ;All Rights Reserved
  5.  
  6. ;Assembled with HI-TECH C 3.09 (CP/M-80) ZAS.
  7.  
  8. ;set vdc reg to read and wait for status bit 7
  9.  
  10. global  _invdc, _outvdc
  11. psect   text
  12.  
  13. _invdc:
  14.         pop     de            ;return address
  15.         pop     hl
  16.         push    hl
  17.         push    de
  18.         ld      a,l
  19.         ld      bc,0d600h
  20.         out     (c),a
  21. 1:
  22.         in      a,(c)
  23.         bit     7,a
  24.         jr      z,1b
  25.         inc     bc
  26.         in      l,(c)
  27.         ld      h,0
  28.         ret
  29.  
  30. ;in-line assembler to set vdc reg to write, wait for status bit 7 and
  31. ;write new value to reg
  32.  
  33. _outvdc:
  34.         pop     hl            ;return address
  35.         pop     bc            ;port address
  36.         pop     de            ;data
  37.         push    de
  38.         push    bc
  39.         push    hl
  40.         ld      a,c
  41.         ld      bc,0d600h
  42.         out     (c),a
  43. 1:
  44.         in      a,(c)
  45.         bit     7,a
  46.         jr      z,1b
  47.         inc     bc
  48.         out     (c),e
  49.         ld      l,e           ;return value in hl also
  50.         ld      h,0
  51.         ret
  52.