DOS 4.4

image
Welcome to DOS 4.4, a new OS for the Apple II in 2018.

A product, a proof of concept, or a project: DOS 4.4 is each of them. You may wonder why we have decided to upgrade/enhance (or downgrade) DOS 3.3 (the January 1983 version), by providing that version, especially as we are more GS/OS users.
You may also wonder what differs in DOS 4.4 from DOS 3.3. We compile the answers in that page.

image

Why DOS 4.4?

  • A product
    • Yes, DOS 4.4 is a (nearly) final product, it works as intended and as DOS 3.3 does
    • It even contains a new version of MUFFIN to copy your DOS 3.3 files onto a DOS 4.4 disk
  • A proof of concept
    • Could it be done?
      • Yes, and that was fun to disassemble and make it work flawlessly!
    • Do I learn something from it?
      • Yes! The DOS 3.3 RWTS routines do not always count cycles correctly: the 3rd epilog nibble of the address field is barely written on disk
      • Yes! DOS 3.3 is slow: the use of an intermediate buffer, even 2 or 3 (counting the OS buffers) slows down things A LOT
      • Yes! Available space is tight.
      • Yes! Thanks to Marcel Cottini's book, I have learned a lot on the inners of DOS 3.3: the OS, the File Manager, and the RWTS.
    • Will I be able to do things differently?
      • Yes! Why not add commands? I did not here
      • Yes! Why not add support for lower-case characters? I did not here
      • Yes! Why not add support for the 4*4 nibble encoding scheme? Hum... I did
  • A project
    • For a DOS upgrade
      • And you can download DOS 3.4 below...
      • DOS 3.4 is like the OS code of DOS 4.4 with the RWTS routines of DOS 3.3
    • For the .WOZ format
      • That format will be generated by the Applesauce device of John Keoni Morris
      • That format will need a couple of new real disk formats to validate the digit from Applesauce
      • So, I have decided to use start with DOS 4.4 to:
        • Understand how the RWTS works
        • Prepare new on-disk copy protections to answer to the topic above
        • Test with a new format: 4*4 encoded nibbles sectors because:
          • Read/Write routines are the base for fast read/write from/to disk
          • And counting cycles is a mandatory step for writing on-disk protection schemes
          • 4*4 is used for spiraling and other weird on-disk protection schemes (decoding is fast)
          • So the 4*4 routines will be used for such a purpose


    What is *NOT* DOS 4.4?

    • An enhanced version of DOS 3.3 (the January 1983 edition)
    • It does not contain new features, it does not recognize lower-case letters!
    • Sorry!


    image

    What is *REALLY* DOS 4.4?

    • Disk structure:
      • A 5.25" floppy disk of 35 tracks of 10 4*4-encoded nibbles sectors, for a total of 89,600 bytes
      • 5 tracks are reserved for DOS 4.4 (4 for the OS, 1 for the catalog), for a total 12,800 bytes
      • 30 tracks are free of use, for a total of 76,800 bytes, more than the 64KB of our machines!
    • Similar features:
      • The same commands as in DOS 3.3: INIT, CATALOG and the others with the same parameters
    • Similar limits:
      • The use of an intermediate buffer to encode/decode nibbles from/to disk
      • The use of an interleaving (physical/logical sector order on disk) table
      • Works with 5.25" disks only
    • Layer separation:
      • DOS patches previously buried in the RWTS are now in the OS code
      • The RWTS contains disk routines only!


    What is the 4*4 encoding scheme?

    • There are constraints to write data on an Apple disk. The format is called GCR:
      • The first bit must be a 1
      • No more than two consecutive 0s
      • Bytes on disk are called nibbles
      • One can play around the limits for great on-disk copy protections but that is not the purpose here
    • So, to encode 256 memory bytes, we will use the 4*4 encoding scheme where:
      • 8 bits will be divided into two nibbles of 4 bits, hence the name
      • The first 4 bits are bits 7x5x3x1x, we shift right the bits: x7x5x3x1, we force x to be 1 (ORA #%10101010), we store that nibble
      • The other 4 bits are bits x6x4x2x0, we force x to be 1 (ORA #%10101010), we store that nibble
      • Our 2 nibbles are now on disk and match 1 byte from memory
      • The DOS 3.2 encoding scheme is called 5*3 and requires 410 nibbles to store 256 bytes onto disk
      • The DOS 3.3 encoding scheme is called 6*2 and requires 342 nibbles to store 256 bytes onto disk
      • The DOS 4.4 encoding scheme is called 4*4 and requires 512 nibbles to store 256 bytes onto disk, we are really wasteful!
      • As the number of bits we can write per track is limited, we have limited DOS 4.4 to 10 sectors per track
      • As the drive speed is 300RPM, that we store a nibble every 32us, not counting the synchronization and specific nibbles for the address and data fields, how many 4*4 sectors can we put on a disk?


      image

      What are the changes?

      • DOS 3.3 patches are now in the OS code ($1D00..$35FF)
      • Due to a lack of space, the error routine and messages have been replaced and display the error code only
      • The RWTS contains disk routines only!
      • All write routines are now cycle accurate: 32us for standard nibbles and 40us for sync nibbles
      • The read and write data field routines have been changed: 4*4 read/write routines
      • MUFFIN (the DOS 3.2 to DOS 3.3 file copier) now copy DOS 3.3 files onto a DOS 4.4 disk


      What could be the next steps?

      • Make it faster and avoid using an intermediate buffer ($3E..$3F is the key)
      • Rewrite the RWTS INIT routine by more reliable and faster code
      • Deliver the working source code of DOS 3.4
      • Make error messages more user friendly (err #0 is the beep, others are messages...)
      • Play with the beast to write on-disk copy protection schemes...


      What are the files provided?

      • DOS 3.3 Slave disk
        This is the A2R view of a slave DOS 3.3 disk created by John Keoni Morris with Applesauce to let you compare freshly formatted DOS 3.3 and DOS 4.4 disks
      • DOS 3.4 Master disk
        This is the new DOS 3.4 master disk!
      • DOS 3.4 Master disk Source code
        It contains all the Merlin source files on a ProDOS disk to let you assemble DOS 3.4 (use DOS34.MAKE.S or DOS34.DISK.S)
        • DOS34.MAKE.S creates a binary file that matches the DOS code as if it were in memory (from $1B00..$3FFF)
        • DOS34.DISK.S creates a binary file that matches the DOS code as if it were on disk (from $3600..$3FFF, $1B00..$35FF)
      • DOS 4.4 Boot disk
        This is a standard DOS 3.3-like boot disk that *MUST* be booted first to then let you boot a DOS 4.4 disk. See the next section.
      • DOS 4.4 Master disk
        Provided in different formats (A2R, EDD, NIB), the disk image contains the master disk of DOS 4.4 in 4*4 encoding scheme
        We found a late minute bug in the boot1 routine (it is corrected in the source code) but not on all disk images:
        Prefer the FDI image over the other ones. Sorry :-(
      • DOS 4.4 Master disk Source code
        It contains all the Merlin source files on a ProDOS disk to let you assemble DOS 4.4 (use DOS44.MAKE.S or DOS44.DISK.S)
        • DOS44.MAKE.S creates a binary file that matches the DOS code as if it were in memory (from $1B00..$3FFF)
        • DOS44.DISK.S creates a binary file that matches the DOS code as if it were on disk (from $3600..$3FFF, $1B00..$35FF)


      How to use DOS 4.4?
      The usage is pretty simple on a real machine or under emulation:

      • Boot DOS 4.4 Boot disk.dsk
      • Remove the disk from the drive
      • Insert DOS 4.4 Master disk.fdi or DOS 4.4 Master disk.nib
      • Press 1-7 to boot from slot 1-7 (we suppose you will press 6)
      • Then, do what you want (CATALOG, INIT, BRUN...)


      References

      • A2R format by Applesauce by John Keoni Morris (thank you a lot, John!)
      • EDD format by i'm fEDD up by Brutal Deluxe Software (it was useful, wasn't it?)
      • NIB format by ADTPro by David Schmidt (best software of the century)
      • Book: Apple II DOS 3.3 Guide du programmeur, Marcel Cottini, SYBEX
      • Book: Systèmes d'Exploitation et Systèmes de Protection sur APPLE II, Jean-Pierre Lagrange, Micro Application


      Download :


      DOS 3.3 Slave disk in .A2R

      DOS 4.4 Boot disk

      DOS 4.4 Master disk (A2R image)

      DOS 4.4 Master disk (EDD image)

      DOS 4.4 Master disk (FDI image)

      DOS 4.4 Master disk (NIB image)

      DOS 4.4 Master disk Source code (20180110)

      DOS 4.4 Master disk Source code (20180109)

      DOS 4.4 Master disk Source code (20180106)