Professional Documents
Culture Documents
Conditional directives:
syntax
.data
.code
1-(if—else)
.If (condition eg. A<=5) note: red color are the keywords
--prog
.elseif (condition)
--prog
.else
--prog
.endif
2-(while)
.while (condition)
--prog
.endw
Eg:
Mov dl,65
.while a<10 ;code to print first 10 alphabets
inc a
mov ah,02h
int 21h
inc dl
.endw
2- (do..while)
.repeat
--prog
.until(condition)
________________________________________________________
File Handling:
int 21h
different regs are used along with the interrupts to access the file, eg when we use ah,02h for printing
we use dl, from which value is printed.
A file of type .txt is created withing the same bin folder, we then create an object of file in .asm file
mov dx, offset File ; Giving the path of our text file using the object we made
mov al,0 ; read only mode of opening file
mov ah,3dh
int 21h
mov dx,offset buffer ; using our variable (as string) to read the contents into it
mov ah,3fh ; interrupt to then read
int 21h
mov dx,offset buffer ;printing the contents
Mov ah,09h
int 21h
To close file:
Mov ah,3eh
int 21h