|
主题 : : 实验9,交作业。 [已解决] |
回复[ 7次 ]
点击[ 319次 ] | |
|
|
|
|
[帖 主] [ 发表时间:2010-07-17 22:43 ] | |
荣誉值:16
信誉值:0
注册日期:2010-07-09 09:48 |
assume cs:codesg
data segment
db 'welcome to masm!'
data ends
codesg segment
start:
mov ax,data
mov ds,ax
mov ax,0b800h
mov es,ax
mov cx,10h
mov si,0h
mov di,0h
s:
mov bx,0h;找不到中间位置,只能用bx来代替了,郁闷中。
mov ah,02h
mov al,ds:[si]
mov es:[bx+40h+di],ax
add bx,0a0h
mov ah,24h
mov al,ds:[si]
mov es:[bx+40h+di],ax
add bx,0a0h
mov ah,71h
mov al,ds:[si]
mov es:[bx+40h+di],ax
mov bx,0b40h
inc si
add di,2h
loop s
mov ax,4c00h
int 21h
codesg ends
end start
感觉这个实验没能很好的总结前面的知识,因为jmp和jcxz这些指令都用不上,要不就是用在这里面比较便扭。不知c中的if、 else if的语句在汇编里面是咋整的? | | |
|
|
|
|
[第3楼] [ 回复时间:2010-07-17 23:31 ] | |
荣誉值:16
信誉值:0
注册日期:2010-07-09 09:48 |
再次改进,请教高手,这样用栈合法不??
assume cs:codesg
data segment
db 'welcome to masm!'
data ends
stacksg segment
dw 0,0,0,0
dw 16 dup(200h,2400h,7100h)
stacksg ends
codesg segment
start:
mov ax,data
mov ds,ax
mov ax,0b800h
mov es,ax
mov ax,stacksg
mov ss,ax
mov sp,8h
mov cx,10h
mov si,0h
mov di,0h
s:
mov dx,cx
mov cx,3h
mov bx,0h
s1: pop ax
mov al,ds:[si]
mov es:[bx+40h+di],ax
add bx,0a0h
loop s1
mov cx,dx
inc si
add di,2h
loop s
mov ax,4c00h
int 21h
codesg ends
end start | | |
|