Professional Documents
Culture Documents
BK Complete
BK Complete
BK Complete
1. About AutoBios
This section introduces AutoBios, lists some reasons for creating your own customized Bios, explains
Ownership and License information, and provides an Overview of the structure of the Bios.
1
Configuring a Bios
requirements without cumbersome escrow agreements or additional payment to a Bios Supplier to obtain
source code. By including AutoBios Documentation as part of your product, you may satisfy your
project requirements. If your project requires special verification or certification activities, AutoBios not
only gives you access to source code, it also allows you to configure it as you desire.
2
Introduction to AutoBios
Building and customizing the Bios requires some tools. Knowledge is the basic tool. Then you will
need the physical tools; the hardware and software described below.
There are many excellent publications available on these subjects in addition to the manuals that are
supplied with the software tools listed below. By visiting your library and book store, and by reading
computer periodicals, and especially by talking to computer-interested acquaintances, you will find ways
to augment your knowledge. For those who may be apprehensive about tackling a Bios project,
remember that knowledge is acquired by bits and pieces. Curiosity, patience, and a positive attitude will
be your best ally.
3
Configuring a Bios
4
Introduction to AutoBios
1.1.12 SysVue
Bonus - AutoBios includes the source code for SysVue, a Prom resident program that provides many of
the features of disk resident Debug programs. SysVue is always available with a keystroke sequence. It
is extremely handy for checking custom features of your Bios. Configuration options in Common.Plt file
let you specify many SysVue options.
Once you have successfully built the standard version of Bios, you will be ready to consider special
versions for your particular application.
5
Configuring a Bios
replacement of unreadable diskette(s) within 90 days of purchase. The Diskette(s) are not copy-protected
and should be used only to make working copies, and then archived for backup purposes. Liability under
this warranty is limited to the replacement of the diskette(s) even if claims otherwise have been made by
purchaser or any user of the information contained in this publication. This statement of warranty
constitutes the full and complete agreement between seller and buyer, and may not be modified by oral
representation or written instrument without the permission of The Software Farm.
1.3.1 Power On -
The processor starts operation at segment:offset address FFFFF:0000. This means that program
execution begins at the last paragraph (16 bytes) at the top of address space. This location normally will
have a far jump to a lower address where the Bios will start to initialize and check-out hardware features
of the system.
1.3.2 Diagnostics -
This usually starts at a label called 'reset' and includes checking of the CPU chip registers, tests and
initialization of the peripheral chips, and ends up by invoking a bootstrap routine.
1.3.3 Bootstrap -
The function of the bootstrap routine is to load DOS from a floppy disk. If you have a hard disk in the
system, a failure to boot from a floppy is usually followed by an attempt to boot from the hard disk. If
no disk is available, you may wish to default to SysVue or some other Prom resident program you may
elect.
1.3.4 Drivers -
The Bios contains the low-level drivers for a variety of devices. DOS normally assumes these drivers are
present in the Bios and makes calls to them to perform peripheral access. The drivers correspond to the
Bios Interrupts documented in various publications about PC's and DOS. To fully support DOS, these
drivers must be included, and their devices initialized by the Bios.
6
Introduction to AutoBios
normal linker utilities (such as Microsoft's Linker which links programs in an ascending address
sequence), can achieve this result. The top module of the Bios is written in Assembly language, so that
programmer control is maintained over the location of certain instructions. Additionally, the top module
provides a place to include various table structures and assembly language subroutines, which are C
functions.
From the power-on reset, a jump is executed (at FFFFF:0000) to an assembly language initialization code
sequence which initializes the DMA controller, the Ram Refresh, and the first 64 Kbytes of System Ram.
Once this has been accomplished, the C language POD (Power On Diagnostic) module is executed. This
module continues the power-up and diagnostic checks of the system, and also calls setup (initialization)
routines in the various device driver modules. When the system has been completely initialized, the
bootstrap function is called.
7
Configuring a Bios
The preferred method is to use a Prom Emulator to eliminate the need to remove and reprogram prom
chips. The emulator may be connected to a "host" machine downloads the Bios-under-Test.
An additional aid to testing is to add debug mode display statements to track the activity of the Bios.
These may be included in your C modules by using the printf("args") statement. The printf function
(printf.c) is similar in usage to the standard C function, but has some variation on argument types to
support the requirements of the Bios and SysVue.
Another test aid is a "PostCode" adapter which responds to Port I/O commands (usually at I/O Port 80),
and displays a two-character Hex code. For those systems with ISA bus connectors, a ready-made board
may be obtained. For other systems, the decoding logic may be added to the system board design.
When you have verified the operation of your modified Bios, the debug-mode statements may be
removed, and the Bios rebuilt.
8
Introduction to AutoBios
consolidated in a top-level file used to direct both the "make" process and the individual module
configuration.
This top-level file (Myfile.Job) is the primary device by which configuration is specified. By
maintaining project specific information in this file, a particular Bios can be re-created as desired. Lower
level modules may be updated independently, without creating regression. This hierarchy allows the
Bios to evolve (as software is known to do) with a minimum impact on the developer.
where the input filename is specified for the input stream, and the output stream may be another file, the
console device, a printer, or a serial channel, as shown in the examples below:
9
Introduction to AutoBios
11
Configuring a Bios
enum { False,True };
// I N C L U D E F I L E S
#include <stdio.h>
#include <string.h>
#include <process.h>
#include <io.h>
#include <conio.h>
#include <stdio.h>
#include <dos.h>
#include <errno.h>
#include <stdlib.h>
#include <fcntl.h>
// F U N C T I O N P R O T O T Y P E S
// V A R I A B L E S
// these are the temp saves for file time and date
unsigned FileDate;
unsigned FileTime;
unsigned Date,Time;
int fh;
FILE *instream,*outstream;
12
Introduction to AutoBios
if (argc < 3)
{
printf("\nUsage is Extract MixedFileName \"[Keyword]\" OutputFile <enter>");
exit(0);
}
// Read each line of the input file, and scan for keywords
while (fgets(line,255,instream))
{
13
Configuring a Bios
Touch may also be used to re-stamp a group of files when desired to align them with a major milestone
event, such as a product release, etc. Wildcard specifiers are allowed with Touch.
//---------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] The File Time/Date Stamp Touch Utility
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] TOUCH.C
//
// [Description] This program updates the time/date stamp(s)
// [Description] for the specified files.
//
// [Usage] Touch filespec <enter>
//
// [Return] Sets time/date stamp on files to current value.
//
// [Notes] None
//
// [History] 2.00 04/11/94 Original
//
//---------------------------------------------------------------------
enum { False,True };
// I N C L U D E F I L E S
#include <process.h>
#include <stdio.h>
#include <dos.h>
#include <sys\types.h>
#include <sys\utime.h>
//---------------------------------------------------------------
14
Introduction to AutoBios
{
printf("\nTouching %s",c_file.name);
if( _utime( c_file.name, NULL ) == -1 ) exit(1);
}
15
Configuring a Bios
//------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include <stdio.h>
#include <process.h>
#include <io.h>
#include <string.h>
/* G L O B A L V A R I A B L E S */
FILE *instream;
FILE *outstream;
unsigned long length;
unsigned int i,numread,numwritten, tab = 0;
#define blen 512
unsigned char instring[blen], outstring[blen], buffer[16384];
/* L O C A L D E F I N I T I O N S */
#define tabchar 9
#define rt_brace 125
#define lf_brace 123
#define indent_level 1 /* # of columns to indent */
/* P R O G R A M */
16
Introduction to AutoBios
while (fgets(instring,blen,instream) != 0)
{
// skip over leading spaces
i=0; while (instring[i++] == ' '); i--;
// check for right brace here so we de-indent the current line
if ((instring[i] == rt_brace) && (tab >= indent_level))
tab -= indent_level;
if(!write_ok)
{
printf("Error in writing temporary file, processing aborted.\n");
printf("Original file %s remains unchanged.\n",argv[1]);
}
else
{
// now copy the $id.$$$ to the original file
if (((instream = fopen("$id.$$$","r+b")) != NULL) &&
((outstream=fopen(argv[1],"w+b")) != NULL))
{
do
{
numread = fread((char *)buffer, sizeof(char),16384,instream);
numwritten = fwrite((char *)buffer, sizeof(char),numread,outstream);
if (numwritten != numread)
{
printf("Transfer error on file %s. Use $ID.$$$ as recovery
file./n",argv[1]);
write_ok = False;
17
Configuring a Bios
}
}
while (numread > 0);
fclose(instream);
fclose(outstream);
if(write_ok)
if ((numread = remove ("$id.$$$")) != 0)
printf("Error deleting temp file $ID.$$$\n");
}
}
}
}
18
Introduction to AutoBios
/* I N C L U D E F I L E S */
#include <stdio.h>
#include <string.h>
#include <process.h>
#include <io.h>
/* G L O B A L V A R I A B L E S */
FILE *instream;
FILE *outstream;
char *EqLoc;
unsigned DotCounter = 10;
/* L O C A L D E F I N I T I O N S */
#ifndef False
#define False 0
#endif
/* MAIN Program */
19
Configuring a Bios
strcpy(InName,argv[1]);
strcpy(OutName,argv[2]); strcat(OutName,".H");
if (filelength(fileno(instream))== -1)
{
printf("\nBad Length on input file %s\n",InName);
fclose(instream);
exit(1);
}
/*-------------------------------------------------------------*/
/*
** Now we have both files open, and we can start translating line by line
*/
printf("\nTranslating ");
20
Introduction to AutoBios
if(strlen(OutString) != 0)
{
fputs(OutString,outstream);
if(!--DotCounter) { DotCounter = 10; printf("."); };
}
}
}
printf(" Done\n\n");
fclose(instream);
fclose(outstream);
exit(0);
}
1. A zero-length Fill .Obj module is created, which will require 0 bytes of space on the 1st pass.
2. The linking order is specified so that the Fill module will be linked prior to the explicit module
(BiosJump).
3. The modules are linked, the total (highest address) being a function of the combined amount of code
(including the zero-length fill module).
4. The highest address used is subtracted from the top of the segment (offset FFFF) and the resulting
value (indicating the shortage) is translated into a text string directive. This evaluation is done by the
BiosGen Utility.
5. A new Fill.Obj module is constructed, using the adjustment value created by BiosGen.
6. A second link is done, in which the Fill module uses the calculated "padding" to occupy sufficient
space to cause to explicit module (BiosJump) to be located at the top of the image.
7. The resulting image (starting usually at offset 0000) contains code for the main Bios modules, Filled
space, then finally the explicit module at the end (top) of the segment, resulting in the power-on reset
code, (as well as other explicit locations) to appear in the correct locations.
The description below summarizes the method by which the Fill value is detected and calculated.
21
Configuring a Bios
The Biosgen.c file is used during the build process to sense the size of the Bios code and calculate a
value which will be used to upward justify the BiosJump module so that it resides in the highest portion
of the Bios segment. Biosgen reads the Bios.Map file from the first link, and detects the actual location
of the calculated position of offset E000. It then creates a filler file (BiosFill.Inc) which is used during
the second link to relocate the BiosJump.Asm modules code to the top of the Bios space.
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Bios filler generator
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] BIOSGEN.C
//
// [Language] MSVC 1.0/1.5
//
// [Category] Bios Build Utility
//
// [Description] This program reads the map file (bios.map) and
// [Description] calculates how far short it falls from ending at
// [Description] the top of the segment. Then it builds a biosfill.inc
// [Description] file that pads out enough to complete the segment
// [Description] (64k bytes). The .inc file is used in a second linking
// [Description] of the .obj files. This produces a full 64k byte file
// [Description] with the power-on reset jumps fixed at offset FFF0 in
// [Description] the binary image file.
//
// [Arguments] biosgen bios.map biosfill.inc
//
// [Return] Creates a biosfill.inc file
//
// [History] 2.00 04/11/94 Original
//
//-------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include <stdio.h>
#include <string.h>
#include <process.h>
#include <stdlib.h>
/* F U N C T I O N P R O T O T Y P E S */
/* G L O B A L V A R I A B L E S */
22
Introduction to AutoBios
FILE *stream;
int radix = 10;
char first[20],second[20],third[20];
char *p;
unsigned int i;
unsigned int diff;
unsigned int find; /* find/no find flag */
unsigned int find_string;
unsigned long int numread;
unsigned char line[255], *result;
/* P R O G R A M */
23
Configuring a Bios
fclose(stream);
if (find == 0) /* no find */
{
printf("Could not find ORG_FFF0 label in .MAP file\n\r");
printf("Aborting operation.\n\r");
printf(" 1. Check command line argument specifies .MAP file\n\r");
printf(" 2. Check .MAP file for proper labels.\n\r");
}
else
{
printf(" File size = %5u\n\r",diff+(0x10000-find_string));
if (diff >= find_string)
{
printf(".EXE file is to large to process - aborting fill generation\n\r");
}
else
{
numread = find_string - diff; /* num to write */
24
Introduction to AutoBios
The Biosdate.c file is the program which inserts the current date value as the date-stamp in the Bios
module. This date is determined from the current date in your development machine. It will obviously
affect the overall checksum of the Bios module, if you re-build on different days.
//-------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Bios date routine
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] BIOSDATE.C
//
// [Language] MSVC 1.0/1.5
//
// [Category] Bios Build Utility
//
// [Description] Insert date string into bios binary file. This program
// [Description] inserts the current date information into the date
// [Description] field in the Bios at location FFF5
//
// [Arguments] Filename
//
// [Return] Writes date field in bios.bin file
//
// [History] 2.00 04/11/94 Original
//
//-------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include <stdio.h>
#include <process.h>
#include <time.h>
#include <string.h>
/* G L O B A L V A R I A B L E S */
FILE *stream;
char date_buffer[9];
/* P R O G R A M */
void main(argc,argv)
int argc;
char *argv[];
25
Configuring a Bios
{
printf("\nBiosDate Utility Ver. 1.00 05-25-93");
printf("\nCopyright 1993 John O. Foster - All Rights Reserved.\n");
if ((argc <2) || (stricmp(argv[1],"/?") == 0))
{
printf("\nUsage is - Biosdate xx.bin <enter>");
printf("\n where xx.bin is name of bios image file");
printf("\n Biosdate inserts today's date string at offset ");
printf("\n FFF5 of the bios image");
exit(0);
}
if ((stream = fopen(argv[1],"r+b")) == NULL)
printf("\nCould not open file for reading\n");
else
{
fseek(stream,-11,SEEK_END); /* find date field */
_strdate(date_buffer);
fwrite((char *)date_buffer,sizeof(char),8,stream);
printf("\nToday's date inserted into file\n");
}
fclose(stream);
}
26
Introduction to AutoBios
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] BIOSSUM.C
//
// [Language] MSVC 1.0/1.5
//
// [Category] Bios Build Utility
//
// [Description] This program calculates a checksum and inserts it
// [Description] into the last byte location of the Bios.
//
// [Arguments] Filename
//
// [Return] None
//
// [History] 2.00 04/11/94 Original
//
//------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include <stdio.h>
#include <process.h>
#include <string.h>
/* G L O B A L V A R I A B L E S */
unsigned numread,i;
char sum,buffer[32768];
FILE *stream;
/* P R O G R A M */
void main(argc,argv)
int argc;
char *argv[];
{
printf("\nBiosSum Bios Checksum Utility Version 1.00 05-25-93");
printf("\nCopyright 1993 John O. Foster - All Rights Reserved.\n");
if ((argc <2) || (stricmp(argv[1],"/?") == 0))
{
printf("\nUsage is Biossum xx.bin <enter>");
printf("\n where xx.bin is the binary bios image file.");
exit(0);
}
if ((stream = fopen(argv[1],"r+b")) == NULL)
printf("Could not open file for reading\n");
else
{
sum=0;
numread = fread((char *)buffer,sizeof(char),32768,stream);
//
27
Configuring a Bios
// Scan for the first "CfgEnd" string and advance to the next paragrap mark
the
// start of the checksummed bios code. Reserve the prior cells for rom
module
// integration later when customizing the bios prom
// with extensions.
//
28
Introduction to AutoBios
The output file is written in standard comma-separated-values, which can be used as input to database or
spreadsheet programs, as well as listed in its raw form.
Following the listing of the Version.C module, are listings of the VrsFiles.Def and the VrsWords.Def
modules which are used in the standard Makefile.
//---------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] The Version Reporting Extraction Program
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] VERSION.C
//
// [Description] This program reads the extension list file (files.vrs)
// [Description] and the keyword file (keywords.vrs) to build a list
// [Description] of file types to scan. If the keywords are found,
// [Description] then the line is written to an output file.
// [Description] The output file may then be used as an input file to
// [Description] a database manager to generate desired reports.
// [Description] An Index value is also written for each output line,
// [Description] This value serves to associate lines with a particular
// [Description] file which is being scanned.
// [Description] The standard delimiter character is the ".
// [Description] The [Delimiter] decimal-value keyword may be used to
// [Description] specifiy an alternate delimiter character. This keyword
// [Description] should be placed after the [Keyword List] keyword in the
// [Description] keyword.vrs file.
//
// [Usage] Version files.vrs keywords.vrs outputfile.txt <enter>
//
// [Arguments] ExtensionList KeywordList OutputFileSpec
//
// [Return] Creates a comma delimited ASCII text file
//
// [Notes] None
//
// [History] 2.00 04/11/94 Original
// [History] 2.00 04/11/94 Original
//
//---------------------------------------------------------------------
enum { True,False };
// I N C L U D E F I L E S
#include <stdio.h>
29
Configuring a Bios
#include <string.h>
#include <process.h>
#include <io.h>
#include <conio.h>
#include <stdio.h>
#include <dos.h>
#include <errno.h>
#include <stdlib.h>
// F U N C T I O N P R O T O T Y P E S
void ScanFile(void);
// V A R I A B L E S
char KeywordList[50][80];
unsigned KeywordListFound = False;
unsigned NumberOfKeywords = 0;
// This is the input line string
char line[255];
char * charptr;
// This is the string used to construct the wildcard string
char Wildcard[32];
// This is the structure used for the findfirst/findnext
struct _find_t c_file;
// These are the temp strings used by the scanner to write the outstream
char FileCountString[255];
char KeywordString[255];
char DataString[255];
char *DataPtr;
char WhiteSpace[] = " ";
unsigned FileIndex;
unsigned KeywordIndex;
unsigned FileCount; // written to output file for Database Key
// This is the column header string dfor the output file
char HeaderString[] =
"\"FileCount\",\"ActualFileName\",\"Keyword\",\"Data\"\n";
char ActualFileNameKeyword[] = "[ActualFileName]";
30
Introduction to AutoBios
31
Configuring a Bios
while(_dos_findnext(&c_file)==0)
{
//printf("\nLooking for next file %s",c_file.name);
ScanFile();
32
Introduction to AutoBios
}
}
fcloseall();
printf("\n");
};
void ScanFile(void)
{
// Read each line of the input file, and scan for keywords
while (fgets(line,255,instream) != NULL)
{
// Remove the newline char, if present
if(charptr = strrchr(line,(int)'\n')) *charptr = 0;
for(KeywordIndex = 0; KeywordIndex < NumberOfKeywords; KeywordIndex++)
{
//printf("\nScanning Keyword %s",&KeywordList[KeywordIndex][0] );
if(strstr(line,&KeywordList[KeywordIndex][0]))
{
//printf("\nFound %s",line);
33
Configuring a Bios
}
}
}
fclose(instream);
}
34
Introduction to AutoBios
//
//---------------------------------------------------------------------
[File List]
.
.bas
.bat
.asm
.c
.chp
.h
.inc
.job
.plt
.ini
.inp
.def
35
Configuring a Bios
//
// [Usage] Used as input to version.exe
//
// [History] 2.00 04/11/94 Original
//
//---------------------------------------------------------------------
36
Introduction to AutoBios
programs, it actually creates the Extended Intel format, which includes segment records, making possible
conversions on image files greater than 64K bytes.
This utility may be run by stand-alone batch files as needed, or included in a PostMake directive in a .Job
file.
;****************************************************************************
;
; [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
;
; [Product Name] AutoBios
;
; [Module Name] Binary to Intel hexadecimal filter
;
; [Version] 3.00
;
; [Author] John O. Foster
;
; [Date] 04/11/94
;
; [File Name] BIN2HEX.ASM
;
;
; [Description] This program converts the contents of a file to Intel
; [Description] hexadecimal format. Since many Prom Programmers will
; [Description] accept an Intel Hex download format, .BIN files may
; [Description] be converted.
; Filter outputs can be directed as shown in the examples below.
;
; [Usage] bin2hex <infile.bin >outfile.hex
; [Usage] bin2hex <infile.bin >COM1
; [Usage] bin2hex <infile.bin >CON
;
; [History] 2.00 04/11/94 Original
;
;****************************************************************************
; P R O G R A M
.model compact,c
stdin equ 0
stdout equ 1
.data
ibuff db 16 dup(0)
obuff db 32 dup(0)
line_count dw 0
char_count db 0
checksum db 0
ochar db 0
eof db 13,10,':00000001FF'
byte_counter dw 0 ; whenever this rolls over, we want to send
37
Configuring a Bios
bin2hex proc
mov ax,DGROUP
mov ds,ax
mov bx,0
mov bx,segment_record_pointer_table[bx]
; now bx points to the canned record
call write_seg_record
mov line_count,0
.WHILE (ax == ax)
mov bx,stdin ; get stdin
mov cx,16
mov dx,offset ibuff
mov ah,3fh
int 21h
.BREAK .IF(Carry?) ; done if error or no more bytes
.BREAK .IF (ax == 0)
mov char_count,al
call write_line
add byte_counter,16 ; count up lines (16 bytes per line)
.IF (byte_counter == 0)
add segment_counter,2 ; this requires a segment change
; since this is a word index, we
; just add 2 now instead of later
push bx
mov bx,segment_counter
mov bx,segment_record_pointer_table[bx]
; now bx points to the canned record
call write_seg_record
pop bx
.ENDIF
.ENDW
call write_eof ; write eof
mov ax,4c00h
int 21h ; return to dos
bin2hex endp
write_line proc
mov checksum,0
mov cl,char_count
38
Introduction to AutoBios
xor ch,ch
mov al,13 ; carriage return
call putc
mov al,10 ; line feed
call putc
mov al,":"
call putc
mov al,char_count
sub checksum,al
call convert
mov ax,line_count
mov al,ah
sub checksum,al
call convert
mov ax,line_count
sub checksum,al
call convert
mov al,00
sub checksum,al
call convert
add line_count,16
mov si,offset ibuff
.REPEAT
lodsb
sub checksum,al
call convert
.UNTILCXZ
mov al,checksum
call convert
ret
write_line endp
39
Configuring a Bios
mov bx,stdout
mov cx,1
mov dx,offset ochar
mov ah,40h
int 21h
ret
putc endp
end bin2hex
40
Introduction to AutoBios
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] SPLITBIN.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] This program reads the .bin file specified by the
// [Description] argument, and splits it into an .evn and a .odd file.
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include <stdio.h>
#include <string.h>
#include <process.h>
/* G L O B A L V A R I A B L E S */
/* P R O G R A M */
41
Configuring a Bios
evenbuffer[i] = inbuffer[j];
oddbuffer[i] = inbuffer[j+1];
}
fwrite((char *)evenbuffer,sizeof(char),numread/2,evenstream);
fwrite((char *)oddbuffer,sizeof(char),numread/2,oddstream);
}
}
}
/* I N C L U D E F I L E S */
#include <stdio.h>
#include <string.h>
#include <process.h>
/* G L O B A L V A R I A B L E S */
42
Introduction to AutoBios
unsigned numread,i,j;
/* P R O G R A M */
43
Configuring a Bios
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Indent Utility
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 07/15/94
//
// [File Name] INDENT.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] This program is a utility which is used to indent C
// [Description] source code lines according to the nesting level of
// [Description] the left and right bracket characters ( { } ). It
// [Description] improves readability of the souce file, but does not
// [Description] affect the logic flow. It is useful when a general
// [Description] purpose editor is being used to prepare source files.
//
// [Arguments] Indent File name <enter>
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include <stdio.h>
#include <process.h>
#include <io.h>
#include <string.h>
/* G L O B A L V A R I A B L E S */
FILE *instream;
FILE *outstream;
unsigned long length;
unsigned int i,numread,numwritten, tab = 0;
#define blen 512
unsigned char instring[blen], outstring[blen], buffer[16384];
/* L O C A L D E F I N I T I O N S */
#define tabchar 9
#define rt_brace 125
44
Introduction to AutoBios
/* P R O G R A M */
45
Configuring a Bios
break;
}
}
}
}
}
}
fclose(instream);
fclose(outstream);
if(!write_ok)
{
printf("Error in writing temporary file, processing aborted.\n");
printf("Original file %s remains unchanged.\n",argv[1]);
}
else
{
// now copy the $id.$$$ to the original file
if (((instream = fopen("$id.$$$","r+b")) != NULL) &&
((outstream=fopen(argv[1],"w+b")) != NULL))
{
do
{
numread = fread((char *)buffer, sizeof(char),16384,instream);
numwritten = fwrite((char *)buffer, sizeof(char),numread,outstream);
if (numwritten != numread)
{
printf("Transfer error on file %s. Use $ID.$$$ as recovery
file./n",argv[1]);
write_ok = False;
}
}
while (numread > 0);
fclose(instream);
fclose(outstream);
if(write_ok)
if ((numread = remove ("$id.$$$")) != 0)
printf("Error deleting temp file $ID.$$$\n");
}
}
}
}
46
Introduction to AutoBios
#**************************************************************************
#
# [Copyright] Copyright (c) 1997 John O. Foster - All Rights reserved.
#
# [Product Name] AutoBios
#
# [Module Name] MakeFile
#
# [Version] 3.00
#
47
Configuring a Bios
True = 1
False = 0
LibOperator=nul
all:: Bios.bin
all:: chiphelp.txt
all:: SaDisk.exe
all:: SaSysVue.exe
all:: SaVideo.exe
all:: SaHard.exe
all:: SaComm.exe
all:: SaLpt.exe
all:: SaPrtScr.exe
all:: SaKb.exe
all:: SaSysSrv.exe
all:: SaEquip.exe
all:: SaMem.exe
all:: SaTimer.exe
all:: SaTOD.exe
all:: SaBoot.exe
all:: PostMake.bat
all:: $(objs)
all:: i386Boot.bin
48
Introduction to AutoBios
! if [type lastmake.txt]
!endif
!include job.tmp
Platform=$(CfgPlatform)
#-------------------------------------------------
!include Platform.tmp
!include common.tmp
Chip = $(CfgChip)
49
Configuring a Bios
chipc.tmp: Chip.Tmp
command /cextract $(Chip).chp [C] chipc.tmp
chiph.tmp: Chip.Tmp
command /cextract $(Chip).chp [H] chiph.tmp
chiphelp.txt: Chip.Tmp
command /cextract $(Chip).chp [HELP] chiphelp.txt
chipdump.h: Chip.Tmp
command /cextract $(Chip).chp [DUMP] chipdump.h
!MESSAGE
cpulevel = $(CfgCompiler)
!if $(CfgCodeView)
!MESSAGE Selecting build options to generate CodeView information files.
adebug =-Fl -Sg -Zi -Sn
cdebug =-Fc -Zi
ldebug = /CO
!endif
!if $(CfgListings)
!MESSAGE Selecting build options to generate listing files.
alist =-Fl -Sg -Sn
clist =-Fc
ldebug =
!endif
50
Introduction to AutoBios
# Run Job2H and H2INC as needed to generate updated .H and .INC files.
Bios.inc: Bios.h
BiosPrfx.inc: Bios.inc
all:: $(Chip).exe
51
Configuring a Bios
52
Introduction to AutoBios
53
Configuring a Bios
54
Introduction to AutoBios
55
Configuring a Bios
56
Introduction to AutoBios
objs = chip.obj \
object.obj \
Printf.obj \
CmdCalc.obj \
CmdChip.obj \
CmdChksm.obj \
CmdCLS.obj \
Cmdcmos.obj \
CmdComp.obj \
CmdDate.obj \
CmdDevic.obj \
lists.obj \
CmdDrive.obj \
CmdDump.obj \
CmdEnter.obj \
CmdFill.obj \
CmdHelp.obj \
GetStr.obj \
CmdInOut.obj \
CmdInt.obj \
CmdMem.obj \
CmdMove.obj \
CmdNpx.obj \
CmdoDump.obj \
CmdPipe.obj \
CmdRegs.obj \
CmdSrch.obj \
CmdSI.obj \
CmdScan.obj \
CmdTrace.obj \
CmdTime.obj \
CmdTypes.obj \
CmdVideo.obj \
CmdSnap.obj \
PrtScr.obj \
Mem.obj \
Misc.obj \
Boot.obj \
SysVue.obj \
Comm.obj \
Keyboard.obj \
Disk.obj \
Hard.obj \
Lpt.obj \
Crt.obj \
Tmr.obj \
Tod.obj \
57
Configuring a Bios
Equi.obj \
SysSrv.obj \
Typing.obj \
Bios8042.obj \
Pause.obj \
KbHit.obj \
CmdVctrs.obj \
CmdRhex.obj \
CmdWhex.obj \
Virtual.obj \
Pod.obj \
buildarg.obj \
prnnames.obj \
prnlist.obj \
getvalue.obj \
namexist.obj \
valuexst.obj \
getname.obj \
reboots.obj \
sysbreak.obj \
conslbrk.obj \
loaduser.obj \
parsedig.obj \
asc2dec.obj \
asc2hex.obj \
isdeciml.obj \
ishex.obj \
CalcCmos.obj \
InCmos.obj \
OutCmos.obj \
RstCmos.obj \
SetCmos.obj \
TglCmos.obj \
CmosType.obj \
DsplyVid.obj \
DsplyDrv.obj \
DsplyDte.obj \
DsplyTme.obj \
DsplyNpx.obj \
DsplyUsr.obj \
DsplyHrd.obj \
DsplyReg.obj \
StrChr.obj \
StrCmp.obj \
StrMatch.obj \
StrLen.obj \
StrStr.obj \
StrTok.obj \
ReadSwit.obj \
RomScan.obj \
CmosTble.obj \
XMemTest.obj \
DskReset.obj \
DskRead.obj \
DskDiag.obj \
DskInit.obj \
58
Introduction to AutoBios
DskRecal.obj \
DskChain.obj \
GetBios.obj \
GetSys.obj \
GetCfg.obj \
GetVirt.obj \
PutChar.obj \
PutChVid.obj \
SetTmCnt.obj \
SetTimer.obj \
Delay.obj \
GetRegs.obj \
CTypes.obj \
RepInOut.obj \
HardTble.obj \
Beep.obj \
SendEOI.obj \
DummyIrt.obj \
SysCfgTb.obj \
GetChar.obj \
VidFuns.obj \
VidMoves.obj \
VidFont.obj \
ScanCall.obj \
SaPrefix.obj \
SaSuffix.obj \
ClrObjct.obj \
StrCpy.obj \
ClkMisc.obj \
CalcSize.obj \
IDstring.obj \
KbTable.obj
BiosLib.lib : $(objs)
lib /PAGE:32 Bioslib.lib @<<BiosLib.lrf
-+$(?: = &^
-+)
BiosLib.lst;
<<KEEP
i386Boot.bin: $*.asm
ml /Fl$*.lst $*.asm
debug <i386Boot.inp
Bios.bin: Virtual.obj \
BiosLink \
BiosCut.inp \
59
Configuring a Bios
biosstart.obj \
bioscfg.obj \
Pod.obj \
BiosJump.obj \
BiosStart.obj \
BiosLib.lib \
biossum.exe \
biosdate.exe \
biosgen.exe \
version.exe \
$(Chip).exe \
tools.ini
copy Blank.inc BiosFill.inc
$(asm) -c -Cp $(ADEBUG) BiosFill.asm
link $(lflags) @BiosLink
biosgen Bios.map BiosFill.inc
$(asm) -c -Cp $(ADEBUG) BiosFill.asm
link $(lflags) @BiosLink
debug <BiosCut.inp
biosdate Bios.bin
biossum Bios.bin
copy Bios.bin $(Job).bin
type <<LastMake.txt
# LastMake Parameters
LastJob=$(Job)
LastChip=$(Chip)
LastPlatform=$(Platform)
<<KEEP
@echo Building Checkpoint List To File Check.Pnt
@erase check.pnt
@-find /I "checkpointcode" Bios.h > $*.pnt
@copy *.pnt check. >NUL
@rename check. check.pnt
@echo Building Include File List To File Include.ncl
@erase include.ncl
@-find /I "#include" Bios.h > $*.ncl
@copy *.ncl include. >NUL
@-rename include. include.ncl
@echo Building ModuleSize List File to FindSize.txt
@-copy *.rpt findsize.tmp >NUL
@-find /I "Module Size" findsize.tmp >findsize.txt
@echo Building Version.Txt file for Optional Version Analysis
@-version vrsfiles.def vrswords.def version.txt >version.rpt
@echo Building CfgHelp.Txt file for Configuration Options Summary
@-version cfgfiles.def cfgwords.def CfgHelp.Txt ?>cfghelp.rpt
@echo Building an Updated Chip Directory File (Chip.Dir).
@dir *.chp >chip.dir
@-find "CHP" chip.dir >chip.xxx
@-sort <chip.xxx >chip.dir
@echo Building an Updated HardType.Txt Information File.
@-extract BiosStart.asm [HELP] hardtype.txt
@echo Building a Current Configuration List ("JobName".Cfg)
@-findcfg Bios.inc >CfgList.xxx
@-sort <Cfglist.xxx >$(Job).Cfg
@echo Building Optional PostMake Sequence
postmake.bat: Bios.bin
60
Introduction to AutoBios
<<postmake.bat
$(CfgPostMake)
$(CfgPostMake0)
$(CfgPostMake1)
$(CfgPostMake2)
$(CfgPostMake3)
$(CfgPostMake4)
$(CfgPostMake5)
<<KEEP
#@echo Running Optional PostMake Sequence
#@postmake.bat
@echo on
@echo.
SaDisk.bin: SaDisk.exe
@debug <SaDisk.inp
@biossize SaDisk.Tmp SaDisk.Bin
SaHard.bin: SaHard.exe
@debug <SaHard.inp
@biossize SaHard.Tmp SaHard.Bin
SaSysVue.bin: SaSysVue.exe
@debug <SaSysVue.inp
@biossize SaSysVue.Tmp SaSysVue.Bin
SaVideo.bin: SaVideo.exe
61
Configuring a Bios
@debug <SaVideo.inp
@biossize SaVideo.Tmp SaVideo.Bin
SaComm.bin: SaComm.exe
@debug <SaComm.inp
@biossize SaComm.Tmp SaComm.Bin
SaLpt.bin: SaLpt.exe
@debug <SaLpt.inp
@biossize SaLpt.Tmp SaLpt.Bin
SaPrtScr.bin: SaPrtScr.exe
@debug <SaPrtScr.inp
@biossize SaPrtScr.Tmp SaPrtScr.Bin
SaKb.bin: SaKb.exe
@debug <SaKb.inp
@biossize SaKb.Tmp SaKb.Bin
SaSysSrv.bin: SaSysSrv.exe
@debug <SaSysSrv.inp
62
Introduction to AutoBios
SaEquip.bin: SaEquip.exe
@debug <SaEquip.inp
@biossize SaEquip.Tmp SaEquip.Bin
SaMem.bin: SaMem.exe
@debug <SaMem.inp
@biossize SaMem.Tmp SaMem.Bin
SaTOD.bin: SaTOD.exe
@debug <SaTOD.inp
@biossize SaTOD.Tmp SaTOD.Bin
SaTimer.bin: SaTimer.exe
@debug <SaTimer.inp
@biossize SaTimer.Tmp SaTimer.Bin
SaBoot.bin: SaBoot.exe
@debug <SaBoot.inp
@biossize SaBoot.Tmp SaBoot.Bin
63
Configuring a Bios
all:: cleanup
cleanup:
@echo.
@echo Make Complete
64
Introduction to AutoBios
[NMAKE]
65
Configuring a Bios
asm =ML
awarn =-W0
adebug =
alist =
ainc =
astd =-c -Cp
extasw =
aflags =$(awarn) $(alist) $(adebug) $(ainc) $(astd) $(extasw)
cc =CL
cwarn =-W0
cdebug =
clist =
cinc =
cpulevel=
cstd =-c -Gs -Ox -Zp1 -J -Zl -Asfw
extcsw =
cflags =$(cwarn) $(clist) $(cdebug) $(cinc) -G$(cpulevel) $(cstd) $(extcsw)
link =link
lstd =
ldebug =
exelink =/E
lflags = $(lstd) $(ldebug)
.SUFFIXES:
.asm.obj:
$(asm) $(aflags) -FR$*.sbr $*.asm
$(asm) $(aflags) $*.asm >$*.rpt
-find /I "checkpoint(" $*.asm > $*.pnt
-find /I "include" $*.asm > $*.ncl
.c.obj:
66
Introduction to AutoBios
.obj.exe:
$(link) $(lflags) $*;
.tmp.h:
Job2h $*.tmp $*
.h.inc:
h2inc /W0 /Cp /Zp1 /G2 /Ht /J /Fc $*.h
.c.exe:
$(cc) -FR$*.sbr $*.c
67
Introduction to AutoBios
Note: The Linker ignores all lines after the semi-colon, so the
module description information is placed at the end of the file
#*************************************************************************
#
# [Copyright] Copyright (c) 1997 John O. Foster - All Rights reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Linker Response file
#
# [Version] 3.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] BiosLink.
#
# [Language] Link Version 5.50
#
# [Description] This is the Linker response file used by the
# [Description] Bios makefile.
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
69
Introduction to AutoBios
71
Introduction to AutoBios
4. Configuring a Bios
4.1 The Configuration Strategy
AutoBios uses a "project' oriented structure to simplify the creation of a Bios customized to a particular
system board. The structure is shown below:
Sample.Job
|---------- ------------------ NoChip.Chp
| Acer.Chp
| VLSI.Chp
| C&T.Chip
| Opti.Chp
|
XT.Plt At.Plt At386.Plt
|
Common.Plt
The fundamental definition file is the Common Platform (Common.Plt) file. This file specifies the
standard default configuration options for all Bios combinations. This file allows easy expansion and
updating of AutoBios, since added features can be specified by modifying the Common.Plt file.
The next level of Platform Files, (typically for each class of system, XT, AT, etc.) permit redefining the
default configuration options, customizing the Bios for a general class of system board.
The highest level of configuration information is contained in the .job file. This is where board specific
options are defined, including the inclusion of support for a particular chipset which may be on the
system board. The chipset definition is specifies by including a .Chp support module from a library of
support modules. Register initialization information needed for a chipset is normally defined in the .Job
module, allowing the .Chp modules to be generalized with default chip initialization information.
The .Job, .Chp, and .Plt modules are processed by the MakeFile in a top-down order as shown above, so
that an default option definition may be over-ridden by a higher precedence module. Any unspecified
options will use the next-lower found definition. The Common.Plt definitions are the lowest-level, and
provide defaults for any otherwise unspecified options.
This precedence allows the .Job files to be minimized for a a particular Job/ Project/System Board. By
examining the following Job, Chip, and Platform files, one can notice the structure involved.
Since these files may be created and updated as required for system board and architecture changes, a
more complete listing of available files is shown in the Appendices.
73
Introduction to AutoBios
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
75
Configuring a Bios
CfgPromSingle = True
CfgDisk1Type = 1440
CfgVideoType = Mono
CfgBaseMem = 640
CfgExtMem = 384
CfgHard1Type = 47
CfgHard47Cyls = 733
CfgHard47Heads = 4
CfgHard47Sectors=28
CfgBootSysVue = True
CfgBootOrder = 1
CfgKeyboardIntercept = False
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgMaxMem = 640
CfgMemTestGranularity = 64
CfgMemTestPatternBias = 0x0000
CfgKeyboardStyleAT = True
CfgPlatform = AT386
# [PostMake]
#------ Use the following template for a PostMake Definition ---
# To create a PostMake Sequence, define CfgPostMake.
# If CfgPostMake is not defined, a default sequence will be used.
# To create an active and and alternate PostMake (useful for
# debugging) in this file, define CfgPostMake as True/False.
#CfgPostMake = False
76
Introduction to AutoBios
!ifdef CfgPostMake
postmake.bat:
<<postmake.bat
@rem --------------------------------------------------------------
@rem - You may add a post-make sequence to the end of the Bios
@rem - build process to create the actual prom image files you need.
@rem - This may include concatenating the Bios to other file images
@rem - for larger prom sizes, running the "bin2hex <infile >outfile"
@rem - converter, or for downloading the prom image to a prom
@rem - programmer. You may wish to run an audio "beep" routine to
@rem - alert you to completion of the build.
@rem - The commands may end with the "^" caret to specify a "newline"
@rem - continuation character.
@rem -------- Insert PostMake Command below ------------------------
rem -- Optional -- PostMake file defined ---
pause
@rem -------- Insert PostMake Commands above -----------------------
<<KEEP
!endif
#---- End Of PostMake template -----------------------------------
77
Introduction to AutoBios
79
Configuring a Bios
CfgPromSingle = False
CfgDisk = True
CfgHard = False
CfgBootSysVue = True
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgVideoType = Mono
CfgBaseMem = 640
CfgExtMem = 3072
CfgTypeByte = 0fah
CfgTypeParms = 08h,00h,0fah,00,0b0h,0,0,0,0,0
CfgDisk1Type = 1200
CfgMaxMem = 640
CfgMemTestGranularity = 64
CfgMemTestPatternBias = 0x0000
CfgKeyboardStyleAT = True
# For MSC 8.0 (Visual C/C++) this is defined as "G3" in the at386.plt
# file to create true 386 code. If using C6 or C7, edit AT386.Plt
# and change G3 to G2.
CfgPlatform = AT386
# [PostMake]
#------ Use the following template for a PostMake Definition ---
80
Introduction to AutoBios
#CfgPostMake = True
!ifdef CfgPostMake
postmake.bat:
<<postmake.bat
@rem --------------------------------------------------------------
@rem - You may add a post-make sequence to the end of the Bios
@rem - build process to create the actual prom image files you need.
@rem - This may include concatenating the Bios to other file images
@rem - for larger prom sizes, running the "bin2hex <infile >outfile"
@rem - converter, or for downloading the prom image to a prom
@rem - programmer. You may wish to run an audio "beep" routine to
@rem - alert you to completion of the build.
@rem - The commands may end with the "^" caret to specify a "newline"
@rem - continuation character.
@rem -------- Insert PostMake Command below ------------------------
rem -- Optional -- PostMake file defined ---
splitbin c_tneat
@rem -------- Insert PostMake Commands above -----------------------
<<KEEP
!endif
#---- End Of PostMake template -----------------------------------
81
Introduction to AutoBios
4.2.2.2 Banjo.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Default Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] banjo.JOB
#
# [Functional Description]
#
# If "NMAKE <enter>" is run without a "Project = xxx" argument,
# this file is used for the default configuration.
#
# To create a specific project, use this file as a sample,
# and create a "myname.prj" file for a specific project
# configuration. Run "NMAKE Project=myname <enter>" to
# create a bios.
#
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
CfgProjectVersion = "0.99"
CfgProjectCustomer= "Onabanjo"
CfgProjectPartNr = "930203000000-00001"
CfgProjectOption = "386SX TI 82S411"
CfgPromSingle = True
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgDisk1Type = 1440
83
Configuring a Bios
CfgDisk2Type = 1200
CfgVideoType = VGA
CfgBaseMem = 640
CfgExtMem = 3200
CfgHard1Type = 47
CfgHard47Cyls = 733
CfgHard47Heads = 4
CfgHard47Sectors=28
CfgBootSysVue = True
CfgBootOrder = 1
CfgKeyboardIntercept = False
CfgPlatform = AT386
CfgChip = TI411
84
Introduction to AutoBios
4.2.2.3 Barry.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Default Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 10/10/93
#
# [File Name] Barry.JOB
#
# [Functional Description]
#
# If "NMAKE <enter>" is run without a "Project = xxx" argument,
# this file is used for the default configuration.
#
# To create a specific project, use this file as a sample,
# and create a "myname.prj" file for a specific project
# configuration. Run "NMAKE Project=myname <enter>" to
# create a bios.
#
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
CfgProjectVersion = "0.99"
CfgProjectCustomer= "Barry"
CfgProjectPartNr = "93101000000-00001"
CfgProjectOption = ""
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgDisk1Type = 1440
#CfgDisk2Type = 360
85
Configuring a Bios
CfgVideoType = VGA
CfgBaseMem = 640
CfgExtMem = 1920
CfgHard1Type = 47
CfgHard47Cyls = 733
CfgHard47Heads = 4
CfgHard47Sectors= 28
CfgBootSysVue = True
CfgBootOrder = 1
CfgKeyboardIntercept = False
CfgPlatform = AT386
CfgChip = SYMPH461
86
Introduction to AutoBios
4.2.2.4 Bob.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Default Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] Bob.JOB
#
# [Functional Description]
#
# If "NMAKE <enter>" is run without a "Project = xxx" argument,
# this file is used for the default configuration.
#
# To create a specific project, use this file as a sample,
# and create a "myname.prj" file for a specific project
# configuration. Run "NMAKE Project=myname <enter>" to
# create a bios.
#
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
CfgProjectVersion = "0.99"
CfgProjectCustomer= "Bob"
CfgProjectPartNr = "930203000000-00001"
CfgProjectOption = ""
CfgPromSingle = True
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgDisk1Type = 1440
87
Configuring a Bios
CTomfgDisk2Type = 360
CfgVideoType = Mono
CfgBaseMem = 640
CfgExtMem = 1920
CfgHard1Type = 47
CfgHard47Cyls = 733
CfgHard47Heads = 4
CfgHard47Sectors= 28
CfgBootSysVue = True
CfgBootOrder = 0
CfgKeyboardIntercept = False
CfgPlatform = AT386
CfgChip = VLSI315
88
Introduction to AutoBios
4.2.2.5 Brent.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Default Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] Brent.JOB
#
# [Functional Description]
#
# If "NMAKE <enter>" is run without a "Project = xxx" argument,
# this file is used for the default configuration.
#
# To create a specific project, use this file as a sample,
# and create a "myname.prj" file for a specific project
# configuration. Run "NMAKE Project=myname <enter>" to
# create a bios.
#
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
CfgProjectVersion = "0.99"
CfgProjectCustomer= "Brent"
CfgProjectPartNr = "930203000000-00001"
CfgProjectOption = "Headland HT22"
CfgPromSingle = True
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgDisk1Type = 1440
89
Configuring a Bios
CfgDisk2Type = 1200
CfgVideoType = VGA
CfgBaseMem = 640
CfgExtMem = 3200
CfgHard1Type = 47
CfgHard47Cyls = 733
CfgHard47Heads = 4
CfgHard47Sectors=28
CfgBootSysVue = True
CfgBootOrder = 1
CfgKeyboardIntercept = False
CfgPlatform = AT386
CfgChip = Hland22
CfgChipData0 = ControlReg0,ControlReg0Default
CfgChipData1 = ControlReg1,ControlReg1Default
CfgChipData2 = ControlReg2,ControlReg2Default
CfgChipData3 = ControlReg3,ControlReg3Default
CfgChipData4 = ControlReg4,ControlReg4Default
CfgChipData5 = ControlReg5,ControlReg5Default
CfgChipData6 = ControlReg6,ControlReg6Default
90
Introduction to AutoBios
4.2.2.6 Dal.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Dal's Bios Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] DAL.JOB
#
# [Description]
#
#
# [//] To create a specific project, use this file as a sample,
# [//] and create a 'myname.job' file for a specific project
# [//] configuration. Run 'NMAKE Job=myname <enter>' to
# [//] create a bios.
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
CfgPromSingle = True
CfgDisk = False
CfgHard = False
CfgBootSysVue = True
CfgCmos = True
CfgCmosInit = True
91
Configuring a Bios
CfgCmosInitAlways = True
CfgVideoType = Mono
CfgBaseMem = 640
CfgExtMem = 0
CfgTypeByte = 0fah
CfgTypeParms = 08h,00h,0fah,00,0b0h,0,0,0,0,0
CfgMaxMem = 640
CfgMemTestGranularity = 64
CfgMemTestPatternBias = 0x0000
CfgKeyboardStyleAT = True
# For MSC 8.0 (Visual C/C++) this is defined as "G3" in the at386.plt
# file to create true 386 code. If using C6 or C7, edit AT386.Plt
# and change G3 to G2.
CfgPlatform = AT386
# [PostMake]
#------ Use the following template for a PostMake Definition ---
# To create a PostMake Sequence, define CfgPostMake.
# If CfgPostMake is not defined, a default sequence will be used.
# To create an active and and alternate PostMake (useful for
# debugging) in this file, define CfgPostMake as True/False.
#CfgPostMake = False
!ifdef CfgPostMake
postmake.bat:
<<postmake.bat
@rem --------------------------------------------------------------
92
Introduction to AutoBios
@rem - You may add a post-make sequence to the end of the Bios
@rem - build process to create the actual prom image files you need.
@rem - This may include concatenating the Bios to other file images
@rem - for larger prom sizes, running the "bin2hex <infile >outfile"
@rem - converter, or for downloading the prom image to a prom
@rem - programmer. You may wish to run an audio "beep" routine to
@rem - alert you to completion of the build.
@rem - The commands may end with the "^" caret to specify a "newline"
@rem - continuation character.
@rem -------- Insert PostMake Command below ------------------------
rem -- Optional -- PostMake file defined ---
pause
@rem -------- Insert PostMake Commands above -----------------------
<<KEEP
!endif
#---- End Of PostMake template -----------------------------------
93
Introduction to AutoBios
4.2.2.7 Ep.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Default Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] EP.JOB
#
# [Functional Description]
#
# If "NMAKE <enter>" is run without a "Project = xxx" argument,
# this file is used for the default configuration.
#
# To create a specific project, use this file as a sample,
# and create a "myname.prj" file for a specific project
# configuration. Run "NMAKE Project=myname <enter>" to
# create a bios.
#
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
CfgProjectVersion = "0.99"
CfgProjectCustomer= "Ep"
CfgProjectPartNr = "930203000000-00001"
CfgProjectOption = "386SX-25 Acer 1217"
CfgPromSingle = True
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
#CfgSysVueConsole = True
95
Configuring a Bios
CfgCodeView = $(True)
#CfgSysObjectPtrPrimary = CfgSysObjectPtrAlternate
CfgDisk1Type = 1440
#CfgDisk2Type = 1200
CfgVideoType = Mono
CfgBaseMem = 640
CfgExtMem = 3456
CfgHard1Type = 47
CfgHard47Cyls = 733
CfgHard47Heads = 4
CfgHard47Sectors=28
CfgBootSysVue = True
CfgBootOrder = 1
CfgKeyboardIntercept = False
CfgPlatform = AT386
CfgChip = ACER1217
96
Introduction to AutoBios
4.2.2.8 Jeff.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Default Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] Jeff.JOB
#
# [Functional Description]
#
# If "NMAKE <enter>" is run without a "Project = xxx" argument,
# this file is used for the default configuration.
#
# To create a specific project, use this file as a sample,
# and create a "myname.prj" file for a specific project
# configuration. Run "NMAKE Project=myname <enter>" to
# create a bios.
#
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
CfgProjectVersion = "0.99"
CfgProjectCustomer= "Jeff"
CfgProjectPartNr = "930203000000-00001"
CfgProjectOption = "386SX Acer 1217"
CfgPromSingle = True
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgDisk1Type = 1440
97
Configuring a Bios
CfgDisk2Type = 1200
CfgVideoType = Mono
CfgBaseMem = 640
CfgExtMem = 384
CfgHard1Type = 47
CfgHard47Cyls = 733
CfgHard47Heads = 4
CfgHard47Sectors=28
CfgBootSysVue = True
CfgBootOrder = 1
CfgKeyboardIntercept = False
CfgPlatform = AT386
CfgChip = ACER1217
98
Introduction to AutoBios
4.2.2.9 Lynn.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Default Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] Lynn.JOB
#
# [Functional Description]
#
# If "NMAKE <enter>" is run without a "Project = xxx" argument,
# this file is used for the default configuration.
#
# To create a specific project, use this file as a sample,
# and create a "myname.prj" file for a specific project
# configuration. Run "NMAKE Project=myname <enter>" to
# create a bios.
#
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
CfgProjectVersion = "0.99"
CfgProjectCustomer= "Ep"
CfgProjectPartNr = "930203000000-00001"
CfgProjectOption = "C&T 4031"
CfgPromSingle = True
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
#CfgSysVueConsole = True
99
Configuring a Bios
CfgCodeView = $(True)
#CfgSysObjectPtrPrimary = CfgSysObjectPtrAlternate
CfgDisk1Type = 1440
#CfgDisk2Type = 1200
CfgVideoType = Mono
CfgBaseMem = 640
CfgExtMem = 3456
CfgHard1Type = 47
CfgHard47Cyls = 733
CfgHard47Heads = 4
CfgHard47Sectors=28
CfgBootSysVue = True
CfgBootOrder = 1
CfgKeyboardIntercept = False
CfgPlatform = AT386
CfgChip = C_T4031
100
Introduction to AutoBios
4.2.2.10 NoChip.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Default Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] nochip.JOB
#
# [Functional Description]
#
# If "NMAKE <enter>" is run without a "Project = xxx" argument,
# this file is used for the default configuration.
#
# To create a specific project, use this file as a sample,
# and create a "myname.prj" file for a specific project
# configuration. Run "NMAKE Project=myname <enter>" to
# create a bios.
#
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
CfgProjectVersion = "0.99"
CfgProjectCustomer= "Nochip"
CfgProjectPartNr = "930203000000-00001"
CfgProjectOption = ""
CfgPromSingle = True
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgDisk1Type = 1440
101
Configuring a Bios
CfgDisk2Type = 360
CfgVideoType = Mono
CfgBaseMem = 640
CfgExtMem = 3200
CfgHard1Type = 47
CfgHard47Cyls = 978
CfgHard47Heads = 14
CfgHard47Sectors= 35
CfgBootSysVue = True
CfgBootOrder = 0
CfgKeyboardIntercept = False
CfgPlatform = AT286
CfgChip = NOCHIP
102
Introduction to AutoBios
4.2.2.11 Pars.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] PARS Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] PARS.JOB
#
# [Functional Description]
#
# If "NMAKE <enter>" is run without a "Project = xxx" argument,
# this file is used for the default configuration.
#
# To create a specific project, use this file as a sample,
# and create a "myname.prj" file for a specific project
# configuration. Run "NMAKE Project=myname <enter>" to
# create a bios.
#
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
CfgPlatform = AT386
CfgChip = UMC481_2
103
Configuring a Bios
# a working board (with the OEM bios) to see how registers are
# originally set up. The register names can be found in the
# "CfgChip".Chp file for your selected chipset.
#CfgChipData0 = ChipEmsControl, 01h, ChipRomEnable, 03h
#CfgChipData1 = ChipMiscStatus, 02h, ChipRomEnable, 03h
#CfgChipData2 = ChipRomEnable, 03h, ChipMiscStatus, 02h
CfgProjectVersion = "0.99"
CfgProjectCustomer= "Pars"
CfgProjectPartNr = "930203000000-00001"
CfgProjectOption = "386DX-40 UMC"
CfgPromSingle = True
CfgDisk = True
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgCmosData = 10h,40h,14h,21h
CfgHard1Type = 47
# [PostMake]
#------ Use the following template for a PostMake Definition ---
# To create a PostMake Sequence, define CfgPostMake.
# If CfgPostMake is not defined, a default sequence will be used.
# To create an active and and alternate PostMake (useful for
# debugging) in this file, define CfgPostMake as True/False.
#CfgPostMake = False
!ifdef CfgPostMake
postmake.bat:
<<postmake.bat
@rem --------------------------------------------------------------
@rem - You may add a post-make sequence to the end of the Bios
@rem - build process to create the actual prom image files you need.
@rem - This may include concatenating the Bios to other file images
@rem - for larger prom sizes, running the "bin2hex <infile >outfile"
@rem - converter, or for downloading the prom image to a prom
@rem - programmer. You may wish to run an audio "beep" routine to
@rem - alert you to completion of the build.
@rem - The commands may end with the "^" caret to specify a "newline"
@rem - continuation character.
@rem -------- Insert PostMake Command below ------------------------
rem -- Optional -- PostMake file defined ---
pause
@rem -------- Insert PostMake Commands above -----------------------
<<KEEP
!endif
#---- End Of PostMake template -----------------------------------
104
Introduction to AutoBios
105
Introduction to AutoBios
4.2.2.12 Paul.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] PAUL.JOB
#
# [Description]
#
# [//] If 'NMAKE <enter>' is run without a 'Job = xxx' argument,
# [//] this file is used for the default configuration.
#
# [//] To create a specific project, use this file as a sample,
# [//] and create a 'myname.job' file for a specific project
# [//] configuration. Run 'NMAKE Job=myname <enter>' to
# [//] create a bios.
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
CfgPromSingle = True
CfgDisk = False
107
Configuring a Bios
CfgCmos = True
#CfgCmosInit = True
#CfgCmosInitAlways = True
#CfgCmosData = 10h,40h,14h,21h
CfgTypeByte = 0fah
CfgTypeParms = 08h,00h,0fah,00,0b0h,0,0,0,0,0
CfgMaxMem = 640
CfgMemTestGranularity = 64
CfgMemTestPatternBias = 0x0000
CfgKeyboardStyleAT = True
# For MSC 8.0 (Visual C/C++) this is defined as "G3" in the at386.plt
# file to create true 386 code. If using C6 or C7, edit AT386.Plt
# and change G3 to G2.
CfgPlatform = AT386
# [PostMake]
#------ Use the following template for a PostMake Definition ---
# To create a PostMake Sequence, define CfgPostMake.
# If CfgPostMake is not defined, a default sequence will be used.
# To create an active and and alternate PostMake (useful for
# debugging) in this file, define CfgPostMake as True/False.
#CfgPostMake = False
!ifdef CfgPostMake
postmake.bat:
<<postmake.bat
@rem --------------------------------------------------------------
@rem - You may add a post-make sequence to the end of the Bios
@rem - build process to create the actual prom image files you need.
@rem - This may include concatenating the Bios to other file images
108
Introduction to AutoBios
@rem - for larger prom sizes, running the "bin2hex <infile >outfile"
@rem - converter, or for downloading the prom image to a prom
@rem - programmer. You may wish to run an audio "beep" routine to
@rem - alert you to completion of the build.
@rem - The commands may end with the "^" caret to specify a "newline"
@rem - continuation character.
@rem -------- Insert PostMake Command below ------------------------
rem -- Optional -- PostMake file defined ---
pause
@rem -------- Insert PostMake Commands above -----------------------
<<KEEP
!endif
#---- End Of PostMake template -----------------------------------
109
Introduction to AutoBios
4.2.2.13 RoyShay.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] RoyShay.JOB
#
# [Description]
#
#
# [//] To create a specific project, use this file as a sample,
# [//] and create a 'myname.job' file for a specific project
# [//] configuration. Run 'NMAKE Job=myname <enter>' to
# [//] create a bios.
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
# This should eliminate conflict with the Future Domain SCSI Board
CfgSysObjectPtrPrimary =CfgSysObjectPtrAlternate
CfgPromSingle = False
CfgDisk = True
111
Configuring a Bios
CfgHard = False
CfgBootSysVue = True
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgVideoType = Mono
CfgBaseMem = 640
CfgExtMem = 3072
CfgTypeByte = 0fah
CfgTypeParms = 08h,00h,0fah,00,0b0h,0,0,0,0,0
CfgDisk1Type = 1200
CfgMaxMem = 640
CfgMemTestGranularity = 64
CfgMemTestPatternBias = 0x0000
CfgKeyboardStyleAT = True
CfgKeyboardIntercept = False
# For MSC 8.0 (Visual C/C++) this is defined as "G3" in the at386.plt
# file to create true 386 code. If using C6 or C7, edit AT386.Plt
# and change G3 to G2.
CfgPlatform = AT386
# [PostMake]
#------ Use the following template for a PostMake Definition ---
# To create a PostMake Sequence, define CfgPostMake.
# If CfgPostMake is not defined, a default sequence will be used.
# To create an active and and alternate PostMake (useful for
# debugging) in this file, define CfgPostMake as True/False.
#CfgPostMake = True
112
Introduction to AutoBios
!ifdef CfgPostMake
postmake.bat:
<<postmake.bat
@rem --------------------------------------------------------------
@rem - You may add a post-make sequence to the end of the Bios
@rem - build process to create the actual prom image files you need.
@rem - This may include concatenating the Bios to other file images
@rem - for larger prom sizes, running the "bin2hex <infile >outfile"
@rem - converter, or for downloading the prom image to a prom
@rem - programmer. You may wish to run an audio "beep" routine to
@rem - alert you to completion of the build.
@rem - The commands may end with the "^" caret to specify a "newline"
@rem - continuation character.
@rem -------- Insert PostMake Command below ------------------------
rem -- Optional -- PostMake file defined ---
@rem -------- Insert PostMake Commands above -----------------------
<<KEEP
!endif
#---- End Of PostMake template -----------------------------------
113
Introduction to AutoBios
4.2.2.14 Sample.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Sample Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] SAMPLE.JOB
#
# [Description]
#
# [//] If 'NMAKE <enter>' is run without a 'Job = xxx' argument,
# [//] this file is used for the default configuration.
#
# [//] To create a specific project, use this file as a sample,
# [//] and create a 'myname.job' file for a specific project
# [//] configuration. Run 'NMAKE Job=myname <enter>' to
# [//] create a bios.
#
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#---------- Primitive Definitions --------------------
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
115
Configuring a Bios
CfgPromSingle = True
CfgDisk1Type = 1440
CfgVideoType = Mono
CfgBaseMem = 640
CfgExtMem = 384
CfgHard1Type = 47
CfgHard47Cyls = 733
CfgHard47Heads = 4
CfgHard47Sectors=28
CfgBootSysVue = True
CfgBootOrder = 1
CfgKeyboardIntercept = False
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgMaxMem = 640
CfgMemTestGranularity = 64
CfgMemTestPatternBias = 0x0000
CfgKeyboardStyleAT = True
CfgPlatform = AT386
# [PostMake]
#------ Use the following template for a PostMake Definition ---
# To create a PostMake Sequence, define CfgPostMake.
# If CfgPostMake is not defined, a default sequence will be used.
# To create an active and and alternate PostMake (useful for
# debugging) in this file, define CfgPostMake as True/False.
#CfgPostMake = False
!ifdef CfgPostMake
postmake.bat:
<<postmake.bat
@rem --------------------------------------------------------------
@rem - You may add a post-make sequence to the end of the Bios
@rem - build process to create the actual prom image files you need.
116
Introduction to AutoBios
@rem - This may include concatenating the Bios to other file images
@rem - for larger prom sizes, running the "bin2hex <infile >outfile"
@rem - converter, or for downloading the prom image to a prom
@rem - programmer. You may wish to run an audio "beep" routine to
@rem - alert you to completion of the build.
@rem - The commands may end with the "^" caret to specify a "newline"
@rem - continuation character.
@rem -------- Insert PostMake Command below ------------------------
rem -- Optional -- PostMake file defined ---
pause
@rem -------- Insert PostMake Commands above -----------------------
<<KEEP
!endif
#---- End Of PostMake template -----------------------------------
117
Introduction to AutoBios
4.2.2.15 Tom.Job
#*************************************************************************
#
# [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
#
# [Product Name] AutoBios
#
# [Module Name] Bios Default Project Configuration FIle
#
# [Version] 2.00
#
# [Author] John O. Foster
#
# [Date] 04/11/94
#
# [File Name] Tom.JOB
#
# [Functional Description]
#
# If "NMAKE <enter>" is run without a "Project = xxx" argument,
# this file is used for the default configuration.
#
# To create a specific project, use this file as a sample,
# and create a "myname.prj" file for a specific project
# configuration. Run "NMAKE Project=myname <enter>" to
# create a bios.
#
#
# [History] 2.00 04/11/94 Original
#
#**************************************************************************
#
#--------------------------------------------------------------------
# These flags may be defined to specify the target project.
# They provide a preset description for popular combinations.
# They are intended to provide the first-highest-level choice.
# They may then set up standard conditions for that target
# Note: These Project Flags should be placed at the beginning
# so that the default expansions come last.
#[Projects]
CfgProjectVersion = "0.99"
CfgProjectCustomer= "Tom"
CfgProjectPartNr = "930203000000-00001"
CfgProjectOption = ""
CfgPromSingle = True
CfgCmos = True
CfgCmosInit = True
CfgCmosInitAlways = True
CfgDisk1Type = 1440
119
Configuring a Bios
CTomfgDisk2Type = 360
CfgVideoType = Mono
CfgBaseMem = 640
CfgExtMem = 1920
CfgHard1Type = 47
CfgHard47Cyls = 733
CfgHard47Heads = 4
CfgHard47Sectors= 28
CfgBootSysVue = True
CfgBootOrder = 0
CfgKeyboardIntercept = False
CfgPlatform = AT386
CfgChip = Eteq390
120
Introduction to AutoBios
---------- CHIP.DIR
02/13/95 08:53a 2,803 SUNTAC.CHP
02/13/95 08:53a 2,951 NOCHIP.CHP
02/13/95 08:53a 5,531 WILDCARD.CHP
02/13/95 08:53a 7,537 VLSI310.CHP
02/13/95 08:53a 8,659 HLAND18.CHP
02/13/95 08:53a 9,019 VLSI486.CHP
02/13/95 08:53a 10,498 HLAND22.CHP
02/13/95 08:53a 10,794 VLSI315.CHP
02/13/95 08:53a 10,845 AMD286LX.CHP
02/13/95 08:53a 11,891 HLAND12.CHP
02/13/95 08:53a 16,303 ACER1217.CHP
02/13/95 08:53a 16,362 C_TNEAT.CHP
02/13/95 08:53a 17,480 C_TF8680.CHP
02/13/95 08:53a 18,022 ETEQ390.CHP
02/13/95 08:53a 18,119 C_TSCAT.CHP
02/13/95 08:53a 18,448 OPTI499.CHP
02/13/95 08:53a 19,890 TI411.CHP
02/13/95 08:53a 20,541 SARC2016.CHP
02/13/95 08:53a 20,838 UMC481_2.CHP
02/13/95 08:53a 21,169 ACER1207.CHP
02/13/95 08:53a 23,816 C_T4031.CHP
02/13/95 08:53a 27,548 SYMPH461.CHP
02/13/95 08:53a 51,912 I386EX.CHP
121
Introduction to AutoBios
[Extract] [HELP]
***********************************************************************
[Version] 2.00
[Date] 04/11/94
**********************************************************************
-------------------------------------------------------------------
[Extract] [H]
[Break]
123
The C Programs
-----------------------------------------------------------
[Break]
-------------------------------------------------------------------
[Extract] [MASM]
[Break]
-------------------------------------------------------------------
[Extract] [C]
124
Introduction to AutoBios
{
unsigned Results = False;
switch(Function)
{
case ChipFastGateA20:
switch (Opcode)
{
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
break;
break;
};
return(Results);
};
[Break]
;--------------------------------------------------------------------
125
Introduction to AutoBios
[Version] 2.00
[Date] 04/11/94
**********************************************************************
[Extract] [H]
127
The C Programs
128
Introduction to AutoBios
// 10 = bank 2
// 11 = bank 3
// Bit 0, ROM BIOS Location (refer to -DACK0)
// 0 = AT memory bus (MD Bus) *
// 1 = AT extended bus (XD Bus)
//
//
#define ChipRomTypeShadowRamEnable 0xfc83
#define ChipRomTypeShadowRamEnableDefault 0x00
// FC83 - ROM Chip type and Shadow RAM enable - Default 00h
// Bit 7-6, ROM Chip type
// 00 = 16K (27128) *
// 01 = 32K (27256)
// 11 = 64K (27512)
// Bit 5, 0F0000-0FFFFF 0 = Disable *, 1 = Enable
// Bit 4, 0E0000-0EFFFF 0 = Disable *, 1 = Enable
// Bit 3, 0D0000-0DFFFF 0 = Disable *, 1 = Enable
// Bit 2, 0C0000-0CFFFF 0 = Disable *, 1 = Enable
// Bit 1, 0B0000-0BFFFF 0 = Disable *, 1 = Enable
// Bit 0, 0A0000-0AFFFF 0 = Disable *, 1 = Enable
//
//DefaultValue 0FC83H,0
//
#define ChipRomAreaEnableShadowRamMode 0xfc84
#define ChipRomAreaEnableShadowRamModeDefault 0x00
// FC84 - ROM area Enable Shadow RAM mode (8-bit R/W)
// Default = 00h
// Follow the steps below to enable the shadow RAM function
// a. Set Shadow RAM to write-only mode.
// b. Read BIOS and Write BIOS data in to the Shadow RAM.
// c. Set Shadow RAM to read-only mode to prevnet memory writes.
//
// Bit 7-6, Video Shadow ROM function (C0000-DFFFF)
// 00 = Disable *
// 01 = Readable
// 10 = Writable
// 11 = Readable/Writable
// Bit 5-4, Video Shadow ROM function (A0000-BFFFF)
// 00 = Disable *
// 01 = Readable
// 10 = Writable
// 11 = Readable/Writable
// Bit 3-2, Shadow ROM function (E0000-FFFFF)
// 00 = Disable *
// 01 = Readable
// 10 = Writable
// 11 = Readable/Writable
// Bit 1, E0000-EFFFF 0 = Enable * / 1 = Disable
// Bit 0, F0000-FFFFF 0 = Enable * / 1 = Disable
//
//DefaultValue 0fc84h,0
//
#define ChipMiscFunctions 0xfc85
#define ChipMiscFunctionsDefault 0x00
// FC85 - Misc. functions - Default 00h
//
129
The C Programs
130
Introduction to AutoBios
[Break]
---------------------------------------------------------------------
//--- This is the code for the standalone ChipDump Utility, and for
//--- the SysVue command to dump the chip registers (if any)
//--- The .EXE for the utility will be the XXXX.Chp filename.
131
The C Programs
inp(0xfc87);
//FlushCpuQueue
//FlushCpuQueue;
return(inp(Reg));
}
[Break]
------------------------------------------------------------------
[Extract] [MASM]
;
; FC80 - Clock and Wait State Register - Default 32h
; Bit 7, Reserved
; Bit 6-5, 8-bit AT cycle wait state generator
; 00 = 5 wait states
; 01 = 4 wait states*
; 10 = 3 wait states
; 11 = 2 wait states
; Bit 4-3, 16-bit AT cylce wait state generator
; 00 = 3 wait states
; 01 = 2 wait states
; 10 = 1 wait state *
; 11 = 0 wait state
;
; Bit 2-0, Processor/System Clock source select
; ProClk SysClk
; 0XX = Note A CLK2IN/4
; 101 = CLK2IN CLK2IN/2
; 110 = CLK2IN CLK2IN/4
; 111 = CLK2IN ATCLK/2
132
Introduction to AutoBios
133
The C Programs
134
Introduction to AutoBios
; 11 = 4 wait states
; Bit 3, Gate A20 Bit
; 0 = Propagate CPU A20 to A20 line *
; 1 = Set A20 to 0
; Bit 2, Reserved
; Bit 1-0, Sleep mode enable/disable. The M1207 will enter sleep mode
; (stop CPU and system clock) when the CPU issues a HLT
; instruction, followed by HLDACK. An INTR or NMI will wake
; up the M1207 from sleep mode.
; 00 = Disable sleep mode *
; 01 = Disable sleep mode
; 10 = Disable sleep mode
; 11 = Enable sleep mode
;
;DefaultValue 0fc85h, 0
;
; FC86 - Planar control register 1 (8-bit R/W)
; Default = 11110000
; Bit 7, RAM B0000-BFFFF 0 = Enable / 1 = Disable *
; Bit 6, RAM A0000-AFFFF 0 = Enable / 1 = Disable *
; Bit 5, RAM 90000-9FFFF 0 = Enable / 1 = Disable *
; Bit 4, RAM 80000-8FFFF 0 = Enable / 1 = Disable *
; Bit 3, RAM 70000-7FFFF 0 = Enable * / 1 = Disable
; Bit 2, RAM 60000-6FFFF 0 = Enable * / 1 = Disable
; Bit 1, RAM 50000-5FFFF 0 = Enable * / 1 = Disable
; Bit 0, RAM 40000-4FFFF 0 = Enable * / 1 = Disable
;
;DefaultValue 0fc86h,0f0h
;
; FC87 - Enable configuration register access
; Read this register immediately before reading or writing other
; registers. Reading this register prepares (opens) the next
; register being accessed for read or write operations.
; The value read from this register is meaningless.
; The read operation itself is significant.
; The register access routine below will perform this operation
; for each initialization write.
;
;
; FC89 - Refresh cycle option select. Default is 0011000
; Bit 7-6, Reserved (low)
; Bit 5, Reserved (high)
; Bit 4, Fast Gate A20 enable/disable
; 0 = Disable (use external GATEA20 from keyboard controller)
; 1 = Enable *
; Bit 3-2, Number of refreshes in one cycle
; 00 = 1 *
; 01 = 2
; 10 = 3
; 11 = 4
; Bit 1-0 Refresh mode cycle select
; 00 = 0 ( 4 ms) *
; 01 = 1 ( 8 ms)
; 10 = 2 (16 ms)
; 11 = 3 (32 ms)
;
135
The C Programs
;DefaultValue 0fc89h,030h
IFDEF CfgChipData
WORD CfgChipData
ENDIF
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
ENDIF
IFDEF CfgChipData3
WORD CfgChipData3
ENDIF
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
PreparePort = 0fc87h
136
Introduction to AutoBios
[Break]
-------------------------------------------------------------------------
[Extract] [C]
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
break;
break;
};
return(results);
};
[Break]
137
Introduction to AutoBios
4.3.3.2 Acer1217
[Extract] [HELP]
***********************************************************************
[Version] 2.00
[Date] 10/12/93
**********************************************************************
[Extract] [H]
139
The C Programs
140
Introduction to AutoBios
141
The C Programs
142
Introduction to AutoBios
// disable/enable (0/1)
// 2 DADS 143 DACK2 Delay ADS disable/enable (0/1)
// 1 reserved 144 DACK1 Tie LOW
// 0 ROMBIOS 145 DACK0 8/16 bit Rom Bios select (0/1)
---------------------------------------------------------------------
//--- This is the code for the standalone ChipDump Utility, and for
//--- the SysVue command to dump the chip registers (if any)
//--- The .EXE for the utility will be the XXXX.Chp filename.
{ "ChipSplitAddress","",ChipSplitAddress,SizeIsByte,ChipSplitAddressDefault, }
,
{ "ChipPageCDShadow","",ChipPageCDShadow,SizeIsByte,ChipPageCDShadowDefault, }
,
{ "ChipPageEFShadow","",ChipPageEFShadow,SizeIsByte,ChipPageEFShadowDefault, }
,
{ "ChipMemRange1A","",ChipMemRange1A,SizeIsByte,ChipMemRange1ADefault, },
{ "ChipMemRange1B","",ChipMemRange1B,SizeIsByte,ChipMemRange1BDefault, },
{ "ChipMemRange1C","",ChipMemRange1C,SizeIsByte,ChipMemRange1CDefault, },
{ "ChipMemRange2A","",ChipMemRange2A,SizeIsByte,ChipMemRange2ADefault,},
143
The C Programs
{ "ChipMemRange2B","",ChipMemRange2B,SizeIsByte,ChipMemRange2BDefault, },
{ "ChipMemRange2C","",ChipMemRange2C,SizeIsByte,ChipMemRange2CDefault, },
{ "ChipIORange1A","",ChipIORange1A,SizeIsByte,ChipIORange1ADefault, },
{ "ChipIORange1B","",ChipIORange1B,SizeIsByte,ChipIORange1BDefault, },
{ "ChipIORange2A","",ChipIORange2A,SizeIsByte,ChipIORange2ADefault, },
{ "ChipIORange2B","",ChipIORange2B,SizeIsByte,ChipIORange2BDefault, },
{ "ChipSpeedPassword","",ChipSpeedPassword,SizeIsByte,ChipSpeedPasswordDefault
, },
{ "ChipCacheControl","",ChipCacheControl,SizeIsByte,ChipCacheControlDefault, }
,
{ "ChipHighSpeedControl","",ChipHighSpeedControl,SizeIsByte,ChipHighSpeedContr
olDefault, },
{ "ChipRecoveryPort","",ChipRecoveryPort,SizeIsByte,ChipRecoveryPortDefault,},
{ "ChipVersion","",ChipVersion,SizeIsByte,ChipVersionDefault, },
{ "","",0,SizeIsByte,0}, /* Nul String or Zero Value is End of Table */
};
[Break]
----------------------------------------------------------------------
[Extract] [MASM]
;--- This macro is used to simplify typing in the desired values ---
144
Introduction to AutoBios
DefaultValue ChipLockRegister,ChipLockRegisterUnlock
DefaultValue ChipRomSizeDefault,ChipRomSizeDefault
DefaultValue ChipDramController,ChipDramControllerDefault
DefaultValue ChipSplitAddress,ChipSplitAddressDefault
DefaultValue ChipPageCDShadow,ChipPageCDShadowDefault
DefaultValue ChipPageEFShadow,ChipPageEFShadowDefault
DefaultValue ChipMemRange1A,ChipMemRange1ADefault
DefaultValue ChipMemRange1B,ChipMemRange1BDefault
DefaultValue ChipMemRange1C,ChipMemRange1CDefault
DefaultValue ChipMemRange2A,ChipMemRange2ADefault
DefaultValue ChipMemRange2B,ChipMemRange2BDefault
DefaultValue ChipMemRange2C,ChipMemRange2CDefault
DefaultValue ChipIORange1A,ChipIORange1ADefault
DefaultValue ChipIORange1B,ChipIORange1BDefault
DefaultValue ChipIORange2A,ChipIORange2ADefault
DefaultValue ChipIORange2B,ChipIORange2BDefault
DefaultValue ChipSpeedPassword,ChipSpeedPasswordDefault
DefaultValue ChipCacheControl,ChipCacheControlDefault
DefaultValue ChipHighSpeedControl,ChipHighSpeedControlDefault
DefaultValue ChipRecoveryPort,ChipRecoveryPortDefault
DefaultValue ChipVersion,ChipVersionDefault
IFDEF CfgChipData
WORD CfgChipData
ENDIF
IFDEF CfgChipData0
WORD CfgChipData0
ENDIF
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
ENDIF
IFDEF CfgChipData3
WORD CfgChipData3
ENDIF
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
IFDEF CfgChipData5
145
The C Programs
WORD CfgChipData5
ENDIF
IFDEF CfgChipData6
WORD CfgChipData6
ENDIF
IFDEF CfgChipData7
WORD CfgChipData7
ENDIF
IFDEF CfgChipData8
WORD CfgChipData8
ENDIF
IFDEF CfgChipData9
WORD CfgChipData9
ENDIF
; End of Table
[Break]
-----------------------------------------------------------------
146
Introduction to AutoBios
[Extract] [C]
case ChipDisable:
outp(ChipRegPort,ChipLockRegister);
outp(ChipDataPort,ChipLockRegisterUnlock);
outp(ChipRegPort,FastGateA20Port);
Temp = inp(ChipDataPort);
outp(ChipRegPort,FastGateA20Port);
outp(ChipDataPort,Temp & ~FastGateA20Bit);
outp(ChipRegPort,ChipLockRegister);
outp(ChipDataPort,ChipLockRegisterLock);
results = True;
break;
};
break;
case ChipFastResetCPU:
switch (Opcode)
{
case ChipEnable:
outp(ChipRegPort,ChipLockRegister);
outp(ChipDataPort,ChipLockRegisterUnlock);
outp(ChipRegPort,FastResetPort);
Temp = inp(ChipDataPort);
outp(ChipRegPort,FastResetPort);
outp(ChipDataPort,Temp | FastResetBit);
outp(ChipRegPort,ChipLockRegister);
outp(ChipDataPort,ChipLockRegisterLock);
results = True;
break;
};
break;
};
*/
147
The C Programs
return(results);
};
[Break]
148
Introduction to AutoBios
4.3.3.3 AMD286LX
[Extract] [HELP]
***********************************************************************
[Version] 2.00
[Date] 04/11/94
**********************************************************************
[Extract] [C]
//--- This is a SysVue command to dump the chip registers (if any) ------
void DumpChip(VueRegSet)
{
printf("\nThis system has no chip registers to dump");
}
[Break]
[Extract] [MASM]
149
The C Programs
RegisterValueTable:
; return all registers to their default values
DB LRR1 ,0aah
DB CCR1 , 00h
DB CCR2 ,0c0h
DB PSR , 00h
DB CDR ,0ffh
DB WSR ,0ffh
DB IPSW1, 44h
DB IPSW2, 44h
DB IPCD , 00h
DB BCR , 00h
DB BMCR , 00h
DB BMPR , 00h
DB SER1 , 00h
DB SER2 , 00h
DB SER3 , 00h
DB SPR1 , 00h
DB SPR2 , 00h
150
Introduction to AutoBios
DB SPR3 , 00h
DB MWS , 01h
DB ROBR1, 00h
DB ROBR2,0c0h
DB RABR , 00h
DB DCR , 00h
DB ARL , 00h
DB XBE1 , 00h
DB XBE2 , 00h
DB XBE3 , 00h
DB XBE4 , 00h
DB XBE5 , 00h
DB XBE6 , 00h
DB XBE7 , 00h
DB XBE8 , 00h
DB XBD , 00h
DB XBSZ , 00h
DB PSFR , 00h
DB MSC , 00h
151
The C Programs
152
Introduction to AutoBios
; End of list
DB 00h,00h ;Indicates end of list
ChipAddressPort = 22h
ChipDataPort = 23h
153
The C Programs
;mov al,00000001b
;out ChipDataPort,al
;jmp ResumeChipHook2
154
Introduction to AutoBios
[Break]
----------------------------------------------------------------------
[Extract] [C]
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
break;
break;
};
return(results);
};
[Break]
155
Introduction to AutoBios
[Version] 2.00
[Date] 04/11/94
**********************************************************************
[Extract] [H]
// 82C836 Registers
157
The C Programs
158
Introduction to AutoBios
159
The C Programs
160
Introduction to AutoBios
161
The C Programs
[Break]
--------------------------------------------------------------------
[Extract] [HELP]
[Break]
--------------------------------------------------------------------
//--- This is the code for the standalone ChipDump Utility, and for
//--- the SysVue command to dump the chip registers (if any)
//--- The .EXE for the utility will be the XXXX.Chp filename.
162
Introduction to AutoBios
unsigned ReadChipRegister(unsigned i)
{
outp(ChipRegPort,i);
return(inp(ChipDataPort));
};
[Break]
--------------------------------------------------------------------
[Extract] [MASM]
ResetHook:
mov ax,0f000h
mov ds,ax
mov es,ax
xor si,si
mov ax,si
SearchSuperCode:
add ax,10h
mov di,OFFSET SuperSign
mov cx,LenSuperSign
repz cmpsb
mov si,ax
jz FoundSuperCode
cmp si,(OFFSET SuperSign)-10h
jae DoneSuperInit
jmp SHORT SearchSuperCode
FoundSuperCode:
mov si,ax
CheckPoint(0aah) ; got to f8680 superstate code
163
The C Programs
mov ax,si
sub ax,10h
add ax,LenSuperSign
mov si,OFFSET DoneSuperInit
jmp ax
jmp ResumeResetHook
;--- This macro is used to simplify typing in the desired values ---
IFDEF CfgChipData
WORD CfgChipData
ENDIF
IFDEF CfgChipData0
WORD CfgChipData0
ENDIF
164
Introduction to AutoBios
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
ENDIF
IFDEF CfgChipData3
WORD CfgChipData3
ENDIF
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
IFDEF CfgChipData5
WORD CfgChipData5
ENDIF
IFDEF CfgChipData6
WORD CfgChipData6
ENDIF
IFDEF CfgChipData7
WORD CfgChipData7
ENDIF
IFDEF CfgChipData8
WORD CfgChipData8
ENDIF
IFDEF CfgChipData9
WORD CfgChipData9
ENDIF
165
The C Programs
[Break]
----------------------------------------------------------------------
[Extract] [C]
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
break;
break;
};
return(results);
};
[Break]
166
Introduction to AutoBios
[Version] 2.00
[Date] 04/11/94
**********************************************************************
[Extract] [H]
// 82C211 Registers
// 82C212 Registers
167
The C Programs
168
Introduction to AutoBios
// Bit Description
// 7 Reserved
// 6 Early READY Enable
// x1xxxxxx = enable
// x0xxxxxx = disable (default)
// 5 LBA Enable
// xx1xxxxx = enable
// xx0xxxxx = disable (default)
// 4 Bus Convert Enable
// xxx1xxxx = enable
// xxx0xxxx = disable (default)
// 3-2 BUSCLK Select
// xxxx00xx = selects BUSCLK as CXIN/4
// xxxx01xx = selects BUSCLK as CXIN/5 (default)
// xxxx10xx = selects BUSCLK as CXIN/6
// xxxx11xx = reserved
// 1-0 Refresh Width
// xxxxxx00 = 140 ns
// xxxxxx01 = 210 ns
// xxxxxx10 = 280 ns (default)
// xxxxxx11 = 350 ns
169
The C Programs
170
Introduction to AutoBios
171
The C Programs
// Bit Description
// 7 RAS encode enable
// 0xxxxxxx = RAS encode disabled (default)
// 1xxxxxxx = RAS encode enabled
// 6 reserved
// 5 RAM disable 040000h-09FFFFh
// xx0xxxxx = enables DRAM on system board (default)
// xx1xxxxx = enables DRAM on I/O channel
// 4 reserved
// 3-0 Extended boundary
// xxxx0000 No Limit (default)
// xxxx0001 1 MB (no extended memory)
// xxxx0010 1.25 MB
// xxxx0011 1.5 MB
// xxxx0100 2 MB
// xxxx0101 3 MB
// xxxx0110 4 MB
// xxxx0111 5 MB
// xxxx1000 7 MB
// xxxx1001 8 MB
// xxxx1010 9 MB
// xxxx1011 10 MB
// xxxx1100 11 MB
// xxxx1101 12 MB
// xxxx1110 13 MB
// xxxx1111 15 MB
[Break]
--------------------------------------------------------------------
[Extract] [HELP]
[Break]
172
Introduction to AutoBios
--------------------------------------------------------------------
//--- This is the code for the standalone ChipDump Utility, and for
//--- the SysVue command to dump the chip registers (if any)
//--- The .EXE for the utility will be the XXXX.Chp filename.
[Break]
--------------------------------------------------------------------
[Extract] [MASM]
;--- This macro is used to simplify typing in the desired values ---
173
The C Programs
;DefaultValue RB0,RB0Default
;DefaultValue RB1,RB1Default
IFDEF CfgChipData
WORD CfgChipData
ENDIF
IFDEF CfgChipData0
WORD CfgChipData0
ENDIF
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
ENDIF
IFDEF CfgChipData3
WORD CfgChipData3
ENDIF
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
IFDEF CfgChipData5
WORD CfgChipData5
ENDIF
IFDEF CfgChipData6
WORD CfgChipData6
ENDIF
IFDEF CfgChipData7
WORD CfgChipData7
ENDIF
IFDEF CfgChipData8
WORD CfgChipData8
ENDIF
IFDEF CfgChipData9
WORD CfgChipData9
ENDIF
174
Introduction to AutoBios
[Break]
----------------------------------------------------------------------
[Extract] [C]
case ChipDisable:
break;
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
case ChipEnable:
175
The C Programs
break;
};
break;
break;
};
return(Results);
};
[Break]
176
Introduction to AutoBios
[Version] 2.00
[Date] 07/22/93
**********************************************************************
[Extract] [H]
// 82C836 Registers
177
The C Programs
178
Introduction to AutoBios
179
The C Programs
180
Introduction to AutoBios
// 5 reserved
// 4-0 CFG 4-0 These bits describe the DRAM configuration
// Default value is xxx00001 (512K total DRAM)
// Bank 0 1 2 3
Total
// (Valid for Non-encoded or Encoded RAS)
// xxx00000 = - - - - 0
// xxx00001 = 256K - - -
512K
// xxx00010 = 256K 256K - - 1 MB
// xxx00011 = 256K 256K - -
640K+384K
// xxx00100 = 256K 256K 256K - 1.5 MB
// xxx00101 = 256K 256K 256K 256K 2 MB
// xxx00110 = 256K 256K 1M - 3 MB
// xxx00111 = 256K 256K 1M 1M 5 MB
// xxx01000 = 256K 1M - - 2.5 MB
// xxx01001 = 256K 1M 1M -
4.5 MB
// xxx01010 = 256K 1M 1M 1M 6.5 MB
// xxx01011 = 1M - - -
2 MB
// xxx01100 = 1M 1M - -
4 MB
// xxx01101 = 1M 1M 1M -
6 MB
// xxx01110 = 1M 1M 1M 1M
8 MB
// (Valid for Encoded RAS only)
// Banks 0-1 2-3 4 5 6 7
Total
// xxx01111 = 256K 1M 1M - - -
7 MB
// xxx10000 = 256K 1M 1M 1M - - 9 MB
// xxx10001 = 256K 1M 1M 1M 1M - 11 MB
// xxx10010 = 256K 1M 1M 1M 1M 1M 13 MB
// xxx10011 = 1M 1M 1M - - - 10 MB
// xxx10100 = 1M 1M 1M 1M - - 12 MB
// xxx10101 = 1M 1M 1M 1M 1M - 14 MB
// xxx10110 = 1M 1M 1M 1M 1M 1M 16 MB
181
The C Programs
// xxxx0100 2 MB
// xxxx0101 3 MB
// xxxx0110 4 MB
// xxxx0111 5 MB
// xxxx1000 7 MB
// xxxx1001 8 MB
// xxxx1010 9 MB
// xxxx1011 10 MB
// xxxx1100 11 MB
// xxxx1101 12 MB
// xxxx1110 13 MB
// xxxx1111 15 MB
[Break]
--------------------------------------------------------------------
[Extract] [HELP]
[Break]
--------------------------------------------------------------------
//--- This is the code for the standalone ChipDump Utility, and for
//--- the SysVue command to dump the chip registers (if any)
//--- The .EXE for the utility will be the XXXX.Chp filename.
182
Introduction to AutoBios
{ "ChipPowerManagement", ChipPowerManagement, },
{ "ChipRomEnable", ChipRomEnable, },
{ "ChipRamWriteProtect", ChipRamWriteProtect, },
{ "ChipShadowRamEnable1", ChipShadowRamEnable1, },
{ "ChipShadowRamEnable2", ChipShadowRamEnable2, },
{ "ChipShadowRamEnable3", ChipShadowRamEnable3, },
{ "ChipDramConfiguration", ChipDramConfiguration, },
{ "ChipExtendedBoundary", ChipExtendedBoundary, },
{ "ChipEmsControl", ChipEmsControl, },
{ "",0,}, /* Nul String is End of Table */
};
unsigned ReadChipRegister(unsigned i)
{
outp(ChipRegPort,i);
_asm jmp $ + 2 ;
return(inp(ChipDataPort));
};
[Break]
--------------------------------------------------------------------
[Extract] [MASM]
;--- This macro is used to simplify typing in the desired values ---
183
The C Programs
IFDEF CfgChipData
WORD CfgChipData
ENDIF
IFDEF CfgChipData0
WORD CfgChipData0
ENDIF
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
ENDIF
IFDEF CfgChipData3
WORD CfgChipData3
ENDIF
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
IFDEF CfgChipData5
WORD CfgChipData5
ENDIF
IFDEF CfgChipData6
WORD CfgChipData6
ENDIF
IFDEF CfgChipData7
WORD CfgChipData7
ENDIF
IFDEF CfgChipData8
WORD CfgChipData8
ENDIF
IFDEF CfgChipData9
WORD CfgChipData9
ENDIF
184
Introduction to AutoBios
.WHILE 1
lods WORD PTR cs:[si]
.BREAK .IF (ax == WORD PTR -1) ; Check for teminating code
mov dx,ChipRegPort
jmp $+2 ; added delay
out dx,al ; set register address
lods WORD PTR cs:[si]
mov dx,ChipDataPort
jmp $+2 ; added delay
out dx,al
.ENDW
jmp NEAR PTR ResumeChipHook1
mov ax,2000h
mov es,ax ; set es = 2000h
mov ax,6000h
mov ds,ax ; set ds = 6000h
mov al,0aah
mov ds:[0],al ; set AA into 6000:0000
mov al,055h
mov es:[0],al ; now set 55 pattern in 2000:0000
cmp ds:[0],al ; see if 55 appears at 6000:0000
jnz NoMirror ; jump done if 1M part
mov dx,ChipRegPort
jmp $+2 ; added delay
out dx,al ; set register address
mov al,0c2h ; init the 256K part setup
mov dx,ChipDataPort
jmp $+2 ; added delay
out dx,al
NoMirror:
jmp NEAR PTR ResumeChipHook2
[Break]
----------------------------------------------------------------------
[Extract] [C]
185
The C Programs
case ChipDisable:
outp(0x92,inp(0x92) & ~2);
Results = True;
break;
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
case ChipEnable:
// needs a 0-1 transition
outp(0x92,inp(0x92) & ~1); outp(0x92,inp(0x92) | 1);
Results = True;
break;
};
break;
break;
};
return(Results);
};
[Break]
186
Introduction to AutoBios
[Version] 2.00
[Date] 04/11/94
**********************************************************************
[Extract] [H]
187
The C Programs
// 1xxxx110 = 1M 1M 1M 1M 8M
// 1xxxx111 = - - - - Reserved
// 6,5 Wait State Control
// x00xxxxx = 1 extra wait for EMS + relocation cycles
// x01xxxxx = 1 extra wait for EMS cycles only
// x10xxxxx = 1 extra wait for relocation cycles only
// x11xxxxx = No extra wait states
// 4 Memory Wait States
// xxx0xxxx = 1 wait state
// xxx1xxxx = 0 wait states
// 3 AT Bus Speed
// xxxx0xxx = 0 Full Speed
// xxxx1xxx = Low speed on I/O
188
Introduction to AutoBios
// xxxxxxx0 = Disable
// xxxxxxx1 = Enable (default)
189
The C Programs
[Break]
[Extract] [HELP]
These definitions are from the Headland spec sheet. We havn't installed
on a Headland board yet, so will appreciate feedback. Thanks...
[Break]
-----------------------------------------------------------------
// Danny:
// This list consists of a name, then the vale defined for that name:
190
Introduction to AutoBios
[Break]
-----------------------------------------------------------------
[Extract] [MASM]
;--- This macro is used to simplify typing in the desired values ---
IFDEF CfgChipData
WORD CfgChipData
ENDIF
IFDEF CfgChipData0
WORD CfgChipData0
ENDIF
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
ENDIF
IFDEF CfgChipData3
WORD CfgChipData3
ENDIF
191
The C Programs
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
IFDEF CfgChipData5
WORD CfgChipData5
ENDIF
IFDEF CfgChipData6
WORD CfgChipData6
ENDIF
IFDEF CfgChipData7
WORD CfgChipData7
ENDIF
IFDEF CfgChipData8
WORD CfgChipData8
ENDIF
IFDEF CfgChipData9
WORD CfgChipData9
ENDIF
192
Introduction to AutoBios
[Break]
---------------------------------------------------------------------
[Extract] [C]
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
break;
break;
};
return(results);
};
[Break]
193
Introduction to AutoBios
[Version] 2.00
[Date] 04/11/94
**********************************************************************
[Extract] [H]
195
The C Programs
// xxx1xxxx = Disable
// 3 Shadow Ram Enable E0000
// xxxx0xxx = Enable
// xxxx1xxx = Disable
// 2 384K Disable
// xxxxx0xx = Enable
// xxxxx1xx = Disable
// 1 Global EMS
// xxxxxx0x = EMS Disabled
// xxxxxx1x = EMS Enabled
// 0 Context Selection Enable
// xxxxxxx0 = Standard Context
// xxxxxxx1 = Alternate Context
196
Introduction to AutoBios
197
The C Programs
[Break]
------------------------------------------------------------------
[Break]
------------------------------------------------------------------
[Extract] [MASM]
; DefaultValue RegisterName,RegisterDefaultValue
DefaultValue ControlReg0,ControlReg0Default
DefaultValue ControlReg1,ControlReg1Default
DefaultValue ControlReg2,ControlReg2Default
DefaultValue ControlReg3,ControlReg3Default
DefaultValue ControlReg4,ControlReg4Default
198
Introduction to AutoBios
DefaultValue ControlReg5,ControlReg5Default
DefaultValue ControlReg6,ControlReg6Default
IFDEF CfgChipData
WORD CfgChipData
ENDIF
IFDEF CfgChipData0
WORD CfgChipData0
ENDIF
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
ENDIF
IFDEF CfgChipData3
WORD CfgChipData3
ENDIF
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
IFDEF CfgChipData5
WORD CfgChipData5
ENDIF
IFDEF CfgChipData6
WORD CfgChipData6
ENDIF
IFDEF CfgChipData7
WORD CfgChipData7
ENDIF
IFDEF CfgChipData8
WORD CfgChipData8
ENDIF
IFDEF CfgChipData9
WORD CfgChipData9
ENDIF
; End of Table
DefaultValue -1,-1 ; -1 Arguments indicate End of Table
199
The C Programs
.BREAK .IF (ax == WORD PTR -1) ; Check for teminating code
mov dx,ChipRegPort
jmp $+2 ; added delay
out dx,al ; set register address
lods WORD PTR cs:[si]
mov dx,ChipDataPort
jmp $+2 ; added delay
out dx,al
.ENDW
jmp NEAR PTR ResumeChipHook1
[Break]
---------------------------------------------------------------
[Extract] [C]
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
break;
break;
};
return(results);
};
[Break]
200
Introduction to AutoBios
201
Introduction to AutoBios
[Version] 2.00
[Date] 08/01/94
**********************************************************************
[Extract] [H]
203
The C Programs
204
Introduction to AutoBios
205
The C Programs
206
Introduction to AutoBios
207
The C Programs
208
Introduction to AutoBios
209
The C Programs
210
Introduction to AutoBios
211
The C Programs
212
Introduction to AutoBios
213
The C Programs
214
Introduction to AutoBios
215
The C Programs
216
Introduction to AutoBios
[Break]
---------------------------------------------------------------------
//--- This is the code for the standalone ChipDump Utility, and for
//--- the SysVue command to dump the chip registers (if any)
//--- The .EXE for the utility will be the XXXX.Chp filename.
217
The C Programs
218
Introduction to AutoBios
219
The C Programs
[Break]
----------------------------------------------------------------------
[Extract] [MASM]
CfgDefaultValue Dma0Tar,Dma0TarSize,Dma0TarDefault
CfgDefaultValue RemapCfg,RemapCfgSize,RemapCfgDefault
IFDEF CfgChipData
WORD CfgChipData
ENDIF
IFDEF CfgChipData0
WORD CfgChipData0
ENDIF
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
220
Introduction to AutoBios
ENDIF
IFDEF CfgChipData3
WORD CfgChipData3
ENDIF
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
IFDEF CfgChipData5
WORD CfgChipData5
ENDIF
IFDEF CfgChipData6
WORD CfgChipData6
ENDIF
IFDEF CfgChipData7
WORD CfgChipData7
ENDIF
IFDEF CfgChipData8
WORD CfgChipData8
ENDIF
IFDEF CfgChipData9
WORD CfgChipData9
ENDIF
; End of Table
include e3d.inc
;---- from intel -------
in al,92h ;Clear Port 92 Reset
and al,0feh
or al,02h
out 92H,al
221
The C Programs
222
Introduction to AutoBios
; PIN 0 = 0, SSIOTX
; PIN 1 = 0, SRXCLK
; PIN 2 = 1, TXD1
; PIN 3 = 0, EOP#/TC
; PIN 4 = 0, DACK0#
; PIN 5 = 1, Timer2
; PIN 6 = 0, GCS6#
; PIN 7 = 0, Don't Care
223
The C Programs
224
Introduction to AutoBios
; to be enabled when reg names are reconciled and init values are
; loaded into the default table section.
; this will replace the linear section above taken from the Intel
; tech notes
; mov si,offset ChipTable
; .WHILE 1
; lods WORD PTR cs:[si]
; .BREAK .IF (ax == WORD PTR -1) ; Check for teminating code
; mov dx,ax ; move port address to DX
; jmp $+2 ; added delay
; lods WORD PTR cs:[si] ; get size for port
; mov bx,ax
; jmp $+2 ; added delay
; lods WORD PTR cs:[si] ; get value for port
; jmp $+2 ; added delay
; .IF (bx == SizeIsByte)
; out dx,al
; .ELSE
; out dx,ax
; .ENDIF
225
The C Programs
; .ENDW
[Break]
-----------------------------------------------------------------
[Extract] [C]
case ChipDisable:
// results = True;
break;
};
break;
case ChipFastResetCPU:
switch (Opcode)
{
case ChipEnable:
// results = True;
226
Introduction to AutoBios
break;
};
break;
};
*/
return(results);
};
[Break]
//---------------------------------------------
227
The C Programs
228
Introduction to AutoBios
229
The C Programs
230
Introduction to AutoBios
231
Introduction to AutoBios
[Version] 2.00
[Date] 04/11/94
**********************************************************************
[Extract] [H]
// 82C836 Registers
233
The C Programs
234
Introduction to AutoBios
// xxxxx0xx = enable
// xxxxx1xx = disable (default)
// 1 Fast Gate A20
// 386 Mode
// xxxxxx0x = GA20 always zero (default)
// xxxxxx1x = GA20 generated
// 486 Mode
// xxxxxx0x = A20M# always active (default)
// xxxxxx1x = Enable A20
// 0 Slow Refresh
// xxxxxxx0 = disable (default)
// xxxxxxx1 = enable
235
The C Programs
// 111Xxxxx = X X
// 3 UNUSED (default = 0)
// 2-0 DRAM types for Bank2 Bank3
// xxxxx000 = 1M X
// xxxxx001 = 1M 1M
// xxxxx010 = X X
// xxxxx011 = 4M 1M
// xxxxx100 = 4M X
// xxxxx101 = 4M 4M
// xxxxx11X = X X (default)
236
Introduction to AutoBios
// xxxxx1xx = enabled
// 1 Enable shadow ram at C4000-C7FFF
// xxxxxx0x = disabled (default)
// xxxxxx1x = enabled
// 0 Enable shadow ram at C0000-C3FFF
// xxxxxxx0 = disabled (default)
// xxxxxxx1 = enabled
237
The C Programs
[Break]
--------------------------------------------------------------------
[Extract] [HELP]
[Break]
238
Introduction to AutoBios
--------------------------------------------------------------------
//--- This is the code for the standalone ChipDump Utility, and for
//--- the SysVue command to dump the chip registers (if any)
//--- The .EXE for the utility will be the XXXX.Chp filename.
[Break]
--------------------------------------------------------------------
[Extract] [MASM]
239
The C Programs
DefaultValue ChipControlRegister1,00
DefaultValue ChipControlRegister2,00
DefaultValue ChipShadowRamControlRegister1,84h
DefaultValue ChipShadowRamControlRegister2,00
DefaultValue ChipDramControlRegister1,87h
DefaultValue ChipDramControlRegister2,0f0h
DefaultValue ChipShadowRamControlRegister3,00
DefaultValue ChipControlRegister3,0d1h
DefaultValue ChipNonCacheBlock1Register1,80h
DefaultValue ChipNonCacheBlock1Register2,10h
DefaultValue ChipNonCacheBlock2Register1,80h
DefaultValue ChipNonCacheBlock2Register2,10h
DefaultValue ChipRomChipSelectRegister3,00
IFDEF CfgChipData
WORD CfgChipData
ENDIF
IFDEF CfgChipData0
WORD CfgChipData0
ENDIF
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
ENDIF
IFDEF CfgChipData3
WORD CfgChipData3
ENDIF
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
IFDEF CfgChipData5
WORD CfgChipData5
ENDIF
240
Introduction to AutoBios
IFDEF CfgChipData6
WORD CfgChipData6
ENDIF
IFDEF CfgChipData7
WORD CfgChipData7
ENDIF
IFDEF CfgChipData8
WORD CfgChipData8
ENDIF
IFDEF CfgChipData9
WORD CfgChipData9
ENDIF
[Break]
----------------------------------------------------------------------
[Extract] [C]
241
The C Programs
[Break]
242
Introduction to AutoBios
4.3.3.11 SunTac
[Extract] [HELP]
***********************************************************************
[Version] 2.00
[Date] 04/11/94
**********************************************************************
[Extract] [H]
[Break]
--------------------------------------------------------------------
[Extract] [C]
unsigned ReadChipRegister(unsigned q)
{
return(q);
};
[Break]
------------------------------------------------------------------
[Extract] [MASM]
243
The C Programs
;--- This macro is used to simplify typing in the desired values ---
[Break]
-------------------------------------------------------------------
[Extract] [C]
244
Introduction to AutoBios
case ChipFastGateA20:
switch (Opcode)
{
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
break;
break;
};
return(results);
};
[Break]
245
Introduction to AutoBios
[Version] 2.00
[Date] 04/11/94
[File Status]
**********************************************************************
[Extract] [H]
// 82C482A Registers
#define RevisionReg 0x80
#define RevisionRegDefault 0x80
// Read Only
247
The C Programs
// ; 0 = KBCLK = OSC14/2
// ; 1 = KBCLK is defined by Bits 7-6 of ControlRegB
// ; 4 = DMA address/data hold time
// ; 0 1-2 T-state
// ; 1 2-3 T-state
// ; 3 = Turbo Pin - Read Only
// ; 1 = high speed
// ; 0 = low speed
// ; 2-0 = AT bus clock selection
// ; For 386 mode
// ; 0 0 0 ATCLK = CLK2/12
// ; 0 0 1 ATCLK = CLK2/10
// ; 0 1 0 ATCLK = CLK2/8
// ; 0 1 1 ATCLK = CLK2/6
// ; 1 X 0 ATCLK = CLK2/4
// ; 1 0 X ATCLK = CLK2/4
// ; 1 1 1 ATCLK = CLK2/16
// ;
// ; For 486 mode
// ; 0 0 0 ATCLK = CLK2/6
// ; 0 0 1 ATCLK = CLK2/5
// ; 0 1 0 ATCLK = CLK2/4
// ; 0 1 1 ATCLK = CLK2/3
// ; 1 X 0 ATCLK = CLK2/2
// ; 1 0 X ATCLK = CLK2/2
// ; 1 1 1 ATCLK = CLK2/8
//
#define ControlRegB 0x82
#define ControlRegBDefault 0x00
// ; Default = 00h
// ; 7-6 = Keyboard Clock Selection
// ; For 386 mode
// ; 0 0 KBCLK = CLK2/12
// ; 0 1 KBCLK = CLK2/8
// ; 1 0 KBCLK = CLK2/6
// ; 1 1 KBCLK = CLK2/4
// ; For 486 mode
// ; 0 0 KBCLK = CLK2/6
// ; 0 1 KBCLK = CLK2/4
// ; 1 0 KBCLK = CLK2/3
// ; 1 1 KBCLK = CLK2/2
// ; 5 = Flush 486 internal cache
// ; 1 = PFLUSH# is active to flush 486 internal cache
// ; 4-3 = Turbo function slection
// ; 0 0 Same as 82C482 (CLKOUT = CKIN)
// ; 0 1 CKOUT = CKIN/2
// ; 1 X controlled by 8742
// ; 2 = LOWA20# selection
// ; 0 LOWA20# control from 8742
// ; 1 LOWA20# from chipset
// ; 1-0 = I/O Command recovery time
// ; 0 0 - 2 BCLK
// ; 0 1 - 4 BCLK
// ; 1 0 - 8 BCLK
// ; 1 1 - 12 BCLK
//
248
Introduction to AutoBios
//
// ; 82C481A Registers
#define IdReg 0x90
#define IdRegDefault 0x00
// ; Read Only
249
The C Programs
// ; 0 - non-cacheable
// ; 1 - cacheable
// ; 6 = math coprocessor ready delayed by 1 T-state
// ; 0 - delay by 1 T-state
// ; 1 - no delay
// ; 5 = Check ELBA# pin in T1 or T2 state (only for 486)
// ; 0 - check ELBA# signal in T1
// ; 1 - check ELBA# signal in T2
// ; 4-0 = Cache RAM size
// ; 00000 - 1MB
// ; 10000 - 512KB
// ; 11000 - 256KB
// ; 11100 - 128KB
// ; 11110 - 64KB
// ; 11111 - 32KB
250
Introduction to AutoBios
251
The C Programs
// ; 5 = E segment cacheability
// ; 0 - non-cacheable
// ; 1 - cacheable
// ; 4 = Shadow ram for E segment
// ; 0 - ROM
// ; 1 - shadow RAM
// ; 3 = write protect E segment
// ; 0 - not write protected
// ; 1 - write protected
// ; 2 = F segment cacheability
// ; 0 - non-cacheable
// ; 1 - cacheable
// ; 1 = Shadow ram for F segment
// ; 0 - ROM
// ; 1 - shadow RAM
// ; 0 = write protect F segment
// ; 0 - not write protected
// ; 1 - write protected
252
Introduction to AutoBios
// ; Default = 00h
// ; 7 = Write Protect for 000DC000-000DFFFF region
// ; 0 - not write protected
// ; 1 - write protected
// ; 6 = Write Protect for 000D8000-000DBFFF region
// ; 0 - not write protected
// ; 1 - write protected
// ; 5 = Write Protect for 000D4000-000D7FFF region
// ; 0 - not write protected
// ; 1 - write protected
// ; 4 = Write Protect for 000D0000-000D3FFF region
// ; 0 - not write protected
// ; 1 - write protected
// ; 3 = Write Protect for 000CC000-000CFFFF region
// ; 0 - not write protected
// ; 1 - write protected
// ; 2 = Write Protect for 000C8000-000CBFFF region
// ; 0 - not write protected
// ; 1 - write protected
// ; 1 = Write Protect for 000C4000-000C7FFF region
// ; 0 - not write protected
// ; 1 - write protected
// ; 0 = Write Protect for 000C0000-000C3FFF region
// ; 0 - not write protected
// ; 1 - write protected
253
The C Programs
[Break]
------------------------------------------------------------------
//--- This is the code for the standalone ChipDump Utility, and for
//--- the SysVue command to dump the chip registers (if any)
//--- The .EXE for the utility will be the XXXX.Chp filename.
254
Introduction to AutoBios
[Break]
--------------------------------------------------------------------
[Extract] [MASM]
RegisterValueTable:
; Return all registers to their default values
; This insures a warm boot sees a known state.
DefaultValue ControlRegA,ControlRegADefault
DefaultValue ControlRegB,ControlRegBDefault
IFDEF CfgChipData
WORD CfgChipData
ENDIF
IFDEF CfgChipData0
WORD CfgChipData0
ENDIF
255
The C Programs
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
ENDIF
IFDEF CfgChipData3
WORD CfgChipData3
ENDIF
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
IFDEF CfgChipData5
WORD CfgChipData5
ENDIF
IFDEF CfgChipData6
WORD CfgChipData6
ENDIF
IFDEF CfgChipData7
WORD CfgChipData7
ENDIF
IFDEF CfgChipData8
WORD CfgChipData8
ENDIF
IFDEF CfgChipData9
WORD CfgChipData9
ENDIF
; End of list
DW -1,-1 ;Indicates end of list
256
Introduction to AutoBios
257
The C Programs
.ELSE
.IF (WORD PTR ds:[00c00h] == 0AA55h) ; Does the bank have 1Mb DRAMs
mov ax,cs:RamPattern[bx+2] ; 1Mb pattern
.ELSE
.IF (WORD PTR ds:[01c00h] == 0AA55h) ; Does the bank have 1Mb DRAMs
mov ax,cs:RamPattern[bx] ; 4 Mb pattern
.ENDIF
.ENDIF
.ENDIF
shr bx,2 ; rebase Index bx
or dx,ax ; update current bank
.ENDW ; loop for four banks
mov al,RAMCFG1 ; load ram cfg registers
out ChipRegPort,al
mov al,dh
out ChipDataPort,al
mov al,RAMCFG0
out ChipRegPort,al
mov al,dl
out ChipDataPort,al
~
jmp NEAR PTR ResumeChipHook2
[Break]
-----------------------------------------------------------------
[Extract] [C]
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
258
Introduction to AutoBios
break;
break;
};
return(results);
};
[Break]
259
Introduction to AutoBios
[Version] 2.00
[Date] 04/11/94
**********************************************************************
[Extract] [H]
--------------------------------------------------------------------
[Extract] [C]
unsigned ReadChipRegister(unsigned q)
{
return(q);
};
[Break]
--------------------------------------------------------------------
[Extract] [MASM]
261
The C Programs
262
Introduction to AutoBios
RegisterValueTable:
; Return all registers to their default values
; This insures a warm boot sees a known state.
263
The C Programs
DB FAXS, 000h
DB ACBL, 055h
DB BCBL, 055h
DB CCBL, 055h
DB DCBL, 055h
DB ECBL, 055h
DB FCBL, 055h
DB PMRA1, 000h
DB PMRE1, 000h
DB PMRA2, 000h
DB PMRE2, 000h
; End of list
DB 00h,00h ;Indicates end of list
264
Introduction to AutoBios
.IF (WORD PTR ds:[00200h] == 0AA55h) ; Does the bank have 256kb DRAMs
mov ah,Simm256 ; 256kb pattern
.ELSE
.IF (WORD PTR ds:[00600h] == 0AA55h) ; Does the bank have 1Mb DRAMs
mov ah,Simm1024 ; 1Mb pattern
.ELSE
.IF (WORD PTR ds:[00e00h] == 0AA55h) ; Does the bank have 4Mb DRAMs
mov ah,Simm4096 ; 4 Mb pattern
.ENDIF
.ENDIF
.ENDIF
[Break]
---------------------------------------------------------------
[Extract] [C]
};
265
The C Programs
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
break;
break;
};
return(results);
};
[Break]
266
Introduction to AutoBios
[Version] 2.00
[Date] 10/05/93
**********************************************************************
[Extract] [H]
267
The C Programs
268
Introduction to AutoBios
[Break]
--------------------------------------------------------------------
269
The C Programs
[Break]
-------------------------------------------------------------------
[Extract] [MASM]
270
Introduction to AutoBios
IFDEF CfgChipData0
WORD CfgChipData0
ENDIF
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
ENDIF
IFDEF CfgChipData3
271
The C Programs
WORD CfgChipData3
ENDIF
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
IFDEF CfgChipData5
WORD CfgChipData5
ENDIF
IFDEF CfgChipData6
WORD CfgChipData6
ENDIF
IFDEF CfgChipData7
WORD CfgChipData7
ENDIF
IFDEF CfgChipData8
WORD CfgChipData8
ENDIF
IFDEF CfgChipData9
WORD CfgChipData9
ENDIF
; End of list
DefaultValue -1,-1 ;Indicates end of list
272
Introduction to AutoBios
[Break]
--------------------------------------------------------------------
[Extract] [C]
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
break;
break;
};
return(results);
};
[Break]
273
Introduction to AutoBios
[Version] 2.00
[Date] 04/11/94
**********************************************************************
[Extract] [H]
[Break]
-------------------------------------------------------------------
[Extract] [C]
[Break]
-------------------------------------------------------------------
[Extract] [MASM]
275
The C Programs
276
Introduction to AutoBios
RegisterValueTable:
; Return all registers to their default values
; This insures a warm boot sees a known state.
277
The C Programs
DB CAXS, 000h
DB DAXS, 000h
DB EAXS, 000h
DB FAXS, 000h
DB ACBL, 055h
DB BCBL, 055h
DB CCBL, 055h
DB DCBL, 055h
DB ECBL, 055h
DB FCBL, 055h
DB PMRA1, 000h
DB PMRE1, 000h
DB PMRA2, 000h
DB PMRE2, 000h
; End of list
DB 00h,00h ;Indicates end of list
278
Introduction to AutoBios
279
The C Programs
[Break]
--------------------------------------------------------------
[Extract] [C]
};
break;
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
break;
break;
};
return(results);
};
[Break]
280
Introduction to AutoBios
4.3.3.16 Wildcard
[Extract] [HELP]
***********************************************************************
[Version] 2.00
[Date] 04/11/94
**********************************************************************
[Extract] [H]
281
The C Programs
//
// READ (when Switch Select = 0)
//
// Bit Description
// 7 Parity Check
// 6 I/O Check
// 5-4 Timer 2 Out
// 3 CtrlReg2 bit 7
// 2 CtrlReg2 bit 6
// 1 Video switch 1
// 0 Video switch 0
//
// READ (when Switch Select = 1)
//
// Bit Description
// 7 Parity Check
// 6 I/O Check
// 5-4 Timer 2 Out
// 3 CtrlReg1 bit 3
// 2 CtrlReg1 bit 2
// 1 CtrlReg1 bit 1
// 0 CtrlReg1 bit 0
//
//
//
#define ChipCtrlReg2 0x63
#define ChipCtrlReg2Default 0x01
// Bit Description
// 7 9.54 Mhz
// 6 7.15 Mhz
// 5 Fast Mode
// 4 512K Ram Size (2 banks of 256K Rams)
// 3 Lock Register (bits 0-4)
// 2 256K Ram (1 bank of 256K Rams)
// 1 8087 present (enable 8087 NMI)
// 0 Disable Parity
[Break]
---------------------------------------------------------------------
//--- This is the code for the standalone ChipDump Utility, and for
//--- the SysVue command to dump the chip registers (if any)
//--- The .EXE for the utility will be the XXXX.Chp filename.
282
Introduction to AutoBios
{ "ChipCtrlReg1","", ChipCtrlReg1,
SizeIsByte,ChipCtrlReg1Default, },
{ "ChipCtrlReg2","", ChipCtrlReg2,
SizeIsByte,ChipCtrlReg2Default, },
{ "","",0,SizeIsByte,0,}, /* Nul String or Zero Value is End of Table */
};
[Break]
------------------------------------------------------------------
[Extract] [MASM]
IFDEF CfgChipData
WORD CfgChipData
ENDIF
IFDEF CfgChipData0
WORD CfgChipData0
ENDIF
IFDEF CfgChipData1
WORD CfgChipData1
ENDIF
IFDEF CfgChipData2
WORD CfgChipData2
283
The C Programs
ENDIF
IFDEF CfgChipData3
WORD CfgChipData3
ENDIF
IFDEF CfgChipData4
WORD CfgChipData4
ENDIF
[Break]
-------------------------------------------------------------------------
[Extract] [C]
};
break;
284
Introduction to AutoBios
break;
case ChipFastResetCPU:
switch (Opcode)
{
};
break;
break;
};*/
return(results);
};
[Break]
285
Introduction to AutoBios
287
The C Programs
!endif
!ifndef False
False = 0
!endif
#----------------------------------------------------------------------
# Default Conditional Configuration Options
#
# The following variables will normally be specifically defined
# in the xxxx.Job file for the particular project. If variables are
# not specified in xxxx.Job, then this file will supply the default
# definitions.
288
Introduction to AutoBios
# [Cfg#]
#
!ifndef CfgProjectPartNr
CfgProjectPartNr = "92093000000-00001"
!endif
#
# [Cfg#]
# [CfgHelp] You may include a project option string
# [CfWord] CfgProjectOption =
# [CfgWordOptions] "Text String"
# [CfgWordDefault] "None"
# [CfgWordAsk] "CfgProjectOption = "
# [CfgWordAnswer]
# [CfgWordOutput] CfgProjectOption =
# [Cfg#]
#
!ifndef CfgProjectOption
CfgProjectOption = "None"
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Platform Support
# [CfgHelp] Only One of these flags should be defined.
# [CfgHelp] This is the general directive. Specific overrides are
# [CfgHelp] possible (see Keyboard) for some drivers and devices.
# [CfgWord] CfgPlatformAT =
# [CfgWordOptions] True/False
# [CfgWordDefault] False
# [CfgWordAsk] "CfgPlatformAT = "
# [CfgWordAnswer]
# [CfgWordOutput] CfgPlatformAT =
# [Cfg#]
#
!ifndef CfgPlatformAT
CfgPlatformAT = False
!endif
!ifndef CfgPlatformWildcard
CfgPlatformWildcard = False
!endif
#
# [Cfg#]
# [CfgHelp] You may specify a Bios type identification byte
# [CfgWord] CfgTypeByte =
# [CfgWordOptions] 0ffh = PC, 0feh = XT, 0fch = AT
# [CfgWordDefault] 0fch
289
The C Programs
# [Cfg#]
#
!ifndef CfgTypeByte
CfgTypeByte = 0fch
!endif
#
# [Cfg#]
# [CfgHelp] These flags designate the level of code to be generated
# [CfgHelp] by the compiler and assembler
# [CfgHelp] 0 (= 8086/8088), 1 (= 80186/80188),
# [CfgHelp] 2 (= 80286), 3 (= 80386), 4 (= 80486)
# [CfgWord] CfgCompiler =
# [CfgWordOptions] 0, 1, 2, 3
# [CfgWordDefault] 2
# [Cfg#]
#
!ifndef CfgCompiler
CfgCompiler = 2
!endif
#
# [Cfg#]
# [CfgWord] CfgMasm =
# [CfgWordOptions] .86, .186, 286p, .386p
# [CfgWordDefault] .386p
# [Cfg#]
#
!ifndef CfgMasm
CfgMasm = .386p
!endif
#
# [Cfg#]
#----------------------------------------------------------------------------
#
# [Cfg#]
# [CfgHelp] Prom Checksum Selection
# [CfgHelp] Determines whether a Bios checksum test is performed.
# [CfgWord] CfgRomChecksum =
# [CfgWordOptions] True, False
# [CfgWordDefault] True
# [Cfg#]
#
!ifndef CfgRomChecksum
CfgRomChecksum = True
!endif
#
# [Cfg#]
#----------------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Language and Locale Options
# [CfgHelp] These flags may be used to specify default langauge and
# [CfgHelp] locale options.
# [CfgWord] CfgLanguage =
# [CfgWord] CfgLocale =
# [CfgWordOptions]
# [CfgWordDefault] English, US
290
Introduction to AutoBios
!ifndef CfgLanguage
CfgLanguage = "English"
!endif
!ifndef CfgLocale
CfgSubLanguage = "US"
!endif
#----------------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Scratch Ram (Objects) location
# [CfgHelp] System Object (Scratch Ram) absolute location definition.
# [CfgHelp] Caution: The System Object is normally allocated at the top of
# [CfgHelp] the System RAM area (typically 640k). If it is desired to
# [CfgHelp] use a discontiguous area, this flag may be used to specify its
# [CfgHelp] location. For normal use, this flag should be left undefined.
# [CfgHelp] See the following flag definition also.
# [Cfg#]
# [CfgWord] CfgSystemObjectAbsolute =
# [CfgWordOptions] 0xyyyy
# [CfgWordDefault] 0xe000
# [Cfg#]
# Alert: This option not presently available
#CfgSystemObjectAbsolute = 0xe000
#
# [Cfg#]
# [CfgSection] Scratch Ram (Objects) Pointer Location
# [CfgHelp] System Object (Scratch Ram) pointer is normally stored at the
# [CfgHelp] primary location defined below. If the Bios (or a StandAlone)
# [CfgHelp] finds the Primary location is unavailable, then an attempt will
# [CfgHelp] be made to use the alternate location.
# [Cfg#]
# [CfgWord] CfgSysObjectPtrPrimary =
# [CfgWord] CfgSysObjectPtrAlternate =
# [Cfg#]
#
!ifndef CfgSysObjectPtrPrimary
CfgSysObjectPtrPrimary = 0x0000040e
!endif
!ifndef CfgSysObjectPtrAlternate
CfgSysObjectPtrAlternate = 0x000004f0
!endif
# [Cfg#]
#----------------------------------------------------------------------------
# [Cfg#]
# [CfgSection] System Object (Scratch Ram) size definition.
# [CfgHelp] Caution: The System Object Size defaults to 4096 bytes, if this
# [CfgHelp] flag is left undefined. It may be used to specify a the size
# [CfgHelp] of memory assigned to be used for the System Object.
# [CfgHelp] This flag should normally be left undefined.
# [Cfg#]
# [CfgWord] CfgSystemObjectSize =
# [CfgWordOptions] size (multiple of 1024)
291
The C Programs
# [CfgWordDefault] 8192
# [Cfg#]
#
#CfgSystemObjectSize = 8192
#
!ifndef CfgSystemObjectSize
CfgSystemObjectSize = 4096
!endif
#
# [Cfg#]
#-------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Hardware Diagnostics Support
# [CfgHelp] This enables/disables checkpoints.
# [CfgWord] CfgCheckPoint True/False Enables/disables checkpoint support
# [Cfg#]
#
!ifndef CfgCheckPoint
CfgCheckPoint = True
!endif
#
# [Cfg#]
# [CfgHelp] This defines the I/O port address to be used for writing
checkpoint
# [CfgHelp] codes. It is normally 128 (0x80 - 80h).
# [CfgWord] CfgCheckPointPort = I/O port number (expressed in decimal!)
# [Cfg#]
#
!ifndef CfgCheckPointPort
CfgCheckPointPort = 128
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Codeview/Debug Information
# [CfgHelp] This flag may be defined to enable the Codeview Debug
# [CfgHelp] facilities. It includes generating code listings and
# [CfgHelp] CodeView information. To build the release version,
# [CfgHelp] it may be defined False.
# [CfgWord] CfgCodeView = $(True/False)
# [Cfg#]
#
!ifndef CfgCodeView
CfgCodeView = $(False)
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgHelp] This flag may be defined to enable generating Listing files.
# [CfgHelp] To build the release version, it may be defined False.
# [CfgWord] CfgListings = $(True/False)
# [Cfg#]
#
!ifndef CfgListings
292
Introduction to AutoBios
CfgListings = $(True)
!endif
#
#--------------------------------------------------------------------
# [Cfg#]
# [CfgHelp] This flag may be defined True to suppress the normal cold-boot
# [CfgHelp] sign on messages.
!ifndef CfgQuietPost
CfgQuietPost = False
!endif
#--------------------------------------------------------
#
# [Cfg#]
# [CfgHelp] These are the Unexpected Interrupt Handling Options.
# [CfgHelp]
# [CfgWord]
# [Cfg#]
#
!ifndef CfgUnexpecIntHandler
CfgUnexpecIntHandler = True
!endif
#
#
!ifndef CfgUnexpecIntDisplay
CfgUnexpecIntDisplay = True
!endif
#
#
!ifndef CfgUnexpecIntTrap
CfgUnexpecIntTrap = True
!endif
#
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# [Cfg#]
# [CfgHelp] These flags are defined to spcify the console I/O.
# [CfgHelp] The default is defined for KB/Video
# [Cfg#]
#
!ifndef CfgConsoleInKeyboard
CfgConsoleInKeyboard = True
!endif
#
!ifndef CfgConsoleInSerial
CfgConsoleInSerial = False
!endif
#
293
The C Programs
!ifndef CfgConsoleOutVideo
CfgConsoleOutVideo = True
!endif
#
!ifndef CfgConsoleOutSerial
CfgConsoleOutSerial = False
!endif
#
# [Cfg#]
# [CfgHelp] These flags should be defined to redirect SysVue I/O.
# [CfgHelp] The default if not defined is KB/CRT
# [CfgHelp] If defined, the device will be COM1
# [CfgWord] CfgSysVueConsole = False/True
# [Cfg#]
#
!ifndef CfgSysVueConsole
CfgSysVueConsole = False
!endif
#
!ifndef CfgSysVueConsolePort
CfgSysVueConsolePort = 0x3f8
!endif
#
# [CfgHelp] This is the init byte for a comm port setup as in Int 14h
!ifndef CfgSysVueConsoleInit
CfgSysVueConsoleInit = 0xe3
!endif
#
!ifndef CfgSysVueConsoleBaud
CfgSysVueConsoleBaud = 9600
!endif
#
!ifndef CfgSysVueConsoleIRQ
CfgSysVueConsoleIRQ = 3
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] ANSI Support
# [CfgHelp] This flag may be defined to enable future ANSI support.
# [CfgWord] CfgANSI = False/True
# [Cfg#]
#
!ifndef CfgANSI
CfgANSI = False
!endif
#
# [Cfg#]
294
Introduction to AutoBios
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Serial Channel Support
# [CfgHelp] This flag should be defined to enable support for COM Ports.
# [Cfg#]
#
!ifndef CfgComm
CfgComm = True
!endif
#
# [Cfg#]
# [CfgHelp] These flags may be used to select/deselect specific opcode
services
# [Cfg#]
#
!ifndef CfgCommOpcodeInit
CfgCommOpcodeInit = True
!endif
#
!ifndef CfgCommOpcodeSend
CfgCommOpcodeSend = True
!endif
#
!ifndef CfgCommOpcodeRx
CfgCommOpcodeRx = True
!endif
#
!ifndef CfgCommOpcodeStatus
CfgCommOpcodeStatus = True
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgHelp] This argument may be used to Initialize the COM ports.
# [CfgHelp] Valid argument are baud rate, # data bits, parity, stop bits.
# [Cfg#]
#
!ifndef CfgComm1Init
CfgComm1Init = 9600,8,N,1
!endif
#
!ifndef CfgComm2Init
CfgComm2Init = 9600,8,N,1
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [CfgHelp] This flag may be specify COM channel device (if not 8250 family)
# [Cfg#]
#
!ifndef CfgComm1Device
CfgComm1Device = 8250
!endif
#
!ifndef CfgComm2Device
295
The C Programs
CfgComm2Device = 8250
!endif
#
#--------------------------------------------------------------------
#
# [CfgHelp] This definition specifies which port to use for virtual
# [CfgHelp] support error reporting port. Normally 0x8e (128+14).
# [CfgHelp] This should NOT be the same as the Checkpoint Port!!!
# [CfgWord] CfgVirtualErrorPort = I/O port number (expressed in decimal!)
# [Cfg#]
#
!ifndef CfgVirtualErrorPort
CfgVirtualErrorPort = 142
!endif
#
# [Cfg#]
# [CfgHelp] This flag specifies whether the full extended memory test
# [CfgHelp] should be performed. A short extended memory sizing routine
# [CfgHelp] only can be run, which will check the last location in each
# [CfgHelp] 64K memory block.
# [CfgWord] CfgVirtualErrorPort = I/O port number (expressed in decimal!)
# [Cfg#]
#
!ifndef CfgVirtualFullTest
CfgVirtualFullTest = False
!endif
#
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] CMOS Memory Support
# [CfgHelp] Summary of AT CMOS Memory definitions
# [CfgHelp] Real time clock is BCD values in locations 00-0D.
# [CfgHelp] 00 Seconds
# [CfgHelp] 01 Seconds Alarm
# [CfgHelp] 02 Minutes
# [CfgHelp] 03 Minutes Alarm
# [CfgHelp] 04 Hours
# [CfgHelp] 05 Hours Alarm
# [CfgHelp] 06 Day of Week
# [CfgHelp] 07 Day of Month
# [CfgHelp] 08 Month
# [CfgHelp] 09 Year
# [CfgHelp]
# [CfgHelp] 0A Bit 7 - Update in Progress
# [CfgHelp]
# [CfgHelp] 0E is the Diagnostic Status Byte:
# [CfgHelp] Bit 7 - Chip lost power
# [CfgHelp] Bit 6 - Bad checksum
# [CfgHelp] Bit 5 - Bad configuration byte
# [CfgHelp] Bit 4 - Bad memory size
# [CfgHelp] Bit 3 - Bad hard disk byte
# [CfgHelp] Bit 2 - Bad time of day
# [CfgHelp]
# [CfgHelp] 0F is the restart status byte. It is loaded before
# [CfgHelp] doing a re-start of the 80286, such as when
296
Introduction to AutoBios
297
The C Programs
#
# [Cfg#]
# [CfgHelp] This flag may be defined to force loading AT CMOS values at power-
on.
# [Cfg#]
#
!ifndef CfgCmosInit
CfgCmosInit = False
!endif
#
!ifndef CfgCmosInitIfBadChecksum
CfgCmosInitIfBadChecksum = True
!endif
#
!ifndef CfgCmosInitIfBadBattery
CfgCmosInitIfBadBattery = True
!endif
#
# [Cfg#]
# [CfgHelp] This flag causes (if CfgCmosInit is defined) the Cmos to be
# [CfgHelp] reloaded on every power-up. Otherwise Cmos will be reloaded
# [CfgHelp] only when the power is lost.
# [Cfg#]
#
!ifndef CfgCmosInitAlways
CfgCmosInitAlways = False
!endif
#
# [Cfg#]
# [CfgHelp] These equates are used to specify the Cmos address and data ports
# [CfgHelp] if they are not located at the default 70,71 hex. Specify Values
# [CfgHelp] in decimal !!
# [Cfg#]
#
#!ifndef CfgCmosRegPort
#CfgCmosRegPort = 112
#!endif
#
#!ifndef CfgCmosDataPort
#CfgCmosDataPort = 113
#!endif
298
Introduction to AutoBios
#
# [Cfg#]
# [CfgHelp] This string may be used to define the initialization Index,Data
# [CfgHelp] if CfgCmosInit is defined.
# [CfgHelp] The 1st value is the cmos register, the 2nd is the value to
load......
# [Cfg#]
#
!ifndef CfgCmosData
#CfgCmosData = 10h,40h,14h,31h
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Video Support
# [CfgHelp] This flag may be defined to configure support for a Video DIsplay.
# [CfgHelp] Video sub-functions and modes may be enabled selectively.
# [CfgHelp] Not all of these flags are implemented
# [Cfg#]
#
!ifndef CfgVideo
CfgVideo = True
!endif
#
!ifndef CfgVideoAll
CfgVideoAll = True
!endif
#
#CfgVideoMono =
#CfgVideoCGA =
#CfgVideoText =
#CfgVideoGraf =
#
# [Cfg#]
# [CfgHelp] If Video is enabled, and All modes are specified, all flags are
enabled.
# [Cfg#]
#
!ifndef CfgVideo
!ifndef CfgVideoAll
CfgVideoMono = True
CfgVideoCGA = True
CfgVideoText = True
CfgVideoGraf = True
!endif
!endif
#
!ifndef CfgVideoGraf
CfgVideoGraf = True
!endif
!ifndef CfgVideoMono
CfgVideoMono = True
!endif
299
The C Programs
!ifndef CfgVideoText
CfgVideoText = True
!endif
!ifndef CfgVideoCGA
CfgVideoCGA = True
!endif
# [Cfg#]
# [CfgHelp] These flags define 2 possible romscan areas for VGA adapters.
# [CfgHelp] If undefined C000-C800 will be used for default.
# [Cfg#]
#
!ifndef CfgVideoPrimaryVGAStart
CfgVideoPrimaryVGAStart = 0xc000
!endif
#
!ifndef CfgVideoPrimaryVGAEnd
CfgVideoPrimaryVGAEnd = 0xc7ff
!endif
#
!ifndef CfgVideoSecondaryVGAStart
CfgVideoSecondaryVGAStart = 0
!endif
#
!ifndef CfgVideoSecondaryVGAEnd
CfgVideoSecondaryVGAEnd = 0
!endif
# If you want to clear the screen on setup, set this flag to true
# this allows you to clear a VGA bios ID string on power-up
!ifndef CfgVideoClearScreen
CfgVideoClearScreen = False
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Memory Configuration
# [CfgHelp] This flag may be defined to define the Maximum Ram in the system.
# [CfgHelp] If not defined, 640K will be used as the default.
# [CfgHelp] Use this only if your Max DRAM is less than 640K.
# [Cfg#]
#
!ifndef CfgMaxMem
CfgMaxMem = 640
!endif
#
# [Cfg#]
#------------------------------------------------------------------
# [CfgHelp] These variables deal with the granularity and the range of
# [CfgHelp] the memory test used for the system ram area
# [CfgHelp] Some platforms may not have stable patterns available in
# [CfgHelp] the bios area for the mem test. Some examples: The V25
# [CfgHelp] reads a byte ptr to the register area at f000:ffff.
300
Introduction to AutoBios
!ifndef CfgMemTestGranularity
CfgMemTestGranularity = 64
!endif
#
!ifndef CfgMemTestPatternBias
CfgMemTestPatternBias = 0
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Print Screen Support
# [CfgHelp] This flag may be defined to enable the PrintScreen Function.
# [Cfg#]
#
!ifndef CfgPrintScreen
CfgPrintScreen = True
!endif
#
# [Cfg#]
# This flag will enable the print screen key to generate an Int 5
# if set true (normal condition).
!ifndef CfgEnableKeyPrintScreen
CfgEnableKeyPrintScreen = True
!endif
#
# This flag will enable/disable the CtrlAltDel key to generate a reboot
#
!ifndef CfgEnableKeyCtrlAltDel
CfgEnableKeyCtrlAltDel = True
!endif
!ifndef CfgEnableKeySysReq
CfgEnableKeySysReq = True
!endif
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Keyboard Support
# [CfgHelp] These are override flags for the Keyboard Driver.
# [CfgHelp] If they are left undefined (the normal case), the keyboard
301
The C Programs
# [Cfg#]
# [CfgHelp] This flag can specify whether to include the Keyboard
# [CfgHelp] Intercpet Function (Int 15, Fun 4F) or not. This is a
# [CfgHelp] normal AT class function.
# [Cfg#]
!ifndef CfgKeyboardIntercept
CfgKeyboardIntercept = True
!endif
# [Cfg#]
# [CfgHelp] This flag specifies whether to wait for a response code to
# [CfgHelp] the keyboard reset. This may take up to 400 milliseconds
# [CfgHelp] if a keyboard is not present.
# [Cfg#]
#ifndef CfgKeyboardResetTest
CfgKeyboardResetTest = False
#endif
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Printer Support
# This flag should be defined to enable support for LPT 1,2,3.
# [Cfg#]
#
!ifndef CfgLPT
CfgLPT = True
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] System Services Support
# [CfgHelp] This flag should be defined to enable support for Cassette
functions.
# [Cfg#]
302
Introduction to AutoBios
#
!ifndef CfgSysSrv
CfgSysSrv = True
!endif
#
!ifndef CfgSysSrvCassetteMotorOn
CfgSysSrvCassetteMotorOn = False
!endif
#
!ifndef CfgSysSrvCassetteMotorOff
CfgSysSrvCassetteMotorOff = False
!endif
#
!ifndef CfgSysSrvCassetteRead
CfgSysSrvCassetteRead = False
!endif
#
!ifndef CfgSysSrvCassetteWrite
CfgSysSrvCassetteWrite = False
!endif
#
!ifndef CfgSysSrvKeyboardIntercept
CfgSysSrvKeyboardIntercept = True
!endif
#
!ifndef CfgSysSrvDeviceOpen
CfgSysSrvDeviceOpen = True
!endif
#
!ifndef CfgSysSrvDeviceClose
CfgSysSrvDeviceClose = True
!endif
#
!ifndef CfgSysSrvProgramTerminate
CfgSysSrvProgramTerminate = True
!endif
#
!ifndef CfgSysSrvEventWait
CfgSysSrvEventWait = True
!endif
#
!ifndef CfgSysSrvJoystick
CfgSysSrvJoystick = True
!endif
#
!ifndef CfgSysSrvSysReqKey
CfgSysSrvSysReqKey = True
!endif
#
!ifndef CfgSysSrvWait
CfgSysSrvWait = True
!endif
#
!ifndef CfgSysSrvMoveBlock
CfgSysSrvMoveBlock = True
!endif
303
The C Programs
#
!ifndef CfgSysSrvGetExtendedMemorySize
CfgSysSrvGetExtendedMemorySize = True
!endif
#
!ifndef CfgSysSrvSwitchToProtectedMode
CfgSysSrvSwitchToProtectedMode = True
!endif
#
!ifndef CfgSysSrvDeviceBusy
CfgSysSrvDeviceBusy = True
!endif
#
!ifndef CfgSysSrvInterruptComplete
CfgSysSrvInterruptComplete = True
!endif
#
!ifndef CfgSysSrvGetSystemConfigParms
CfgSysSrvGetSystemConfigParms = True
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Floppy Disk Support
# [CfgHelp] These flags may be used to define the diskette support desired.
# [CfgWord] CfgDisk True/False Enables/disables floppy disk support
# [Cfg#]
#
!ifndef CfgDisk
CfgDisk = True
!endif
#
# [Cfg#]
# [CfgHelp] These flags may be used to specify the default drive types.
# [CfgWord] CfgDisk1Type 360/720/1200/1440 Specifies type of drive A:
# [Cfg#]
#
!ifndef CfgDisk1Type
CfgDisk1Type = 0
!endif
#
# [Cfg#]
# [CfgWord] CfgDisk1Type 360/720/1200/1440 Specifies type of drive B:
# [Cfg#]
#
!ifndef CfgDisk2Type
CfgDisk2Type = 0
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [CfgHelp] This flag may be used to specify a non-twisted cable
# [CfgHelp] for the floppy drives
# [CfgWord] CfgDiskCableSwap True/False Specifies normal/straight cable
# [Cfg#]
304
Introduction to AutoBios
#
!ifndef CfgDiskCableSwap
CfgDiskCableSwap = False
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Hard Disk Support
# [CfgHelp] This flag may be defined to enable hard disk support for AT's.
# [CfgWord] CfgHard True/False Enables/disables hard disk support
# [Cfg#]
#
!ifndef CfgHard
CfgHard = False
!endif
#
# [Cfg#]
# [CfgHelp] These may be defined to specify the default hard drive types.
# [CfgHelp] CfgInitCMOS must be defined to process these drive types.
# [CfgWord] CfgHard1Type = drive type #
# [CfgWord] CfgHard2Type = drive type #
# [Cfg#]
#
#CfgHard1Type = 47
#
# [Cfg#]
#
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Rom Scan Support
# [CfgHelp] This Flag should be defined if you wish to perform the RomScan.
# [Cfg#]
#
!ifndef CfgRomScanEnable
CfgRomScanEnable = True
!endif
#
# [Cfg#]
# [CfgHelp] If the RomScan is enabled, you may specify whether the scan
# [CfgHelp] will occur on the normal IBM compatible 2K boundaries, or
# [CfgHelp] on 512 byte boundaries.
# [CfgHelp] If the value is undefined, the default is 2048 byte multiples.
# [Cfg#]
#
!ifndef CfgRomScanBoundaries
CfgRomScanBoundaries = 2048
!endif
#
# [Cfg#]
# [CfgHelp] These flags may be used to define non-standard romscan areas.
# [CfgHelp] If undefined, the default is C800 - Start-of-Bios.
# [CfgHelp] See CfgVideo options for complementary functions.
# [Cfg#]
#
!ifndef CfgRomScanPrimaryStart
305
The C Programs
CfgRomScanPrimaryStart = 0xc800
!endif
#
!ifndef CfgRomScanPrimaryEnd
CfgRomScanPrimaryEnd = 0xe000
!endif
#
!ifndef CfgRomScanSecondaryStart
CfgRomScanSecondaryStart = 0x0000
!endif
#
!ifndef CfgRomScanSecondaryEnd
CfgRomScanSecondaryEnd = 0x0000
!endif
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Boot Options Support
# [CfgHelp] This Value may be defined if you wish to boot to SysVue BEFORE
# [CfgHelp] booting to disk. Normally SysVue will boot after the Disk boot
# [CfgHelp] fails. In either case, the "EXIT" command of SysVue will try
# [CfgHelp] another boot sequence again.
# [Cfg#]
#
!ifndef CfgBootSysVue
CfgBootSysVue = False
!endif
#
# [CfgHelp] This flag may be used if you want to include your own
# [CfgHelp] boot routine. This may transfer control to a hard-coded
# [CfgHelp] routine at a specific location.
#
CfgBootUser = False
CfgBootUserLocation = 0e0001234
#
# [CfgHelp] If you are using a disk-based boot, this flag may be used to
# [CfgHelp] specify the order of devices; i.e.; A: then C:, C: then A:. etc.
# [CfgHelp] This Value may be defined if you wish select one of four possible
# [CfgHelp] orders of booting.
# [Boot]
# The default CfgBootOrder = 0 is A:, C: if left undefined.
# CfgBootOrder = 1 is C:, A:
# CfgBootOrder = 2 is A:
# CfgBootOrder = 3 id C:
#
#
!ifndef CfgBootOrder
CfgBootOrder = 0
!endif
#
#
# [CfgHelp] This flag may be used if you want to include your own
# [CfgHelp] special signature in the boot record. This prevents an
# [CfgHelp] unauthorized boot diskette from loading.
306
Introduction to AutoBios
!ifndef CfgBootSignatureCheck
CfgBootSignatureCheck = False
!endif
!ifndef CfgBootSignatureLoc
CfgBootSignatureLoc = 3
!endif
!ifndef CfgBootSignature
CfgBootSignature = ""
!endif
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
# [CfgSection] Bios Size Configuration Support
# [CfgHelp] This Value may be defined if you wish to pad the front of the
# [CfgHelp] Bios to free up the begining of the segment
# [CfgHelp] This Value is usually 0000 for AT's and 8000h for XT's.
# [CfgHelp] If the Value is not defined, 0000 is assumed.
# [Cfg#]
#
!ifndef CfgPad
CfgPad = 0000h
!endif
#
# [Cfg#]
#
#--------------------------------------------------------------------
# [CfgHelp] These flags may be defined to specify the target system.
# [CfgHelp] They provide a preset description for popular combinations.
# [CfgHelp] They are intended to provide the first-highest-level choice.
# [CfgHelp] They may then set up standard conditions for that target
# [CfgHelp] Note: These Project Flags should be placed at the beginning
# [CfgHelp] so that the default expansions come last.
# [Cfg#]
#
#CfgTargetGenericXT
#CfgTargetGenericAT
#CfgTargetAMD286LX
#
# [Cfg#]
# [CfgHelp] these flags may be expanded to replace the chip flags below,
# [CfgHelp] since they allow more comprehensive configuration definitions.
# [CfgHelp] These sets may then be enabled/disabled with one major flag,
# [CfgHelp] making it easier to define multiple configurations.
# [CfgHelp] Example of project specific targets is shown below
# [Cfg#]
#
#CfgTargetMyProject1
#CfgTargetMyProject2
#
# [Cfg#]
#--------------------------------------------------------------------
# [Cfg#]
307
The C Programs
#
# END OF CONDITIONAL CONFIGURATION OPTIONS
#--------------------------------------------------------------------------
308
Introduction to AutoBios
309
Introduction to AutoBios
!ifndef False
False = 0
!endif
#----------------------------------------------------------------------
# Default Conditional Configuration Options
#
# The following variables will normally be specifically defined
# in the xxxx.Job file for the particular project. If variables are
# not specified in xxxx.Job, then this file will supply the default
# definitions.
311
The C Programs
#----------------------------------------------------------------------
# Default Project Configuration and Identification Information
# [SubTitle]
# [Section] User Text Strings
# [SubSection]
# [Item]
# [Keyword.Search for this string]
# [Default] CfgProjectVersion = "0.99"
# [Help] You may include a project version number or use the default
# [Help]
# [Ask] "CfgProjectVersion = "
# [Answer]
# [Output] CfgProjectVersion =
# [Wait]
#
!ifndef CfgProjectVersion
CfgProjectVersion = "0.99"
!endif
!ifndef CfgProjectCustomer
CfgProjectCustomer= "Generic"
!endif
!ifndef CfgProjectPartNr
CfgProjectPartNr = "92093000000-00001"
!endif
!ifndef CfgProjectOption
CfgProjectOption = "None"
!endif
#--------------------------------------------------------------------
# [Section] Platform Support
# [Help] Only One of these flags should be defined.
# [Help] This is the general directive. Specific overrides are
# [Help] possible (see Keyboard) for some drivers and devices.
!ifndef CfgPlatformAT
CfgPlatformAT = True
!endif
!ifndef CfgTypeByte
CfgTypeByte = 0fch
!endif
!ifndef CfgTypeParms
CfgTypeParms = 08h,00h,0fch,01,070h,0,0,0,0,0
!endif
!ifndef CfgCompiler
CfgCompiler = 3
!endif
312
Introduction to AutoBios
!ifndef CfgMasm
CfgMasm = .386p
!endif
#--------------------------------------------------------------------
#[Section] CMOS Memory Support
# [Help] This flag may be defined to enable support for AT CMOS memory.
!ifndef CfgCmos
CfgCmos = True
!endif
# [Help] This flag may be defined to force loading AT CMOS values at power-on.
#
!ifndef CfgCmosInit
CfgCmosInit = False
!endif
!ifndef CfgCmosInitIfBadChecksum
CfgCmosInitIfBadChecksum = True
!endif
!ifndef CfgCmosInitIfBadBattery
CfgCmosInitIfBadBattery = True
!endif
!ifndef CfgCmosInitAlways
CfgCmosInitAlways = False
!endif
#--------------------------------------------------------------------
# [Section] Keyboard Support
# [Help] These are override flags for the Keyboard Driver.
# [Help] If they are left undefined (the normal case), the keyboard
# [Help] will follow the paltform definition.
# [Help] If one (and ONLY one) is defined, then that will force
# [Help] the keyboard definition.
!ifndef CfgKeyboardStyleAT
CfgKeyboardStyleAT = True
!endif
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# [Section] Hard Disk Support
# [Help] This flag may be defined to enable hard disk support for AT's.
!ifndef CfgHard
CfgHard = True
313
The C Programs
!endif
314
Introduction to AutoBios
!ifndef False
False = 0
!endif
#----------------------------------------------------------------------
# Default Conditional Configuration Options
#
# The following variables will normally be specifically defined
# in the xxxxJob file for the particular project. If variables are
# not specified in xxxx.Job, then this file will supply the default
# definitions.
315
The C Programs
#----------------------------------------------------------------------
# Default Project Configuration and Identification Information
# [SubTitle]
# [Section] User Text Strings
# [SubSection]
# [Item]
# [Keyword.Search for this string]
# [Default] CfgProjectVersion = "0.99"
# [Help] You may include a project version number or use the default
# [Help]
# [Ask] "CfgProjectVersion = "
# [Answer]
# [Output] CfgProjectVersion =
# [Wait]
#
!ifndef CfgProjectVersion
CfgProjectVersion = "0.99"
!endif
!ifndef CfgProjectCustomer
CfgProjectCustomer= "Generic"
!endif
!ifndef CfgProjectPartNr
CfgProjectPartNr = "92093000000-00001"
!endif
!ifndef CfgProjectOption
CfgProjectOption = "None"
!endif
#--------------------------------------------------------------------
# [Section] Platform Support
# [Help] Only One of these flags should be defined.
# [Help] This is the general directive. Specific overrides are
# [Help] possible (see Keyboard) for some drivers and devices.
!ifndef CfgPlatformAT
CfgPlatformAT = True
!endif
!ifndef CfgTypeByte
CfgTypeByte = 0fch
!endif
!ifndef CfgTypeParms
CfgTypeParms = 08h,00h,0fch,01,070h,0,0,0,0,0
!endif
!ifndef CfgCompiler
CfgCompiler = 3
!endif
316
Introduction to AutoBios
!ifndef CfgMasm
CfgMasm = .386p
!endif
#----------------------------------------------------------------------------
# [Section] Prom Configuration
# Prom Configuration Information
# [Help] If a single prom chip will be used, a split ID field will be omitted.
!ifndef CfgPromSingle
CfgPromSingle = False
!endif
#--------------------------------------------------------------------
!ifndef CfgLPT
CfgLPT = False
!endif
!ifndef CfgPrintScreen
CfgPrintScreen = False
!endif
!ifndef CfgCmosClock
CfgCmosClock = False
!endif
!ifndef CfgANSI
CfgANSI = True
!endif
#--------------------------------------------------------------------
#[Section] CMOS Memory Support
# [Help] This flag may be defined to enable support for AT CMOS memory.
!ifndef CfgCmos
CfgCmos = False
!endif
# [Help] This flag may be defined to force loading AT CMOS values at power-on.
#
!ifndef CfgCmosInit
CfgCmosInit = False
!endif
!ifndef CfgCmosInitIfBadChecksum
CfgCmosInitIfBadChecksum = True
!endif
!ifndef CfgCmosInitIfBadBattery
CfgCmosInitIfBadBattery = True
!endif
317
The C Programs
!ifndef CfgCmosInitAlways
CfgCmosInitAlways = False
!endif
#--------------------------------------------------------------------
# [Section] Keyboard Support
!ifndef CfgKeyboard
CfgKeyboard = False
!endif
#--------------------------------------------------------------------
!ifndef CfgDisk
CfgDisk = False
!endif
!ifndef CfgVideo
CfgVideo = False
!endif
!ifndef CfgKeyboardIntercept
CfgKeyboardIntercept = False
!endif
#--------------------------------------------------------------------
# [Section] Hard Disk Support
# [Help] This flag may be defined to enable hard disk support for AT's.
!ifndef CfgHard
CfgHard = False
!endif
318
Introduction to AutoBios
319
The C Programs
// Size Identifiers
#define SizeIsString 0
#define SizeIsByte 1
#define SizeIsWord 2
#define SizeIsLong 4
#include "product.h"
#include "job.h"
#include "platform.h"
#include "common.h"
#include "chiph.tmp"
#include "stddefs.h"
#include "intregs.h"
#include "Bios8042.h"
#include "lang.h"
struct FDiskParmItem
{
char SpecifyByte1;
char SpecifyByte2;
char MotorWait;
char BytesPerSectorCode;
char SectorsTrack;
char Gap;
char Dtl;
char Gap3;
char FillCharByte;
char HeadSettle;
char MotorStart;
char MaxTracks;
char DataRate;
char Step;
char DriveID;
char MediaID;
};
/*******************************************************
320
Introduction to AutoBios
*******************************************************/
struct HDTable
{
unsigned Cyls;
char Heads;
unsigned ReducedWrite; /* XT Only - AT = 0*/
unsigned PreComp; /* default 0 */
char MaxECC; /* XT Only */
char Control; /* set to 0 */
char TimeOut; /* XT Only */
char FormatTimeOut; /* XT Only */
char CheckTimeOut; /* XT Only */
unsigned Landing;
char Sectors;
char Reserved; /* Reserved, Set to 0 */
};
#ifndef _H2INC
struct NameValueList
{
char near * Name;
unsigned Value;
};
#endif
struct ItemList
{
char near * ItemName;
char near * ItemDescription;
unsigned ItemAddress;
unsigned ItemSize;
unsigned ItemDefault;
unsigned ItemValue;
};
321
The C Programs
//=====================================================================
//
// This is the inline assembly language code definition to provide
// Bios Stack swapping. A portion of the BiosObject is reserved for
// the Bios Stack. A service routine may elect to use it's own stack
// by swapping from the user stack to the Bios Stack.
// This allows Bios serovice routines to be recursive without using
// a large amount of the user's stack. To determine whether the
// Bios routine is being called from the user, or another Bios routine,
// an InBios semaphore swaps the stack only when entering from a
// users routine.
//
// The typical use is:
// InterruptEnvelope(MemCall,DeviceMem,0)
// or:
// InterruptEnvelope(SysMain,DeviceSysVue,OriginTrap)
//
// Note: a Device = 0 skips the Snapshot calls
//
#define InterruptEnvelope(Destination,DeviceMask,OriginCode) \
_asm { \
/* Save the original SS for a calling argument, the SP is held in bp */ \
_asm mov cx,ss \
_asm mov dx,bp \
/* Get the BiosObject ptr */ \
_asm xor ax,ax \
_asm mov es,ax \
_asm mov es,es:[SystemLocation] \
_asm les di,es:[0].Bios_Ptr \
/* disable interrupts */ \
_asm lahf \
_asm cli \
/* Check the InBios Semaphore */ \
_asm cmp word ptr es:[di].InBios,0 \
/* Skip swapping if already in the Bios */ \
_asm jnz skipswap \
/* First time into Bios, so do the swap, saving the old SS:SP */ \
_asm mov es:[di].StackSaveSP,bp \
_asm mov es:[di].StackSaveSS,ss \
/* The new stack will be in the BiosObject */ \
_asm mov bx,es \
_asm mov ss,bx \
_asm lea bx,es:[0].BiosStackEnd \
_asm add bx,di \
_asm mov sp,bx \
_asm skipswap: \
/* Increment the InBios semaphore */ \
_asm inc word ptr es:[di].InBios \
_asm sahf \
/* Set the Data Segment to the Code Segment */ \
_asm mov ax,cs \
_asm mov ds,ax \
/* Call the snap and service routines with a ptr to the regs */ \
322
Introduction to AutoBios
//=====================================================================
#include "objects.h"
// these are arbitrary identifiers so the main routine will know how it was
entered
/*
// This definition sizes the block acquire to include the variables
// specified in the variable declaration
*/
/* Function Prototypes */
323
The C Programs
void _enable(void);
void _disable(void);
#define PushInterruptStatus _asm { pushf }
#define PopInterruptStatus _asm { popf }
#define NoOpcode _asm { _asm nop };
#define FlushCpuQueue _asm { _asm jmp $+2 };
void interrupt far SysError(unsigned);
324
Introduction to AutoBios
/*----------------------------------------------------------------------*/
unsigned IsAlpha(char);
unsigned IsUpper(char);
unsigned IsLower(char);
unsigned IsDigit(char);
unsigned IsHexDigit(char);
unsigned IsSpace(char);
unsigned IsPunct(char);
unsigned isalnum(char);
unsigned IsPrintable(char);
unsigned IsGraph(char);
unsigned IsCntrl(char);
unsigned IsAscii(char);
char ToUpper(char);
char ToLower(char);
325
The C Programs
#include "lowram.h"
#define MaxArgs 16
unsigned SnapActive(void);
unsigned WatchActive(void);
unsigned LogActive(void);
void MarkDeviceActive(unsigned device);
void MarkDeviceInactive(unsigned device);
unsigned PutChar(char);
void BiosID(void);
void PartNrID(void);
void VersionID(void);
void OwnerID(void);
void CustomerID(void);
void DateStamp(void);
void BiosStart(void);
//--------------------------------------------------------------
326
Introduction to AutoBios
#ifndef _H2INC
unsigned SysVueSetup(ActionArgument);
unsigned MemSizeSetup(ActionArgument);
unsigned TimeOfDaySetup(ActionArgument);
unsigned SystemServicesSetup(ActionArgument);
unsigned BootSetup(ActionArgument);
unsigned MoveSysObjectRoutine(ActionArgument);
unsigned RomCheckSunRoutine(ActionArgument);
unsigned CommSetup(ActionArgument);
unsigned ConsoleCommSetup(ActionArgument);
unsigned LptSetup(ActionArgument);
unsigned FDiskSetup(ActionArgument);
unsigned HDiskSetup(ActionArgument);
unsigned RomScanRoutine(ActionArgument);
unsigned EquipmentSetup(ActionArgument);
unsigned KeyboardSetup(ActionArgument);
unsigned TimerSetup(ActionArgument);
unsigned VideoSetup(ActionArgument);
unsigned PrintScreenSetup(ActionArgument);
unsigned SysVueConsoleSetup(ActionArgument);
unsigned CDSetup(ActionArgument);
#endif
void DummyIret(void);
void DummyISR(void);
void beep(void);
void OutCmos(unsigned,unsigned);
void ResetCmosBits(unsigned,unsigned);
void SetCmosBits(unsigned,unsigned);
void ToggleCmosBits(unsigned,unsigned);
unsigned InCmos(unsigned);
unsigned long SetTimeOutCount(unsigned);
void DelayCall(unsigned count,unsigned resolution);
void BootJump(unsigned char);
unsigned Motherboard(unsigned);
327
The C Programs
unsigned TimeOfDay(void);
unsigned RamTestOK(unsigned base,unsigned gran,unsigned bias);
unsigned ChecksumOK(unsigned,unsigned);
unsigned ChecksumBiosOK(void);
unsigned SetTimerCount(void);
unsigned read_refresh_count(void);
unsigned CalcHDiskSize(unsigned,unsigned,unsigned);
unsigned long SetTimeOutCount(unsigned count);
unsigned CmosType(char drive_nr);
unsigned CallDiskDiagnostic(void);
unsigned CallDiskReset(unsigned);
void CallDiskInitDrive(unsigned);
void CallDiskRecalibrate(unsigned);
unsigned CallDiskRead(unsigned Drive,unsigned NrSectors,
unsigned Track,unsigned Head,unsigned Sector,
unsigned char far *Buffer);
void RepeatIn(void far *buffer,unsigned portnr,unsigned count);
void RepeatOut(void far *buffer,unsigned portnr,unsigned count);
void FDiskChain(void);
unsigned VideoSetMode(unsigned);
unsigned VideoGetMode(void);
void VideoWriteTty(char);
void VideoSetCursor(unsigned);
void VideoScrollUp(unsigned,unsigned,unsigned,unsigned);
void MoveRow(unsigned,unsigned,unsigned,unsigned);
void ClearRow(unsigned,unsigned,unsigned,unsigned);
328
Introduction to AutoBios
void MoveGraphicsRow(unsigned,unsigned,unsigned,unsigned);
void ClearGraphicsRow(unsigned,unsigned,unsigned,unsigned);
void VideoWriteChar(unsigned);
void VideoWriteAC(char,unsigned);
unsigned VideoReadAC(void);
void VideoClearScreen(void);
/*--------------------------------------------------------------------*/
#include "sysvue.h"
//-----------------------------------------------------------
struct SysVueCommandList
{
char near * CmdName;
char near * CmdHelpString;
void (near * Cmd)(VueRegSet);
};
// This structure is for the SysVue command line parser. The token
// is followed by the index for the save array of the value of the token.
//
unsigned BuildArguments(VueRegSet);
329
The C Programs
struct WordWordList
{
unsigned Word1;
unsigned Word2;
};
struct ByteByteList
{
unsigned Byte1;
unsigned Byte2;
};
unsigned Trap(void);
330
Introduction to AutoBios
#include "virtual.h"
/*********************************************************/
331
Introduction to AutoBios
#define NULL 0
#define EOS '\0'
//
// Define the watch and snap bits
333
The C Programs
// This is the master enable flag for snaps. Only snaps on this
// list can be enabled.
#define SnapMasterPattern DeviceMaskSysSrv | \
DeviceMaskLpt | \
DeviceMaskDisk | \
DeviceMaskHard | \
DeviceMaskBoot | \
DeviceMaskPrtScr | \
DeviceMaskEquipment | \
DeviceMaskMemory | \
DeviceMaskCDRom
// This is the master enable flag for watches. Only watches on this
// list can be enabled.
#define WatchMasterPattern DeviceMaskSysSrv | \
DeviceMaskLpt | \
DeviceMaskDisk | \
DeviceMaskHard | \
DeviceMaskBoot | \
DeviceMaskPrtScr | \
DeviceMaskEquipment | \
DeviceMaskMemory | \
DeviceMaskPod | \
DeviceMaskCDRom
// This is the master enable flag for logging. Only logs on this
// list can be enabled.
#define LogMasterPattern DeviceMaskSysSrv | \
DeviceMaskLpt | \
DeviceMaskDisk | \
DeviceMaskHard | \
DeviceMaskBoot | \
DeviceMaskPrtScr | \
DeviceMaskEquipment | \
DeviceMaskMemory
334
Introduction to AutoBios
#ifndef CfgCmosRegPort
#define CmosRegPort 112
#else
#define CmosRegPort CfgCmosRegPort
#endif
#ifndef CfgCmosDataPort
#define CmosDataPort 113
#else
#define CmosDataPort CfgCmosDataPort
#endif
/*-- To add Port 0x80 hexadecimal outputs, use this definition --*/
#if CfgCheckPoint
#ifndef _H2INC
#define CheckPoint(xy) _asm { _asm mov al,xy _asm out CfgCheckPointPort,al }
#endif
#else
#ifndef _H2INC
#define CheckPoint(xy) _asm { }
#endif
#endif
struct ActionItemList {
char near * ActionMessage;
//char near * TrueMessage;
//char near * FalseMessage;
unsigned (near * DoRoutine)();
//unsigned (near * TrueRoutine)();
//unsigned (near * FalseRoutine)();
//unsigned long LongValue;
};
335
The C Programs
#define SetupStatusStub 8
#define SetupStatusInactive 16
#define SetupStatusDeleted 32
#define SetupStatusReserved 64
#define SetupStatusNotFound 128
#if CfgCompiler
#define pushI(immediate) _asm { _asm mov ax,immediate _asm push ax }
#else
#define pushI(immediate) _asm { _asm push immediate }
#endif
//--------------------------------
unsigned IsAlpha(char);
unsigned IsUpper(char);
unsigned IsLower(char);
unsigned IsDigit(char);
unsigned IsHexDigit(char);
unsigned IsSpace(char);
unsigned IsPunct(char);
unsigned isalnum(char);
unsigned IsPrint(char);
unsigned IsGraph(char);
unsigned IsCntrl(char);
unsigned IsAscii(char);
336
Introduction to AutoBios
/*===============================================================*/
enum /* Slots are reserved in the System Object for Thread Headers */
{
SystemObjectType,
PoolObjectType,
BiosObjectType,
SysVueObjectType,
VirtualObjectType,
ExecObjectType,
TaskObjectType,
TaskControlBlockObjectType,
StackObjectType,
EventObjectType,
MailboxObjectType,
SignalObjectType,
TextObjectType,
ProcessObjectType,
BufferObjectType,
FifoObjectType,
SpareObjectType,
337
The C Programs
CfgObjectType,
};
338
Introduction to AutoBios
339
The C Programs
#if(0==1)
/* Note - the thread list will need to be changed to a directory structure,
where two long slots will hold the handle and the thread-head. This
will allow using any legal handle without reserving max-space, as is
required now. The thread-heads can be found by scanning the directory
with the handle as the key.
This is the proposed structure for the directory entry
struct { unsigned long HandleEntry; char far * ThreadEntry; } DirEntry;
DefineObject(Future_SYSTEM_Object)
char far * PoolStart; /* This is the default system pool */
char far * PoolCurrentOpen;
char far * PoolEnd;
char far * PoolExtension /* a flink to the pool extenssion */ /*
Pointer to ourself - NULL - */
DirEntry;
DirEntry;
DirEntry;
DirEntry;
DirEntry;
DirEntry;
DirEntry;
DirEntry;
char far * PoolBlock;
/* this is the start of the system pool area */
EndDefineObject;
#endif
/*
// The first pool in the thread is the main (primary) one. Additional
// pools may be created by flinking.
*/
340
Introduction to AutoBios
/*
//-- By making these pointers 32 bit, we will be compatible with
//-- 386/486 linear mode. We may use only the lower 16 bits now,
//-- but the structure will be ready.
*/
unsigned long PoolStart;
unsigned long PoolCurrentOpen;
unsigned long PoolEnd;
unsigned long PoolExtension;
unsigned PoolBlock[PoolLength/2];
} PoolObject;
struct StructureFlagMaster
{
unsigned Flag;
unsigned Master;
unsigned Save;
unsigned Reserved;
};
341
The C Programs
unsigned Locked:1; \
unsigned Enabled:1; \
unsigned Full:1; \
unsigned Available:1; \
unsigned Waiting:1; \
unsigned Reserved:1; \
unsigned Permanent:1; \
unsigned Native:1; \
} CfgStatusFlags; \
unsigned CfgStatus; \
}; \
342
Introduction to AutoBios
/*--- This defines the structure of the Bios Ram area -----*/
343
The C Programs
unsigned Reserved1:1;
unsigned NrComPorts:3;
unsigned GamePort:1;
unsigned Reserved2:1;
unsigned NrLptPorts:2;
} EquipFlag;
unsigned EquipByte;
};
union
{
struct
{
char RightShift:1;
char LeftShift:1;
char CtrlShift:1;
char AltShift:1;
char ScrollState:1;
char NumState:1;
char CapsState:1;
char InsertState:1;
} KbFlag; /* 0x0417 */
char KbFlagByte;
};
union
{
struct
{
char LeftCtrl:1;
char LeftAlt:1;
char SysReq:1;
char HoldState:1;
char ScrollShift:1;
char NumShift:1;
char CapsShift:1;
char InsertShift:1;
} KbFlag1;
char KbFlagByte1; /* 0x0418 */
};
union
{
struct
{
char RecalDrive0:1;
char RecalDrive1:1;
344
Introduction to AutoBios
char Spares:5;
char IntFlag:1;
} SeekStatus; /* 0X043E */
char SeekStatusByte;
};
union
{
struct
{
char Drive0isOn:1;
char Drive1isOn:1;
char Drive2isOn:1;
char Drive3isOn:1;
char DriveSelected:2;
char Reserved:1;
char WriteFormatOperation:1; /* 0X043F */
} MotorStatus;
char MotorStatusByte;
};
union
{
struct
{
char ErrorCode:5;
char ControllerFailed:1;
char SeekError:1;
char DriveNotReady:1;
} DiskStatus; /* 0X0441 */
char DiskStatusByte;
};
345
The C Programs
};
};
char ActivePage; /* 0X0462 */
unsigned ADDR_6845; /* 0X0463 */
char CRT_MODE_SET; /* 0X0465 */
char CRT_PALLETTE; /* 0X0466 */
unsigned VirtualOffset; /* 0X0467 */
unsigned VirtualSegment; /* 0X0469 */
unsigned char VirtualFlag; /* 0X046B */
union
{
unsigned long TimerLong; /* 0X046C */
struct
{
unsigned TimerLow;
unsigned TimerHigh;
};
};
char TimerOverflow; /* 0X0470 */
char BIOS_BREAK; /* 0X0471 */
unsigned RESET_FLAG; /* 0X0472 */
char HD_STATUS1; /* 0X0474 */
char HD_NUM; /* 0X0475 */
char HD_CONTROL; /* 0X0476 */
char spare3;
char LPT_TIMEOUT_LIST[4]; /* 0X0478 */
char COMM_TIMEOUT_LIST[4]; /* 0X047C */
unsigned KbBufferStart; /* 0X0480 Index */
unsigned KbBufferEnd; /* 0X0482 Index */
char ROWS; /* 0X0484 */
unsigned POINTS; /* 0X0485 */
char INFO; /* 0X0487 */
char INFO_3; /* 0X0488 */
char sparex[3]; /* 0X0489 */
char HD_STATUS; /* 0X048C */
char HD_ERROR; /* 0X048D */
char HD_INT_FLAG; /* 0X048E */
char HF_CNTRL; /* 0X048F */
struct
{
char DriveType:3;
char DriveEst:1;
char MediaType:3;
char MediaEst:1;
} DiskID[4]; /* 0X0490 */
union
{
struct
{
char LastCodeE1:1;
char LastCodeE0:1;
346
Introduction to AutoBios
char RightCtrl:1;
char RightAlt:1;
char Keyboard101:1;
char ForcedNumLock:1;
char LastCodeFirstID:1;
char ReadIDinProgress:1;
} KbFlag3; /* 0X0496 */
char KbFlagByte3;
};
union
{
struct
{
char LEDs:3;
} Kb;
struct
{
char ScrollLED:1;
char NumLED:1;
char CapsLED:1;
char Reserved:1;
char AckRxed:1;
char ResendRxed:1;
char UpdateInProgress:1;
} KbFlag2; /* 0X0497 */
char KbFlagByte2;
};
union
{
unsigned long UserFlagLong; /* 0X0498 */
struct
{
unsigned UserFlagOffset;
unsigned UserFlagSegment;
};
};
union
{
unsigned long RtcLong; /* 0X049C */
struct
{
unsigned RtcLow;
unsigned RtcHigh;
};
};
347
Introduction to AutoBios
/*-- Define the Registers on the Stack for an Interrupt Call --*/
#define SizeofRegArray 21
349
The C Programs
/* byte registers */
#else
#define SizeofRegArray 13
350
Introduction to AutoBios
unsigned RegIP;
unsigned RegCS;
unsigned RegFlags;
} WordRegs;
/* byte registers */
351
Introduction to AutoBios
/***********************************************************************
*
* SysVue Definitions
*
********************************************************************/
353
The C Programs
struct Tokens
{
union TokenValueStructure
{
char far * CharPtr;
unsigned far * WordPtr;
unsigned long far * LongPtr;
char CharValue[4];
unsigned WordValue[2];
unsigned long LongValue;
} Value;
union TokenMaskStructure
{
unsigned WordMask[2];
unsigned long LongMask;
} ValueMask;
} Token[MaxArgs + 1];
unsigned ArgC;
unsigned long LastDumpSave; // Used by CmdDump.c
char far * ThisTokenPtr; // These two ptrs are used by StrTok
char far * NextTokenPtr;
/* L O C A L D E F I N I T I O N S */
#define TypeAscii 1
#define TypeHex 2
enum order
{
354
Introduction to AutoBios
nulreg,
axsave,bxsave,cxsave,dxsave,spsave,
bpsave,sisave,disave,dssave,essave,
sssave,cssave,ipsave,pswsave,
};
enum extendedorder
{
enulreg,
eaxsave,ebxsave,ecxsave,edxsave,espsave,
ebpsave,esisave,edisave,edssave,eessave,
esssave,ecssave,eipsave,epswsave,
};
/*--------------------------------------------------------------------*/
/* Command Prototypes */
void CmdChip(VueRegSet);
void CmdBootDump(VueRegSet);
void CmdCompare(VueRegSet);
void CmdCompareAscii(VueRegSet);
void CmdCompareByte(VueRegSet);
void CmdCompareWord(VueRegSet);
void CmdCompareDouble(VueRegSet);
void CmdChecksum(VueRegSet);
void CmdCLS(VueRegSet);
void CmdColdBoot(VueRegSet);
void CmdCmos(VueRegSet);
355
The C Programs
void CmdDate(VueRegSet);
void CmdDevices(VueRegSet);
void CmdDump(VueRegSet);
void CmdDumpAscii(VueRegSet);
void CmdDumpByte(VueRegSet);
void CmdDumpWord(VueRegSet);
void CmdDumpDouble(VueRegSet);
void CmdDrive(VueRegSet);
void CmdEnter(VueRegSet);
void CmdEnterAscii(VueRegSet);
void CmdEnterByte(VueRegSet);
void CmdEnterWord(VueRegSet);
void CmdEnterDouble(VueRegSet);
void CmdExit(VueRegSet);
void CmdFill(VueRegSet);
void CmdFillAscii(VueRegSet);
void CmdFillByte(VueRegSet);
void CmdFillWord(VueRegSet);
void CmdFillDouble(VueRegSet);
void CmdHardBoot(VueRegSet);
void CmdHex(VueRegSet);
void CmdHelp(VueRegSet);
void CmdInPort(VueRegSet);
void CmdInPortByte(VueRegSet);
void CmdInPortWord(VueRegSet);
void CmdInPortCmos(VueRegSet);
//void InvokeInterrupt(VueRegSet);
void CmdLog(VueRegSet);
void CmdMove(VueRegSet);
void CmdMem(VueRegSet);
void CmdOutPort(VueRegSet);
void CmdOutPortByte(VueRegSet);
void CmdOutPortWord(VueRegSet);
void CmdOutPortCmos(VueRegSet);
void CmdOrder(VueRegSet);
void CmdWarmBoot(VueRegSet);
void CmdWHex(VueRegSet);
void CmdRHex(VueRegSet);
void CmdRegDisplay(VueRegSet);
void CmdRAX(VueRegSet);
void CmdRBX(VueRegSet);
void CmdRCX(VueRegSet);
void CmdRBP(VueRegSet);
void CmdRDX(VueRegSet);
void CmdRSP(VueRegSet);
void CmdRSI(VueRegSet);
void CmdRDI(VueRegSet);
void CmdRDS(VueRegSet);
void CmdRES(VueRegSet);
void CmdRSS(VueRegSet);
void CmdRCS(VueRegSet);
void CmdRIP(VueRegSet);
void CmdRF(VueRegSet);
void CmdScan(VueRegSet);
void CmdSysInfo(VueRegSet);
void CmdSearch(VueRegSet);
356
Introduction to AutoBios
void CmdSearchAscii(VueRegSet);
void CmdSearchByte(VueRegSet);
void CmdSearchWord(VueRegSet);
void CmdSearchDouble(VueRegSet);
void CmdSFRDUMPER(VueRegSet);
void CmdSnap(VueRegSet);
void CmdTypes(VueRegSet);
void CmdUser(VueRegSet);
void CmdWatch(VueRegSet);
void CmdTime(VueRegSet);
void CmdTrace(VueRegSet);
void CmdVectors(VueRegSet);
void CmdVideo(VueRegSet);
void CmdToCon(VueRegSet);
void CmdToLpt(VueRegSet);
void CmdObjectDump(VueRegSet);
357
Introduction to AutoBios
359
The C Programs
//--- The Global Descriptor Table for Switch Mode Operation ---
//
// This structure order is determined by the function call format.
// Do not alter it !!!!!!!!
typedef unsigned short Dummy;
360
Introduction to AutoBios
//==================================================================
char __based(__segname("_TEXT"))DelimiterList[];
enum { ChipFastGateA20 = 1,
ChipProtect, ChipFastCPU,
ChipFastResetCPU, ChipFastResetNPX,
};
enum { ChipInstalled = 1,
ChipStatus, ChipEnable,
ChipDisable,
};
361
The C Programs
362
Introduction to AutoBios
.NOLIST
;*************************************************************************
;
; [Copyright] Copyright (c) 1997 John O. Foster - All Rights reserved.
;
; [Product Name] AutoBios
;
; [Module Name] Bios assembly module prefix
;
; [Version] 3.00
;
; [Author] John O. Foster
;
; [Date] 04/11/94
;
; [File Name] BiosPrfx.INC
;
; [Description] This include file is used for the standard definitions
; [Description] for assembly language modules of the bios.
;
; It is used to define the segment names, the segment loading sequence,
; assorted macros, and location assignments.
;
; [History] 2.00 04/11/94 Original
;
;***************************************************************************
.model small,C
include bios.inc
CfgMasm
;--- Declare the segment sequence to insure that the Linker places
;--- them in the proper order !
.seq
363
The C Programs
CONST ENDS
;--- This assigns all the segments to a common group for the Linker
EXTERNDEF Restart2:near
EXTERNDEF Restart5:near
EXTERNDEF Restart9:near
EXTERNDEF Restart10:near
EXTERNDEF Reset:near
EXTERNDEF BiosPod:near ; pod module is a destination
EXTERNDEF ORG_FFF0:byte
EXTERNDEF VideoFont:byte
EXTERNDEF ResetHook:near
EXTERNDEF ChipHook1:near
EXTERNDEF ChipHook2:near
EXTERNDEF ChipHook3:near
EXTERNDEF ResumeResetHook:near
EXTERNDEF ResumeChipHook1:near
EXTERNDEF ResumeChipHook2:near
EXTERNDEF ResumeChipHook3:near
;--- This macro is used to simplify typing in the desired values ---
; for cmos initialization values
364
Introduction to AutoBios
endm
IF CfgCheckPoint
CheckPoint macro arg
mov al,arg
out CfgCheckPointPort,al
endm
ELSE
CheckPoint macro arg
endm
ENDIF
delay macro
jmp $+2
endm
send_eoi macro
push ax
mov al,20h
out 20h,al
delay
out 0a0h,al
pop ax
endm
365
The C Programs
; Bios Equates
.data
.LIST
.code
366
Introduction to AutoBios
367
The C Programs
include BiosPrfx.inc
_ATEXT SEGMENT
assume cs:DGROUP
DateStamp proc
BYTE '--/--/--',0
DateStamp endp
; These locations are loaded with the current date by biosdate during
; the build process.
_ATEXT ENDS
end
368
Introduction to AutoBios
include BiosPrfx.inc
.code
IFNDEF CfgPad ; This set the starting offset for the Bios
ORG 0000h
ELSE
ORG CfgPad
ENDIF
BiosStart proc
db ProductName
db " - Copyright (c) 1988-1997 John O. Foster"
db " - All Rights Reserved "
BiosStart endp
END
369
The C Programs
370
Introduction to AutoBios
include BiosPrfx.inc
_FILL SEGMENT
include Biosfill.inc
_FILL ENDS
end
371
Introduction to AutoBios
include BiosPrfx.inc
373
The C Programs
end
374
Introduction to AutoBios
375
Introduction to AutoBios
include BiosPrfx.inc
include chipasm.tmp
END
377
Introduction to AutoBios
379
The C Programs
These registers are both read/write, so two of these are used for passing parameters by the Bios. The
basic restart-type code is passed in location 0F of the CMOS-RAM, but an error-descriptive value is
passed in the page register port at 80, and a second argument may be passed in register port 88.
Notes for potential 386/376 users - The 386, as mentioned previously, has an enhanced mechanism for
switching between real and virtual modes, while the 376 assumes the virtual mode of operation from
reset, since it does not have the real-mode capability.
;---------------------------------------------------------------------
; [Copyright] Copyright (c) 1997 John O. Foster - All rights Reserved.
;
; [Product Name] AutoBios
;
; [Module Name] Virtual memory support (MASM)
;
; [Version] 3.00
;
; [Author] John O. Foster
;
; [Date] 04/11/94
;
; [File Name] Virtual.ASM
;
; [Language] MASM 6.11
;
; [Description]
;
; [History] 2.00 04/11/94 Original
;
;----------------------------------------------------------------------
include biosprfx.inc
DefaultShutDown macro
mov al,2 ; signify exception error
out CfgVirtualErrorPort,al
mov al,0feh
out Port8042Command,al
@@: hlt
jmp @B
endm
externdef RomIDTDescriptor:near
externdef NullRomIDTDescriptor:near
;---- these are opcodes to be used with the virtual support ------
380
Introduction to AutoBios
lds si,Vptr
CheckPoint(60h)
mov ax,VirtualEnableBit
lmsw ax ; goto virtual mode
381
The C Programs
mov ax,55aah
xchg es:[0fffeh],ax
xchg es:[0fffeh],ax
.BREAK .IF (ax != 55aah)
endif
.ENDW
sub dx,StartLoc ; rejustify to "0000"
shl dx,6 ; example 256K = 100h
; This is the real 386/486 return from the ext mem test
mov eax,0
mov CR3,eax
mov eax,CR0
and eax,07ffffffeh
mov CR0,eax
382
Introduction to AutoBios
pop es
pop ds
popa
INVOKE ChipFunction,ChipFastGateA20,ChipDisable
.IF(ax != True)
INVOKE NormalGateA20,DisableA20Command
.IF(ax != True)
mov al,3
out CfgVirtualErrorPort,al
.ENDIF
.ENDIF
CheckPoint(65h)
in al,CfgVirtualErrorPort ; get error port to return
.IF (al == 0)
mov ax,True
.ELSE
mov ax,False
.ENDIF
ret
VirtualTestMasm endp
;--------------------------------------------------------------------
lds si,Vptr
383
The C Programs
mov ax,VirtualEnableBit
lmsw ax ; go into protected mode
;if CfgVirtualMoveVerify
mov cx,bx ; get copy of count
sub di,di
sub si,si
repe cmpsw
jcxz VerifyOk
mov al,55h ; use 55 for a verify error
out CfgVirtualErrorPort,al
VerifyOk:
;endif
if 0
in al,PortB ; see if a parity error on move
and al,ParityError
.IF (al != 0)
xchg ds:[di],ax ; re-write the bad word
xchg ds:[di],ax
mov al,1 ; set parity error code in bucket
out CfgVirtualErrorPort,al
in al,PortB
delay
or al,DisableParity ; reset parity
out PortB,al
delay
and al,EnableParity
out PortB,al
.ENDIF
endif
mov eax,0
mov CR3,eax
mov eax,CR0
and eax,07ffffffeh
384
Introduction to AutoBios
mov CR0,eax
dw next1
dw 0f000h
next1:
pop es
pop ds
popa
;----------------------------------------------------------------
lds si,Vptr
mov ax,VirtualEnableBit
lmsw ax ; go to protected mode
385
The C Programs
; These are the "continue" points for returning from virtual mode to
; real mode, when using the switch to virtual mode function above
; The User MUST disable both interrupts and NMI, and load V_OFFSET and
; V_SEGMENT with a valid continuation address. Then the user must
; load the restart code (5d or 10d (05h or 0ah)) in CMOS location
; xx, then cause a double fault exception to force a CPU reset. Not many
; users get involved in this.
; Programmers Opinion: If you really want to operate in virtual mode,
; get a 386 machine.
ShutDown proc
DefaultShutDown
ShutDown endp
end
386
Introduction to AutoBios
include Biosprfx.inc
387
The C Programs
ret
beep endp
end
388
Introduction to AutoBios
include BiosPrfx.inc
;----- calc the hdisk size - this uses some long unsigneds -----
end
389
Introduction to AutoBios
include BiosPrfx.inc
391
The C Programs
mov ax,True
.ENDIF
ret
ClockSetTime endp
end
392
Introduction to AutoBios
393
Introduction to AutoBios
include BiosPrfx.inc
end
395
Introduction to AutoBios
include BiosPrfx.inc
public CmosDefaultTable
CmosDefaultTable WordWordList {1,1}
ifdef CfgDisk1Type
if (CfgDisk1Type EQ 360)
DiskType = 10h
endif
if (CfgDisk1Type EQ 1200)
DiskType = 20h
endif
397
The C Programs
if (CfgDisk1Type EQ 720)
DiskType = 30h
endif
if (CfgDisk1Type EQ 1440)
DiskType = 40h
endif
if (CfgDisk1Type EQ 2880)
DiskType = 50h
endif
EquipTemp = 1
endif
ifdef CfgDisk2Type
if (CfgDisk2Type EQ 360)
DiskType = DiskType OR 01h
endif
if (CfgDisk2Type EQ 1200)
DiskType = DiskType OR 02h
endif
if (CfgDisk2Type EQ 720)
DiskType = DiskType OR 03h
endif
if (CfgDisk2Type EQ 1440)
DiskType = DiskType OR 04h
endif
if (CfgDisk2Type EQ 2880)
DiskType = DiskType OR 05h
endif
EquipTemp = 41h
endif
ifdef CfgVideoType
if (CfgVideoType EQ VGA)
EquipTemp = EquipTemp OR 00h
endif
if (CfgVideoType EQ CGA40)
EquipTemp = EquipTemp OR 10h
endif
if (CfgVideoType EQ CGA)
EquipTemp = EquipTemp OR 20h
endif
if (CfgVideoType EQ CGA80)
EquipTemp = EquipTemp OR 20h
endif
if (CfgVideoType EQ Mono)
EquipTemp = EquipTemp OR 30h
endif
endif
398
Introduction to AutoBios
ifdef CfgHard1Type
if CfgHard1Type LE 15
HardType = CfgHard1Type * 16
else
HardType = 0f0h
CmosDefaultValue CmosRegExtendedDriveC,CfgHard1Type
endif
endif
ifdef CfgHard2Type
if CfgHard2Type LE 15
HardType = HardType OR CfgHard2Type
else
HardType = HardType OR 00fh
CmosDefaultValue CmosRegExtendedDriveD,CfgHard2Type
endif
endif
CmosDefaultValue CmosRegHardDriveType,HardType
ifdef CfgHard47Cyls
ifdef CfgHard47Heads
ifdef CfgHard47Sectors
CmosDefaultValue CmosRegDrive47CylLow, LOW CfgHard47Cyls
CmosDefaultValue CmosRegDrive47CylHigh, HIGH CfgHard47Cyls
CmosDefaultValue CmosRegDrive47Heads, CfgHard47Heads
CmosDefaultValue CmosRegDrive47Sectors, CfgHard47Sectors
endif
endif
endif
ifdef CfgHard48Cyls
ifdef CfgHard48Heads
ifdef CfgHard48Sectors
CmosDefaultValue CmosRegDrive48CylLow, LOW CfgHard48Cyls
CmosDefaultValue CmosRegDrive48CylHigh, HIGH CfgHard48Cyls
CmosDefaultValue CmosRegDrive48Heads, CfgHard48Heads
CmosDefaultValue CmosRegDrive48Sectors, CfgHard48Sectors
endif
endif
endif
ifdef CfgBootOrder
CmosDefaultValue CmosRegOptionFlags, CfgBootOrder
else
CmosDefaultValue CmosRegOptionFlags, 0
endif
399
The C Programs
ifdef CfgBaseMem
CmosDefaultValue CmosRegBaseMemHigh, HIGH CfgBaseMem
CmosDefaultValue CmosRegBaseMemLow, LOW CfgBaseMem
endif
ifdef CfgExtMem
CmosDefaultValue CmosRegExtMemHigh, HIGH CfgExtMem
CmosDefaultValue CmosRegExtMemLow, LOW CfgExtMem
endif
ifdef CfgCmosData
dw CfgCmosData
endif
end
400
Introduction to AutoBios
include BiosPrfx.inc
public _ctype
public _ctype_
BYTE _C ; 000
BYTE _C ; 001
BYTE _C ; 002
401
The C Programs
BYTE _C ; 003
BYTE _C ; 004
BYTE _C ; 005
BYTE _C ; 006
BYTE _C ; 007
BYTE _C ; 008
BYTE _S+_C ; 009
BYTE _S+_C ; 00A
BYTE _S+_C ; 00B
BYTE _S+_C ; 00C
BYTE _S+_C ; 00D
BYTE _C ; 00E
BYTE _C ; 00F
BYTE _C ; 010
BYTE _C ; 011
BYTE _C ; 012
BYTE _C ; 013
BYTE _C ; 014
BYTE _C ; 015
BYTE _C ; 016
BYTE _C ; 017
BYTE _C ; 018
BYTE _C ; 019
BYTE _C ; 01A
BYTE _C ; 01B
BYTE _C ; 01C
BYTE _C ; 01D
BYTE _C ; 01E
BYTE _C ; 01F
BYTE _S+_B ; 020
BYTE _P ; 021
BYTE _P ; 022
BYTE _P ; 023
BYTE _P ; 024
BYTE _P ; 025
BYTE _P ; 026
BYTE _P ; 027
BYTE _P ; 028
BYTE _P ; 029
BYTE _P ; 02A
BYTE _P ; 02B
BYTE _P ; 02C
BYTE _P ; 02D
BYTE _P ; 02E
BYTE _P ; 02F
BYTE _N+_X ; 030
BYTE _N+_X ; 031
BYTE _N+_X ; 032
BYTE _N+_X ; 033
BYTE _N+_X ; 034
BYTE _N+_X ; 035
BYTE _N+_X ; 036
BYTE _N+_X ; 037
BYTE _N+_X ; 038
BYTE _N+_X ; 039
BYTE _P ; 03A
402
Introduction to AutoBios
BYTE _P ; 03B
BYTE _P ; 03C
BYTE _P ; 03D
BYTE _P ; 03E
BYTE _P ; 03F
BYTE _P ; 040
BYTE _U+_X ; 041
BYTE _U+_X ; 042
BYTE _U+_X ; 043
BYTE _U+_X ; 044
BYTE _U+_X ; 045
BYTE _U+_X ; 046
BYTE _U ; 047
BYTE _U ; 048
BYTE _U ; 049
BYTE _U ; 04A
BYTE _U ; 04B
BYTE _U ; 04C
BYTE _U ; 04D
BYTE _U ; 04E
BYTE _U ; 04F
BYTE _U ; 050
BYTE _U ; 051
BYTE _U ; 052
BYTE _U ; 053
BYTE _U ; 054
BYTE _U ; 055
BYTE _U ; 056
BYTE _U ; 057
BYTE _U ; 058
BYTE _U ; 059
BYTE _U ; 05A
BYTE _P ; 05B
BYTE _P ; 05C
BYTE _P ; 05D
BYTE _P ; 05E
BYTE _P ; 05F
BYTE _P ; 060
BYTE _L+_X ; 061
BYTE _L+_X ; 062
BYTE _L+_X ; 063
BYTE _L+_X ; 064
BYTE _L+_X ; 065
BYTE _L+_X ; 066
BYTE _L ; 067
BYTE _L ; 068
BYTE _L ; 069
BYTE _L ; 06A
BYTE _L ; 06B
BYTE _L ; 06C
BYTE _L ; 06D
BYTE _L ; 06E
BYTE _L ; 06F
BYTE _L ; 070
BYTE _L ; 071
BYTE _L ; 072
403
The C Programs
BYTE _L ; 073
BYTE _L ; 074
BYTE _L ; 075
BYTE _L ; 076
BYTE _L ; 077
BYTE _L ; 078
BYTE _L ; 079
BYTE _L ; 07A
BYTE _P ; 07B
BYTE _P ; 07C
BYTE _P ; 07D
BYTE _P ; 07E
BYTE _C ; 07F
BYTE 128 dup (0)
404
Introduction to AutoBios
405
The C Programs
or char,20h
.ENDIF
mov al,char
xor ah,ah
ret
ToLower endp
end
406
Introduction to AutoBios
;
; [Product Name] AutoBios
;
; [Module Name] MASM DelayCall Function
;
; [Version] 2.00
;
; [Author] John O. Foster
;
; [Date] 04/11/94
;
; [File Name] Delay.asm
;
; [Language] MS MASM 6.1x
;
; [Purpose] Provides Power-on routines
;
; [Functional Description]
;
; [History] 2.00 04/11/94 Original
;
;*****************************************************************
include BiosPrfx.inc
407
The C Programs
call read_timer_count
.UNTIL (ax <= cx) ; delay until current count <= calced count
.ELSE
.IF (res == Milliseconds)
mov cx,count ; this is major loop
.REPEAT
INVOKE DelayCall,1000,Microseconds
.UNTILCXZ ; repeat major loop for total counts
.ELSE
.IF (res == Seconds)
mov cx,count ; this is major loop
.REPEAT
INVOKE DelayCall,1000,Milliseconds
.UNTILCXZ ; repeat major loop for total counts
.ENDIF
.ENDIF
.ENDIF
ret
DelayCall endp
; Note: Remember that the counters in the 8253/8254 are down counters,
; so that we have to subtract the desired count from the current count.
; The tick timer runs in Mode 3, so that counts are decremented by two (2)
; on the falling edge of each clock pulse (every .8 usecs).
end
408
Introduction to AutoBios
include BiosPrfx.inc
if CfgHard
FDiskChain proc near ; sits at vector 13 if hdisk installed
.IF (dl & 80h)
jmp near ptr HDiskFunctionCall
.ELSE
int 40h
retf 2
.ENDIF
ret
FDiskChain endp
endif
;------------------------------------------------------------------
; returns the high order word of an unsigned long integer as an
; unsigned in ax
; unsigned GetHighOfLong(unsigned long)
;
if CfgHard
409
The C Programs
endif
end
410
Introduction to AutoBios
include BiosPrfx.inc
end
411
Introduction to AutoBios
include BiosPrfx.inc
end
413
Introduction to AutoBios
include BiosPrfx.inc
end
415
The C Programs
416
Introduction to AutoBios
include BiosPrfx.inc
end
417
Introduction to AutoBios
include BiosPrfx.inc
end
419
Introduction to AutoBios
include BiosPrfx.inc
DummyIret proc
iret
DummyIret endp
end
421
Introduction to AutoBios
include BiosPrfx.inc
end
423
Introduction to AutoBios
include BiosPrfx.inc
;unsigned GetChar(void);
GetChar proc
xor ax,ax
int 16h
ret
GetChar endp
;unsigned GetCharEcho(void);
GetCharEcho proc uses bx
xor ax,ax
int 16h
push ax
mov ah,0eh
mov bx,0
int 10h
pop ax
ret
GetCharEcho endp
425
The C Programs
end
426
Introduction to AutoBios
include BiosPrfx.inc
GetSS proc
mov ax,ss
ret
GetSS endp
GetSP proc
mov ax,sp
add ax,2 ; return value before the call
ret
GetSP endp
GetES proc
mov ax,es
ret
GetES endp
GetCS proc
mov ax,cs
ret
GetCS endp
427
The C Programs
GetDS proc
mov ax,ds
ret
GetDS endp
GetDH proc
mov al,dh
ret
GetDH endp
GetDL proc
mov al,dl
ret
GetDL endp
end
428
Introduction to AutoBios
include BiosPrfx.inc
end
429
Introduction to AutoBios
include BiosPrfx.inc
end
431
Introduction to AutoBios
include BiosPrfx.inc
IF CfgHard
; This is where the hard disk table can reside. There is room for
; 60-70 entries as needed. You may modify these entries to support
; the disk types you desire.
;ALIGN 16
public HDiskTable
433
The C Programs
; [Break]
; The SysVue "TYPES" Command looks for this following
; entry to sense the end of the hard drive parameter table.
drive_type -1,-1,-1,-1,-1,-1,-1 ; end of table
ENDIF
end
434
Introduction to AutoBios
include BiosPrfx.inc
BiosID proc
ifdef CfgBiosID
BYTE CfgBiosID,0
else
BYTE ProductName,0
endif
BiosID endp
VersionID proc
ifdef CfgProjectVersion
BYTE CfgProjectVersion,0
else
BYTE "Version 1.00 ",0
endif
VersionID endp
CustomerID proc
ifdef CfgProjectCustomer
BYTE CfgProjectCustomer,0
else
BYTE "Software Farm",0
endif
CustomerID endp
435
The C Programs
name_id proc
BYTE ProductName,0
name_id endp
PartNrID proc
ifdef CfgProjectPartNr
BYTE CfgProjectPartNr,0
else
BYTE "92xxxxx-xxxxx",0
endif
PartNrID endp
OwnerID proc
BYTE "Copyright (c) John O. Foster 1988-1997 - All Rights Reserved ",0
OwnerID endp
end
436
Introduction to AutoBios
include BiosPrfx.inc
;char KbTable[89][4];
; This table covers all keys.
;** Some keys are pre-checked for special handling.
;** Some special keys are padded out in this table.
;** The format is: base,upper,ctrl,alt cases.
;** The alt cases are handled as extended codes.
public KbTable
KbTable label byte
437
The C Programs
438
Introduction to AutoBios
end
439
Introduction to AutoBios
include BiosPrfx.inc
end
441
Introduction to AutoBios
include BiosPrfx.inc
443
The C Programs
ret
RepeatOut endp
end
444
Introduction to AutoBios
include BiosPrfx.inc
445
The C Programs
ret
CheckSumOK endp
;-- this is the far call routine called by 'C' rom scan ---
end
446
Introduction to AutoBios
include BiosPrfx.inc
end
447
Introduction to AutoBios
include BiosPrfx.inc
EXTERNDEF SystemConfigurationTable:NEAR
SystemConfigurationTable LABEL NEAR
ifdef CfgTypeParms
BYTE CfgTypeParms
else
WORD 8 ; length of table in BYTEs
BYTE 0fch ; model BYTE
BYTE 01h ; sub model BYTE
BYTE 0 ; bios level
BYTE 70h ; DMA 3,cascade 8259, rtc clock
BYTE 4 dup(0); spares
endif
end
449
Introduction to AutoBios
include BiosPrfx.inc
451
The C Programs
BYTE 066h,066h,066h,066h,066h,000h,066h,000h ; 13 - ^S
BYTE 07fh,0dbh,0dbh,07bh,01bh,01bh,01bh,000h ; 14 - ^T
BYTE 03eh,063h,038h,06ch,06ch,038h,0cch,078h ; 15 - ^U
BYTE 000h,000h,000h,000h,07eh,07eh,07eh,000h ; 16 - ^V
BYTE 018h,03ch,07eh,018h,07eh,03ch,018h,0ffh ; 17 - ^W
BYTE 018h,03ch,07eh,018h,018h,018h,018h,000h ; 18 - ^X
BYTE 018h,018h,018h,018h,07eh,03ch,018h,000h ; 19 - ^Y
BYTE 000h,018h,00ch,0feh,00ch,018h,000h,000h ; 1A - ^Z
BYTE 000h,030h,060h,0feh,060h,030h,000h,000h ; 1B - ^[
BYTE 000h,000h,0c0h,0c0h,0c0h,0feh,000h,000h ; 1C - ^\
BYTE 000h,024h,066h,0ffh,066h,024h,000h,000h ; 1D - ^]
BYTE 000h,018h,03ch,07eh,0ffh,0ffh,000h,000h ; 1E - ^6
BYTE 000h,0ffh,0ffh,07eh,03ch,018h,000h,000h ; 1F - ^-
BYTE 000h,000h,000h,000h,000h,000h,000h,000h ; 20 - spc
BYTE 030h,078h,078h,030h,030h,000h,030h,000h ; 21 - !
BYTE 06ch,06ch,06ch,000h,000h,000h,000h,000h ; 22 - "
BYTE 06ch,06ch,0feh,06ch,0feh,06ch,06ch,000h ; 23 - #
BYTE 030h,07ch,0c0h,078h,00ch,0f8h,030h,000h ; 24 - $
BYTE 000h,0c6h,0cch,018h,030h,066h,0c6h,000h ; 25 - %
BYTE 038h,06ch,038h,076h,0dch,0cch,076h,000h ; 26 - &
BYTE 060h,060h,0c0h,000h,000h,000h,000h,000h ; 27 - '
BYTE 018h,030h,060h,060h,060h,030h,018h,000h ; 28 - (
BYTE 060h,030h,018h,018h,018h,030h,060h,000h ; 29 - )
BYTE 000h,066h,03ch,0ffh,03ch,066h,000h,000h ; 2A - *
BYTE 000h,030h,030h,0fch,030h,030h,000h,000h ; 2B - +
BYTE 000h,000h,000h,000h,000h,030h,030h,060h ; 2C - ,
BYTE 000h,000h,000h,0fch,000h,000h,000h,000h ; 2D - -
BYTE 000h,000h,000h,000h,000h,030h,030h,000h ; 2E - .
BYTE 006h,00ch,018h,030h,060h,0c0h,080h,000h ; 2F - /
BYTE 07ch,0c6h,0ceh,0deh,0f6h,0e6h,07ch,000h ; 30 - 0
BYTE 030h,070h,030h,030h,030h,030h,0fch,000h ; 31 - 1
BYTE 078h,0cch,00ch,038h,060h,0cch,0fch,000h ; 32 - 2
BYTE 078h,0cch,00ch,038h,00ch,0cch,078h,000h ; 33 - 3
BYTE 01ch,03ch,06ch,0cch,0feh,00ch,01eh,000h ; 34 - 4
BYTE 0fch,0c0h,0f8h,00ch,00ch,0cch,078h,000h ; 35 - 5
BYTE 038h,060h,0c0h,0f8h,0cch,0cch,078h,000h ; 36 - 6
BYTE 0fch,0cch,00ch,018h,030h,030h,030h,000h ; 37 - 7
BYTE 078h,0cch,0cch,078h,0cch,0cch,078h,000h ; 38 - 8
BYTE 078h,0cch,0cch,07ch,00ch,018h,070h,000h ; 39 - 9
BYTE 000h,030h,030h,000h,000h,030h,030h,000h ; 3A - :
BYTE 000h,030h,030h,000h,000h,030h,030h,060h ; 3B - ;
BYTE 018h,030h,060h,0c0h,060h,030h,018h,000h ; 3C - <
BYTE 000h,000h,0fch,000h,000h,0fch,000h,000h ; 3D - =
BYTE 060h,030h,018h,00ch,018h,030h,060h,000h ; 3E - >
BYTE 078h,0cch,00ch,018h,030h,000h,030h,000h ; 3F - ?
BYTE 07ch,0c6h,0deh,0deh,0deh,0c0h,078h,000h ; 40 - @
BYTE 030h,078h,0cch,0cch,0fch,0cch,0cch,000h ; 41 - A
BYTE 0fch,066h,066h,07ch,066h,066h,0fch,000h ; 42 - B
BYTE 03ch,066h,0c0h,0c0h,0c0h,066h,03ch,000h ; 43 - C
BYTE 0f8h,06ch,066h,066h,066h,06ch,0f8h,000h ; 44 - D
BYTE 0feh,062h,068h,078h,068h,062h,0feh,000h ; 45 - E
BYTE 0feh,062h,068h,078h,068h,060h,0f0h,000h ; 46 - F
BYTE 03ch,066h,0c0h,0c0h,0ceh,066h,03eh,000h ; 47 - G
BYTE 0cch,0cch,0cch,0fch,0cch,0cch,0cch,000h ; 48 - H
BYTE 078h,030h,030h,030h,030h,030h,078h,000h ; 49 - I
BYTE 01eh,00ch,00ch,00ch,0cch,0cch,078h,000h ; 4A - J
452
Introduction to AutoBios
BYTE 0e6h,066h,06ch,078h,06ch,066h,0e6h,000h ; 4B - K
BYTE 0f0h,060h,060h,060h,062h,066h,0feh,000h ; 4C - L
BYTE 0c6h,0eeh,0feh,0feh,0d6h,0c6h,0c6h,000h ; 4D - M
BYTE 0c6h,0e6h,0f6h,0deh,0ceh,0c6h,0c6h,000h ; 4E - N
BYTE 038h,06ch,0c6h,0c6h,0c6h,06ch,038h,000h ; 4F - O
BYTE 0fch,066h,066h,07ch,060h,060h,0f0h,000h ; 50 - P
BYTE 078h,0cch,0cch,0cch,0dch,078h,01ch,000h ; 51 - Q
BYTE 0fch,066h,066h,07ch,06ch,066h,0e6h,000h ; 52 - R
BYTE 078h,0cch,0e0h,070h,01ch,0cch,078h,000h ; 53 - S
BYTE 0fch,0b4h,030h,030h,030h,030h,078h,000h ; 54 - T
BYTE 0cch,0cch,0cch,0cch,0cch,0cch,0fch,000h ; 55 - U
BYTE 0cch,0cch,0cch,0cch,0cch,078h,030h,000h ; 56 - V
BYTE 0c6h,0c6h,0c6h,0d6h,0feh,0eeh,0c6h,000h ; 57 - W
BYTE 0c6h,0c6h,06ch,038h,038h,06ch,0c6h,000h ; 58 - X
BYTE 0cch,0cch,0cch,078h,030h,030h,078h,000h ; 59 - Y
BYTE 0feh,0c6h,08ch,018h,032h,066h,0feh,000h ; 5A - Z
BYTE 078h,060h,060h,060h,060h,060h,078h,000h ; 5B - [
BYTE 0c0h,060h,030h,018h,00ch,006h,002h,000h ; 5C - \
BYTE 078h,018h,018h,018h,018h,018h,078h,000h ; 5D - ]
BYTE 010h,038h,06ch,0c6h,000h,000h,000h,000h ; 5E - ^
BYTE 000h,000h,000h,000h,000h,000h,000h,0ffh ; 5F - _
BYTE 030h,030h,018h,000h,000h,000h,000h,000h ; 60 - '
BYTE 000h,000h,078h,00ch,07ch,0cch,076h,000h ; 61 - a
BYTE 0e0h,060h,060h,07ch,066h,066h,0dch,000h ; 62 - b
BYTE 000h,000h,078h,0cch,0c0h,0cch,078h,000h ; 63 - c
BYTE 01ch,00ch,00ch,07ch,0cch,0cch,076h,000h ; 64 - d
BYTE 000h,000h,078h,0cch,0fch,0c0h,078h,000h ; 65 - e
BYTE 038h,06ch,060h,0f0h,060h,060h,0f0h,000h ; 66 - f
BYTE 000h,000h,076h,0cch,0cch,07ch,00ch,0f8h ; 67 - g
BYTE 0e0h,060h,06ch,076h,066h,066h,0e6h,000h ; 68 - h
BYTE 030h,000h,070h,030h,030h,030h,078h,000h ; 69 - i
BYTE 00ch,000h,00ch,00ch,00ch,0cch,0cch,078h ; 6A - j
BYTE 0e0h,060h,066h,06ch,078h,06ch,0e6h,000h ; 6B - k
BYTE 070h,030h,030h,030h,030h,030h,078h,000h ; 6C - l
BYTE 000h,000h,0cch,0feh,0feh,0d6h,0c6h,000h ; 6D - m
BYTE 000h,000h,0f8h,0cch,0cch,0cch,0cch,000h ; 6E - n
BYTE 000h,000h,078h,0cch,0cch,0cch,078h,000h ; 6F - o
BYTE 000h,000h,0dch,066h,066h,07ch,060h,0f0h ; 70 - p
BYTE 000h,000h,076h,0cch,0cch,07ch,00ch,01eh ; 71 - q
BYTE 000h,000h,0dch,076h,066h,060h,0f0h,000h ; 72 - r
BYTE 000h,000h,07ch,0c0h,078h,00ch,0f8h,000h ; 73 - s
BYTE 010h,030h,07ch,030h,030h,034h,018h,000h ; 74 - t
BYTE 000h,000h,0cch,0cch,0cch,0cch,076h,000h ; 75 - u
BYTE 000h,000h,0cch,0cch,0cch,078h,030h,000h ; 76 - v
BYTE 000h,000h,0c6h,0d6h,0feh,0feh,06ch,000h ; 77 - w
BYTE 000h,000h,0c6h,06ch,038h,06ch,0c6h,000h ; 78 - x
BYTE 000h,000h,0cch,0cch,0cch,07ch,00ch,0f8h ; 79 - y
BYTE 000h,000h,0fch,098h,030h,064h,0fch,000h ; 7A - z
BYTE 01ch,030h,030h,0e0h,030h,030h,01ch,000h ; 7B - {
BYTE 018h,018h,018h,000h,018h,018h,018h,000h ; 7C - |
BYTE 0e0h,030h,030h,01ch,030h,030h,0e0h,000h ; 7D - }
BYTE 076h,0dch,000h,000h,000h,000h,000h,000h ; 7E - ~
BYTE 000h,010h,038h,06ch,0c6h,0c6h,0feh,000h ; 7F -
end
453
The C Programs
454
Introduction to AutoBios
include BiosPrfx.inc
VideoGetMode proc
mov ah,0fh
push bp
int 10h
pop bp
ret
VideoGetMode endp
455
The C Programs
pop bp
ret
VideoSetCursor endp
456
Introduction to AutoBios
int 10h
pop bp
ret
VideoScrollUp endp
end
457
Introduction to AutoBios
include BiosPrfx.inc
459
The C Programs
460
Introduction to AutoBios
end
461
Introduction to AutoBios
7. The C Programs
These are the modules of the Bios which are in C. They include the Function Calls and the Interrupt
Service Routines.
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] The Bios List Collection
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Lists.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] This is the collection of Lists used for Bios
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
463
The C Programs
{"OV",OVbit, },
{"DN",DNbit, },
{"EI",EIbit, },
{"TF",TFbit, },
{"NG",NGbit, },
{"ZR",ZRbit, },
{"AC",ACbit, },
{"PE",PEbit, },
{"CY",CYbit, },
{"" ,0, },
};
// This list is used for a bit position mask for various routines
464
Introduction to AutoBios
{"10",0x0400, },
{"9", 0x0200, },
{"8", 0x0100, },
{"7", 0x0080, },
{"6", 0x0040, },
{"5", 0x0020, },
{"4", 0x0010, },
{"3", 0x0008, },
{"2", 0x0004, },
{"1", 0x0002, },
{"0", 0x0001, },
{"", 0, },
};
465
The C Programs
{ "SS",sssave, },
{ "SP",spsave, },
{ "IP",ipsave, },
{ "",0,},
};
//--------------------------------------------------------------
//void LengthAddition(void);
//void PointerDetection(void);
//----- this is the text list for the floppy drive types --------
466
Introduction to AutoBios
{ "CmosRegDayOfWeek", CmosRegDayOfWeek, },
{ "CmosRegDayOfMonth", CmosRegDayOfMonth, },
{ "CmosRegMonth", CmosRegMonth, },
{ "CmosRegYear", CmosRegYear, },
{ "CmosRegStatusA", CmosRegStatusA, },
{ "CmosRegStatusB", CmosRegStatusB, },
{ "CmosRegStatusC", CmosRegStatusC, },
{ "CmosRegStatsuD", CmosRegStatusD, },
{ "CmosRegDiagnosticStatus", CmosRegDiagnosticStatus, },
{ "CmosRegRestartStatus", CmosRegRestartStatus, },
{ "CmosRegDiskDriveType", CmosRegDiskDriveType, },
{ "CmosRegOptionFlags", CmosRegOptionFlags, },
{ "CmosRegHardDriveType", CmosRegHardDriveType, },
{ "CmosRegEquipment", CmosRegEquipment, },
{ "CmosRegBaseMemLow", CmosRegBaseMemLow, },
{ "CmosRegBaseMemHigh", CmosRegBaseMemHigh, },
{ "CmosRegExtMemLow", CmosRegExtMemLow, },
{ "CmosRegExtMemHigh", CmosRegExtMemHigh, },
{ "CmosRegExtendedDriveC", CmosRegExtendedDriveC, },
{ "CmosRegExtendedDriveD", CmosRegExtendedDriveD, },
{ "CmosRegChecksumHigh", CmosRegChecksumHigh, },
{ "CmosRegChecksumLow", CmosRegChecksumLow, },
{ "CmosRegExtMemFoundLow", CmosRegExtMemFoundLow, },
{ "CmosRegExtMemFoundHigh", CmosRegExtMemFoundHigh, },
{ "CmosRegCentury", CmosRegCentury, },
{ "CmosRegInformationFlags", CmosRegInformationFlags, },
{ "CmosRegDrive47CylLow", CmosRegDrive47CylLow, },
{ "CmosRegDrive47CylHigh", CmosRegDrive47CylHigh, },
{ "CmosRegDrive47Heads", CmosRegDrive47Heads, },
{ "CmosRegDrive47Sectors", CmosRegDrive47Sectors, },
{ "CmosRegDrive48CylLow", CmosRegDrive48CylLow, },
{ "CmosRegDrive48CylHigh", CmosRegDrive48CylHigh, },
{ "CmosRegDrive48Heads", CmosRegDrive48Heads, },
{ "CmosRegDrive48Sectors", CmosRegDrive48Sectors, },
{ "", 0, },
};
//------------------------------------------------
// This is a prototype for an index list for the stored registers
struct NameValueList RegisterIndexList[] =
{
{"AX",axsave,},
{"EAX",eaxsave,},
{"BX",bxsave,},
{"EBX",ebxsave,},
467
The C Programs
{"CX",cxsave,},
{"ECX",ecxsave,},
{"DX",dxsave,},
{"EDX",edxsave,},
{"SP",spsave,},
{"ESP",espsave,},
{"BP",bpsave,},
{"EBP",ebpsave,},
{"SI",sisave,},
{"ESI",esisave,},
{"DI",disave,},
{"EDI",edisave,},
{"DS",dssave,},
{"ES",essave,},
{"SS",sssave,},
{"CS",cssave,},
{"IP",ipsave,},
{"EIP",eipsave,},
{"PSW",pswsave,},
{"EPSW",epswsave,},
{"" ,0, },
};
//----------------------------------------------------
struct NameValueList RegisterTokenList[] =
{
{"AX",axsave,},
{"BX",bxsave,},
{"CX",cxsave,},
{"DX",dxsave,},
{"SP",spsave,},
{"BP",bpsave,},
{"SI",sisave,},
{"DI",disave,},
{"DS",dssave,},
{"ES",essave,},
{"SS",sssave,},
{"CS",cssave,},
{"IP",ipsave,},
{"PSW",pswsave,},
{"" ,0, },
};
468
Introduction to AutoBios
{"EIP",eipsave,},
{"EPSW",epswsave,},
{"" ,0, },
};
//--------------------------------------------
//---------------------------------------------
#define ExceptionDivideError 0
#define ExceptionDebugInterrupt 1
#define ExceptionNMI 2
#define ExceptionBreakpoint 3
#define ExceptionINTO 4
#define ExceptionBound 5
#define ExceptionInvalidOpcode 6
#define ExceptionNoNPX 7
#define ExceptionDoubleFault 8
#define ExceptionNpxSegmentOverrun 9
#define ExceptionInvalidTSS 10
#define ExceptionNoSegment 11
#define ExceptionStack 12
#define ExceptionGeneral 13
#define ExceptionPageFault 14
#define ExceptionNpxError 16
#define ExceptionAlignment 17
469
The C Programs
470
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Misc. functions
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Misc.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] This module includes miscellaneous functions used
// [Description] by various modules.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
/* L O C A L C O N S T A N T S */
/* P R O G R A M S */
unsigned GetCmosSystemMemorySize()
{
unsigned Temp = InCmos(CmosRegBaseMemHigh); Temp <<= 8;
return(Temp |= InCmos(CmosRegBaseMemLow));
}
471
The C Programs
unsigned GetCmosExtendedMemorySize()
{
unsigned Temp = InCmos(CmosRegExtMemHigh); Temp <<= 8;
return(Temp |= InCmos(CmosRegExtMemLow));
}
unsigned GetCmosExtendedMemory()
{
unsigned Temp = InCmos(CmosRegExtMemFoundHigh); Temp <<= 8;
return(Temp |= InCmos(CmosRegExtMemFoundLow));
}
void DisplaySystemMemory(void)
{
unsigned j;
printf("%5d",j = GetCmosSystemMemorySize());
}
void DisplayExtendedMemory(void)
{
unsigned j;
printf("%5d",j = GetCmosExtendedMemorySize());
}
472
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Power on diagnostics
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] POD.C
//
// [Language] MSVC 1.5
//
// [Description] This module does the power on diagnostics and
// [Description] initialization. When it finishes, it does a
// [Description] bootstrap to load the system.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
// I N C L U D E F I L E S
#include "Bios.h"
// F U N C T I O N P R O T O T Y P E S
473
The C Programs
unsigned RomCheckSumRoutine(ActionArgument);
unsigned PrintSignonMessages(ActionArgument);
unsigned DummyActionTrue(ActionArgument);
unsigned GamePortSetup(ActionArgument);
// G L O B A L V A R I A B L E S
// G L O B A L C O N S T A N T S
// L O C A L D E F I N I T I O N S
struct PortTable
{
unsigned char Port;
unsigned char Value;
};
474
Introduction to AutoBios
{ 0xa1,0x01, }, // icw4
{ 0xa1,0xff, }, // disable all interrupts
{ 0, 0, },
};
//---------------------------------------
#if CfgVideo
{ MsgVideo, VideoSetup, },
#endif
{ "", PrintSignonMessages, },
// These dummys provide a signon message after the setup has been performed
#if CfgVideo
{ MsgVideo, DummyActionTrue, },
#endif
475
The C Programs
{ MsgEquipmentService, DummyActionTrue, },
// ---------------------------------------------------------
{ MsgTimerService, TimerSetup, },
{ MsgKeyboardService, KeyboardSetup, },
{ MsgSysVue, SysVueSetup, },
{ MsgMemorySizeService, MemSizeSetup, },
{ MsgTimeOfDayService, TimeOfDaySetup, },
//#if CfgPrintScreen
{ MsgPrintScreenService, PrintScreenSetup, },
//#endif
{ MsgSystemServices, SystemServicesSetup, },
{ MsgBootstrapService, BootSetup, },
{ MsgSizeAndTestMemory, MemoryTestRoutine, },
{ MsgMoveSystemObject, MoveSysObjectRoutine, },
{ MsgExtendedMemory, ExtMemTest, },
{ MsgRomChecksum, RomCheckSumRoutine, },
{ MsgLptService, LptSetup, },
#if CfgGame
{ MsgGame Port Check, GamePortSetup, },
#endif
{ MsgFloppyDiskService, FDiskSetup, },
{ MsgHardDiskService, HDiskSetup, },
{ MsgRomScan, RomScanRoutine, },
{ "",0, },
};
// P R O G R A M
void BiosPod(void)
{
struct _BiosRam far * LowRam = 0;
struct _SystemObject far * System;
struct _BiosObject far * Bios;
void (interrupt far * Boot) (void);
LoadDS();
476
Introduction to AutoBios
CheckPoint(0x01);
#if CfgQuietPost
ResetFlag = 0x1234;
#endif
CheckPoint(0x02);
Bios = GetBiosObject();
Bios->FlagMaster[Snap].Master = SnapMasterPattern;
Bios->FlagMaster[Watch].Master = WatchMasterPattern;
Bios->FlagMaster[Log].Master = LogMasterPattern;
// need some new code to boot from a list in the cfg block parms
}
}
477
The C Programs
_asm
{
_asm mov ax,0f000h
_asm push ax
_asm mov ax,OFFSET templabel
_asm push ax
_asm retf
};
templabel:
if(SrcPtr != 0x0f) // These may be PIC spurious signals
{
LoadDS();
#if CfgUnexpecIntDisplay
printf("\nUnexpected Interrupt %4x at %p",SrcPtr,Codestream);
if(ValueExists(SrcPtr,ExceptionList))
{
printf(" - Type is: %s", GetName(SrcPtr,ExceptionList));
};
#endif
#if CfgUnexpecIntTrap
Trap(); // optional for debugging
#endif
};
};
//---------------------------------------------------------------
478
Introduction to AutoBios
unsigned Result;
unsigned char far * TempPtr; // used for results of get name checks
LoadDS();
//CheckPoint(0x03);
// If not a NULL PTR, return indicating actions not performed
if(!ActionTable) return(False);
// Call the Init Routine, and look for a Return Status reply
Result = (* fptr)(&ActionTable[Index]);
if (Cold())
{
if((TempPtr = GetName(Result,SetupMessageList)) != 0)
printf("%s",TempPtr);
}
else // !Cold
{
switch (Result)
{
case SetupStatusOK:
case SetupStatusStub:
case SetupStatusNul:
// Treat these cases as succesful, so no error print
break;
default:
printf("%s",ActionTable[Index].ActionMessage);
if((TempPtr = GetName(Result,SetupMessageList)) != 0)
printf("%s",TempPtr);
break;
}
}
}
else
{
//CheckPoint(0x012);
// An Init Routine associated with the name was not specified
//printf("\nAction Item: \"%s\" Not found in Action Table \"%s\"",
//
ActionTable[Index].ActionString,ActionTable[0].ActionString);
};
479
The C Programs
//CheckPoint(0x013);
}
return(True);
};
//--------------------------------------------------------------
unsigned CreateSystemObjectRoutine(ActionArgument)
{
struct _SystemObject far * System;
LoadDS();
CheckPoint(0x014);
SystemSegmentPointer = FP_SEG(System);
CheckPoint(0x015);
return(SetupStatusNul);
};
//-----------------------------------------------------------
unsigned MoveSysObjectRoutine(ActionArgument)
{
struct _SystemObject far * System;
unsigned long OldPtr = (unsigned long)(GetSystemObject());
SystemSegmentPointer = 0;
480
Introduction to AutoBios
}
return(SetupStatusOK);
};
//---------------------------------------------------------------
SendEOI2();
};
unsigned LoadVectors(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
unsigned Index;
481
The C Programs
LoadDS();
CheckPoint(0x016);
CheckPoint(0x017);
#if CfgPlatformAT
// Load PIC 2 vectors with eoi & iret
for(Index = 0x70; Index <= 0x77; Index++)
{
LowRam->IntVector[Index] = (void near *) DummyEOI2;
}
482
Introduction to AutoBios
_enable();
CheckPoint(0x018);
return(SetupStatusOK);
};
//----------------------------------------------------------
//----------------------------------------------------------
unsigned PrintSignonMessages(ActionArgument)
{
#if CfgUserSignonMessage
printf("%s",UserMessage0);
printf("%s",UserMessage1);
printf("%s",UserMessage2);
printf("%s",UserMessage3);
printf("%s",UserMessage4);
printf("%s",UserMessage5);
printf("%s",UserMessage6);
printf("%s",UserMessage7);
#else
printf("\a\n%s\nVersion %s - %s - Part # %s - %s",
(void far *)OwnerID,
(void far *)VersionID,
(void far *)CustomerID,
(void far *)PartNrID,
(void far *)DateStamp);
printf("%q\nBios at...............%4x",GetCS());
#endif
return(SetupStatusNul);
};
//-----------------------------------------------------
//-------------------------------------------------------
unsigned MemoryTestRoutine(ActionArgument)
{
register Index = 0;
printf("%q %4d",Index);
for (Index = 64;
(Index < CfgMaxMem) &&
(RamTestOK(Index << 6,CfgMemTestGranularity,CfgMemTestPatternBias));
MemorySizeWord = (Index += CfgMemTestGranularity),
printf("%q\b\b\b\b\b %4d",Index));
return(SetupStatusNul);
};
/*-----------------------------------------------------
483
The C Programs
Check for optional rom modules from c8000 -> beginning of bios
in 2k increments. A valid module has'55aa' in the first 2 locations,
length indicator (length/512) in the 3rd location, and test/init.
Code starts in the 4th location. These modules may adjust the mem
size downward to reserve System ram memory.
--------------------------------------------------------*/
unsigned RomScanRoutine(ActionArgument)
{
unsigned Index;
LoadDS();
unsigned RomCheckSumRoutine(ActionArgument)
{
return(CheckSumBiosOK()?SetupStatusOK:SetupStatusError);
}
//------------------------------------------------------
unsigned InitPeripherals(ActionArgument)
{
//------- setup the 8255 if one exists ------------
CheckPoint(0x019);
PortWrite(PIOInitTable);
CheckPoint(0x020);
PortWrite(DmaInitTable);
CheckPoint(0x021);
484
Introduction to AutoBios
PortWrite(PICInitTable);
CheckPoint(0x022);
PortWrite(PITInitTable);
CheckPoint(0x023);
return(SetupStatusOK);
};
unsigned GamePortSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
//---------------------------------------------------------
485
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] equipment function
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Equi.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] Interrupt 0x11 - get equipment configuration
//
// This function call returns an equipment configuration word.
//
// The equip_flag variable is set during the power on.
//
// Returns the Equipment Word in AX:
//
// Bit Description
// 15,14 number of printers attached
// 13 = 0
// 12 = 1 = game port attached
// 11,10,9 number of rs232 cards attached
// 8 = 0
// 7,6 number of diskette drives
// 00=1, 01=2, 10=3, 11=4 only if bit 0 = 1
// 5,4 initial video mode
// 00 - no video adapter
// 01 - 40x25 bw using color card
// 10 - 80x25 bw using color card
// 11 - 80x25 bw using bw card
// 3,2 not used
// 1 0/1 = no 8087/8087
// 0 0/1 = boot from int 18/floppy disk
//
// [Arguments] None
//
// [Return] Equipment word in AX
//
487
The C Programs
/* I N C L U D E F I L E S */
#include "Bios.h"
/* G L O B A L S */
/* L O C A L D E F I N I T I O N S */
/* P R O G R A M */
unsigned EquipmentSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
LoadDS();
CheckPoint(0xa0);
_disable();
LowRam->IntVector[0x11]= (void near *)EquipmentFunctionCall;
_enable();
CheckPoint(0xa1);
return(True);
}
488
Introduction to AutoBios
//---------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] memory size function
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Mem.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] Interrupt 12h - get memory size
//
// This function call returns the amount of System RAM in AX.
// The value indicates the number of 1024 byte blocks of RAM.
//
// [Arguments] None
//
// [Return] Mem size in AX
//
// [History] 2.00 04/11/94 Original
//
//------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
/* P R O G R A M */
unsigned MemSizeSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
LoadDS();
_disable();
LowRam->IntVector[0x12]= (void near *) MemSizeFunctionCall;
_enable();
489
The C Programs
return(SetupStatusOK);
}
490
Introduction to AutoBios
If a non-standard keyboard or alternate input device is being used, it is suggested that the keyboard
function call structure be retained. The application will then be independent of the hardware
characteristics of the actual input device, and may be exercised in a development environment with the
standard keyboard input device.
//-------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Keyboard Driver
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Keyboard.c
//
// [Language] MSVC 1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
/* G L O B A L V A R I A B L E S */
491
The C Programs
/* G L O B A L C O N S T A N T S */
/* L O C A L D E F I N I T I O N S */
#if defined(CfgKBXT)
//#if (CfgChipName == AMD286LX)
// #define KeyControlPort 0x64
//#else
#define KeyControlPort 0x61
//#endif
#else
#define KeyControlPort 0x61
#endif
492
Introduction to AutoBios
#define NumPad6Key 77
#define NumPad7Key 71
#define NumPad8Key 72
#define NumPad9Key 73
#define MinusKey 74
#define PlusKey 78
#define InsertKey 82
#define DeleteKey 83
#define SysReqKey 84
/* L O C A L C O N S T A N T S */
493
The C Programs
494
Introduction to AutoBios
#endif
/* P R O G R A M */
/*==========================================*/
/*==========================================*/
/* Interrupt 16h - Keyboard function call */
/*==========================================*/
/*==========================================*/
/*-----------------------------------------------*/
unsigned KeyboardSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
struct _BiosObject far * Bios = GetBiosObject();
unsigned status = SetupStatusOK;
LoadDS();
_disable();
LowRam->IntVector[0x16]= (void near *)KeyboardFunctionCall;
#if CfgKeyboard
LowRam->IntVector[0x09]= (void near *)KeyboardInterruptServiceRoutine;
#endif
// The Dummy Iret is installed since the keyboard is installed
// before the System Services, which will replace this vector.
LowRam->IntVector[0x15]= (void near *)DummyIret;
_enable();
LowRam->KbBufferHead = 0x1e;
LowRam->KbBufferTail = 0x1e;
LowRam->KbBufferStart = 0x1e;
LowRam->KbBufferEnd = 0x3e;
#if CfgKeyboard
outp(0x21,inp(0x21) & ~0x03);
#if CfgKeyboardStyleAT
if(!Reset8042()) { status = SetupStatusError; printf("...Reset 8042
failed..."); };
#else
outp(KeyControlPort,inp(KeyControlPort) | 0xc0);
outp(KeyControlPort,inp(KeyControlPort) & ~ 0x80);
495
The C Programs
#if CfgKeyboardStyleAT
EnableKeyboard();
#endif
#endif
LowRam->KbFlagByte = 0; /* reset the flags */
LowRam->KbFlagByte1 = 0;
LowRam->KbFlagByte2 = 0;
LowRam->KbFlagByte3 = 0;
Bios->DevicesInstalled |= Device;
return(status);
}
/*==========================================*/
_enable ();
switch(Regs->RegAH)
{
case OpcodeWaitForKey:
LowRam->KbBufferHead += 2;
case OpcodeCheckForKey:
_disable();
Regs->RegFlags &= ~ZeroBit; /* clear only the zero bit in the
flags */
496
Introduction to AutoBios
case OpcodeStoreKeyData:
_disable();
Regs->RegAL = 0; Regs->RegFlags &= ~CarryBit;
if(!LoadBuffer(Regs->RegCX)) { Regs->RegAL = 1; Regs->RegFlags |=
CarryBit; };
_enable();
break;
case OpcodeReadExtendedInput:
//printf("\nKB - Read Extended Input Call");
while (LowRam->KbBufferHead == LowRam->KbBufferTail)
{
_enable();
NoOpcode; NoOpcode; NoOpcode;
_disable();
};
LowRam->KbBufferHead += 2;
case OpcodeReadExtendedStatus:
//printf("\nKB - Read Extended Status Call");
_disable();
Regs->RegFlags &= ~ZeroBit; /* clear only the zero bit in the flags */
case OpcodeReadExtendedShift:
//printf("\nKB - Read Extended Shift Call");
Regs->RegAH = (LowRam->KbFlagByte1 & 0xf3) | (LowRam->KbFlagByte3 & 0x0c);
Regs->RegAL = LowRam->KbFlagByte;
break;
case OpcodeGetFlags:
Regs->RegAX = (Regs->RegAX & 0xff00) | LowRam->KbFlagByte;
break;
default:
497
The C Programs
/*======================================================*/
_enable();
#if CfgKeyboardStyleAT
DisableKeyboard(); /* only if AT */
#endif
#if CfgKeyboardStyleAT
#else
outp(KeyControlPort,inp(KeyControlPort) | 0x80);
outp(KeyControlPort,inp(KeyControlPort) & ~0x80);
#endif
498
Introduction to AutoBios
case SysReqKey:
#if CfgEnableKeySysReq
// to be added later
#endif
break;
case TabKey:
if((LowRam->KbFlag.LeftShift) || (LowRam->KbFlag.RightShift))
ScanWord = 15*256; else ScanWord = 15*256+9;
break;
case PrtScrKey:
if(LowRam->KbFlag.CtrlShift) ScanWord = 114*256;
else
{
if(LowRam->KbFlag.LeftShift || LowRam->KbFlag.RightShift )
{
#if CfgEnableKeyPrintScreen
(void far *)InterruptCall = LowRam->IntVector[0x05];
(* InterruptCall) ();
#endif
}
else ScanWord = 55*256+'*';
}
break;
case AltKey:
LowRam->KbFlag.AltShift = 1;
/* if(!LowRam->KB_FLAG & alt_shift) */
LowRam->ALT_INPUT = 0;
break;
case BreakCode+AltKey:
LowRam->KbFlag.AltShift = 0;
if(LowRam->ALT_INPUT) ScanWord = LowRam->ALT_INPUT;
break;
case CapsKey:
if (!LowRam->KbFlag1.CapsShift)
/* if key not depressed */
{
LowRam->KbFlag.CapsState ^= 1;
499
The C Programs
LowRam->KbFlag1.CapsShift = 1;
}
break;
case NumKey:
if (!LowRam->KbFlag1.NumShift)
/* if key not depressed */
{
LowRam->KbFlag1.NumShift = 1;
LowRam->KbFlag.NumState ^= 1;
}
if(LowRam->KbFlag.CtrlShift)
/* do pause mode */
{
LowRam->KbFlag1.HoldState = 1;
if(LowRam->CRT_MODE != 7)
{
outp(0x3d8,LowRam->CRT_MODE_SET);
}
SendEOI1();
#if CfgKeyboardStyleAT
EnableKeyboard();
#endif
case ScrollKey:
if (!LowRam->KbFlag1.ScrollShift)
/* if key not depressed */
{
LowRam->KbFlag1.ScrollShift = 1;
if(LowRam->KbFlag.CtrlShift)
{
SendEOI1();
#if CfgKeyboardStyleAT
EnableKeyboard();
#endif
500
Introduction to AutoBios
{
(void far *)InterruptCall = LowRam->IntVector[0x18];
(* InterruptCall) ();
}
else /* break condition */
{
LowRam->BIOS_BREAK = 0x80;
#if CfgEnableKeyCtrlBreak
(void far *)InterruptCall = LowRam->IntVector[0x1B];
(* InterruptCall) ();
#endif
}
}
break;
case InsertKey:
if (LowRam->KbFlag.AltShift)
{
assemble_alt_numeric(ScanCode);
}
else
{
if (!LowRam->KbFlag.InsertState)
{
LowRam->KbFlag.InsertState ^= 1; /* toggle insert state */
LowRam->KbFlag1.InsertShift = 1;
}
/*
// If in either num_state or shift_state, but not bithe, code = '0'
// else code = 0
*/
if(!LowRam->KbFlag.NumState)
{
if (!LowRam->KbFlag.LeftShift && !LowRam->KbFlag.RightShift)
ScanWord = InsertKey*256;
else
ScanWord = InsertKey*256+'0';
}
else
{
if (LowRam->KbFlag.LeftShift || LowRam->KbFlag.RightShift)
ScanWord = InsertKey*256;
else
ScanWord = InsertKey*256+'0';
}
}
break;
501
The C Programs
case DeleteKey:
if((LowRam->KbFlag.CtrlShift) && (LowRam->KbFlag.AltShift))
{
#if CfgEnableKeyCtrlAltDel
if (!LowRam->KbFlag.LeftShift && !LowRam->KbFlag.RightShift)
{
LowRam->RESET_FLAG = 0x1234; /* warm boot */
}
else
{
LowRam->RESET_FLAG = 0; /* cold boot */
}
_disable();
InCmos(0x00); /* set NMI mask */
CmdColdBoot(0);
#endif
}
else
{
if(LowRam->KbFlag.NumState)
{
if(!LowRam->KbFlag.LeftShift && !LowRam->KbFlag.RightShift)
ScanWord = 83*256+'.';
else
ScanWord = 83*256;
}
else
{
if(LowRam->KbFlag.LeftShift && LowRam->KbFlag.RightShift)
ScanWord = 83*256+'.'; else ScanWord = 83*256;
}
}
break;
502
Introduction to AutoBios
case NumPad7Key:
case NumPad8Key:
case NumPad9Key:
if (LowRam->KbFlag.AltShift) assemble_alt_numeric(ScanCode);
else
{
col = 0; /* BASE = 0 (all extended codes) */
if (LowRam->KbFlag.AltShift)
col = AltCol; /* ALT = 3 (all suppressed) */
else if (LowRam->KbFlag.CtrlShift)
col = CtrlCol; /* CTRL = 2 (all extended codes */
if (LowRam->KbFlag.NumState)
ScanWord = KbTable[ScanCode][1];
else
ScanWord = KbTable[ScanCode][col] << 8;
}
break;
case F1Key:
case F2Key:
case F3Key:
case F4Key:
case F5Key:
case F6Key:
case F7Key:
case F8Key:
case F9Key:
case FKey10:
case FKey11:
case FKey12:
ScanWord = TranslateFromColumn(ScanCode);
if ((ScanWord & 0xff00) == 0)
ScanWord = ScanWord << 8;
break;
default:
ScanWord = TranslateFromColumn(ScanCode);
if(LowRam->KbFlag.CapsState)
{
if (((ScanByte >= 'A') && (ScanByte <= 'Z')) ||
((ScanByte >= 'a') && (ScanByte <= 'z')))
ScanByte ^= 0x20;
}
ScanWord = (ScanCode << 8) | ScanByte;
}
break;
}
}
503
The C Programs
break;
}
}
if(ScanWord != -1) /* load scan word into buffer */
{
if(!LoadBuffer(ScanWord)) beep();
}
}
/* read the in service register to see if eoi is needed */
_disable();
outp(0x20,0x0b);
if((inp(0x20) & 0x02) != 0)
{
SendEOI1();
#if CfgKeyboardStyleAT
EnableKeyboard(); /* only if AT */
#endif
}
_enable();
#if CfgKeyboardStyleAT
//UpdateLEDs(); /* only if AT */
#endif
#endif
}
// If a serial port was also enabled for the console input device,
504
Introduction to AutoBios
return(ReturnValue);
};
/*---------------------------------------------*/
#if CfgKeyboardStyleAT
void UpdateLEDs()
{
struct _BiosRam far * LowRam = 0;
if(LowRam->KbFlag2.ScrollLED ||
LowRam->KbFlag2.NumLED ||
LowRam->KbFlag2.CapsLED)
{
/* check update busy bit */
if (!LowRam->KbFlag2.UpdateInProgress)
{
EnableKeyboard();
LowRam->KbFlag2.UpdateInProgress = 1; /* set update busy */
if(Send8042Data((char)0xed) != False) /* send the led command */
{
DelayCall(10,Milliseconds);
505
The C Programs
void EnableKeyboard()
{
/*Send8042(0x60); Send8042Data(0x21); */
if(!Send8042((char)0xae)) printf("X");
};
#endif
//--------------------------------------------------------------------
/*=======================================================*/
506
Introduction to AutoBios
507
Introduction to AutoBios
If a video adapter is not installed in a system, it is wise to retain the video function, and internally modify
it to direct output to an alternate device. This permits character oriented video output (such as the
"write_tty" command) to retain PC compatibility during the development phases. As an example, the
video driver might relay characters to a serial channel output routine, but the application could be
exercised on a system with a video device installed.
Note: Screen flickering - some early generation video adapters do not have clean memory-write/refresh-
read timing and flickering may be observed when updating the screen. Most of the currently available
adapters, in our experience, seem to minimize this flickering effect. If you observe flickering, the general
method to pursue to minimize this is to sample the horizontal re-trace status, (usually bit 0 of the status
port, 3BA or 3DA), and write into display memory only when the adapter is in retrace (moving the
blanked beam from right to left to start a new line). The vertical sync time can also be used for writing.
Note: 24 line scrolling - The standard Write-TTY function scrolls all 25 lines. A 24 line scroll may be a
desirable option in order to maintain a "status" line at the bottom of the screen. This may be
accomplished by modifying the Write-TTY function to either always scroll 24 (or 25) or to sense a flag
(or variable) to determine how many lines should be scrolled.
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Video Driver
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CRT.C
//
// [Language] MSVC 1.5
//
// [Description] This driver manages the video display.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
509
The C Programs
/* F U N C T I O N P R O T O T Y P E S */
void Load6845Byte(unsigned,char);
void Load6845Word(unsigned,unsigned);
unsigned expand_byte(char,char);
unsigned CheckMode(unsigned);
unsigned swap(unsigned);
void VideoCall(struct _IRegs far * Regs);
/* G L O B A L V A R I A B L E S */
/* G L O B A L C O N S T A N T S */
/* L O C A L D E F I N I T I O N S */
#define OpCodeSetMode 0
#define OpCodeSetCursorShape 1
#define OpCodeSetCursor 2
#define OpCodeReadCursor 3
#define OpCodeReadLightPen 4
#define OpCodeSetActivePage 5
#define OpCodeScrollUp 6
#define OpCodeScrollDown 7
#define OpCodeReadAC 8
#define OpCodeWriteAC 9
#define OpCodeWriteC 10 /* 0A */
#define OpCodeSetColor 11 /* 0B */
#define OpCodeWritePixel 12 /* 0C */
#define OpCodeReadPixel 13 /* 0D */
#define OpCodeWriteTTY 14 /* 0E */
#define OpCodeReturnVideoState 15 /* 0F */
#define OpCodeWriteString 19 /* 13 */
/* L O C A L C O N S T A N T S */
510
Introduction to AutoBios
enum
{
HorzTotal,
HorzEnable,
StartHorzBlank,
StopHorzBlank,
StartHorzRetrace,
StopHorzRetrace,
VerticalTotal,
OverFlow,
PresetRowScan,
MaxScanLine,
CursorStart,
CursorEnd,
StartAddressHigh,
StartAddressLow,
CursorLocationHigh,
CursorLocationLow,
};
struct _Video
{
char c;
char attrib;
};
/* P R O G R A M */
unsigned BufferAt(unsigned);
511
The C Programs
unsigned VideoSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
struct _BiosObject far * Bios = GetBiosObject();
unsigned Temp;
//unsigned JumperVideo;
LoadDS();
CheckPoint(0xc0);
#if CfgVideo
/* reset any video cards */
outp(ColorPort + 4, 0); outp(MonoPort + 4, 1);
inp(MonoPort + 6); inp(ColorPort + 6); outp(EGAPort, 0);
//};
switch (LowRam->EquipFlag.VideoMode)
{
case VideoModeMono:
512
Introduction to AutoBios
case VideoModeCGA80:
// could test for video buffer @ b800
if(BufferAt(0xb800))
{
VideoSetMode(3);
}
else
{
LowRam->ADDR_6845 = MonoPort;
VideoSetMode(2);
}
break;
case VideoModeCGA40:
// could test for video buffer @ b800
if(BufferAt(0xb800))
{
VideoSetMode(1);
}
else
{
LowRam->ADDR_6845 = MonoPort;
VideoSetMode(2);
}
break;
}
513
The C Programs
#endif
CheckPoint(0xc1);
Bios->DevicesInstalled |= Device;
#endif
return(SetupStatusNul);
}
/*=== ===*/
/*=== MAIN VIDEO ROUTINE ===*/
/*=== ===*/
//-----------------------------------------------
struct GraphicsCell
{
union
{
unsigned vword; /* video cell word */
unsigned char vchar; /* video character */
unsigned char vattr; /* video attribute */
};
};
struct TextCell
{
union
{
unsigned vword; /* video cell word */
unsigned char vchar; /* video character */
unsigned char vattr; /* video attribute */
};
};
union
{
struct _ScreenArray far * Ptr;
514
Introduction to AutoBios
unsigned SegOffWords[2];
}Screen;
_enable();
CheckPoint(0xc2);
if(LowRam->ADDR_6845)
{
if (LowRam->ADDR_6845 == MonoPort) Screen.Ptr = (void far *)MonoBuffer;
else Screen.Ptr = (void far *)ColorBuffer;
switch (Regs->RegAH)
{
/*=============================================*/
/*=== ===*/
/*=== AH = 0 = set mode ===*/
/*=== AL = mode to be selected (0-7) ===*/
/*=== ===*/
/*=============================================*/
case OpCodeSetMode:
switch(LowRam->EquipFlag.VideoMode)
{
case VideoModeMono:
LowRam->CRT_MODE = 7; /* if mono, force mode 7 */
LowRam->ADDR_6845 = MonoPort; Screen.Ptr = (void far *)MonoBuffer;
break;
default:
LowRam->ADDR_6845 = ColorPort; Screen.Ptr = (void far *)ColorBuffer;
if (Regs->RegAL != 7)
LowRam->CRT_MODE = Regs->RegAL; /* if color, use selected mode */
else
{
if (LowRam->EquipFlag.VideoMode == VideoModeCGA80)
LowRam->CRT_MODE = 0; else LowRam->CRT_MODE = 2;
515
The C Programs
};
break;
};
LowRam->CRT_MODE_SET = mode_table[LowRam->CRT_MODE];
outp((LowRam->ADDR_6845) + 4, LowRam->CRT_MODE_SET);
ParmAddress = LowRam->IntVector[0x1D];
LowRam->CursorEndLine = VideoParms[LowRam->CRT_MODE][CursorEnd];
LowRam->CursorStartLine = VideoParms[LowRam->CRT_MODE][CursorStart];
outp((LowRam->ADDR_6845) + 4,mode_table[LowRam->CRT_MODE]);
LowRam->CRT_MODE_SET = mode_table[LowRam->CRT_MODE];
LowRam->CRT_COLS = column_table[LowRam->CRT_MODE];
LowRam->CRT_LENGTH = length_table[LowRam->CRT_MODE];
FillLength = 2 * LowRam->CRT_LENGTH;
LowRam->CursorMode = 0x0607;
Col = 0; Row = 0;
while (Row < 26)
{
Screen.Ptr->AtTextCursor[Page][Row][Col++].vword = 0x0720; //FillWord;
if(Col >79) {Col = 0; Row++;};
}
break;
/*===========================================*/
/*=== ===*/
/*=== AH = 1 = set the cursor shape ===*/
516
Introduction to AutoBios
/*=== ===*/
/*=== CH = start line ===*/
/*=== CL = stop line ===*/
/*=== ===*/
/*===========================================*/
case OpCodeSetCursorShape:
break;
/*=====================================*/
/*=== ===*/
/*=== AH = 2 = set cursor position ===*/
/*=== ===*/
/*=== DH = row | ===*/
/*=== DL = column | ===*/
/*=== BH = page | ===*/
/*=== | ===*/
/*=====================================*/
case OpCodeSetCursor:
LowRam->CursorWord[Regs->RegBH] = Regs->RegDX;
if (LowRam->ActivePage == Regs->RegBH)
Load6845Word(14,((LowRam->CRT_START) +
(((Regs->RegDH * LowRam->CRT_COLS) + (Regs->RegDL) ) << 1) >>1 ));
break;
/*=============================================*/
/*=== ===*/
/*=== AH = 3 = read cursor position ===*/
/*=== ===*/
/*=== BH = page | DH = row ===*/
/*=== | DL = column ===*/
/*=== | CX = cursor mode ===*/
/*=== | ===*/
/*=============================================*/
case OpCodeReadCursor:
Regs->RegCX = LowRam->CursorMode;
Regs->RegDX = LowRam->CursorWord[Regs->RegBH];
break;
/*=============================================*/
/*=== ===*/
/*=== AH = 4 = read light pen position ===*/
/*=== ===*/
/*=== | AH = 0 = no info ===*/
/*=== | AH = 1 = info ===*/
/*=== | DH = row ===*/
/*=== | DL = column ===*/
517
The C Programs
case OpCodeReadLightPen:
Regs->RegAH = 0; /* set no light pen return code */
break;
/*==========================================*/
/*=== ===*/
/*=== AH = 5 = set active page ===*/
/*=== ===*/
/*=== AL = active page # | ===*/
/*=== | ===*/
/*==========================================*/
case OpCodeSetActivePage:
LowRam->ActivePage = Regs->RegAL;
LowRam->CRT_START = LowRam->CRT_LENGTH * Regs->RegAL;
Regs->RegDX = LowRam->CursorWord[Regs->RegAL];
Load6845Word(12,LowRam->CRT_START / 2);
Load6845Word(14,(LowRam->CRT_START +
(((Regs->RegDH * LowRam->CRT_COLS ) + (Regs->RegDL) ) << 1)
>>1 ));
break;
/*=============================================*/
/*=== ===*/
/*=== AH = 6 = scroll up ===*/
/*=== ===*/
/*=== AL = # rows to scroll (0 = blank ) ===*/
/*=== CX = row,col of upper left corner ===*/
/*=== DX = row,col of lower right corner ===*/
/*=== BH = attribute for blanked line ===*/
/*=== ===*/
/*=============================================*/
case OpCodeScrollUp:
if (CheckMode(IsGraphicsMode))
{
#if CfgVideoGraf
if (!(Regs->RegAL)) /* blank the field */
{
i = Regs->RegDH - Regs->RegCH;
for (LineCount = 0; LineCount <= i; LineCount++)
{
for (Row = Regs->RegCH; Row <= Regs->RegDH; Row++)
{
ClearGraphicsRow(Screen.Segment,
((Row * 320) + (Regs->RegCL)),
(Regs->RegDL) - (Regs->RegCL) + 1,0);
}
}
518
Introduction to AutoBios
}
else /* scroll the field */
{
/* i will = the # of rows to scroll */
i = Regs->RegAL;
519
The C Programs
break;
/*===================================================*/
/*=== AH = 7 = scroll down ===*/
/*=== ===*/
/*=== AL = # rows to scroll (0 = blank window) ===*/
/*=== CX = row,col of upper left corner ===*/
/*=== DX = row,col of lower right corner ===*/
/*=== BH = attribute for blanked line ===*/
/*=== ===*/
/*===================================================*/
case OpCodeScrollDown:
if (CheckMode(IsGraphicsMode))
{
#if CfgVideoGraf
if (!(Regs->RegAL)) /* blank the field */
{
i = Regs->RegDH - Regs->RegCH;
for (LineCount = 0; LineCount <= i; LineCount++)
{
for (Row = Regs->RegCH; Row <= Regs->RegDH; Row++)
{
ClearGraphicsRow(Screen.Segment,
((Row*320)+(Regs->RegCL)),
(Regs->RegDL)-(Regs->RegCL)+1,0);
}
}
}
else /* scroll the field */
{
for (LineCount = 0; LineCount < Regs->RegAL;
LineCount++)
{
for (Row = Regs->RegDH; Row > Regs->RegCH; Row--)
{
MoveGraphicsRow(Screen.Segment,
((Row - 1) * 320) + (Regs->RegCL),
(Row * 320) + (Regs->RegCL),
Regs->RegDL-Regs->RegCL+1);
}
Row = Regs->RegCH;
ClearGraphicsRow(Screen.Segment,
(Row * 320) + (Regs->RegCL),
(Regs->RegDL)-(Regs->RegCL)+1,0);
}
}
#endif
}
520
Introduction to AutoBios
else
{
if (!(Regs->RegAL)) /* blank the field */
{
for (LineCount = 0; LineCount <= (unsigned)(Regs->RegDH - Regs->RegCH);
LineCount++)
{
for (Row = Regs->RegCH; Row <= Regs->RegDH; Row++)
{
for(Col = Regs->RegCL; Col <= Regs->RegDL; Col++)
{
Screen.Ptr->AtTextCursor[Page][Row][Col].vword =
(Regs->RegBH) << 8 | 0x20;
}
}
}
}
else /* scroll the field */
{
for (LineCount = 0; LineCount < Regs->RegAL; LineCount++)
{
for (Row = Regs->RegDH; Row > Regs->RegCH; Row--)
{
for(Col = Regs->RegCL; Col <= Regs->RegDL; Col++)
{
Screen.Ptr->AtTextCursor[Page][Row+1][Col].vword =
Screen.Ptr->AtTextCursor[Page][Row][Col].vword;
};
}
for(Col = Regs->RegCL; Col <= Regs->RegDL; Col++)
{
Screen.Ptr->AtTextCursor[Page][Regs->RegCH][Col].vword =
(Regs->RegBH) << 8 | 0x20;
};
}
}
}
break;
/*=============================================*/
/*=== ===*/
/*=== AH = 8 = read attr and char at cursor ===*/
/*=== ===*/
/*=== BH = page # | AL = char ===*/
/*=== for alpha only | AH = attrib ===*/
/*=============================================*/
case OpCodeReadAC:
if (CheckMode(IsGraphicsMode))
{
#if CfgVideoGraf
for (j = 0; j < 128; j++)
{
Temp = True;
521
The C Programs
break;
/*==============================================*/
/*=== ===*/
/*=== AH = 9 = write attr and char at cursor ===*/
/*=== ===*/
/*=== BH = page # | ===*/
/*=== for alpha only| ===*/
/*=== CX = # write | ===*/
/*=== AL = character | ===*/
/*=== BL = attribute | ===*/
/*=== | ===*/
/*==============================================*/
case OpCodeWriteAC:
if(CheckMode(IsGraphicsMode))
{
#if CfgVideoGraf
for (i=0; i <= 7; i++)
{
/* if the mode is 640 x 200 */
if(LowRam->CRT_MODE == 6)
{
522
Introduction to AutoBios
pokeb(MK_FP(Screen.Segment,
(Row * 320) + ((i & 0xfe) * 40) +
Col +
((i & 1) * 0x2000)),
VideoFont[Regs->RegAX & 0x007f][i]);
}
else
{
poke(MK_FP(Screen.Segment,
(Row * 320) + ((i & 0xfe) * 40) +
(Col * 2) +
((i & 1) * 0x2000)),
expand_byte(VideoFont[Regs->RegAX & 0x007f][i],
(char)(Regs->RegBX & 0x83)));
}
}
#endif
}
else
{
i = Regs->RegCX;
while (i--)
{
Screen.Ptr->AtTextCursor[Page][Row][Col++].vword =
(Regs->RegBL << 8) | (Regs->RegAL);
if(Col >79) {Col = 0; Row++;};
}
}
break;
/*===============================================*/
/*=== ===*/
/*=== AH = 10 = write char at cursor position ===*/
/*=== ===*/
/*=== BH = page # ===*/
/*=== for alpha only| ===*/
/*=== CX = # to write ===*/
/*=== AL = character ===*/
/*=== ===*/
/*===============================================*/
case OpCodeWriteC:
if(CheckMode(IsGraphicsMode))
{
#if CfgVideoGraf
for (i=0; i <= 7; i++)
{
/* if the mode is 640 x 200 */
if(LowRam->CRT_MODE == 6)
{
//ScreenPtr->AtTextCursor[][][] = VideoFont[Regs->regAL][i]
523
The C Programs
pokeb(MK_FP(Screen.Segment,
(Row * 320) + ((i & 0xfe) * 40) +
Col +
((i & 1) * 0x2000)),
VideoFont[Regs->RegAX & 0x007f][i]);
}
else
{
/*==============================================*/
/*=== ===*/
/*=== AH = 11 = set color for MRES graphics ===*/
/*=== ===*/
/*=== BH = 0 ===*/
/*=== BL = background color ===*/
/*=== ===*/
/*=== BH = 1 ===*/
/*=== BL = pallette select ===*/
/*=== ===*/
/*==============================================*/
case OpCodeSetColor:
/* get current pallette value */
if(!(Regs->RegBH)) /* this is color 0 */
{
/* turn off low 5 bits of current color */
LowRam->CRT_PALLETTE &= 0xe0;
LowRam->CRT_PALLETTE |= (Regs->RegBX & 0x1f);
/* turn off high three bits of input */
}
else /* select pallette */
{
LowRam->CRT_PALLETTE &= 0xdf; /* turn off pallete select bit */
if((Regs->RegBX & BIT0))
524
Introduction to AutoBios
/*===========================================*/
/*=== ===*/
/*=== AH = 12 = write pixel ===*/
/*=== ===*/
/*=== DX = row 0-199 ===*/
/*=== CX = column 0-639 ===*/
/*=== AL = pixel value (1 or 2 bits) ===*/
/*=== bit 7 = 1 = XOR lower bits ===*/
/*=== ===*/
/*===========================================*/
case OpCodeWritePixel:
pokeb(MK_FP(Screen.Segment,Row),((peekb(MK_FP(Screen.Segment,Row)
& ~Col) |
((Regs->RegAX & 0x0001) << (Regs->RegCX % 8)))));
}
else /* write 2 bits */
{
/* col variable is used for bit mask */
Col = 3 << (Regs->RegCX % 4);
pokeb(MK_FP(Screen.Segment,Row),((peekb(MK_FP(Screen.Segment,Row)
& ~Col) | ((Regs->RegAX & 0x0003) << (Regs->RegCX % 4)))));
break;
/*==========================================*/
/*=== ===*/
/*=== AH = 13 = read pixel ===*/
/*=== ===*/
/*=== DX = row 0-199 | AL = pixel ===*/
/*=== CX = column 0-639 | ===*/
/*=== | ===*/
/*==========================================*/
525
The C Programs
case OpCodeReadPixel:
Regs->RegAL = ((peekb(MK_FP(Screen.Segment,Row)
>> (Regs->RegCX % 8)) & 1));
}
else /* read 2 bits */
{
Regs->RegAL = ((peekb(MK_FP(Screen.Segment,Row)
>> (Regs->RegCX % 4)) & 3));
break;
/*=========================================*/
/*=== ===*/
/*=== AH = 14 = write tty ===*/
/*=== ===*/
/*=== AL = character to write ===*/
/*=== BL = fground color in graphics ===*/
/*=== use active page ===*/
/*=========================================*/
case OpCodeWriteTTY:
#if CfgConsoleOutSerial
//send al to com port
TempAL = Regs->RegAL;
_asm
{
push dx
push bx
push cx
mov dx,CfgSysVueConsolePort
add dx,5
526
Introduction to AutoBios
and al,0x60
cmp al,0x60
je local10
loop local5
dec bl
jnz local4
local10:
mov al,TempAL
mov dx,CfgSysVueConsolePort
out dx,al
pop cx
pop bx
pop dx
}
#endif
#if CfgConsoleOutVideo
switch (Regs->RegAL)
{
case '\a': /* bell */
beep();
break;
VideoWriteChar(Regs->RegAL);
Col++;
if (Col >= LowRam->CRT_COLS)
{
527
The C Programs
Col = 0;
if (Row == 24)
{
/* find the fill attribute */
Attribute = VideoReadAC() >> 8;
VideoScrollUp(1,Attribute,0,(24 << 8) | (LowRam->CRT_COLS - 1));
}
else
{
Row++;
}
}
break;
}
Load6845Word(14,(LowRam->CRT_START +
((Row * LowRam->CRT_COLS) + Col ) << 1) >>1 );
#endif
break;
/*===========================================*/
/*=== ===*/
/*=== AH = 15 = return video state ===*/
/*=== ===*/
/*=== AH = # of cols ===*/
/*=== AL = mode ===*/
/*=== BH = page ===*/
/*=== ===*/
/*===========================================*/
case OpCodeReturnVideoState:
Regs->RegAH = LowRam->CRT_COLS;
Regs->RegAL = LowRam->CRT_MODE;
Regs->RegBH = LowRam->ActivePage;
break;
/*====================================================*/
/*=== ===*/
/*=== AH = 19 = write string ===*/
/*=== ===*/
/*=== ES:BP = pointer to string ===*/
/*=== CX = length of string ===*/
/*=== DX = cursor position ===*/
/*=== BH = page # ===*/
/*=== ===*/
/*=== AL = 0 = write string - don't move cursor ===*/
/*=== BL = attribute ===*/
/*=== AL = 1 = write string - move cursor ===*/
/*=== BL = attribute ===*/
528
Introduction to AutoBios
case OpCodeWriteString:
if ((outchar == '\b' ) ||
(outchar == '\r' ) ||
(outchar == '\n' ))
{
VideoWriteTty(outchar);
Row = LowRam->Cursor[Page].Row;
Col = LowRam->Cursor[Page].Col;
}
else
{
LocalCX = 1;
LocalBX = Regs->RegBX;
if (Regs->RegAL > 2)
{
LocalBX = peekb(MK_FP(Regs->RegES,Regs->RegBP));
Regs->RegBP++;
}
VideoWriteAC(outchar,Regs->RegBX);
Col++;
if (Col >> (LowRam->CRT_COLS))
{
Row++;
if (Row >=25)
{
Col = 0;
VideoWriteTty('\n');
Row--;
}
}
/* update cursor */
VideoSetCursor((Row << 8) | Col);
}
529
The C Programs
}
/* restore original cursor */
if (!(Regs->RegAX & 1))
{
LowRam->CursorWord[Regs->RegBH] = TempCursor;
VideoSetCursor(TempCursor);
}
}
break;
/*===========================================*/
/*=== ===*/
/*=== default case for invalid opcodes ===*/
/*=== ===*/
/*===========================================*/
default:
break;
}
}
CheckPoint(0xc4);
}
/*=============================================*/
/*=== ===*/
/*=== SUPPORTING FUNCTIONS ===*/
/*=== ===*/
/*=============================================*/
/*---
**--- return alpha or graphics mode flag
*/
case IsAlphaMode:
return(((LowRam->CRT_MODE >= 4) && (LowRam->CRT_MODE <= 6))?False:True);
break;
default:
return(False);
}
}
/*---
**--- expand the byte for medium res.
530
Introduction to AutoBios
/*------------------------------------------------*/
/*--- ---*/
/*--- load a byte into the 6845 reg 'n' ---*/
/*--- ---*/
/*------------------------------------------------*/
531
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Floppy Disk Driver
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Disk.C
//
// [Language] MSVC 1.5
//
// [Description] This module supports 360 to 2.88 floppy drives.
//
// [Arguments] Registers
//
// [Return] Registers
// Carry Flag set if error condition
//
533
The C Programs
// I N C L U D E F I L E S
#include "Bios.h"
// F U N C T I O N P R O T O T Y P E S
// L O C A L D E F I N I T I O N S
534
Introduction to AutoBios
// FDC commands
535
The C Programs
//
// The following Enumerations are all the same, permitting more
// descriptive entries as to their meaning in various tables
#if CfgDiskCableSwap
// This is non-twist cable mapping
// Useful only for Drive A: unless changing select jumpers
#else
// This is normal mapping
char _based(_segname("_CODE")) CableMap[4]={ 0x1c, 0x2d, 0x4e, 0x8f };
#endif
/* TypeNone */ {TypeNone,TypeNone,TypeNone,TypeNone},
/* Type360 */ {Type360, TypeNone,TypeNone,TypeNone},
/* Type1200 */ {Type1200,Type360, TypeNone,TypeNone},
/* Type720 */ {Type720, TypeNone,TypeNone,TypeNone},
/* Type1440 */ {Type1440,Type720, TypeNone,TypeNone},
/* Type2880 */ {Type2880,Type1440,Type720, TypeNone},
/* TypeSpare */ {TypeNone,TypeNone,TypeNone,TypeNone},
/* TypeSpare */ {TypeNone,TypeNone,TypeNone,TypeNone},
};
//
// These definitions provide descriptive names for values in the
// DiskTable below, and for standard values used by the Driver.
536
Introduction to AutoBios
#define StartTime 8
#define Sectors08 8
#define Sectors09 9
#define Sectors15 15
#define Sectors18 18
#define Sectors36 36
#define MaxTrax40 39
#define MaxTrax80 79
#define DTL -1
struct DiskItem
{
char DriveID;
char MediaID;
char MaxTracks;
char SectorsTrack;
char DataRate;
char Step;
char Gap;
char Gap3;
};
{Drive360,Media360,MaxTrax40,Sectors09,Rate250,SingleStep,0x2a,0x50,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
},
{
// ---- Drive type 1 = 360 ----
537
The C Programs
{
// ---- Drive type 2 = 1.2 ------
{
// ---- Drive type 3 = 720 ------
538
Introduction to AutoBios
{
// ---- Drive type 4 = 1.44 ------
{
//---- Drive type 6 = reserved ------
{0,0,0,0,0,0,0,0,},
539
The C Programs
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
},
{
//---- Drive type 7 = reserved ------
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,},
},
};
// P R O G R A M
/*
540
Introduction to AutoBios
//======================================================
//=================== START OF CODE ====================
//======================================================
struct _FDiskRegs
{
unsigned DriveType:3;
unsigned DriveTrash:13;
unsigned FdcCommand;
unsigned DmaCommand;
unsigned DmaDirectionWrite;
unsigned Sector_Track;
unsigned MediaType:3;
unsigned MediaTrash:13;
unsigned OpCode;
unsigned Drive;
unsigned NrSectors;
unsigned LocalES;
unsigned LocalBX;
unsigned Head;
unsigned Sector;
unsigned Track;
unsigned MaxTrack;
unsigned MaxSectors;
unsigned Index;
unsigned TryCount;
unsigned MediaIndex;
unsigned WaitForMotor;
unsigned EndTrack,EndHead,EndSector,NumSectors,SectorsTrack;
union
{
char WidthChar[4];
unsigned WidthWord[2];
unsigned long WidthLong[1];
}XfrAddress;
unsigned XfrLength;
};
// P R O G R A M
unsigned FDiskSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
struct _BiosObject far * Bios = GetBiosObject();
unsigned i, condition = SetupStatusOK;
_enable();
LoadDS();
Bios->DevicesInstalled |= Device;
541
The C Programs
if(LowRam->DiskID[0].DriveType = (char)CmosType(0))
LowRam->DiskID[0].DriveEst = True;
if(LowRam->DiskID[1].DriveType = (char)CmosType(1))
LowRam->DiskID[1].DriveEst = True;
if(!CallDiskReset(0)) { condition = SetupStatusError; };
LowRam->MOTOR_COUNT = 0xff;
outp(FdcDOR,CableMap[0]); // turn on Drive a: motor for faster boot
//========================================================
//========================================================
//========================================================
//======== BEGINNING OF MAIN ROUTINES ===================
//========================================================
//========================================================
//========================================================
Me->OpCode = Regs->RegAH;
Me->Drive = Regs->RegDL;
Me->NrSectors = Regs->RegAL;
Me->Head = Regs->RegDH;
Me->Sector = Regs->RegCL;
Me->Track = Regs->RegCH;
Me->LocalES = Regs->RegES;
542
Introduction to AutoBios
Me->LocalBX = Regs->RegBX;
Me->DriveType = LowRam->DiskID[Me->Drive].DriveType;
LowRam->DiskStatusByte = ErrorCommand;
Regs->RegAH = OpcodeBadFunction;
Regs->RegFlags |= CarryBit; // set return error flag
}
else
{
switch (Me->OpCode)
{
case OpcodeReset: printsnapstring(MsgOpcodeReset);
FdcReset(Me);
Regs->RegAH = LowRam->DiskStatusByte;
if (Regs->RegAH) Regs->RegFlags |= CarryBit;
break;
case OpcodeReadStatus:
printsnapstring(MsgOpcodeReadStatus);
Regs->RegAH = LowRam->DiskStatusByte;
if (Regs->RegAH) Regs->RegFlags |= CarryBit;
break;
case OpcodeReadSectors:
printsnapstring(MsgOpcodeReadSectors);
Me->WaitForMotor = False;
Me->FdcCommand = OpcodeFdcRead;
Me->DmaCommand = DmaOpcodeRx;
Me->DmaDirectionWrite = False;
goto read_write_verify;
case OpcodeWriteSectors:
printsnapstring(MsgOpcodeWriteSectors);
543
The C Programs
Me->WaitForMotor = True;
Me->FdcCommand = OpcodeFdcWrite;
Me->DmaCommand = DmaOpcodeTx;
Me->DmaDirectionWrite = True;
goto read_write_verify;
case OpcodeVerifySectors:
printsnapstring(MsgOpcodeVerifySectors);
Me->WaitForMotor = False;
Me->FdcCommand = OpcodeFdcVerify;
Me->DmaCommand = DmaOpcodeVerify;
Me->DmaDirectionWrite = False;
goto read_write_verify;
read_write_verify:
// if a media change sensed, then de-establish media
if (MediaChanged(Me))
{
LowRam->DiskID[Me->Drive].MediaEst = False;
LowRam->DiskID[Me->Drive].MediaType = 0;
Me->MediaIndex = 0;
}
Me->TryCount = 3;
if (!LowRam->DiskID[Me->Drive].MediaEst)
{
// set the media index for the first possible type of media
LowRam->DiskID[Me->Drive].MediaType = SequenceTable[Me->DriveType][0];
// set the media type according to the Drive type [index = 0]
Me->MediaType = LowRam->DiskID[Me->Drive].MediaType;
}
do // this is the minor loop
// do until we run out of RetryNeededs
{
LowRam->DiskStatusByte = 0;
// set up Drive and media indexes before doing the dma setup,
// which needs to know how many bytes per Sector for calcing xfr length
Me->DriveType = LowRam->DiskID[Me->Drive].DriveType;
Me->MediaType = LowRam->DiskID[Me->Drive].MediaType;
if (DmaSetupOK(Me))
{
// send the specify command
SendSpecifyCommandOK();
SendRate(Me);
544
Introduction to AutoBios
if (InitControllerOK(Me))
if (SendCommandOK(Me->Track))
if (SendCommandOK(Me->Head))
if (SendCommandOK(Me->Sector))
if (SendCommandOK(FdcBytesPerSectorCode))
if (SendCommandOK(GetParm(SectorsTrack)))
if (SendCommandOK(GetParm(Gap)))
if (SendCommandOK(DTL))
if (GetFdcStatusOK(Me))
{
Regs->RegAH = LowRam->DiskStatusByte;
Regs->RegAL = CalcSectors(Me);
if (Regs->RegAH) Regs->RegFlags |= CarryBit;
break;
case OpcodeFormatTrack :
printsnapstring(MsgOpcodeFormatTrack);
Me->FdcCommand = OpcodeFdcFormat;
Me->DmaCommand = DmaOpcodeTx;
Me->DmaDirectionWrite = True;
// if media not established, then set media type = Drive type
if (!LowRam->DiskID[Me->Drive].MediaEst)
LowRam->DiskID[Me->Drive].MediaType = LowRam->DiskID[Me->Drive].DriveType;
Me->WaitForMotor = True;
if (MediaChanged(Me)) // check for media change
{
SendSpecifyCommandOK();
SendRate(Me);
if (DmaSetupOK(Me))
{
if (InitControllerOK(Me))
{
if (SendCommandOK(FdcBytesPerSectorCode))
{
if (SendCommandOK(GetParm(SectorsTrack)))
{
if (SendCommandOK(GetParm(Gap3)))
{
SendCommandOK(FillByte); // send command
GetFdcStatusOK(Me);
}
}
545
The C Programs
}
}
}
}
Regs->RegAH = LowRam->DiskStatusByte;
if (Regs->RegAH) Regs->RegFlags |= CarryBit;
break;
case OpcodeReadDiskParms :
printsnapstring(MsgOpcodeReadDiskParms);
if (!LowRam->EquipFlag.DiskPresent) Regs->RegFlags = 1;
else
{
if (!CmosType(Me->Drive)) Regs->RegFlags = 1;
else
{
Me->DriveType = CmosType(Me->Drive);
Regs->RegAX = 0;
Regs->RegBH = 0;
Regs->RegBL = Me->DriveType;
Regs->RegCL = FDiskTable[Me->DriveType][Me->DriveType].SectorsTrack;
Regs->RegCH = FDiskTable[Me->DriveType][Me->DriveType].MaxTracks;
Regs->RegDH = 01;
Regs->RegDL = LowRam->EquipFlag.NrDrives +1;
Bios->FDiskParmTable.SpecifyByte1 = Specify1;
Bios->FDiskParmTable.SpecifyByte2 = Specify2;
Bios->FDiskParmTable.MotorWait = OffTime;
Bios->FDiskParmTable.BytesPerSectorCode = FdcBytesPerSectorCode;
Bios->FDiskParmTable.SectorsTrack = Regs->RegCL;
Bios->FDiskParmTable.Gap = FDiskTable[Me->DriveType][Me->DriveType].Gap;
Bios->FDiskParmTable.Dtl = DTL;
Bios->FDiskParmTable.Gap3 = FDiskTable[Me->DriveType][Me-
>DriveType].Gap3;
Bios->FDiskParmTable.FillCharByte = FillByte;
Bios->FDiskParmTable.HeadSettle = SettleTime;
Bios->FDiskParmTable.MotorStart = StartTime;
Regs->RegES = FP_SEG(Bios);
Regs->RegDI = &Bios->FDiskParmTable;
}
}
break;
case OpcodeReadDiskType :
printsnapstring(MsgOpcodeReadDiskType);
Regs->RegAH = 00; // no Drive
if (LowRam->DiskID[Me->Drive].DriveType != TypeNone)
{
if (LowRam->DiskID[Me->Drive].DriveType == Type360)
{
Regs->RegAH = 0x01; // 40 Track, no change line
}
546
Introduction to AutoBios
else
{
Regs->RegAH = 0x02; // 80 Track, change line
}
}
break;
case OpcodeReadDiskChange :
printsnapstring(MsgOpcodeReadDiskChange);
// if no Drive - then return a timeout condition
if (LowRam->DiskID[Me->Drive].DriveType == TypeNone)
{
LowRam->DiskStatusByte |= ErrorTimeOut;
}
else
{
// if 360 k Drive - always return disk change
if (LowRam->DiskID[Me->Drive].DriveType == Type360)
LowRam->DiskStatusByte = ErrorMediaChange;
else
// if 720, 1.4, or 2.8 Drive - read the change line
if (ChangeLineActive(Me)) LowRam->DiskStatusByte = ErrorMediaChange;
}
Regs->RegAH = LowRam->DiskStatusByte;
if (Regs->RegAH) Regs->RegFlags |= CarryBit;
break;
case 2: // 360/1.2
if(Me->DriveType == Type1200)
LowRam->DiskID[Me->Drive].MediaType = Type360;
LowRam->DiskID[Me->Drive].MediaEst = True;
//LowRam->DiskID[Me->Drive].DriveType = Type1200;
break;
case 3: // 1.2/1.2
if(Me->DriveType == Type1200)
LowRam->DiskID[Me->Drive].MediaType = Type1200;
LowRam->DiskID[Me->Drive].MediaEst = True;
//LowRam->DiskID[Me->Drive].DriveType = Type1200;
break;
case 4: // 720/720
if(Me->DriveType == Type720)
547
The C Programs
LowRam->DiskID[Me->Drive].MediaType = Type720;
LowRam->DiskID[Me->Drive].MediaEst = True;
//LowRam->DiskID[Me->Drive].DriveType = Type720;
break;
default: printsnapstring(MsgOpcodeDefault);
LowRam->DiskStatusByte = ErrorCommand; // bad command
break;
}
Regs->RegAH = LowRam->DiskStatusByte;
if (Regs->RegAH) Regs->RegFlags |= CarryBit;
break;
default : printsnapstring(MsgOpcodeBadCommand);
LowRam->DiskStatusByte = ErrorCommand;
548
Introduction to AutoBios
Regs->RegAH = OpcodeBadFunction;
Regs->RegFlags |= CarryBit; // set return error flag
} // end of switch
}
}
LowRam->MOTOR_COUNT = OffTime; // set motor count
} // end of disk_io
//=======================================================
//========================================================
//--------------------------------------------------------
//--------------------------------------------------------
unsigned SendSpecifyCommandOK(void)
{
if(!SendCommandOK(3)) return(False);
if(!SendCommandOK(Specify1)) return(False);
if(!SendCommandOK(Specify2)) return(False);
return(True);
}
//=======================================================
549
The C Programs
// Start the reset by setting the reset/ bit low in the DOR
outp(FdcDOR,status);
// Complete the reset by setting the reset/ bit high in the DOR
outp(FdcDOR,status | 0x04);
/*======================================================
--------------------------------------------------------*/
550
Introduction to AutoBios
{
struct _BiosRam far * LowRam = 0;
char LastMotor;
DelayCall(125 * StartTime,Milliseconds);
LowRam->MOTOR_COUNT = 0xff;
// hit timer with max on-count
}
}
/*========================================================
--------------------------------------------------------*/
unsigned IntReceived(void)
{
struct _BiosRam far * LowRam = 0;
// this time out should be about 3 secs
unsigned long i = SetTimeOutCount(3 * 20);
do
{
// If interrupt pending, return to caller
if(LowRam->SeekStatus.IntFlag)
{
// reset the interrupt flag
LowRam->SeekStatus.IntFlag = False;
return (True);
}
//printf("\ri = %p",LowRam->TimerLong);
}
while (LowRam->TimerLong < i);
LowRam->DiskStatusByte |= ErrorTimeOut;
return (False);
}
/*========================================================
551
The C Programs
--------------------------------------------------------*/
/*====================================================================
-------------------------------------------------------------------*/
/*==============================================================
----------------------------------------------------------------*/
552
Introduction to AutoBios
if (Me->DmaCommand != (char)DmaOpcodeVerify)
{
Me->XfrAddress.WidthLong[0] = (unsigned long) Me->LocalES << 4;
Me->XfrAddress.WidthLong[0] += (unsigned long) Me->LocalBX;
}
Me->XfrLength = (Me->NrSectors * BytesPerSector) - 1;
outp(DmaAddressPort,Me->XfrAddress.WidthChar[0]); // output low address
outp(DmaAddressPort,Me->XfrAddress.WidthChar[1]); // output high address
outp(DmaPagePort,Me->XfrAddress.WidthChar[2]); // output page address
outp(DmaBasePort,Me->XfrLength & 0xff); // output low byte
outp(DmaBasePort,Me->XfrLength >> 8); // output high byte
_enable(); // enable interrupts
outp(DmaMaskPort,DmaOpcodeOn); // init disk channel
/*==========================================================
--------------------------------------------------------*/
553
The C Programs
}
// A 1.2MB drive needs to double-step for 360k media
if (FDiskTable[Me->DriveType][Me->MediaType].Step) Me->Track *= 2;
/*=========================================================
--------------------------------------------------------*/
/*=======================================================
--------------------------------------------------------*/
unsigned ResultsReadOK(void)
{
struct _BiosRam far * LowRam = 0;
unsigned count = 0; unsigned long TimeOutCount;
do
{
TimeOutCount = SetTimeOutCount(20); // about 1 second
while ((inp(FdcMSR) & 0xc0) != 0xc0)
{
if(TimerLongCounter >= TimeOutCount)
{
554
Introduction to AutoBios
LowRam->DiskStatusByte |= ErrorTimeOut;
return(False);
};
}
LowRam->FDC_STATUS[count] = (char)inp(FdcDataReg);
DelayCall(1,Milliseconds);
/*=======================================================
--------------------------------------------------------*/
outp(FdcConfigPort,FDiskTable[LowRam->DiskID[Me->Drive].DriveType]
[LowRam->DiskID[Me->Drive].MediaType].DataRate);
}
/*=======================================================
--------------------------------------------------------*/
/*===========================================================
555
The C Programs
--------------------------------------------------------- */
// get the next possible media type for this Drive type
MediaType = SequenceTable[Me->DriveType][++Me->MediaIndex];
// insert the new media type into the LowRam->DISK_ID[] and return saying try
again
LowRam->DiskID[Me->Drive].MediaType = MediaType;
LowRam->DiskID[Me->Drive].MediaEst = False;
LowRam->DiskStatusByte = 0;
LowRam->FDC_STATUS[0] = 0;
return(True); // return saying RetryNeeded
}
/*========================================================
--------------------------------------------------------*/
void PurgeFdc(void)
{
unsigned count = 0;
while (((inp(FdcMSR) & 0xc0) == 0xc0) && (++count < 50))
{
inp(FdcDataReg); // read status
DelayCall(1,Milliseconds);
}
}
/*=======================================================
556
Introduction to AutoBios
--------------------------------------------------------*/
/*=======================================================
/*======================================================
-------------------------------------------------------*/
/*=========================================================
557
The C Programs
Returns:
True if media changed, False if not changed
-------------------------------------------------------*/
MotorOn(Me);
FdcReset(Me);
TempTrack = Me->Track;
Me->Track = 0;
SeekOK(Me);
Me->Track = 1;
SeekOK(Me);
Me->Track = TempTrack;
LowRam->DiskStatusByte = ErrorMediaChange;
/*==============================================================
---------------------------------------------------------------*/
558
Introduction to AutoBios
/*========================================================
--------------------------------------------------------*/
/*=======================================================
returns:
number of Sectors transferred
--------------------------------------------------------*/
559
The C Programs
Me->NumSectors += Me->SectorsTrack;
Me->NumSectors += Me->SectorsTrack;
}
}
else // different head
{
Me->NumSectors += Me->SectorsTrack;
}
Me->NumSectors += (Me->EndSector - Me->Sector);
return(Me->NumSectors);
}
//====================================================
560
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] AT/IDE Hard Disk Driver
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Hard.C
//
// [Language] MSVC 1.5
//
// [Description] Interrupt 13h - hard disk driver
//
// AH = 0 - do a reset on the controller, set recal needed
//
// AH = 1 - read the last operation status into AL
//
//--------------- for the following operations -------------
//
// DL = drive number (0x80-0x81)
// DH = head number
// CH = track number
// CL = sector number (except for Format)
// AL = number of sectors (except for Format)
// ES:BX - data buffer address (except for Format)
//
//
// AH = 2 - read sectors
//
// AH = 3 - write sectors
//
// AH = 4 - verify sectors
//
// The above commands return in AL the # of sectors succesful
//
// AH = 5 - format track
561
The C Programs
562
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
// F U N C T I O N P R O T O T Y P E S
// G L O B A L V A R I A B L E S
// G L O B A L C O N S T A N T S
// L O C A L D E F I N I T I O N S
563
The C Programs
564
Introduction to AutoBios
// L O C A L C O N S T A N T S
// P R O G R A M
struct _Variables
{
char Frame[8]; // The command block
struct HDTable far * ParmTable; // ptr to the drive parm table
char far * XfrAddress;
unsigned long delay_count;
//unsigned index;
char temp;
unsigned count;
struct _BiosRam far * LowRam;
struct _IRegs far * Regs;
};
unsigned HDiskSetup(ActionArgument)
{
struct _BiosObject far * Bios = GetBiosObject();
struct _BiosRam far * LowRam = 0;
unsigned drive_type;
unsigned condition = SetupStatusError;
LoadDS();
565
The C Programs
Bios->DevicesInstalled |= Device;
#if CfgHard
LowRam->HD_NUM = 0; // clear number of drives
LowRam->HD_CONTROL = 0; // clear control byte
LowRam->HD_STATUS1 = 0; // clear disk status
//printf("\nChecking CMOS");
// Check to See if the CMOS is valid
if (!((InCmos(CmosRegDiagnosticStatus) & \
(CmosRegBitBadBat | CmosRegBitBadSum | CmosRegBitBadCfg)) != 0))
{
LoadUserDriveParms(); // Get the type 47 & 48 values
switch(drive_type)
{
case 47:
LowRam->IntVector[0x41] = &Bios->HardDrive47;
break;
case 48:
LowRam->IntVector[0x41] = &Bios->HardDrive48;
break;
default:
LowRam->IntVector[0x41] = &HDiskTable[drive_type-1];
};
566
Introduction to AutoBios
switch(drive_type)
{
case 47:
LowRam->IntVector[0x46] = &Bios->HardDrive47;
break;
case 48:
LowRam->IntVector[0x46] = &Bios->HardDrive48;
break;
default:
LowRam->IntVector[0x46] = &HDiskTable[drive_type-1];
};
LowRam->HD_NUM = 2; // say there are two drives
}
//=================================================
//======== BEGINNING OF MAIN ROUTINES ============
//=================================================
Vars.LowRam = 0;
Vars.Regs = Regs;
//-----------------
567
The C Programs
_enable();
// Invalid Hard Drive Number, No Hard Drives Present, Not Enough Drives
if ((Regs->RegDL > 0x81) || (!LowRam->HD_NUM) ||
((Regs->RegDL & 0x7f) > (LowRam->HD_NUM - 1)))
Regs->RegAH = OpcodeBadCommand;
if (Regs->RegDL == 0x80)
/*Drive 0 */ Vars.ParmTable = LowRam->IntVector[0x41];
else /*Drive 1*/ Vars.ParmTable = LowRam->IntVector[0x46];
switch (Regs->RegAH)
{
case OpcodeReset: printsnapstring(MsgOpcodeReset);
568
Introduction to AutoBios
DelayCall(100,Microseconds);
if(Busy(&Vars))
{
struct _BiosRam far * LowRam = 0;
LowRam->HD_STATUS1 = OpcodeErrorReset;
}
else
{
if(inp(PortReadErrorRegister) != 0x01)
{
LowRam->HD_STATUS1 = OpcodeErrorReset;
}
else
{
CallDiskInitDrive(0x80);
CallDiskRecalibrate(0x80);
CallDiskInitDrive(0x81);
CallDiskRecalibrate(0x81);
}
LowRam->HD_STATUS1 = 0; // clear the error bits
}
LowRam->HD_STATUS1 = 0; // clear the error bits
}
break;
case OpcodeReadStatus:
printsnapstring(MsgOpcodeReadStatus);
Regs->RegAL = LowRam->HD_STATUS1;
break;
case OpcodeReadSectors:
printsnapstring(MsgOpcodeReadSectors);
Vars.Frame[7] = HdcOpcodeRead;
if(Vars.Frame[2] == 0) { LowRam->HD_STATUS1 = OpcodeErrorCommand; break; }
if(!DmaOverrun(&Vars))
{
if(SendCommand(&Vars))
{
// do this loop for each sector
do
{
if(!IntReceived(&Vars)) break;
// do the sector transfer
RepeatIn(Vars.XfrAddress,PortReadData,256);
Vars.XfrAddress += 512;
if (!HDiskStatusOK(&Vars)) break;
569
The C Programs
}
while(--Vars.Frame[2] != 0);
}
}
break;
case OpcodeWriteSectors:
printsnapstring(MsgOpcodeWriteSectors);
Vars.Frame[7] = HdcOpcodeWrite;
case OpcodeVerifySectors:
printsnapstring(MsgOpcodeVerifySectors);
Vars.Frame[7] = HdcOpcodeVerify;
if(SendCommand(&Vars))
{
if (IntReceived(&Vars)) HDiskStatusOK(&Vars);
}
break;
case OpcodeFormatTrack:
printsnapstring(MsgOpcodeFormatTrack);
Vars.Frame[7] = HdcOpcodeFormat;
Vars.Frame[2] = Vars.ParmTable->Sectors;
if(SendCommand(&Vars))
{
// wait for data request interrupt
570
Introduction to AutoBios
if(ReadyForData(&Vars))
{
// do this loop for each sector
do
{
// do the sector transfer
RepeatOut(Vars.XfrAddress,PortWriteData,256);
Vars.XfrAddress += 512;
if (!HDiskStatusOK(&Vars)) break;
}
while(((LowRam->HD_STATUS & 0x08) != 0) && (--Vars.Frame[2] != 0));
// if the controller is still asking for more data,then it is an error
if(inp(PortReadSectorCount) != 0)
LowRam->HD_STATUS1 = (unsigned char)OpcodeErrorUndefined;
}
}
break;
Regs->RegAX = 0;
break;
if(SendCommand(&Vars))
{
if(!Busy(&Vars)) HDiskStatusOK(&Vars);
}
break;
571
The C Programs
}
if (!HDiskStatusOK(&Vars)) break;
}
while(--Vars.Frame[2] > 0);
}
}
break;
572
Introduction to AutoBios
RepeatOut(Vars.XfrAddress,PortWriteData,256);
Vars.XfrAddress += 512;
if (!HDiskStatusOK(&Vars)) break;
}
while(((Vars.LowRam->HD_STATUS & 0x08) != 0) && (--Vars.Frame[2] != 0));
// if the controller still asking for more then an error.
if(inp(PortReadSectorCount) != 0)
Vars.LowRam->HD_STATUS1 = (unsigned char)OpcodeErrorUndefined;
}
}
}
break;
Vars.Frame[7] = HdcOpcodeSeek;
if(SendCommand(&Vars))
{
if(IntReceived(&Vars)) HDiskStatusOK(&Vars);
if(Vars.LowRam->HD_STATUS1 == OpcodeErrorSeek) Vars.LowRam->HD_STATUS1 = 0;
}
break;
case OpcodeTestDriveReady:
printsnapstring(MsgOpcodeTestDriveReady);
if(!Busy(&Vars))
{
outp(PortWriteSizeDriveHead,Vars.Frame[6]); HDiskStatusOK(&Vars);
}
break;
case OpcodeRecalibrate:
printsnapstring(MsgOpcodeRecalibrate);
Vars.Frame[7] = HdcOpcodeRecal;
if(!SendCommand(&Vars)) { break; };
if(!IntReceived(&Vars))
{
if(!IntReceived(&Vars))
{
break;
};
573
The C Programs
};
HDiskStatusOK(&Vars);
if(Vars.LowRam->HD_STATUS1 == OpcodeErrorSeek) Vars.LowRam->HD_STATUS1 = 0;
break;
case OpcodeDiagnostic:
printsnapstring(MsgOpcodeDiagnostic);
// make sure interrupts are disabled when changing the interrupt mask
_disable();
outp(0xa1,inp(0xa1) & ~0x40);
outp(0x21,inp(0x21) & ~0x04);
_enable();
if(Busy(&Vars)) // Not ok to start diag
{
}
else
{
outp(PortWriteCommand,HdcOpcodeDiag);
if (!Busy(&Vars)) // wait for completion
{
if ((Vars.LowRam->HD_ERROR = (char)inp(PortReadErrorRegister)) != 1)
{
Vars.LowRam->HD_STATUS1 = OpcodeErrorHDC;
}
}
else
{
LowRam->HD_STATUS1 = (unsigned char)OpcodeErrorTimeOut;
}
}
break;
case OpcodeGetDiskType:
printsnapstring(MsgOpcodeGetDiskType);
Regs->RegCX = GetHighOfLong(Vars.ParmTable->Cyls - 1) *
Vars.ParmTable->Heads * Vars.ParmTable->Sectors;
Regs->RegDX = (Vars.ParmTable->Cyls - 1) *
Vars.ParmTable->Heads * Vars.ParmTable->Sectors;
Regs->RegAX = 0x0300;
break;
} // end of switch
Regs->RegAH = LowRam->HD_STATUS1;
if(Regs->RegAH) Regs->RegFlags |= 1;
574
Introduction to AutoBios
//====================================================
//====================================================
do
{
if ((inp(PortReadStatus) & 0x80) == 0) return(False);
}
while (LowRam->TimerLong < delay_count);
//======================================================
//
// Wait for the hardware interrupt to occur. Time-out and
// return if no interrupt.
//
// Returns True if Rxed, False if timeout - not received
//
//-----------------------------------------------------
do
575
The C Programs
{
if(LowRam->HD_INT_FLAG)
{
LowRam->HD_INT_FLAG = False; LowRam->HD_STATUS1 = 0; return (True);
}
}
while ((LowRam->TimerLong < delay_count));
// LowRam->HD_INT_FLAG = False;
LowRam->HD_STATUS1 |= OpcodeErrorTimeOut;
return(False);
}
//======================================================
//
// Wait for the data request. Time-out and
// return if no request.
//
// Returns True if controller is ready to accept data.
// Returns False if not ready - timeout.
//
//-----------------------------------------------------
do
{ if((inp(PortReadStatus) & OUTPUT_REQ_BIT) != 0) { return(True); } }
while (LowRam->TimerLong < delay_count);
LowRam->HD_STATUS1 = (unsigned char)OpcodeErrorTimeOut;
return (False);
}
//=================================================
//--------------------------------------------------
// Checks the Hard Disk Status,
// Returns True if OK, False if not OK
//----------------------------------------------------
//
//
// Checks the Status byte from the controller and
576
Introduction to AutoBios
return(True);
}
//-----------------------------------------------------
//------------------------------------------
// Reads the Error Byte from the Controller
// Returns True if OK, False if not OK
577
The C Programs
unsigned index = 0;
struct _BiosRam far * LowRam = 0;
temp = LowRam->HD_ERROR = (char)inp(PortReadErrorRegister);
//---------------------------------------------------------
// check for transfer overrun
// if ecc mode than use 7f04 as max, else use 8000
// Returns True if an Overrun condition is detected
//----------------------------------------------------
// Returns True if successful, False if not
do
{
// check for controller and drive ready
if (!Busy(Vars))
{
578
Introduction to AutoBios
// select drive
outp(PortWriteSizeDriveHead,Vars->Frame[6]);
if (StatusByteOK(Vars))
{
// reset the interrupt flag byte
LowRam->HD_INT_FLAG = False;
outp(PortWritePreComp,Vars->Frame[1]);
outp(PortWriteSectorCount,Vars->Frame[2]);
outp(PortWriteSectorNumber,Vars->Frame[3]);
outp(PortWriteCylinderLow,Vars->Frame[4]);
outp(PortWriteCylinderHigh,Vars->Frame[5]);
outp(PortWriteSizeDriveHead,Vars->Frame[6]);
outp(PortWriteCommand,Vars->Frame[7]);
return(True);
}
}
}
while(count-- > 0);
return(False);
}
//====================================================
//====================================================
//====================================================
579
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Bootstrap routine
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Boot.C
//
// [Language] MSVC 1.0/1.5
//
// [Category] Bios BIOS Function
//
// [Description] This module does the bootstrap load to get DOS loaded
// [Description] and running.
//
// We look at the boot list to determine what drives should be used for the
// boot attempts. The boot sector is loaded into 0000:7c00 and control is
// transferred to that address.
// If the boot cannot be performed, then we exit.
//
// [Arguments] None
//
// [Return] If Boot Not Successful
//
581
The C Programs
// I N C L U D E F I L E S
#include "Bios.h"
// F U N C T I O N P R O T O T Y P E S
unsigned _boot(void);
// G L O B A L V A R I A B L E S
// L O C A L C O N S T A N T S
// this is the list of possible boot devices, in the order in which they
// should be tried.
// If all the named drives are tried and fail, then exit
// The list is terminated by a -1
// L O C A L D E F I N I T I O N S
// P R O G R A M
unsigned BootSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
LoadDS();
582
Introduction to AutoBios
if(BootBuffer->BootBufferSpace[255] == 0xaa55)
{
#if CfgBootSignatureCheck
// If a hard drive, allow booting
if(StrCmp(SignatureBuffer,CfgBootSignature) || BootDrive == 0x80)
{
// needs to pass drive # in DL to DOS
BootJump((unsigned char)BootDrive);
}
else
{
printf("Unauthorized Boot Diskette.\n");
}
#else
// needs to pass drive # in DL to DOS
BootJump((unsigned char)BootDrive);
#endif
}
else
{
printf("\nBoot Sector Signature was not the expected 55AA");
printf("\nDo you want to continue anyway ? (Y/N) ");
if (ToUpper((unsigned char)GetCharEcho()) == 'Y')
BootJump((unsigned char)BootDrive);
583
The C Programs
}
}
}
}
}
#else
#if (CfgBootUser)
printf("\n--- Jumping to User Specified Location %p",CfgBootUserLocation);
BootJump(CfgBootUserLocation)
#else
printf("\n---- No User Boot Specified -------\n");
#endif
#endif
};
584
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] System Services (Cassette) function
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] SysSrv.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] This module returns an error condition in AX in
// [Description] the event a user program calls this function.
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* G L O B A L S */
void SystemConfigurationTable(void);
/* L O C A L D E F I N T I O N S */
585
The C Programs
/* P R O G R A M */
/*-------------------------------------------------------*/
unsigned SystemServicesSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
struct _BiosObject far * Bios = GetBiosObject();
LoadDS();
_disable();
LowRam->IntVector[0x15]= (void near *)SystemServicesFunctionCall;
_enable();
Bios->DevicesInstalled |= Device;
return(SetupStatusOK);
}
/*-------------------------------------------------------*/
_enable();
switch (Regs->RegAH)
{
case OpcodeOpenDevice:
printsnapstring(MsgOpcodeOpenDevice);
Regs->RegAH = 0x00; Regs->RegFlags &= ~CarryBit;
break;
case OpcodeCloseDevice:
printsnapstring(MsgOpcodeCloseDevice);
Regs->RegAH = 0x00; Regs->RegFlags &= ~CarryBit;
break;
586
Introduction to AutoBios
case OpcodeProgramTerminate:
printsnapstring(MsgOpcodeProgramTerminate);
Regs->RegAH = 0x00; Regs->RegFlags &= ~CarryBit;
break;
587
The C Programs
case OpcodeDeviceBusy:
printsnapstring(MsgOpcodeDeviceBusy);
Regs->RegAH = 0x00;
Regs->RegFlags &= ~CarryBit;
break;
case OpcodeInterruptComplete:
printsnapstring(MsgOpcodeInterruptComplete);
Regs->RegAH = 0x00;
Regs->RegFlags &= ~CarryBit;
break;
case OpcodeSwitchToProtectedMode:
printsnapstring(MsgOpcodeSwitchToVirtualMode);
Regs->RegAH = VirtualMode(Regs->RegBX,MK_FP(Regs->RegES,Regs->RegSI));
if (Regs->RegAH != 0) Regs->RegFlags |= CarryBit;
break;
case OpcodeGetExtendedMemorySize:
printsnapstring(MsgOpcodeGetExtMemSize);
Regs->RegAH = InCmos(CmosRegExtMemFoundHigh);
Regs->RegAL = InCmos(CmosRegExtMemFoundLow);
Regs->RegFlags &= ~CarryBit;
break;
case OpcodeGetSystemConfigParms:
printsnapstring(MsgOpcodeReturnSystemParms);
Regs->RegES = GetCS();
Regs->RegBX = (unsigned)&SystemConfigurationTable;
Regs->RegFlags &= ~CarryBit;
Regs->RegAH = 0x00;
Regs->RegFlags &= ~CarryBit;
break;
#if CfgSysSrvKeyboardIntercept
#endif
default: printsnapstring(MsgOpcodeDefault);
case OpcodeKeyboardIntercept: // Omit any printing if from Keyboard
Regs->RegAH = 0x86;
Regs->RegFlags |= CarryBit;
break;
}
}
void Exception(void);
588
Introduction to AutoBios
void Exception()
{
outp(CfgVirtualErrorPort,2);
Shutdown();
};
LDT_ENTRY RomIDT[] =
{
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
{ (unsigned)Exception,offsetof(MoveGDT,MoveCS),0,0x87,0,},
};
LDT_ENTRY RomIDTDescriptor =
{ sizeof(RomIDT), RomIDT, CodeSegHigh, 0x93, 0 };
589
The C Programs
{
printf("\nName: %s - Limit: %4X - Base: %4X%4X - Access: %2X",
name,Vptr->LimitLow,Vptr->BaseMid,Vptr->BaseLow,
Vptr->Access);
};
Temp.TempLong = Build24BitAddress(FP_SEG(Vptr),FP_OFF(Vptr));
Vptr->MoveGDTDescriptor.LimitLow = sizeof(MoveGDT);
Vptr->MoveGDTDescriptor.BaseLow = Temp.TempShort[0];
Vptr->MoveGDTDescriptor.BaseMid = Temp.TempShort[1];
Vptr->MoveGDTDescriptor.Access = 0x93;
Vptr->MoveGDTDescriptor.Reserved = 0;
printf("\nVptr = %p",Vptr);
PrintDescriptor("GDT",&Vptr->MoveGDTDescriptor);
Vptr->MoveCS.LimitLow = (unsigned)-1;
Vptr->MoveCS.BaseLow = CodeSegLow;
Vptr->MoveCS.BaseMid = CodeSegHigh;
Vptr->MoveCS.Access = 0x9b;
Vptr->MoveCS.Reserved = 0;
PrintDescriptor("CS ",&Vptr->MoveCS);
590
Introduction to AutoBios
Temp.TempLong = Build24BitAddress(GetSS(),0);
Vptr->MoveSS.LimitLow = (unsigned)-1;
Vptr->MoveSS.BaseLow = Temp.TempShort[0];
Vptr->MoveSS.BaseMid = Temp.TempShort[1];
Vptr->MoveSS.Access = 0x93;
Vptr->MoveSS.Reserved = 0;
PrintDescriptor("SS ",&Vptr->MoveSS);
PrintDescriptor("IDT",&RomIDTDescriptor);
};
//----------------------------------------------------------
//
// Test Ram - size, test, and clear
//
//---------------------------------------------------------
// returns True/False in AX - size in cmos(30 and 31)
// note: these are all near procs, since they can be
// called from the Bios CS: only. After we do a restart,
// we are also in the Bios CS:, so we automatically connect
// with the right return address.
// The ram test is a combination of a block-move (Bios ->
// test area) followed by a block compare.
//
unsigned TestExtendedMemoryOK(void)
{
struct _VirtualObject far * VirtObjectPtr = GetVirtualObject();
struct StructureMoveGDT far * Vptr = &VirtObjectPtr->VirtualTestGDT;
union
{
unsigned TempShort[2];
unsigned long TempLong;
} Temp;
if(!ChipFunction(ChipFastGateA20,ChipEnable))
591
The C Programs
{
if(!NormalGateA20(EnableA20Command))
{
outp(CfgVirtualErrorPort,3);
printf("\nGate a20 loop fail");
return(False);
};
};
BuildDescriptor(Vptr);
Temp.TempLong = Build24BitAddress(FP_SEG(Vptr),FP_OFF(Vptr));
Vptr->MoveDS.LimitLow = (unsigned)-1;
Vptr->MoveDS.BaseLow = Temp.TempShort[0];
Vptr->MoveDS.BaseMid = Temp.TempShort[1];
Vptr->MoveDS.Access = 0x93;
Vptr->MoveDS.Reserved = 0;
PrintDescriptor("DS ",&Vptr->MoveDS);
Temp.TempLong = Build24BitAddress(GetES(),0);
Vptr->MoveES.LimitLow = (unsigned)-1;
Vptr->MoveES.BaseLow = Temp.TempShort[0];
Vptr->MoveES.BaseMid = Temp.TempShort[1];
Vptr->MoveES.Access = 0x93;
Vptr->MoveES.Reserved = 0;
PrintDescriptor("ES ",&Vptr->MoveES);
printf("\n");
};
//--------------------------------------------------------------------
//-------- move virtual block - function code 15h ----------
592
Introduction to AutoBios
if(!ChipFunction(ChipFastGateA20, ChipEnable))
{
NormalGateA20(EnableA20Command);
};
BuildDescriptor(Vptr); //(es:si)
PrintDescriptor("DS ",&Vptr->MoveDS);
PrintDescriptor("ES ",&Vptr->MoveES);
};
if(!ChipFunction(ChipFastGateA20, ChipEnable))
{
NormalGateA20(EnableA20Command);
593
The C Programs
}
// reload the 8259 interrupt controllers because we have changed
// the base address of the IDT (the interrupt vectors).
outp(inta00,0x11);
outp(inta01,InterruptIndex >> 8);
outp(inta01,0x04);
outp(inta01,0xff);
outp(intb00,0x11);
outp(intb01,InterruptIndex);
outp(intb01,0x02);
outp(intb01,0xff);
outp(intb01,0x01);
outp(intb01,0xff);
Vptr->ModeBios.LimitLow = (unsigned)-1;
Vptr->ModeBios.BaseLow = CodeSegLow;
Vptr->ModeBios.BaseMid = CodeSegHigh;
Vptr->ModeBios.Access = 0x9b;
Vptr->ModeBios.Reserved = 0;
PrintDescriptor("Bio",&Vptr->ModeBios);
PrintDescriptor("CS ",&Vptr->ModeCS);
PrintDescriptor("DS ",&Vptr->ModeDS);
PrintDescriptor("SS ",&Vptr->ModeSS);
PrintDescriptor("ES ",&Vptr->ModeES);
594
Introduction to AutoBios
//---------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] LPT driver
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] LPT.C
//
// [Language] MSVC 1.5
//
// [Description] Int 0x17 - parallel printer driver
//
// Input:
//
// AH = 0 print the character in AL
// on return, ah = 1 if character could not be printed
// (time out).
// Other bits set as on normal Status call
//
// AH = 1 initialize the printer Port
// returns with AH set with printer Status
//
// AH = 2 read the printer Status into (ah)
// 7 6 5 4 3 2 1 0
// | | | | | | | +-- time out
// | | | | | | +------ unused
// | | | | | +---------- unused
// | | | | +-------------- 1 = i/o error
// | | | +------------------ 1 = selected
// | | +---------------------- 1 = out of paper
// | +-------------------------- 1 = acknowledge
// +------------------------------ 1 = not busy
//
595
The C Programs
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
/* G L O B A L V A R I A B L E S */
/* G L O B A L C O N S T A N T S */
/* L O C A L D E F I N I T I O N S */
/* P R O G R A M */
unsigned LptSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
struct _BiosObject far * Bios = GetBiosObject();
LoadDS();
Bios->DevicesInstalled |= Device;
scan_lpt(0x3bc); scan_lpt(0x378); scan_lpt(0x278);
return(SetupStatusOK);
}
596
Introduction to AutoBios
if(Temp < 3)
{
LowRam->LPT_LIST[Temp] = Port;
LowRam->LPT_TIMEOUT_LIST[Temp] = 0xff;
};
/* init the Port automatically */
/* _asm { _asm mov dx,Temp _asm mov ah,1 _asm int 0x17 }; */
}
}
/*=======================================================================*/
_enable();
597
The C Programs
Regs->RegAH = 0;
outp (Port+2, 0x08); /* set init line low */
/* wait for the next timer transition */
DelayCall(100,Microseconds);
//while(ReadTimer() == ReadTimer());
outp (Port+2, 0x0c); /* set init line high */
goto read_Status;
case ReadStatus:
printsnapstring(MsgOpcodeReadStatus);
Regs->RegAH = 0;
read_Status:
Regs->RegAH = (inp(Port+1) & 0xf8) ^ 0x48;
}
}
}
/*====================================================================*/
598
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Serial Port Driver
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Comm.C
//
// [Language] MSVC 1.5
//
// [Purpose] Provides Serial Channel Low-Level Support
//
// [Description] Interrupt 0x14 -- Serial Port Driver
//
// [//] Provides a function call for initializing, sending data, receiving
data,
// [//] and reading the status of an asynchronous adapter.
//
// [//] Upon Entry:
//
// [//] DX = Logical Async device # (0,1,2,3) for COM1,2,3,4
//
// [//] OpcodeComInit the Port:
// [//] AH = 00h
// [//] AL = initialization parameters:
//
// [//] Bit Meaning
// [//] ----- -----------
// [//] Bits 7,6,5
// [//] 0 0 0 110 Baud
599
The C Programs
// [//] 0 0 1 150
// [//] 0 1 0 300
// [//] 0 1 1 600
// [//] 1 0 0 1200
// [//] 1 0 1 2400
// [//] 1 1 0 4800
// [//] 1 1 1 9600
//
// [//] Bits 4,3
// [//] 0 0 No parity
// [//] 0 1 Odd parity
// [//] 1 0 No parity
// [//] 1 1 Even parity
//
// [//] Bit 2
// [//] 0 One stop bit
// [//] 1 Two stop bits
//
// [//] Bits 1,0
// [//] 0 0 5 bits/char
// [//] 0 1 6 bits/char
// [//] 1 0 7 bits/char
// [//] 1 1 8 bits/char
//
// [//] Send a character:
// [//] AH = 01h
// [//] AL = the character to send
//
// [//] Receive a character:
// [//] AH = 02h
//
// [//] Read the Port status:
// [//] AH = 03h
//
// [//] Upon Exit:
//
// [//] For 'OpcodeComInit the Port' (AH=0):
// [//] AH = Line status
// [//] Bit Meaning if = 1
// [//] --- --------------
// [//] 7 Time out
// [//] 6 Tx Empty (TEMT)
// [//] 5 Tx Holding Register Empty (THRE)
// [//] 4 Break Interrupt (BI)
// [//] 3 Framing Error (FE)
// [//] 2 Parity Error (PE)
// [//] 1 Overrun Error (OE)
// [//] 0 Data Ready (DR)
//
// [//] AL = Modem status
// [//] Bit Meaning if = 1
// [//] --- --------------
// [//] 7 Data Carrier Detect (DCD)
// [//] 6 Ring Indicator (RI)
// [//] 5 Data Set Ready (DSR)
// [//] 4 Clear To Send (CTS)
600
Introduction to AutoBios
601
The C Programs
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
/* G L O B A L V A R I A B L E S */
/* G L O B A L C O N S T A N T S */
/* L O C A L D E F I N I T I O N S */
/* opcode definitions */
/* P R O G R A M */
/*
// SCAN Com Ports -
602
Introduction to AutoBios
// This routine is called to determine how many Ports are in the system
*/
unsigned CommSetup(ActionArgument)
{
unsigned Temp;
struct _BiosRam far * LowRam = 0;
struct _BiosObject far * Bios = GetBiosObject();
LoadDS();
_disable();
LowRam->IntVector[0x14]= (void near *)CommFunctionCall;
_enable();
#if CfgComm
scan_comm(0x3f8); scan_comm(0x2f8); scan_comm(0x3e8); scan_comm(0x2e8);
Bios->DevicesInstalled |= Device;
return(SetupStatusOK);
#else
return(SetupStatusStub);
#endif
}
#if CfgComm
void scan_comm(unsigned Port)
{
struct _BiosRam far * LowRam = 0;
unsigned Temp;
outp(Port+3,0x55);
NoOpcode; NoOpcode; NoOpcode; /* NoOpcodes for bus delay */
if (inp(Port+3) == 0x55)
{
LowRam->EquipFlag.NrComPorts++;
for (Temp = 0;((Temp < 4) && (LowRam->COMM_LIST[Temp] != 0));Temp++);
if(Temp < 4)
{
LowRam->COMM_LIST[Temp] = Port;
LowRam->COMM_TIMEOUT_LIST[Temp] = 0xff;
};
//?????????????????????????????????/
/* init the Port to 9600 baud */
_asm { _asm mov ax,0x00e3 _asm mov dx,Temp _asm int 0x14 };
//_asm { _asm mov ax,CfgComm1Init _asm mov dx,Temp _asm int 0x14 };
}
}
#endif
/*-------------------------------------------------------------------*/
603
The C Programs
_enable();
switch(Regs->RegAH)
{
case OpcodeComInit: printsnapstring(MsgOpcodeInitPort);
Regs->RegAH = 00;
/* set Divisor latch enable */
outp(Port+LineCtrlReg,0x80);
/* get the Divisor */
Divisor = baud_table[(Regs->RegAL >> 5) & 0x07];
/* load the baud rate Divisor into the 8250 */
outp(Port+DivLsbReg,Divisor);
outp(Port+DivMsbReg,(Divisor >> 8));
/* set length,parity,stop bits */
outp(Port+LineCtrlReg,(Regs->RegAL & 0x1f));
/* set DTR and RTS lines */
outp(Port+ModemCtrlReg,(0x08 | DtrBit | RtsBit));
Regs->RegAH = (char)inp(Port+LineStatusReg);
Regs->RegAL = (char)inp(Port+ModemStatusReg);
break;
TimeOutCounter = SetTimeOutCount(TimeOut);
604
Introduction to AutoBios
/* check DSR */
TimeOutCounter = SetTimeOutCount(TimeOut);
while(((inp(Port+ModemStatusReg) & DsrBit) != DsrBit))
{
if (LowRam->TimerLong >= TimeOutCounter)
{Regs->RegAH |= timeout_bit; break;}
}
if (Regs->RegAH == 0) /* OK - no timeout */
{
case OpcodeComStatus:
printsnapstring(MsgOpcodeReadStatus);
Regs->RegAH = (char)inp(Port+LineStatusReg);
605
The C Programs
Regs->RegAL = (char)inp(Port+ModemStatusReg);
break;
default: printsnapstring(MsgOpcodeBadCommand);
;
}
}
#endif
}
//-------------------------------------------------------------------
// This section is used if the serial port is enabled as a SysVue
// console device
// Note: this code is a template and has not yet been tested
void LoadBuffer(unsigned);
#if CfgConsoleInSerial
unsigned SysVueConsoleSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
unsigned status = True;
unsigned Divisor;
LoadDS();
_disable();
606
Introduction to AutoBios
return(SetupStatusOK);
};
_enable();
// get the incoming ASCII code from the serial port and place
// it in the Keyboard Buffer
LoadBuffer((unsigned) inp(CfgSysVueConsolePort));
607
The C Programs
je local10
loop local5
dec bl
jnz local4
local10:
mov al,TempAL
mov dx,CfgSysVueConsolePort
out dx,al
pop cx
pop bx
pop dx
}
};
/*======================================================*/
608
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Real time clock service routine
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Tmr.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] Interrupt 0x08 This routine services the real time
// [Description] clock interrupt.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
/* G L O B A L S */
/* C O N S T A N T S */
/* D E F I N E S */
609
The C Programs
/* P R O G R A M */
unsigned TimerSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
struct _BiosObject far * Bios = GetBiosObject();
LoadDS();
_disable();
LowRam->IntVector[0x1C]= (void near *)DummyIret;
LowRam->IntVector[0x08]= (void near *)TimerISR;
#if CfgCmos
LowRam->IntVector[0x4A]= (void near *)DummyIret;
LowRam->IntVector[0x70]= (void near *)RTC_INT;
#endif
_enable();
Bios->DevicesInstalled |= Device;
return(SetupStatusOK);
}
//===============================================
// Interrupts are enabled by calling Int 1A, event or alarm function calls.
// For events, the ISR will decrement the counter and set the specified
// location to 0x8000.
// The user must provide the address of an alarm routine to be executed
// when the alarm interrupt occurs.
610
Introduction to AutoBios
#if CfgCmos
unsigned flags;
#endif
611
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Bios Time Of Day function
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Tod.C
//
// [Language] MSVC 1.5
//
// [Description] Interrupt 0x1A - Time of Day function call -
// read/set the clock
//
//
// Interrupt 1AH - Time of Day function call
// read/set the internal clock or the 6818 clock chip
//
// AH = 0 - read the clock.
// returns:
// CX = high word of count
// DX = low word of count
// AL = 0 if no 24 hour rollover since last read
//
// AH = 1 - set the clock
// CX = high word of count
// DX = low word of count
//
// AH = 2 - read the time from the 6818 clock
// returns:
// CH = BCD hours
// CL = BCD minutes
// DH = BCD seconds
// CY flag if 6818 not running
//
// AH = 3 - set the time to the 6818 clock
// CH = BCD hours
// CL = BCD minutes
// DH = BCD seconds
// DL = 0/1 = normal/daylight time
//
// AH = 4 - read the date from the 6818 clock
613
The C Programs
// returns:
// CH = BCD century
// CL = BCD year
// DH = BCD month
// DL = BCD day
// CY flag if 6818 not running
//
// AH = 5 - set the date to the 6818 clock
// CH = BCD century
// CL = BCD year
// DH = BCD month
// DL = BCD day
//
// AH = 6 - set the 6818 alarm
// CH = BCD hours from set time
// CL = BCD minutes from set time
// DH = BCD seconds from set time
// returns:
// CY flag if alarm already set
// NOTE: function 6 is hooked through Int. 4ah, user replaceable.
//
//
// AH = 7 - reset the 6818 alarm off
//
// [History] 2.00 04/11/94 Original
//
//--------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
unsigned UpdateInProgress(void);
unsigned InitializeRealTimeClock(void);
void _time_of_day(void);
/* G L O B A L S */
/* L O C A L D E F I N I T I O N S */
/* P R O G R A M */
614
Introduction to AutoBios
unsigned TimeOfDaySetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
struct _BiosObject far * Bios = GetBiosObject();
LoadDS();
_disable();
LowRam->IntVector[0x1A]= (void near *)TimeOfDayFunctionCall;
_enable();
Bios->DevicesInstalled |= Device;
if(!SetTimerCount()) return(SetupStatusError);
return(SetupStatusOK);
}
switch(Regs->RegAH)
{
case OpcodeReadTimeCounter:
printsnapstring(MsgOpcodeReadCurrentClock);
_disable();
Regs->RegAL = (char)LowRam->TimerOverflow;
Regs->RegDX = LowRam->TimerLow;
Regs->RegCX = LowRam->TimerHigh;
LowRam->TimerOverflow = 0;
_enable();
break;
case OpcodeSetTimeCounter:
printsnapstring(MsgOpcodeSetTimeCounter);
_disable();
LowRam->TimerLow = Regs->RegDX;
LowRam->TimerHigh = Regs->RegCX;
LowRam->TimerOverflow = 0;
_enable();
break;
default: printsnapstring(MsgOpcodeBadCommand);
Regs->RegFlags |= CarryBit;
break;
#if CfgCmos
case OpcodeReadRTC: printsnapstring(MsgOpcodeReadTime);
615
The C Programs
616
Introduction to AutoBios
case OpcodeResetAlarm:
printsnapstring(MsgOpcodeResetAlarm);
OutCmos(CmosRegStatusB,InCmos(CmosRegStatusB) & 0x57);
break;
#endif
}
};
/*--------------------------------------------------
-----------------------------------------------------*/
#if CfgCmos
unsigned UpdateInProgress(void)
{
unsigned j = 0;
while(j++ < 2000) { if (!(InCmos(CmosRegStatusA) & BIT7)) return(False); };
return(True);
}
unsigned InitializeRealTimeClock(void)
{
OutCmos(CmosRegStatusA,0x26);
OutCmos(CmosRegStatusB,0x82);
InCmos(CmosRegStatusC);
InCmos(CmosRegStatusD);
return(True);
}
#endif
617
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] 8042 Keyboard Controller functions
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Bios8042.C
//
// [Language] MSVC 1.0/1.5
//
// [Category] Bios Keyboard Controller Support
//
// [Description] This module includes AT keyboard controller functions.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
619
The C Programs
/==================================================*/
unsigned Reset8042()
{
unsigned stat = True;
unsigned long jj; /* 1 second delay counter */
/* mask out interrupts in case they are still enabled */
outp(0x21,inp(0x21) | 0x02);
/* purge the 8042's output buffer */
inp(0x60);
/* reset the 8042 */
if(!Send8042(0xaa)) stat = False;
if(!WaitToRx8042()) stat = False;
620
Introduction to AutoBios
#endif
/* configure 8042 */
if(!Send8042(0x60)) stat = False;
if(!Send8042Data(0x45)) stat = False;
//if(!Send8042Data(0x65)) stat = False; // for PS/2
DelayCall(20,Milliseconds); // delay for AMI, Everex, Award
outp(0x21,inp(0x21) & ~0x02);
return(stat);
}
/*---- this gets the video jumper byte from the 8042 ----*/
unsigned GetVideoJumper()
{
#if CfgPlatformAT
unsigned temp = 0;
outp(0x21,inp(0x21) | 0x02);
WaitToSend8042();
Send8042((char)0xc0); /* read the jumper command */
WaitToRx8042();
temp = inp(0x60);
outp(0x21,inp(0x21) & ~0x02);
if ((temp & 0x40) == 0) return(2);
/* return CGA index value, else */
return(3); /* return MDA index value */
#else
return(ReadSwitches() >> 4 & 0x03);
#endif
}
unsigned WaitToSend8042(void)
{
struct _BiosRam far * LowRam = 0;
unsigned long jj = SetTimeOutCount(20); /* 1 second delay */
do
{
if((inp(0x64) & 0x02) == 0) return(True);
} while (LowRam->TimerLong < jj);
return(False);
}
unsigned WaitToRx8042()
{
struct _BiosRam far * LowRam = 0;
unsigned long jj = SetTimeOutCount(20); /* 1 second delay */
do
{
621
The C Programs
622
Introduction to AutoBios
/*************************************************************************
*
* [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
*
* [Product Name] AutoBios
*
* [Module Name] Object primitives
*
* [Version] 2.00
*
* [Author] John O. Foster
*
* [Date] 04/11/94
*
* [File Name] Object.C
*
* [Language] MSVC 1.0/1.5
*
* [Description] This module contains the primitive Object operators
* 1. Create a system Object
* 2. Allocate from system Object
* 3. Release from system Object
*
* [Arguments]
*
* [Return]
*
* [History] 2.00 04/11/94 Original
*
******************************************************************************
*********************/
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
/* G L O B A L V A R I A B L E S */
623
The C Programs
/* G L O B A L C O N S T A N T S */
/* L O C A L D E F I N I T I O N S */
/* P R O G R A M */
/*
// NOTE: We build an initial set of Object in the 1st 64k.
// Later, after we have sized memory and determined where to place
// the final Object, a rebuild rather than a simple block-move is
// required because of the far pointers we use.
// The move system segment routine will have to do a complete rebuild !
// if(System = MK_FP(SystemSegmentPointer,0) == 0)
if(!System)
{
624
Introduction to AutoBios
MemorySizeWord -= (BlockSize/1024);
System = GetSystemObject();
System->PoolEnd = MK_FP(SystemSegmentPointer,BlockSize);
}
return(System);
}
/*
** block size is passed as number of bytes needed.
625
The C Programs
return(Object);
}
PopInterruptStatus;
return(0); // A NULL Ptr indicates no acquire performed
};
626
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Bios printf routines
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] Printf.c
//
// [Language] MSVC 1.0/1.5
//
// [Description] This routine implements a subset of the standard
// [Description] printf function, modified for Bios use
// [Description] in Bios applications. The Cold/Warm and Watch
// [Description] capabilities are additions.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* P R O T O T Y P E S */
627
The C Programs
/* D E F I N I T I O N S */
/* P R O G R A M */
void putcountedchar(char c)
{
// colcounter // must be somewhere permanent !!! later
};
628
Introduction to AutoBios
==============================================================*/
c = *FormatPtr++;
switch(c)
{
/* %c is for character */
case 'c': case 'C': PutChar((char)(va_arg(ArgPtr,int))); break;
/* %x is for hex */
case 'x': case 'X':
// Build running additive checksum for hex value prints before
// ArgPtr gets advanced to the next argument
629
The C Programs
HexSum += *ArgPtr;
if (width) put16(va_arg(ArgPtr,unsigned),width);
else puthex(va_arg(ArgPtr,unsigned));
break;
/* %s is for string */
/* This is recursive, the string might have format codes in it ! */
case 's': case 'S': printf(va_arg(ArgPtr,char far *)); break;
/* %w is print if WatchFlag is on */
case 'w': case 'W':
if (!WatchActive()) print_flag = False;
break;
/* %n is print if SnapFlag is on */
case 'n': case 'N':
if (!SnapActive()) print_flag = False;
break;
default:
// unrecognized format specifier
break;
}
}
break;
630
Introduction to AutoBios
default:
if (c == '\n') { PutChar('\n'); PutChar('\r'); } else PutChar(c);
break;
}
}
return(HexSum & 255);
}
631
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Display Pause routine
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] PAUSE.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
void Pause(void)
{
while(kbhit()) { GetChar();}; // get any pending keys
printf("\n>--- Hit Any Key to Continue ---<");
while(!kbhit()) { }; GetChar();
}
633
Introduction to AutoBios
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Check for key depressed routine
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] KbHit.c
//
// [Language]MSVC 1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/*
** check to see if any key present at console device --
** returns true if a key waiting
*/
unsigned kbhit(void)
{
_asm
{
mov ax,0x0100
int 0x16
mov ax,False
jz kbno
mov ax,True
kbno:
};
}
635
The C Programs
636
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] String to Token Routine
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] StrTok.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
// StrTok examines a string, detecting a series of zero or more tokens
// separated by one or more control characters from the Control list
// of separators. The first call is made with the pointer to the string
// to be examined, and the separation character following the token
// is replaced with a null to mark the end of the token. A pointer to
// the beginning of the token is returned. The value of NextToken is also
// updated to point to the next token in the string. Subsequent calls
// are made with String = NULL, and the NextToken value is used to advance
// through the string until no more tokens remain, in which case, a NULL
// is returned.
//
// This routine is an adaptation of the standard library function,
// modified for re-entrancy for Bios use.
//
// [Arguments]
// A pointer to the string, a pointer to the separation characters list,
// and a pointer to the intermediate NextToken save location.
// [Return]
// A far pointer to the detected token, and an updated NextToken value.
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
// I N C L U D E F I L E S
#include "Bios.h"
// P R O G R A M
637
The C Programs
//-------------------------------------------------------
638
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] String in a String Function
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] StrStr.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
// char far *StrStr(char far *string1,char far *string2)
// checks to see if string2 occurs in string1.
// If true, it returns a pointer to the location in string1.
// If not, it returns a NULL.
//
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* P R O G R A M */
639
The C Programs
return(NULL);
}
640
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] String Compare Function
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] StrCmp.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] Compare the two strings for lexical order. Ends the
// [Description] comparison when the following occurs: (1) strings
// [Description] differ, or (2) the end of the strings is reached.
// [Description] For the purposes of the comparison, upper case
// [Description] characters are converted to lower case.
//
// unsigned StrCmp(char far *stringa, char far *stringb)
//
// Exit values:
// returns True if strings compare
// returns False if strings do not compare
//
// This is somewhat similar to the standard function "strnicmp"
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* P R O G R A M */
641
The C Programs
642
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Print Screen function
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] PrtScr.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] Interrupt 0x05 - Print Screen Handler
// This module copies the contents of the screen buffer to the printer.
//
// [Arguments] None
//
// [Return] None
//
// [History] 2.00 04/11/94 Original
//
//---------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
unsigned LptPrint(char,unsigned);
643
The C Programs
/* G L O B A L S */
/* P R O G R A M */
unsigned PrintScreenSetup(ActionArgument)
{
struct _BiosRam far * LowRam = 0;
struct _BiosObject far * Bios = GetBiosObject();
struct _PrtScrRegs far * Me;
LoadDS();
#if !CfgPrintScreen
LowRam->IntVector[0x05]= (void near *) DummyIret;
return(SetupStatusStub);
#else
LowRam->IntVector[0x05]= (void near *) PrintScreenFunctionCall;
Bios->DevicesInstalled |= Device;
return(SetupStatusOK);
#endif
}
#if CfgPrintScreen
void PrtScrCall(struct _IRegs far * Regs);
_enable();
Error = False;
/* send cr-lf */
if(LptPrint(0,0x0d) & 0x01) Error = True;
else if(LptPrint(0,0x0a) & 0x01) Error = True;
644
Introduction to AutoBios
#endif
645
Introduction to AutoBios
8. SysVue
This section includes the top SysVue File, and the supporting command files.
647
The C Programs
The "Int" command allows the execution of an interrupt, using the register values set with the "Rxx"
commands. This permits specialized execution of bios functions from within sysvue. With the watch
function enabled, this is a handy debugging aid.
SysVue may also be expanded with new commands as desired.
An easy way for you to generate documentation of your version of SysVue is to use the ">LPT"
command to provide hard copy of the various screens and menus. These printouts may then be integrated
into the user documentation you create.
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Bios version of SysVue
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] SysVue.C
//
// [Language] MSVC 1.5
//
// [Description] This is the SysVue module which is a Bios-resident
// [Description] debug/monitor program.
//
// NOTE:
// Entry to SysVue is by CTRL-ALT-BREAK.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void syntax_error(VueRegSet);
static unsigned ExecuteCommand(void far *);
/* G L O B A L V A R I A B L E S */
648
Introduction to AutoBios
/* G L O B A L C O N S T A N T S */
/* L O C A L D E F I N I T I O N S */
/* L O C A L C O N S T A N T S */
649
The C Programs
650
Introduction to AutoBios
/* P R O G R A M */
unsigned SysVueSetup(ActionArgument)
{
VueRegSet;
struct _BiosRam far * Vectors = 0;
struct _SystemObject far * System = GetSystemObject();
struct _BiosObject far * Bios = GetBiosObject();
Bios->FlagMaster[Snap].Master = SnapMasterPattern;
Bios->FlagMaster[Watch].Master = WatchMasterPattern;
_disable();
Vectors->IntVector[0x18]= (void near *) SysVue;
_enable();
Bios->DevicesInstalled |= Device;
651
The C Programs
return(SetupStatusOK);
}
/*==============================================*/
/*==============================================*/
/*======= SysVue Main Routine ==================*/
/*==============================================*/
/*==============================================*/
652
Introduction to AutoBios
{
register i;
struct _BiosRam far * Vectors = 0;
struct _SystemObject far * System = GetSystemObject();
struct _SysVueObject far * Me = System->SysVueObjectPtr;
void far * OldMe;
_enable();
// chain the break vector through SysVue logic: if the break flag is
// set by the sysbreak isr, return a true from the csts routine to
// abort the op in progress. when exiting SysVue: de-chain the vector
// back to the original state for normal operation.
_disable();
Me->SysVueBreakChain = Vectors->IntVector[0x1B];
Vectors->IntVector[0x1B]= (void near*)SysBreak;
_enable();
if(NameExists(origin,OriginList))
printf("\nSysVue entered from %s Origin",GetName(origin,OriginList));
// move the stacked registers into the saves so we know where we came from
//printf("\nSaving Registers");
//MemCpy(&Me->RegSaves,Regs,sizeof(struct _IRegs));
//printf("\nSaving Registers Complete");
// if(peek(0x26a,0x316) == 0x0beb)
//{
653
The C Programs
DisplayRegistersAndFlags(Regs);
//printf("\n %4x:%4x %2x %2x",Regs->RegCS,Regs->RegIP,
//MK_FP(Regs->RegCS,Regs->RegIP),MK_FP(Regs->RegCS,Regs->RegIP+1));
// lword(cs);printf(":");lword(ip);printf(" ");
// lbyte(peekb(cs,ip));
// printf(" ");
// lword(peek(cs,ip+1));
//}
if(--Me->TraceCount != 0)
{
if(ConsoleBreak())
{
Me->ExitFlag = False;
Me->TraceCount=1;
}
else
{
// check for any key
if (kbhit())
{
Me->ExitFlag = False;
Me->TraceCount=1;
}
else
{
Me->ExitFlag = True;
//Me->RegSaves[pswsave] |= 0x0100; // set trace bit
// chain-in the trace vector
_disable();
Me->SysVueTraceChain = Vectors->IntVector[0x01];
Vectors->IntVector[0x01]= (void near *)SysTrace;
_enable();
}
}
}
}
if(origin == OriginBoot)
{
Me->TraceCount = 1;
// restore the trapped locations and decrement the
// pc value
// clear the trap saves and stuff
}
654
Introduction to AutoBios
if(origin == OriginDivide)
{
printf("\nDivide Overflow at location - %4x:%4x",Regs->RegCS,Regs->RegIP);
}
if(origin == OriginSysError)
{ printf("\nSystem Error, Type - %4x",Regs->RegAX); }
while (!Me->ExitFlag)
{
printf("\nSysVue>");
gets(Me->LineBuffer,sizeof(Me->LineBuffer),'\r');
if(Me->ArgC = BuildArguments(Me))
{
/* execute the command */
if(!ExecuteCommand(Me)) printf("\nUnrecognized Command");
}
else
{ printf("\nNo Command Seen"); }
}
// set_vector(0x1b,FP_OFF(BiosObject->SysVueBreakChain),FP_SEG(BiosObject-
>SysVueBreakChain));
Me->ObjectStatusFlags.InUse = False;
Me->SysVueBusy = False; /* release Sysvue */
_disable();
Vectors->IntVector[0x1B]= Me->SysVueBreakChain;
_enable();
}
}
//======================================================================
//--- This function checks the command list, and executes the command --
unsigned ExecuteCommand(VueRegSet)
{
void (near * funct_ptr) (VueRegSet); unsigned j = 0;
655
The C Programs
void nmi_int(VueRegSet) { ; }
//-------------------------------------------------------------
656
Introduction to AutoBios
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Calculator Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdCalc.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdHex(VueRegSet)
{
printf("\n Sum is: %4x",Me->Token[1].Value.LongValue +
Me->Token[2].Value.LongValue);
printf("\nDifference is: %4x",Me->Token[1].Value.LongValue -
Me->Token[2].Value.LongValue);
}
657
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Checksum Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdChksm.c.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdChecksum(VueRegSet)
{
unsigned char sum = 0;
while ((Me->Token[0].Value.LongValue <=
Me->Token[1].Value.LongValue) && !ConsoleBreak());
{
sum += *Me->Token[0].Value.CharPtr++;
};
printf("\nChecksum = %2x",sum);
}
659
The C Programs
660
Introduction to AutoBios
//***********************************************************************
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Chip Dump Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdChip.C
//
// [Description] This module dumps the contents of the chipset used.
//
// [History] 2.00 04/11/94 Original
//
//**********************************************************************
#include "Bios.h"
#include "chipc.tmp"
void CmdChip()
{
unsigned LineCounter = 1;
unsigned i = 0;
printf("\n%s Dump",ChipID);
printf("\nReg = Default Val Description");
while(StrLen(DumpList[i].ItemName))
{
printf("\n%2x = %2x %2x %s",
DumpList[i].ItemAddress,
DumpList[i].ItemDefault,
ReadChipRegister(DumpList[i].ItemAddress,
DumpList[i].ItemSize),
DumpList[i].ItemDescription);
if(!(LineCounter++ % 16)) Pause(); /* pause when the screen is full */
i++;
};
};
661
The C Programs
662
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue CMOS Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdCmos.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//--------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
sum = 0;
for(j = 0x10; j < 0x2e; j++) { sum += InCmos(j); }
663
The C Programs
664
Introduction to AutoBios
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Clear Screen Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdCLS.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
void CmdCLS(VueRegSet)
{
#if CfgANSI
printf("\033[2J");
#else
VideoSetMode(VideoGetMode());
#endif
};
665
Introduction to AutoBios
//----------------------------------------------------------------------
//
/* I N C L U D E F I L E S */
#include "Bios.h"
void CmdCompareAscii(VueRegSet)
{ Me->ModeSize = SizeIsByte; Me->ModeType = TypeAscii; CmdCompare(VueSet); };
void CmdCompareByte(VueRegSet)
{ Me->ModeSize = SizeIsByte; Me->ModeType = TypeHex; CmdCompare(VueSet); };
void CmdCompareWord(VueRegSet)
{ Me->ModeSize = SizeIsWord; Me->ModeType = TypeHex; CmdCompare(VueSet); };
void CmdCompareDouble(VueRegSet)
{ Me->ModeSize = SizeIsLong; Me->ModeType = TypeHex; CmdCompare(VueSet); };
void CmdCompare(VueRegSet)
{
//printf("\nReached compare routine");
while ((Me->Token[1].Value.LongValue <= Me->Token[2].Value.LongValue) && !
ConsoleBreak())
{
if(Me->ModeType == TypeAscii)
{
//printf("\nComparing Ascii");
667
The C Programs
if (*Me->Token[1].Value.CharPtr != *Me->Token[3].Value.CharPtr)
{
printf("\n%p > %c %c < %p",
Me->Token[1].Value.LongValue,*Me->Token[1].Value.CharPtr,
*Me->Token[3].Value.CharPtr, Me->Token[3].Value.LongValue);
}
/* Point to the next location */
Me->Token[1].Value.CharPtr++; Me->Token[3].Value.CharPtr++;
}
else
{
switch(Me->ModeSize)
{
default:
case SizeIsByte:
//printf("\nComparing Bytes");
if (*Me->Token[1].Value.CharPtr != *Me->Token[3].Value.CharPtr)
{
printf("\n%p > %2x %2x < %p",
Me->Token[1].Value.LongValue, *Me->Token[1].Value.CharPtr,
*Me->Token[3].Value.CharPtr, Me->Token[3].Value.LongValue);
}
/* Point to the next location */
//printf("\nIncrementing Pointers");
Me->Token[1].Value.CharPtr++; Me->Token[3].Value.CharPtr++;
break;
case SizeIsWord:
//printf("\nComparing Words");
if (*Me->Token[1].Value.WordPtr != *Me->Token[3].Value.WordPtr)
{
printf("\n%p > %2x %2x < %p",
Me->Token[1].Value.LongValue, *Me->Token[1].Value.WordPtr,
*Me->Token[3].Value.WordPtr, Me->Token[3].Value.LongValue);
}
/* Point to the next location */
Me->Token[1].Value.WordPtr++; Me->Token[3].Value.WordPtr++;
break;
case SizeIsLong:
//printf("\nComparing Longs");
if (*Me->Token[1].Value.LongPtr != *Me->Token[3].Value.LongPtr)
{
printf("\n%p > %2x %2x < %p",
Me->Token[1].Value.LongValue, *Me->Token[1].Value.LongPtr,
*Me->Token[3].Value.LongPtr, Me->Token[3].Value.LongValue);
}
/* Point to the next location */
Me->Token[1].Value.LongPtr++; Me->Token[3].Value.LongPtr++;
break;
}
}
}
//printf("\nExiting Compare");
}
668
Introduction to AutoBios
669
Introduction to AutoBios
//---------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Date Command
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdDate.C
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//---------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdDate(VueRegSet)
{
unsigned Month,Day,Year;
if(Me->ArgC > 1) // if anything entered
{
printf("\nGoing to Parse: %s",Me->ArgV[1]);
Month = ParseDigitString(Me->ArgV[1],1);
Day = ParseDigitString(Me->ArgV[1],2);
Year = ParseDigitString(Me->ArgV[1],3);
printf("\n%2d:%2d:%2d",Month,Day,Year);
671
The C Programs
672
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Disk Drives Command
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdDrive.C
//
// [Description]
//
// NOTE:
// Entry to SysVue is by CTRL-ALT-BREAK.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdDrive(VueRegSet)
{
register Temp,DecValue;
unsigned Mask, Key, HardCell;
673
The C Programs
case 'A':
case 'B':
if(NameExists(Me->ArgV[2],DiskList))
{
Temp = *Me->ArgV[1] - 'A';
Key = GetValue(Me->ArgV[2],DiskList); Key |= (Key << 4);
Mask = DiskMaskTable[Temp]; Key &= Mask;
ResetCmosBits(CmosRegDiskDriveType,Mask);
SetCmosBits(CmosRegDiskDriveType,Key);
}
else
{
beep();
return;
};
break;
case 'C':
case 'D':
Temp = *Me->ArgV[1] - 'C';
HardCell = HardCellTable[Temp];
if(IsDecimalString(Me->ArgV[2]))
{
DecValue = AsciiToDec(Me->ArgV[2]);
if(DecValue < 49)
{
if(DecValue > 15) { Key = 15; }
else
if(DecValue < 15) { Key = DecValue; DecValue = 0; }
else
if(DecValue == 15) { Key = 0; DecValue = 0; };
ResetCmosBits(CmosRegHardDriveType,Mask);
SetCmosBits(CmosRegHardDriveType,Key);
OutCmos(HardCell,DecValue);
} else beep();
} else beep();
break;
if(InCmos(CmosRegDiskDriveType) != 0)
SetCmosBits(CmosRegEquipment,0x01);
else
ResetCmosBits(CmosRegEquipment,0x01);
};
CalcCmosChecksum(); // recalc checksum
}
printf("\nOptions for Drive A: and B: are:\n");
PrintNames(DiskList);
printf("\nOptions for Hard drives C: and D: are Type 0 - 48");
printf("\nFor list of hard drive types, enter ""Types""");
674
Introduction to AutoBios
DisplayDrives();
}
675
Introduction to AutoBios
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Dump Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdDump.C
//
// [Category] SysVue Command Implementation
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* P R O G R A M */
void CmdDumpAscii(VueRegSet)
{ Me->ModeType = TypeAscii; CmdDump(Me); };
void CmdDumpByte(VueRegSet)
{ Me->ModeSize = SizeIsByte; Me->ModeType = TypeHex; CmdDump(Me); };
//void CmdBootDump(VueRegSet)
//{ Me->ModeSize = SizeIsByte; Me->ModeType = TypeHex; CmdBootDump(Me); };
void CmdDumpWord(VueRegSet)
{ Me->ModeSize = SizeIsWord; Me->ModeType = TypeHex; CmdDump(Me); };
void CmdDumpDouble(VueRegSet)
{ Me->ModeSize = SizeIsLong; Me->ModeType = TypeHex; CmdDump(Me); };
void CmdDump(VueRegSet)
{
677
The C Programs
union
{
void far * Ptr;
unsigned long PtrAsLong;
};
unsigned LineCounter = 1;
unsigned i;
if(!Me->Token[1].ValueMask.LongMask)
Me->Token[1].Value.LongValue = Me->LastDumpSave;
switch(Me->ModeType)
{
case TypeAscii:
// if start and end are the same, then bump the end
if(Me->Token[2].Value.WordValue[1] == Me->Token[1].Value.WordValue[1])
Me->Token[2].Value.LongValue = Me->Token[1].Value.LongValue + 1023;
;
//if(!Me->Token[2].ValueMask.LongMask)
// Me->Token[2].Value.LongValue =Me->Token[1].Value.LongValue + 1023;
do
{
printf("%a",*Me->Token[1].Value.CharPtr++);
//if(!(LineCounter++ % 20)) Pause(); /* pause when the screen is full */
} while ((Me->Token[1].Value.LongValue % 64));
};
break;
case TypeHex:
//if(!Me->Token[2].ValueMask.LongMask)
// Me->Token[2].Value.LongValue = Me->Token[1].Value.LongValue + 255;
//if(!Me->Token[2].ValueMask.WordMask[1])
// Me->Token[2].Value.WordValue[1] = Me->Token[1].Value.WordValue[1];
// if start and end are the same, then bump the end
if(Me->Token[2].Value.WordValue[1] == Me->Token[1].Value.WordValue[1])
Me->Token[2].Value.LongValue = Me->Token[1].Value.LongValue + 255;
;
678
Introduction to AutoBios
switch(Me->ModeSize)
{
case SizeIsByte: printf("%2x ",*Me->Token[1].Value.CharPtr++); break;
case SizeIsWord: printf("%4x ",*Me->Token[1].Value.WordPtr++); break;
case SizeIsLong: printf("%p " ,*Me->Token[1].Value.LongPtr++); break;
};
if(!(Me->Token[1].Value.WordValue[0] % 4)) printf(" ");
}
while ((Me->Token[1].Value.LongValue % 16));
printf(" ");
for (i = - 16; i != 0; printf("%a",*(Me->Token[1].Value.CharPtr + i)), i+
+);
if(!(LineCounter++ % 20)) Pause();
};
break;
};
Me->LastDumpSave = Me->Token[2].Value.LongValue + 1;
}
void CmdBootDump(VueRegSet)
{
unsigned i;
679
Introduction to AutoBios
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Enter Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdEnter.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] This is the SysVue Enter Command.
//
// NOTE:
// Entry to SysVue is by CTRL-ALT-BREAK.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
// this would be the case for an Execute Command which may not be
// implemented
//void ENTER_(VueRegSet)
//{
//struct _BiosRam far * LowRam = 0;
// struct SYSTEM_Object far * System = GetSystemObject();
//struct BIOS_Object far * BiosObject = System->Bios_Ptr;
// if e<enter> then it is execute else it is enter
681
The C Programs
//}
void CmdEnter(VueRegSet)
{
unsigned inchar = ' ',Temp;
if(*Me->Token[2].Value.CharPtr)
{
switch(Me->ModeSize)
{
case SizeIsByte:
*Me->Token[1].Value.CharPtr = Me->Token[2].Value.LongValue;
break;
case SizeIsWord:
*Me->Token[1].Value.WordPtr = Me->Token[2].Value.LongValue;
break;
case SizeIsLong:
*Me->Token[1].Value.LongPtr = Me->Token[2].Value.LongValue;
}
}
else
{
printf("\n%p",Me->Token[1].Value.LongValue);
/* solicit input */
Temp = inchar;
/* terminate this on a cr */
if(Temp = gets(Me->EnterBuffer,sizeof(Me->EnterBuffer),' ') == '\n') break;
printf(" -- Me->EnterBuffer = %s -- ",Me->EnterBuffer);
682
Introduction to AutoBios
switch (Me->ModeSize)
{
case SizeIsByte: *Me->Token[1].Value.CharPtr = Me->EnterValue; break;
case SizeIsWord: *Me->Token[1].Value.WordPtr = Me->EnterValue; break;
case SizeIsLong: *Me->Token[1].Value.LongPtr = Me->EnterValue; break;
}
}
if (Me->Token[0].Value.WordValue[0] % 8)
printf("\n%p",Me->Token[0].Value.LongValue);
}
printf('\n');
}
}
void CmdEnterAscii(VueRegSet)
{ Me->ModeType = TypeAscii; CmdEnter(VueSet); };
void CmdEnterByte(VueRegSet)
{ Me->ModeSize = SizeIsByte; Me->ModeType = TypeHex; CmdEnter(VueSet); };
void CmdEnterWord(VueRegSet)
{ Me->ModeSize = SizeIsWord; Me->ModeType = TypeHex; CmdEnter(VueSet); };
void CmdEnterDouble(VueRegSet)
{ Me->ModeSize = SizeIsLong; Me->ModeType = TypeHex; CmdEnter(VueSet); };
683
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Fill
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdFill.C
//
// [Description]
//
// [NOTE] Entry to SysVue is by CTRL-ALT-BREAK.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdFill(VueRegSet)
{
while ((Me->Token[1].Value.LongValue <= Me->Token[2].Value.LongValue)
&& !ConsoleBreak())
{
switch (Me->ModeSize)
{
case SizeIsByte: *Me->Token[1].Value.CharPtr++ = Me-
>Token[3].Value.LongValue; break;
case SizeIsWord: *Me->Token[1].Value.WordPtr++ = Me-
>Token[3].Value.LongValue; break;
case SizeIsLong: *Me->Token[1].Value.LongPtr++ = Me-
>Token[3].Value.LongValue; break;
}
}
}
685
The C Programs
void CmdFillAscii(VueRegSet)
{ Me->ModeSize = SizeIsByte; Me->ModeType == TypeAscii; CmdFill(VueSet); };
void CmdFillByte(VueRegSet)
{ Me->ModeSize = SizeIsByte; Me->ModeType == TypeHex; CmdFill(VueSet); };
void CmdFillWord(VueRegSet)
{ Me->ModeSize = SizeIsWord; Me->ModeType == TypeHex; CmdFill(VueSet); };
void CmdFillDouble(VueRegSet)
{ Me->ModeSize = SizeIsLong; Me->ModeType == TypeHex; CmdFill(VueSet); };
686
Introduction to AutoBios
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Help Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdHelp.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
void CmdHelp(VueRegSet)
{
unsigned j = 0, LineCounter = 1;
687
The C Programs
688
Introduction to AutoBios
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] BiosVue Input and Output Commands
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdInOut.C
//
// [Language MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 1,00 01-01-92 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdInPort(VueRegSet)
{
switch (Me->ModeSize)
{
case SizeIsByte: printf(" - %2x",inp (Me->Token[1].Value.WordValue[0]));
break;
case SizeIsWord: printf(" - %4x",inpw(Me->Token[1].Value.WordValue[0]));
break;
}
}
689
The C Programs
void CmdOutPort(VueRegSet)
{
//if(!Me->TokenValid[1] || !Me->TokenValid[2]) { printf("\a"); return; };
switch (Me->ModeSize)
{
case SizeIsByte: outp (Me->Token[1].Value.LongValue,Me-
>Token[2].Value.LongValue); break;
case SizeIsWord: outpw(Me->Token[1].Value.LongValue,Me-
>Token[2].Value.LongValue); break;
}
}
void CmdInportCmos(VueRegSet)
{
outp(CmosRegPort,Me->Token[1].Value.LongValue);
printf(" - %2x",inp(CmosDataPort));
}
void CmdOutPortCmos(VueRegSet)
{
outp(CmosRegPort,Me->Token[1].Value.LongValue);
outp(CmosDataPort,Me->Token[2].Value.LongValue);
}
690
Introduction to AutoBios
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Interrupt Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdInt.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
void CmdInt(VueRegSet)
{
#if 0 == 1
unsigned longj;
/* get the interrupt number from the command line */
691
The C Programs
j = *(Me->token_value[1] * 4);
printf("%p ",j);
//BiosInt(Me->token_value[1],&Me->ax);
for (i = 0; i <= 13; i++) Me->RegSaves[i] = Reg.Array[i];
692
Introduction to AutoBios
//---------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Memory Command
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdMem.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdMem(VueRegSet)
{
693
The C Programs
694
Introduction to AutoBios
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Move Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdMove.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// NOTE:
// Entry to SysVue is by CTRL-ALT-BREAK.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdMove(VueRegSet)
{
while ((Me->Token[1].Value.LongValue <= Me->Token[2].Value.LongValue) && !
ConsoleBreak())
{
*Me->Token[3].Value.CharPtr++ = *Me->Token[1].Value.CharPtr++;
};
}
695
Introduction to AutoBios
//---------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue NPX Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdNPX.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void NPX(VueRegSet)
{
if(Me->ArgC > 1)
{
if((Me->Token[2].Value.CharValue[0] & 0x01))
OutCmos(CmosRegEquipment,InCmos(CmosRegEquipment) | 0x02);
else
OutCmos(CmosRegEquipment,InCmos(CmosRegEquipment) & ~0x02);
CalcCmosChecksum();
}
printf("Options are: 0 = No, 1 = Yes\n");
printf("NPX ");
DisplayNPX(VueSet);
}
697
The C Programs
698
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue ObjectDump
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdOdump.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] Dump the Object Descriptors
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
// I N C L U D E F I L E S
#include "Bios.h"
// F U N C T I O N P R O T O T Y P E S
void CmdObjectDump(VueRegSet)
{
union
{
struct _SystemObject far * Ptr;
unsigned long Long;
}System;
699
The C Programs
printf("\n %p %p %s",
System,System.Ptr->ObjectLength,System.Ptr->ObjectName);
while (list.me->ObjectLength != 0)
{
printf("\n %p %p %s",
list.me,list.me->ObjectLength,list.me->ObjectName);
list.temp += list.me->ObjectLength;
}
printf("\nDo you want to Dump The Contents of the Objects (Y/N) ? :");
if(ToUpper(GetCharEcho()) == 'Y')
{
// Dump the System Object first
Me->Token[1].Value.LongValue = System.Long;
Me->Token[2].Value.LongValue = (unsigned long)&System.Ptr->PoolBlock;
Me->Token[1].ValueMask.LongMask =
Me->Token[2].ValueMask.LongMask = (unsigned long)-1;
CmdDump(Me); Pause();
Me->Token[1].ValueMask.LongMask =
Me->Token[2].ValueMask.LongMask = (unsigned long)-1;
CmdDump(Me); Pause();
// move system pointer to next block
System.Long += System.Ptr->ObjectLength;
};
}
}
700
Introduction to AutoBios
//-------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Pipe (Redirection) Commands
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdPipe.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdToCon(VueRegSet)
{
struct _SystemObject far * System = GetSystemObject();
System->RedirectFlag = False;
};
void CmdToLpt(VueRegSet)
{
struct _SystemObject far * System = GetSystemObject();
System->RedirectFlag = True;
/*
// If you are watching the printer driver, it must not be
// copying screen output to the printer.
// An insidious recursion results, blowing the system away !
//if((Me->watch_flag & LPT) != 0) Me->watch_flag &= ~LPT;
*/
701
The C Programs
702
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Read Intel Hex
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdRHex.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] This is Read Intel Hex Format Command.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdRHex(VueRegSet)
{
703
The C Programs
switch (Me->HexRecordType)
{
case IntelDataRecord:
if (Me->CharCount == 0)
{
Me->HexRecordType = IntelEOFRecord;
break;
}
while (Me->CharCount-- > 0)
{
*Me->Token[1].Value.CharPtr++ = GetByte(VueSet);
}
GetByte(VueSet);
if (Me->Sum != 0) Me->HexRecordType = IntelEOFRecord;
break;
case IntelEOFRecord:
/* return to SysVue main */
break;
case IntelAddressRecord:
/* set load address segment */
Me->Token[1].Value.WordValue[1] = GetWord(VueSet);
GetByte(VueSet);
if (Me->Sum != 0) Me->HexRecordType = IntelEOFRecord;
break;
case IntelStartRecord:
/* set cs:ip of reg set */
printf("\CS:IP = %4x:%4x",Me->RegsPtr->RegCS,Me->RegsPtr->RegIP);
Me->RegsPtr->RegCS = GetWord(VueSet);
Me->RegsPtr->RegIP = GetWord(VueSet);
printf("\CS:IP = %4x:%4x",Me->RegsPtr->RegCS,Me->RegsPtr->RegIP);
GetByte(VueSet);
if (Me->Sum != 0) Me->HexRecordType = IntelEOFRecord;
break;
}
}
while (Me->HexRecordType != IntelEOFRecord);
}
char GetByte(VueRegSet)
{
char cc,d;
cc = GetChar() - '0';
if (cc > 9) cc -= 7;
d = GetChar() - '0';
if (d > 9) d -= 7;
cc = cc << 4 | d;
Me->Sum += cc;
return (cc);
}
704
Introduction to AutoBios
unsigned GetWord(VueRegSet)
{
return ((GetByte(VueSet) << 8) | GetByte(VueSet));
}
705
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Search Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdSearch.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] Search an address range for a keyword modified
// [Description] by the mask-word
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdSearch(VueRegSet);
void CmdSearchAscii(VueRegSet)
{ Me->ModeSize = SizeIsByte; Me->ModeType = TypeAscii; CmdSearch(VueSet); };
void CmdSearchByte(VueRegSet)
{ Me->ModeSize = SizeIsByte; Me->ModeType = TypeAscii; CmdSearch(VueSet); };
void CmdSearchWord(VueRegSet)
{ Me->ModeSize = SizeIsWord; Me->ModeType = TypeAscii; CmdSearch(VueSet); };
void CmdSearchDouble(VueRegSet)
{ Me->ModeSize = SizeIsLong; Me->ModeType = TypeAscii; CmdSearch(VueSet); };
void CmdSearch(VueRegSet)
707
The C Programs
{
/* if the mask is zero (default), set it to all ones */
if(!Me->Token[4].Value.LongValue) Me->Token[4].Value.LongValue = -1;
/* size the mask according to the data type */
switch (Me->ModeSize)
{
case SizeIsByte: Me->Token[4].Value.LongValue = 0x000000ff; break;
case SizeIsWord: Me->Token[4].Value.LongValue = 0x0000ffff; break;
case SizeIsLong: Me->Token[4].Value.LongValue = 0xffffffff; break;
}
while((Me->Token[1].Value.LongValue <= Me->Token[2].Value.LongValue) && !
ConsoleBreak())
{
if((((*Me->Token[1].Value.LongPtr) ^ Me->Token[3].Value.LongValue) &
Me->Token[4].Value.LongValue) == 0)
{
if(Me->ModeType == TypeAscii)
{
printf("\n%p %k",Me->Token[1].Value.LongValue,*Me-
>Token[1].Value.CharPtr);
}
else
{
switch (Me->ModeSize)
{
case SizeIsByte:
printf("\n%p %2x",Me->Token[1].Value.LongValue,*Me-
>Token[1].Value.CharPtr);
break;
case SizeIsWord:
printf("\n%p %4x",Me->Token[1].Value.LongValue,*Me-
>Token[1].Value.WordPtr);
break;
case SizeIsLong:
printf("\n%p %p",Me->Token[1].Value.LongValue,*Me-
>Token[1].Value.LongPtr);
}
}
}
Me->Token[1].Value.CharPtr++;
}
}
708
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue System Information Command
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdSI.C
//
// [Description]
//
// NOTE:
// Entry to SysVue is by CTRL-ALT-BREAK.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdSysInfo(VueRegSet)
{
unsigned j, CalcedMemSize;
struct _BiosRam far * LowRam = 0;
struct _SystemObject far * System = GetSystemObject();
709
The C Programs
DisplayVideo();
710
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] Snapshot Functions
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdSnap.C
//
// [Language] MSVC 1.5
//
// [ Description]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void SpyCommand(VueRegSet,unsigned);
/* L O C A L C O N S T A N T S */
/* P R O G R A M S */
void CmdSnap(VueRegSet)
{
SpyCommand(VueSet,Snap);
}
void CmdWatch(VueRegSet)
{
SpyCommand(VueSet,Watch);
};
void CmdLog(VueRegSet)
{
SpyCommand(VueSet,Log);
};
711
The C Programs
{
unsigned Index;
struct _BiosObject far * Bios = GetBiosObject();
unsigned Temp;
LoadDS();
if(Me->ArgC < 2)
{
printf("\nSelected %ss are: ",GetName(SpyType,SpyList));
if(!(Bios->FlagMaster[SpyType].Flag & Bios->FlagMaster[SpyType].Master))
{
printf("None");
}
else
{
for(Index = 0; Index < 15; Index++)
{
Temp = (Bios->FlagMaster[SpyType].Flag &
Bios->FlagMaster[SpyType].Master & BitList[Index].Value);
if(ValueExists(Temp,DeviceList))
{
printf("%s, ",GetName(Temp,DeviceList));
};
};
};
}
else
{
Index = 1;
if(StrCmp(Me->ArgV[1],"List"))
{
printf("\n"); PrintNames(DeviceList);
};
if(StrCmp(Me->ArgV[1],"All")) Bios->FlagMaster[SpyType].Flag = -1;
if(StrCmp(Me->ArgV[1],"None")) Bios->FlagMaster[SpyType].Flag = 0;
if(StrCmp(Me->ArgV[1],"No")) Bios->FlagMaster[SpyType].Flag = 0;
if(StrCmp(Me->ArgV[1],"Off"))
{
Bios->FlagMaster[SpyType].Save = Bios->FlagMaster[SpyType].Flag;
Bios->FlagMaster[SpyType].Flag = 0;
}
if(StrCmp(Me->ArgV[1],"On"))
{
if(!Bios->FlagMaster[SpyType].Save)
{
printf("\nNo %ss Selected\a",GetName(SpyType,SpyList));
}
else
{
Bios->FlagMaster[SpyType].Flag = Bios->FlagMaster[SpyType].Save;
};
}
while(Me->ArgV[Index])
712
Introduction to AutoBios
{
if(NameExists(Me->ArgV[Index],DeviceList))
{
Bios->FlagMaster[SpyType].Flag |= GetValue(Me->ArgV[Index],DeviceList);
}
Index++;
};
};
};
// this will execute if the "snap" bit for the specified device is set
/*------------------------------------------------------------*/
unsigned GetSavedSS(void)
{
struct _BiosObject far * Bios = GetBiosObject();
return(Bios->StackSaveSS);
}
unsigned GetSavedSP(void)
{
struct _BiosObject far * Bios = GetBiosObject();
return(Bios->StackSaveSP);
}
//----------------------------------------------------------
713
The C Programs
//---------------------------------------------------
unsigned SnapActive(void)
{
return(SnapWatchLogActive(Snap));
}
unsigned WatchActive(void)
{
return(SnapWatchLogActive(Watch));
};
unsigned LogActive(void)
{
return(SnapWatchLogActive(Log));
};
714
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Display and Set Time Command
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdTime.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// NOTE:
// Entry to SysVue is by CTRL-ALT-BREAK.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdTime(VueRegSet)
{
unsigned Hours,Minutes,Seconds;
if(Me->ArgC > 1) // if anything entered
{
printf("\nGoing to Parse: %s",Me->ArgV[1]);
Hours = ParseDigitString(Me->ArgV[1],1);
Minutes = ParseDigitString(Me->ArgV[1],2);
Seconds = ParseDigitString(Me->ArgV[1],3);
printf("\n%2x:%2x:%2x",Hours,Minutes,Seconds);
715
The C Programs
716
Introduction to AutoBios
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Trace Command
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdTrace.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//------------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
void CmdTrace(VueRegSet)
{
#if (0 == 1)
struct _BiosRam far * Vectors = 0;
struct _SystemObject far * System = GetSystemObject();
//struct BiosObject far * Bios = System->Bios_Ptr;
Me->TraceCount = (unsigned)Me->Token[1].LongValue;
if(Me->TraceCount == 0) Me->TraceCount = 1;
Me->ExitFlag = True;
Me->RegSaves[pswsave] |= 0x0100; // set trace bit
// chain-in the trace vector
_disable();
Me->SysVueTraceChain = Vectors->IntVector[0x01];
Vectors->IntVector[0x01]=(void near *)SysTrace;
717
The C Programs
_enable();
#endif
}
718
Introduction to AutoBios
//----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1997 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Display Hard Disk Types COmmand
//
// [Version] 3.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdTypes.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdTypes(VueRegSet)
{
DisplayHardDiskTypes(VueSet);
};
unsigned HardCellTable[2][4] =
{
{ CmosRegDrive47CylLow, CmosRegDrive47CylHigh,
CmosRegDrive47Heads, CmosRegDrive47Sectors, },
{ CmosRegDrive48CylLow, CmosRegDrive48CylHigh,
CmosRegDrive48Heads, CmosRegDrive48Sectors, },
};
void CmdUser(VueRegSet)
{
struct BiosObject far * Bios = GetBiosObject();
719
The C Programs
unsigned Index,UserType,UserParms[5];
LoadDS();
if(Me->ArgC > 1)
{
OutCmos(HardCellTable[UserType][0], UserParms[2]);
OutCmos(HardCellTable[UserType][1], UserParms[2] >> 8);
OutCmos(HardCellTable[UserType][2], UserParms[3]);
OutCmos(HardCellTable[UserType][3], UserParms[4]);
CalcCmosChecksum();
}
LoadUserDriveParms();
PrintHardDiskTitleBar();
DisplayUserHardTypes();
return;
};
void CmdOrder(VueRegSet)
{
struct BiosObject far * Bios = GetBiosObject();
unsigned Index,UserType,UserParms[5];
LoadDS();
if(Me->ArgC < 2)
{
printf(" - Boot Order is %s\n",GetName((InCmos(CmosRegOptionFlags) &
CmosRegBitBootOrder),BootOrderList));
}
else
{
if(NameExists(Me->ArgV[1],BootOrderList))
{
ResetCmosBits(CmosRegOptionFlags,CmosRegBitBootOrder);
SetCmosBits(CmosRegOptionFlags,GetValue(Me->ArgV[1],BootOrderList));
CalcCmosChecksum();
printf(" - Boot Order is %s\n",GetName((InCmos(CmosRegOptionFlags) &
CmosRegBitBootOrder),BootOrderList));
}
};
printf("\nBooting Order Options are:");
PrintNames(BootOrderList);
return;
};
720
Introduction to AutoBios
721
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Interrupt Vectors Dump Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdVctrs.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
void VlsiDump(VueRegSet);
/* P R O G R A M */
void Cmdvectors(VueRegSet)
{
unsigned i;
Me->Token[1].Value.LongValue = 0x00000000;
Me->Token[2].Value.LongValue = 0x0000013f;
while((Me->Token[1].Value.LongValue <= Me->Token[2].Value.LongValue) && !
ConsoleBreak())
{
printf("\n%p ",Me->Token[1].Value.LongValue);
do
{
printf("%p ",*Me->Token[1].Value.LongPtr++);
if((Me->Token[1].Value.CharValue[0] % 4) == 0) printf(" ");
}
while ((Me->Token[1].Value.CharValue[0] % 16) != 0);
printf(" ");
// for (i = - 16; i != 0; printf("%k",*(Me->Token[1].CharPtr + i)), i++);
}
723
The C Programs
Pause();
Me->Token[1].Value.LongValue = 0x00400000; Me->Token[2].Value.LongValue =
0x004000ff;
while((Me->Token[1].Value.LongValue <= Me->Token[2].Value.LongValue) && !
ConsoleBreak())
{
printf("\n%p ",Me->Token[1].Value.LongValue);
do
{
printf("%2X ",*Me->Token[1].Value.CharPtr++);
if((Me->Token[1].Value.LongValue % 4) == 0) printf(" ");
}
while ((Me->Token[1].Value.CharValue[0] % 16) != 0);
printf(" ");
for (i = - 16; i != 0; printf("%k",*(Me->Token[1].Value.CharPtr + i)), i++);
};
Pause();
CmdChip(Me);
}
724
Introduction to AutoBios
//------------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Video
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdVideo.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//-----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdVideo(VueRegSet)
{
if(Me->ArgC > 1) /* if anything entered */
{
if(NameExists(Me->ArgV[1],DisplayList))
{
OutCmos(CmosRegEquipment,(InCmos(CmosRegEquipment) & 0xcf) |
(GetValue(Me->ArgV[1],DisplayList) << 4));
CalcCmosChecksum();
}
else beep();
}
else
{
printf(" Options are:\n"); PrintNames(DisplayList);
}
725
The C Programs
DisplayVideo(VueSet);
}
726
Introduction to AutoBios
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] SysVue Write Intel Hex Command
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] CmdWHex.C
//
// [Language] MSVC 1.0/1.5
//
// [Description]
//
// NOTE:
// Entry to SysVue is by CTRL-ALT-BREAK.
//
// [Arguments]
//
// [Return]
//
// [History] 2.00 04/11/94 Original
//
//----------------------------------------------------------------------
/* I N C L U D E F I L E S */
#include "Bios.h"
/* F U N C T I O N P R O T O T Y P E S */
void CmdWHex(VueRegSet)
{
727
The C Programs
{
printf("\r\n:");
Me->CharCount = Me->Token[2].Value.LongValue -
Me->Token[1].Value.LongValue;
Me->Sum = 0;
Me->Sum -= printf("%2x%4x%2x",Me->CharCount,*Me->Token[1].Value.WordPtr,0);
Me->Sum -= printf("%4x",*Me->Token[3].Value.WordPtr++);
Me->Sum -= printf("%4x",*Me->Token[3].Value.WordPtr);
printf("%2x",Me->Sum);
}
printf("\r\n:00000001FF");
}
}
728
Introduction to AutoBios
9. StandAlones
9.1 The Concept of StandAlones
StandAlones are an optional way to build drivers and services which allow them to be loaded into RAM
as a 1.) a rom-scan module by the Bios before booting up the operating system or 2.) loading the module
as a TSR. This can be done for either testing modified modules or for replacing existing functions on an
existing machine.
The StandAlones are created using an envelope to surround the standard AutoBios function with the
structure neccassary to appear as a DOS.EXE program or as a Installable Device Driver conforming to
the Bios Rom-Scan format.
The Envelope also provides for additional functions such as finding and reserving space for the program
variables, and for the Terminate-Stay-Resident mode of operation.
9.2.1 SaPrefix.asm
The Prefix block contains the 55AA signature needed by Rom-Scan and executes a call to a special
Main-like routine, and also defines a DOS entry point.
;
******************************************************************************
*********************
;
; [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
;
; [Product Name] AutoBios
;
; [Module Name] StandAlone Module Linking Prefix Module
;
; [Version] 2.00
;
; [Author] John O. Foster
;
; [Date] 1-31-94
;
; [Filename] SaPrefix.asm
;
; Functional Description:
;
; This module is used as a linking prefix for stand-alone versions
; of the Bios Drivers. It includes a 55AA header so the module
; may be built as a Rom-Scan Installable driver.
; The modules may also be loaded as DOS TSR's
;
;
; Version History:
729
The C Programs
;
;
******************************************************************************
*********************
include BiosPrfx.inc
.code
extrn RomStart:near
extrn DosStart:near
extrn EndOfCode:near
end DosStart
730
Introduction to AutoBios
9.2.2 SaSuffix.asm
The Suffix block contains the definition for the Data area to be used when being loaded as a DOS TSR,
and the End Markers used to determine how much space to be retained by the module when returning to
DOS and keeping memory assigned to the module.
;
******************************************************************************
*********************
;
; [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
;
; [Product Name] AutoBios
;
; [Module Name] StandAlone Module Linking Prefix Module
;
; [Version] 2.00
;
; [Author] John O. Foster
;
; [Date] 1-31-94
;
; [Filename] SaPrefix.asm
;
; Functional Description:
;
; This module is used as a linking prefix for stand-alone versions
; of the Bios Drivers. It includes a 55AA header so the module
; may be built as a Rom-Scan Installable driver.
; The modules may also be loaded as DOS TSR's
;
;
; Version History:
;
;
******************************************************************************
*********************
include BiosPrfx.inc
.code
extrn RomStart:near
extrn DosStart:near
extrn EndOfCode:near
731
The C Programs
end DosStart
732
Introduction to AutoBios
9.2.3 MainBody.c
The MainBody routines find and reserve space for the modules data variables. Depending on the mode
of loading the module, the space may be located in an existing AutoBios System Object, a new System
Object may be created, or the data area may be located in the DOS TSR area. This routine is generic and
is used as an include in a Mainxxx routine.
//-----------------------------------------------------------------------
//
// [Copyright] Copyright (c) 1994 John O. Foster - All Rights Reserved.
//
// [Product Name] AutoBios
//
// [Module Name] StandAlone Load Envelope Routines
//
// [Version] 2.00
//
// [Author] John O. Foster
//
// [Date] 04/11/94
//
// [File Name] MainBody.C
//
// [Language] MSVC 1.0/1.5
//
// [Description] This provides the body envelope for building the
// [Description] standalone version of Bios Drivers
//
// [Arguments] Registers
//
// [Return]
//
//
// [History] 2.00 04/11/94 Original
//
//---------------------------------------------------------------------
// I N C L U D E F I L E S
void DosStart(void);
void RomStart(void);
void LastLocation(void);
void EndOfCode(void);
void far * Last = &LastLocation;
void far * EndCode = &EndOfCode;
//void far * First = &MainStart;
void DosStart(void)
{
733
The C Programs
BlockSize += 1023;
BlockSize &= ~1023;
SystemSegmentPointer =
FP_SEG(BlockPtr) + (FP_OFF(BlockPtr) >> 4);
System = GetSystemObject();
System->PoolEnd = MK_FP(SystemSegmentPointer,BlockSize);
734
Introduction to AutoBios
Destination(LoadMessage,0);
Temp = FP_OFF(Last);
Temp /= 16; Temp++;
//Keep
_asm mov ah,0x31
_asm mov al,0
_asm mov dx,Temp
_asm int 0x21
}
else
// If SystemSegmentPointer !=0, then check for the name field.
// If existing SystemObject, then use it.
{
System = GetSystemObject();
if(StrStr(System->ObjectName,"SystemObject"))
{
printf("\nLoading - Using existing System Object.\n");
printf("\n%s",LoadMessage);
Temp = FP_OFF(EndCode);
Temp /= 16; Temp++;
//Keep
_asm mov ah,0x31
_asm mov al,0
_asm mov dx,Temp
_asm int 0x21
}
else
{
// Try the Alternate Location
void RomStart(void)
{
735
The C Programs
if(!SystemSegmentPointer)
{
printf("\nCreating New System Object\n");
if(!(System = CreateSystemObject(CfgSystemObjectSize)))
{
printf("\nAborting Load - Could not create System Object\n");
return;
};
printf("\nCreating Bios Object\n");
/* Now allocate a BiosObject in the system pool area */
if(!(System->Bios_Ptr = AcquireObject
(BiosObject, "BiosObject" ,BiosObjectType)))
{
printf("\nAborting Load - Could not create Bios Object\n");
return;
} ;
}
else
{
printf("\nUsing Existing System Object\n");
};
Destination(LoadMessage,0);
printf("\nSetup Completed");
};
736
Introduction to AutoBios
// I N C L U D E F I L E S
737
The C Programs
#include "Bios.h"
#include "MainBody.c"
738
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
739
The C Programs
740
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
741
The C Programs
742
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
743
The C Programs
744
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
745
The C Programs
746
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
747
The C Programs
748
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
749
The C Programs
750
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
751
The C Programs
752
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
753
The C Programs
754
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
755
The C Programs
756
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
757
The C Programs
758
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
759
The C Programs
760
Introduction to AutoBios
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
761
The C Programs
762
The StandAlone Mainxxx files
// I N C L U D E F I L E S
#include "Bios.h"
#include "MainBody.c"
763
The C Programs
764
The StandAlone Mainxxx files
9.4.1 SaBoot.Inp
nsaboot.exe
l
nsaboot.tmp
w cs:0
q
9.4.2 SaComm.Inp
nsacomm.exe
l
nsacomm.tmp
w cs:0
q
9.4.3 SaDisk.Inp
nsadisk.exe
l
nsadisk.tmp
w cs:0
q
9.4.4 SaEquip.Inp
nsaequip.exe
l
nsaequip.tmp
w cs:0
q
9.4.5 SaHard.Inp
nsahard.exe
l
nsahard.tmp
765
The C Programs
w cs:0
q
9.4.6 SaKb.Inp
nsakb.exe
l
nsakb.tmp
w cs:0
q
9.4.7 SaLpt.Inp
nsalpt.exe
l
nsalpt.tmp
w cs:0
q
9.4.8 SaMem.Inp
nsamem.exe
l
nsamem.tmp
w cs:0
q
9.4.9 SaPrtScr.Inp
nsaprtscr.exe
l
nsaprtscr.tmp
w cs:0
q
9.4.10 SaSysSrv.Inp
nsasyssrv.exe
l
nsasyssrv.tmp
w cs:0
q
766
The StandAlone Mainxxx files
9.4.11 SaSysVue.Inp
nsasysvue.exe
l
nsasysvue.tmp
w cs:0
q
9.4.12 SaTimer.Inp
nsatimer.exe
l
nsatimer.tmp
w cs:0
q
9.4.13 SaTOD.Inp
nsatod.exe
l
nsatod.tmp
w cs:0
q
9.4.14 SaVideo.Inp
nsavideo.exe
l
nsavideo.tmp
w cs:0
q
767
The StandAlone Mainxxx files
Prom Programmer
Needhams Electronics, Inc.
4539 Grove Avenue
Sacramento, CA 95841
(916) 972-8042
BBS (916) 972-8042
FAX (916) 972-9960
Prom Eraser
Walling
Prom Emulators
Technical Solutions
PO Box 462101
Garland TX 75046-2101
769
Hardware Devices
771