Professional Documents
Culture Documents
) Machine Language Part 2
) Machine Language Part 2
) Machine Language Part 2
Observations:
Output is effected by writing code that manipulates the screen memory map
22AIE102|CEN 4
Screen memory map
22AIE102|CEN 5
DEMO of Screen memory map in Hardware
Simulator
22AIE102|CEN 6
Memory mapped input
22AIE102|CEN 7
When a key is pressed on the keyboard, the key’s scan code appears in
the keyboard memory map
22AIE102|CEN 8
The Hack character set
22AIE102|CEN 9
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 10
DEMO of Keyboard memory map in Hardware
Simulator
22AIE102|CEN 11
Hack assembly language (overview)
22AIE102|CEN 12
Hack Programming
• Working with registers and memory
• Branching
• Variables
• Iteration
• Pointers
• input/output
22AIE102|CEN 13
Registers and memory
22AIE102|CEN 14
Typical operations
22AIE102|CEN 15
Program example: add two numbers
Implicit line
numbers
22AIE102|CEN 16
Program example: add two numbers
22AIE102|CEN 17
Terminating a program
22AIE102|CEN 18
Terminating a program
NOP slide
22AIE102|CEN 19
Terminating a program
22AIE102|CEN 20
Built-in symbols
• The Hack assembly language features built-in symbols:
21
Built-in symbols
• The Hack assembly language features built-in symbols:
22
Thank You
22AIE102|CEN 23