Click here to Skip to main content
15,886,592 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone, the reason for this post is to see if something can be done regarding this code, what happens is that I cannot delete a file as long as the 3CH function to create it is executed with INT 21H.

ASM
;Enter the file name
MOV AH, 0AH 
LEA DX, NMF
INT 21H
MOV BL, NMF[1]
MOV NMF[BX + 2], ' '

;Create the file
MOV AH, 3CH  
MOV CX, 0H  
LEA DX, NMF + 2 
INT 21H
MOV HND, AX

;Close the file
MOV AH, 3EH
MOV BX, HND
INT 21H

;Delete the file
MOV AH, 41H
LEA DX, NMF + 2 
INT 21H


NMF and HND are defined as follows.

ASM
NMF DB 100 DUP(' '), 0
HND DW 0


And it is worth mentioning that the CF = 0 and AX = 00003 at the time of launching the interrupt to delete the file, so I would not know if it is an error since CF is not 1. I hope and you can help me, thank you.

What I have tried:

I did test and remove the execution of the interrupt to create a file and if the delete works if I put in NMF the name of a file directly, and when I try again executing the create interrupt with the direct name in NMF it stops working.
Posted
Updated 25-Oct-21 9:47am

1 solution

I cannot quite see how your path is set up but it does not look quite correct. You need to put the maximum length of the buffer in byte 0 before you call the create function. You then need to store zero in the byte after the last character of the string (not a space):
ASM
MOV NMF[0], 100
MOV AH, 0AH 
LEA DX, NMF
INT 21H
MOV BL, NMF[1]
MOV NMF[BX + 2], 0

NB it is more than 30 years since I last wrote 8080 assembler so I apologise for any syntax errors.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900