Assembler - Lesson 0: Installing the compiler and running the first program through DOSBox

In this course, it is planned to analyze the main features of programming on the simplest assembler implementation - TASM. Personally, this knowledge was enough for me to pass the computer perfectly at the institute and finish all laboratory work. Many lessons will have homework based on them.





First, let's install our old compiler.

Link





Why vk.com?

I understand perfectly well that this is the same collective farm to share files through VK discussions, but who knows what this small group may turn into in the future.





After unpacking the files, I advise you to save them in the Asm folder on the C drive in order to have less discrepancies with the material presented here.





To run the compiler, we also need a DOSBox emulator. He will revive all our components. Download and install it!

Link





In the Asm folder, I specially left the code.asm file. It is on it that we will practice running our program. I advise you to keep a copy of it, because all the code is stored there, which in 99% of cases will be present in each of your projects.





code.asm
s_s segment
s_s ends

d_s segment
d_s ends

c_s segment
assume ss:s_s, ds:d_s, cs:c_s
begin:
mov ax, d_s
mov ds, ax
mov ax, 0

	; Your code needs to be here

mov ah, 4ch
int 21h
c_s ends
end begin
      
      



So. We launch our DOSBox and see the following:





First, we need to mount the drive where you saved your Asm folder. I have this drive C, so I write the following command:





mount d: c:\asm
      
      



d: , . i s. C . .





, :





d:
      
      



dir, , . CODE ASM, .





! 20 , ? :





tasm code.asm
      
      



, OBJ.





:





tlink code.obj
      
      



– CODE.MAP   CODE.EXE. assembler.





, , , . , , .





td code
      
      



. …





F7 fn + F7 1 . , . , . β€œβ€ . .





CS

Code segment – , turbo debug . – TD 16- . - β€˜12’ 18, 12 β€˜C’. CS β€œBegin end.” Pascal main.





DS

Data segment, , TD. (char) . β€œHello, world”, , ASCII. DS VAR, Pascal. , .





SS

Stack segment – . , . , .





ax, bx, cx, si, di, ss, cs . . – , . , . Pascal Assembler , , . , , . .





c, z, s, o, p .. . , , , . . , , , .






- , , . , .





. .ASM, , code.asm code.obj code.exe.






:

  1. mount d: c:\asm – , – asm





  2. d: -





  3. tasm code.asm –





  4. tlink code.obj –





  5. td code – debug





  6. F7 –





, Assembler. , - . Habr .








All Articles