---
title: ASM Ch.1
---
# Assembly Language<br> Chapter 1: Basic Concepts
NTNU 組合語言
##### [Back to Note Overview](https://reurl.cc/XXeYaE)
##### [Back to Assembly Language](https://hackmd.io/@NTNUCSIE112/HkSk0OxBD)
###### tags: `NTNU` `CSIE` `選修` `Assembly Language`
---
[TOC]
---
## 1.1 Welcome to Assembly Language
<!-- ### 1.1.1 Questions You Might Ask
### 1.1.2 Assemble Language Applications -->
- Some representative types of applications
- Business application for single platform
- Hardware device driver
- Business application for multiple platforms
- Embedded systems & computer games
#### Comparing ASM to High-Level Languages

<!--翻譯成中文表格 但是不要直接刪掉圖片-->
### 1.1.3 Section Review
## 1.2 Virtual Machine Concept
### 1.2.1 Section Review
- [Tanenbaum](https://en.wikipedia.org/wiki/Andrew_S._Tanenbaum#Tanenbaum%E2%80%93Torvalds_debate): Virtual machine concept
- Programming Language analogy
- Each computer has a native machine language (language L0) that runs directly on its hardware
- A more human-friendly language is usually constructed above machine language, called Language L1
- Programs written in L1 can run two different ways:
- Interpretation
- L0 program interprets and executes L1 instructions one by one
- Translation
- L1 program is completely translated into an L0 program, which then runs on the computer hardware
#### Virtual Machines
#### Translating Languages
- English: Display the sum of A times B plus C
- C++
```cpp=
cout << A * B + C;
```
- Assembly Language
```assembly=
mov eax, A
mul B
add eax, C
call WriteInt
```
- Intel Machine Language
```=
A1 00000000
F7 25 00000004
03 05 00000008
E8 00500000
```
#### Specific Machine Levels

- Level 4 - High-Level Language
- Application-oriented languages
- C++, Java, Pascal, Visual Basic . . .
- Programs compile into Level 3(assembly language)
- Level 3 - Assembly Language
- [Instruction mnemonics(指令助憶)](https://terms.naer.edu.tw/detail/1280466/) that have a one-to-one correspondence to machine language
- Programs are translated into Level 2(ISA)
- Level 2 - Instruction Set Architecture (ISA)
- Also known as conventional machine language
- Executed by Level 1(Digital Logic)
- Level 1 - Digital Logic
- CPU, constructed from digital logic gates
- System bus
- Memory
- Implemented using bipolar transistors
## 1.3 Data Representation
### 1.3.1 Binary Integers
- Translating between binary and decimal
- MSB - most significant bit
- LSB - least significant bit
### 1.3.2 Binary Addition
沒什麼重點
### 1.3.3 Integer Storage Sizes

### 1.3.4 Hexadecimal Integers
- Translating between decimal and hexadecimal
### 1.3.5 Hexadecimal Addition
### 1.3.6 Signed Binary Integers

### 1.3.7 Binary subtraction
### 1.3.8 Character Storage
### Boolean Operations