Fix spi bug

Was reading a value from x, shifting it, but then not writing it back.
This caused an infinite loop as it would never move on from the MSB.
This commit is contained in:
Byron Lathi
2022-03-10 11:16:35 -06:00
parent 6f3155cf35
commit ee5271d955

View File

@@ -26,24 +26,9 @@ _spi_write_byte:
adc #$01
sta BB_SPI_BASE ; Write clock
txa
lsr ; Select net bit
lsr ; Select next bit
tax
bne @loop ; Stop when mask is 0
ply ; Restore regs
plx
rts ; Return
and #$01 ; Get first bit
asl
asl
sta BB_SPI_BASE ; write bit without clock
adc #$01
sta BB_SPI_BASE ; write bit with clock
tay
and #$022
ply
plx
rts