view level1/modules/dwrdmess.asm @ 2730:6bd6e348665d

Working on cloned default branch, pulled 2012/11/03 user: gheskett@wdtv.com branch 'default' changed ChangeLog changed ReadMe changed defs/rbf.d changed defs/rbsuper.d changed defs/scsi.d changed level1/atari/cmds/fuji.asm changed level1/coco/modules/makefile changed level1/modules/boot_scsi.asm changed level1/modules/superdesc.asm changed level2/coco3/bootfiles/makefile changed level2/coco3/modules/makefile changed level2/coco3_6309/bootfiles/makefile changed level2/modules/joydrv_6551L.asm changed rules.mak
author gheskett@wdtv.com
date Sat, 10 Nov 2012 11:55:48 -0500
parents c92a6c65bbd9
children c505ae3120c4
line wrap: on
line source

*******************************************************
*
* DWRdMess
*    Receive a response from the DriveWire server via MESS FIFO
*    4/27/10 AAW - Based on John Linville's example driver
*
* Entry:
*    X  = starting address where data is to be stored
*    Y  = number of bytes expected
*
* Exit:
*    CC = carry set on framing error, Z set if all bytes received
*    X  = starting address of data received
*    Y  = checksum
*    U is preserved.  All accumulators are clobbered
*

DWRead    clra                          ; clear Carry (no framing error)
          pshs      u,x,cc              ; preserve registers, push timeout msb
          orcc      #$50                ; mask interrupts
         
         leau      ,x                  ; U = storage ptr
         ldx       #0                  ; initialize checksum

* Read a byte
rxByte   ldb       $ffe1               ; check for data in FIFO
         beq       rxByte              ; loop while empty
         ldb       $ffe0               ; read data value

         stb       ,u+                 ; store received byte to memory
         abx                           ; update checksum
         leay      ,-y                 ; decrement request count
         bne       rxByte              ; loop if another byte wanted
          
          
* Clean up, set status and return
rxExit    leay      ,x                  ; return checksum in Y
          puls      cc,x,u,pc        ; restore registers and return
          setdp     $00