changeset 3034:f818de1b815a

Moved becker routine with timeout to a new driver called BECKERTO and restored original BECKER routine from backup. Reasoning for this is on slower DW servers the return packets may not come back in time and would generate timeouts often. This prevented a few people being able to actually use the becker interface on those slower DW servers.
author David Ladd <drencor-xeen@users.sf.net>
date Sat, 03 Jan 2015 00:02:16 -0600
parents 7028ce216ccf
children 1cef81d100ce
files level1/modules/dwread.asm
diffstat 1 files changed, 52 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/level1/modules/dwread.asm	Tue Dec 23 21:14:58 2014 -0800
+++ b/level1/modules/dwread.asm	Sat Jan 03 00:02:16 2015 -0600
@@ -65,40 +65,71 @@
           puls      cc,dp,x,u,pc        ; restore registers and return
           ELSE
           IFNE BECKER
-* NOTE: becker routine now supports timeout  ...
-DWRead	  clra                  ; clear Carry, Set Z
-	  pshs	 cc,x,u         ; save regs
-          leau   ,x		; U is data buffer
-          ldx    #$0000		; X is reset check sum
+* NOTE: There is no timeout currently on here...
+DWRead    clra                          ; clear Carry (no framing error)
+          deca                          ; clear Z flag, A = timeout msb ($ff)
+          tfr       cc,b
+          pshs      u,x,dp,b,a          ; preserve registers, push timeout msb
+          leau   ,x
+          ldx    #$0000
           IFEQ   NOINTMASK
-          orcc   #IntMasks	; turn off interrupts
+          orcc   #IntMasks
           ENDC
-ini@      pshs	 x		; save X
-	  ldx	 #0x8000	; X = timeout
-loop@     ldb    $FF41		; test for data ready flag
+loop@     ldb    $FF41
           bitb   #$02
-          bne    rdy@		; byte is ready
-	  leax	 -1,x		; bump timout
-	  bne    loop@          ; not timed out, try again
+          beq    loop@
+          ldb    $FF42
+          stb    ,u+
+          abx
+          leay   ,-y
+          bne    loop@
+          tfr    x,y
+          ldb    #0
+          lda    #3
+          leas      1,s                 ; remove timeout msb from stack
+          inca                          ; A = status to be returned in C and Z
+          ora       ,s                  ; place status information into the..
+          sta       ,s                  ; ..C and Z bits of the preserved CC
+          leay      ,x                  ; return checksum in Y
+          puls      cc,dp,x,u,pc        ; restore registers and return
+          ELSE
+          IFNE BECKERTO
+* NOTE: There is now timeout ...
+DWRead    clra                  ; clear Carry, Set Z
+          pshs   cc,x,u         ; save regs
+          leau   ,x             ; U is data buffer
+          ldx    #$0000         ; X is reset check sum
+          IFEQ   NOINTMASK
+          orcc   #IntMasks      ; turn off interrupts
+          ENDC
+ini@      pshs   x              ; save X
+          ldx    #0x8000        ; X = timeout
+loop@     ldb    $FF41          ; test for data ready flag
+          bitb   #$02
+          bne    rdy@           ; byte is ready
+          leax   -1,x           ; bump timout
+          bne    loop@          ; not timed out, try again
         ;; timed out!
-	  puls	 x              ; remove timeout off stack
-	  puls   cc		; pull CC
-	  comb                  ; reset Z (timeout error)
-	  puls	 x,u,pc	        ; restore registers and return
-	;; a byte is ready
-rdy@      puls	 x		; restore X
+          puls   x              ; remove timeout off stack
+          puls   cc             ; pull CC
+          comb                  ; reset Z (timeout error)
+          puls   x,u,pc         ; restore registers and return
+        ;; a byte is ready
+rdy@      puls   x              ; restore X
           ldb    $FF42          ; get byte from port
           stb    ,u+            ; store in data buffer
           abx                   ; add received byte to checksum
           leay   ,-y            ; decrement byte counter
           bne    ini@           ; go get another byte if not done
-	;; done reading bytes return
-          tfr    x,y		; put checksum in y
+        ;; done reading bytes return
+          tfr    x,y            ; put checksum in y
           puls   cc,x,u,pc      ; restore registers and return
+
+          ENDC
           ENDC
           ENDC
 
-          IFEQ BECKER+JMCPBCK+ARDUINO
+          IFEQ BECKER+JMCPBCK+ARDUINO+BECKERTO
           IFNE BAUD38400
 *******************************************************
 * 38400 bps using 6809 code and timimg