Sem 6‎ > ‎MPRC LAB‎ > ‎

P2: 1's compliment and and 2's compliment of 8 bit number.

posted Mar 29, 2013, 5:17 AM by Neil Mathew   [ updated Mar 29, 2013, 5:17 AM by Neil Mathew ]

ALGO: 1's compliment

Memory Address Opcode MneumonicsComments
 25003A LDA 2000H3A = Load Address to Accumulator
 250100LSB First (00 of 2000)
 250220MSB Second (20 of 2000)
 25032FCMA
 250432STA 2001HStores accumulator value
250502LSB (02)
250620MSB(20)
250776HLTHalt (End of Program)

ALGO: 2's compliment

Memory Address Opcode MneumonicsComments
 25003A LDA 2000H3A = Load Address to Accumulator
 250100LSB First (00 of 2000)
 250220MSB Second (20 of 2000)
 25032FCMA
 2504 3C INR AAdd 1 to compliment to get 2's compliment
 250532STA 2001HStores accumulator value
250602LSB (02)
250720MSB(20)
250876HLTHalt (End of Program)



Comments