【文章內(nèi)容簡(jiǎn)介】
2 Numbers ? Assume data is stored in mailboxes with addresses 90 ? Write instructions Input a Store the Input a Add Output the number Chapter 6 Little Man Computer 616 Program to Add 2 Numbers: Using Mnemonics Mailbox Mnemonic Instruction Description 00 IN 。input 1st Number 01 STO 99 。store data 02 IN 。input 2nd Number 03 ADD 99 。add 1st to 2nd 04 OUT 。output result 05 COB 。stop 99 DAT 00 。data Chapter 6 Little Man Computer 617 Program to Add 2 Numbers Mailbox Code Instruction Description 00 901 。input 1st Number 01 399 。store data 02 901 。input 2nd Number 03 199 。add 1st to 2nd 04 902 。output result 05 000 。stop 99 000 。data Chapter 6 Little Man Computer 618 Program Control ? Branching (executing an instruction out of sequence) ? Changes the address in the counter ? Halt Content Op Code Operand (address) BR (Jump) 6 xx BRZ (Branch on 0) 7 xx BRP (Branch on +) 8 xx COB (stop) 0 (ignore) Chapter 6 Little Man Computer 619 Instruction Set Arithmetic 1xx ADD 2xx SUB Data Movement 3xx STORE 5xx LOAD BR 6xx JUMP BRZ 7xx BRANC ON 0 BRP 8xx BRANCH ON + Inp