flat assembler
Message board for the users of flat assembler.

Index > DOS > FCB.

Author
Thread Post new topic Reply to topic
MaoKo



Joined: 07 May 2019
Posts: 100
Location: Paris/French
MaoKo 12 Nov 2020, 13:04
Hello. I have some question about FCB in DOS. I known that is a legacy stuff but I really need to understand the thing. First of all, when you execute a command like EDIT A.ASM DOS fill the fcb name and extension to A and ASM. Does the program need to open the file with int 33 and ah == 15 or the file is already open? And my second question is what is the byte located at FCB+011H?
I read the source of an old program in CP/M and it do that:
Code:
        MOV     CL,4            ;Needed for shifts
        MOV     [OFFSET],-100H
        MOV     SI,FCB+11H      ;Scan second FCB for offset
        LODB
        CMP     AL," "          ;Check if offset present
        JZ      HAVOFF
        MOV     B,[SIGN],0      ;Assume positive sign for now
        CMP     AL,"+"
        JZ      GETOFF          ;Get a positive offset
        CMP     AL,"-"
        JNZ     GETOFF1         ;If not + or -, then not signed
        MOV     B,[SIGN],1      ;Flag as negative offset
    

In DOS the offset 11H correspond to the size of the file and reserved for system use in CP/M.
So in CP/M it's like a description of the file?
Best regard.
Post 12 Nov 2020, 13:04
View user's profile Send private message Visit poster's website Reply with quote
MaoKo



Joined: 07 May 2019
Posts: 100
Location: Paris/French
MaoKo 12 Nov 2020, 17:42
Ok sorry. It's seem to refer to the second argument as described in this doc http://www.x-hacker.org/ng/interrupts_and_ports/ng565ff.html . This is weird because in all document except this one, the FCB is +30 byte long. Here the first FCB is 16 byte long and the second is 20 byte I guess.This is why I was so confused :/.
If anyone has the layout of FCB #1 and FCB #2 I would greatly appreciate Wink
Post 12 Nov 2020, 17:42
View user's profile Send private message Visit poster's website Reply with quote
MaoKo



Joined: 07 May 2019
Posts: 100
Location: Paris/French
MaoKo 12 Nov 2020, 18:05
Ok. Evertyhing is say here.
Quote:

When creating an external command, there are two ways to pass arguments from the command line to the external command. First, when passing the file names to the command line as arguments, use 5CH and 6CH in the system scratch area. COMMAND.COM, which always considers the first and second parameters as file names when external commands are executed, expands them to a drive number (1 byte) + file name (8 bytes) + extension (3 bytes) and stores them in 5CH and 6CH. These are in the same format as the first 12 bytes of FCB, so setting these address as first addresses of FCB permits various operatuons.

However, since in this method only 16 bytes differ from the starting addresses of two FCBs, either 5CH or 6CH (only) can be used as a complete FCB. Next, when passing arguments other than file names (numbers, for instance) or creating an external command handling more than three file names, COMMAND.COM stores the whole command line, which invoked the external command, except for the command line itself in the form of number of bytes (1 byte) + command line body, so it can be used by interpreting it in the external command properly. See List 3.3 of section 4 for an example of passing arguments using this DMA area.

This is the link of the source if someone is interested:
https://github.com/Konamiman/MSX2-Technical-Handbook/blob/master/md/Chapter3.md
Post 12 Nov 2020, 18:05
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.