[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Convert BCD to Decimal

Posted on 1998-04-12
2
Medium Priority
?
3,975 Views
Last Modified: 2008-02-01
Hi,
I'm having real problems converting a BCD number to decimal.  I want to do it using assembly coding.  I have tried shifting (shl,shr) the upper 4 and lower 4 bits right out of the number to deal with them on their own.  I found out shifting doesnt work like that (it just adds on a bunch of 0's where you shifted from and keeps the numbers I thought would shift right out of the register ( would be nice to have them dropped out ) ).  
If I have a BCD number in a register (16 or 8 bit) (ie. Get Real Time Clock returns hour in BCD to CH)  how can I properly change it to decimal?

Thanks in advance
0
Comment
Question by:bod_1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
Nexial earned 80 total points
ID: 1019045
Here's how I do it, for the clock:
(a minor snippet)

     DOSCALL @GETTME ; CH<-hours, CL<-minutes
     MOV     AL,CH           ;AL<-binary hours
     AAM                     ;Convert AL to two
     XCHG    AL,AH           ; BCD digits in AX.
     OR      HOUR,AX         ;Fold into hours
     MOV     AL,CL           ;AL<-binary minutes
     AAM                     ;Convert AL to two
     XCHG    AL,AH           ; BCD digits in AX.

0
 

Author Comment

by:bod_1
ID: 1019046
Nietod... you're amazing

I haven't got the snippet working yet but youve pointed me towards the right instructions.
Thanks
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Great sound, comfort and fit, excellent build quality, versatility, compatibility. These are just some of the many reasons for choosing a headset from Sennheiser.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question