+ -
当前位置:首页 → 问答吧 → 这是怎么回事请问

这是怎么回事请问

时间:2011-02-14

来源:互联网

执行int 21h后,为什么会cs:ip跳转到一个不知名的地方?

如图

作者: zeussword   发布时间: 2011-02-14

看中断向量表

作者: Lactoferrin   发布时间: 2011-02-14

这是我的coding,没语法错误,那个debug实在不好使啊。。。我用它debug一个example,结果到int 21h还是跳转到一个不知名的地方。。但那个example运行良好啊。。求解释。。

stk segment stack
 db 128 dup(?)
 tos label word
stk ends

data segment
 arr1 db 25,53,22,89,0
 arr2 db 2,3,5,7,11,13,17
 msg db 'none$'
data ends

code segment

assume cs:code, ss:stk, ds:data
  thr equ 50

start: mov ax,stk
  mov ss,ax
  mov sp,offset tos
  mov ax,data
  mov ds,ax

  mov bx,0
  mov cx,0

count: mov dl,arr1[bx]

  mov ah,4 ;print arr1[bx]
  cmp dl,0
  je next1
  int 21h

  mov ah,2 ;print space
  mov dl,32
  int 21h
 
  inc bx
  inc cx
  jmp count


next1: mov ah,2 ;print enter
  mov dl,13
  int 21h

  mov bx,0
  push cx
  mov cx,0

compare: mov dl,arr1[bx]

  cmp dl,0 ;if end
  je next2

inc bx

  mov ah,4 ;print if less
  cmp dl,thr
jnl compare
int 21h

mov ah,2 ;print space
mov dl,32
int 21h

inc cx
jmp compare

next2: cmp cx,0 ;if none print none
  jne next3
  mov dx,offset msg
  mov ah,9
  int 21h

next3: mov ah,2 ;print enter
  mov dl,13
int 21h

mov bx,0
mov ax,0
mov cx,0
mov si,0

cnteven: mov bl,arr1[si] ;if end
  cmp bl,0
je next4

inc si ;jump next if odd
add bl,0
jpo cnteven

add ax,bx ;else add and jump back
inc cl
jmp cnteven

next4: div cl ;print quotient
  mov dl,al
mov ah,4
int 21h

mov dl,32 ;print space
mov ah,2
int 21h

mov dl,cl ;print number of evens
mov ah,4
int 21h

mov dl,13 ;print enter
mov ah,2
int 21h

mov di,0



isprime: mov al,arr1[di]  
  cmp al,0
  je ending

  mov cx,7
  mov si,0

s: mov bl,al
div byte ptr arr2[si]
cmp ah,0
je next5
mov al,bl
inc si
loop s

mov dl,al
mov ah,4
int 21h

mov dl,32
mov ah,2
int 21h

 

next5: inc di
  jmp isprime


ending: mov ah,4ch
  int 21h

code ends
end start


引用 1 楼 lactoferrin 的回复:

看中断向量表

作者: zeussword   发布时间: 2011-02-14

遇到int 21H的时候, 按P,不能按T。

作者: masmaster   发布时间: 2011-02-14