Ñáîðíèê ïî çàäà÷àì è ïðèìåðàì Assembler

       

Ñîçäàíèå ôàéëà ñ óñå÷åíèåì ñóùåñòâóþùåãî äî íóëåâîé äëèíû



Ñîçäàíèå ôàéëà ñ óñå÷åíèåì ñóùåñòâóþùåãî äî íóëåâîé äëèíû

Âõîä: ÀÍ = 3Ch; CX = àòðèáóòû ôàéëà (çíà÷åíèÿ áèòîâ: 0=1 — òîëüêî ÷òåíèå; 1= 1 — ñêðûòûé ôàéë; 2=1 — ñèñòåìíûé ôàéë; 3=0 — èãíîðèðóåòñÿ; 4=0 — çàðåçåðâèðîâàí (êàòàëîã), äîëæåí áûòü ðàâåí 0; 5 — áèò àðõèâàöèè; 6= 0 — ðåçåðâ; 7=1 — îáùèé ôàéë â ñèñòåìå Novell Netware; 8...15=0 — ðåçåðâ); DS:DX — ASCIZ-èìÿ ôàéëà.

Âûõîä: CF=O — ÀÕ = äåñêðèïòîð ôàéëà; CF=1 — ÀÕ = êîä îøèáêè (3 — íåò òàêîãî ïóòè; 4 — íåò ñâîáîäíîãî äåñêðèïòîðà ôàéëà; 5 — äîñòóï îòêàçàí).

õîãñõ.ñõ :àòðèáóòû ôàéëà - îáû÷íûé ôàéë Ids dx,point_fname:

ôîðìèðóåì óêàçàòåëü íà èìÿ ôàéëà movah.5bh :íîìåð ôóíêöèè DOS

int21h îòêðûâàåì ôàéë

jnc ml : îáîéäåì îòêðûòèå ôàéëà

moval,02h ;ðåæèì äîñòóïà

movah.3dh ;íîìåð ôóíêöèè DOS

int 21h : îòêðûâàåì ôàéë

jc exit :ïåðåõîä, â ñëó÷àå îøèáêè

mi: :äåéñòâèÿ ïðè óñïåøíîì îòêðûòèè ôàéëà:

mov handle.ax :ñîõðàíèì äåñêðèïòîð ôàéëà



Ñîäåðæàíèå ðàçäåëà