3158: b0 40 08 20 mov #8200, 0xf2a4 ;#SPI1_CR, PC rel. 0x02402
315c: a4 f2
;set SCG1 = 1
- 315e: 32 d0 80 00 bis #128,sr ;#0x0080
+; 315e: 32 d0 80 00 bis #128,sr ;#0x0080
; FIXME: ^^^ BUG ^^^ BUG ^^^ BUG ^^^ BUG ^^^ BUG ^^^ BUG ^^^
; *** IN FABBED CHIP: ***
; this makes SCG[1:0] = 10b
; b) Couple the LFXTAL to the PI pin weakly to drive enough to switch.
; May not be fast enough for UART0 baud rate-setting code operation.
; c) ???
+;
+; BUGFIX SOLUTION:
+; leave sr unchanged, and not touch SCG[1:0] bits
+; bis instruction is logical OR, just OR with zero and move on
+ 315e: 32 d0 00 00 bis #128,sr ;#0x0000
Assembly_Code:
3162: b2 40 8e 34 mov #UART_ISR, &0xffea ;#0x348e
; PA(5) - RXD0
31da: b2 40 3e 00 mov #62, &PAPER ;#0x003e
31de: 0c 1a
- 31e0: b0 12 76 31 call #0x3176
+; 31e0: b0 12 76 31 call #0x3176
; FIXME: ^^^ BUG ^^^ BUG ^^^ BUG ^^^ BUG ^^^ BUG ^^^ BUG ^^^
; *** IN FABBED CHIP: ***
; The call to #0x3176 should be init() or #0x3172.
; As-is, this jumps into the middle of a 3-word instruction within init().
; -> Death by foot-shooting.
+;
+; BUGFIX SOLUTION:
+; properly call main() by using the correct address, 0x3172
+ 31e0: b0 12 72 31 call #0x3172
;setup SPI0
; SPI_En = 1