The lines of code below are borrowed from the print media. My focus is on the assembly; so by making use of these lines, iam trying to understand certain features of the assembly that are unclear to me. I was able to follow a few lines of code, and then going got tough.
.model small .code FNAME EQU 9Eh org 100h Start: mov ah, 4Eh mov dx, offset com_file int 21h search _lp: jc done mov ax, 3D01h mov dx, FNAME int 21h ; xchg ax, bx mov ah, bx mov cl, 42 mov dx,100h int 21h ; mov ah, 3Eh int 21h jmp search_lp Done: Ret Com_file db ‘*.com’ , 0 End start
The plan in the lines below is to *search for a .COM file so the Register must be set up before the Interrupt service routine is used to seek the help of DOS.
mov ah, 4Eh mov dx, offset com_file int 21h.
1. A value 4E hex is moved to ah register
2. The offset is moved to register DX
3. Interrupt service routine 21h used.
Result being successful, carry flag CF is set to 0, so the execution doesn’t jump to DONE but continues to next line; which is trying * To open the found file :
mov ax, 3D01h mov dx, FNAME int 21h
1. Now, 3Dh is moved to ah, and 01h to al
2. FNAME is moved to dx
…………………………….......Well, this is where I encountered my own interruption.
DX must point to the address of the file in memory, the file we have located ;the file that we want to open. How does that address (of the file that we want to open) is linked to a label!! How the FNAME is used here in this context is what that escapes me… Be kind enough to explain to enlighten the obscure part in my understanding...thank you.