11111111111111
有点不懂,来看看
前来考古。
解法一:
assume cs:code
a segment
db 1, 2, 3, 4, 5, 6, 7, 8 ;即使a段不满16字节,也占用0-f内存空间。
a ends
b segment
db 1, 2, 3, 4, 5, 6, 7, 8 ;即使b段不满16字节,也占用10-1f内存空间。
b ends
k segment
db 0, 0, 0, 0, 0, 0, 0, 0 ;即使k段不满16字节,也占用20-2f内存空间。
k ends
code segment
start: mov ax,a
mov ds,ax ;将a段关联ds段。则使用偏移地址即可得到b、k段数据。
mov bx,0h ;编译器默认十进制。
mov cx,8
s:mov ax,0h
add al,
add al, ;b段在a段基础上偏移10H。
mov ,al ;k段在a段基础上偏移20H。
inc bx
loop s
mov ax, 4c00H
int 21H
code ends
end start ;代码33行。
解法二:
assume cs:code
a segment
db 1, 2, 3, 4, 5, 6, 7, 8 ;即使a段不满16字节,也占用0-f内存空间。
a ends
b segment
db 1, 2, 3, 4, 5, 6, 7, 8 ;即使b段不满16字节,也占用10-1f内存空间。
b ends
k segment
db 0, 0, 0, 0, 0, 0, 0, 0 ;即使k段不满16字节,也占用20-2f内存空间。
k ends
code segment
start:mov ax,a
mov ss,ax ;将a段关联ss段。
mov ax,b
mov es,ax ;将b段关联es段。
mov ax,k
mov ds,ax ;将k段关联ds段。因为要将结果存到k段中,
;所以k段关联ds段代码看起来更清爽。
mov bx,0
mov cx,8
s:mov al,ss: ;将a段数据赋予al中。
add al,es: ;将b段数据相加至al中
mov ,al ;将a、b段数据相加结果赋予k段中。
inc bx
loop s
mov ax,4c00h
int 21h
code ends
end start ;代码36行。
来学习
code segment
start: mov ax,a
mov ds,ax
mov ax,b
mov ss,ax
mov sp,16
mov bx,0
mov cx,8
s: push
add bx,2
loop s
mov ax, 4c00h
int 21h
code ends
感觉这样也是对的啊
学完了 但是 还是有点不理解 所以来看看
正在学习汇编
bnbcghb
很有用,谢谢
过来学习
dd
asd zhhc
看看标准答案!
第二个 只能用push
assume cs:code
a segment
dw 1,2,3,4,5,6,7,8,9,0ah,0bh,0ch,0dh,0eh,0fh,0ffh
a ends
b segment
dw 0,0,0,0,0,0,0,0
b ends
code segment
start:
mov ax,a
mov ds,ax
mov ax,b
mov ss,ax
mov sp,16
mov cx,8
mov bx,0
s:
push ds:
add bx,2
loop s
mov ax,4c00h
int 21h
code ends
end start
好好好
大力支持,学完了顺便做题巩固知识。
今天早点休息
8+8的时候al不会溢出吗?不会有影响吗?
学习了