Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!VCCSCENT.BITNET!SOMITCW From: SOMITCW@VCCSCENT.BITNET Newsgroups: comp.lang.asm370 Subject: hex to decimal Message-ID: <9002100327.AA24770@lilac.berkeley.edu> Date: 10 Feb 90 03:05:24 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: IBM 370 Assembly Programming Discussion List Distribution: inet Organization: The Internet Lines: 25 >say you've got a hex value in a register and >want to convert it to decimal. isnt there >a quick way to do this with shifts? If by HEX to DECIMAL, you mean convert a register value to a HEX display format, use UNPK and TR. Example: ST Rx,WORK1 Put the register in storage for UNPacK UNPK OUTPUT(9),WORK(5) UNPacK the register's data TR OUTPUT(8),TABLE Translate X'FA'-X'FF' to C'A'-C'F' * OUTPUT DS CL8,CL1 Output area for HEX in display format * WORK DS XL4 Register hold area * TABLE EQU *-240 TRANSLATE TABLE DC CL16'0123456789ABCDEF' * Notes: The 5th byte of WORK is referenced by UNPK. The 9th byte of OUTPUT is garbage. The programs base register must point more than 240 bytes before where TABLE is defined.