--- podex-orig.s Wed Sep 28 17:42:12 2005 +++ podex.s Sun Feb 11 23:42:05 2007 @@ -16,6 +16,12 @@ ;; ;; Kevin Ross' BDM12 v4.7 compatible protocol ;; + ;; [2005.09.28] Michal Konieczny + ;; - corrected address increment errors in MEMDUMP and MEMPUT + ;; + ;; [2007.02.11] Michal Konieczny + ;; - default crystal is 14.7456MHz, for ATTiny2313 + ;; - changed endianness of parameter for setting extended speed .file "podex.s" .arch at90s2313 @@ -27,13 +33,14 @@ ;; +------------------------+ ;; | XTAL | A | B | ;; |---------+------+-------| + ;; | 14.7456 | 72 | 3125 | ;; | 11.0592 | 54 | 3125 | ;; | 9.2160 | 9 | 625 | ;; | 7.3728 | 36 | 3125 | ;; +------------------------+ ;; -.equ POD_XTAL640_A, 9 ; POD_XTAL640_A/POD_XTAL640_B = f_pod/(640MHz) -.equ POD_XTAL640_B, 625 ; (for precise computation of ExtendedSpeed spec. in v.4.7) +.equ POD_XTAL640_A, 72 ; POD_XTAL640_A/POD_XTAL640_B = f_pod/(640MHz) +.equ POD_XTAL640_B, 3125 ; (for precise computation of ExtendedSpeed spec. in v.4.7) ;; .equ BAUD_RATE, 115200 .equ UBRR_DENOM, POD_XTAL640_B*BAUD_RATE @@ -504,8 +511,10 @@ ldi r16,READ_WORD rcall hw_read_cmd ; read mem(wAddress) rcall pod_tx_word ; send to PC - add r21,1 ; wAddress++ - adc r20,0 + ldi r25,2 + ldi r24,0 + add r21,r25 ; wAddress += 2 + adc r20,r24 subi r19,1 brsh pod_ext_03_lp subi r18,1 @@ -573,8 +582,10 @@ rcall pod_rx mov r23,r17 ; get word to r22:r23 rcall hw_write_cmd ; write to mem(wAddress) - add r21,1 ; wAddress++ - adc r20,0 + ldi r25,2 + ldi r24,0 + add r21,r25 ; wAddress += 2 + adc r20,r24 subi r19,1 ; decrement wCount-er brsh pod_ext_06_lp subi r18,1 @@ -587,8 +598,8 @@ brne ext_unknown_cmd rcall pod_rx ; bEClockScalar -- ignore, compute everything from w128EClocks rcall pod_rx_word ; w128EClocks - sts XSPEED_LO,r20 ; #################?!?!?!?#### - sts XSPEED_HI,r21 ; #########ENDIAN?!########### + sts XSPEED_LO,r21 ; big endian + sts XSPEED_HI,r20 ; but not really sure lds r17,SPEED ; is ExtendedSpeed currently in use? cp r17,BDM12SPEED_X brne pod_ext_07_0