This is my guide to the Starman's site.

Copyright © 2007, 2011, 2012 by Daniel B. Sedory
NOT to be reproduced in any form without Permission of the Author!

How PC Programs Work:
Understanding x86 (Intel) Machine Code

  This area of  The Starman's Realm could also be called Assembly Language 101. Though most of these pages will deal with pre-existing programs and figuring out how they work rather than teaching you how to create them, we've finally added a page about assembling and compiling x86 Assembly source code under MASM (which is FREE if you know where to look for it; don't worry, we'll show you!). You'll come to understand much about Intel 8086 and other x86 Assembly instructions as you learn how the example programs function on a PC.

Whether you want to create your own programs or simply try to understand how others work, you must have a listing of all the basic Intel x86 Opcodes and a copy of Ralf Brown's famous Interrupt List  (see the References section below for obtaining free downloads of both items). If you move on to C/C++ or Win32 Assembly (see below) programming for Windows®, you'll also need to know about Windows API calls!

What is Hexidecimal?


"Hexa... What?" Well, that's hexa- (six) plus decimal (ten), or sixteen.
It stands for the Base 16 Number System. Programmers often refer to it as simply, Hex (which by itself should mean only six, such as the number of sides that a "Hex wrench" has, but it almost always means Hexadecimal if the subject is computer software rather than hardware).

You may already know that Binary (or Base 2) is what computers actually use to carry out calculations. Octal is Base 8, and Decimal, of course, is Base 10. And just as we have ten digits, 0 through 9, in the Decimal system, there are sixteen digits we could use for Hexadecimal (0-9 and six more).

Just before FAT32 was invented, many people had hard drives that used 32 KiB clusters; with lots of wasted space on them. The space you save by using Windows 2000/XP with NTFS rather than FAT32 can be huge since the size of new drives has already reached triple digits of Gigabytes!

So, what does a Base 16 number system have to do with a machine that's based ( pun intended) on zeros and ones?

    Do any of those numbers above look familiar to you, specifically the number 1024 and its multiples? It's more than just a coincidence that this is equal to the term we call a Binary Kilobyte (1024 bytes, or 2 to the power of 10 or 1 KiB). The 2 Kib, 4 Kib and 16 Kib multiples of this Binary number should now be evident in the Table above. 10,000 Hex (FFFFh + 1) is equivalent to 64 Binary KB (65,536 bytes, or 2 to the power of 16) which is the largest size a true .COM program* can have.

    After laying some groundwork from the past, we'll return to these observations and answer that important question in the box above! Hopefully you'll enjoy the following commentary on highlights from the history of computing.

*Perhaps you've heard of the file COMMAND.COM (it's the kernel for the MS-DOS 7.1 Operating System on a Windows™ 98 Boot Disk). Well it's really an .EXE program! Microsoft® simply felt it had to retain the same name for this file, most likely for compatibility reasons; it hasn't been an actual .COM file since Windows™ 95 was released. A true .COM program can never be more than 64 KiB in size, and does not begin with the letters "MZ" (which you'll find at the beginning of this COMMAND.COM file and all other .EXE files).

A Quick Look at the Amazing History of Computers

Over half a century ago, hot, room-sized machines built with vacuum tubes and relays were already using the same concepts we still use today to carry out instructions on numbers stored as "bits" (Binary digits) in structures known as registers. Today, even our hand-held programmable calculators could blow away those old computers in speed if not in results (number of digits). And the registers have shrunk from the size of handfuls of light bulbs to a space so tiny you need an electron microscope to see it; yet they still continue to add, subtract and compare bits by the same logical methods already known long before those now archaic machines could have been built.

Programs were often stored and fed into those first computers from patterns of holes punched into a roll of paper tape (Punched Tape). This idea came from an earlier device called the teletype (or teletypewriter or teleprinter), which used a seven-bit code we now call ASCII to send alphanumeric data over wires. Essentially this same bit code or expansions upon it, such as Unicode, are still used to store data on a PC. Designed for communications, the original code included control characters to signal the start of, success, failure, and end of transmissions. The ASCII code 7, was used to ring a real bell at a distant station, thus it is often abbreviated as "bell" in an ASCII chart. Programs now use it to beep a computer's speaker!

Some of the 33 control codes used decades ago, such as ASCII 8 (a Backspace), 10 [0Ah] (a Line Feed), and 13 [0Dh] (a Carriage-Return) are still fairly close to their original meanings, while others were so "device dependent" that modern day equivalents no longer exist.

Seven bits gives us a total of 128 different codes in the standard ASCII character set. That's 64 + 32 + 16 + 8 + 4 + 2 + 1 or 127, plus the zero. At a much later date, companies such as IBM® and Apple® introduced their own Extended ASCII character sets; which were eventually followed by Unicode.

Read the full page at:

A Few Details about the IBM PC and Microsoft
Instead of making its own Disk Operating System, IBM® paid a little software company to put together a DOS for their new IBM Personal Computers. But, IBM did not pay for exclusive rights to any future uses of this DOS. And when that little company (called Microsoft®) made some changes and started selling MS-DOS to anyone, it wasn't long until a flood of "AT clones" and "IBM - compatibles" spread across the globe! Microsoft and Intel® made a fortune selling the essential software and hardware that made up a PC, but IBM simply acted like its usual "big blue" self over the losses in home and small business sales. I'm sure that IBM now wishes they had done things differently, but perhaps that's what they deserved for making a calculated decision to promote Microsoft's DOS instead of an 8086 version of CP/M by Gary Kildall (which later became Digital Research DOS). And in spite of what you may read elsewhere, Gary never 'lost out' to Bill Gates due to any personal differences or missed meetings! It was simply a business decision by IBM; which appears to have been done on purpose since IBM's DOS could only be used on their machines, whereas Gary's OS was almost machine independent. It's a little known fact (these days) that IBM actually licensed both DOS and CP/M-86 for their PC, but you had to special order CP/M-86 rather than having it come at a much lower price with most PCs as IBM's DOS did; that was clearly a business decision on the part of IBM!

Bits, Bytes, Characters and Words
Data in these new microcomputers was contained in 8-bit units called "bytes" (a combination of the word bit and to bite; a 4-bit unit is often called a "nibble" ). IBM® later added an extended-ASCII character set for their PCs, which doubled the size from 128 to 256 codes. Inside the Processor itself (the CPU), there were also registers of 16-bit lengths. The machine code which ran the CPU could have instructions of this size too, or even larger, arriving at the CPU in a number of successive bytes. It was around this time, that the term "word" took on its usual meaning of two eight-bit bytes. So, how did they manipulate such large binary numbers without making too many mistakes?

Why Octal and Hexadecimal are used On Computers

Long before this, programmers regularly used a convenient method to handle large binary numbers in either 3-bit or 4-bit groupings. Most people find it quite easy to see what decimal numbers are represented by only three bits; for example, 101 is 5, 011 is 3, etc. If we use the 3-bits at a time method to convert the binary number 111000101000 into groups of 3-bit decimal digits, we obtain: 7 0 5 0. "If you needed to turn this into an Octal (Base 8) number, what more would you need to do?" Nothing! The digits 7050 are the Octal equivalent of this Binary number; it's almost too simple. But to convert either of them into Decimal is a lot more difficult for most of us; yet it's quite often unnecessary for a programmer to do so.

Not long after computers needed to be programmed, the actual machine code for the computer instructions was replaced by mnemonics (first m is silent when pronouncing this word; it essentially means abbreviations). Three or four letters (at first), were used in what was called the Assembly Language for a particular CPU; thus, today we have the x86 Assembly code (in various forms) for Intel-based computers. It was also possible to use more than one base numeration for writing data in these Assembly languages, so programmers made sure their Assemblers [the programs which convert Assembly language into a particular machine code] could understand Octal as well as Binary numbers.

Well, what about Hexadecimal? The same Binary number above, grouped into four bits at a time, will give us the Hex numerals, E28. Now we're finally getting to the bottom of that important question above; and the main reason I wanted to write this essay.

The maximum number a four-bit Binary can represent is 15. Exactly the same as a single Hex digit. And if you sum up the next four higher bits in a Binary number having eight bits, for example, the ones in 11110000, you'll get 16+32+64+128 = 240, or simply 15 times 16. And the next four bits beyond that will give you 15 times 256, or 3840.

Let's compare the differences between grouping the Binary digits in sets of fours (for Hexadecimal) and threes (for Octal) in a more graphic manner :

Binary:  | 2048 1024 512 256 | 128 64 32 16 | 8 4 2 1 | = 1111 1111 1111
  HEX :  |       256's       |     16's     |   1's   | =   F    F    F 
Computing      (15 x 256)    +  (15 x 16 )  +   15
 Decimal          3840       +     240      +   15      =    4 0 9 5
Binary: |2048 1024 512 | 256 128 64 | 32 16 8 | 4 2 1 | = 111 111 111 111
 OCTAL: |    512's     |     64's   |   8's   |   1's | =  7   7   7   7 
Computing ( 7 x 512 ) +  ( 7 x 64 ) + (7 x 8) +   7
 Decimal     3584     +     448     +    56   +   7     =    4 0 9 5
 F F F h  =  7 7 7 7  Octal  =  4 0 9 5 (Decimal).

This shows that it's almost as easy to extract a Hexadecimal number from a Binary as it was to obtain its Octal equivalent. We simply group the Binary bits by four digits instead of three.


There are two important aspects to the beauty of using Hexadecimal with computers: First, it can represent 16-bit words in only four Hex digits, or 8-bit bytes in just two; thus, by using a numeration with more symbols, it is both easier to work with (saving paper and screen space) and makes it possible to understand some of the vast streams of data inside a computer merely by looking at the Hex output. This is why programs such as DEBUG, use only Hexadecimal to display the actual Binary bytes of a Memory Dump rather than a huge number of ones and zeros!

The second aspect is closely related: Whenever it is necessary to convert the Hex representation back into the actual Binary bits, the process is simple enough to be done in your own mind. For example, FAD7 hex is 1111101011010111 (F=1111, A=1010, D=1101, 7=0111) in Binary. The reason one might wish to do this is in order to work with "logical" (AND, OR or XOR) or "bit-oriented" instructions (Bit tests, etc.) which may make it easier (at times) for a programmer to comprehend.

For example, if you wanted to logically AND the hex number FAD7 with D37E, you might have a difficult time without first changing these numbers into Binary. If you jot them out in Binary on scratch paper, the task will be much easier:

FAD7(hex) =  1 1 1 1  1 0 1 0  1 1 0 1  0 1 1 1
   D37E(hex) =  1 1 0 1  0 0 1 1  0 1 1 1  1 1 1 0
 ANDing gives:  1 1 0 1  0 0 1 0  0 1 0 1  0 1 1 0
   the Answer:     D       2        5       6
     (in hex)

Final thoughts
One final bit of advice: Remember that memory, stored programs, or codes always begin counting their locations or offsets with a ZERO (0). So, to arrive at a total you must add a one (1) to whatever number you see in the tables above: Thus, the amount of total memory locations in FF hex or the total length in bytes of a program that ends at offset FFh is 256 (inclusive), not just 255. In this case, an old phrase you may have heard, "nothing counts," is quite literally true as a zero stands for the first (1st) location you start counting from.

However, any given 8-bit byte of memory, can never hold or count up to anything larger than FF hex, or 255,
since a zero in a memory register represents the idea of nothing being in there (a true nil or null). In this case, the zero in a data register does not really count, because it is being used as a symbol to convey the idea that there isn't anything in there yet; it's only a void or emptiness!

Copyright ©1996,1997,1999,2000,2002,2003,2004 by  Daniel B. Sedory
 < Online reply form here >

Legal Personality
To have legal personality means to be capable of holding legal rights and obligations[1][2] within a certain legal system, such as entering into contracts, suing, and being sued.[3] Legal personality is a prerequisite to legal capacity, the ability of any legal person to amend (enter into, transfer, etc.) rights and obligations. In international law, consequently, legal personality is a prerequisite for an international organization to be able to sign international treaties in its own name.

The capacity of natural and juridical persons, and legal persons in general, determines whether they may make binding amendments to their rights, duties and obligations, such as getting married or merging, entering into contracts, making gifts, or writing a valid will. Capacity is an aspect of status and both are defined by a person's personal law:

Intellectual property (IP)
refers to creations of the intellect for which a monopoly is assigned to designated owners by law.[1] Intellectual property rights (IPRs) are the protections granted to the creators of IP, and include trademarks, copyright, patents, industrial design rights, and in some jurisdictions trade secrets.[2] Artistic works including music and literature, as well as discoveries, inventions, words, phrases, symbols, and designs can all be protected as intellectual property.

Shareware is a type of proprietary software which is initially provided free of charge to users, who are allowed and encouraged to make and share copies of the program. Shareware is often offered as a download from an Internet website or as a compact disc included with a magazine. Shareware is available on all major personal computer platforms. The term shareware is used in contrast to open-source software, in which the source code is available for anyone to inspect and alter; and freeware, which is software distributed at no cost to the user but without source code being made available.

There are many types of shareware, and while they may not require an initial up-front payment, all are intended to generate revenue in one way or another. Some limit use to personal non-commercial purposes only, with purchase of a license required for use in a business enterprise. The software itself may be limited in functionality or be time-limited, or it may remind the user that payment would be appreciated.

See the Mozilla/Netscape/Firefox browser shareware license on this page:


In cultures that practice marital monogamy, bigamy is the act of entering into a marriage with one person while still legally married to another.[1] Bigamy is a crime in most Western countries, and when it occurs in this context often neither the first nor second spouse is aware of the other.[2][3] In countries that have bigamy laws, consent from a prior spouse makes no difference to the legality of the second marriage, which is usually considered void.

When the first 386 computers with the Microsoft DOS 5 O/S were released in 1991 they could access Edits' online Help through the use of an external modem which used BitCom software It was provided free by the modem manufacturer. Here is the BitCom manual  BitCom

The intel 80386 chip (introduced in October 1985)  added a 32-bit architecture and a paging translation unit, which made it much easier to implement operating systems that used virtual memory. It also offered support for register debugging.

 Timeline of DOS Operating Systems
It is interesting to note that DR DOS was released in 1990 and is virtually the same as Microsoft DOS. There is more about vapourware on the following page.

COMMAND.COM is the default command-line interpreter for DOS, Windows 95, Windows 98 and Windows ME. In the case of DOS, it is the default user interface as well. It has an additional role as the first program run after boot, hence being responsible for setting up the system by running the AUTOEXEC.BAT configuration file, and being the ancestor of all processes. COMMAND.COM's successor on OS/2 and Windows NT systems is cmd.exe, although COMMAND.COM is available on IA-32 versions of those operating systems.

COMMAND.COM is a DOS program. Programs launched from COMMAND.COM are DOS programs that use the MS-DOS API to communicate with the operating system (DOS).

CONFIG.SYS is the primary configuration file for the DOS and OS/2 operating systems. It is a special ASCII text file that contains user-accessible setup or configuration directives evaluated by the operating system during boot. CONFIG.SYS was introduced with DOS 2.0.[nb 1]

The directives in this file configure DOS for use with devices and applications in the system. The CONFIG.SYS directives also set up the memory managers in the system. After processing the CONFIG.SYS file, DOS proceeds to load and execute the command shell specified in the SHELL line of CONFIG.SYS, or COMMAND.COM if there is no such line. The command shell in turn is responsible for processing the AUTOEXEC.BAT file.

CONFIG.SYS is composed mostly of name=value directives which look like variable assignments. In fact, these will either define some tunable parameters often resulting in reservation of memory, or load files, mostly device drivers and TSRs, into memory.

In DOS, CONFIG.SYS is located in the root directory of the drive from which the system was booted.

AUTOEXEC.BAT is a system file that was originally on DOS-type operating systems. It is a plain-text batch file in the root directory of the boot device. The name of the file is an abbreviation of "automatic execution", which describes its function in automatically executing commands on system startup; the filename was coined in response to the 8.3 filename limitations of the FAT file system family.

AUTOEXEC.BAT is read upon startup by all versions of DOS, including MS-DOS version 7.x as used in Windows 95 and Windows 98. Windows ME only parses environment variables as part of its attempts to reduce legacy dependencies,[1] but this can be worked around.[2] In Korean versions of MS-DOS/PC DOS 4.01 and higher (except for PC DOS 7 and 2000), if the current country code is set to 82 (for Korea) and no /P:filename is given and no default AUTOEXEC.BAT is found, COMMAND.COM will look for a file named KAUTOEXE.BAT instead in order to ensure that the DBCS frontend drivers will be loaded even without properly set up CONFIG.SYS and AUTOEXEC.BAT files.[3]

Under DOS, the file is executed by the primary copy of the command-line processor (typically COMMAND.COM) once the operating system has booted and the CONFIG.SYS file processing has finished. While DOS by itself provides no means to pass batch file parameters to COMMAND.COM for AUTOEXEC.BAT processing, the alternative command-line processor 4DOS supports a 4DOS.INI AutoExecParams directive and //AutoExecParams= startup option to define such parameters.[4] Under Concurrent DOS, Multiuser DOS and REAL/32, three initial parameters will be passed to either the corresponding STARTxxy.BAT (if it exists) or the generic AUTOEXEC.BAT startup file, %1 holds the virtual console number,[5] %2 the 2-digit terminal number (xx) (with 00 being the main console) and %3 the 1-digit session number (y).[6]

Windows NT and its descendants Windows XP and Windows Vista parse AUTOEXEC.BAT when a user logs on. As with Windows Me, anything other than setting environment variables is ignored.[7] Unlike CONFIG.SYS, the commands in AUTOEXEC.BAT can be entered at the interactive command line interpreter. They are just standard commands that the computer operator wants to be executed automatically whenever the computer is started, and can include other batch files.

AUTOEXEC.BAT is most often used to set environment variables such as keyboard, soundcard, printer, and temporary file locations. It is also used to initiate low level system utilities, such as the following:

  • Virus scanners
  • Disk caching software
  • Mouse drivers
  • Keyboard drivers
  • CD drivers
  • Miscellaneous other drivers

HIMEM.SYS is a DOS device driver which allows DOS programs to store data in extended memory via the Extended Memory Specification (XMS). This device driver is of particular importance because various versions of Microsoft Windows that ran on top of the DOS operating system required HIMEM.SYS to be loaded to be able to run.

As of MS-DOS 5.0, HIMEM.SYS was introduced and could be used to load the DOS kernel code into the High Memory Area (HMA) to increase the amount of available conventional memory by specifying DOS=HIGH in CONFIG.SYS.

HIMEM.SYS provides access to the memory beyond the first 1 MB of space and thus is required by Windows 9x/Me in order to load the graphical portions of the operating systems. In FreeDOS, the matching file is named HIMEM.EXE and can be loaded from the FreeDOS configuration file named FDCONFIG.SYS or CONFIG.SYS.

In DR DOS 5.0 and 6.0, the driver was named HIDOS.SYS rather than HIMEM.SYS.

In Windows 9x, there is also a command-line loadable version of HIMEM.SYS called XMSMMGR.EXE. It can load extended memory services after the system boots into the command prompt. This allows Windows Setup to load even if HIMEM.SYS is not loaded.

The name  EMM386 was used for the expanded memory managers of both Microsoft's MS-DOS and Digital Research's DR-DOS, which created expanded memory using extended memory on Intel 80386 CPUs. There also is an EMM386.EXE available in FreeDOS.[1]

EMM386.EXE can map memory into unused blocks in the upper memory area (UMA), allowing device drivers and

TSRs to be "loaded high", preserving conventional memory.

The technique probably first appeared with the development of CEMM, included with Compaq MS-DOS 3.31 in 1987. Microsoft's version first appeared, built-in, with Windows/386 2.1 in 1988 and as standalone EMM386.SYS with MS-DOS 4.01 in 1989; the more flexible EMM386.EXE version appeared in MS-DOS 5.0 in 1991.

Just as the other expanded memory managers, EMM386 uses the processor's virtual 8086 mode. It temporarily shuts down during a Windows session in 386 Enhanced mode, with Windows' protected mode kernel taking over its role.

A RAM drive (RAMDRIVE.SYS also called a RAM disk) is a block of random-access memory (primary storage or volatile memory) that a computer's software is treating as if the memory were a disk drive (secondary storage). It is sometimes referred to as a virtual RAM drive or software RAM drive to distinguish it from a hardware RAM drive that uses separate hardware containing RAM, which is a type of battery-backed solid-state drive.

SmartDrive (or SMARTDRV) was a disk caching program shipped with MS-DOS versions 4.01 through 6.22 and Windows 3.0 through Windows 3.11.[1] It improved data transfer rates by storing frequently accessed data in random-access memory (RAM).[2]

Early versions of SmartDrive were loaded through a CONFIG.SYS device driver named SMARTDRV.SYS.[1] Versions 4.0 and later were loaded through an executable file named SMARTDRV.EXE, which could be run at user's discretion or at boot time via AUTOEXEC.BAT.[1] However, SMARTDRV.EXE also includes double-buffering driver that should be loaded through CONFIG.SYS.[2] Version 4.0 also introduced 32-bit disk access and could reduce its footprint in conventional memory (the first 640 kilobytes of memory which was critical to DOS) by running in upper memory area (the 384 kilobytes of memory located beyond the conventional memory).[2]

A cloaked variant of SmartDrive utilizing the Helix Cloaking API was available from Helix Software. On Intel 80386 processors, it could run in protected mode to reduce its footprint in conventional memory.

Microsoft suggests SmartDrive to be used when installing Windows 2000 or Windows XP from MS-DOS to reduce installation time.[3]

See also

https://en.In computing, XCOPY is a command used on PC DOS, MS-DOS, OS/2, Microsoft Windows, and related operating systems for copying multiple files or entire directory trees from one directory to another and for copying files across a network. XCOPY stands for extended copy,[1] and was created as a more functional file copying utility than the copy command found in these operating systems. XCOPY first appeared in DOS 3.2.

Create a new directory by copying all contents of the existing directory, including any files or subdirectories having the "hidden" or "system" attributes and empty directories.

xcopy e:\existing e:\newcopy /e /i /h

Xcopy fails with an "insufficient memory" error when the path plus filename is longer than 254 characters[3] and moving large files without the "/j" option (available only after Server 2008R2) can consume all available RAM on a system.[4]

My DOS 5 manual, p 589 says xcopy does not copy hidden and system files. In previous versions it did, but not in MS-DOS 5. To remove the hidden or system attribute from a file, use the attrib command.
From what I remember, Bill Gates was having trouble with the copy command because trying to copy system files meant that two files had to be combined making them too big to be copied. I created xcopy specifically for this.


Make a free website with Yola