|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
话说我要毕业了!!!!!激动啊,终于熬出头了!! |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
中山大学-11 取补指令 neg 格式:neg oprd 这条指令对操作数取补,就是用零减去操作数oprd,再把结果送回oprd 执行操作:(oprd)<--- -(oprd) Eg:neg al neg varw[si] 有效地址是就是varw的位移加si的值 如在字节操作时对-128,-32768取补,则操作数不变(还是-128,-32768本 身),但of=1,其他均为0 操作数可以是通用寄存器,也可以是存储单元 此指令的执行结果影响cf,zf,sf,of,af,pf 操作数为0时,求补运算的结果时cf=0,其他情况则均为1 比较指令 cmp cmp oprd1,oprd2 这条指令完成操作数oprd1减去操作数oprd2,运行结果不送到oprd! 但影响标志cf,zf,sf,of,af和pf Eg: cmp si,di cmp cl,5 cmp dx,[bp-4] 比较指令主要用于比较两个数的管,是否相等,谁大谁小。 执行了比较指令后,可根据zf是否置位,判断两者是否相等; 如果两者是无符号数,则可根据cf判断大小, 如果两者是有符号数,则要根据sf和of判断大小。 Eg:设x,y,z均为双精度数,它们分别存放在地址为x(低位),x+2(高 位);y,y+2;z,z+2的存储单元中,存放时高位字在高地址中,低位字在低地 址中,下列指令序列实现 w<--x+y+24-z 并用w和w+2单元存放运算结果 一般双精度数把高位放在dx中,低位放在ax中。双精度运算要从低位进行运 算,这样高位才能进行运算 mov ax,x ax=x mov dx,x+2 dx=x+2 add ax,y ax=ax+y adc dx,y+2 dx=dx+y+2+cf add ax,24 ax=ax+25 adc dx,0 dx=dx+0+cf sub ax,z ax=ax-z sbb dx,z+2 dx=dx-(z+2)-cf mov w,ax w=ax mov w+2 w=w+2 Eg:当前数据段寄存器的内容是1B00H,在数据段的偏移地址2000H单元内 (1b00h:2000h),含有一个内容为0ff10H和8000H的指针,它们是一个16位变 量的偏移地址和段地址,试写出把该变量装入ax的指令序列 根据题意可得ds=1b00h,d=2000h 物理地址=1b000+2000=1d000h 所以(1d000h)=0ff10h,(1d002h)=8000h mov bx,[2000h] mov es, [2002h] mov ax, es:[bx] Eg:写出执行以下计算的指令序列,其中x,w,z均为存放16位带符号数单位 的地址 z<--- w+(z-x) 1.mov ax,z mov bx,x sub ax,bx mov bx,w add ax,bx mov z,ax 2.mov ax,z sub ax,x add ax,w mov z,ax 2个操作数,必须有至少一个寄存器,不然不能进行运算 只有双精度的数才考虑高,低位运算 =================我是无敌分割线======================== 讲各种指令时还简单易懂。 他举得例子就蛋疼了,第二个例题,首先那个题就让我纠结了好半天。 这看不懂,那看不懂。不理解他解答的(1d000h)=off10h和(1d002h)=8000h 还有那句纠结的话,看不懂!!在数据段的偏移地址2000H单元内 ,含有一个内容为0ff10H和8000H的指针,一个是...!! 原题就在上面,有没有懂得起的童靴帮我详细说明一下他这个题的意思和他的解答~~ 同时感谢汇编学习群里面的兄弟为小弟我解答这些问题~~群号:17679340 有兴趣一起学习的,都加进来吧~ |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
中山大学-10 Eg:在table数组中依次存储了7个字数据,紧接着是名为zero的字单元,表 示如下: table dw 23,36,2,100,32000,54,0 zero dw ? 1.如果bx包含数组table的初始地址,请编写指令将数据0传送给zero单元 mov ax,[bx+0ch] 因为每个数字占2个字节单元,第12,13字节单元组成数 字0,既是[table+0ch]==0 mov zero,ax 2.如果bx包含数据0在数组中的位移量,请编写指令将数据0传送给zero单元 mov ax,[table+bx] bx==0ch,bx这时表示偏移地址 mov zero,ax Eg:试分析下列程序段执行完后,a单元的内容是多少? data segment a dw 0 b dw 0 dw指的是一个字 c dw 230,20,54 data ends code segment ... mov bx,offset c mov ax,[bx] mov b,ax mov ax,2[bx] 2[bx]=[c+2] add ax,b ... code ends 执行完之后,ax=ax+b=20+230,a单元的内容就是250 1.加减运算指令 减法指令 sub 格式: sub oprd1,oprd2 执行操作:(oprd1)<---(oprd1)-(oprd2) Eg:sub [si+14h],0136h 指令执行前:ds=3000h,si=0040h (30054h)=4336 指令执行后:物理地址=30000+0040+14=30054H(30054H)=4200h sf=0,zf=0,cf=0,of=0 ps:救命啊,以上怨念终于解释清楚了 Eg:sub dh,[bp+4] 指令执行前:dh=41h,ss=0000h,bp=00e4h,(000e8h)=5ah 指令执行后:dh=0e7h,sf=1,zf=0,cf=1(不够减,无符号数有借位), of=0 该指令影响标志位cf说明无符号数相减的溢出,同时它又是被减数的最高有 效位向高位借位值 of位则说明带符号数的溢出减法的of位的设置方法为: 若2个数的符号相反(源操作数,目的操作数),而结果的符号与减数(目的 操作数)相同则of=1. 如果2个数的符号相同,那么of=0,如果有溢出,说明结果是错误的 带借位的减法指令 sbb 格式:sbb oprd1,oprd2 执行操作:(oprd1)<---(oprd1)-(oprd2)-cf Eg:sbb al,dl sbb dx,ax 该指令主要用于多字节数相减的场合 减1指令 dec 格式:dec oprd 执行操作:(oprd)<---(oprd)-1 Eg:dec varb varb是字节变量 操作数oprd可以是通用寄存器,也可以使存储单元,在相减时,把操作数作 为一个无符号数对待,这条指令执行的结果影响标志zf,sf,of,af,但不 影响cf 该指令主要用于调整地址指针和计数器 ==========我是无敌分割线============ 好多天没更新过了。。 今天不错,让我解决了个纠结,但是又很愚蠢的问题,哈哈~~ 现在看起来,真的好傻啊啊啊啊啊~~ |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
有的,从视频第5节开始,就是学习关于汇编语言的各种寻址方式和指令。慢慢看吧,兄弟,我的笔记里面有的哦~~ |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
谢谢你的解释,很清楚。 |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
因为前几天拿到王爽的汇编语言这本书了,看书看的都忘记视频这个事情了。。 我来说一下这个视频和书的区别吧,正如大家所见,前面我们学习了中山大学视频教程的前8章内容(其实还有几章,没有发出来。万恶的电信,不提它了!NND~)。视频从计算机最基础的数的结构开始讲起,到学习汇编语言必须知道关于cpu的知识,比如寄存器,存储器,存储单元,物理地址,偏移地址,段地址,8位,16位(未来的趋向是32位)等等~~再到各种汇编指令的具体作用。学习流程是十分正确,从简单到复杂,从基础到结构化。 但是我自己的感觉并不是那么好(只是自我感受,各位其他同学如何,我就不知道了),因为面对一些问题时,视频上并不是讲的很详细。诸如寄存器,存储器,存储单元等关系,他一直没有描述这个到底是个什么东西,而是只是介绍了它们用来做什么,什么时候用~所以导致我看完视频之后老是有这样的疑问,他是个什么东西。Eg:特别是8086CPU的20位地址总线,决定它的1MB的寻址能力。但是它又是16位的结构,只有64KB的寻址能力。所以需要内部2个16位的地址合成20位的物理地址,既是段地址和偏移地址。。在看视频的时候这段,简直让我头昏脑胀的,一直不懂什么意思。 经过这2天的看书,发现这些东西并没有想象的那么神秘,没那么难,其实挺简单的。。以前一直纠结的问题得到了解决。所以在我帖子上建议的仁兄们说的果真不错啊。 先去学习下王爽那本书,再看这个视频比较好,虽说都是基础教程。但是王爽的书更适合那些对计算机原理不是特别清楚的人使用,对于那些问题讲的比较直观。 而视频对这些问题都比较含糊,可能各位会像我一样,为了一个问题纠结很久的。。 但是也不是说视频不好,它存在这么久,并且得到大家认可,当然有它的理由。它是一部经典,当然也和所有的经典一样,有那么一点点瑕疵。它和书,2个经典结合起来的话,我相信,它们会是一部非常棒的学习教材~ 当然,这个帖子,我会继续更新下去,不过可能会比较慢了点。 因为现在我会将2个资源结合着看,这样可能对学习好一点。总之,新人朋友们,加油吧~ |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
哦,谢谢了哈~ |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
我的第一张帖子里面有地址,因为我也是看别人收集的,而且没有经过别人允许。就没有转过来,你可以去看看那位朋友的原帖嘛、 大家一起加油~~ |
|
|
|
|
|
|
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
中山大学-9 1.标志位操作指令 标志位操作指令仅对指令规定的标志产生指令规定的影响,对其他标志没有 影响 清进位标志指令的格式:CLC 该指令使cf=0 置进位标志指令的格式:STC 该指令使cf=1 进位标志取反指令的格式:CMC 该指令使进位标志取反,如cf=1,使用后cf=0 如cf=0,使用后cf=1 清方向标志指令的格式:CLD 该指令使df=0,从而在执行串操作指令时,使地址按递增方式变化 置方向标志指令的格式:STD 该指令使df=1,从而在执行串操作指令时,使地址按递减方式变化 清中断允许标志的格式:CLI 该指令使if=0,于是CPU就不响应来自外部装置的可屏蔽中断,但对不可屏蔽 中断和内部中断没有影响 置中断允许标志指令的格式:STI 该指令使if=1,则CPU可以响应可屏蔽中断 2.加减运算指令 加法指令 ADD 格式:ADD OPRD1,OPRD2 执行的操作OPRD1<---OPRD1+OPRD2 Eg:mov ax,7896H; ax=7896H 即AH=78H,AL=96H;各标志位保持不变 ADD AL,AH; AL=0EH, AH=78H 所以AX=780EH; cf=1,zf=0,sf=0,of=0,af=0,pf=0 Eg:add dx,0f0f0H 执行前dx=4652H 执行后dx=3742H zf=0,sf=0,cf=1,of=0 4652H+0f0f0H=13742H,有进位,所以把1进到cf中,即cf=1 Eg:add ax,4321 执行前ax=62a0H 执行后ax=a5c1H sf=1,zf=0,cf=0,of=1 加法指令影响标志位 2个正数相加得到负数,溢出标志of=1;2个负数相加得到正数,溢出标志 of=1 1个正数,一个负数相加,不管结果为正负,都没有溢出,of=0 of位则根据操作数的符号及其变化情况来设置;若两个操作数的符号相同而 结果的符号与之相反时of=1,否则of=0 cf位可以用来表示无符号数的溢出,由于无符号数的最高有效位只有数值意 义而无符号意义,所以从该位产生的进位应该是结果的实际进位值,但在有 限数范围内就说明了结果 带进位加指令 ADC 格式:ADC OPRD1,OPRD2 OPRD1<---OPRD1+OPRD2+CF Eg:下列指令序列执行2个双精度(32位)的加法,设目的操作数放在dx和ax 寄存器中,其中dx存放在高位字(高16位,ax中是低16位)。源操作数存放 在bx,cx中,其中bx存放高位字 执行前:dx=0002H ax=0f365H bx=0005H cx=0e024H 指令序列为:add ax,cx adc dx,bx 执行第一条指令后: ax=0d389H,sf=1,zf=0,cf=1,of=0 执行第二条指令后: dx=0008H, sf=0,zf=0,cf=0,of=0 则执行完后:dx=0008H,ax=0d389H 为实现双精度数加法,必须用两条指令分别完成 低位字和高位字的加法,而且在高位字相加时,应该使用adc指令以便把前一 条add指令作低位字加法所产生的进位值加入高位字之内。另外,带符号的双 精度数的溢出,应该根据adc指令的of位来判断,而作低位加法用的add指令 的溢出是无意义的,此指令影响标志位 加1指令INC 格式:INC OPRD 该条指令完成对操作数OPRD加1,然后把结果送回OPRD OPRD<---OPRD+1 操作数DST可以是通用寄存器,也可以是存储单元 这条指令执行的结果影响标志zf,sf,of,pf,af,但它不影响cf 该指令主要用于调整地址指针和计数器 Eg:写出把首地址为BLOCK的字数组的第6个字送到DX寄存器的指令 1.寄存器间接寻址 mov bx,offset block //offset为属性操作符,也可以写为lea bx,block add bx,000AH //因为是第6个字,中间隔有5个字,所以+000AH mov dx,[bx] //上条指令得到的只是bx的地址,需要取该地址的值 2.寄存器相对寻址 mov bx,offset block mov dx,[bx+000AH] =====================我是无敌分割线======================== 哇呀呀,最近的各种指令太多了,而且我简单的看过下后面的内容。 也会介绍很多指令啊~~和C语言不一样,汇编的这些指令以后就是构成我们编写程序的组成部分,所以需要好好记啊。 最近十分想找点汇编的基础练习题来练习和巩固下最近学习的知识,但是在网上找的题,要不是没有答案,要不是有答案没有详细解答。。这让我很是纠结~~ 求各位童鞋推荐点汇编的习题集来练练手~~或者直接给我下载地址。。 小弟感激不尽~ |
|
[调查]查查积分
看看啊,来看雪这么久了,转正路漫漫啊~~~ |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
中山大学-8 1.堆栈操作指令 在8086/8088系统中,堆栈是一段RAM(内存)区域 称为栈底的一端地址较大(高地址),称为栈顶的一端地址较小(低地址) 堆栈的段值在堆栈段寄存器SS中,堆栈指针寄存器SP始终指向栈顶。 堆栈以"后进先出"方式工作的一个存储去。堆栈的存取必须以!字!为单位 ,堆栈操作指令分为两种 【1】进栈指令push 格式:push src(源操作数) 执行操作:(sp)<---(sp)-2 该指令把源操作数src压入堆栈,它先把堆栈指针寄存器sp的值减2,然后把 源操作数src送入由sp所指的栈顶。 源操作数src可以是通用寄存器和段寄存器,也可以是字存储单元。 Eg:PUSH AX 物理地址=sp-2 【2】出栈指令pop 格式:pop dst(目的操作数) 执行操作(sp)<---(sp)+2 该指令从栈顶弹出一个字数据到目的操作数dst,它先把堆栈指针寄存器sp所 指的字数据送至目的操作数dst,然后sp+2 注意dst可以是通用寄存器和段寄存器(但cs例外),也可以是字存储单元 Eg:pop ax 物理地址=sp+2 以上两条指令push和pop只能做字操作,它们可以使用除立即数以外的其他寻 址方式。但pop指令不允许用cs寄存器,此两条指令不影响标志位。 应用:临时保存寄存器的内容,必要时再回复其原始内容。 push ax;保护ax push bx; ...; 其间程序用到ax和bx寄存器 pop bx;使ds的内容与cs的内容相同 pop ax;回复ax 数据交换的传送,交换,堆栈指令的3种方式: ax和si的内容交换 传送: mov bx,ax bx=ax mov ax,si ax=si mov si,bx si=bx 交换xchg(两个寄存器交换时最快): xchg ax,si 堆栈(两个字单元交换): push ax push si ... pop ax pop si 堆栈:si的值在栈顶,先出,所以先pop ax就让si的值赋给ax 在交代数据交换时这样写,如果一般情况下不能这样写 Eg:假设ss=2250H,sp=0140H,如果在堆栈中存入5个数据,栈顶物理地址是 多少?又从堆栈中取出3个数据,则栈顶的物理地址是多少? 未改变前=22500+0140=22640H 存入5个数据栈顶的物理地址为22640-0A=22636H 取出3个数据栈顶的物理地址为22636+6=2263CH 2.标志操作指令(识记) 【1】标志传送指令 属于数据传送指令组 指令LAHF采用固定寻址方式,格式: LAHF 该条指令把标志寄存器的低8位(包括sf,zf,af,pf和cf)传送到寄存器ah 的指定位 指令SAHF采用固定寻址方式,格式: SAHF 该指令和LAHF刚好相反,把寄存器AH的指定位送至标志寄存器的低8位的sf, zf,af,pf,cf,因而这些标志的内容就要受到影响,并取决于ah相应位的 状态,这条指令不影响溢出标志of,方向标志df,中断允许标志if和追踪标 志tf,也即不影响标志寄存器的高位字节。 Eg:mov ah,0c1H sahf; cf=1,pf=0,af=0,zf=1,sf=1 指令pushf,格式: pushf 该条指令把标志寄存器的内容压入堆栈,就是先把堆栈指针寄存器sp的值-2 ,然后把标志寄存器的内容送入由sp所指的栈顶 指令popf,格式: popf 该条指令把当前堆栈顶的一个字传送到标志寄存器,同时相应地修改堆栈指 针,就是把堆栈指针寄存器sp+2 这条指令和pushf指令一起可以保存和恢复标志寄存器的内容,就是保存和恢 复各标志的值,另外,这两条指令也可以用来改变追踪标志TF 为了改变tf标志,可先用pushf指令将标志压入堆栈,然后设法改变栈顶字单 元中的第8位(把整个标志寄存器看成是一个字),再用popf指令把该字弹回 到标志寄存器,这样其余的标志不受影响,而只有tf标志按需要改变。 ========================我是无敌分割线==================== 还好数据结构学习的不错。。今天学习的这些都十分轻松啊。。 不知道结合着后面的会怎么样,多花点时间把这2天没用学习的,都学回来~~ 加油 |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
万恶的下载需要KX,以前糊里糊涂的下了3个东西,白白浪费了我6个kx~~~ 等我成会员了,看我不把你们全下一遍,然后删掉。。 碎碎念一下 |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
啊呀呀,今天可能更新不鸟了。时间不够了呀,宿舍要断电了呢~~~ 明天我来更新笔记哈,希望对大家有用,大家一起进步~~ 还好过2天有运动会,可以好好的学2天了~~ |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
http://bbs.pediy.com/showthread.php?t=124346 我在最前面有提到哦~~ 你去看看,那上面很多资料的~一起加油吧!! |
|
[原创]汇编语言学习跟踪,正在学习汇编的新人们,进来一起进步吧~
额,我可不是一个轻易放弃的人哦,这2天有点事情~家里面要买房,所以从学校回到了家里面,都没时间上网的,不过放心,这2天我都有在看书。刚刚下午才到学校里面呢,放心,我会和你一起进步的~~~ |
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值