but it doesn't work and the system block
Could someone help me please?
On 4 Feb 1999 15:27:24 GMT, Emanuele Bianchi
> i need an help about asm 8086, here's the problem:
>i'm patching the timer interrupt 1ch ,because i'm writing a TSR program
>that works lik an allarm-clock , so i have to check the current time with
>the time that the user have decided.
>when the two values are different the program jump to the old interrupt
>routine .
>here' the "exit and wait for correct time" code
>wait : pop es
> pop ds
> pop di
> pop si
> pop dx
> pop cx
> pop bx
> pop ax
> sti
> jmp cs:savint1c
>but it doesn't work and the system block
>Could someone help me please?
It probably doesn't work because the original interrupt address is
a double word, but "jmp cs:savint1c" assembles by default to a single word
value. Try "jmp dword ptr cs:savint1c".
--Donald Davis
The error is one the jmp instruction.
It depends on the compiler you are using.
in NASM you would write: JMP FAR [CS:savint1c]
in MASM it would be JMP CS:DWORD PTR [CS:savint1c]
I think the same that works with MASM works with most of the assemblers.
If you are not using NASM, try the MASM way, and if it doesn't work, try
something like JMP FAR CS:[savint1c]
/ Andreas Katsiapis
This is not correct. The instruction assembles to match the size of the
operand. Only if savint1c is declared as a word does the assembler do as
you indicate.
n.b. the sti is redundant -- int 1c is called by the timer chip handler with
interrupts enabled. What does your program do if the times match???
Eventually it must IRET, either directly, or by jumping to the previous int
1c handler.
>hi
> i need an help about asm 8086, here's the problem:
>i'm patching the timer interrupt 1ch ,because i'm writing a TSR program
>that works lik an allarm-clock , so i have to check the current time with
>the time that the user have decided.
>when the two values are different the program jump to the old interrupt
>routine .
>here' the "exit and wait for correct time" code
>wait : pop es
> pop ds
> pop di
> pop si
> pop dx
> pop cx
> pop bx
> pop ax
> sti
> jmp cs:savint1c
>
>but it doesn't work and the system block
>Could someone help me please?
>
Someone already suggested 'jmp dword ptr cs:savint1v', but have you
considered using int 1A AH=06 and letting the BIOS do the checking for
you?
--
Simon van Dongen <sg...@xs4all.nl> Rotterdam, The Netherlands
As he reclined there he sang ballads of ancient valour, from
time to time beating a hollow wooden duck in unison with his
voice, so that the charitable should have no excuse for
missing the entertainment. -Bramah, Kai Lung's Golden Hours
>DONALD G. DAVIS <dgd...@nyx10.nyx.net> wrote in message
>news:79cp1o$42c$1...@winter.news.rcn.net...
>>Emanuele Bianchi <emb...@komodo.ing.unico.it> writes:
>>
>>> i need an help about asm 8086, here's the problem:
>.........
>>> sti
>>> jmp cs:savint1c
>>
>>>but it doesn't work and the system block
>>>Could someone help me please?
>>
>> It probably doesn't work because the original interrupt address is
>>a double word, but "jmp cs:savint1c" assembles by default to a single word
>>value. Try "jmp dword ptr cs:savint1c".
>> --Donald Davis
>This is not correct. The instruction assembles to match the size of the
>operand. Only if savint1c is declared as a word does the assembler do as
>you indicate.
You are right; I apologize for my inaccuracy. I had tested the
two forms by assembling a test program under MASM 5.1, then disassembling
with CodeView. The "jmp cs:..." assembled an instruction reported by
CodeView as "jmp word ptr cs:..." However, I had made the declaration in
the form "savint1c dw ?,?" When I replaced that with "savint1c dd ?",
CodeView reported it as "jmp dword ptr cs:..." as you stated.
--Donald
Int 1ch is for applications, not for TSRs. TSRs should hook int 8. The
reason is that an application has no duty to chain int 1ch. So if you
use int 1ch in a TSR you may lose the interrupt when an application is
running.
Osmo
IMHO you should chain *any* and *every* interrupt that you're trying to
hook rather than replace.
- Benjamin.
[ ... ]
> IMHO you should chain *any* and *every* interrupt that you're trying to
> hook rather than replace.
Definitely NOT true. For example, if you want to spawn a DOS
application, and display its output in a window, you can _replace_ int
29h to do so. If you chain to the original int 29h handler as well,
you'll cause all sorts of havoc, and you definitely WON'T get what you
want on the screen.
As I understand the only reason for int 1ch to exist is that one does
not have to chain it. As there is only one application active at a time
then not chaining does not cause harm. In anyway one should ĺprepare for
the fact that applications do not chain and therefore not use the
interrupt in TSRs.
Also there are cases where not chaining is perfectly valid. For example
divide by zero or overflow exceptions.
Osmo
I'll re-iterate what I said above - that you should chain interrupts that
you're trying to hook, rather than replace. Obviously those interupts that
your trying to replace shouldn't chain through. However, in the example/
question that started this thread, I'm fairly sure that the user wanted to
hook the interrupt.
- Benjamin.