Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

x86 Assembly Language FAQ - General Part III

( Part1 - Part2 - Part3 )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Cities ]
x86 Assembly Language FAQ - General Part III
From: fys_at_cybertrails.com (Ben Lunt)
Subject: x86 Assembly Language FAQ - General Part 3 of 3
Supersedes: <89sf4a$stn$6@news.dgsys.com>
Followup-To: alt.lang.asm,comp.lang.asm.x86
Date: 3 Mar 2004 23:04:44 MST
Organization: Forever Young Software
Lines: 935
Approved: news-answers-request@MIT.EDU
Distribution: world
Expires: Tue, 22 Jun 2004 23:59:59 GMT
Message-ID: <8b8v6c$n7i$6@news.dgsys.com>
Reply-To: fys@cybertrails.com
Summary: This is the FAQ for the x86 Assembly Language programmers for the
alt.lang.asm and comp.lang.asm.x86 newsgroups. This particular section of the
FAQ is part three of three parts that contain x86 assembly language
information
common to all assemblers.
Keywords: x86 Assembly Language ASM FAQ General

See reader questions & answers on this topic! - Help others by sharing your knowledge
Archive-Name: assembly-language/x86/general/part3
Posting-Frequency: monthly (21st of every month)
Last-modified: 2004/03/03
------------------------------


Subject: 26. WWW Assembly HomePages
26.1  CAUTION

Individuals maintain all of the web sites listed here.  I will strive to
maintain this list current but do not be surprised if the addresses no
longer are current.

26.2 ASSEMBLY LANGUAGE RELATED HOME PAGES

Randy Hyde's Assembly Language Page
    http://webster.cs.ucr.edu/
        Excellent tutorial, Art of Assembly Language
        ASM Style Guide

Christian Ludoff's 80x86 Sandpile Page
    http://www.sandpile.org  Basic Page

Benjamin David Lunt's DOS assembly page
    http://www.cybertrails.com/~fys/index.htm
       Assembly language programming in DOS, Undocumented DOS,
         DOS secrets, and DOS help.

EG3 Electronic Communication's Electronic Engineer's Toolbox
    http://www.eg3.com/softd/assembly.htm

Robert Collins' x86 Monthly Digest
    http://www.x86.org/
        Intel processor bugs
        Intel data sheets and programming manuals
        In-Depth articles
        Productivity ehancements and programming tips
        Rober Collins' Dr. Dobb's Journal Undocumented Corner.
        Much more

Jannes Faber's Assembly home page
    http://www.mavrahane.com/program/assembly/assembly/ass.htm [broken]
        List of ASM Books with short reviews
        A few hints and tricks
        Complete source code to some of his programs
        A listing of EMS Professional Shareware products

Ray Rose's HTML For Assembler home page
    http://www.alaska.net/~rrose/assembly.htm [broken]
        An extensive list of ASM books without descriptions
        Links to alt.lang.asm, comp.lang.asm.x86, and
            alt.msdos.programmer newsgroups.
        Link to the Yahoo/Computers and Internet/Languages/Assembly page
            (see below)

Michael Babcock's Programming Home Page (many broken links on pages)
    http://w3.tyenet.com/mbabcock/mtb.programming.html
        This home page has links to:
            Optimizing 803/4/586 ASM Programming
                http://w3.tyenet.com/mbabcock/prg.optimize.html
            ASM Tutorial
                http://w3.tyenet.com/mbabcock/prg.asmtut1.html
            Utilities
                http://w3.tyenet.com/mbabcock/prg.utils.html

Dr. ASM's Assembly Home Page
    http://web.syr.edu/~dbgrandi/assembly.htm [Broken]
    Some answered questions and links to other assembly related sites.

James Vahn's 80xxx Snippets - 80x86 Assembly Language Enthusiasts
    http://www.cet.com/~jvahn
        Download snippets & Booklist

Kip Irvine's Assembly Language Sources
    http://www.nuvisionmiami.com/books/asm/index.html

Gavin Estey's Home
    http://burks.brighton.ac.uk/burks/language/asm/
        His ASM tutorial, other ASM Links, FAQs and Optimizations

Grzegorz Mazur's x86 CPU Stuff
    http://grafi.ii.pw.edu.pl/gbm/x86/index.html
        x86 CPU identification algorithms
        Cyrix/IBM5x86/6x86 (and 486) control program
        Links to other information on x86 family CPUs

Eric Isaacson's A86 Assembler and D86 Debugger Page
    http://eji.com/a86/index.htm
        Overviews of a86 and a386 assemblers, d86 and d386 debuggers,
            download and purchase of a86 and d86.

Tore Nilsson's Assembly Tutorial Page
    http://www.ice-digga.com/programming/ [Broken]
        VLA's Assembly and DMA programming tutorials, Asphyxia's VGA
            tutorials, and some graphics and sound programming
            information.

Gerd Kortemeyer's 387/486DX/Pentium/Floating Point Processor Stuff
    http://atlas.csd.net/~cgadd/knowbase/MISC0034.HTM
        A collection of assembler routines written for Turbo Pascal and
        C++.

Cameron's 386+ Programming Page             NOT CURRENTLY WORKING
    http://free.prohosting.com/~cameron/
        32 bit DOS extender/Utilities/pmode extender
        File formats and specifications/Game programming
        Knowledge Base with ASM tutorials, Denthor's VGA Trainer and
            Univ. of Guadalajara ASM tutorial

Peter's PMODE Home Page
    http://www.geocities.com/SiliconValley/Peaks/1231/
        Pmode tutorials and programming related files

Niko Komin's Assembler for PCS page
    http://www.inx.de/~nkomin/html/assembe.htm
        Shareware, pmode, x86 mnemonics, ASM related links.

Kurt I. Groenbech's Alab Homepage
    http://tihlde.org/~kurtg/index2.html
        Home page for the Assembler Laboratory that is an IDE for
            assemblers

Bob Richardson's PC Assembly Language Page
    http://bobrich.lexitech.com/ [Broken]
        Eighteen topics taken from his SELFIN PC Assembly Language
            Group.

Jesper Pedersen's Processor Information Page
    http://www.imada.ou.dk/~jews/PInfo/intel.html [Broken]
        List of instructions and opcodes used by Intel, AMD, Cyrix and
            Nexgen.

Quantasm's x86 and Pentium Programming Tips and Info
    http://www.quantasm.com/freeinfo.html [Broken]

Ferdi Smit's Assemble It! Page
    http://www.xs4all.nl/~smit/
        His own source code, 3D programming, his own ASM tutorial,
            optimization and other information.

Paul Hsieh's x86 Assembly Language Page
    http://www.azillionmonkeys.com/qed/asm.html
        Feature articles, Optimization and General
            Programming/References

Charles Winner's ASM Resources
    http://www.eecs.utoledo.edu/~cwinner/assembly.html [Broken]

G. Adam Stanislav's Whiz Kid Technomagic
    http://www.geocities.com/SiliconValley/Heights/7394/
        Win95 Assembly Language source code examples

John Eckerdal's Assembly Page
    http://www.geocities.com/SiliconValley/Park/6452/index.html
        Nice collection of Assembly Gems.

Gaz's Little Web Programming Page
    http://www.fortunecity.com/skyscraper/fatbit/427/programming.html
        Protected Mode Tutorial and large library of NASM source code
        written for the WDosX 32 bit DOS extender

Christopher Giese's Triple Fault Club
    http://www.execpc.com/~geezer/os/
        NASM and DJGPP Code, Protected Mode Code, OS Code

The Bass Demon's Operating System Theory Page
    http://home.no.net/tkos/ [Broken]
        Information on Hard Disks, Partitioning and Booting, FAT
        specific file system information, File system theory article,
        Available assembler source codes and Memory Management

Anthony's Programming Page:
    http://alink.home.dhs.org/
        Home of ALINK, a freeware linker for MSDOS and Win32. It links
        Intel/Microsoft OMF object and library files, to MSDOS COM and
        EXE files, and PE files for Win32 (including DLLs). Source code
        (ANSI C) is also available for download - this should compile
        with any 32-bit ANSI C compiler.

Craig Peacock's Interfacing the PC Page
    http://www.beyondlogic.org/
        Much information about interfacing with the parallel and serial
        ports, information about IRQs and AT keyboards, and many links
        to more technical information.

Chris Dragan's Home Page
    http://chris.dragan.name/
        His own programs and assembler source code, Win32 programs.

David Lindauer's LADSoft Computer Page
    http://members.tripod.com/~ladsoft/
        PMODE Information
        Windows assembly demos for TASM
        MSDOS Demo/utility programs

Jan Wagemakers' Linux and Assembler Home Page
    http://www.janw.easynet.be/eng.html

Brennan's Guide to Inline Assembly
    http://setiathome.ssl.berkeley.edu/~korpela/djgpp_asm.html
        Information on AT&T syntax

Dr. Carter's PC Assembly Programming Code Page
    http://www.comsc.ucok.edu/~pcarter/pcasm/code/
        Much NASM code

Gustavo Net's ASM page
    http://www.gustavo.net/programming/asm.shtml
        Links to tutorials, Programmer's Forum, source code, and more.

Henry S. Takeuchi's Windows 95 Assembly Language Programming
    http://www.eskimo.com/~htak/win32asm/win32asm.htm
        Source code and tutorial

Glenn Strycker's The International Brotherhood of Assembly/Machine
Programmers (IBAMP)
    http://www.members.kconline.com/strycker/IBAMP/index.html [Broken]
        Assembly Chat and Forum, links, source code

Alexei A. Frounze HomePage!
    http://alexfru.chat.ru/eindex.html
        Protected Mode information, many ASM Links, V86 Mode Monitor
        Tutorial, COFF Utilities

Linux/i386 assembly programming page
    http://linuxassembly.org
        Linux assembly documentation, tutorials and utilities. Many
        Linux related links.

Alex Verstak Programming Page
    http://members.tripod.com/~averstak/
        Much disk structure, e.g., boot, FAT, directory and filenames -
        short and long

Free Programming Resources::Assembly Section
    http://www.freeprogrammingresources.com/assembly.html
    Assembly Tutorials

"ClipX Legacy Defined"
    http://www.clipx.net/norton.php
    Top left side of the page has a list of assembly information, mainly to do
    with DOS and hardware programming.

"Rick Hohensee's cLIeNUX/interim directory"
    contains several works pertaining to coding the x86 asm-level-explicitly,
from
    Linux or similar. In
      ftp://ftp.gwdg.de/pub/cLIeNUX/interim
    you will find...

      osimplay           OSen as easy as child's play
                         supercedes shasm, which was an assembler in Bash.
                         osimplay has a few high-level-like features. I
                         don't use C anymore.

      H3sm               Hohensee's 3-stack machine
                         is a 3-stack Forth-like language written separately
                         in C and in Gas using the asmacs m4 macros that
became
                         osimplay. The difference between C and Gas for a
stack
                         language is huge, and illustrative. A Forth-like
routines
                         "dictionary" is basically unoptimizeable by a
compiler.
                         The asm version is much less hideous, and faster.

      H3rL               Hohensee's 3-ring Linux
                         is the asm version of H3sm installed into the Linux
                         kernel as a kernel thread, like a kernel debugger,
but
                         with a prompt always on vt1 (until H3sm crashes).

      Ha3sm              Hohensee's Autonomous 3-stack machine
                         is an OS design sketch based on H3sm.

      eforthl            (Ting, Muench) is a Forth (Charles Moore) in
                         Gas for Linux (Rideau) with 160 syscalls and other
                         tweaks (Hohensee). It's 19k with all the syscalls.

      libsys             is a syscalls-only linking library and ctr0.S
replacement
                         to work without libc. ViralinuxII, also in this
directory,
                         uses it for a 1-floppy Linux.

      Forreal.tgz        is a bootable demo of Forreal Mode, which is 32-bit
                         unprotected, which I (Rick Hohensee) seem to be the
first
                         to have explained, and I have it running interrupt
handlers
                         (in the low meg). No, it's not quite Unreal Mode.

                         The bootable in Forreal.tgz is written in osimplay,
                         an 80386 assembler (compembler?) with no dependancies
                         besides a Linux build host (or similar) and the GNU
                         Bash shell. The code in Forreal is prepatory to
writing
                         Ha3sm in osimplay.

    As I write this I am working on a MASM-->osimplay translator in Bash,
which will
    probably only support enough MASM to convert Chuck Moore's colorForth to
osimplay.
    Then I'll want a Gas-->osimplay, which may be up when you read this, along
with
    various programs converted from Gcc/Gas to osimplay. I hope.


Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
              Benjamin D Lunt, fys_at_cybertrails.com
              Rick Hohensee, rhohen@linux01.gwdg.de
Last changed: 02 Jun 2004

Return to the Table Of Contents------------------------------
Subject: 27. Common Reason Why Memory Allocation Fails
27.1  BACKGROUND

A common error received when first learning to use Int 21h Function 48h,
allocate memory, is error code 8, insufficient memory available.
Usually, the programmer then writes a small program that only allocates
memory, and the program still fails.  This situation is quite puzzling
because there should be hundreds of kilobytes of memory available but
this function reports that there is insufficient memory for a few
hundred bytes.  The reason is that DOS generally allocates all available
memory above the loaded program to that program.  Therefore, there is no
more memory to allocate, so the request fails.

27.2  .COM FILES

Since a .COM file does not contain any header information, the DOS
loader has no way of determining how much memory is required for a
program beyond the physical size of the program.  Even this number is
deceptive because it does not include a stack.  Therefore, DOS always
allocates all available memory above the program to the program.

To use the allocate memory function, the programmer must release that
extra memory using Int 21h Function 4ah, Set Memory Block Size.  Given
that generally there is more that 64 Kbytes of memory, the DOS sets
Stack Top to just under that value, it is generally safe to release all
memory above 64 Kbytes.

27.3 .EXE FILES

The amount of memory the DOS allocates to the loaded program depends
upon a value in the .EXE header.  This value is called Maximum
Allocation and is a word starting at offset 12.  This value specifies
the number of 16-byte paragraphs beyond the image size wanted by the
program to execute.  This value must be equal or greater than the
Minimum Allocation, which is the number of 16-byte paragraphs beyond the
image size required by the program to execute.  This space generally
contains uninitialized variables and the stack.

The value of Maximum Allocation is set by the /CPARM Option for the
Microsoft Linker.  By default, the linker sets this value to 0ffffh that
will causes DOS to allocate the largest block of available memory.  This
memory can be used as a heap, print buffer, etc.

27.4  DETERMINING HOW MUCH MEMORY IS AVAILABLE TO A PROGRAM

In the PSP, at offset 02h, DOS loads a word that is the segment address
of the next Memory Control Block or Arena.  Subtracting the PSP from
that value at offset 02h will be the number of memory paragraphs
allocated to the program.  The number of bytes can be calculated by
shifting that number to the left by 4 bits, multiplying by 16, the size
of a memory paragraph.

27.5  HOW TO DEALLOCATE MEMORY AT THE START OF A PROGRAM

If you want to load and execute another program, you must release memory
to make room for the program.  Also, since the largest chunk of memory
is allocated already to the program, all requests to allocate memory
generally fail.

Again, to use the allocated memory function, the programmer must release
the extra memory above the program use as for a .COM file above.  The
problem here is where is the end of the program.  The answer is not as
simple as with the .COM file.  There are two basic solutions.

1.  If you use the .dosseg option, the Microsoft Linker will define a
label, _end, at the end of the DGROUP.  Since the .dosseg option also
places any FAR data segments between the code and DGROUP segments, you
can release all memory above that label.

2.  If you do not want or are unable to use the first option, use an
include file which declares all segments used by your program.  Define a
label in the last segment and use it as the _end label in the first
example.

27.6  TELLING DOS NOT TO ALLOCATE ALL AVAILABLE MEMORY AT STARTUP

If you are using a Microsoft Linker or a compatible linker, you can use
the /CPARMMAXALLOC or /CP switch.  Set this switch to /CP:1.  The Linker
places 1 at offset 0ch in the .exe header.  This tells DOS that you only
need a maximum of 1 paragraph of memory above your program.  DOS
compares this to the minimum memory required at offset 0ah in the .exe
header.  If the max is less than the minimum, DOS assigns the minimum.
Therefore, your program gets only the memory necessary for it to
execute, and all other memory above your program is available for
allocation.

Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
Last changed: 21 Feb 99

Return to the Table Of Contents------------------------------
Subject: 28. Volume Serial Numbers
28.1  VOLUME SERIAL NUMBER FORMAT

The volume serial number was introduced with DOS 4.0 as part of an
extended boot record and is created through you either FORMAT a disk or
use DISKCOPY to create another disk.  The serial number is a function of
the time/date of the formatting or the diskcopying.  Note that DISCOPY
generates a new volume serial number so a DISKCOPY is not an exact image
of the source diskette.

28.2  CALCULATING THE VOLUME SERIAL NUMBER

For example, say a disk was formatted on 26 Dec 95 at 9:55 PM and 41.94
seconds.  DOS takes the date and time just before it writes it to the
disk.

Low order word is calculated:               Volume Serial Number is:
    Month & Day         12/26   0c1ah
    Sec & Hundrenths    41:94   295eh               3578:1d02
                                -----
                                3578h

High order word is calculated:
    Hours & Minutes     21:55   1537h
    Year                1995    07cbh
                                -----
                                1d02h

Note that DOS interrupt 21h Functions 2ah, Get DOS Date, and 2ch, Get
DOS Time, are particularly suited to getting the date and time for
calculating the Volume Serial Number.

28.3 READING AND SETTING THE VOLUME SERIAL NUMBER

To read the Volume Serial Number, use the IOCTL call, Int 21h function
440dh Minor Code 66h, Get Media ID.  To write the Volume Serial Number,
use the IOCTL call, Int 21h function 440dh Minor Code 46h, Set Media ID.

WARNING!  These IOCTL calls use a structure that also contains the
volume label and file system type.  So that you do not create errors
with these values, I recommend that you always Minor Code 66h to
initialize the structure before setting the Volume Serial Number to a
new value and writing it back to the disk.

Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
Last changed: 17 Feb 96

Return to the Table Of Contents------------------------------
Subject: 29. File Formats Assosiated with ASM
29.1  INTEL

There are two sources for this information.  The first is available from
Intel.  The Tools Interface Standards Committee has prepared the
following documents:

    ftp://ftp.intel.com/pub/tis/ [broken]

The readme file in each .zip file states that the document is the
Relocatable Object Module Format Specification, V1.1.

Unfortunately, both files unzip into documents formatted for Postscript
printers.  Adobe's Acrobat can not display them, but Ghostscript can.
If you need GhostScript, you can get it from the following site.  Read
the ftp://ftp.cs.wisc.edu/pub/ghost/aladdin



29.2  MICROSOFT

The second is from Microsoft.  This file is located at:

    ftp://ftp.microsoft.com/Softlib/MSLFILES/ss0288.exe [broken]
    http://www.powerbasic.com/files/pub/docs/SS0288.zip

http://sunsite.lanet.lv/ftp/mirror/x2ftp/msdos/programming/formats/ss0288.zip

This file expands into ascii text files that are the Microsoft Product
Support Services Application Note: Relocatable Object Module Format.
These files date from 1992.  Also included are the .lib file format and
the CodeView extensions.

29.3  COFF format

This information is specific for DJGPP COFF but is this the same as used
by Microsoft (I believe)
    http://www.delorie.com/djgpp/doc/coff/


29.4  Executable Linkable Format (ELF)

Brian Raiter at muppetlabs has a delightful and very lucid page on the
unix Executable Linkable Format, ELF, (in Gas on Linux, but ELF is
pan-unix, and a rather sensible spec). Raiter can been seen in the
vger linux-assembly list on occaission.


Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
              Rick Hohensee, rhohen@linux01.gwdg.de
Last changed: 02 Jun 2004

Return to the Table Of Contents------------------------------
Subject: 30. Rebooting from Software
30.1  WARM AND COLD REBOOT

Within DOS, there are two types of rebooting.  There is the warm reboot
that is evoked by pressing the "Ctrl-Alt-Del" key combination.  During
this reboot, all Power On System Tests, POSTs, are performed with the
exception of the memory tests.  In addition to the POSTs, interrupt
vectors are reinitialized and system timers reinitialized.  In other
words, the BIOS code initializes the computer system to such a state
that the computer system is ready for loading the operating system.
Issuing an interrupt 19h does the loading of the operating system.

The second type of rebooting is a cold reboot that occurs when the
system is turned on.  The only difference between a cold reboot and a
warm reboot is the performing of the memory tests.

30.2  PERFORMING A REBOOT FROM SOFTWARE

Whether a cold or warm reboot is performed depends upon the value if the
reset flag in the ROM BIOS data area.  If this flag is set to 1234h, a
warm reset is performed.  Any other value results in a cold reboot.
Usually a zero is loaded for the cold reboot.  Code snippets to do this
are:

ROMBIOS_DATA    segment at 0400h
    org 72h
ResetFlag   dw  ?
ROMBIOS_DATA    ends

ROMBIOS     segment at 0f000h
    org 0fff0h
Reset   label   far
ROMBIOS ends

In your code:

    mov ax, seg ROMBIOS_DATA
    mov ds, ax
ASSUME ds:ROMBIOS_DATA
    mov ResetFlag, 1234h        ; or 0 if cold reset is desired
    jmp Reset

30.3  WARNINGS!

Neither the warm nor the cold boot flushes buffers, system, smartdrv,
and EMM386, or notifies TSRs.  This can lead to lost of data.  The best
source code that considers most of this is:

    ftp://ftp.simtel.net/pub/simtelnet/msdos/bootutil/reboot33.zip

Full source code is available.

30.4  JUST USING INT 19H

Using this interrupt alone will only reload the operating system onto a
computer system that may not be initialized properly for it.  The
interrupt vectors are not reset but the TSRs that have hooks into the
interrupt table may be overwritten.  Obviously, this can lead to the
system hanging if one of these hooked and overwritten interrupts is
called.  Other problems can be timers not reset or add-on cards not
reinitialized properly.  So, do NOT use Int 19h to reboot the computer.

30.5  USING F000:E05B INSTEAD OF F000:FFF0 AS THE JUMP ADDRESS

In the original IBM ROM BIOS, the instruction at f000:fff0 was a long
jump to f000:e05b.  Some programs skipped the jump at f000:fff0 and went
directly to the second address which is the start of the reset procedure
in ROM BIOS.  I checked my 386 with non-IBM BIOS, and the start of the
reset procedure is at the same address.  I believe that using the second
address is dangerous because there is not any guarantee that it will
stay the same.  In addition, if you are rebooting the computer what is
the reason in saving a few cycles!  Stay with the address f000:fff0 as
the jump there always will take the execution path to the correct code.

Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
Last changed: 20 Dec 96

Return to the Table Of Contents------------------------------
Subject: 31. Other FAQs
31.1  COMP.OS.MSDOS.PROGRAMMER

This excellent FAQ is posted every 20 days to comp.os.msdos.programmer,
comp.answers and news.answers newsgroup.

It is available from

    ftp://rtfm.mit.edu/pub/usenet-by-group/comp.os.msdos.programmer/

31.2  COMMUNICATIONS FAQS

The following websites contains many links to communication and hardware
related FAQs, e.g., serial port, game port, keyboard, modem, and LANs.
Most of these FAQs are not approved FAQs so are not found at
rtfm.mit.edu but that is not to say that these are not quality FAQs.
There is much good information.

    http://www.webcom.com/~llarrow/comfaqs.html
    http://www.repairfaq.com/filipg/LINK/F_LINKIN.html#LINKIN_003 (broken)
    http://www2.psyber.com/~tcj/faqnfile.html

Contributor: Raymond Moon, raymoon@moonware.dgsys.com
Last changed: 25 Oct 98

Return to the Table Of Contents------------------------------
Subject: 32. Pseudo Random Number Generator in Assembly Language
Mark Adler wrote a set or pseudo random number generators based upon
algorithms from Knuth's "Art of Computer Programming", vol 2, 2nd ed.
The file comes with full assembly source and .obj files for all major
memory models.  While written to link with Turbo C, the .obj files when
linked with Microsoft C worked well, except for the procedure that
return a double random number.  The reason was that the return protocol
is different between Borland C and Microsoft C.  Once the code was
modified to work with Microsoft C, the code worked well.

To test the algorithms, I created an array of 100 random numbers and
then generated random numbers and tried to determine if the original
pattern was ever repeated.  My program kept the length of the longest
matching series.  For real or double, the longest matching series was
one after more than a billion random numbers.  For ints, 0 and 1 as the
only selections produced the longest matching series of 31 matches after
more than a billion random numbers.  Increasing the range of acceptable
numbers quickly reduced the longest matching series to 2 in over 250
million random numbers.  My short testing revealed that the longest
matching series seldom increased after this number.

Lastly, to test the distribution, I counted the number of hits for each
number between 0 and 100.  I collected about 100,000 hits for each
number.  The standard deviation was only 319 or less than 0.33%.

While my testing was not a rigorous mathematical testing of the
algorithm and its implementation, I believe for most uses, these
procedures are adequate.

The file is available:
    ftp://ftp.simtel.net/pub/simtelnet/msdos/turbo_c/tcrnd11.zip

Note that the description of this file is inaccurate.

Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
Last changed: 4 May 96

Return to the Table Of Contents------------------------------
Subject: 33. Command Line Arguments
33.1  WHERE IS THE COMMAND LINE

DOS loads the command line into the PSP.  The length of the command line
is stored in a byte at offset 80h.  The command line is stored in the
next 127 bytes starting at 81h.  As, generally, there is a space between
the filename and the start of the command line argument; a space usually
is the first character in this string.  The string is terminated with a
carriage return character, 0dh.

At startup for both .COM and .EXE format programs, DS and ES point to
the PSP.

33.2  HOW TO ACCESS THE COMMAND LINE ARGUMENTS

See Subject #8, How to Redirect STDERR to a File.  I have written a
demonstration program that contains assembly language startup code that
parses the command line arguments onto the stack and provides them as
argc and *argv[] to the main procedure.  Anyone interested in accessing
command line arguments should look at this code.

Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
Last changed: 15 Jun 96

Return to the Table Of Contents------------------------------
Subject: 34. Free 32 bit and DJGPP Assemblers
34.1  Brennan Underwood's Guide to Inline Assembly under DJGPP.

This is an introduction to inline assembly under DJGPP and is based upon
GCC.  The AT&T/UNIX syntax is explained.  The URL is:

    http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html

34.2  DJGPP QUICK ASM PROGRAMMING GUIDE

Andrew Ly has a web page covering:
    URLs to FAQs
    AT&T x86 ASM Syntax
    Some inline ASM information
    converting .obj/.lib files

The URL to this page is:
    www.castle.net/~avly/djgpp.html

34.3  FREE 32-BIT X86 ASSEMBLER FAQ/LINUX X86 ASSEMBLY HOWTO

Francois-Rene Rideau has authored a FAQ on free 32-bit assemblers or
Linus x86 Assembly HowTo.  It is available:

    http://www.linuxdoc.org/HOWTO/Assembly-HOWTO/

Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
Last changed: 04 Feb 2001

Return to the Table Of Contents------------------------------
Subject: 35. TERSE Programming Language
Jim Neil has just announced his TERSE Programming Language.  TERSE gives
all of the control available in assembly language with the look-and-feel
and ease-of-use found in high-level languages.

It is available:
    http://www.terse.com

Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
Last changed: 19 Aug 96

Return to the Table Of Contents------------------------------
Subject: 36. Assembly Language IDEs
36.1    ASMEDIT

ASMEDIT is an Integrated Development Environment (IDE) for Assembly
Language programmers.  This IDE has a build in editor that provides
syntax coloring, editing of files up to 256 Mbytes, dissammembly of
short code pieces, and shelling to run external assemblers, linkers,
debuggers and make programs.

The real benefit of ASMEDIT is its extensive help.  This help covers:
    80x86 ASM mnemonics up to 686 including FPU and MMX;
    Complete Opcode Tables;
    BIOS Interrupts;
    DOS Interrupts and DOS Functions;
    EMS and Mouse Functions;
    BIOS and DOS Data Structures;
    Diagnostic Codes; and
    VGA programming information.

ASMEDIT is available at:

    http://www.o-love.net/asmedit/ae_whats.html

36.2  ALAB

Assembler Laboratory is an assembler IDE, packed with nice features such
as:

    syntax and error highlighting
    proc, macro and data browsers
    tasm, masm, a86 and dlink support
    heuristic scan
    opcode help, extended ascii chart, scan codes, calculator
    much more!

The latest version is available from the author's homepage:
    http://tihlde.org/~kurtg/programs/alab.html

36.3 ASMIDE

The latest version of ASMIDE, 4.01, has the following features:
    *   contains all the features of a conventional editor, such as
        Finding, Replacing, Cutting, Copying, Pasting.
    *   has the ability to open multiple files, allowing you to transfer
        text between the files. Multiple windows can be Tiled or
        Cascaded, and features Scroll bars.
    *   has mouse support.
    *   features a simple, 4 function, 3 mode calculator, and an Ascii
        Chart.
    *   has menu systems allowing you to assemble, link, run and debug
        your program.  Short cut keys are also provided.
    *   allows you to specify your own assembler, linker and debugger in
        the configuration file.
    *   features setup dialogs that provide support for TASM, TLINK,
        MASM and LINK.

ASMIDE is available:
    http://www.inx.de/~nkomin/files/asmide.arj [Broken]

36.4  NASMIDE

NASM-IDE is a front end for NASM that allows multiple files to be worked
on within the same editing environment.  Written in Turbo Pascal and
Turbo Vision, the NASM-IDE interface is clear and straightforward.
Features include:

    Turbo Vision point-and-click style interface
    Automatic syntax highlighting of source code
    An ASM Assistant to guide users through the creation of assembler
        projects
    On-line help system
    Support for three main output file formats - flat file binary and
        DOS 16 bit and Win32 object files

Learn more about NASIDE and download it from:

    http://www.inglenook.co.uk/nasmide/index.html

36.5  MicroASM

MicroASM is written by Ole Saether.  It is a Windows 95 & NT windows
editor with support for MS-DOS command line assemblers.

With MicroAsm you can:

    Create and edit text files.
    Run the files through your favorite command-line assembler.
    Automatically highlight lines containing errors.

To learn more about it and download it, visit:
    http://asm.emu8086.com/

36.6  TASM IDE

Joost Vrielink has developed a Turbo Assembler IDE.  It is free for
downloading from his web site:
    http://tasm.freeservers.com/ [Broken]

The IDE is an editor just like WordPad, but compile/link/run/debug can
be accomplished with just one click.  It also has a built-in
dec/hex/bin/oct converter, and syntax highlighting is almost finished.
It is perfectly suited to make simple 16-bit DOS programs within the
Windows 95/98 environment.  Changes are being added quite often, so
remember to return and check every now and then.

Contributor: Raymond Moon, raymoon@moonware.dgsys.com
Last Changed: 04 Feb 2001

Return to the Table Of Contents-----------------------------
Subject 37. Dissassemblers
38.1  Review of Disassemblers

Jerzy Tarasiuk has reviewed some commercial and shareware disassemblers.
The shareware assemblers are available in this directory.  The review is
available:

    ftp://ftp.simtel.net/pub/simtelnet/msdos/disasm/aabstrct.txt

Contributor: Raymond Moon, raymoon@moonware.dgsys.com
Last Changed: 13 Oct 96

Return to the Table Of Contents-----------------------------
Subject: 38. How to Optimize for the Pentium
39.1 PENTIUM OPTIMIZATION SITE

The below site is updated as new information becomes available and
contains information not found elsewhere.
    http://www.agner.org/assem/

38.2 LITERATURE AVAILABLE FROM INTEL

Much useful literature can be downloaded free from Intel's WWW site:
    http://www.intel.com

The documents are in various different file formats.  If a particular
document is in a format not supported by your word processing software,
then you may seek an appropriate file viewer somewhere on the Internet.
Many software companies are offering such file viewers free to support
their file formats.

Tutorials for Optimizing the Pentium, and Pentium Pro/Pentium II can be
downloaded from:
    http://developer.intel.com/design/perftool/cbts/pentopt/index.htm
    http://developer.intel.com/design/perftool/cbts/pproopt/index.htm

Manuals for the Pentium and Pentium Pro processors can be downloaded
from:
    http://developer.intel.com/design/pentium/manuals/
    http://developer.intel.com/design/pro/manuals/

Detailed information on the MMX processors can be found in the
documents:
"MMX Technology Developers Guide", and "Programmers Reference Manual",
both of which are available from:
    http://developer.intel.com/drg/mmx/manuals/

Many other sources other than Intel also have useful information.  I
would particularly recommend:
    http://www.x86.org.

Contributor: Ray Moon, raymoon@moonware.dgsys.com
Last Changed: 20 Dec 97

Return to the Table Of Contents-----------------------------
Subject: 39. Assembly Language Programming Style Guidelines
Randy Hyde has done it again.  He has written a style guide that will
help you write more readable and maintainable assembly language code.
The URL is:

    http://webster.cs.ucr.edu/Articles/asmstyle.html (HTML)
    http://webster.cs.ucr.edu/Articles/asmstyle.pdf (.PDF)


Contributor: Ray Moon, raymoon@moonware.dgsys.com
Last Changed: 04 Feb 2001

Return to the Table Of Contents-----------------------------
Subject: 40. Other Assembly-Related Newsgroups
Here are some other assembly language newsgroups that may be of
interest.

    news:msnews.microsoft.com/microsoft.public.masm
    news:forums.borland.com/borland.public.tasm
    news:fido7.talks-asm
    news:alt.os.assembly
    news:alt.os.development

Contributor: Ray Moon, raymoon@moonware.dgsys.com
Last Changed: 26 Dec 97

Return to the Table Of Contents-----------------------------
Subject: 41. ZD-86 Debugger
41.1  DESCRIPTION

ZD86 is a full-featured Assembler Debugging Environment that provides
Symbolic Debugging for most common Assemblers, including A86, MASM,
TASM, etc.  The symbolic debugging capability displays and highlights
your statement labels and variable names where you have placed them in
your code.  It is a powerful tool for the advanced assembly language
programmer yet friendly enough for someone just starting with assembly
language.

41.2  AVAILABILITY

The ZD86 Debugger is available from:

    ftp://cet.cet.com/pub/80xxx/ [Broken]

Contributor: Ray Moon, raymoon@moonware.dgsys.com
Last Changed: 22 Jun 97

Return to the Table Of Contents-----------------------------
Subject: 42. Links to x86 Processor Manufacturers
AMD
    http://www.amd.com/K6/k6docs/index.html

Intel
    http://developer.intel.com/design/PentiumII/manuals/

Cyrix
    http://www.cyrix.com/products/cyr3.htm

Contributor: Ray Moon, raymoon@moonware.dgsys.com
Last Changed: 04 Feb 2001

Return to the Table Of Contents-----------------------------
Subject: 43. Linkers
43.1  Microsoft's 16-bit linker

Microsoft has its 16-bit DOS linker available from its FTP site.  The
linkers URL is:
    ftp://ftp.microsoft.com/softlib/mslfiles/

43.2  ALINK

ALINK is a freeware linker for MSDOS and Win32. It links Intel/Microsoft
OMF object and library files, to MSDOS COM and EXE files, and PE files
for Win32 (including DLLs). Source code (ANSI C) is also available for
download  It should compile with any 32-bit ANSI C compiler.

Also available is IMPLIB, a Win32 import library generator, as a
companion to ALINK.

These are available form Anthony's Programming Page:
    http://alink.home.dhs.org/

Contributor: Ray Moon, raymoon@moonware.dgsys.com
Last Changed: 21 Feb 99

Return to the Table Of Contents-----------------------------
Subject: 44. ASM Mailing Lists
44.1  NASM MAILING LIST

Michael Darling has started a NASM mailing list.  You can subscribe to
the list on the following web page:
    http://groups.yahoo.com/group/nasm-devel

44.2  X86 ASM MAILING LIST

Michael Ware has created an x86 ASM mailing list.  You can subscribe to
the list on the following web page:
    http://www.eGroups.com/list/assembly

44.3  Linux programmers interested in assembly have

linux-assembly@vger.kernel.org
and an offshoot, started Aug 3 2003 by a couple people banned from the
canonical
Linux lists ( >;o) ), at linux-assembly@mlists.in-berlin.de
The latter is assembly-specific but not strictly Linux or x86 specific, and
may
or may not take root. The vger list is currently several posts a week.

44.4  Hot ASM Chat

EFnet IRC has an #asm channel where Microsoft employees posing as busty
19-year-olds in tube-tops with names like "Virus" will field your TSR
(Tickle-and-Stay-Resident) questions. www.irchelp.org has a dynamically
updated list of live servers for the big Internet Relay Chat networks.


Contributor: Ray Moon, raymoon@moonware.dgsys.com
             Rick Hohensee, rhohen@linux01.gwdg.de
Last Changed: 02 Jun 2004

Return to the Table Of Contents-----------------------------
Subject 45. ASM Programming Journal
There is a new ASM Programming Journal.  Visit and read or download the
issues at:
    http://www.assembly-journal.com/
    http://asmjournal.freeservers.com/

Contributor: Ray Moon, raymoon@moonware.dgsys.com
Last Changed: 04 Feb 2001

Return to the Table Of Contents-----------------------------
Subject 46. High Level Assembly Language
Randy Hyde has developed a High Level Assembly (HLA) language as a tool
to help teach assembly language programming and machine organization to
University students at the University of California, Riverside. The
basic idea was to teach students assembly language programming by
leveraging their knowledge of high level languages like C/C++ and
Pascal/Delphi. At the same time, HLA was designed to allow advanced
assembly language programmers write more readable and more powerful
assembly language code.

There is much documentation but it still is in development.  If you want
to give HLA a try, its URL is:
    http://webster.cs.ucr.edu/AsmTools/HLA/index.html

Contributor: Ray Moon, raymoon@moonware.dgsys.com
Last Changed: 20 Feb 2000

Return to the Table Of Contents-----------------------------
Subject: 47. PC Operating Systems in Assembly

47.1  Menuet

Menuet appears to be a GUIed OS written in one nasm file.

Description: Graphical realtime OS written in all 32-bit assembly, for
             x86 i386+, fits on one floppy, protected...
             www.menuetos.org


47.2  Enth/Flux

Description: Enth is a stand-alone 32-bit Forth for the PC. Most such critters
have
             native-code assembly facilities from and intimately linked to the
             Forth interpreter. It boots here, and I used it to sniff some
ports for
             Forreal/Ha3sm work.
Assembler:   NASM version 0.98

             http://www.ynet.com.au/sean/


47.3  Retro

Description: Retro was originally written by Tom Novelli in nasm. It was going
to
             be the core OS of the Tunes Project at one time. The Tunes
project
             has extremely high goals and a magnificent OS survey section on
thier
             site. Francois-Rene "Fare'" Rideau coordinates the Tunes Project.
             Retro appears to have germinated separately, i.e. it has a new
             host, maintainer, and recent updates.

             http://retro.tunes.org/index.html


47.4  colorForth

Description: Chuck Moore is the author of Forth. His colorForth at
colorforth.com
             is written in MASM and, as per Chuck usual, challenges every
assumption
             ever assumed about programming. His colorForth bootsector is in a
MASM
             use32 "segment", just for starters. Then it gets weird.
colorForth is
             a bootable standalone Forth-like for the PC in about 40k of
source.
             It's flat pmode, strongly prefers VESA, and has been ported
around
             a bit.


Contributor: Rick Hohensee, rhohen@linux01.gwdg.de
Last Changed: 02 Jun 2004


Return to the Table Of Contents-----------------------------
Subject: 99. Acknowledgments
I would like to acknowledge all the people who have assisted me or any
of the contributors.  For their time and effort, this FAQ is a better
product.

David Boedicker, Barry Brey, Paolo Ciccone, Giuseppe De Marco, Morten
Elling, Kris Heidenstrom, Alan Illeman, Don Krull, Chabad Lubavitch,
Thanh Ma, Jeff Owens, Ed Parry, Keith Petersen, Michael Roberts, Russell
Schulz, Rocky Seelbach, Janos Szamosfalvi, Cedric Ware and Evenbit

Return to the Table Of Contents


User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




Part1 - Part2 - Part3

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
"fys" <zfysz@cybertrails.com>





Last Update March 27 2014 @ 02:11 PM