1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| .DATA
mybuf BYTE 10 DUP (' ')
pstring BYTE 0Dh,0Ah,"enter data: "
ostring BYTE 0Dh,0Ah,"going to burn titi.txt "
fic db "titi.txt",0
abyte BYTE ?
.CODE
.STARTUP
; prompt user
mov bx, 1 ; stdout
mov cx, LENGTHOF pstring
mov dx, SEG pstring
mov ds, dx
mov dx, OFFSET pstring
mov ah, 40h
INT 21h
; ignore possible errors
; read data
mov bx, 0 ; stdin
mov cx, LENGTHOF mybuf
mov dx, SEG mybuf
mov ds, dx
mov dx, OFFSET mybuf
mov ah, 3Fh
INT 21h
; ignore possible errors
mov bx, 1 ; stdout
mov cx, LENGTHOF ostring
mov dx, SEG ostring
mov ds, dx
mov dx, OFFSET ostring
mov ah, 40h
INT 21h
; ignore possible errors
;open
mov ah,3dh
mov al,1
lea dx,fic ;ds:dx
int 21h
;////////////////////////////////////////////////////////////////
; le pobleme est dans cette partie//////////////////////////
mov bx, OFFSET fic
mov cx, LENGTHOF mybuf
mov dx, SEG mybuf
mov ds, dx
mov dx, OFFSET mybuf
mov ah, 40h
INT 21h
;////////////////////////////////////////////////////////////////
_fin :
mov ah, 3eh ; fermeture du fichier
int 21h
; clear buffer
mov bx, 0 ; stdin
mov cx, 1
mov dx, SEG abyte
mov ds, dx
mov dx, OFFSET abyte
clearbuf: mov ah, 3Fh
INT 21h
mov al, abyte
cmp al, 0Ah
jne clearbuf
.EXIT
END |
Partager