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:
19
sw/spi.s
19
sw/spi.s
@@ -26,24 +26,9 @@ _spi_write_byte:
|
|||||||
adc #$01
|
adc #$01
|
||||||
sta BB_SPI_BASE ; Write clock
|
sta BB_SPI_BASE ; Write clock
|
||||||
txa
|
txa
|
||||||
lsr ; Select net bit
|
lsr ; Select next bit
|
||||||
|
tax
|
||||||
bne @loop ; Stop when mask is 0
|
bne @loop ; Stop when mask is 0
|
||||||
ply ; Restore regs
|
ply ; Restore regs
|
||||||
plx
|
plx
|
||||||
rts ; Return
|
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user