welcome tinhocK1 website

Thursday, 28/03/2024, 2:29 PM

Chào Guest

Login form

Đăng nhập:
mật khẩu:

Ẩn

Tán Gẫu

500

Bạn thấy web tinhoc K1 thế nào?

Rate my site
Total of answers: 108
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » download » tài liệu chuyên ngành » copy con
copy con
quocdat11 Date: Wednesday, 15/10/2008, 2:28 PM | Message # 1
Nhóm: Removed





bài giai copy con mới xin được của thầy

các bạn là thanh vien mới thấy được bài

;-------------------------------
EXTR_SEG SEGMENT stack
dw 2048 dup(0)
EXTR_SEG ENDS
;--------------------------------
Assume CS:Code_seg, DS: Data_Seg
CODE_SEG SEGMENT
MAIN PROC NEAR
mov ax,Data_Seg
push ax
pop ds ;khoi tao ds
lea dx,Nhapfile ;Y/cau nhap ten file
call WriteStr
lea dx,Max ;Cho nhap vao buffer
call Readln
call Insert0
lea dx,Buffer
call OpenFile
jnc FileDaco
call NewFile
jc Baoloi
mov bx,ax ;cat the file
call InputKey
lea dx,Dulieu
mov cx,fSize
call WriteFile
call CloseFile
jmp short Thoat
Baoloi:
lea dx,Error
call WriteStr
jmp short Thoat
Filedaco:
lea dx,FileExists
call WriteStr
Thoat:
mov ah,4Ch
int 21h
MAIN ENDP
;-----------------------------------------
InputKey Proc
lea di,Dulieu
Input:
call Enter
call Readkey
cmp al,0
jnz XulyKytu1
call Readkey
cmp al,40h
jnz OkRead
mov dl,'^'
call WriteChar
mov dl,'Z'
call WriteChar
ret ;thoat vi da nhan F6
XulyKytu1:
mov FirstKey,al
mov dl,al
call WriteChar
OkRead:
lea dx,Max
call Readln
NOP
mov al,FirstKey
push ds
pop es
stosb
mov ch,0
mov cl,Len
push cx
lea si,Buffer
rep movsb
mov ax,0A0Dh
stosw
pop cx
add cx,3
add fSize,cx
jmp short Input
InputKey Endp
;-----------------------------------------
Enter Proc
mov dl,0Ah
call WriteChar
mov dl,0Dh
call WriteChar
ret
Enter Endp
;-----------------------------------------
CloseFile Proc
mov ah,3Eh
int 21h
ret
CloseFile Endp
;-----------------------------------------
WriteFile Proc
mov ah,40h
int 21h
ret
WriteFile Endp
;-----------------------------------------
OpenFile Proc
push dx
mov ah,3Dh
mov al,0
int 21h
pop dx
ret
OpenFile Endp
;-----------------------------------------
NewFile Proc
mov ah,3Ch
mov cx,32 ;Attribute
int 21h
ret
NewFile Endp
;-----------------------------------------
Insert0 Proc
lea di,Buffer
mov ah,0
mov al,Len
add di,ax
mov al,0
push ds
pop es
stosb
ret
Insert0 Endp
;-----------------------------------------
Readln Proc
mov ah,0Ah
int 21h
ret
Readln Endp
;-----------------------------------------
WriteStr Proc
mov ah,09
int 21h
ret
WriteStr Endp
;------------------------------------------
WriteChar Proc
mov ah,2
int 21h
ret
WriteChar Endp
;------------------------------------------
Readkey Proc
mov ah,8
int 21h
ret
ReadKey Endp
;------------------------------------------
CODE_SEG ENDS
;-----------------------------------------------
DATA_SEG SEGMENT PUBLIC
Max db 255
Len db 0
Buffer db 255 dup(0)
Nhapfile db 'Nhap ten file:$'
Error db 0dh,0ah,'Khong the tao file!$'
FileExists db 0dh,0ah,'File dang ton tai$'
FirstKey db 0
fSize dw 0
Dulieu db 10240 dup(0)
DATA_SEG ENDS
;-----------------------------------------------
END MAIN

chúc các bạn làm bài tốt

 
Forum » download » tài liệu chuyên ngành » copy con
  • Page 1 of 1
  • 1
Search: