diff --git a/src/6502/ch395_read_recv_buf_sn.s b/src/6502/ch395_read_recv_buf_sn.s index bbfc879..15edb79 100644 --- a/src/6502/ch395_read_recv_buf_sn.s +++ b/src/6502/ch395_read_recv_buf_sn.s @@ -26,33 +26,25 @@ ldy #$00 + ldx #$00 @loop2: lda CH395_DATA_PORT ; set ptr2 sta (RES),y - iny - cpy RESB bne @loop2 - tya - clc - adc RES - bcc @S1 - inc RES+1 - -@S1: - sta RES - + inx + cpx RESB+1 + bne @loop2 @decrement: - ldx RESB ldy #$00 @L1: lda CH395_DATA_PORT sta (RES),y iny - dex - bpl @L1 + cpy RESB + bne @L1 rts .endproc diff --git a/src/6502/ch395_write_send_buf_sn.s b/src/6502/ch395_write_send_buf_sn.s index ea8d073..bc7fa8a 100644 --- a/src/6502/ch395_write_send_buf_sn.s +++ b/src/6502/ch395_write_send_buf_sn.s @@ -36,30 +36,32 @@ entry_point_c: stx CH395_DATA_PORT ; set length high - ldx RESB+1 - beq @decrement + ldx RESB+1 ; High byte equal to 0 ? + beq @decrement ; Yes only dec Low byte @restart: + ldx #$00 ldy #$00 @loop: lda (RES),y sta CH395_DATA_PORT iny - cpy RESB + bne @loop + inx + cpx RESB+1 bne @loop @decrement: - ldx RESB ldy #$00 @L1: lda (RES),y sta CH395_DATA_PORT iny - dex - bpl @L1 + cpy RESB + bne @L1 @exit: rts