汇编nop写成c语言

汇编nop写成c语言,第1张

刚学就要先学指令啊,每行就是一条指令,别那么着急,慢慢研究明白了指令就很容易看懂了。

d2:

dec const ;记录数减1

sub point,70 ;尾指针前移一个记录

cmp const,0 ;比较const和0的大小,设置标志

jz d4 ;判断标志位,ZF=1时,跳转到d4

lea dx,delmsg ;删除成功

call disply ;调用display

call separath ;调用separath

call disp ;显示所有记录

call separath ;调用separath

ret ;子程序返回

d3:

lea dx,empmsg ;存储空间为空

call disply ;调用display

ret ;子程序返回

d4:

lea dx,delmsg ;删除成功

call disply ;调用display

ret ;子程序返回

delete endp ;伪指令,删除子过程结束

;--------------------------------------

change proc near ;修改记录

mov errcde,0 ;把errcde赋值为0

cmp const,0 ;比较const和0的大小,设置标志位

jz c1 ;判断标志位,决定是否跳转到c1

call elecnam ;调用elecnam

cmp errcde,1 ;比较errcde和1的大小,设置标志位

jnz c2 ;判断标志位,决定是否跳转到c2

call separath ;调用separath

ret ;子程序返回

c2:

mov bx,dx

;把要修改记录的偏移地址保存在bx 中

call prochnum ;调用子程序

call prochnam ;调用子程序

call prochtel ;调用子程序

mov dx,bx ;相当于dx=bx

inc dx ;相当于 dx = dx +1

mov di,dx ;相当于di = dx

sub ch,ch ;相当于 ch - ch

call stors ;调用子程序

call separath ;调用子程序

call disp ;调用子程序

call separath ;调用子程序

ret ;子程序返回

c1:

lea dx,empmsg ;存储空间为空

call disply ;调用子程序

ret ;子程序返回

change endp ;伪指令,修改子过程结束

;--------------------------------------

search proc near ;查询记录

cmp const,0 ;比较const与0的大小,设置标志位

jz s4 ;判断标志位,决定是否跳转

lea dx,msg6 ;分配内存,dx=msg6

call disply ;调用子程序

s0:

mov ah,7 ;ah=7

int 21h ;调用21号中断,DOS中断

cmp al,'0' ;比较al和0,设置标志位

jnz s1 ;上一句结果不为0,则跳转到s1

call separath ;调用子程序

call disp ;调用子程序

call separath ;调用子程序

call elecnum ;调用子程序

call separath ;调用子程序

ret ;子程序返回

s1:

cmp al,'1' ;比较al和1,设置标志位

jnz s2 ;上一句结果不为0,则跳转到s2

call separath ;调用子程序

call disp ;调用子程序

call separath ;调用子程序

call elecnam ;调用子程序

call separath ;调用子程序

ret ;子程序返回

s2:

lea dx,ermsg ;分配存储空间,dx=ermsg

call disply ;调用子程序

jmp s0 ;跳转到s0

s4:

lea dx,empmsg ;存储空间为空

call disply ;调用子程序

ret ;子程序返回

search endp ;查找子过程结束

;--------------------------------------

;由键盘输入电话并把输入缓冲区的其余单元用空格填入

prochnum proc near ;伪指令,定义一个近进程

lea dx,msg3 ;分配存储空间 ,dx=msg3

call disply ;调用子程序

mov ah,0ah ;ah=0ah

lea dx,numpar ;分配存储空间,dx=numpar

int 21h ;调用DOS中断

cmp numlen,0 ;比较numlen和0,设置标志位

jne b1 ;不相等则跳转到b1

ret ;子程序返回

b1:

mov al,20h

;用空格填满剩余的单元

sub ch,ch ;ch=ch-ch

mov cl,numlen ;cl=numlen

lea di,numfld ;di=numfld

add di,cx ;di=di + cx

neg cx ;求补

add cx,16 ;cx = cx + 16

cld ;let df=0

rep stosb ;循环指令

call rcrlf ;回车换行

ret ;子程序返回

prochnum endp ;获取号码子过程结束

;--------------------------------------

;由键盘输入姓名并把输入缓冲区的其余单元用空格填入

prochnam proc near ;建立一个近的获取姓名的子过程

lea dx,msg4 ;dx = msg4

call disply ;调用子程序

mov ah,0ah ;ah=0ah

lea dx,namepar ;dx=namepar

int 21h ;调用DOS中断

cmp namelen,0 ;比较namelen 和0

jne b2 ;不相等跳转到b2

ret ;子程序返回

b2:

mov al,20h ;al=20h

sub ch,ch ;ch=ch-ch

mov cl,namelen ;cl=namelen

lea di,namefld ;di=namefld

add di,cx ;di=di + cx

neg cx ;求cx补码

add cx,20 ;cx = cx +20

cld ;清标志位

rep stosb ;循环

call rcrlf ;调用子程序

ret ;子程序返回

prochnam endp ;获取姓名子程序结束

;由键盘输入地址并把输入缓冲区的其余单元用空格填入

prochtel proc near ;建立一个近的子进程

lea dx,msg5 ;dx =msg5

call disply ;调用子程序

mov ah,0ah ;ah=0ah

lea dx,telpar ;dx=telpar

int 21h ;调用DOS中断

cmp tellen,0 ;比较tellen和0

jne b3 ;不相等跳到b3

ret ;调用子程序

b3:

mov al,20h ;al=20h

sub ch,ch ;ch = ch- ch

mov cl,tellen ;cl=tellen

lea di,telfld ;di=tellen

add di,cx ;di=di + cx

neg cx ;cx求补码

add cx,30 ;cx=cx+30

cld ;清标志位

rep stosb ;循环等待

call rcrlf ;调用子程序

ret ;子程序返回

prochtel endp ;获取地址输入子过程结束

;--------------------------------------

;把记录(序号)写入到内存单元array中

以上就是关于汇编nop写成c语言全部的内容,包括:汇编nop写成c语言、uchar readadx(void){ ADCON0 =ADCON0&(~(7<<2)); ADCON0|=(1<<2); // apply the new channel select asm(、请ASM汇编高手帮我翻译下每行句子的意思,,刚学不太懂。。等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9560498.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-29
下一篇2023-04-29

发表评论

登录后才能评论

评论列表(0条)

    保存