[Assembly] Combined with high-level language Assembly

Assembly can be combined with the high-level languages ​​such as Pascal, C / C , … when writing programs, in this article I just mentioned combined with Pascal Assembly

When combined with Pascal Assembly have 2 from: inserted directly into the asm file or write separate files.

1. Write the 1 file.
Inserting asm syntax:

asm
    lệnh
end;

Example: Count 2 integer a, b. Type in pascal and asm calculated.
Assembly combined with Pascal
So just run alone.

2. Write separated into files
Some rules:
+ The label sharing (constant name, variable name, subroutine name…) of Pascal and assembler files must understand each other through the use of control orders when trading program for Pascal and PUBLIC and EXTERNAL EXTRN for assembly
+ Any declaration of Pascal are shared should not need to declare more PUBLIC. Pascal was only two external reports for the subroutine is located in the external module
- The subroutine is a procedure the following declaration forms:
ten_thu_tuc procedure ([argument]); external;
- The subroutine is functional form, the following declaration forms:
function ten_thu_tuc ([argument]): type ; external;

Example: Calculate a ^ 2 – b(c-d). Enter a, b,c, d by Pascak, calculated by asm.
File A2_BC_D.pas và file calproc.asm như sau:
asm combined with Pascal

After 2 This file, you dịch file calproc.asm sang file obj placed in the directory C:TASM as the designated path $ L. Now Ctrl + F9 chạy file A2_BC_D.pas thôi.