home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / C128CPM / SGTOOL16.ARC / LIBC128.ARC / VDCIO.AS < prev    next >
Encoding:
Text File  |  1994-02-27  |  1.3 KB  |  49 lines

  1. ;SG C Tools 1.6
  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. ;get vdc register
  9.  
  10. global  _invdc, _outvdc
  11. psect   text
  12.  
  13. _invdc:
  14.         pop     de              ;return address
  15.         pop     hl              ;vdc register to set
  16.         push    hl
  17.         push    de
  18.         ld      a,l
  19.         ld      bc,0d600h       ;vdc status port
  20.         out     (c),a           ;set reg to read
  21. 1:
  22.         in      a,(c)           ;repeat
  23.         bit     7,a             ;  test bit 7
  24.         jr      z,1b            ;until bit 7 high
  25.         inc     bc              ;vdc data register
  26.         in      l,(c)           ;get data
  27.         ld      h,0
  28.         ret
  29.  
  30. ;set vdc register
  31.  
  32. _outvdc:
  33.         pop     hl              ;return address
  34.         pop     bc              ;vdc register to write
  35.         pop     de              ;data
  36.         push    de
  37.         push    bc
  38.         push    hl
  39.         ld      a,c
  40.         ld      bc,0d600h       ;vdc status port
  41.         out     (c),a           ;set reg to read
  42. 1:
  43.         in      a,(c)           ;repeat
  44.         bit     7,a             ;  test bit 7
  45.         jr      z,1b            ;until bit 7 high
  46.         inc     bc              ;vdc data register
  47.         out     (c),e           ;set data
  48.         ret
  49.