model small
.code
FILENAME DB "test.txt",0
BUFFER DB "00 10 20 30 40 50 60 70 80 90",'$'
BUFFLENG DB $-BUFFER ; get BUFFER size (number of bytes)
ERROR_WRITING DB "Error Writing To File$"
ERROR_CREATING DB "Error Creating File$"
start: ; program entry point
; prepare data segment
PUSH CS
POP DS
MOV AH,3Ch ; Create File Function Number
XOR CX,CX ; CX=file attribute (0=normal)
LEA DX,FILENAME ; dx point to file name buffer
INT 21h
JC ERRORC
MOV BX,AX
WRITEFILE:
MOV AH,40h ; read & write file function number
MOV CL,BUFFLENG ; number of byte
DEC CX ; eliminate to print '$' end string symbol
LEA DX,BUFFER ; dx point to bytes destination buffer byte
INT 21h ; do function
JC ERRORW ; if writing error (cf=1) do jmp
JMP EXIT
ERRORC:
MOV AH,09h
LEA DX,ERROR_CREATING ; print error msg
INT 21h
JMP EXIT
CLOSEFILE:
MOV AH,3Eh ; close file
INT 21h
JMP EXIT
ERRORW:
MOV AH,09h
LEA DX,ERROR_WRITING ; print error msg
INT 21h
EXIT:
MOV AH,4Ch ; close program
INT 21h
end startسؤال 1- شفتوا الأرقام اللي كتبتها في الملف كم اتعامل معها
يعني ودي أخلي البرنامج يسوي لها مثلا جمع ثم يقسمها على 10 مثلاً ؟؟
2- كيف ابحث عن الملف هذا اللي أنا كتبت عليه ثم تخرج لي رسالة هل هذا الملف موجود وإلا لا ؟؟
أفيدونا ....!!