by Nikolai Golovchenko
; Input - ASCII number in x ; Output - binary in x mov W, #-'A'+10 sb x.6 mov W, #-'0' add x, W
ASCII numbers '0'-'9' have codes 48-57, and 'A'-'F' have codes 65-70. The second group differs from the first one by a value of bit 6. To map '0'-'9' to 0-9 we need to substract '0' (if bit 6 is clear), and to map 'A'-'F' to 10-15 we substract 'A' and add 10 (if bit 6 is set).
|file: /Techref/scenix/lib/math/radix/ah2b-1d4b_sx.htm, 0KB, , updated: 2004/6/10 13:40, local time: 2019/12/11 13:48,
|©2019 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.sxlist.com/techref/scenix/lib/math/radix/ah2b-1d4b_sx.htm"> PIC Microcontroller Radix Math Methods ASCII Hex to Binary</A>
|Did you find what you needed?|
Welcome to sxlist.com!
& kind contributors
just like you!
Please don't rip/copy
Copies of the site on CD
are available at minimal cost.
Welcome to www.sxlist.com!