home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-03-22 | 37.7 KB | 1,046 lines |
- Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!howland.erols.net!pants.skycache.com.MISMATCH!triton.skycache.com!portc01.blue.aol.com!portc.blue.aol.com!feed.newsreader.com!news!not-for-mail
- From: raymoon@ms1.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: <89sf1e$stn$3@news.dgsys.com>
- Followup-To: alt.lang.asm,comp.lang.asm.x86
- Date: 21 Mar 2000 23:03:27 GMT
- Organization: MoonWare
- Lines: 1020
- Approved: news-answers-request@MIT.EDU
- Distribution: world
- Expires: Thu, 20 Apr 2000 23:59:59 GMT
- Message-ID: <8b8v3v$n7i$3@news.dgsys.com>
- Reply-To: raymoon@moonware.dgsys.com
- NNTP-Posting-Host: dgs.dgsys.com
- X-Trace: news.dgsys.com 953679807 23794 207.154.12.1 (21 Mar 2000 23:03:27 GMT)
- X-Complaints-To: usenet@news.dgsys.com
- NNTP-Posting-Date: 21 Mar 2000 23:03:27 GMT
- 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
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
- Xref: senator-bedfellow.mit.edu alt.lang.asm:25272 comp.lang.asm.x86:83705 news.answers:179901 alt.answers:47942 comp.answers:40154
-
- Archive-Name: assembly-language/x86/general/part3
- Posting-Frequency: monthly (21st of every month)
- Last-modified: 2000/02/20
-
- ------------------------------
-
- 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.ucr.edu/Page_asm
- Excellent tutorial, Art of Assembly Language
- ASM Style Guide
-
- Christian LudoffÆs 80x86 Sandpile Page
- http://www.sandpile.org Basic Page
- http://www.sandpile.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.eg3.com/softd/assembly.htm
- http://www.eg3.com/softdv/assembly.htm
- http://www.eg3.com/softd/assmhot.htm
- Assembly Language Hot Lists and Major Resources.
-
- 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.cryogen.com/nasm
- 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 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
-
- The Official Web Shareware Site
- http://www.jumbo.com/pages/programming/dos/asmutl/
- This site appears to have a few ASM files not on SimTel.
-
- 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
-
- Kip Irvine's Assembly Language Sources
- http://www.nuvisionmiami.cim/kip/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/x86asm/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.ice-digga.com/programming/
- 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://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 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.
-
- Alexandre Zvenigorosky IIIÆs Programs for PC 386+
- http://www.cpod.com/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/valarr2.html
- Links to Arrowsoft Assembler, ZD86 debugger, discussion of
- ArrowsoftÆs Assemblers deviations from MASM.
-
- Kurt I. GroenbechÆs Alab Homepage
- http://www.nano.no/~espeng/alab/
- 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 (Not currently
- working)
- http://www.dcs.ed.ac.uk/home/skx/asm/index.html
- Assembly Language Newbie information. A86 Source Code
-
- 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
-
- Jaap Harm's 80x86 Assembly Page (Not currently working)
- http://home.worldonline.nl/~jaapharm/
- Tutorial, source code and links
-
- Charles Winneræs ASM Resources (Not currently working)
- http://www.cse.utoledo.edu/%7Ecwinner/assembly.html
-
- 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.netwurx.net/~geezer/os/index.htm
- NASM and DJGPP Code, Protected Mode Code, OS Code
-
- The Bass Demon's Operating System Theory Page
- http://home.c2i.net/tkjoerne/os/index.htm
- Information on Hard Disks, Partitioning and Booting, FAT
- specific file system information, File system theory article,
- Available assembler source codes and Memory Management
-
- OS Development Page
- http://milkyway.isa.net.au/os-dev/index2.html
- Documentation, Links, Source files, Bulletin Board
-
- The NASM Advocate
- http://people.mw.mediaone.net/nasm/index.html
- NASM source code, documentation (HTML format), NASM specific
- IDE, NASM Links, NASM Mailing List and NASM Mailing List
- Archives
-
- Anthony's Programming Page:
- http://www.geocities.com/SiliconValley/Network/4311/
- 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.senet.com.au/~cpeacock/
- 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://ams.ampr.org/cdragan/
- His own programs and assembler source code, Win32 programs.
-
- David Lindauer's LADSoft Computer Page
- http://www.ladsoft.com
- PMODE Information
- Windows assembly demos for TASM
- MSDOS Demo/utility programs
-
- Jan Wagemakers' Linux and Assembler Home Page
- http://bewoner.dma.be/JanW/eng.html
-
- Brennan's Guide to Inline Assembly
- http://www.rt66.com/~brennan/djgpp/bgtia.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/win95asm/win95asm.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
- 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
-
- Contributor: Raymond Moon, raymoon@moonware.dgsys.com
- Last changed: 20 Feb 2000
-
- ------------------------------
-
- 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
-
- ------------------------------
-
- 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
-
- ------------------------------
-
- 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 Committee has prepared the
- following documents:
-
- ftp://ftp.intel.com/pub/tis/omf11g.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
-
- 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 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/
-
- Contributor: Raymond Moon, raymoon@moonware.dgsys.com
- Last changed: 25 Oct 98
-
- ------------------------------
-
- 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
-
- ------------------------------
-
- 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
- http://www2.psyber.com/~tcj/faqnfile.html
-
- Contributor: Raymond Moon, raymoon@moonware.dgsys.com
- Last changed: 25 Oct 98
-
- ------------------------------
-
- 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
-
- ------------------------------
-
- 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
- http://sag-www.ssl.berkeley.edu/~korpela/djgpp_asm.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.eleves.ens.fr:8080/home/rideau/Assembly-HOWTO
- http://www.linuxhq.com/LDP/HOWTO/Assembly-HOWTO.html
-
- Contributor: Raymond Moon, raymoon@moonware.dgsys.com
- Last changed: 21 Feb 99
-
- ------------------------------
-
- 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
- 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 from simtel or any of its mirrors:
-
- ftp://ftp.simtel.net/pub/simtelnet/msdos/asmutl/aedt182.zip
-
- 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.nano.no/~espeng/alab/
-
- 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
-
- 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://home.eunet.no/~oleset/microasm.htm
-
- 36.6 TASM IDE
-
- Joost Vrielink has developed a Turbo Assembler IDE. It is free for
- downloading from his web site:
- http://www.angelfire.com/in/tasm
-
- 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: 19 Sep 98
-
- -----------------------------
-
- 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 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
-
- -----------------------------
-
- 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.ucr.edu/Page_softeng/sample.html
-
- Contributor: Ray Moon, raymoon@moonware.dgsys.com
- Last Changed: 21 May 97
-
- -----------------------------
-
- 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
-
- -----------------------------
-
- 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/zd86-101.zip
-
- Contributor: Ray Moon, raymoon@moonware.dgsys.com
- Last Changed: 22 Jun 97
-
- -----------------------------
-
- 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/developers/dv-home.htm
-
- Contributor: Ray Moon, raymoon@moonware.dgsys.com
- Last Changed: 25 Oct 98
-
- -----------------------------
-
- 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/lnk563.exe
-
- 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://www.geocities.com/SiliconValley/Network/4311/index.html
-
- Contributor: Ray Moon, raymoon@moonware.dgsys.com
- Last Changed: 21 Feb 99
-
- -----------------------------
-
- 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://nasm.home.ml.org
-
- 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
-
- Contributor: Ray Moon, raymoon@moonware.dgsys.com
- Last Changed: 23 Nov 98
-
- -----------------------------
-
- Subject 45. ASM Programming Journal
-
- There is a new ASM Programming Journal. Visit and read or download the
- issues at:
- http://asmjournal.freeservers.com/
-
- Contributor: Ray Moon, raymoon@moonware.dgsys.com
- Last Changed: 26 Feb 99
-
- -----------------------------
-
- 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/Page_hla/Page_hla.html
-
- Contributor: Ray Moon, raymoon@moonware.dgsys.com
- Last Changed: 20 Feb 2000
-
- -----------------------------
- Subject: 47. 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 and Cedric Ware
-