- [qingpengchen2011] 我的子程序是没错的,我在想是不是虚拟机的问题 08/08 12:17
- [qingpengchen2011] 嗯~行。我再认真详细看看,谢谢咯 08/08 10:38
- [tomato] 我运行了,不是地址的问题。也没有出现崩溃的现象,不过有的子程序功能好像不太对。子程序书中都有,建议你 08/07 22:07
- [tomato] 还是不行吗?我帮你看一下。 08/07 21:29
- [qingpengchen2011] table等标志的值都是在此安装程序中的偏移地址,所以那些子程序等等的地址都是要重新计算的。这点我倒 08/07 18:10
- [qingpengchen2011] table dw sub0-int7ch+200h,sub1-int7ch+200h,sub2-in 08/07 18:06
- [qingpengchen2011] table dw sub0-int7ch+200h,sub1-int7ch+200h,sub2-in 08/07 18:06
- [tomato] 结果也贴上来晾凉吧。 08/05 23:49
- [tomato] 我看不是死循环的问题,是子程序入口地址错了。告诉你一个解决思路,就是单步跟踪读取子程序地址那个地方, 08/05 23:45
- [tomato] 很有可能是你程序的问题,检查一下是不是死循环了。 08/05 23:41
[2011-08-04 23:33] 实验十六。这个实验基础完成,但是有一点不明白,就是我在虚拟机纯DOS下运行后,过一段时候,虚拟机就会崩溃,WHY。。。
code segment
start:
mov ax,code
mov ds,ax
mov si,offset int7ch
mov ax,0
mov es,ax
mov di,200h
mov cx,offset int7chend-offset int7ch
cld
rep movsb
cli
mov word ptr es:[4*7ch],200h
mov word ptr es:[4*7ch+2],0
sti
mov ax,4c00h
int 21h
;子程序说明如下
;(1)清屏
;(2) 设置前景色
;(3) 设置背景色
;(4)向上滚动一行
;入口参数说明
;(1) 用ah寄存器传递功能号:0表示清屏 1表示设置前景色 2表示设置背景色3表示向上滚动一行
;(2) 对于2 3 号功能,用al 传送颜色值,al 0~7
;------------------int 7ch
int7ch:
jmp short set
table dw sub0-int7ch+200h,sub1-int7ch+200h,sub2-int7ch+200h,sub3-int7ch+200h
set:
push bx
cmp ah,3
ja ok
mov bl,ah
mov bh,0
add bx,bx
call word ptr cs:[bx+202h]
ok:
pop bx
iret
;----------sub0======
sub0:
push bx
push es
push cx
mov bx,0b800h
mov es,bx
mov bx,0
mov cx,2000
sub0s:
mov byte ptr es:[bx],' '
add bx,2
loop sub0s
pop cx
pop es
pop bx
ret ;此子程序也是被调用的,所以同样要返回
;-----end
;-------sub1
sub1:
push es
push bx
push cx
mov bx,0b800h
mov es,bx
mov bx,1
mov cx,2000
sub1s:
and byte ptr es:[bx],11111000b
or es:[bx],al
add bx,2
loop sub1s
pop cx
pop bx
pop es
ret
;--------end ---sub1
;----sub2
sub2:
push es
push bx
push cx
mov cl,4
shl al,cl
mov bx,0b800h
mov es,bx
mov bx,1
mov cx,2000
sub2s:
and byte ptr es:[bx],10001111b
or es:[bx],al
add bx,2
loop sub2s
pop cx
pop bx
pop es
ret
;0-----end sub2
;00-----sub3
sub3:
push es
push di
push ds
push si
push cx
mov si,0b800h
mov es,si
mov ds,si
mov si,160
mov di,0
;mov cx,160*24
;cld
;rep movsb
mov cx,24
sub4:
push cx
mov cx,160
rep movsb
pop cx
loop sub4
mov cx,80
mov si,0
sub3s:
mov byte ptr es:[160*24+si],' '
add si,2
loop sub3s
pop cx
pop si
pop ds
pop di
pop es
ret
;-=-------end sub3
int7chend:nop
code ends
end start
[ tomato 发表于 2011-08-05 23:41 ]
很有可能是你程序的问题,检查一下是不是死循环了。
[ tomato 发表于 2011-08-05 23:45 ]
我看不是死循环的问题,是子程序入口地址错了。告诉你一个解决思路,就是单步跟踪读取子程序地址那个地方,看看是否能够正确找到你要调用的子程序。这个问题是一个比较深的知识点,很重要,所以,需要你自己一步步跟踪,彻底搞明白才是这道题目的意义。要有耐心啊!
[ qingpengchen2011 发表于 2011-08-07 18:06 ]
table dw sub0-int7ch+200h,sub1-int7ch+200h,sub2-int7ch+200h,sub3-int7ch+200h 子程序的入口地址我有重新计算过的。嗯。行,我单步跟踪看看,谢谢啦
[ qingpengchen2011 发表于 2011-08-07 18:06 ]
table dw sub0-int7ch+200h,sub1-int7ch+200h,sub2-int7ch+200h,sub3-int7ch+200h 子程序的入口地址我有重新计算过的。嗯。行,我单步跟踪看看,谢谢啦
[ qingpengchen2011 发表于 2011-08-07 18:10 ]
table等标志的值都是在此安装程序中的偏移地址,所以那些子程序等等的地址都是要重新计算的。这点我倒是明白,我的程序出现的问题是,如果你安装后并执行,是可以的- -。但是呢?在执行后,(可以正常执行的各个子程序)过一段时候,虚拟机就崩溃了。
[ tomato 发表于 2011-08-07 21:29 ]
还是不行吗?我帮你看一下。
[ tomato 发表于 2011-08-07 22:07 ]
我运行了,不是地址的问题。也没有出现崩溃的现象,不过有的子程序功能好像不太对。子程序书中都有,建议你跟书中的程序比对一下。最好要第二版。
[ qingpengchen2011 发表于 2011-08-08 10:38 ]
嗯~行。我再认真详细看看,谢谢咯
[ qingpengchen2011 发表于 2011-08-08 12:17 ]
我的子程序是没错的,我在想是不是虚拟机的问题