在看王爽的<汇编语言>时,13章int指令示例一
assume cs:code
code segment
start:mov ax, 3456
int 7ch
add ax, ax
adc dx, dx
mov ax,4c00h
int 21h
code ends
end start
编译后调度总在int 7ch处出错:NTVDM CPU遇到无效的指令
查了些资料,也没有解决问题。我想肯定不是王爽的问题,但自己的问题在哪里呢?
在书的此部分下面紧接着是:
assume cs:code
code segment
start:
mov ax,cs ;2552:0000 8CC8 MOV AX,CS
mov ds,ax ;2552:0002 8ED8 MOV DS,AX
mov si,offset sqr ;中断 ;2552:0004 BE2D00 MOV SI,002D
mov ax,0 ;2552:0007 B80000 MOV AX,0000
mov es,ax ;2552:000A 8EC0 MOV ES,AX
mov di,200h ;2552:000C BF0002 MOV DI,0200
mov cx,offset sqrend - offset sqr ;2552:000F B90800 MOV CX,0008
cld ;2552:0012 FC CLD
rep movsb ;2552:0013 F3 REPZ
mov ax,0 ;2552:0014 A4 MOVSB
mov es,ax ;2552:0015 B80000 MOV AX,0000
mov word ptr es:[7ch*4],200h ;2552:0018 8EC0 MOV ES,AX
mov word ptr es:[7ch*4+2],0 ;2552:001A 26C706F0010002 MOV [WORD ES:01F0],0200
;;;mov ax, 10H
;;;int 7ch
;;;add ax, ax
;;;adc dx, dx
mov ax,4c00h ;2552:0021 26C706F2010000 MOV [WORD ES:01F2],0000
int 21h ;2552:0028 B8004C MOV AX,4C00
;中断例程
sqr: mul ax ;push bp ;2552:002B CD21 INT 21 Terminate Process with Return Code
;mov bp,sp ;2552:002D 55 PUSH BP
;add [bp+2],bx ;2552:002E 8BEC MOV BP,SP
;pop bp ;2552:0030 015E02 ADD [BP+0002],BX
iret ;2552:0033 5D POP BP
sqrend: nop ;2552:0034 CF IRET
code ends ;2552:0035 90 NOP
end start
它们之间的联系是什么,当时还以为是两相互独立,不相干的程序
原来问题就在:
;设置中断向量
mov word ptr es:[7ch*4],200h
mov word ptr es:[7ch*4+2],0
阅读(4634) | 评论(0) | 转发(0) |