VOGONS


First post, by donbright

User metadata
Rank Newbie
Rank
Newbie

Does anyone have any good example code on how to open files on PC DOS 1.0? It doesn't have the same interrupt 21 command as later versions of DOS. It appears to allow you to open a file by pointing to a 'File Control Block' but how do I find the FCB given that i only know a file name?

Is it even worth it targeting PC DOS 1.0? I only kind of want to do it because a lot of the Emulators, when they boot an IBM PC 5150, they default to using PC DOS 1. And after all, it is the OG PC DOS.

Thanks

Reply 1 of 8, by kdr

User metadata
Rank Member
Rank
Member

PC DOS 1.x is a very primitive (and simple) environment. It was a slightly more polished version of 86-DOS, which was originally designed (by Tim Paterson at SCP) to be a kinda-clone of CP/M which ran on the 8080/Z80 machines. It's just about possible to use a CP/M developer's manual to write a DOS 1.x compatible program. 86-DOS also included a very nice little x86 assembler. And DEBUG.COM was originally designed as the ROM monitor for SCP's 8086 processor boards.

Anyway, a good resource for writing DOS 1.x programs is the 86-DOS manuals, which have been archived at bitsavers:
http://www.bitsavers.org/pdf/seattleComputer/

When you run a DOS program, the command interpreter "pre-parses" the first command argument as a filename and fills in a template FCB which is located at DS:005Ch. So for really simple programs, all you need to do is set DS:DX to point at this FCB and start calling the INT 21h functions.

Reply 2 of 8, by donbright

User metadata
Rank Newbie
Rank
Newbie

thank you. i will try to think of it as almost a different OS, the funny thing is subsequent DOS somehow managed to keep backward compatibility with DOS 1...

fun note from programmers guide ... "The users stack must have a total of 16 levels (32 bytes) of space available for the interrupt, which will insure compatibility with future multi-user versions of 86-DOS"

Reply 3 of 8, by Zup

User metadata
Rank Oldbie
Rank
Oldbie

AFAIR:
- DOS 1.0 did not support directories nor hard disks; I highly recommend targetting DOS 2.x (or better 3.x) so you can support both directories and handles.
- You have to build your own FCB before trying to open the file; then the OS will inform you if the file was opened succesfully.
- FCB was considered deprecated... maybe it won't work everywhere (Ralf Brown's interrupt list says that some DOS won't open files in FAT32 filesystems using FCB and others need some special values).

I have traveled across the universe and through the years to find Her.
Sometimes going all the way is just a start...

I'm selling some stuff!

Reply 4 of 8, by Jo22

User metadata
Rank l33t++
Rank
l33t++

MS-DOS 6.2x still supports FCBS, there's an optional FCBS= statement for Config.sys.
Default value for FCBS is 2, I think. Some memory managers reduce them to pseudo FCBS by installing a FCBS=2,0 statement (non-functional).

As far as popular DOSes go, 1.0 is pretty much irrelevant. A classic used to be v2.11.
Even failed MS-DOS compatibles still got their 2.x upgrade before being pushed out of market, with a few of them seeing 3.2/3.3 still.

Anyway, back to PC-DOS 1.0.. If you can, please have a look at CALL5 interface.
It was used for porting CP/M programs to DOS, essentially.

Good luck! 🙂🤞

Edit: Now that I think of it, BASIC-86 (the compiler) might support PC-DOS 1.0.
It was the successor to BASIC-80 aka MBASIC, as far as I know.

Edit: Turbo Pascal 3 and earlier may support PC-DOS 1.0..

Last edited by Jo22 on 2023-04-25, 23:11. Edited 2 times in total.

"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//

Reply 5 of 8, by bakemono

User metadata
Rank Oldbie
Rank
Oldbie

This info is in an MS-DOS 2.1 manual. I never actually used DOS 1.0 but this is the FCB interface used by DOS 1.0 isn't it?
int 21h, function 0Fh - open file - DS:DX must contain address of FCB
function 10h - close file
function 14h - sequential read
function 15h - sequential write
function 16h - create file
etc.
If there are in fact compatibility problems with later OSs, maybe you could detect the DOS version and switch to FCBs only for DOS 1.0

Attachments

  • EXEC0309.JPG
    Filename
    EXEC0309.JPG
    File size
    162.04 KiB
    Views
    698 views
    File license
    Fair use/fair dealing exception

again another retro game on itch: https://90soft90.itch.io/shmup-salad

Reply 6 of 8, by donbright

User metadata
Rank Newbie
Rank
Newbie

figuring this stuff out is almost as much work as the actual program im writing so i think i will give up and target dos 2.1,

funny thing is the "detect dos version" function also doesn't exist in Dos 1. . . probably some other way to detect though.

thank you very much all

Reply 7 of 8, by doshea

User metadata
Rank Member
Rank
Member

I think I would find targeting DOS 1.0 to be an interesting project if I started out targeting CP/M-86 and then investigated what it was like to port to DOS using those CP/M compatibility features, since I gather it was meant to be relatively straightforward. That's just me though!

Reply 8 of 8, by Jo22

User metadata
Rank l33t++
Rank
l33t++
doshea wrote on 2023-04-26, 01:21:

I think I would find targeting DOS 1.0 to be an interesting project if I started out targeting CP/M-86 and then investigated what it was like to port to DOS using those CP/M compatibility features, since I gather it was meant to be relatively straightforward. That's just me though!

That reminds me of Digital Research's DOS Plus..
Versions 1.x were based off CP/M-86, but included a DOS emulator called "PC Mode".
It had DOS 2.11 API/ABI compatibility and ran DOS executables transparently.
Ie, DOS Plus could execute both CP/M-86 and DOS applications and their OSes' commands (both COPY and PIP).
And read/write both FAT and CP/M file systems.

Here's more information about the matter:
https://www.seasip.info/Cpm/dosplus.html

Quick video of version 2.x running CP/M-86 applications:
https://www.youtube.com/watch?v=D1v3e-pF4Kg

"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//