Wednesday, 15 September 2010

intel 8080 - Read register pair by bits - assembly i8080 -


I have a hexadecimal value stored in the register pair. And I want to read it with characters. For example, in B in 322 (hexadecimal) I want to save 2 in 2 and then 2 (in ASCII). Is this possible in some way? Or is it possible to store this register pair in "string" by string I mean-> my_string: ds 30 I'm really new to the assembly.

I remember, "pair B register" is made up of B and C registers. C is less than 8 bits, and B contains 8 bits high. So if you have a value in BC and you want to get hexadecimal digit (4 marks) then the process is something similar:

  1. MOV A, B
  2. Shift A right 4 place (see below) puts 4 high bits of this number in less than 4 bits of A, and clears the high bit of A4. So you have 0 to 15 numbers.
  3. Changing that value to hex digits (0-9, IAF) I remember there was some non-obvious way to do this, but I do not know what it was.
  4. to output that value (or later to save in output to memory).
  5. MOV A, B
  6. ANI 0x0 F - this high 4 bits zero, give you four bits of high byte. MOV A, C
  7. Step 2, 3, and 4
  8. Step 3 and 4
  9. MOV A, C
  10. Li>
  11. Step 3 and 4

Since I wrote a 8080 code, it has been a long time since, so I'm not going to confuse you with a broken code. Am I will fulfill the requirements above to your needs.

Note that my use of 0x0F can not be the right syntax for your code. I am trying with the decimal value 15 or hexadecimal value F and I do not know how your codeher hexadecimal constant expresses.

I do not think there was a change instruction in 8080. However, if it has rotation instructions, instead of transferring 4 degrees, instead of transferring 4, you rotate the four places properly and then assert less 4 bits. This is:

  RAR RAR RR RARI 0x0F  

No comments:

Post a Comment