2534
|
1 *******************************************************
|
|
2 *
|
|
3 * DWRdMess
|
|
4 * Receive a response from the DriveWire server via MESS FIFO
|
|
5 * 4/27/10 AAW - Based on John Linville's example driver
|
|
6 *
|
|
7 * Entry:
|
|
8 * X = starting address where data is to be stored
|
|
9 * Y = number of bytes expected
|
|
10 *
|
|
11 * Exit:
|
|
12 * CC = carry set on framing error, Z set if all bytes received
|
|
13 * X = starting address of data received
|
|
14 * Y = checksum
|
|
15 * U is preserved. All accumulators are clobbered
|
|
16 *
|
|
17
|
|
18 DWRead clra ; clear Carry (no framing error)
|
|
19 pshs u,x,cc ; preserve registers, push timeout msb
|
|
20 orcc #$50 ; mask interrupts
|
|
21
|
|
22 leau ,x ; U = storage ptr
|
|
23 ldx #0 ; initialize checksum
|
|
24
|
|
25 * Read a byte
|
|
26 rxByte ldb $ffe1 ; check for data in FIFO
|
|
27 beq rxByte ; loop while empty
|
|
28 ldb $ffe0 ; read data value
|
|
29
|
|
30 stb ,u+ ; store received byte to memory
|
|
31 abx ; update checksum
|
|
32 leay ,-y ; decrement request count
|
|
33 bne rxByte ; loop if another byte wanted
|
|
34
|
|
35
|
|
36 * Clean up, set status and return
|
|
37 rxExit leay ,x ; return checksum in Y
|
|
38 puls cc,x,u,pc ; restore registers and return
|
|
39 setdp $00
|
|
40
|
|
41
|