two bugfixes directly to dis-assembled, annotated ROM
authorDan White <dan@whiteaudio.com>
Thu, 25 Apr 2013 21:02:03 +0000 (16:02 -0500)
committerDan White <dan@whiteaudio.com>
Thu, 25 Apr 2013 21:02:03 +0000 (16:02 -0500)
rom-bugfix.asm

index e23e554a994796211ba8d85c4e8a8e6a46ae876a..e87c68bba2e19968692f1b4b5a2356a8470d7ffd 100644 (file)
@@ -357,7 +357,7 @@ gotoMain:
     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
@@ -374,6 +374,11 @@ gotoMain:
 ;  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
@@ -448,12 +453,16 @@ main:
 ; 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