TITLE ESR Handling routines .MODEL LARGE ;The macros.asm file is included in order to provide macro ;definitions. These macros aid in defining the symbol names ;to support the different compilers. ; include macros.asm MPublicDataDef ReceiveESRHandler MExternProcDef ProcessReceivedData MPublicDataDef GotConnection MExternProcDef SetConnId .DATA ; The stack segment and pointer will have to be saved as you should ; setup your own stack. stk_seg dw 0 ; variable to store old stack segment stk_ptr dw 0 ; variable to store old stack pointer ; new_stk dw 512 dup (0) ; new stack of a 1000 bytes in length new_stk dw 128 dup (0) ; new stack of 256 bytes in length stk_end dw 0 ; The end of the stack .CODE ; @datasize is TRUE if the model is MEDIUM or LARGE and FALSE if the model ; is SMALL or COMPACT. Just modify the .MODEL ???? above ; for the model you want. es/si contains the seg/offset of the currently ; used ECB that ProcessReceivedData needs to process. MProcDefFar ReceiveESRHandler mov ax,DGroup mov ds,ax mov stk_seg,ss ; Save the stack segment mov stk_ptr,sp ; Save the stack pointer mov ax,ds mov ss,ax ; move segment of new_stk into SS mov sp,offset stk_end ; move offset of new_stk to SP IF @datasize push es ENDIF push si MCallDef ProcessReceivedData mov ss,stk_seg ; Restore old stack segment mov sp,stk_ptr ; Restore old stack pointer retf MProcEnd ReceiveESRHandler MProcDefFar GotConnection mov ax,DGroup mov ds,ax mov stk_seg,ss ; Save the stack segment mov stk_ptr,sp ; Save the stack pointer mov ax,ds mov ss,ax ; move segment of new_stk into SS mov sp,offset stk_end ; move offset of new_stk to SP IF @datasize push es ENDIF push si MCallDef SetConnId mov ss,stk_seg ; Restore old stack segment mov sp,stk_ptr ; Restore old stack pointer retf MProcEnd GotConnection ; END