-
- lea 0xa10005,a1
- move.l (transfer_addr,pc),a0
- move.l (transfer_len,pc),d2
-
- move.l (transfer_mode,pc),d0
- tst.l d0
- bne transfer_recv
-
-transfer_send:
- move.b #0x4f,(0xa1000b).l
-
-tr_send_loop:
- move.b (a0),d1
- and.b #0x0f,d1
-
-wait_tl_low1:
- move.b (a1),d0
- btst.b #4,d0
- bne wait_tl_low1
-
- move.b d1,(a1) /* clears TH and writes data */
-
- move.b (a0)+,d1
- lsr.b #4,d1
- bset.b #6,d1 /* prepare TH */
-
-wait_tl_hi1:
- move.b (a1),d0
- btst.b #4,d0
- beq wait_tl_hi1
-
- move.b d1,(a1)
- subq.l #1,d2
- bne tr_send_loop
-
- move.b #0,(0xa1000b).l
- bra return_to_main
-
-transfer_recv:
- move.b #0,(a1) /* clear TH */
-
-tr_recv_loop:
-wait_tl_low2:
- move.b (a1),d0
- btst.b #4,d0
- bne wait_tl_low2
-
- move.b #0x40,(a1) /* set TH */
- move.b d0,d1
- and.b #0x0f,d1
-
-wait_tl_hi2:
- move.b (a1),d0
- btst.b #4,d0
- beq wait_tl_hi2
-
- move.b #0,(a1) /* clear TH */
- lsl.b #4,d0
- or.b d0,d1
- move.b d1,(a0)+
-
- subq.l #1,d2
- bne tr_recv_loop
-
- move.b #0,(0xa1000b).l