Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:15
CP/DOS DosSetSigHandler  mapper                             Page     1-1


				page 80,132
				
				title CP/DOS DosSetSigHandler  mapper
				
				        include msc.inc
 0000                        C	_DATA   SEGMENT WORD PUBLIC 'DATA'
 0000                        C	_DATA   ENDS
			     C	
 0000                        C	CONST   SEGMENT WORD PUBLIC 'CONST'
 0000                        C	CONST   ENDS
			     C	
 0000                        C	_BSS    SEGMENT WORD PUBLIC 'BSS'
 0000                        C	_BSS    ENDS
			     C	
 0000                        C	STACK   SEGMENT PARA PUBLIC 'STACK'
 0000                        C	STACK   ENDS
			     C	
			     C	DGROUP  GROUP   _DATA, CONST, _BSS, STACK
			     C	
			     C	
			     C	
				
 0000				dosxxx  segment byte public 'dos'
				        assume  cs:dosxxx,ds:nothing,es:nothing,ss:nothing
				
				;**********************************************************************
				;*
				;*   MODULE:   dossetsighandler
				;*
				;*   FILE NAME: dos007.asm
				;*
				;*   CALLING SEQUENCE:
				;*
				;*       push      word    file handle
				;*       push      dword   distance
				;*       push      word    move type
				;*       push@     dword   new pointer
				;*       call      doschgfileptr
				;*
				;*   MODULES CALLED:  PC-DOS Int 21h, ah=42h
				;*
				;*********************************************************************
				
				            public   dossetsighandler
				            .sall
				            .list
				
				str         struc
 0000  0000			old_bp      dw       ?
 0002  00000000			return      dd       ?
 0006  0000			Signumber   dw       ?          ; signal number
 0008  0000			Action      dw       ?          ; action code
 000A  00000000			Prevaction  dd       ?          ; previous action code
 000E  00000000			Prevadrs    dd       ?          ; previous vector address
 0012  00000000			Routineadrs dd       ?          ; interrupt handler address
 0016				str         ends
				
				; While we hate to do this, we have to.  The following data areas are
				; expected to be in the CODE segment.
				
 0000				NextControlBreakHandler         label   dword
 0000  00AA R			NextControlBreakHandlerOffset   dw      DummyControlBreakHandler
 0002  ---- R			NextControlBreakHandlerSegment  dw      dosxxx
				
 0004				NextCriticalErrorHandler        label   dword
 0004  00AB R			NextCriticalErrorHandlerOffset  dw      DummyCriticalErrorHandler
 0006  ---- R			NextCriticalErrorHandlerSegment dw      dosxxx
				
 0008				dossetsighandler  proc  far
				
				        Enter    dossetsighandler       ; push registers
				
 0014  8B 46 08			        mov      ax,[bp].action         ; get action code
 0017  3D 0002			        cmp      ax,2                   ; action code 2 ??
 001A  74 06			        je       continue1              ; branch if true
 001C  B8 0001			        mov      ax,1                   ; else, set error code
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:15
CP/DOS DosSetSigHandler  mapper                             Page     1-2


 001F  EB 3C 90			        jmp      exit                   ; return
				
 0022				continue1:
 0022  8B 46 06			        mov      ax,[bp].signumber      ; get signel number
 0025  3D 0001			        cmp      ax,1                   ; signal 1 (cntrl chara) ??
 0028  74 0B			        je       cntrlc                 ; jump if true
 002A  3D 0004			        cmp      ax,4                   ; signal 4 (cntrl chara) ??
 002D  74 06			        je       cntrlc                 ; jump if true
 002F  B8 0002			        mov      ax,2                   ; else, set error code
 0032  EB 29 90			        jmp      exit                   ; return
				
 0035  B8 3523			cntrlc: mov      ax,03523h
 0038  CD 21			        int      21h                    ; get old vector address
				
 003A  C5 76 0E			        lds      si,[bp].prevadrs       ; previous handler pointer
 003D  89 1C			        mov      word ptr [si],bx       ; save it in prevsdrs
 003F  8C 44 02			        mov      word ptr [si]+2,es
				
 0042  C5 56 12			        lds      dx,[bp].routineadrs    ; get address of signal  handler
				
 0045  2E: 89 16 0000 R		        mov     NextControlBreakHandlerOffset,dx   ; save it
 004A  2E: 8C 1E 0002 R		        mov     NextControlBreakHandlerSegment,ds
				
 004F  8C CA			        mov     dx,cs
 0051  8E DA			        mov     ds,dx
 0053  BA 006C R		        mov     dx,offset RealControlBreakHandler
				
 0056  B8 2523			        mov      ax,02523H
 0059  CD 21			        int      21h                   ; set signal handler addrs in vector
				
 005B  2B C0			        sub      ax,ax                 ; set good return code
				
 005D				exit:   mexit                          ; pop registers
 0069  CA 0010			        ret      size str - 6          ; return
				
 006C				dossetsighandler  endp
				
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:15
CP/DOS DosSetSigHandler  mapper                             Page     1-3


				        page
				
				;------------------------------------------------------------------------------
				
				; This routine will get control on  control break, and it will make
				;  sure that the environment is acceptable prior to calling the new
				;  handler.  NOTE: we expect the new handler to be written in MicroSoft 'C'
				
 006C				RealControlBreakHandler         proc    far
				
 006C  1E			        push    ds
 006D  06			        push    es
 006E  57			        push    di
 006F  56			        push    si
 0070  55			        push    bp
 0071  52			        push    dx
 0072  51			        push    cx
 0073  53			        push    bx
 0074  50			        push    ax
				
				; reestablish the es and ds segment registers before going to 'C'
				
 0075  B8 ---- R		        mov     ax,seg DGroup
 0078  8E D8			        mov     ds,ax
 007A  8E C0			        mov     es,ax
				
 007C  2E: FF 1E 0000 R		        call    NextControlBreakHandler
				
 0081  58			        pop     ax
 0082  5B			        pop     bx
 0083  59			        pop     cx
 0084  5A			        pop     dx
 0085  5D			        pop     bp
 0086  5E			        pop     si
 0087  5F			        pop     di
 0088  07			        pop     es
 0089  1F			        pop     ds
				
 008A  CF			        iret
				
 008B				RealControlBreakHandler         endp
				
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:15
CP/DOS DosSetSigHandler  mapper                             Page     1-4


				        page
				
				;------------------------------------------------------------------------------
				
				; This routine will get control on the control break, and it will make
				;  sure that the environment is acceptable prior to calling the new
				;  handler.  NOTE: we expect the new handler to be written in MicroSoft 'C'
				
 008B				RealCriticalErrorHandler        proc    far
				
 008B  1E			        push    ds
 008C  06			        push    es
 008D  57			        push    di
 008E  56			        push    si
 008F  55			        push    bp
 0090  52			        push    dx
 0091  51			        push    cx
 0092  53			        push    bx
 0093  50			        push    ax
				
				; reestablish the es and ds segment registers before going to 'C'
				
 0094  B8 ---- R		        mov     ax,seg DGroup
 0097  8E D8			        mov     ds,ax
 0099  8E C0			        mov     es,ax
				
 009B  2E: FF 1E 0000 R		        call    NextControlBreakHandler
				
 00A0  58			        pop     ax
 00A1  5B			        pop     bx
 00A2  59			        pop     cx
 00A3  5A			        pop     dx
 00A4  5D			        pop     bp
 00A5  5E			        pop     si
 00A6  5F			        pop     di
 00A7  07			        pop     es
 00A8  1F			        pop     ds
				
 00A9  CF			        iret
				
 00AA				RealCriticalErrorHandler        endp
				
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:15
CP/DOS DosSetSigHandler  mapper                             Page     1-5


				        page
				
				;------------------------------------------------------------------------------
				
 00AA				DummyControlBreakHandler        proc    far
				
 00AA  CF			                iret
				
 00AB				DummyControlBreakHandler        endp
				
 00AB				DummyCriticalErrorHandler       proc    far
				
 00AB  CF			                iret
				
 00AC				DummyCriticalErrorHandler       endp
				
				
				
 00AC				dosxxx      ends
				
				            end

Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:15
CP/DOS DosSetSigHandler  mapper                             Symbols-1


Macros:

		N a m e			Lines

ENTER  . . . . . . . . . . . . .  	   3
MEXIT  . . . . . . . . . . . . .  	   3
POPAL  . . . . . . . . . . . . .  	   9
PUSHAL . . . . . . . . . . . . .  	   9

Structures and Records:

                N a m e                 Width   # fields
                                        Shift   Width   Mask    Initial

STR  . . . . . . . . . . . . . .  	0016	0007
  OLD_BP . . . . . . . . . . . .  	0000
  RETURN . . . . . . . . . . . .  	0002
  SIGNUMBER  . . . . . . . . . .  	0006
  ACTION . . . . . . . . . . . .  	0008
  PREVACTION . . . . . . . . . .  	000A
  PREVADRS . . . . . . . . . . .  	000E
  ROUTINEADRS  . . . . . . . . .  	0012

Segments and Groups:

                N a m e         	Length	 Align	Combine Class

DGROUP . . . . . . . . . . . . .  	GROUP
  _DATA  . . . . . . . . . . . .  	0000	WORD	PUBLIC	'DATA'
  CONST  . . . . . . . . . . . .  	0000	WORD	PUBLIC	'CONST'
  _BSS . . . . . . . . . . . . .  	0000	WORD	PUBLIC	'BSS'
  STACK  . . . . . . . . . . . .  	0000	PARA	PUBLIC	'STACK'
DOSXXX . . . . . . . . . . . . .  	00AC	BYTE	PUBLIC	'DOS'

Symbols:            

                N a m e         	Type	 Value	 Attr

CNTRLC . . . . . . . . . . . . .  	L NEAR	0035	DOSXXX
CONTINUE1  . . . . . . . . . . .  	L NEAR	0022	DOSXXX

dossetsighandler . . . . . . . .  	F PROC	0008	DOSXXX	Global	Length = 0064
DUMMYCONTROLBREAKHANDLER . . . .  	F PROC	00AA	DOSXXX	Length = 0001
DUMMYCRITICALERRORHANDLER  . . .  	F PROC	00AB	DOSXXX	Length = 0001

EXIT . . . . . . . . . . . . . .  	L NEAR	005D	DOSXXX

NEXTCONTROLBREAKHANDLER  . . . .  	L DWORD	0000	DOSXXX
NEXTCONTROLBREAKHANDLEROFFSET  .  	L 0002	0000	DOSXXX
NEXTCONTROLBREAKHANDLERSEGMENT .  	L WORD	0002	DOSXXX
NEXTCRITICALERRORHANDLER . . . .  	L DWORD	0004	DOSXXX
NEXTCRITICALERRORHANDLEROFFSET .  	L 0002	0004	DOSXXX
NEXTCRITICALERRORHANDLERSEGMENT   	L WORD	0006	DOSXXX

REALCONTROLBREAKHANDLER  . . . .  	F PROC	006C	DOSXXX	Length = 001F
REALCRITICALERRORHANDLER . . . .  	F PROC	008B	DOSXXX	Length = 001F

@CPU . . . . . . . . . . . . . .  	TEXT  0101h		
@FILENAME  . . . . . . . . . . .  	TEXT  sighand		
@VERSION . . . . . . . . . . . .  	TEXT  510		


    266 Source  Lines
    290 Total   Lines
     40 Symbols

  47424 + 272492 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors
