home *** CD-ROM | disk | FTP | other *** search
- Custom-Made Boot Messages
- (PC Magazine Vol 5 No 2 January 28, 1986 by Peter Norton)
-
- A problem arises when you send out nonsystem disks to people who
- may not be experienced enough with their PCs to know the difference
- between ordinary disks and the boot disks you use to start your
- computer. If someone starts up his computer with an ordinary disk --
- one that doesn't contain the DOS system files -- he gets a message
- such as: "Non-system disk or disk error. Replace and strike any key
- when ready." While that's certainly not the most technical and
- confusing message you've seen, it's also not very helpful to PC
- beginners who may not know what system disks and disk errors are.
-
- For the disks I send out to customers, I decided it would be nice
- to display a less intimidating message that would provide at least a
- little more helpful information. So I created my own boot record
- program to display something more reassuring. The program can be
- useful to user groups, which distribute thousands of public-domain
- diskettes, and others. Lots of these disks go to those who are just
- learning how to use their computers. It's nice to have a user-friendly
- message that identifies what disk they have and tells them what went
- wrong.
-
- The boot program you create will display a series of messages,
- giving the user whatever information you want. In my case, I tell
- users the name of the product, so they know what they've got, and then
- what they need to do. The program then waits for a keystroke and
- reboots the computer.
-
- Three files are used. The first file, BOOTMAKE.BAT (see below),
- is a regular DOS batch file that automates the process. It assembles
- the boot program and converts it into the proper format, first by
- linking it and then (with EXE2BIN) by converting it from an .EXE to
- a .COM format. Next comes the key step, which uses DEBUG to transfer
- this program onto a diskette's boot record. The batch file finishes
- up by deleting the extraneous files that were created along the way.
-
- To automate the command sequence that tells DEBUG to transfer the
- boot program onto a prospective user's diskette, you use BOOT.DBG,
- which consists of two lines:
-
- W 100 0 0 1
- Q
-
- BOOT.DBG provides DEBUG with the commands that write the boot record
- onto a diskette. BOOTMAKE.BAT uses DOS's redirection facility to pass
- these commands to DEBUG; in order for this to work, of course, you'll
- have to have these commands stored in the right filename. The first
- command in BOOT.DBG writes (W) from memory location hext 100 (where
- the boot program has been loaded) to the A: drive's (0) first or boot
- sector (0) for a length of one sector (1).
-
- BOOTMAKE.BAT and BOOT.DBG take the labor out of creating your
- custom boot record. The part that's really interesting is the assembler
- program (BOOT.ASM) that creates the boot record itself.
-
- BOOT.ASM begins with a jump past some data that describes the
- disk's format. All the disk formats introduced since DOS 2.0 have this
- descriptive information in them. Since my boot record is set up for
- the PC's lowest common denominator, the single-sided, eight-sector
- diskette (a DOS 1.0 format), this information isn't needed. I included
- it partly out of compulsive tidiness and partly to show what is needed
- for other disk formats. If you set up a custom boot record for another
- format, substitute the appropriate information in these fields. The
- best way to find out what belongs here is simply to inspect the
- standard boot record on the disk format you're interested in; you can
- use DEBUG or Norton Utilities' snooping tool to see what the right
- data is.
-
- Next comes the program that makes this boot record work. The
- first three instructions (following the label "begin") give the
- program addressing access to its own data. The hex value 07C0 is used
- because that's the memory segment paragraph address where the PC loads
- the boot program.
-
- Following that is a short program that displays whatever messages
- you want to show. The assembler code is set up so that it automatically
- adjusts to the size of whatever messages you substitute for the ones
- used. The program through "loop continue" does the work of displaying
- the message.
-
- The next two lines of the program simply read a character from the
- keyboard. This makes the program pause so that the user can read the
- messages. After a key is pressed, the program proceeds to clear the
- screen and then reboot the computer. The screen is cleared by using a
- simple trick: It tells the computer to change the video mode (the
- format of the display screen), which always causes the screen to clear;
- to avoid disrupting anything, we first find out what the current mode
- is and then "change" it to the same mode.
-
- Following that simple bit of programming comes the messages to be
- displayed. You can substitute your own messages for the ones used in
- BOOT.ASM. Those used give you all the clues you need to set up yours.
- The lines that read "0Dh,0Ah" are the return carriage and line feed
- characters needed to move from one display line to another. All the
- messages fit within 40 characters in case the computer starts up in
- 40-column mode (as the PCjr does), but that really isn't necessary.
- If you want to position your messages further across the screen, you
- can use the tab character, 09h, to substitute for a bunch of spaces.
- About the only thing you have to be careful with is not to make your
- messages too long to fit. You'll have 424 bytes to hold your messages.
-
- After the messages that you place in the boot record come a few
- assembler statements that count how much space is left in the 512-byte
- boot record; fill it out with padding, and finish the record off with
- a standard 2-byte signature, hex 55 AA.
-
- With this simple program, you'll be able to create your own custom
- boot record messages to help and guide anyone who tries to start his
- computer with your diskette.
-
- There is one minor flaw in this custom boot record. On some PCs
- -- it seems only to be old-model machines with the earliest ROM BIOS
- and those that use only the color/graphics adapter (and some Compaqs)
- -- only part of the messages are displayed. In such cases the rest of
- the program, which waits for a keystroke, clears the screen and
- reboots, works fine, but only about half of the message lines appear
- on the screen.
-
- - - - - -
- BOOTMAKE.BAT:
-
- rem This batch file will
- rem 1) assemble boot.asm
- rem 2) link it into boot.exe
- rem 3) convert it into boot.com
- rem 4) copy it to the boot record
- rem in a diskette in drive A
- rem (be prepared for that)
- rem 5) delete extraneous files
- pause Ready?
- masm boot,boot.obj,nul,nul
- link boot,boot,con;
- exe2bin boot.exe boot.com
- debug boot.com <boot.dbg
- del boot.obj
- del boot.exe
- del boot.com