Author Topic: Printing a BCD value  (Read 1019 times)

haghiri75

  • Regular Member
  • *
  • Posts: 1
Printing a BCD value
« on: May 05, 2016, 12:56:41 AM »
I wrote a code with interrupt 1ah, and I did this :
Code: [Select]
mov al, ch
and al, 0fh
mov dl, al

Now, for example time is "18:36", it shall print hours, and only prints 8. Because I wanted program to do this. But, what can I do to show "1"?

P.S : I tested masking lower nibble, but it wasn't my answer.

FORTRANS

  • Member
  • ****
  • Posts: 946
Re: Printing a BCD value
« Reply #1 on: May 05, 2016, 05:55:08 AM »
Hi,

   Try the following to print the high packed BCD digit in a byte.
It is similar to your posted code that printed the low digit.

Code: [Select]
        MOV     AL,CH
        SHR     AL,4
        MOV     DL,AL

HTH,

Steve