[net.micro.pc] fastboot

turnera@pur-ee.UUCP (Turner) (02/10/85)

    I am not familiar with the article that Mr. Kenley refers to
but about a year ago I wrote my own fast boot routine.  So far, it has
worked beautifully with a variety of different system configurations
and software.  In spite of comments by Al Schwartz it works fine with
DOS 2.0  (it has not been tested with other versions of DOS).

    My routine works by setting the system board switches for some small
amount of RAM, I set mine for 64K.  This causes my system to initialize
64K of RAM.  Thus booting from drive A: starts about 5 seconds after turning
the power on. I then intervene in the boot process to tell the system how 
much RAM it actually has and, to avoid parity errors, I initialize 
all the additional RAM.  

    In my system I have a total of 320K RAM and the initialization of 
the additional 256K takes about a second.  So, in my system, what used to
take about 30 seconds now takes only 6 seconds.  This decrease in startup
time has completely changed my mind about when it was worth firing up my 
system.

    Be aware that my routine is not very bright.  It must be specifically 
taylored for each system.  This is not hard to do so I will discuss the 
routine for my system and then point out what needs to be changed for 
others.


Theory of Operation

    When the pc is turned on the startup process sets two memory locations
according to the system board switch settings.  These locations are:

          40:13H  total system ram (in K)
          40:15H  total I/O ram (in K)

    With the system board switches indicating 64K of ram these values will
be wrong so the fast boot routine must set 40:13H and 40:15H to the correct
values.  My system has a 64K motherboard and 256K on an expansion card 
so my total system ram is 320K (140H) and my I/O ram is 256K (100H). Also,
the fast boot routine must initialize all the ram above the first 64K.  A
quick check with the debug miniassembler shows that the entire routine 
requires about 50 bytes.

    After the system has initialized the ram according to the switch settings
it then loads the first sector of track 0 on drive A: into memory location
0:7c00H and jumps to that location to execute the bootup routine.  A look
at that sector for DOS 2.0 shows that the first program step is a jump to 
offset 2EH which must be the start of the DOS bootup routine.

-l 4000:0 0 0 1

-u 4000:0 l2

4000:0000 EB2C          JMP     002E                               

If I can find a place on this sector to put my 50 byte fast boot routine then
I can replace the JMP 002E with a JMP to the start of my routine.  Then after
my routine is done I can JMP to the DOS bootup routine at 002E.  An 
examination of the remainder of track 0 sector 1 shows that there are no 
unused areas in the sector but there are  several rarely used error messages

-d 4000:190

4000:0190  6B 20 6F 72 20 64 69 73-6B 20 65 72 72 6F 72 0D   k or disk error.
4000:01A0  0A 52 65 70 6C 61 63 65-20 61 6E 64 20 73 74 72   .Replace and str
4000:01B0  69 6B 65 20 61 6E 79 20-6B 65 79 20 77 68 65 6E   ike any key when
4000:01C0  20 72 65 61 64 79 0D 0A-00 0D 0A 44 69 73 6B 20    ready.....Disk 
4000:01D0  42 6F 6F 74 20 66 61 69-6C 75 72 65 0D 0A 00 69   Boot failure...i
4000:01E0  62 6D 62 69 6F 20 20 63-6F 6D 30 69 62 6D 64 6F   bmbio  com0ibmdo
4000:01F0  73 20 20 63 6F 6D 30 00-00 00 00 00 00 00 55 AA   s  com0.......U*
4000:0200  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................

twords the end of the sector.  After looking at them I decided to place my 
routine at 1A0.  Therefore, the first program step of sector 1 track 0 must 
become JMP 01A0 and the fast boot routine begins at 1A0.  Below is a listing 
of the routine with comments. 


-l 4000:0 0 0 1

-u 4000:0 l3

1000:0000 E99D01        JMP     01A0      ;jump to fast boot routine
-u 4000:1a0 l2d

4000:01A0 B84000        MOV     AX,0040   ;set data segment 
4000:01A3 8ED8          MOV     DS,AX     ;to 0040       
4000:01A5 BB1300        MOV     BX,0013   ;ds:bx = 40:13 ttl sys ram address
4000:01A8 B84001        MOV     AX,0140   ;load ax with ttl sys RAM (note 1)
4000:01AB 8907          MOV     [BX],AX   ;set 40:13 to ttl sys RAM
4000:01AD 43            INC     BX        ;ds:bx = 40:14
4000:01AE 43            INC     BX        ;ds:bx = 40:15 = ttl I/O ram add
4000:01AF 2C40          SUB     AL,40     ;subtract 64K from ttl ram (note 2)
4000:01B1 8907          MOV     [BX],AX   ;set 40:15 to ttl I/O ram
4000:01B3 B80010        MOV     AX,1000   ;set starting seg for initialization
4000:01B6 31C9          XOR     CX,CX     ;zero cx, ram will be set to zero
4000:01B8 89CB          MOV     BX,CX     ;set offset to zero
4000:01BA 8ED8          MOV     DS,AX     ;load ds with segment      
4000:01BC 890F          MOV     [BX],CX   ;set ds:[bx] to zero
4000:01BE 43            INC     BX        ;set ds:[bx]     
4000:01BF 43            INC     BX        ;to next address             
4000:01C0 75FA          JNZ     01BC      ;done with this segment?         
4000:01C2 80C410        ADD     AH,10     ;set up ax for next segment 
4000:01C5 80FC50        CMP     AH,50     ;done with initialization? (note 3)
4000:01C8 7402          JZ      01CC      ;yes, jump to DOS bootup
4000:01CA EBEE          JMP     01BA      ;no, initialize next segment 
4000:01CC E95FFE        JMP     002E      ;jump to DOS bootup (note 4)



Notes:

     1.  The total system ram will vary from system to system.  Change the
         value used here to the correct value for your system.

     2.  My system has a 64K motherboard therefore if I subtract 40H from
         the total system ram I will get the correct total for I/O ram.  
         For systems with 256K motherboards the program step:

                 SUB AL,40

         should be replaced by

                 DEC AH

         this subtracts 0100H from the total system ram giving the
         correct value for total I/O ram.

     3.  This is the value for the segment of ram where initialization
         will cease.  In my system, ram occupies segments 0000 through
         4000 therefore I stop initialization when AH = 50.

     4.  If you are using a version of DOS other than 2.0 you may need to
         modify this program slightly.  Specifically, the DOS bootup 
         proceedure may begin somewhere other than offset 2EH and the
         error messages may be in a different location.  I have no version of
         DOS higher than 2.0 so I don't know if modifications are required
         for 2.1 or 3.X.


         
Example:  Mr. Kenley stated that he has 640K of RAM.  Assuming that he has
          DOS 2.0, a 256K motherboard and has set his system switches for 
          64K the fast boot routine becomes:

-l 4000:0 0 0 1

-u 4000:0 l3

4000:0000 E99D01        JMP     01A0                               
-u 4000:1a0 l30

4000:01A0 B84000        MOV     AX,0040                            
4000:01A3 8ED8          MOV     DS,AX                              
4000:01A5 BB1300        MOV     BX,0013                            
4000:01A8 B84001        MOV     AX,0280                            
4000:01AB 8907          MOV     [BX],AX                            
4000:01AD 43            INC     BX                                 
4000:01AE 43            INC     BX                                 
4000:01AF FECC          DEC     AH                              
4000:01B1 8907          MOV     [BX],AX                            
4000:01B3 B80010        MOV     AX,1000                            
4000:01B6 31C9          XOR     CX,CX                              
4000:01B8 89CB          MOV     BX,CX                              
4000:01BA 8ED8          MOV     DS,AX                              
4000:01BC 890F          MOV     [BX],CX                            
4000:01BE 43            INC     BX                                 
4000:01BF 43            INC     BX                                 
4000:01C0 75FA          JNZ     01BC                               
4000:01C2 80C410        ADD     AH,10                              
4000:01C5 80FC50        CMP     AH,A0                              
4000:01C8 7402          JZ      01CC                               
4000:01CA EBEE          JMP     01BA                               
4000:01CC E95FFE        JMP     002E                               


    Once you have decided what changes are necessary for your specific 
system you can modify track 0 sector 1 of your boot disk with the DOS 
debugger as follows.

Start debug then place your boot disk in drive A: (a backup of your boot 
disk is wiser).  Then proceed as follows (select a value for XXXX as is
appropriate for your system).

-l XXXX:0 0 0 1
-a XXXX:0
XXXX:0000 jmp 1a0
XXXX:0003 ^C
-a XXXX:1a0
XXXX:01A0 mov ax,0040
XXXX:01A3 mov ds,ax
       .
       .
       .
XXXX:01CC jmp 2e
XXXX:01CF ^C
-w XXXX:0 0 0 1
-q

Set your system board switches for 64K and you're all ready to stop waiting.

    In the time that my friends and I have been using this routine we have 
only encountered problems with two pieces of software.  They are QuadRam's 
Quaddrive (QD) and MicroPro's installation program (wsinst?).  Both crashed
immediatly, claiming insufficient memory.  Clearly, they read the switches
instead of the RAM.  Otherwise, we have successfully used a wide variety 
of word processors, text editors, spreadsheets, compilers, data bases and 
games with no apparent side effects.  Oh yes, once I got a garbled error
message, but somehow, I was able to decipher it.