[org 0x0100]
jmp start
oldisr: dd 0 ; space for saving old ISR
; subroutine to clear the screen
clrscr: push es
push ax
push cx
push di
mov ax, 0xb800
mov es, ax ; point es to video base
xor di, di ; point di to top left column
mov ax, 0x0720 ; space char in normal attribute
mov cx, 2000 ; number of screen locations
cld ; auto increment mode
rep stosw ; clear the whole screen
pop di
pop cx
pop ax
pop es
ret
; keyboard interrupt service routine
kbisr: push ax
push es
push cx
push dx
mov ax, 0xb800
mov es, ax ; point es to video memory
in al, 0x60 ; read a char from keyboard port
cmp al, 0x22 ; has the g key pressed
jne nextcmp ; no, try next comparison
mov ax, 0x600 ; setting green background
mov bh, 0x2a ; attribute of color
mov cx, 0000h ; where the color starts to point
mov dx, 184fh ; where the color ends to point
int 10h
jmp exit ; leave interrupt routine
nextcmp: cmp al, 0x30 ; has the b key pressed
jne nocmp ; no, chain to old ISR
mov ax, 0x600 ; setting blue background
mov bh, 0x19 ; attribute of color
mov cx, 0000h ; where the color starts to point
mov dx, 184fh ; where the color ends to point
int 10h
jmp exit ; leave interrupt routine
nocmp: pop dx
pop cx
pop es
pop ax
jmp far [cs:oldisr] ; call the original ISR
exit: mov al, 0x20
out 0x20, al ; send EOI to PIC
pop dx
pop cx
pop es
pop ax
iret ; return from interrupt
start: call clrscr ; clear the screen
xor ax, ax
mov es, ax ; point es to IVT base
mov ax, [es:9*4]
mov [oldisr], ax ; save offset of old routine
mov ax, [es:9*4+2]
mov [oldisr+2], ax ; save segment of old routine
cli ; disable interrupts
mov word [es:9*4], kbisr ; store offset at n*4
mov [es:9*4+2], cs ; store segment at n*4+2
sti ; enable interrupts
mov dx, start ; end of resident portion
add dx, 15 ; round up to next para
mov cl, 4
shr dx, cl ; number of paras
mov ax, 0x3100 ; terminate and stay resident
int 0x21
plz share if somone has the solution
--
I Can't Promise To Solve Your All Problems
But I Can Promise That You Would Not Have To Face
Them Alone…
--
You received this message because you are subscribed to the Google Groups "Pak Youth" group.
To post to this group, send email to pak-youth@googlegroups.com.
To unsubscribe from this group, send email to pak-youth+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pak-youth?hl=en.
--
You received this message because you are subscribed to the Google Groups "Pak Youth" group.
To post to this group, send email to pak-youth@googlegroups.com.
To unsubscribe from this group, send email to pak-youth+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pak-youth?hl=en.
No comments:
Post a Comment