10.1 Assemblers Flashcards
What is an assember?
Translates assembly (abstracted ISA) into machine code
What is assembly?
Writing programs specific for an ISA using mnemonics
What are mnemonics
- Using short words to describe 1s and 0s operations in the ISA
- A lookup table is used to translate mnemonics to opcodes
What is a lexer (and what does it do)
- A lexer turns the source program into a set of tokens.
- A token could be the opcode, operand etc.
What is the difference between an assembler and a compiler?
Assembler: Converts assembly to machine code
Compiler: Converts higher level program to machine code
What types of convenient notations do assemblers typically allow for
- Labels: Reference next line number
- Named Constants: Can just be replaced with value
- Variables: Can be changed
What is the format for Hex 8 assembly
How do Labels work in Hex 8 assembly
- Refers to next line
How does the hex-8 assembler accomodate for large operands
- Inserts PFIX instructions automatically
What does the DATA keyword do in hex-8 assembly?
- Inserts that amount of data into the instruction stream (ie makes room for that many bits in memory)
Why does an assember run 2 passes, and what does it do on each pass?
- Resolve labels and symbols
- Construct binary
Note: no need to hold entire program in memory
What is backpatching
Used to assemble in one pass.
Fixes up labels afterwards.
Downsides: need to store entire program in memory (may be a problem for embedded devices)