home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_03 / C_JS_108.ZIP / COMS / IO_ST.S < prev   
Text File  |  1995-08-19  |  1KB  |  36 lines

  1. *---------------------------------------------------------------------
  2. * Example code on how to send and recive a Byte (8 bits) on the ATARI
  3. * ST side.
  4. *---------------------------------------------------------------------
  5.  
  6. *---------------------------------------------------------------------
  7. * Byte to be sent is in D0.W
  8. *---------------------------------------------------------------------
  9. send_byte
  10.     move.l    #$fb0000,a0        * Base
  11.     lsl.w    #1,d0            * Shift because cartport don't
  12.                     * have a A0 adress line.
  13.     move.w    d0,a1            * Move...
  14. loop
  15.     move.w    $fa0002,d0        * Status register.
  16.     btst    #1,d0            * If '1' there is already a
  17.                     * byte waiting in buffer not
  18.                     * read by the Jaguar.
  19.     bne    loop
  20.     move.w    0(a0,a1.w),d0        * Buffer clear. Send byte by
  21.                     * reading! Trash in d0.
  22.     rts
  23.  
  24. *---------------------------------------------------------------------
  25. *---------------------------------------------------------------------
  26. *---------------------------------------------------------------------
  27. get_byte                
  28.     move.w    $fa0002,d0        * Status register load.
  29.     btst    #0,d0            * If '0' there are NO new byte
  30.                     * to be read.
  31.     beq    get_byte
  32.     move.w    $fa0000,d0        * Buffer loaded! Move
  33.                     * incoming byte to d0.
  34.     and.w    #$ff,d0            * Mask off trash from d0.
  35.     rts
  36.