Lecture 6 - Assembly Language Programming Flashcards

1
Q

What is machine code?

A

Machine code is how a microcontroller responsed to a set of instructions that will take in input and output data

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

What is programming in machine code?

A
  1. Very low level programming
  2. Difficult and error prone
    Improvements such as making abbreviations that make sense such as ADD for adding and CMP for comparing, this does require and assembler.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an assembler?

A

Translate mnemonics of codes to machine language

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

How do Assembly Commands work?

A

Label: needed for branching and jumps
Command: op-code for processor (tell machine what to do)
Operands: The arguments the command operates on (constant, memory, register)
Comments: describe what is process is occuring

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

What are the arithmetic commands in assembly?

A

ADD: Addition
SUB: Subtraction
MUL: Multiplication
THERE IS NO DIVISION
ADIW: Add immediate word
SUBI: Sub immediate
MULS: Multiplication signed
NEG: Negation
CLR: Clear
INC: Increment
DEC: Decrement

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

What are the data movement commands in assembly?

A

LD: Load data from a memory location to a register
ST: Store data from register into memory location
MOV: Move compies data from one register to another register or froma memory location to a register without modifying original data
LDS: Load direct from SRAM
STS: Store direct to SRAM
IN: Reads data from an I/O port or memory-mapped I/O register into a register
OUT: Writes data from an I/O port or memory-mapped I/O register into a register

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

What are the logic and shift commands in assembly?

A

AND, OR, COM (not/compliment), EOR (xor) - also have ANDI (and immediate) and ORI
LSL/LSR: shift left/shift right
ROL/ROR: rotate left/right

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

What are the compare and branch commands in assembly?

A

CP OR TST: comparing
JMP: Jump always
BREQ: Branch if-equal
BRLT: Branch if-less-than

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

What are the stack commands in assembly?

A

PUSH: push on stack
POP: pop from stack

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

What are the subroutine commands in assembly?

A

CALL: call subroutine
RET: return

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

What are assembly operands?

A

They can be constants such as 10 (decimal constant), as well as hex, binary or character ie Z
They can be registers ie R0, R1 -> MOV R1, R2
They can be memory values such as LDS R5, name (REFER TO SLIDES)

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

What are assembly registers?

A

Register are just small storage spaces, assembly typically has 32 general purpose registers. Not all instructions work with registers. REFER TO SLIDES FOR EXAMPLES

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

How does jump work in assembly?

A

So after every instruction/command the program counter increments to the next instruction. Jump can be used to change control flow. This is an unconditional jump, which will change the program counter to specified address. REFER TO SLIDES

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

How does branch work in assembly?

A

So after every instruction/command the program counter increments to the next instruction. Branch can be used to change control flow. A conditional branch will only change the program counter if the condition is true. It is made on several different conditions and these conditions are the result of arithmetic or logic operations. REFER TO SLIDES

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

What are the four addressing modes of assembly?

A

Immediate
Direct
Absolute
Indirect

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

What is call in assembly?

A

It is similar to the JMP command but it preserves current program counter ons stack, so execution can return later using RET (return from subroutine)

17
Q

What is a stack in assembly?

A

It is a data structure with elements of the same type and is consider to be a linear data structure as an array. You typically add new elements and delete exisiting elements on the same side, which is known as last in first out. You have a stack pointer which points to the next free element and a stack typically grows from large to small address

18
Q

What is the link between a subroutine and a stack?

A

A stack is required for every subroutine call, it can also save a restore registers within subroutines

19
Q

Ports in assembly???

A

REFER TO SLIDES