Docsity

computer hardware and system software 5, Slides of Computer Fundamentals

Partial preview of the text

Download computer hardware and system software 5 and more Slides Computer Fundamentals in PDF only on Docsity!

MIS 2103

Computer Hardware and

System Software

Fall 2023 Lecture # The Little Man Computer

The Little Man Computer

Content: Instructions

§ Op code § Operation code § Arbitrary mnemonic § Operand § Object to be manipulated p Data or p Address of data Address Content Op code Operand

Magic!

§ Load program into memory

§ Put data into In Basket

Instruction Set

Arithmetic 1xx ADD 2xx SUB Data Movement 3xx STORE 5xx LOAD Input/Output 901 INPUT 902 Output Machine Control (coffee break)

000 STOP

COB

xx = address of data

Input/Output

§ Move data between calculator and

in/out baskets

Content Op Code Operand (address) IN (input) (^9 ) OUT (output) (^9 )

Internal Data Movement

§ Between mailbox and calculator

Content Op Code Operand (address) STO (store) 3 xx LDA (load) (^5) xx

LMC Internal Data

LDA STO

Arithmetic Instructions

§ Read mailbox § Perform operation in the calculator Content Op Code Operand (address) ADD (^1) xx SUB (^2) xx

LMC Arithmetic Instructions

ADD SUB

Program to Add 2 Numbers:

Using Mnemonics

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

to 2

nd

04 OUT ;output result 05 COB ;stop 99 DAT 00 ;data

Program to Add 2 Numbers

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

to 2

nd

04 902 ;output result 05 000 ;stop 99 000 ;data

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 + Input/Output 901 INPUT 902 OUTPUT Machine Control (coffee break) 000 HALT COB

Find Positive Difference of 2 Numbers

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)