Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
karthi_ind

Active User

Joined: 24 Feb 2004
Posts: 131
Location: Chennai

 Posted: Sun Oct 03, 2010 7:11 pm    Post subject: Two's complement Hi, Could you help me out on this. Display the two's complement value from 1 to n numbers thru assembler program. Pls guide me on this.

enrico-sorichetti

Global Moderator

Joined: 14 Mar 2007
Posts: 10456
Location: italy

 Posted: Sun Oct 03, 2010 7:51 pm    Post subject: Reply to: Two's complement since this not something we usually do/have done we would need to do it just for Your sake review the TWO complement notation for short numbers ( 4 bits , 0 to 15 ) doing it by pencil and paper after that expand the logic to longer number
dick scherrer

Site Director

Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

 Posted: Sun Oct 03, 2010 10:28 pm    Post subject: Hello, Is this a binary number? You might try multiplying n by -1 (negative one) and see if the result is what you want. . .
Bill O'Boyle

CICS Moderator

Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

Posted: Mon Oct 04, 2010 12:58 am    Post subject: Reply to: Two's complement

For register usage, with a positive number in Rx (R14 in this example), review the LCR (Load Complement Register) instruction.

EG:

 Code: LA    R14,15              LOAD WITH X'0000000F'          LCR   R15,R14             LOAD WITH TWO'S COMPLEMENT (R14 PRESERVED)

Bill
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Sorting a 9's complement by comparing... venkatatcts DFSORT/ICETOOL 1 Sat Nov 14, 2009 1:33 pm Need to Sort field that are in 9's co... fareed DFSORT/ICETOOL 2 Wed Mar 29, 2006 1:19 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us