[Coco] dwwrite suggestion

Robert Gault robert.gault at att.net
Wed Dec 25 13:40:59 EST 2013


Someone recently posted a problem with dwwrite and the random loss of bits under 
certain conditions. I lost the message so don't know who that was.

Well I've been seeing intermittent problems that might have been caused by the 
above so looked at the code.

This for "57600 (115200) bps using 6309 native mode".
tx0020    bita      #1                  ; even or odd bit number ?
           beq       tx0040              ; branch if even (15 cycles)
tx0030    nop                           ; extra (16th) cycle
tx0040    stb       -1,u                ; send bit

Why should a positive bit require more time than a zero? In any case, nop is 2 
cycles not 1. This ought to result in random speed and that does not seem right.

Anyway I changed to code to
tx0020    bita      #1                  ; even or odd bit number ?
           beq       tx0040              ; now cycle count is the same
tx0030    equ       *                   ; with or without a branch
tx0040    nop
           stb       -1,u

Actually the bita and beq could be replaced by two more nop with the same cycle 
count.

Well this version of dwwrite works fine on my Coco3 6309 system and at first 
glance seems to have removed some intermittent problems I was seeing. The bita 
#1 test does not seem to be needed.

Robert



More information about the Coco mailing list