John Fine's home page
Topics: Protected mode programming examples, System utilities, Building
embedded systems
Last modified: Sep 12, 1999
NASM is an x86 assembler
written by Simon Tatham and Julian Hall, in portable C code and released with
full source code.
I made several changes to NASM, which were released as part of version 0.98
(release assembled by H. Peter Anvin).
I expect to make more NASM changes in the future; But at the moment almost
all of the NASM materials on my web pages have been superseded by the release of
version 0.98.
The following software is distributed as "zero price shareware". You don't
need to send any money to register and use this software; However, EMAIL
registration (to johnfine@erols.com) is
REQUIRED to continue to use it after a reasonable evaluation period.
I provide NO WARRANTY that this software is suitable or safe for any purpose.
Use it entirely at your own risk. If you do not accept these conditions, then
you have no permission to download, evaluate, or use this software.
pci07.zip can be
used to display or modify registers in PCI configuration space. It runs in DOS
or a DOS session of Win3.1 or Win95. For several Intel chipsets and for the SiS
5571, it translates a significant fraction of the raw information into readable
form. For most devices it defaults to displaying only identification of the
device. It can display/modify any registers in hex.
jloc07.zip a
linker/locator. To be used (instead of a linker) when you need more link-time
control over the placement of code and data segments. It is useful for linking
BIOS's and other ROM based executables, bootstrap code, operating systems, and
embedded systems executables. The current version cannot produce output formats
(such as EXE) which have load-time relocations. It can produce COM files and
flat image files. Online
documentation is now available. You will need DPMI to run JLOC. You may need
CSDPMI
pcopy02.zip
contains PARTCOPY.EXE, a utility for copying raw data. Backup the first few
tracks of your hard drive; Install boot code for your homemade OS on a floppy,
or even on your hard drive; Copy any chunk out of a file to a new file or
patching a chunk of another file.
These samples are the beginning of
what I intend to be a set of instructive examples in pmode and OS programming.
To rebuild any of them, you will need NASM and JLOC.
This sample source code is offered without warranty and without restrictions.
If you don't agree to use it entirely at your own risk, don't download it. If
you learn something from it, I would appreciate an EMAIL message telling me so
(but that is not required). If you include part or all of this code in a
product, it would be polite (but not required) to credit the source.
My sample source code contains a massive amount of explanation, so I think
you will find it easy to follow, even if the concepts are new. In order to focus
on the key concepts in the examples, I have left out a lot of code that would be
required if these were products rather than samples. These programs generally
assume they are being run in the correct environment, and do not produce useful
error messages when they are not.
- Boot code
- bootp02.zip
a very heavily commented example of a bootstrap for a protected mode image.
It loads images compatible with vload (below) and also images too large for
vload. BOOTP is designed to be loaded from a floppy by the BIOS and then
BOOTP loads the pmode image from the hard drive. This strange combination
may be more convenient than normal boot methods when you are debugging a new
OS or any stand-alone pmode project.
- bootf02.zip
Similar to bootp, except that both the boot and the image load from the same
FAT12 floppy. Could be used as the floppy version of boot code for a real
OS.
- bootr01.zip
Real mode bootsectors for FAT12 and FAT16. Could be used to load a real mode
OS, or to load a loader which then loads either a real or protected mode OS.
- vload04.zip
an example of using the VCPI interface to take control of the machine in
protected mode. I use vload to test stand alone protected mode programs
(such as practice versions of protected mode operating systems). It saves
one reboot when switching from edit/assemble/link under DOS to test without
DOS.
- smbmbr03.zip
(Small Multi-Boot Master-Boot-Record) is a replacement for a hard disk
master boot record. It displays a menu of choices of what to boot. It must
be customized for each install, so only source code is included, no
binaries.
- V86 mode
- v86test2.zip
Code to manage a V86 session from protected mode, packaged in a module that
can be loaded from bootp or bootf and can in turn load and run a 16-bit OS
such as DOS.
- v86call3.zip
This started as an attempt to help Aviv Revach with an OS
project and became an example of how to call the BIOS in V86 mode from a
pmode OS. It is packaged as something that can be loaded and run (from bootp
or bootf), but the stubs of OS startup code that make that possible aren't
intended to be realistic. They are just enough to make the V86 parts
testable.
- Other pmode images
- tasktes1.zip
An example of multi-tasking using TSS's. It is also an example of a flexible
scheduling algorythm. It also includes an example of kernel memory
management.
- 8254ex05.zip
an example of real time scheduling, using the 8254 timer for dynamic
(different for each tick) intervals. It also is an example of a priority
heap.
- 8254ex04.zip
a modification of 8254ex05.zip to demonstrate features added in version 0.4
of JLOC (including mixing C code with ASM).
- pmcom02.zip
A program to switch from real mode to 32 bit pmode and demonstrate use of a
pmode IDT and TSS. Unlike most of my samples, it builds without JLOC. It
includes a nonJLOC version of my GDT.INC to demonstrate building readable
IDT and GDT descriptors with just NASM and without the JLOC features that
make that easier.
- Sep 12,1999
- Renamed V86CALL
and slightly improved the comments in it.
- Jul 5, 1999
- bootr
- May 23, 1999
- NASM 0.98 pre-release 7
- May 15, 1999
- NASM 0.98 pre-release 6
- May 2, 1999
- Added BOOTF. Fixed links for NASM 0.98p3.7
- Mar 18, 1999
- NASM 0.98 pre-release 3.6
- Feb 24, 1999
- Fixed some links
- Feb 5, 1999
- Fixed PMCOM to avoid hitting a bug in 16-bit versions of NASM 0.97