Compiling source series of Calc

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.