汇编指令 ·若用符号表示跳转位置和变量位置,是否简化了问题? ·于是,汇编语言出现 0:01010110 add B ·用助记符表示操作码 1:00100100 jxx LO ·用标号表示位置 2: ●●●p●0 ●p。年平 ·用助记符表示寄存器 3: 4:01100111← LO:sub 5: ●●●0年 ●●年●●● 6: B: 用汇编语言编写的优点是: 7 C. 不需记忆指令码,编写方便 可读性比机器语言强 需将汇编语言转 在第4条指令 与绝对位置无关,扩展性好 换为机器语言! 前加指令时不 用改变add、 用汇编系统转换 jxx和sub指 令中的地址码! 2022年12月14日 引言 11
• 若用符号表示跳转位置和变量位置,是否简化了问题? • 于是,汇编语言出现 • 用助记符表示操作码 • 用标号表示位置 • 用助记符表示寄存器 • … 2022年12月14日 引言 11 汇编指令 0:0101 0110 1:0010 0100 2: …… 3: …… 4: 0110 0111 5: …… 6: …… 7: …… add B jxx L0 …… …… L0:sub C …… B: …… C: …… 在第4条指令 前加指令时不 用改变add、 jxx和sub指 令中的地址码! 用汇编语言编写的优点是: 不需记忆指令码,编写方便 可读性比机器语言强 与绝对位置无关,扩展性好 需将汇编语言转 换为机器语言! 用汇编系统转换
符号语言 The early programmers realized that it would be a tremendous help to use mnemonic symbols for the instruction codes and memory locations,so they developed assembly language for this purpose. ORIG x3000 Address (in hexadecimal)of the first instruction LD R1,FIRST Copy the number in memory location FIRST to register R1 LD R2, SECOND Copy the number in memory location SECOND to register R2 ADD R3,R2,R1 Add the numbers in R1 and R2 and place the sum in register R3 ST R3,SUM Copy the number in R3 to memory location SUM HALT ;Halt the program FIRST FILL #5 Location FIRST contains decimal 5 SECOND.FILL #6;Location SECOND contains decimal 6 SUM BLKW #1 Location SUM (contains 0 by default) .END ;End of program
符号语言 • The early programmers realized that it would be a tremendous help to use mnemonic symbols for the instruction codes and memory locations, so they developed assembly language for this purpose
高级程序设计语言 Programming language abstractions fall into two general categories: data abstraction and control abstraction. Data abstractions simplify for human users the behavior and attributes of data,such as numbers,character strings,and search trees. Control abstractions simplify properties of the transfer of control,that is,the modification of the execution path of a program based on the situation at hand.Examples of control abstractions are loops,conditional statements,and procedure calls. int first =5; int second =6; int sum first second;
高级程序设计语言 • Programming language abstractions fall into two general categories: data abstraction and control abstraction. • Data abstractions simplify for human users the behavior and attributes of data, such as numbers, character strings, and search trees. • Control abstractions simplify properties of the transfer of control, that is, the modification of the execution path of a program based on the situation at hand. Examples of control abstractions are loops, conditional statements, and procedure calls