1

I have issues in assembler language: how to add byte and word and print out the result. For example FFFF+FF. The result would be 100FE. The problem is that I dont know how to print out the whole result since it is bigger than one word. I can print only 00FE, where is the 1?

Example (b1 is a byte, w1 is a word):

mov ah, 00h
mov al, b1
mov bx, w2
add ax, bx
nrz
  • 10,435
  • 4
  • 39
  • 71
  • What architecture? Do you have any 32-bit registers? – Carl Norum Oct 13 '13 at 20:36
  • 1
    The `1` is in your carry bit. You'll need to extend your value to two words and move the carry into the high-order word, low order byte. Then you'll have to figure out how to print a two-word result, making sure you get the bytes in the right order! –  Oct 13 '13 at 20:38
  • 2
    Do a jump-on-no-carry `jnc` skipping the printing of `1`. And then print the word. – Joop Eggen Oct 13 '13 at 20:43

1 Answers1

-1

Been an extremely long time for assembly, but you will likely need to use the carry flag (more detail here: check if carry flag is set)

Community
  • 1
  • 1
jguyton
  • 11