I have a hexadecimal value stored in register pair B. And I want to read it by chars. For example in B is 322 (hexadecimal) I want to have in accumulator 3 then 2 and then 2 (in ASCII). Is it somehow possible? Or is it possible to store this register pair into "string". By string I mean this line-> my_string: ds 30
I'm really new to assembly.
As I recall, "register pair B" is made up of the B and C registers. C is the low 8 bits, and B contains the high 8 bits. So if you have a value in BC and you want to get the hexadecimal digits (4 digits), the procedure is something like:
It's been a long time since I wrote any 8080 code, so I'm not going to confuse you with broken code here. The steps I outline above will do what you need.
Note that my use of 0x0F might not be the correct syntax for your assembler. I'm trying to and immediate with the decimal value 15, or hexadecimal value F. I don't know how your assembler expresses hexadecimal constants.
I don't think the 8080 had a shift instruction. It did, however, have rotate instructions. So what you do instead of shift right 4 places is rotate right four places and then mask the low 4 bits. That is:
RAR
RAR
RAR
RAR
ANI 0x0F