检测点10.5
(1)下面的程序执行后,ax中的数值为多少?
assume cs:code
stack segment
dw 8 dup (0)
stack ends
code segment
start: mov ax,stack
mov ss,ax
mov sp,16
mov ds,ax
mov ax,0
call word ptr ds:[0eh]
inc ax
inc ax
inc ax
mov ax,4c00h
int 21h
code ends
end start
ax = 3
(2)下面的程序执行后,ax和bx中的数值为多少?
assume cs:codesg
stack segment
dw 8 dup(0)
stack ends
codesg segment
start:
mov ax,stack
mov ss,ax
mov sp,10h
mov word ptr ss:[0],offset s ;(ss:[0])=1ah
mov ss:[2],cs ;(ss:[2])=cs
call dword ptr ss:[0] ;cs入栈,ip=19h入栈,转到cs:1ah处执行指令
;(ss:[4])=cs,(ss:[6])=ip
nop
s: mov ax,offset s ;ax=1ah
sub ax,ss:[0ch] ;ax=1ah-(ss:[0ch])=1ah-19h=1
mov bx,cs ;bx=cs=0c5bh
sub bx,ss:[0eh] ;bx=cs-cs=0
mov ax,4c00h
int 21h
codesg ends
end start