0

Hi I am taking up a course on 16-bit assembly programming using TASM and I would like to know if when the value inside a bracket or the address becomes negative, would it become an error or proceed accordingly?

e.g. BP=94F7h, SI=0EF89h MOV AX,[BP+SI-0DFC1h]

the sum of BP and SI would be greater than 4-bits so another question comes into my mind, would I discard the 5th bit before proceeding to subtracting the displacement or still consider it?

Aldwin
  • 23
  • 1
  • 1
  • 7
  • Addresses cannot be negative, they are unsigned values. They simply overflow with the 17th bit discarded. The result is 0A4BFh. A 16 bit value, not 4 bits. The odds that the program will work correctly are rather slim, this looks like code produced by a random number generator. – Hans Passant Jan 23 '14 at 19:41
  • The processor combines all the values involved in an indexing operation (e.g., the index register, any offset ) as 2's complement numbers (you call them negative, but that's just an opinion about what that bit string represents) essentially by adding them. Whateever the final sum, it becomes the address. – Ira Baxter Jan 23 '14 at 20:29
  • thanks for answering guys. sorry for the late reply though – Aldwin Mar 09 '14 at 03:35

0 Answers0