i want to enter a string like 415A6B31 and the assembly function should return AZk1 so i have to take every two bytes and convert to one byte ... 41 = A 5A = z and so on
how to make it in assembly?
Look at the numbers you are dealing with. the string is in hex yes? look up the hex values 0-9 are 0x30 to 0x39, and with 0xF to get 0-9 yes? anding 0x41 with 0xF does not result in 0xA though, so for each byte in the string
if(byte>0x39) byte = byte - 7;
byte=byte&0xF;
that gives you nibbles (nybbles) 0x4, 0x1, 0x5, 0xA, etc. Then combine the nibbles into bytes
(0x4<<8)|0x1 = 0x41, (0x5<<4)|0xA = 0x5A, etc.
C language symbols:
<< means shift left
& means and
| means or
- means subtract
0x means the number is in hexadecimal