-4

I have a code

MOV AL, 025H
MOV BL, 034H
MOV BL, 034H
ADD AL,BL

but I can't print the hex number in AL register to the screen.

mirabilos
  • 5,123
  • 2
  • 46
  • 72
Cem
  • 15
  • 1
  • 1
  • 4

1 Answers1

2

You have to convert it to ASCII first if you want to print it on the screen. Thus you have to get the separate hex-digits and convert them to ASCII in order, e.g. 025H -> '0' '2' '5'... You can do so dividing by powers of 16 (10H) and taking the modulo:

025H MOD 10H^1 = 5
025H MOD 10H^2 = 2

And so on...

m0skit0
  • 25,268
  • 11
  • 79
  • 127