tasm psp program

samaira

samaira

@samaira-P4RsEf Oct 26, 2024
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

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • whiz.kid.aniket

    whiz.kid.aniket

    @whizkidaniket-5IiBCq Nov 13, 2010

    Did you copy this program from techmax or technical?

    and are you trying to copy the contents from file1 to file2?
  • samaira

    samaira

    @samaira-P4RsEf Nov 13, 2010

    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