今天是暑期小学期的第一天, 这个小学期的内容是Java和汇编。
昨天晚上看了一下老师放在网络学堂上的forward,其中What’s Wrong With Assembly Language的条目如下
• Assembly is hard to learn.
• Assembly is hard to read and understand.
• Assembly is hard to debug.
• Assembly is hard to maintain.
• Assembly is hard to write.
• Assembly language programming is time consuming.
• Improved compiler technology has eliminated the need for assembly language.
• Today, machines are so fast that we no longer need to use assembly.
• If you need more speed, you should use a better algorithm rather than switch to assembly
language.
• Machines have so much memory today, saving space using assembly is not important.
• Assembly language is not portable.
本来对汇编没有什么惧意的,但经过作者那么一吓,不禁对汇编重视一点了。其实那位作者想说明上面的观点是对汇编的误区,但看过那个作者的反驳之后觉得,上面的观点还是有道理的...
今天上课的时候惊奇的发现第一排坐着一个十岁的(有好事者后来问他)小男孩,拿着我们的书,上课还很认真的记笔记。真是奇迹,难道遇到了小神童?!
毛希平老师为了说明汇编语言对理解高级程序设计语言是有裨益的就举了下面这个例子,问题那个关系成立:&a>&b>&c还是&a<&b<&c?
int main()

...{
int a=1;
int b=2;
int c=-1;
}
违反我直觉的是答案竟然是&a>&b>&c,毛老师说这和什么堆栈有关系,不过她也言之不详,所以我也没大搞明白。
我的第一个汇编程序,在MASM5上编译并链接运行成功:
data segment
a db ?
b db ?
c db ?
string db 'c=$'
data ends

code segment
main proc far
assume cs:code,ds:data,es:data
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov es,ax
mov a,1
mov b,2
mov al,a
add al,b
mov c,al
lea dx,string
mov ah,09
int 21h
add c,30h
mov dl,c
mov ah,2
int 21h
mov dl,0ah
int 21h
mov dl,0dh
int 21h
mov dl,0dh
int 21h
ret
main endp
code ends
end start
这个汇编程序所对应的C程序如下:
#include <stdio.h>
int main()

...{
int a,b,c;
a=1;
b=2;
c=a+b;
printf("c=%d ",c);
return 0;
}
昨天晚上看了一下老师放在网络学堂上的forward,其中What’s Wrong With Assembly Language的条目如下
• Assembly is hard to learn.
• Assembly is hard to read and understand.
• Assembly is hard to debug.
• Assembly is hard to maintain.
• Assembly is hard to write.
• Assembly language programming is time consuming.
• Improved compiler technology has eliminated the need for assembly language.
• Today, machines are so fast that we no longer need to use assembly.
• If you need more speed, you should use a better algorithm rather than switch to assembly
language.
• Machines have so much memory today, saving space using assembly is not important.
• Assembly language is not portable.
本来对汇编没有什么惧意的,但经过作者那么一吓,不禁对汇编重视一点了。其实那位作者想说明上面的观点是对汇编的误区,但看过那个作者的反驳之后觉得,上面的观点还是有道理的...
今天上课的时候惊奇的发现第一排坐着一个十岁的(有好事者后来问他)小男孩,拿着我们的书,上课还很认真的记笔记。真是奇迹,难道遇到了小神童?!
毛希平老师为了说明汇编语言对理解高级程序设计语言是有裨益的就举了下面这个例子,问题那个关系成立:&a>&b>&c还是&a<&b<&c?
我的第一个汇编程序,在MASM5上编译并链接运行成功:
这个汇编程序所对应的C程序如下:
初探汇编与Java
本文探讨了汇编语言的学习难点及其对高级语言的理解价值,并通过一个简单的汇编程序实例对比了其与C语言的表现形式。
1523





