汇编学习历程(键盘中断劫持)

来源:互联网 发布:淘宝质量好的童装店 编辑:程序博客网 时间:2024/06/04 23:28

劫持键盘中断

本程序劫持9号中断,实现判断键盘输入修改屏幕颜色, R G B 键 分别修改 屏幕背景为红色  绿色 蓝色。


assume cs:code,ds:data,ss:stackcode segmentstart:mov ax,datamov ds,axmov ax,stackmov ss,axmov sp,16;set about segmentpush dspush cspop ds;chenge ds is csmov si,offset install_startmov ax,0mov es,axmov di,200hcld;set transmission direction is plusmov cx,offset install_end - offset install_start;set copy byte sizerep movsb;start copypop ds;recover dsmov ax,0mov es,axpush es:[36]pop es:[202h]push es:[38]pop es:[204h];save interrupted addressmov word ptr es:[36],200hmov word ptr es:[38],0;change interrupted addressmov ax,4c00hint 21hinstall_start:jmp okdb 'this is a test$'; this save former 9interrupted addressok:push dspush axpush bxpush dxpush espush cx;save segmentin al,60hpushfpushf pop bxand bh,11111100bpush bxpopfmov bx,0mov es,bxcall dword ptr es:[202h];call former 9interruptedmov bx,0b800h;set show seg addressmov es,bx;judge virtual codecmp al,13h;if redje redcmp al,22h;if greenje greencmp al,30h;if blueje bluejmp nred:mov al,47h;set red virtual codejmp egreen:mov al,27h;set green virtual codejmp eblue:mov al,17h;set blue virtual codee:mov cx,2000;set loop sizemov bx,1;set change addressr:mov byte ptr es:[bx],aladd bx,2loop rn:pop cx;recover segmentpop espop dxpop bxpop axpop dsiretinstall_end:nopcode endsdata segmentdb 'This Is A Test!!!'data endsstack segmentdw 8 dup(0)stack endsend start

原创粉丝点击