programming assignment

profilelmoueomx
itsiac_ml.doc

PRIVATE

Array Element Machine Code(Decimal)

(Memory Location) Op Code Operand Assembler Like Code Comments

00 03 100 LOAD [100] * clear the

01 02 100 SUB [100] Accumulator *

02 04 100 STORE [100]

03 03 50 TOP LOAD [50] * ADD the first

04 01 100 ADD [100] number *

05 04 100 STORE [100]

06 03 03 LOAD TOP * LOAD the ML instr

Located at TOP into

the ACC. (ACC = 0350)*

07 02 20 SUB TARGET * SUB Target from the

ACC (ACC = -49)

08 06 13 BZ BOTTOM * Branch to halt program

if target is reached. *

09 03 03 LOAD TOP * LOAD the address of

Top into the ACC again.

(ACC = 0350)

10 01 19 ADD ONE * ADD 1 to the contents

OF the ACC *

(ACC = 0351)

11 04 03 STORE TOP * Put 0351 at location

[03]. The ML instruction

at location [03] is now

03 BRANCH TOP * Branch to ML

instruction

at location [03]

13 07 ‑‑ BOTTOM DUMP * Dump Memory and

Registers *

14 08 ‑‑ HALT * Stop execution*

15

16

17

18

19 00 01 ONE DC 1

20 03 99 TARGET LOAD [99]

21

22

23

24

25

47

48

49

50 << DATA GOES HERE >>

51

52

53

54

55

56

Storage

Location Machine Code(HEX)

Array

Element | OpCode | Operand | Assembler Like Code

00 03 64 LOAD [100] * clear

01 02 64 SUB [100] Accumulator *

02 04 64 STORE [100]

03 03 32 TOP LOAD [50]

04 01 64 ADD [100]

05 04 64 STORE [100]

06 03 03 LOAD TOP

07 02 14 SUB TARGET

08 06 13 BZ BOTTOM

09 03 03 LOAD TOP

10 01 13 ADD ONE

11 04 03 STORE TOP

12 05 03 BRANCH TOP

13 07 ‑‑ BOTTOM DUMP

14 08 ‑‑ HALT

15

16

17

18

19 00 01 ONE DC 1

20 00 63 TARGET DC 0063(h)