799 lines
30 KiB
Plaintext
799 lines
30 KiB
Plaintext
|
From: raymoon@dgsys.com (Raymond Moon)
|
||
|
Newsgroups: alt.lang.asm,comp.lang.asm.x86,news.answers,alt.answers,comp.answers
|
||
|
Subject: x86 Assembly Language FAQ - General Part 3/3
|
||
|
Supersedes: <5h6e1v$b4q@reader1.news.act.net>
|
||
|
Followup-To: alt.lang.asm,comp.lang.asm.x86
|
||
|
Date: 21 Apr 1997 21:23:10 GMT
|
||
|
Organization: MoonWare
|
||
|
Lines: 778
|
||
|
Approved: news-answers-request@MIT.EDU
|
||
|
Distribution: world
|
||
|
Expires: Tue, 20 May 1997 23:59:59 GMT
|
||
|
Message-ID: <5jglru$ijs@news.dgsys.com>
|
||
|
Reply-To: raymoon@moonware.dgsys.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 Assemby Language ASM FAQ General
|
||
|
|
||
|
|
||
|
Archive-Name: assembly-language/x86/general/part3
|
||
|
Posting-Frequency: monthly (21st of every month)
|
||
|
Last-modified: 1997/03/18
|
||
|
|
||
|
------------------------------
|
||
|
|
||
|
Subject: 26. WWW Assembly HomePages
|
||
|
|
||
|
26.1 CAUTION
|
||
|
|
||
|
All of the web sites listed here are maintained by individuals. 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.ucr.edu/Page_asm
|
||
|
Excellent tutorial, Art of Assembly Language
|
||
|
ASM Style Guide
|
||
|
|
||
|
Christian Ludoff's 80x86 Sandpile Page
|
||
|
http://www.sanpile.org Basic Page
|
||
|
http://www.sanpile.org/80x86/overview.shtml
|
||
|
The second page is where you should kept you link. Much good
|
||
|
information is available at this site.
|
||
|
|
||
|
EG3 Electronic Communication's Electronic Engineer's Toolbox
|
||
|
http://www.cera2.com/assembly.htm
|
||
|
http://www.eetoolbox.com/assembly.htm
|
||
|
http://www.eg3.com/assembly.htm
|
||
|
Assembly Language Hot Lists and Major Resources. Links to FAQs and
|
||
|
other web sites
|
||
|
|
||
|
Assembly Language Tutorial
|
||
|
http://udgftp.cencar.udg.mx/ingles/tutor/Assembler.html
|
||
|
http://www.cit.ac.nz/smac/csware.htm
|
||
|
Version 2.6 of on-line 386 assembly languager course. Self tests,
|
||
|
assignments, course notes, and software are included.
|
||
|
http://www.cyberbeach.net/~mbabcock/Programming/asmtut1.htm
|
||
|
Mike Babcock's ASM Tutorial
|
||
|
|
||
|
Brian Brown's Introduction to Hardware Systems
|
||
|
http://www.cit.ac.nz/smac/cbt/hwsys/default.htm
|
||
|
Good links to general asm information. Links to iAPX386
|
||
|
information.
|
||
|
|
||
|
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.fys.ruu.nl/~faber/Amain.html
|
||
|
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
|
||
|
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)
|
||
|
|
||
|
NASM: The Netwide Assembler Project
|
||
|
http://www.dcs.warwick.ac.uk/~jules/nasm1.html
|
||
|
A group of programmers are writing a new assembler. This home page
|
||
|
describes the project and where to download the latest version.
|
||
|
|
||
|
Michael Babcock's 3/4/586 ASM Programming Home Page
|
||
|
http://www.cyberbeach.net/~nbabcock/Prg.welcome.html
|
||
|
This home page has links to:
|
||
|
Optimizing 803/4/586 ASM Programming
|
||
|
http:///www.cyberbeach.net/~mbabcock/Programming/Optimize.html
|
||
|
ASM Tutorial
|
||
|
http://www.cyberbeach.net/~mbabcock/Programming/asmtut1.htm
|
||
|
Utilities
|
||
|
http:///www.cyberbeach.net/~mbabcock/Programming/Utils.html
|
||
|
|
||
|
The Official Web Shareware Site
|
||
|
http://www.jumbo.com/prog/dos/asmutil
|
||
|
This site appears to have a few asm files not on SimTel.
|
||
|
|
||
|
Hamarsoft 86BUGS list Online
|
||
|
http://www.xs4all.nl/~feldmann/
|
||
|
List contains many documented and undocumented errors in Intel
|
||
|
microprocessors, as well as undocumented instructions.
|
||
|
|
||
|
Joe's Assembly Language Page
|
||
|
http://jasper.idbsu.edu:8000/
|
||
|
Links to his own and other asm code.
|
||
|
His own Assembly Language Search Engine
|
||
|
|
||
|
Bill Stapleton's Assembly Language Reference Page
|
||
|
http://www.carl.ua.edu/~wstablet/ee384.html
|
||
|
A collection of 80x86 assembly language references generating from
|
||
|
teaching EE383 and EE384 courses at The University of Alabama.
|
||
|
|
||
|
Dr. ASM's Assembly Home Page
|
||
|
http://web.syr.edu/~dbgrandi/assembly.htm
|
||
|
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
|
||
|
|
||
|
Arzie's Home Page
|
||
|
http://www.dlc.fi/~arzie/programming.html
|
||
|
Many links to programming related pages
|
||
|
|
||
|
Kip Irvine's Assembly Language Sources
|
||
|
http://netrunner.net/~irvinek/asm.htm
|
||
|
|
||
|
Gavin Estey's Home
|
||
|
http://www.strangecreations.com/library/assembly/index.htm
|
||
|
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
|
||
|
|
||
|
Heath Holcomb's x86 Assembly Page
|
||
|
http://www.wfu.edu/~holcojh5/asm/x86asm.html
|
||
|
Some pointers on what is assembly language, what is assembly good
|
||
|
for, and what do you need to get started.
|
||
|
Pointers to ASM Tutorial, this FAQ, other ASM web pages
|
||
|
|
||
|
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.geocities.com/SiliconValley/2704/tutorial.html
|
||
|
VLA's Assembly and DMA programming tutorials, Asphyxia's VGA
|
||
|
tutorials, and some graphics and sound programming
|
||
|
information.
|
||
|
|
||
|
Ard Oerlemans Assembly Programming on the Intel Chips Page
|
||
|
http://www.wi.leidenuniv.nl/~aoerlema/assembly.html
|
||
|
Information on programming sound cards, audio file format,
|
||
|
compression techniques, video card programming, graphic file
|
||
|
formats, Asphyxia VGA tutorial.
|
||
|
|
||
|
Gerd Kortemeyer's 387/486DX/Pentium/Floating Point Processor Stuff
|
||
|
http://www.nscl.msu.edu/~kortemey/copro.html
|
||
|
A collection of assembler routines written for Turbo Pascal and
|
||
|
C++. Most of the comments are in German after an English
|
||
|
introduction.
|
||
|
|
||
|
Cameron's 386+ Programming Page
|
||
|
http://hudson.idt.net/~c027319/
|
||
|
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.globalserve.on.ca/~subdeath/
|
||
|
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.
|
||
|
|
||
|
Alexandre Zvenigorosky III's Programs for PC 386+
|
||
|
http://cpodlcom/monoweb/zveni/prg.html
|
||
|
Zvenigorosky's assembler and debugger, currently documentation
|
||
|
only in French.
|
||
|
|
||
|
Rich Elber's ValArrow (286 Assembler) Page
|
||
|
http://www.geocities.com/SiliconValley/Heights/7052/valarr.html
|
||
|
Links to Arrowsoft Assembler, ZD86 debugger, discussion of
|
||
|
Arrowsoft's Assemblers deviations from MASM.
|
||
|
|
||
|
Kurt I. Groenbech's Alab Homepage
|
||
|
http://www.idb.hist.no/kurtg/
|
||
|
Home page for the Assembler Laboratory that is an IDE for
|
||
|
assemblers
|
||
|
|
||
|
Christian Kurzke's Advanced x86 Assembly Programming
|
||
|
http://wwwcip.informatik.uni-erlangen.de/user/cnkurzke/hwkmcs/index.html
|
||
|
Excerpts from lessons given at Adalbert Stifter Gymnasium in 1989
|
||
|
|
||
|
Bob Richardson's PC Assembly Language Page
|
||
|
http://lexitech.com/bobrich/
|
||
|
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
|
||
|
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
|
||
|
|
||
|
Steve Kemp's Assembly Language Programming Index
|
||
|
http://www.dcs.ed.ac.uk/home/skx/asm/index.html
|
||
|
Assembly Language Newbie information. A86 Source Code
|
||
|
|
||
|
Phil Toland's Assembly Language Page
|
||
|
http://www.epix.net/~toland/asm/index.html
|
||
|
URLs to Win32 Assembly Lanugage Kit.
|
||
|
|
||
|
The Real Programmer's Virtual Library
|
||
|
http://hudson.idt.net/~c027319
|
||
|
Some original tutourials, compression, URLs to files on the
|
||
|
Internet with much valuable information for assembly language
|
||
|
programmers.
|
||
|
|
||
|
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.geocities.com/SiliconValley/9498/asm.html
|
||
|
Feature articles, Optimization and General Programming/References
|
||
|
|
||
|
26.3 MISCELLANEOUS ASM WEB SITES
|
||
|
|
||
|
ASM Resources
|
||
|
http://www.cse.utoledo.edu/%7Ecwinner/assembly.html
|
||
|
|
||
|
|
||
|
Contributor: Raymond Moon, raymoon@moonware.dgsys.com
|
||
|
Last changed: 28 Feb 97
|
||
|
|
||
|
------------------------------
|
||
|
|
||
|
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 which
|
||
|
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 which 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 allocate 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.
|
||
|
|
||
|
Contributor: Raymond Moon, raymoon@moonware.dgsys.com
|
||
|
Last changed: 26 Dec 95
|
||
|
|
||
|
------------------------------
|
||
|
|
||
|
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 particularily 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 contain 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
|
||
|
|
||
|
------------------------------
|
||
|
|
||
|
Subject: 29. .obj File Format
|
||
|
|
||
|
29.1 INTEL
|
||
|
|
||
|
There are two sources for this information. The first is available from
|
||
|
Intel. The Tools Interface Standards Committe has prepared the following
|
||
|
documents:
|
||
|
|
||
|
ftp://ftp.intel.com/pub/IAL/TIS/omf11g.zip
|
||
|
and
|
||
|
ftp://ftp.intel.com/pub/IAL/TIS/omf11h.zip
|
||
|
|
||
|
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
|
||
|
(keep trying as I found it difficult connecting to this site)
|
||
|
|
||
|
29.2 MICROSOFT
|
||
|
|
||
|
The second is from Microsoft. This file is located at:
|
||
|
|
||
|
ftp://ftp.microsoft.com/Softlib/MSLFILES/ss0288.exe
|
||
|
|
||
|
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 is the .lib file format and the
|
||
|
CodeView extensions.
|
||
|
|
||
|
Contributor: Raymond Moon, raymoon@moonware.dgsys.com
|
||
|
Last changed: 9 Jan 96
|
||
|
|
||
|
------------------------------
|
||
|
|
||
|
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. The
|
||
|
loading of the operating system is done by issuing an interrupt 19h.
|
||
|
|
||
|
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
|
||
|
the reset flag in the ROM BIOS data area. If this flag is set to 1234h, a
|
||
|
warm reset is performed. An 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 takes most of this into account is:
|
||
|
|
||
|
ftp://ftp.simtel.net/pub/simtelnet/msdos/bootutil/reboot33.zip
|
||
|
|
||
|
Full souce 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 properly initialized 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. Also, 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
|
||
|
|
||
|
------------------------------
|
||
|
|
||
|
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/dos-faq
|
||
|
|
||
|
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.paranoia.com/~filipg/HTML/LINK/PORTS/F_Parallel.html
|
||
|
http://www2.psyber.com/~tcj/resource.html
|
||
|
|
||
|
Contributor: Raymond Moon, raymoon@moonware.dgsys.com
|
||
|
Last changed: 17 Feb 96
|
||
|
|
||
|
------------------------------
|
||
|
|
||
|
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 because 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 that 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 algrorithm
|
||
|
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
|
||
|
|
||
|
------------------------------
|
||
|
|
||
|
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
|
||
|
|
||
|
------------------------------
|
||
|
|
||
|
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.rt66.com/~brennan/djgpp/bgtia.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:
|
||
|
http://remus.rutgers.edu/~avly/djasm.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.eleves.ens.fr:8080/home/rideau/Assembly
|
||
|
|
||
|
Contributor: Raymond Moon, raymoon@moonware.dgsys.com
|
||
|
Last changed: 19 Jun 96
|
||
|
|
||
|
------------------------------
|
||
|
|
||
|
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
|
||
|
|
||
|
------------------------------
|
||
|
|
||
|
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 shourt 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 from simtel or any of its mirrors:
|
||
|
|
||
|
ftp://ftp.simtel.net/pub/simtelnet/msdos/asmutl/aedt182.zip
|
||
|
|
||
|
or directly from the authors at:
|
||
|
|
||
|
http://www.skynet-computers.de/~asmedit
|
||
|
|
||
|
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://www.idb.hist.no/~kurtg/
|
||
|
|
||
|
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 from the author:
|
||
|
http://pc-ec102.ee.und.ac.za/kurien/asmid401.arj
|
||
|
|
||
|
Contributor: Raymond Moon, raymoon@moonware.dgsys.com
|
||
|
Last Changed: 11 Dec 96
|
||
|
|
||
|
-----------------------------
|
||
|
|
||
|
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
|
||
|
|
||
|
-----------------------------
|
||
|
|
||
|
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://announce.com/agner/assem
|
||
|
|
||
|
38.2 LITERATURE AVAILABLE FROM INTEL
|
||
|
|
||
|
Much useful literature can be downloaded for free from Intel's www site:
|
||
|
http://www.intel.com
|
||
|
|
||
|
You can find the documents you need by using the search facilities at:
|
||
|
http://www-cs.intel.com/search2.htm
|
||
|
and:
|
||
|
http://www-cs.intel.com/search.htm
|
||
|
|
||
|
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 for free to support their
|
||
|
file formats.
|
||
|
|
||
|
The most useful document is Intel's application note, "AP-526
|
||
|
Optimizations for Intel's 32-bit Processors" that can be downloaded
|
||
|
from:
|
||
|
http://www.intel.com/design/pro/applnots/ap526.htm
|
||
|
|
||
|
A fancy tutorial named "Optimizing Applications for the Pentium
|
||
|
Processor" can be downloaded from:
|
||
|
http://www.intel.com/ial/processr/cbt.htm
|
||
|
|
||
|
Manuals for the Pentium and PentiumPro processors can be downloaded from:
|
||
|
http://www.intel.com/design/pentium/MANUALS/index.htm
|
||
|
http://www.intel.com/design/pro/MANUALS/index.htm
|
||
|
|
||
|
Detailed information on the MMX processors can be found in the documents:
|
||
|
"Intel architecture MMX technology developer's manual", and "Intel
|
||
|
architecture MMX technology programmers reference manual", both of which
|
||
|
are available from:
|
||
|
http://www.intel.com/pc-supp/multimed/mmx/
|
||
|
|
||
|
Many other sources other than Intel also have useful information. I would
|
||
|
particularly recommend:
|
||
|
http://www.x86.org.
|
||
|
|
||
|
The shareware editor ASMEDIT has an online help which covers all
|
||
|
instruction codes etc. It is available from:
|
||
|
http://www.skynet-computers.de/~asmedit
|
||
|
|
||
|
Contributor: Agner Fog, Agner@login.dknet.dk
|
||
|
Last Changed: 14 Oct 96
|
||
|
|
||
|
-----------------------------
|
||
|
|
||
|
Subject: 39. 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.
|
||
|
|
||
|
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 and Cedric Ware
|
||
|
|
||
|
|