国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASM > 正文

匯編語言自定義int9中斷程序

2019-11-10 22:15:58
字體:
供稿:網(wǎng)友
代碼解釋如下:
;改變int9中斷例程改變它的中斷處理程序assume cs:codestack segment	db 128 dup(0)stack endscode segment	start:			mov ax,stack				mov ss,ax				mov sp,128				call cpy_new_int9							;復制自定義的int9程序				call save_int9								;保存原有的int9程序的入口地址:cs:ip				call set_new_int9							;設置中斷向量表loopInput:		mov ax,100h				jmp loopInput				call set_old_int9							;原來的int9的中斷程序入口地址恢復				mov ax,4c00h				int 21h;========================================================	;恢復int9本來的中斷向量表set_old_int9:	mov ax,0				mov es,ax				cli				mov Word ptr es:[9*4],[200h]				mov word ptr es:[9*4+2],[202h]				sti				ret;========================================================   ;設置新的中斷向量表set_new_int9:	push ax				push es								mov ax,0				mov es,ax				cli											;屏蔽外中斷				mov word ptr es:[9*4],7E00h				mov word ptr es:[9*4+2],0				sti				pop es				pop ax				ret;========================================================	;保存原來的int9中斷程序的地址,ip與cs到0000:0200處save_int9:		push ax				push es				mov ax,0				mov es,ax				cli				push es:[9*4]				pop es:[200h]				push es:[9*4+2]				pop es:[202h]				sti				pop es				pop ax				ret;========================================================	;新的int9中斷處理程序new_int9:		push ax				in al,60h									;讀取60h號端口接受到的一個掃描碼				pushf				call dword ptr cs:[200h]					;因為這段代碼是要復制到0000:0200h,所以cs = 0000,將原來的int9的中斷處理程序的地址保存到棧中				cmp al,3Bh									;按下的是否是F1鍵				jne new_int9Ret				call change_colornew_int9Ret:	pop ax				iret										;pop ip,pop cs,popf ,執(zhí)行完這句,cs:ip = 0000:0200h,程序其實就去執(zhí)行int9的中斷處理程序去了		;========================================================change_color:	push ax				push es				push cx				push bx								mov ax,0B800h				mov es,ax				mov cx,2000				mov bx,1changeColor:	inc byte ptr es:[bx]				add bx,2				loop changeColor								pop bx				pop cx				pop es				pop ax				retnew_int9End:	nop						;========================================================	;復制int9程序,將ds:si處的程序復制到es:di處,cpy_new_int9:	mov ax,cs				mov ds,ax				mov si,offset new_int9				mov di,7E00h				mov ax,0				mov es,ax				mov cx, offset new_int9End - offset new_int9	;復制的次數(shù)				cld											;cf  = 0 ,每次操作后si、di遞增				rep movsb				ret;========================================================			code endsend start
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 岐山县| 凉城县| 邵武市| 绥江县| 黄冈市| 衢州市| 科技| 平江县| 宁河县| 夏邑县| 洛扎县| 日照市| 杂多县| 抚州市| 洛宁县| 建水县| 敦煌市| 和政县| 军事| 婺源县| 通道| 大竹县| 松溪县| 桃江县| 县级市| 高台县| 高密市| 宝坻区| 广宗县| 包头市| 合肥市| 义乌市| 铁岭市| 白城市| 丰镇市| 白沙| 孝感市| 武强县| 武胜县| 犍为县| 兴隆县|