



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




























Fall 2023 Lecture # The Little Man Computer
§ Op code § Operation code § Arbitrary mnemonic § Operand § Object to be manipulated p Data or p Address of data Address Content Op code Operand
Arithmetic 1xx ADD 2xx SUB Data Movement 3xx STORE 5xx LOAD Input/Output 901 INPUT 902 Output Machine Control (coffee break)
xx = address of data
Content Op Code Operand (address) IN (input) (^9 ) OUT (output) (^9 )
Content Op Code Operand (address) STO (store) 3 xx LDA (load) (^5) xx
LDA STO
§ Read mailbox § Perform operation in the calculator Content Op Code Operand (address) ADD (^1) xx SUB (^2) xx
ADD SUB
Mailbox Mnemonic Instruction Description 00 IN ;input 1 st Number 01 STO 99 ;store data 02 IN ;input 2 nd Number 03 ADD 99 ;add 1 st
nd
04 OUT ;output result 05 COB ;stop 99 DAT 00 ;data
Mailbox Code Instruction Description 00 901 ;input 1 st Number 01 399 ;store data 02 901 ;input 2 nd Number 03 199 ;add 1 st
nd
04 902 ;output result 05 000 ;stop 99 000 ;data
Arithmetic 1xx ADD 2xx SUB Data Movement 3xx STORE 5xx LOAD BR 6xx JUMP BRZ 7xx BRANC ON 0 BRP 8xx BRANCH ON + Input/Output 901 INPUT 902 OUTPUT Machine Control (coffee break) 000 HALT COB
00 IN 901 INPUT (1st number input) 01 STO 10 310 STO 10 (to mailbox no 10) 02 IN 901 INPUT (2nd number input) 03 STO 11 311 STO 11 (store to mailbox no 11) 04 SUB 10 210 SUB 10 (subtract 1st number from 2nd) 05 BRP 08 808 ;test (Branch to 08 if 2nd > 1st ) 06 LDA 10 510 ;if negative, reverse order (load 1st) 07 SUB 11 211 SUB 11 (subtract 2nd number from 1st) 08 OUT 902 ;print result and 09 COB 000 ;stop (The Little Man rests) 10 DAT 00 000 ;used for data ( st number) 11 DAT 00 000 ;used for data ( nd number)