Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

basic tsr and interrupt hooking

4 views
Skip to first unread message

mamn...@gmail.com

unread,
Apr 13, 2006, 3:52:58 PM4/13/06
to
hi everyone
i am a newbie in assembly.i hav to write a screensaver tsr. but my
problem is i cannot run any program where interrupt vector table is
changed.i searched internet last five hours but couldn't find a single
example that properly works in my pc.Is there any problem in xp as its
not pure dos?i am following "Ytha Yu" and "Charles Marut" s "Assembly
Language Programming and Organization of the IBM PC".Every code of this
book works except interrupt hooking and memory resident programs.can
anyone send me a small WORKING example using custom interrupt vector
table (like printing 'A' every second)?
Thanx in advance.
-==maMNun==-

Frank Kotler

unread,
Apr 15, 2006, 10:17:26 PM4/15/06
to
mamn...@gmail.com wrote:
> hi everyone
> i am a newbie in assembly.

Kewl! Learnin' stuff is fun... and you've got a lot to learn! :)

> i hav to write a screensaver tsr.

Sounds like homework...

> but my
> problem is i cannot run any program where interrupt vector table is
> changed.

Do you mean you can't get one to work, or it's not allowed by the
assignment?

> i searched internet last five hours but couldn't find a single
> example that properly works in my pc.

Which ones did you try?

Is there any problem in xp as its
> not pure dos?

I've never run XP. Might be... Can you boot to "real dos" and see if
your examples work there?

Does this help you any?

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B101921

> i am following "Ytha Yu" and "Charles Marut" s "Assembly
> Language Programming and Organization of the IBM PC".

I'm not familiar with the book... Sounds like it might be valuable to an
antique book dealer. :)

> Every code of this
> book works except interrupt hooking and memory resident programs.

Well, maybe it *is* a problem with XP...

> can
> anyone send me a small WORKING example using custom interrupt vector
> table (like printing 'A' every second)?

I don't have such a thing on hand - not "working" on XP, for sure. How
are you trying to print the 'A'? "Direct to screen" should work,
although that may be flukey in XP... Dos or bios interrupts may have
"reentrancy" problems. You hooking int 8 or 1Ch?

Read over this material, if you haven't, and see if it helps you figure
it out.

http://webster.cs.ucr.edu/AoA/DOS/ch18/CH18-1.html

Good Luck,
Frank

Rod Pemberton

unread,
Apr 16, 2006, 1:29:46 PM4/16/06
to

<mamn...@gmail.com> wrote in message
news:1144957978.1...@e56g2000cwe.googlegroups.com...

> hi everyone
> i am a newbie in assembly.i hav to write a screensaver tsr.

Fine.

> but my
> problem is i cannot run any program where interrupt vector table is
> changed

Why? If you are running under real mode MS-DOS, changing the interrupt
table isn't any problem. This sounds like you are running under a dos
emulator, perhaps WinXP?

> .i searched internet last five hours but couldn't find a single
> example that properly works in my pc.

How are you trying to run them? Why or how do they fail?

> Is there any problem in xp as its
> not pure dos?

Yes. WinXP uses an emulates DOS. There are many unsupported features.
It's likely that TSR's are one of them.

> can
> anyone send me a small WORKING example using custom interrupt vector
> table (like printing 'A' every second)?

Yes. The following will change the color of the upper left corner of a text
screen everytime the timer tick interrupt is called.


; Assemble with NASM, portion of TSR code ported from NBASM example
; nasm -f bin -o tsr.com tsr.asm

BITS 16
ORG 0x100

SECTION .text

start: jmp install

olddosint: dw 00h,00h

newdosint: cli ; put TODO stuff here
push es
push word 0B800h
pop es

inc byte [es:1] ; set colors

nowait: pop es
jmp far [cs:olddosint] ; jmp to old interrupt

install: mov ax,3508h ; get old interrupt vector
int 21h

mov [olddosint],bx
mov [olddosint+2],es

push cs
pop ds
mov dx,newdosint ; set new interrupt vector
mov ax,2508h
int 21h

mov es,[cs:002Ch] ; free environment block
mov ah,49h
int 21h

mov dx,install ; get paragraphs needed
sub dx,start
shr dx,04
add dx,byte 17 ; add 16 paras for PSP + 1 extra
mov ax,3100h ; termination and stay resident
int 21h

HTH,

Rod Pemberton

Frank Kotler

unread,
Apr 16, 2006, 1:58:55 PM4/16/06
to
Rod Pemberton wrote:
> <mamn...@gmail.com> wrote in message
> news:1144957978.1...@e56g2000cwe.googlegroups.com...

...


>>Is there any problem in xp as its
>>not pure dos?
>
> Yes. WinXP uses an emulates DOS. There are many unsupported features.
> It's likely that TSR's are one of them.

Aha! Then Mamnun probably *does* want to boot to "real dos"! A quick
google for "bootdisks" turns up a number of sources for floppy images
that should do the job...

Thanks for the example!

Best,
Frank

Rod Pemberton

unread,
Apr 16, 2006, 3:03:09 PM4/16/06
to

"Frank Kotler" <fbko...@comcast.net> wrote in message
news:fsmdnTKRxYi...@comcast.com...

Yes that's a good idea for him. Locate a bootdisk for MS-DOS 6.22 or 7.10,
or Freedos and try the example I posted. It should run properly under real
mode dos, Win95/98/SE/ME, but probably not under *nix flavored Win2k/XP/NT
etc.

> Thanks for the example!
>

I've got dozens based off that template for just about every DOS interrupt,
interrupt combinations, LFN's, etc. etc... I've found it to be very useful
especially with a good hex print routine. :-)


Rod Pemberton


0 new messages