Documente Academic
Documente Profesional
Documente Cultură
programului
; Sarcina de proiectare
; CR-191. Testarea2.
;
==================================================================
================
; Creare File / Dirr. Copiere File, Vizuare File, Stergere File / Dirr. ....
; R-Read File; W-Wtite File; C-Create; D-Delete_File; T-Input Text; F-afisare contiut File;
; L-Close; P-Copeie File to File; N- Rename File;M - Creare Dir; I - Trecere in directoriu;
; U - Sterge directoriu;
; Q - termitarea programului.
;
==================================================================
================
org 100h
jmp start
dir1 db "c:\test3", 0
dir2 db "c:\test2", 0
dir3 db "c:\newname", 0
file1 db "c:\file1.txt", 0
file2 db "c:\newfile.txt", 0
file3 db "c:\t1.txt", 0
handle dw ?
text db "Datele pentru inscriere in fisier: Text1, Text1, Grupa CR-191, $ "
text_student1 db 0Dh, 0Ah, "Studentul Grupei CR-191. Ilies Victor ...: $"
erroare db 0Dh, 0Ah, "S-a comis o eroare in procesul executarii programului, $"
COM db ?
start:
mov ax, cs
mov dx, ax
mov es, ax
MOV AH, 9
INT 21h
MOV AH, 9
INT 21h
Repeat:
MOV AH, 9
INT 21h
INT 16h
MOV COM, AL
JE Read_File
JE Create_File
JE Create_Dir
JE Write_File
JE Delete_File
JE New_Text
JE New_File
JE Quit
MOV AH, 9
INT 21h
DEC BP
JNZ Repeat
Read_File:
MOV AH, 9
INT 21h
DEC BP
JMP Repeat
Create_Dir:
; create c:\emu8086\vdrive\C\test1
int 21h
MOV AH, 9
INT 21h
DEC BP
JMP Repeat
Create_File:
mov cx, 0
jc err
mov handle, ax
MOV AH, 9
INT 21h
DEC BP
JMP Repeat
Write_File:
mov cx, 0
int 21h
jc err
mov handle, ax
; write to file 1:
int 21h
; write to file 2:
mov ah, 40h
int 21h
; close c:\emu8086\vdrive\C\test1\file1.txt
int 21h
MOV AH, 9
INT 21h
DEC BP
JMP Repeat
Delete_File:
int 21h
MOV AH, 9
INT 21h
DEC BP
JMP Repeat
err:
MOV AH, 9
INT 21h
nop
MOV AH, 9
INT 21h
New_Text:
jmp m1
msg1 db 0Dh, 0Ah, "Introduceti Textul Nou pentru inscriere in File: $"
mov ah, 9
int 21h
; input a string:
int 21h
DEC BP
JMP Repeat
New_File:
jmp m2
mov ah, 9
int 21h
; input filename:
int 21h
xor bx, bx
mov filename[bx+2], 0
mov cx, 0
int 21h
jc err
mov handle, ax
int 21h
jc err
; close file
int 21h
jc err
DEC BP
JMP Repeat
Quit:
RET
;;
;;
; create c:\emu8086\vdrive\C\test1
mov dx, offset dir1
int 21h
; create c:\emu8086\MyBuild\test2
int 21h
int 21h
mov cx, 0
int 21h
jc err
mov handle, ax
; write to file:
int 21h
; close c:\emu8086\vdrive\C\test1\file1.txt
int 21h
int 21h
int 21h
int 21h
; create and open file: c:\emu8086\MyBuild\t1.txt
mov cx, 0
int 21h
jc err2
mov handle, ax
; seek:
mov al, 0
mov cx, 0
mov dx, 10
int 21h
; write to file:
int 21h
; seek:
mov al, 0
mov cx, 0
mov dx, 2
int 21h
; write to file:
int 21h
; close c:\emu8086\MyBuild\t1.txt
int 21h
err2:
nop
int 21h
int 21h
; Program Nou
;name "int21"
;org 100h
;jmp start
; c:\emu8086\MyBuild
; c:\emu8086\vdrive\
; relative paths such as "c:\mydir\..\autoexec.bat" are disabled for the same reasons.
; declarations:
; buffers hold ascii chars for INT 21h/0Ah input function,
; 00 1 buffer size
;filename db 30,?, 30 dup(' ') ; file name should be in 8.3 - dos compatible format.
; file handle:
;handle dw 0
;jmp m1
; mov ah, 9
; int 21h
; input a string:
; int 21h
;jmp m2
; mov ah, 9
; int 21h
; input filename:
; int 21h
; xor bx, bx
; mov filename[bx+2], 0
; mov cx, 0
; int 21h
; jc error
; mov handle, ax
; xor cx, cx
; int 21h
; jc error
; close file
; int 21h
; jc error
; int 21h
; jc error
; mov handle, ax
; xor cx, cx
; int 21h
; jc error
; mov t2[1], al
; close file
; int 21h
; jc error
;jmp m3
; mov ah, 9
; int 21h
; xor bx, bx
; mov ah, 9
; int 21h
; jmp ok
;error: jmp m5
; msg5 db 0Dh,0Ah,"error...",0Dh,0Ah,'$'
; mov ah, 9
; int 21h
;ok:
;jmp m4
; mov ah, 9
; int 21h
; mov ah, 0
; int 16h
; int 21h
name "Evaluare_2"
Crearea mapei
Codul
name "exerc2"
org 100h
jmp start
dir1 db "c:\Mapa_1", 0
dir2 db "c:\Mapa_2", 0
file1 db "c:\Mapa_1\File_1.txt", 0
file2 db "c:\Mapa_2\File_2.txt", 0
handle dw ?
start:
mov ax, cs
mov dx, ax
mov es, ax
; create c:\emu8086\vdrive\Mapa_1
int 21h
; create c:\emu8086\vdrive\Mapa_2
int 21h
int 21h
mov handle, ax
; write to file:
int 21h
mov cx, 0
int 21h
mov handle, ax
; write to file:
int 21h
ret