This is the past DOS era of the compilation of source code, although has passed, but for the study of the assembly is still helpful, assembly language is just a basic programmer language, most people can grasp, not necessarily in-depth research.
PAGE, 132
TITLE CALC
Cgroup GROUP codeseg
Codeseg SEGMENT PARA Public ' CODE '
Assume Cs:cgroup,ds:cgroup,es:cgroup
Public CALC
ORG 100H
CALC PROC FAR
JMP START
;---------------------------------------------------------------------;
; ;
; DATA area;
; ;
;---------------------------------------------------------------------;
DB ' INTERRUPT number = '
Int_number DB 61h
Screen_handle DW 0001h
Message DB ' Pemath isn't resident ', 13,10
Message_len EQU $-message
TAG DB ' Pemath '
Tag_len EQU $-tag
;---------------------------------------------------------------------;
; ;
; CODE area;
; ;
;---------------------------------------------------------------------;
START:
;---------------------------------------------------------------------;
; TEST for PRESENCE of CALCULATOR;
;---------------------------------------------------------------------;
SUB Ax,ax
MOV Es,ax
SUB BH,BH
MOV Bl,int_number
SHL bx,1
SHL bx,1
MOV DI,ES:[BX]
MOV Es,es:[bx+2]
ADD di,4
LEA Si,tag
MOV Cx,tag_len
Repe CMPSB
JE Call_calc
MOV Bx,screen_handle
MOV Cx,message_len
LEA Dx,message
MOV ah,40h
INT 21h
JMP Short Calc_exit
;---------------------------------------------------------------------;
; Call CALCULATOR;
;---------------------------------------------------------------------;
Call_calc:
MOV Al,int_number
MOV BYTE PTR Int_code,al
DB 0CDh; Int
Int_code:
DB 00h
NOP
NOP
Calc_exit:
INT 20h
CALC ENDP
Codeseg ENDS
End CALC