estxrah@warwick.ac.uk (Worm) (03/09/90)
I am trying to write a Command Line Editor as a TSR using MSC and MASM 4.0. I am using the small model which means the code is in the CS segment and everything else is put in a GROUP. This means when function 31h is executed space is reserved to hold the code in the CS segment. This means that anything used by a C library routine in the DS segment is likely to get corrupted. Does this mean that I have to write my own version of malloc to use the space specially reserved? Has anybody ever tried to do this sort of thing before ? The routines I use are something like this : main () { do_tsr () ; } In tsr.asm _do_tsr PROC NEAR ; Change int 21h to use my routine first (new_21) ; Calc space to save mov ax,3100h int 21h _do_tsr ENDP _new_21 PROC NEAR ; Save state ; Swap to my stack ; Put args on stack where dos buffer is located ie SEG and OFF call edit_cl ; Restore stack ; Restore state _new_21 ENDP In edit.c edit_cl () { /* Do the editing */ } Many thanks for any help, Stu estxrah@warwick.UUCP ** estxrah@uk.ac.warwick.cs ** estxrah@cs.warwick.ac.uk "She's not Ben Johnson, but then who is ?" - David Coleman