汇编语言自制7ch号中断,实现清屏,改变前景色后景色等功能,可是测试后发现没有效果
assume cs:codesg,ss:stacksg
stacksg segment
db 128 dup(0)
stacksg ends
codesg segment
start:
mov ax,stacksg
mov ss,ax
mov sp,128
;install
mov ax,cs
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
mov ax,0
mov es,ax
mov es:[7ch*4], 200h
mov es:[7ch*4+2],0
mov ax,0204H
int 7ch
mov ax,4c00h
int 21h
int7ch: ;ah功能号
jmp short int7chmain
table dw offset clscreen-offset int7ch+200h
dw offset setfront-offset int7ch+200h
dw offset setbackground-offset int7ch+200h
dw offset rollup-offset int7ch+200h
int7chmain:
push bx
cmp ah,4
ja int7chret
mov bh,0
mov bl,ah
jmp word ptr cs:[bx+202h]
clscreen:
push ds
push si
push ax
push cx
mov ax,0b800h
mov ds,ax
mov si,0
mov cx,80*25
clscreenloop:
mov byte ptr ds:[si],' '
add si,2
loop clscreenloop
pop cx
pop ax
pop si
pop ds
jmp int7chret
setfront: ;al 颜色
push ds
push si
push ax
push cx
mov ax,0b800h
mov ds,ax
mov si,1
mov cx,80*25
setfrontloop:
and byte ptr ds:[si],11111000b
or byte ptr ds:[si],al
add si,2
loop setfrontloop
pop cx
pop ax
pop si
pop ds
jmp int7chret
setbackground:
push ds
push si
push ax
push cx
mov ax,0b800h
mov ds,ax
mov si,1
mov cx,80*25
setbackgroundloop:
and byte ptr ds:[si],00011111b
shl al,1
shl al,1
shl al,1
shl al,1
or byte ptr ds:[si],al
add si,2
loop setbackgroundloop
pop cx
pop ax
pop si
pop ds
jmp int7chret
rollup:
push ds
push si
push es
push di
push ax
push cx
mov ax,0b800h
mov ds,ax
mov es,ax
mov si,160
mov di,0
mov cx,160*24
cld
rep movsb
pop cx
pop ax
pop di
pop es
pop si
pop ds
jmp int7chret
int7chret:
pop bx
iret
int7chend:nop
codesg ends
end start