First post, by llm
FYI: this is my very first DOS TSR after >30Years
its a reduced example of my NoUniVBE project that just contains my TSR install/uninstall
the program installs a TSR that hooks Interrupt 10h (doing nothing currently) and
uses some Interrupt 10h relative Data to finde itself for uninstalling (UniVBE does is alike and the detection Data will be much larger in the end)
i detect if the TSR is installed, recover the original int 10h vector entry and
free the memory with int 21h/49h
the problem is that after calling int 21h/49h dosbox waits for a kexpress (i think there is something very wrong in my code that produces this effect)
and the original int 10h seems to be not recovered after the uninstall because my install detection matches again
any idea?
; USAM or MASM; uasm.exe tsrint10.asm; ulink.exe -T16 -Tdc tsrint10.obj, tsrint10.com,tsrint10.map; or 16bit link.exe from microsoft.MODEL TINYPSP_BYTES = 100hFar_pointer strucoffs dw 0segm dw 0Far_pointer endsTSR_ID_STR EQU <"MyID">TSR_info_t strucsignature db TSR_ID_STRload_segment dw 0old_int10h Far_pointer<>TSR_info_t ends.CODEorg PSP_BYTESstart:jmp configure;====================================================; resident part;====================================================tsr_info TSR_info_t<>; resident codedetoured_int10h:pushfcall cs:tsr_info.old_int10hiretend_of_resident:;====================================================; configure part (not resident);====================================================PARAGRAPH_BYTES = 16RESIDENT_BYTES = end_of_resident - startRESIDENT_PARAGRAPHS = (PSP_BYTES + RESIDENT_BYTES + (PARAGRAPH_BYTES-1))/PARAGRAPH_BYTESTSR_INFO_DISTANCE = detoured_int10h - tsr_infoVIDEO_BIOS_INT = 10h ; 5h for testing
; configure datainstalled_msg db 'installed!',10,13,'$'uninstalled_msg db 'uninstalled!',10,13,'$'; configure codeconfigure:; is TSR installedmov ah,35hmov al,VIDEO_BIOS_INTcliint 21hstimov di,bxsub di,TSR_INFO_DISTANCE; es:di = tsr_info; exists TSR info signature?cldmov cx, sizeof(TSR_info_t.signature)mov si, offset(tsr_info.signature)repe cmpsbjne installjmp uninstallinstall:; safe old VIDEO BIOS interrupt handler ptrmov ah,35hmov al,VIDEO_BIOS_INTcliint 21hstimov [tsr_info.old_int10h.segm],esmov [tsr_info.old_int10h.offs],bx; install new handlermov ah,25hmov al,VIDEO_BIOS_INTpush dspush cspop dsmov dx,offset(detoured_int10h)cliint 21hstipop ds; safe load segment of TSRmov [tsr_info.load_segment],csmov dx,offset(installed_msg)mov ah,9hint 21h; stay residentmov dx,RESIDENT_PARAGRAPHSmov ah,31hmov al,0int 21huninstall:mov ah,35hmov al,VIDEO_BIOS_INTcliint 21hsti; es:di = tsr_infomov di,bxsub di,TSR_INFO_DISTANCE; install old handlermov ah,25hmov al,VIDEO_BIOS_INTpush dsmov ax,es:[di+TSR_info_t.old_int10h.segm]mov ds,axmov dx,es:[di+TSR_info_t.old_int10h.offs]cliint 21hstipop dsmov ah,49hmov ax,es:[di+TSR_info_t.load_segment]mov es,axint 21h; <<<<<<<<<<<<<<<<<< Dosbox waits here for a keypress?;<<<<<<<<<<<<<<<<<< and the recover of the old int 10h seems to not happenmov dx,offset(uninstalled_msg)mov ah,9hint 21hmov ax,4c00hint 21hend start