EoC-1 - Lecture - 17 - Machine Language - Part 2
EoC-1 - Lecture - 17 - Machine Language - Part 2
EoC-1 - Lecture - 17 - Machine Language - Part 2
22AIE102|CEN 1
Input / output
Output is effected by writing code that manipulates the screen memory map
22AIE102|CEN 3
Screen memory map
22AIE102|CEN 4
DEMO of Screen memory map in Hardware
Simulator
22AIE102|CEN 5
Memory mapped input
22AIE102|CEN 6
When a key is pressed on the keyboard, the key’s scan code appears in
the keyboard memory map
22AIE102|CEN 7
The Hack character set
22AIE102|CEN 8
Handling the keyboard
To check which key is currently pressed:
• Probe the contents of the Keyboard chip
• In the Hack computer: probe the contents of
RAM[24576].
22AIE102|CEN 9
DEMO of Keyboard memory map in Hardware
Simulator
22AIE102|CEN 10
Hack assembly language (overview)
22AIE102|CEN 11
Hack Programming
• Working with registers and memory
• Branching
• Variables
• Iteration
• Pointers
• input/output
22AIE102|CEN 12
Registers and memory
22AIE102|CEN 13
Typical operations
22AIE102|CEN 14
Program example: add two numbers
Implicit line
numbers
22AIE102|CEN 15
Program example: add two numbers
22AIE102|CEN 16
Terminating a program
22AIE102|CEN 17
Terminating a program
NOP slide
22AIE102|CEN 18
Terminating a program
22AIE102|CEN 19
Built-in symbols
• The Hack assembly language features built-in symbols:
20
Built-in symbols
• The Hack assembly language features built-in symbols:
21
Thank You
22AIE102|CEN 22