1 / 26

CS2422 Assembly Language and System Programming

CS2422 Assembly Language and System Programming. Department of Computer Science National Tsing Hua University. Announcement. Two sessions for this course: CS2422-01 ( 潘雙洪教授) CS2422-02 ( 金仲達教授). Course Administration: CS2422-02. 授課老師: 金仲達

sprather
Download Presentation

CS2422 Assembly Language and System Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS2422 Assembly Language andSystem Programming Department of Computer Science National Tsing Hua University

  2. Announcement • Two sessions for this course: • CS2422-01 (潘雙洪教授) • CS2422-02 (金仲達教授)

  3. Course Administration: CS2422-02 • 授課老師: 金仲達 • 辦公室: 資電館443 電話: 42804email: king@cs.nthu.edu.tw • 助教: 張建偉、劉力瑋 • 辦公室: 資電館734 電話: 53553 • 上課時間: • 星期二15:20-17:10 星期四15:20-16:10 • 上課地點: 資電館236 • 課程網頁: http://www.cs.nthu.edu.tw/~king/courses/cs2422.html

  4. Textbooks • Kip Irvine, “Assembly Language for Intel-Based Computers”, 5th ed. • Leland Beck, “System Software” • Using the first 4 chapters • Other good books: • Patterson and Hennesey, “Computer Organization and Design” (not Intel-based, textbook of CS4100) • The Art of Assembly (freely available online)

  5. Honor Code • University code will be followed strictly to handle the cheating in assignments and exams. • You are allowed (and in fact encouraged) to discuss the assignments, but the work must be your own.

  6. Grading (Subject to Change) 1. Program assignments: 60% 2. Mid-term exam.: 20% 3. Final exam: 20% • Early bonus: +2% each day early, up to two days • Late penalty: -20% each day (or partial day) late • The instructor reserves the right to normalize (including shift and scale) the scores for the purpose of achieving fair grade distribution within the class or across classes

  7. What’s Next? • Basic concepts • What is “assembly language”, “assembly program”, and “assembler”? • How are they related to computers? • Why this course?

  8. 稻田是怎麼灌溉的? 灌溉渠道 水庫

  9. 灌溉渠道

  10. 閘門 5 1 6 4 3 2 水利會 控制中心 7 8 如何實施分區輪流灌溉?

  11. 水利會控制中心的「閘門排程表」

  12. 水利會總幹事的「灌溉區排程表」

  13. 水利會理事長的灌溉指示 • 今年三期稻作由9/17開始灌溉 • 9/17灌溉新埔、大埔 • 9/18灌溉北埔、新埔、南埔 • 9/19至9/24輪流,一天灌溉北埔、大埔,另一天灌溉新埔、南埔 • 9/25灌溉新埔 (以上故事純屬虛構) 灌溉和電腦有什麼對應的關係?

  14. Datapath Register 5 Memory Control 1 Controller 6 ALU N 4 Z 3 2 IR PC clock 7 水利會 控制中心 8 multiplexer 閘門排程表 Computer Analogy Machine code 10110110 11101010 01010111 11011011 00100111 …

  15. 灌溉區排程表 閘門排程表 灌溉區排程表 Computer Analogy Assembly program ?

  16. 理事長的指示 理事長的指示 灌溉區排程表 Computer Analogy High-level Language Program ?

  17. Assembly Language • Machine language: • Machine instructions: direct instructions to the processor, e.g. to be encoded to control the datapath • A numeric language understood by the processor • Assembly language: • Statements (instructions) in short mnemonics and symbolic reference, e.g. ADD, MOV, CALL, var1, i, j, that have a 1-to-1 relationship with machine instructions • Understood by human

  18. From C to Assembly C x = (a+b) * b Assembly MOV AX, a ADD AX, b MUL c MOV x, AX C compiler

  19. From Assembly to Binary Assembly MOV AX, a ADD AX, b MUL c MOV x, AX Assembler 00000000101000010000000000011000 00000000100011100001100000100001 10001100011000100000000000000000 10001100111100100000000000000100 10101100111100100000000000000000 10101100011000100000000000000100 00000011111000000000000000001000 Machine code

  20. Different Levels of Abstractions MOV AX, a ADD AX, b MOV x, AX temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; High Level Language Program Compiler Assembly Language Program more elaborated later in Sec. 1-2: Virtual Machine Concept Assembler 0000 1001 1100 0110 1010 1111 0101 1000 1010 1111 0101 1000 0000 1001 1100 0110 1100 0110 1010 1111 0101 1000 0000 1001 0101 1000 0000 1001 1100 0110 1010 1111 Machine Language Program Machine Interpretation Control Signal ALUOP[0:3] <= InstReg[9:11] & MASK ° °

  21. Comparing Assembly to High-Level Languages

  22. System Programming • Programming of system software: • Programs that support operation of a computer itself, rather than any particular application • Examples: text editor, compiler, loader or linker, debugger, macro processor, operating system, database management systems, ….

  23. System Programming • Assembler: • A computer program to translate an assembly program into the processor’s object code • Translates assembly instruction mnemonics into opcodes, and resolves symbolic names for memory locations and other entities • Linker: • A program that takes one or more objects generated by compilers/assemblers and assembles them into a single executable file • Loader: • A program to load executables into memory, preparing them for execution and executing them • Usually a part of operating system

  24. What’s Next? • Basic concepts • What is “assembly language”, “assembly program”, and “assembler”? • How are they related to computers? • Why this course?

  25. Why This Course? • A great way to learn how a computer works: • To talk in the languages of the processors • To see how a computer talks to other devices • To write very efficient code (size & speed) • To build solid background for other courses: • Computer Architecture, Compilers, Operating Systems…etc.

  26. Even More Important Now • A few examples: • The SOC (System-On-Chip) and embedded system trend • The era of ubiquitous computing • For graphics folks: the DirectX and OpenGL shading languages • The hardware/software boundary is blurring

More Related