Close

MIKBUG S-Record Load Dropping Characters

A project log for MIKBUG on Multicomp

MIKBUG Running on Multicomp with 6800 CPU

land-boardscomland-boards.com 06/28/2020 at 13:300 Comments

MIKBUG is dropping a character during s-record-loads. Dropped baud rate from 115,200 to 9600 and it still drops character. RTS is not being de-asserted even when changing RTS buffer assertion levels so I don't think it's an overrun. I have seen RTS deassert on larger transfers. 

Trace is using DS Logic Plus on Tx, Rx, RTS_N lines.

Load works OK at 2400 baud. Strange behavior.

6800 S-Record Load Assembly Code

S1STRING    FCC    "This S1 load has entered system scratch area"
        FCB    $0D,$0A,$04
; DGG - S Record loader
SLOAD        EQU     *
        PSHA                ; Save A register
        STX    TEMPX1       ; Save X register
        ; DGG - Next line was BSR but fixing the CPX VAR lines made it too far away
GOAGAIN JSR    GETCHAR      ; Get first character from ACIA
        ;  Wait for an S
        CMPA   #$53         ; Is it "S"
        BNE    GOAGAIN      ; If not go read again
        BSR    GETCHAR      ; Get second character in frame
        CMPA   #$39         ; Is it "9"
        BEQ    RECOVER      ; If "9" go and end read
        CMPA   #$31         ; Is it a "1"
        BNE    GOAGAIN      ; If no then go start again
        CLR    TEMPA        ; Clear Frame length
        BSR    GETHEX       ; Get frame length from input stream
        SUBA   #$02         ; Subtract the checksum
        STAA   BYTESTORE    ; Save frame length
        BSR    GETADD       ; Read next two bytes for dest address
GETCOUNT BSR   GETHEX       ; Get the byte number
        DEC    BYTESTORE    ; decrement counter
        BEQ    INCOUNT      ; If zero go to increment byte count
        STAA   0,X          ; Store read byte into memory
        CMPA   0,X          ; Test if RAM OK
        BNE    QUESTION     ; If write failed send Question and abort
        INX                 ; Increment address pointer
; DGG - CPX was CMPX which did not compile and was commented out
; DGG- Changed branch from BGE to BLE (I think the compare worked the other way)
        CPX    VAR          ; Is it the system scratch area
        BLE    S1EXIT       ; Abort if close to system scratch
        BRA    GETCOUNT     ; go get another byte
;
S1EXIT  LDX    #S1STRING    ; Protect System Scratch Abort S1
        BSR    OUTSTR       ; Print abort string
        BRA    RECOVER      ; Back to console prompt
;
INCOUNT INC    TEMPA        ; Increment tempa 
        BEQ    GOAGAIN      ; If zero go for another frame
QUESTION LDAA  #$3F         ; Load question mark
        JSR    OUTPUTA      ; Send to console
RECOVER LDX    TEMPX1       ; Restore "X"
        PULA                ; Restore A
        JMP    CONTRL       ; Jump to exit
; 
;
GETADD  BSR    GETHEX       ; Read in byte
        STAA   ADDRESS      ; store in first part of address
        BSR    GETHEX       ; Get another byte of data
        STAA   ADDRESS1     ; store in second address register
        LDX    ADDRESS      ; Load X register both bytes of address
        RTS                 ; Return from sub routine
;
;    ADD IN THE ADDRESS OFFSET
;
GETHEX  BSR    CONVHEX  ; Go get byte of data and convert to binary 
        ASLA            ; Shift the the 4 bits into msb
        ASLA            ; Shift the the 4 bits into msb    
        ASLA            ; Shift the the 4 bits into msb    
        ASLA            ; Shift the the 4 bits into msb    
        TAB             ; Transfer "A" to "B"
        BSR    CONVHEX  ; Go get byte of data and convert to binary
        ABA             ; Add 4 bits in "A" and "B" into "B"
        TAB             ; Transfer "A" to "B"
        ADDB   TEMPA    ; Add into checksum
        STAB   TEMPA    ; Add into checksum
        RTS             ; Return from sub routine
;     
CONVHEX JSR    GETCHAR  ; Get HEX character from ACIA
        SUBA   #$30     ; Convert to binary
        BMI    QUESTION ; Convert to binary
        CMPA   #$09     ; Convert to binary
        BLE    RETURN2  ; Convert to binary
        CMPA   #$11     ; Convert to binary
        BMI    INCSTACK ; Convert to binary
        CMPA   #$16     ; Convert to binary
        BGT    INCSTACK ; Convert to binary
        SUBA   #$07     ; Convert to binary
RETURN2 RTS             ; Return from sub routine

Solution

Shut off the echo using "N" command and it works even at 115,200 baud.

Type "O" to turn on after transfer.

Need to turn off echo if using built-in INEEE routine from programs you write otherwise characters will be echoed. Alternately could Set/Clear ECHO flag. Might want to save ECHO flag.

0xf1f3  INEEE

0xf20a  OUTEEE

Discussions