0

🖥 Les sources de MS-DOS 1.1 & 2.0 (1981 & 1983) divulguées

Bill Gates et la commande de IBM pour ses PC XT en 1981

Lorsqu’en 1981 IBM commande à Bill Gates un système d’exploitation capable de piloter son IBM-PC XT, Gates rachète QDOS (Quick and Dirty OS), un clone de CP/M écrit par Tim Paterson, et lui demande de l’adapter à l’IBM-PC tout en le renommant MS-DOS (Microsoft Disk Operating System).

MS-DOS restera par la suite le système d’exploitation phare de Microsoft jusqu’en 1995, date d’apparition de Windows 95 à laquelle il devient invisible. De nos jours, l’interpréteur de commandes n’est plus COMMAND.COM mais CMD.EXE

MS-DOS 1.00 sort en juillet 1981 en même temps que le tout premier IBM-PC. Il ne supporte que les disquettes simple face (160 Ko) et 64 fichiers maximum par disquette. Il ne gère pas les répertoires.
MS-DOS 1.25 est la première version vendue par Microsoft.
MS-DOS 2.00 sort en mars 1983 et supporte les disques durs, les répertoires et les disquettes 5 pouces 1/4 double face de 360 Ko.

Microsoft a livré en 2014 le code source de Microsoft MS-DOS 1.1 et 2 (respectivement juillet 1981 et mars 1983) et c’est fun à consulter. Pour l’anecdote aussi, à l’occasion du 1er avril 2015, Microsoft a publié une version de MS-DOS tournant sous Windows Phone.

Le code source de MS-DOS 1.1 & 2 (1981 & 1983)

Disponible ici.

📃 Parlez-vous ASM ?!

    push    bx              ; save pointer to fat area
    push    ds
    mov     ah,50           ; request the dpb
    int     21h
    mov     cx,[bx+15]      ; get fat sector count
    mov     dx,[bx+6]       ; first sector of fat
    pop     ds              ; restore fat area pointer
    pop     bx
    mov     al,dl           ; is it the default drive?
    or      al,al
    jnz     driveok         ; if not, load fat
        +--------------------------------------+
        | DWORD Pointer to next device         |
        |  (-1 if last device)                 |
        +--------------------------------------+
        | WORD Attributes                      |
        |  Bit 15 = 1 if char device 0 if blk  |
        |  if bit 15 is 1                      |
        |      Bit 0 = 1 if Current sti device |
        |      Bit 1 = 1 if Current sto output |
        |      Bit 2 = 1 if Current NUL device |
        |      Bit 3 = 1 if Current CLOCK dev  |
        |  Bit 14 is the IOCTL bit (see below) |
        |  Bit 13 is the NON IBM FORMAT bit    |
        +--------------------------------------+
        | WORD Pointer to Device strategy      |
        |      entry point                     |
        +--------------------------------------+
        | WORD Pointer to Device interrupt     |
        |      entry point                     |
        +--------------------------------------+
        | 8-BYTE character device name field   |
        | Character devices set a device name  |
        | For block devices the first byte is  |
        | The number of units                  |
        +--------------------------------------+

Premiers constats sur les fichiers

  • Sont disponibles les exécutables et le code source. Le ZIP fait moins de 900 Ko.
  • Les sources de MS-DOS 1.1 font 296 Ko pour 8 fichiers.
  • Les sources de MS-DOS 2 font 1.8 Mo pour 118 fichiers et la version compilée un peu moins de 450 Ko.
  • MS-DOS 2.0 utilise 28 Ko de mémoire vive, 12 Ko pour MS-DOS 1.
  • MS-DOS 2.0 est commercialisé sur 5 disquettes 5 pouces 1/4.
  • Les sources de l’interpréteur de commande COMMAND.COM pèsent 66 Ko dans la version 1.0 (2165 lignes)
  • Les sources de la version 1.0 contiennent un mail de Tim Paterson au sujet de MS-DOS 1.25. Les sources de la version 2.0 contiennent quelques fichiers texte (13)
  • La version 1.0 compilée comprend deux exécutables et 27 fichiers .COM dont BASIC.COM (12 Ko) et des commandes externes connues comme CHKDSK (2 Ko), DISKCOMP (2 Ko), FORMAT (4 Ko)…
  • La version 2.0 compilée comprend déjà l’éditeur de texte EDLIN (5 Ko)
  • Contre toute attente, il y a quelques lignes drôles et sarcastiques dans les commentaires

🗂 Enfin la prise en charge des dossiers avec MS-DOS 2.0 en 1983 !

Fichier SYSCALL.TXT

                      +-disk-+
                      /        \
                     /          \
                    /            \
                 sales         accounting
                /    |            |      \
               /     |            |       \
              /      |            |        \
         John       Mary         Steve      Sue
        /  | (A)       |         |   |         \
       /   |           |         |   |          \
      /    |           |         |   |           \
   report accts.     report   accts. report      report
          receiv.             receiv     

In MSDOS  2.0 the user can arrange his files in such a manner that files that are not part of his current task do not  interfere  with that task.  Pre-2.0 versions of MSDOS has a single directory that contains files.  MSDOS extends this  concept  to  allow a directory to contain both files and  directories  and  to  introduce  the  notion  of  the 'current' directory.

📃 Ouvrir et parcourir les sources en ASM

La source COMMAND.ASM de 1981

📧 Le mail iconique de Tim Paterson au sujet de MS-DOS 1.25

From: Tim Paterson
To: Len Shustek
Subject: RE: Source code to MS-DOS 1.0


I have found and attached the source code for MS-DOS 1.25 as shipped by Seattle Computer Products. Version 1.25 was the first general release to OEM customers other than IBM so was used by all the first clone manufacturers.

IBM’s DOS 1.1 corresponds to MS-DOS 1.24. There is one minor difference between 1.24 and 1.25, as noted in the revision history at the top of MSDOS.ASM.

Of the file attached, only STDDOS.ASM/MSDOS.ASM (DOS main code) and COMMAND.ASM (command processor) would have been used by an OEM other than Seattle Computer. The other files: IO.ASM – I/O system unique to SCP (equivalent to ibmbio.sys).
ASM.ASM & HEX2BIN.ASM – Old 8086 assembler developed by SCP (used to assemble older version of DOS). TRANS.ASM – Z80 to 8086 assembly source code translator developed by SCP.

I also have a 6” stack of printouts of assembly listings for some of these and probably other related programs.

Tim Paterson
Paterson Technology
http://www.patersontech.com/

Les 7 paramètres vidéo CGA de l’époque sur PC-XT

ParameterParameterFunction
040 x 25black and white
1 40 x 25 color
280 x 25black and white
3 80 x 25 color
4320 x 200black and white
5 320 x 200 color
6640 x 200black and white

Quelques commandes internes de MS-DOS 2.0

Commandes internes de MS-DOS 2.0

Fichier QUICK.TXT 

INTERNALS 

DIR
        Same as  before  except  directories  appear  with the
        string "" in the size field
RENAME
        Same as before
REN
        Same as above
ERASE
        Same as before except will now take paths
DEL
        Same as above
TYPE
        Same as before except will now take paths
REM
        Same as before
COPY
        Same as before only now takes paths
PAUSE
        Same as before
DATE
        Same as before
TIME
        Same as before
VER
        Prints MS-DOS version number
VOL   [d:]
        Prints the volume ID of drive d:  (default if missing)
CHDIR  [d:]path
        Changes current directory of  drive  d:   (default  if
        missing) to path.
CD
        Same as above

📃 Les descriptions rigolotes des commandes externes de MS-DOS 2.0 (en gras dans la source)

Fichier QUICK.TXT  

EXTERNAL COMMANDS 

FORMAT
        Formats disks
CHKDSK
        Checks disks   Now   understands  directory  structure
        and has switches  to  prevent  undesired  blasting  of
        disks and reports on extents
EDLIN
        Ridiculous editor :-)
DEBUG
        The huge debugger, now has an assemble command
SYS
        Copies the operating system onto disks
RECOVER
        Reconstructs   disk   directories  from  the  FAT  and
        squeezes bad sectors out of files
PRINT
        The infamous background file  printing  utility  which
        fools you  into  thinking  MS-DOS  can do something it
        really can't.
FILCOM
        Has not changed a bit
EXEFIX
        Fixes .EXE files for stack  allocation,  and  converts
        .COM files into .EXE format.
LOCATE
        Sort of  inverse  of the above, turnes .EXE files into
        .COM files (sometimes !).
CONFIG.SYS
        A special file which will do all  sorts  of  wonderous
        things when the system is booted.
SORT, CIPHER, FGREP, MORE
        Filters (talk to CHRISP for details)

L’application EDLIN (éditeur de texte) est qualifiée de RIDICULOUS EDITOR 🙂 et le fichier de démarrage CONFIG.SYS est décrit comme “do all sorts of wonderous things” (c’est la magie !)

📃 Le Revision history et le source code dudit “ridiculous editor” EDLIN 2.00 de 1983

Le source de EDLIN de 1983 (MS-DOS 2.0) fait 1845 lignes pour 56 Ko.

    title   EDLIN for MSDOS 2.0
 ;-----------------------------------------------------------------------;
 ;               REVISION HISTORY:                                       ;
 ;                                                                       ;
 ;       V1.02                                                           ;
 ;                                                                       ;
 ;       V2.00   9/13/82  M.A. Ulloa                                     ;
 ;                  Modified to use Pathnames in command line file       ;
 ;               specification, modified REPLACE to use an empty         ;
 ;               string intead of the old replace string when this       ;
 ;               is missing, and search and replace now start from       ;
 ;               first line of buffer (like old version of EDLIN)        ;
 ;               instead than current+1 line. Also added the U and       ;
 ;               V commands that search (replace) starting from the      ;
 ;               current+1 line.                                         ;
 ;                                                                       ;
 ;               9/15/82  M.A. Ulloa                                     ;
 ;                  Added the quote character (^V).                      ;
 ;                                                                       ;
 ;               9/16/82  M.A. Ulloa                                     ;
 ;                  Corrected bug about use of quote char when going     ;
 ;               into default insert mode. Also corrected the problem    ;
 ;               with ^Z being the end of file marker. End of file is    ;
 ;               reached when an attempt to read returns less chars      ;
 ;               than requested.                                         ;
 ;-----------------------------------------------------------------------;
 FALSE   EQU     0
 TRUE    EQU     NOT FALSE
 KANJI   EQU     FALSE
 roprot  equ     true            ;set to TRUE if protection to r/o files
                                 ; desired.
 FCB     EQU     5CH
 Comand_Line_Length equ 128
 quote_char equ  16h             ;quote character = ^V
 PAGE
     .xlist     INCLUDE DOSSYM.ASM     .list
 SUBTTL  Contants and Data areas
 PAGE
 PROMPT  EQU     "*"
 STKSIZ  EQU     80H

📃 Le fichier FORMAT.TXT

The OEM  must  supply  five (NEAR) routines to the program
along with 6 data items.  The names of the routines are  INIT,
DISKFORMAT, BADSECTOR,  WRTFAT  and  DONE,  and  their flow of
control (by the Microsoft module) is like this:
      |
  +---------+
  |  INIT   |
  +---------+
       |
       |<------------------------------+
 +------------+                        |
 | DISKFORMAT |                        |
 +------------+                        |
       |<-------+                      |
 +-----------+  |-This loop is done    |-    This loop done
 | BADSECTOR |  | for each group of    | once for each disk 
 +-----------+  | bad sectors          | to be formatted.
       |----->--+                      | If variable HARDFLAG
       |                               | is set then the loop
 +----------+                          | is only performed
 |          |                          | once.
 |  WRTFAT  |                          |
 +----------+                          |
       |                               |
   +------+                            |
   | DONE |                            |
   +------+                            |
       +---->--------------------------+

📃 Le README.TXT et le contenu des 5 disquettes 5 pouces 1/4 double densité de MS-DOS 2.0

MSDOS 2.0 RELEASE

The 2.0 Release of MSDOS includes five 5 1/4 double density single sided
diskettes or three 8 iinch CP/M 80 format diskettes.
The software/documentation on the five inch diskettes is arranged
as follows: 

1.
DOS distribution diskette.  This diskette contains files which
should be distriibuted to all users.  This allows the DOS distri-
bution diskette to meet the requirements of users of high level
language compilers as well as users running only applications.
Many compilers marketed independently through the retail channel
(including those of Microsoft) assume LINK comes with the DOS, as
in the case of IBM.  How you choose to distrubute BASIC (contracted
for separately) is up to you. 

2.
Assembly Language Development System diskette.  This diskette
contains files of interest to assembly language programmers.
High level language programmers do not need these programs unless
they are writing assembly language subroutines.  IBM chose to
unbundle this package from the DOS distribution diskette (except
for DEBUG), but you do not have to do so. 

3.
PRINT and FORMAT diskette.  This diskette contains .ASM source
files which are necessary to assemble the print spooler, which you
may wish to customize for greater performance.  .OBJ files are also
included for the FORMAT utility. 

4.
Skeltal BIOS and documentation diskette.  This diskette contains
the skeltal BIOS source code and the SYSINIT and SYSIMES object
modules which must be linked with your BIOS module.  The proper
sequence for linking is BIOS - SYSINIT - SYSIMES.
A profiler utiliity is also included on the diskette, but this
is not intended for end-users.  This is distributed for use by
your development staff only and is not supported by Microsoft
If you do decide to distribute it, it is at your own risk! 

5.
Documentation.  Features of 2.0 are documented on this disk. 

Vous pouvez évaluer cet article en un clic. Garanti sans gluten. Merci !
(Evaluations : 1 / Moyenne : 5)

Krak

Dompteur d'IA, machine prolifique à pisser du code de merde non commenté et pas opti depuis 1986, maître des traditions / maître-brasseur / grand malade à WoW, chasseur de gardiens à Ingress de 2014 à 2019, nerd sapiosexuel monomaniaque, amateur de piments 🌶️ au delà de 300.000 Scoville grâce à Stéphane Pécaut et de pizzas maison 🍕 grâce à Marloin, j'apprécie particulièrement les 3C (les chats 😼, le code et les choux de Bruxelles 🥦) & la philosophie du CCC.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *