So you're trying to install an ISR into Windows 7's DOS emulation? I'm guessing that would work better if you went the standard route. Something like:
Code:
org 100h
bits 16
old10h: jmp install
align 4
new10h:
; how about we just save the return values on stack?
pushf
call far [cs:old10h]
; if you get here, be happy
ret: sti
hlt
jmp ret
iret
install:
; OK, so CS must be initialized. What about DS?
mov ax, cs
mov ds, ax
mov ax, 2510h
int 21h
mov [old10h], bx
mov [old10h + 2], es
mov dx, new10h
int 21h
mov dx, (install + 15)/16
mov ax, 3100h
int 21h
That is the way most TSRs work, and what the Windows 7 DOS emulation is likely expecting: The program exits with the TSR function, instead of the normal exit function. The vector is read and written using DOS functions.
It is entirely possible that the DOS emulation in Windows 7 thinks all memory is free after the exit from your COM. Also, a few points of order:
1. On entry to the ISR, you can expect CS to be set up, but DS, ES, and SS are not (necessarily) set to the same value. Therefore, you must always use a CS override, or else switch DS to being equal to CS.
2. You don't have to push a return address yourself. A far call instruction does exist.