tasm psp program

i have written the following code to create two files using psp.name of my program is copytry.And the code is as follows


disp macro msg
lea dx,msg
mov ah,09h
int 21h
endm

.model small
.data
fname1 db 20 dup(?)
fname2 db 20 dup(?)
fhandle1 dw ?
fhandle2 dw ?
buff1 db 20 dup(?)
buff2 db 20 dup(?)
msg1 db 10,13,'file is created$'
msg2 db 10,13,'file not created$'

.code
mov ax,@data
mov ds,ax
mov es,ax
mov ah,62h
int 21h
mov es,bx
mov bx,80h
mov cl,es:[bx]
dec cl
mov bx,82h
lea di,fname1
l1:
mov bl,es:[bx]
mov [di],bl
inc bx
inc di
dec cl
cmp bl,''
jne l1
mov dl,00h
mov [di],dl
lea si,fname2
l2:mov bl,es:[bx]
mov [si],bl
inc bx
inc si
dec cl
cmp cl,00h
jne l2
mov [si],cl

;create first file
lea dx,fname1
mov cx,00h
mov ah,3ch
int 21h
jc l3
disp msg1
mov fhandle1,ax

;create second file
lea dx,fname2
mov cx,00h
mov ah,3ch
int 21h
jc l3
disp msg1
mov fhandle2,ax
jmp exit1

l3:
disp msg2
exit1:mov ah,4ch
int 21h
end


and the output is as follows
C:\Tasm>tasm copytry.asm
Turbo Assembler Version 3.0 Copyright (c) 1988, 1991 Borland International

Assembling file: copytry.asm
Error messages: None
Warning messages: None
Passes: 1
Remaining memory: 460k


C:\Tasm>tlink copytry
Turbo Link Version 5.0 Copyright (c) 1992 Borland International
Warning: No stack

C:\TASM>copytry a.txt b.txt

file is created
file is created

But when i check those files only first file is created and that too in some other format.And second file is not created.Not able to understand.😔

Replies

  • whiz.kid.aniket
    whiz.kid.aniket
    Did you copy this program from techmax or technical?

    and are you trying to copy the contents from file1 to file2?
  • samaira
    samaira
    whiz.kid.aniket
    Did you copy this program from techmax or technical?

    and are you trying to copy the contents from file1 to file2?
    this is neither from techmax nor technical.They have given it in more complicated way that i m not able to understand.this i tried myself.and i want to copy from file1 to file2

You are reading an archived discussion.

Related Posts

Here's a way to quickly speed up your favorite firefox browser by Moving Firefox Cache to RAM - Open firefox and type the following in address bar: about:config In the...
CEans, We launched CrazyEngineers Forum RSS subscription few days ago. The mail delivery is handled by Google's Feedburner service. I'm sure many of you have already subscribed to it and...
Can we send mail in a project from localhost?? If yes then how?
Hellow CEans... myself poonam biswakarma from assam, a 4th year CRAZY electrical enginreering student. Google led me to this site. Happy to be a member of CE nd meet the...
If your Macbook is showing no sign of shut down, and just shows a spinning wheel against blue screen, here's a quick way to fix it- Turn on the power...