用汇编语言编写一个程序,新建一个文件abc.txt,从键盘输入abc.txt文件的内容(不超过100个字符),然后新建另外一个文件def.txt,将abc.txt文件的前10个字符复制到def.txt。
DATAS SEGMENT
buf1 db 100,?,100 dup(?)
buf2 db 10 dup(?)
file1 db 'abc.txt',00h
f1 dw ? ;存放文件代号
file2 db 'def.txt',00h
f2 dw ?
error1 db ' error number $
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
mov si,10
;-------创建abc.txt文件------------
mov ah,3ch
mov cx,00
lea dx,file1
int 21h
jc error;判断是否出错
mov f1,ax;存放新建的文件代号
;-------10号调用从键盘输入字符串写到abc.txt中-------
mov ah,0ah
lea dx,buf1
int 21h
mov ah,40h
mov cl,[buf1+1]
lea dx,buf1+2;偏移地址
mov bx,f1;文件代号
int 21h
jc error
;---------abc关了再开-----------------
; mov ah,3eh;关
;