Assembly Language Source Code

The Idea

Over the years, I have written and given away a lot of assembly language source code. Some is useful in its own right but most of these programs were written in response to questions on the Fidonet 80XXX echo (a pre-Usenet assembly language discussion forum) and so they were mostly intended to show an idea or approach relating to assembly language programming. In other words, while they might actually do something, they're mostly intended to be read by humans rather than run by computers.

Almost all of this code is several years old and I haven't tested any of it for at least that long, so it's being made available "as is".

The Code

All of this code with the exception of getcol.asm and fibo-linux.asm are intended to be run under MS-DOS. Comments in the source code will typically explain more details about the code. Much of the code is written to be assembled with Borland's TASM, but little work would probably be involved in translating these routines to use other assemblers, like MASM or maybe even NASM.

When I use TASM, I typically use version 4.1, but I also use 5.0 on occasion. When I use MASM, it's usually either version 6.14 or version 6.11. For linking, I usually use Borland's tlink version 7.1.30.1 or sometimes Microsoft's linker version 5.60.339 or 5.31.009 or even occasionally version 3.65 depending on which computer I'm using and what code I'm working on. I've been known to run NASM on occassion, but I find that it doesn't yet have all the features I want in an assembler.

Assembly language source files with descriptions
new! boot.asm simplified program to work with loader.asm to transfer your own loader code to a floppy disk. (see more description)
fibo-linux.asm a small program that calculates and prints terms of the Fibonacci series. The algorithm is similar to fibo.asm but this program runs under Linux and is very fast.
fibo-masm.asm a small program that calculates and prints terms of the Fibonacci series (MASM/TASM version)
fibo.asm a small program that calculates and prints terms of the Fibonacci series (NASM version)
slip.asm an implementation of SLIP (Serial Link IP), RFC 1055 in assembly language (click here for more description...)
toclip.asm command line program allows piping of output from other programs into Windows clipboard. (click here for more description...)
loader.asm boot loader for a roll-your-own operating system (click here for more description...)
beroset.asm demonstration "operating system" stub for use with loader.asm (click here for more description...)
sector.asm writes a boot sector to the floppy disk (in A:)
tinyfrac.asm multi-function fractal demonstration program which results in 255 byte program
flatmode.asm sets up "flat real mode"
test1.asm demo showing how to use "flat real mode"
rawread.asm BIOS-based disk I/O to access MS-DOS file structure
fibo2.asm shows an interesting way to calculate Fibonacci numbers and also shows how to use the numeric coprocessor (Floating Point Unit)
vga.asm shows one possible method for checking the type of video card installed in a system
showdate.asm assembly language program which shows the current date and time in a form identical to that used by Posix ctime()
showregs.asm shows the contents of registers on program start
test2.asm illustrates the simplified stack-based parameter passing using Borland's TASM
print.asm not a whole program, but a module containing various print routines
example.asm very short program to show how one uses the floating point unit
pow.asm another floating point example program. This one contains a routine to do exponentiation
drives.asm a short utility program which enumerates valid drives attached to the system
dpmitest.asm a DPMI test program which also serves an example for how to use DPMI services to access memory
bcd.asm the venerable IBM-370 had a numeric format called packed decimal which was similar to packed BCD. This program shows how one might manipulate such numbers.
cashedsb.asm disables the cache on a 486 and Pentium processor.
eject.asm ejects a SCSI tape (or CD-ROM) from a drive. Shows a working example of a program which uses ASPI.
isbnchek.asm checks the validity of an ISBN by verifying the checksum
scr.asm shows a demonstration of a routine which scrolls a window on a text mode screen
net_q.asm gets a list of Queue servers under Novell Netware 3.11
net_sn.asm fetches and prints the network serial number under Novell Netware 3.11
bootthru.asm copies the Master Boot Record (MBR) from the C: drive, modifies it so that it will work from a floppy and writes it to a floppy. The effect is that the computer will boot "through" the A drive and load as though it had been booted from C:
getcol.asm workaround for a Windows 3.1 bug which returned an incorrect collate sequence table. This routine uses DPMI routines to fetch the DOS collate sequence table instead.
pentbug.asm tests for the well documented Pentium divide bug
pentid.asm issues the CPUID instruction to fetch the family, model and stepping ID

Ed Beroset
Last modified: Mon Mar 30 23:50:20 2009
Level Double-A conformance icon, 
          W3C-WAI Web Content Accessibility Guidelines 1.0 Valid CSS! Valid XHTML 1.0!