【學習筆記】彙編:自己模擬內中斷函式設計
阿新 • • 發佈:2019-01-29
由於內中斷(int)事實上是呼叫預先存在記憶體中的函式,所以我們可以覆蓋掉原函式,自己完成內中斷函式的設計
DATAS SEGMENT ;此處輸入資料段程式碼 DATAS ENDS STACKS SEGMENT db 128 dup(0) STACKS ENDS CODES SEGMENT ASSUME CS:CODES,DS:DATAS,SS:STACKS START: MOV AX,DATAS MOV DS,AX MOV AX,STACKS MOV SS,AX MOV SP,128 CALL copy_new_7CH CALL set_new_7CH INT 7CH MOV AH,4CH INT 21H ;=============================================== new_7CH: MOV AX,1000H IRET end_new_7CH: ;=============================================== set_new_7CH: MOV BX,0 MOV ES,BX MOV word ptr ES:[7CH*4],7E00H MOV word ptr ES:[7CH*4+2],0 end_set_new_7CH: RET ;=============================================== copy_new_7CH: MOV AX,0 MOV ES,AX MOV DI,7E00H MOV AX,CS MOV DS,AX MOV SI,OFFSET new_7CH mov cx,OFFSET end_new_7CH - new_7CH cld rep movsb end_copy_new_7CH: ret ;=============================================== CODES ENDS END START