急!!汇编:程序1.把ax寄存内容分4组每组4位,然后把这4组数分别放在AL,BL,CL,DL中

来源:百度知道 编辑:UC知道 时间:2024/06/03 19:28:14
2、2个5字节的16进制数相加
3、计算1到100的累加和。
我后天就考试了由于汇编学的太垃圾!请各位大侠帮帮忙啊!100分作为回谢

;1.把ax寄存内容分4组每组4位,然后把这4组数分别放在AL,BL,CL,DL中
assume cs:code
code segment
start:
mov ax,1234h
mov bx,ax
mov cx,ax
mov dx,ax
and al,0fh ;al中是4
mov cl,4
shr bl,cl ;bl中是3
and ch,0fh ;ch中是2,先存在这,最后再给cl
mov cl,4
shr dh,cl
mov dl,dh ;dl中是1
mov cl,ch
mov ax,4c00h
int 21h
code ends
end start
;----------------------------------
;2个5字节的16进制数相加,假设12345678ABh+23456789CDh
assume cs:code
code segment
start:
mov dx,12h ;高8位
mov bx,3456h ;中16位
mov ax,78ABh ;低16位.共40位即5个字节.

add ax,89CDh ;低位相加
adc bx,4567h ;中位相加
adc dx,23h ;高位相加
;结果就在dx,bx,ax三个寄存器中.

mov ax,4c00h
int 21h
code ends
end start
;-------------------------------------
;计算1到100的累加和。
assume cs:code
code segment
start:
xor ax,ax ;清0
xor bx,bx ;清0
mov cx,100
begin:
inc bx
add