; TSR Program to change the background color of DOS when key is pressed
[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
[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
On Thu, Jun 9, 2011 at 10:10 AM, wafiullah naeemzi <wnaeemzi@gmail.com> wrote:
plz br help me in cs401On Thu, Jun 9, 2011 at 8:58 AM, mc100401317 Razia Sultana <mc100401317@vu.edu.pk> wrote:
mery pass jo file hy wo execute nahi ho rahi hy plz send me execute able file--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en
Management: https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing: https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group: http://groups.google.com/group/askari_mis?hl=en
--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en
Management: https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing: https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group: http://groups.google.com/group/askari_mis?hl=en
No comments:
Post a Comment
PLEASE COMMENT ABOUT YOUR VISIT AND MY SITE
Note: Only a member of this blog may post a comment.