直接定址表:利用直接定址表的中断处理程序来源: 发布时间:星期四, 2009年2月12日 浏览:1140次 评论:0
;21:022007-7-5 \" align=top>assumecs:codesg \" align=top> \" align=top>datasgsegment \" align=top>endlEQU<0dh,0ah> \" align=top>function0dbendl,\"ThisInt7chfunctionis:$\" \" align=top>function1dbendl,\"(1)Cls$\" \" align=top>function2dbendl,\"(2)SetFrontColor$\" \" align=top>function3dbendl,\"(3)SetBackColor$\" \" align=top>function4dbendl,\"(4)ScrollUp$\" \" align=top>function5dbendl,\"(5)Exit$\" \" align=top>inputfdbendl,endl,\"PleaseInputfunctionnumber:$\" \" align=top>inputcdbendl,endl,\"PleaseInputcolor(0-8):$\" \" align=top>errorsdbendl,endl,\"InputError!PleaseInputthenumber(1-5),color(0-8)\",endl,endl,\'$\' \" align=top>datasgends \" align=top> \" align=top>stacksegment \" align=top>dw 16dup(0) \" align=top>stackends \" align=top> \" align=top>codesgsegment \" align=top> \" align=top>start: \" align=top>movax,stack \" align=top>movss,ax \" align=top>movsp,32 \" align=top>movax,datasg \" align=top>movds,ax ;/**//////////////////////////////////////////////// \" align=top>;安装7ch中断处理 \" align=top>movax,0 \" align=top>moves,ax \" align=top>cli \" align=top>movwordptres:[7ch*4],offscreen \" align=top>moves:[7ch*4+2],cs \" align=top>sti ; /**///////////////////////////////////////////////// \" align=top>7ch \" align=top> \" align=top>movax,4c00h \" align=top>21h \" align=top> ;/**///////////////////////////////////////////////// \" align=top>;7ch中断处理代码 \" align=top> \" align=top>screen: \" align=top>jmpshowfc \" align=top>table: \" align=top>dw0,sub1,sub2,sub3,sub4;直接定值表第个0为补充地址使得输入1sub1 \" align=top> \" align=top>showfc: \" align=top>pushax \" align=top>pushdx \" align=top>pushbx \" align=top>pushcx \" align=top> \" align=top>;显示功能提示[Page] \" align=top>showfc1: \" align=top>movah,9;21h9号功能为在标准输出上显示以$结尾串DS:DX指向串偏移地址 \" align=top>movdx,offfunction0 \" align=top>21h \" align=top>movdx,offfunction1 \" align=top>21h \" align=top>movdx,offfunction2 \" align=top>21h \" align=top>movdx,offfunction3 \" align=top>21h \" align=top>movdx,offfunction4 \" align=top>21h \" align=top>movdx,offfunction5 \" align=top>21h \" align=top> \" align=top>movdx,offinputf \" align=top>21h \" align=top> \" align=top>;提示输入功能号码 \" align=top>inputfc: \" align=top>movah,1 \" align=top>21h;21h1号功能为从标准输入(键盘)读取个ASCII码到al无输入时等 \" align=top>;待回显输入 \" align=top>subal,30h;输入数字ASCII码减30h转换为十进制值 \" align=top>movbh,al \" align=top>cmpbh,5;范围判断 \" align=top>jaerror \" align=top>cmpbh,5;5号功能为退出 \" align=top>jesret \" align=top>cmpbh, 0;范围判断 \" align=top>jberror \" align=top>cmpbh,2;如果是23号功能则提示输入颜色值 \" align=top>jeinputcolor \" align=top>cmpbh,3 \" align=top>jeinputcolor \" align=top>jmp \" align=top> \" align=top>inputcolor: \" align=top>movah,9 \" align=top>movdx,offinputc \" align=top>21h \" align=top>movah,1 \" align=top>21h \" align=top>subal,30h \" align=top>cmpal,8;范围判断 \" align=top>jaerror \" align=top>cmpal,0 \" align=top>jberror;范围判断 \" align=top> \" align=top>:[Page] movah,bh \" align=top>movbl,ah \" align=top>movbh,0 \" align=top>addbx,bx;根据输入功能号码来确定TABLE中子偏移地址 \" align=top>callwordptrtable[bx];子 \" align=top>jmp showfc1;功能循环 \" align=top> \" align=top>sret: \" align=top>popcx \" align=top>popbx \" align=top>popdx \" align=top>popax \" align=top>iret \" align=top> \" align=top>error: callsub1 \" align=top>movah,9 \" align=top>movdx,offerrors \" align=top>21h \" align=top>jmpshowfc1 \" align=top> \" align=top>sub1: \" align=top>pushbx \" align=top>pushcx \" align=top>pushes \" align=top>movbx,0b800h \" align=top>moves,bx \" align=top>movbx,0;显存偶数地址为 \" align=top>movcx,2000;显存页4000字节偶数字节为2000个 \" align=top>sub1s: \" align=top>movptres:[bx],\'\';用空格代替原先相当于清除原 \" align=top>addbx,2 \" align=top>loopsub1s \" align=top>popes \" align=top>popcx \" align=top>popbx \" align=top>ret \" align=top> \" align=top> \" align=top>sub2: \" align=top>pushbx \" align=top>pushcx \" align=top>pushes \" align=top>movbx,0b800h \" align=top>moves,bx \" align=top>movbx,1;显存奇数地址为颜色值 \" align=top>movcx,2000;显存页4000字节奇数字节为2000个 \" align=top>sub2s: \" align=top>andptres:[bx],11111000b;颜色值中012位为前景色RGB先清除掉 \" align=top>ores:[bx],al;再or上我们输入al值则得到我们需要前景色 \" align=top>addbx,2 \" align=top>loopsub2s \" align=top>popes \" align=top>popcx \" align=top>popbx \" align=top>ret \" align=top> \" align=top>sub3: \" align=top>pushbx \" align=top>pushcx \" align=top>pushes \" align=top>movcl,4 \" align=top>shlal,cl \" align=top>movbx,0b800h \" align=top>moves,bx \" align=top>movbx, 1 \" align=top>movcx,2000 \" align=top>sub3s: \" align=top>andptres:[bx],10001111b;颜色值中765位为背景色RGB \" align=top>ores:[bx],al \" align=top>addbx,2 \" align=top>loopsub3s \" align=top>popes \" align=top>popcx \" align=top>popbx \" align=top>ret \" align=top> \" align=top>sub4: \" align=top>pushcx \" align=top>pushsi \" align=top>pushdi \" align=top>pushes \" align=top>pushds \" align=top>movsi,0b800h \" align=top>moves,si \" align=top>movds,si \" align=top>movsi,160;显存页25行(0-24)160列(0-159)这里160为下行开头第列 \" align=top>movdi,0;上行开头SI,DI顺序递增~ \" align=top>cld \" align=top>movcx,24;只需要复制后面24行开头第行不要了 \" align=top>sub4s: \" align=top> pushcx \" align=top>movcx, 160;列数还是要够160这里是循环次数注意和上面区别 \" align=top>repmovsb \" align=top>popcx \" align=top>loopsub4s \" align=top> \" align=top>movcx,80;行160列偶数列为80偶数列也即是所在列 \" align=top>movsi,0 \" align=top>sub4s1: \" align=top>movptr[160*24+si],\'\';最后行上移了原来行要清除掉 \" align=top>addsi,2 \" align=top>loopsub4s1 \" align=top>popds \" align=top>popes \" align=top>popdi \" align=top>popsi \" align=top>popcx \" align=top>ret \" align=top> \" align=top>codesgends \" align=top>endstart [Page] 唉做个这么简单东西都要花这么长时间年轻人话估计有45分钟也就搞定调试完了 0
相关文章读者评论
发表评论 |