Vassili wrote: >Dear Myke >For such a conversion I use look-up table. The problems with a table look up method is that it takes a minimum of 14 cycles to do the conversion and you are looking at 23 instructions (without regards to PCLATH or other page bits), this is compared to my method that takes 12 cycles and 12 Instructions. I am assuming the code would be: movf/swapf TMP, w ; Get the High/Low Nybble andlw 0x00F ; Isolate for the Table call HextoASCII ; Call the Table With HextoASCII being an "addwf PCL"/"retlw '0'"/"retlw '1'"/... Or is there a better way of doing this? >This allows you to assign any >symbols to any digits with no restrictions. For reverse conversion I use >the folloving procedure: it takes only 4 instructions (save MOVWF TMP) > >CATH ; Procedure converts ASCII Value to >HEX Digits > movwf TMP > btfsc TMP,5 ; Check if TMP=A..F > goto RM ; If not then go to mask and return > addlw D'9' ; Here is magic conversion >RM andlw H'0F' ; MASK > return I like this algorithm, but I'm curious to understand why you don't write it as: movwf TMP btfss TMP, 5 ; Skip Over if 0x030 - 0x03F addlw 9 ; Convert the lower byte to valid Hex andlw 0x00F return This would save you one cycle/instruction, or am I missing something here? In any case, it's a great algorithm (and definitely going into my "snippet" folder). >PS: recently bought your book. Have some notes. If you are interested in >critics let me know. I then will send my notes to you privately. Sure, I'm interested in what I can do better next time. myke Opus: There's a 465 pound woman pruning her azelias while wearing a pink stretch bodysuit. 911 Operator: So what's the emergency? Opus: From a taste perspective, it's a crisis of biblical proportions!