topic: little man computing Flashcards

(9 cards)

1
Q

what does the instruction INP do, make reference to a register

A

instruction INP, puts the value input by the user into the accumulator - a register (small area of fast memory) which stores the intermediate results of arithmetic and logical (1 or 0) calculations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what are all the LMC instructions

A

INP - input, loaded into acc, overwriting value that was already there
ADD - add value found in specified memory location to value in the acc
SUB - subtract, value found in specified memory from value in acc
STA - stores the contents of the acc into the specified memory location
LDA - loads the acc with the contents of the specified memory location overwriting any value that was already there
BRA - banch always to the given labelled instruction.
BRZ - branch if zero, if the value in the acc is 0, branch to the given labelled instruction.
BRP - branch if positive or zero, if the value in the accumulator is zero or positive, branch to the given labelled instruction
OUT - outputs contents of acc
HLT - halt, ends program
DAT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

why is assembly language needed

A

allows better control over memory than a high level language.
usually runs faster than programs written using a high level language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what are the four modes of addressing

A
  • immediate (literal)
  • indirect (reference to a cell in memory pointing to another call)
  • direct (reference to a cell in memory)
  • indexed (reference plus offset)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

describe immediate addressing (literal)

A

operand is an actual valu e.g. a literal number, rather than a memory location (literal)
needs no access to RAM - no fetch is required
range of values is limited by the size of the operand (e.g. if there are 4 bits for the operand, the literal value can only be 0 - 15)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

direct addressing (pointer)

A

operand is a memory location, like Little Man Computer
this mode is good when programmer a wants global variable
address is constant throughout the program executive since it’s part of the assembly program instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

indirect addressing (pointer to pointer)

A

operand is a memory location pointing to another memory location to be used
multiple fetches are required
this mode allows access to more memory, since an 8 bit instruction might have 4 bits for the opcode, 4 bits for the operand (max 16 memory locations can be referenced). The pointed to memory location can use all 8 bits to reference 128 memory locations available
with code, we can compute indirect memory addresses and change their values e.g. from 97 to 73; without it, things like linked lists (year 2) would be impossible

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

indexed addressing (pointer plus offset)

A

operand is a memory location plus an offset stored in a special ‘index register’
this mode is ideal to store and access values stored sequentially e.g. in arrays since arrays are stored in contiguous memory locations. The pointer points to the memory location of the first element in the array.
by incrementing or decrementing the offset, different elements of the array can be indexed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is a low level language typically used in

A

embedded systems with minimal resources, e.g. washing machine
device drivers which need to communicate directly with hardware
real-time systems like an OS that is designed to carry out actions in a guaranteed amount of time, usually a small fraction of a second e.g. auto-pilot systems on aircraft.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly