shaunc@gold.gvg.tek.com (Shaun Case) (06/27/91)
Here is a summary of responses I got regarding my queries on
EMS & XMS handle numbering, and setting variables in the
parent environment.
I recently asked the following questions:
1) What is the numbering scheme for EMS and XMS handles?
2) How can I set a variable in the parent environment?
I recieved a lot of good information from the following people:
Ralf.Brown@B.GP.CS.CMU.EDU
Glenn Forbes Larratt <glratt@uncle-bens.rice.edu>
richard@einstein.dartmouth.edu
raymond@math.berkeley.edu (Raymond Chen)
greg%turbo.atl.ga.us@mathcs.emory.edu (Greg Montgomery)
The short answers are below, and a summary of responses, including
some source code, follows.
1) Both EMS and XMS handle numbering are implementation dependent.
2) The basic trick is that a pointer in every program PSP points to
it's parent process PSP, and another pointer points to it's environment
segment (even your OWN environment segment can be ANYWHERE in the
address space) so you just follow the pointers. Then you have to
find the MCB for the environment block, which is just 16 bytes
before it in memory. This tells you how long it is, so you know if
your new entry will fit. I use the 4DOS shell, partly because it
will reserve extra space in child environments rather than using the
command.com shrink-to-fit method. [ -- Rich Brittain ]
Summary follows:
Subject: Re: what are the valid ranges for XMS EMB handles?
Date: Sat, 15 Jun 91 09:56:37 EDT
From: Ralf.Brown@B.GP.CS.CMU.EDU
Yes, you can have both XMS and EMS in the same machine--they are not
incompatible. In fact, with QEMM, XMS and EMS share the same physical
memory--QEMM doles out its pool of physical memory to either as the
requests come in. I have 4DOS swap to XMS while a number of programs
that I run from the 4DOS shell use EMS. No problems.
I would imagine EMS handle numbering is also implementation-dependent.
Ralf
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
From: richard@einstein.dartmouth.edu
Date: Tue, 18 Jun 91 18:13:51 -0400
Subject: Re: XMS/EMS/changing the master environment (everything, basically)
>My other possible solution was to set an environment variable
>like SET MYPROG=NNNNNNNNNN, and then sprintf() in an E or an X for
>the memory type, and then the handle number. Of course, this requires
>modifying the master environment, which, according to all accounts, is
>a rough thing to do. Neverthless, I gave it a shot and failed; TASM/
>TC code is below, for anyone who wants to try to fix it. (I didn't
>write the ASM code, I swiped it from Simtel.)
It isn't too tough. I wrote a setenv program a while back that appeared
on c.b.i.p. - it has code for Turbo C and notes on what it is doing. It is
on simtel20 under msdos.sysutl as RBSETNV?.ZIP I think, where ? is 2 or 3,
and it can also be obtained by anon ftp from calvin.ee.cornell.edu
I didn't read your assembler version carefully, but I suspect that it didn't
check to see if the addition to the environment was overflowing the allocated
segment - if so it was probably overwriting the start of the program and hence
it bombed.
Richard Brittain
[ the file is RBSETNV1.ZIP and is what I ended up using. The source is all
C, and is public domain. -- SC ]
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subject: Re: XMS/EMS/changing the master environment (everything, basically)
Date: Tue, 18 Jun 91 20:43:06 EDT
From: ralf@B.GP.CS.CMU.EDU
Since I was just working on the EMS chapter in my forthcoming book, I can
give you some more info.
1. EMS handles are indeed implementation-dependent. The original Intel
Above Board driver assigns handles in the order FF01h, FE02h, FD03h, etc.
2. To find the current EMS handles, use the following:
INT 67 - LIM EMS - GET PAGES FOR ALL HANDLES
AH = 4Dh
ES:DI -> array to receive information
Return: AH = status
00h successful
BX = number of active EMM handles
array filled with 2-word entries, consisting of a handle
and the number of pages allocated to that handle
80h internal error
81h hardware malfunction
84h undefined function requested
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Date: Wed, 19 Jun 91 11:16:39 -0400
From: richard@einstein.dartmouth.edu (Richard Brittain)
Subject: Re: setting master env vars from C
The environment of the parent could be anywhere in the address space - no
reason to assume it is within 64k of the current code segment.
My code uses small model, but with explicit far pointers for all the remote
stuff. The basic trick is that a pointer in every program PSP points to
it's parent process PSP, and another pointer points to it's environment
segment (even your OWN environment segment can be ANYWHERE in the address
space) so you just follow the pointers. Then you have to find the MCB
for the environment block, which is just 16 bytes before it in memory. This
tells you how long it is, so you know if your new entry will fit. I use the
4DOS shell, partly because it will reserve extra space in child environments
rather than using the command.com shrink-to-fit method.
richard@einstein.dartmouth.edu
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subject: Re: what are the valid ranges for XMS EMB handles?
From: greg%turbo.atl.ga.us@mathcs.emory.edu (Greg Montgomery)
Date: Thu, 20 Jun 91 14:01:56 EDT
shaunc@gold.gvg.tek.com (Shaun Case) writes:
> I need to search through all allocated XMS EMBs quickly. If possible,
> I would like to limit the search to valid (i.e., possilbe) XMS EMB
> handles. I already know how to tell if a given handle is valid,
> but it takes too long to search through 2,000+ handles!
One thing you might want to do is call Intel and get the XMS spec.
It's an 800 number and they'll send it to you free. Only problem is
I'm not sure where my copy is. Well, anyway, if you find the number,
just call and say you want the XMS spec and they'll give it to you.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Date: Thu, 13 Jun 91 02:16:03 PDT
From: raymond@math.berkeley.edu (Raymond Chen)
Subject: Re: what are the valid ranges for XMS EMB handles?
In article <2516@gold.gvg.tek.com> you write:
>It says that
>"handles are a scarce resource" but doesn't say what range they
>fall into.
Because you're not supposed to know what range they fall into.
They are magic cookies.
(Of course, since I worked on HIMEM.SYS, I could tell you what they
are, but there are no guarantees that what I tell you will be correct
for any version of HIMEM.SYS other than the one I worked on.)
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Date: Thu 13 Jun 91 12:23:54 EDT
From: Ralf.Brown@B.GP.CS.CMU.EDU
Subject: Re: what are the valid ranges for XMS EMB handles?
In article <2516@gold.gvg.tek.com>, you wrote:
}What are [XMS handles], anyway? Pointers to start blocks? Tags that get
}hashed into a table in the XMS driver with pointers to EMBs?
Implementation-dependent. Under QEMM, XMS handles start at 1 and increment,
but share the same space with EMS handles (so allocating XMS, EMS, EMS, and
then XMS would get you EMS handles 2 and 3, XMS handles 1 and 4).
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
From: Glenn Forbes Larratt <glratt@uncle-bens.rice.edu>
Subject: Re: XMS/EMS/changing the master environment (everything, basically)
Date: Wed, 19 Jun 91 17:04:15 CDT
>
> Yes, I would like to see the code you used to find (and set variables in?)
> the master environment.
>
> I have found some C code that should work, but I would like to see your
> routine -- I might use it if it is small and fast. (I want to make
> sure I am doing the mixed language thing properly anyway.)
>
I'm not sure how much help this will be, since it's all assembly, but here it
is:
page ,132 ; (ctrl-oh) ibm pc printer condensed mode
title wc - network card lookup and hd wiper control
; Copyright 1991 Glenn F. Larratt
; **********************************************************
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; Inquiries, bugreports, problems, love letters, etc., to:
; Internet: glratt@rice.edu
; BITNET: LARRATT@RICEVM2
; U.S. Mail: Glenn F. Larratt
; PO Box 2671; Lovett College
; Houston, TX 77252
; All of the above addresses good through May 1993.
;
; Rice University hereby disclaims all copyright interest in the program
; `WC.ASM' (which reads communication cards and alters bootup configurations)
; written by Glenn F. Larratt
;
; 26 June 1991
; James E. Doyle
; Assistant Director of Business Affairs
;
; **********************************************************
; Version 1.0 10 May 1991
; **********************************************************
; This program is the major component of a new system for periodic wiping
;and reconfiguring of the PS/2's attached to the MUDD105 Novell Network. The
;program:
; 1. Detects the presence of either or both of a 3Com 3C523 Ethernet card
; and an IBM Token Ring Adapter;
; 2. Reads a text file called wc.tbl in the current directory, which file
; contains a table of machine-specific configuration information
; for each machine on MUDD105;
; 3. Determines whether the machine on which it is running has en entry
; in the table: if so, it is processed further; if not, the
; system is halted;
; 4. Creates fresh copies of the appropriate PC/TCP driver files in the
; \drivers directory of the current drive, and uses ipconfig.exe
; and ifconfig.exe to configure them with information from the
; table;
; 5. Modifies a preexisting environmental variable, WIPECTRL_CARD_TYPE,
; to reflect either a special-handling code for a specific
; machine, or a general code identifying the hardware type.
;Necessary entry conditions:
; 1. Environmental variable WIPECTRL_CARD_TYPE=ABORT;
; 2. Presence of following files and subdirectory on current drive:
; .\wc.com This program
; .\wc.tbl Text file: configuration table
; .\ipcust.sys Generic PC/TCP IP customization driver
; .\ifcust.sys Generic PC/TCP interface customization
; driver for packet driver
; .\ibmtr.sys Generic PC/TCP interface customization
; driver for IBM Token Ring
; \ipconfig.exe Configuration utility for ipcust.sys
; \ifconfig.exe Configuration utility for ifcust.sys
; and ibmtr.sys
; \drivers\ Workarea subdirectory for configuration
; of customization files
;Exit conditions:
; 1. Environmental variable WIPECTRL_CARD_TYPE=
;Value Means Action to take
;ABORT Error in processing DO NOT WIPE THIS PS/2
;3C523 Detected valid 3C523 Wipe, finish 3C523 configuration
;IBMTR Detected valid Token Ring Wipe, finish Token Ring configuration
;(else) Detected valid special-handling Wipe, configure for specific use
;
; The only current value for (else) is LANGS for machine #416, the
;languages station; planning for the PRINTing station is in the works.
;
;Notes:
; 1. The program will print out the values read for detection of valid
; cards; the numbers can thus be visually confirmed. The spinoff
; cl.com (cardlook) program does this without any other action.
; 2. A successful installation will put up the banner from ifconfig.exe
; once and from ipconfig.exe twice as it executes this programs
; to configure the driver files.
; 3. Any detected error will abort the program, leaving WIPECTRL_CARD_TYPE
; set to ABORT to halt further processing; an error message will
; be printed and the program will beep twice for a configuration
; error, four times for a fatal error.
SUBTTL Structure definitions
PAGE
table_entry struc ; structure for storing table entries from wc.tbl
card_number db 6 dup (?) ; six-byte card number
IP_addr db 18 dup (' ') ; Internet Protocol address; four bytes,
; expressed in decimal separated by periods
host_name db 47 dup (' ') ; Internet host name
full_name db 52 dup (' ') ; Full name describing this machine
special_label db 5 dup (' ') ; For LANGS (languages), PRINT
; NOTE: sizes of host_name and full_name are arbitrarily longer than really
; necessary; they are chosen to make the record size 128 bytes, because it's
; easier to examine them in debug that way
table_entry ends
parm_block_tbl struc ; parameter block structure for DOS EXEC calls
env_seg dw ? ; segment containing environment
cmd_line_o dw ? ; offset and segment for command line arguments
cmd_line_s dw ?
FCB_1_o dw ? ; offset and segment for 1st File Control Block
FCB_1_s dw ?
FCB_2_o dw ? ; offset and segment for 2nd File Control Block
FCB_2_s dw ?
parm_block_tbl ends
SUBTTL Equates and data areas
PAGE
cseg segment para public 'code'
assume cs:cseg,ds:cseg,ss:cseg,es:cseg
org 100h
entpt: jmp start ; program flow commented at start
ID_3Com_bytes db 6 dup (0) ; bytes read to detect 3C523
ID_3Com_bad db 0 ; "invalid 3C523" flag
ID_TR_bytes db 6 dup (0) ; bytes read to detect T(oken)R(ing)A(dapter)
ID_TR_bad db 0 ; "invalid TRA" flag
env_match db 'WIPECTRL_CARD_TYPE=' ; match to find this env variable
env_value db 'ABORT',0 ; offset of its value
env_match_end equ byte ptr $
env_value_3Com db '3C523',0 ; replacement value for 3C523 config
env_value_TR db 'IBMTR',0 ; replacement value for TRA config
input_file_name db 'wc.tbl', 0 ; file name for config table
ifconfig_cmd db '\ifconfig.exe', 0 ; to execute this program
ipconfig_cmd db '\ipconfig.exe', 0 ; to execute this program
ifc_header_3C db ' ' ; command line arguments for ifconfig
ifc_dest_fnam db 'a:\drivers\' ; call when configuring for 3C523
ifc_src_fnam db 'ifcust.sys '
ifc_trailer_3C db 0, 18 dup (0Dh)
ifc_header_TR db ' ' ; command line arguments for ifconfig
itr_dest_fnam db 'a:\drivers\' ; call when configuring for TRA
itr_src_fnam db 'ibmtr.sys '
ifc_trailer_tr db 0, 18 dup (0Dh)
ipc_header db ' ' ; command line arguments for ipconfig call
ipc_dest_fnam db 'a:\drivers\'
ipc_src_fnam db 'ipcust.sys '
ipc_trailer db 0, 104 dup (0Dh)
hostname_header db 'hostname ' ; appended to ipconfig call
fullname_header db 'fullname ' ; appended to ipconfig call
ID_3Com_msg db '3Com 3C523 ID bytes : $' ; formatting strings to
ID_TR_msg db 'IBM Token Ring ID bytes: $' ; print card numbers
ID_TR_err_msg db 7,' REDUNDANCY FAILURE-aborting TR check', 7
; special error message for mismatch between odd/even TRA PROMS
crlf db 0Dh, 0Ah, '$' ; CR LF end
; severity signals for abort processing
FATAL_ERR equ 2
CONFIG_ERR equ 1
NO_ERROR equ 0
; error messages - encoded with a severity signal and an output string
; which will get a CRLF tacked on
no_file_errmsg db FATAL_ERR, 'File not found - WC.TBL$'
bad_read_errmsg db FATAL_ERR, 'Error reading file WC.TBL$'
no_card_errmsg db CONFIG_ERR, 'No recognizable network cards installed$'
prompt_2_cards db 0Dh, 0Ah, 'Two network cards present: Install (3)C523,'
db ' (T)oken Ring, or (A)bort? $'
abort_errmsg db NO_ERROR, 'Aborting PC/TCP installation$'
no_match_errmsg db CONFIG_ERR, 'No table entry matching network card$'
bad_mem_errmsg db FATAL_ERR, 'Memory allocation failure$'
bad_copy_errmsg db FATAL_ERR, 'Error copying driver files$'
;bad_dir_errmsg db FATAL_ERR, 'Unable to find or create directory '
db 'C:\DRIVERS$'
no_mem_errmsg db FATAL_ERR, 'Unable to allocate memory for driver '
db 'file copy$'
read_src_errmsg db FATAL_ERR, 'Error reading driver source file$'
internal_errmsg db FATAL_ERR, 'INTERNAL ERROR-ABORTING$'
exec_errmsg db FATAL_ERR, 'Error executing PC/TCP configuration '
db 'utilities$'
no_master_errmsg db FATAL_ERR,'Unable to find master environment$'
no_env_errmsg db FATAL_ERR,'Unable to find environmental variable'
db 'WIPECTRL_CARD_TYPE$'
even
param_block parm_block_tbl <,offset ifc_header_3C,,5Ch,,6Ch>
; parameter block table for all DOS EXEC calls made
input_handle dw 0 ; file handle for wc.tbl
input_end dw offset input_begin ; pointer to end of raw text
table_end dw offset ethercard_tbl ; pointer to end of table
this_node dw offset ethercard_tbl ; pointer to entry for the
; card in this machine
which_card dw offset ID_3Com_bytes ; type of card identified
source_handle dw 0 ; source file handle for file copy
dest_handle dw 0 ; destination file handle for file copy
buffer_seg dw 0 ; special buffer segment allocated for file copy
save_stack_sp dw ? ; area to save stack pointer during DOS EXEC calls
save_stack_ss dw ?
SUBTTL Subroutines
PAGE
skip_crlf proc near
; skip carriage return/line feed combination - moves to beginning of the next
; line of raw text
; entry [si] data string in raw text
; exit [si] first char after CR LF pair
; c = reached EOF
scl_cr_loop:
cmp si,input_end
jae scl_reached_EOF
lodsb
cmp al, 0Dh
jne scl_cr_loop
cmp si,input_end
jae scl_reached_EOF
cmp byte ptr [si],0Ah
jne scl_got_next_line
lodsb
scl_got_next_line:
clc
ret
scl_reached_EOF:
stc
ret
skip_crlf endp
pad_with_spaces proc near
; pad with spaces - delimits data in the field with a (close) quote, fills the
; right-hand side of a field in the table with spaces
; entry [di] remainder of field
; cx bytes remaining in field
mov al,'"'
stosb
inc cx
mov al,' '
rep stosb ; pad remainder of field with spaces
ret
pad_with_spaces endp
copy_string proc near
; copy string - copies a string, either one word delimited by whitespace, or
; several delimted by quotes, from raw text area into a table field
; entry [si] is source string
; [di] is destination
; cx is max bytes to copy (field size -3: 1 for terminating
; space, 2 for delimiting quotes
; Implicit delimitation by terminating whitespace (sp, tab
; CR), or by enclosing quotes: [si] will point to CR or first
; non-delimiter on exit
; exit [si] is next non-delimiter in string or = [input_end]
; c = reached EOF
mov al,'"'
stosb
xor ah,ah ; reset quote flag
cs_copy_loop:
cmp byte ptr [si], 0Dh
je cs_move_done
jcxz cs_skip
cmp byte ptr [si], '"'
jne cs_not_quoted
lodsb ; to clear quote mark
xor ah,0FFh
jz cs_move_done
cs_not_quoted:
movsb
dec cx
jmp short cs_real_move
cs_skip:
lodsb
cs_real_move:
cmp si,input_end
jae cs_reached_EOF
cmp byte ptr [si], ' '
je cs_whitespace
cmp byte ptr [si], 09h
je cs_whitespace
jmp short cs_copy_loop
cs_whitespace:
or ah,ah
jnz cs_copy_loop
cs_move_done:
cmp byte ptr [si], ' '
je cs_not_done
cmp byte ptr [si], 09h
je cs_not_done
call pad_with_spaces
clc
ret
cs_reached_EOF:
call pad_with_spaces
stc
ret
cs_not_done:
lodsb
jmp short cs_move_done
copy_string endp
convert_hex proc near
; convert hexadecimal number - converts delimited ASCII hex number from raw text
; into a byte and stores it in the table
; entry [si] is delimited ASCII hexadecimal number
; [di] is storage for converted number
; dh,dl are possible delimiters
; exit [si] is next non-delimiter in string, or = [input_end]
; [di] is incremented
; c = reached EOF
cld
xor bx,bx
ch_loop:
lodsb
sub al,'0'
cmp al,9
jle ch_numeric
sub al,'A'-('9'+1)
ch_numeric:
or bl,al
cmp si,input_end
jae ch_reached_EOF
cmp [si],dl
je ch_found_delim
cmp [si],dh
je ch_found_delim
shl bx,1
shl bx,1
shl bx,1
shl bx,1
jmp short ch_loop
ch_found_delim:
mov al,bl
stosb
ch_next_item_loop:
lodsb
cmp [si],dl
je ch_next_item_loop
cmp [si],dh
je ch_next_item_loop
clc
ret
ch_reached_EOF:
stc
ret
convert_hex endp
read_input_file proc near
; read input file - attempts to read wc.tbl from the current directory into the
; raw text area beginning at input_begin, then processes the raw text into table
; entries: each line of text is either a comment (begins with whitespace) or a
; record of 5 fields: 6-byte card number, IP address, hostname, fully descriptive
; name, and special processing code (optional field).
; entry irrelevant
; exit c if error, file handle [batch_handle], errcode ax
mov dx,offset input_file_name
mov ax,3D00h ; DOS - open ASCIIZ file ds:dx for read
int 21h
mov input_handle,ax
jnc rf_read_file
mov dx,offset no_file_errmsg
ret ; immediately pass back c on error
rf_read_file:
mov ah,3Fh ; DOS - read cx bytes file bx to ds:dx
mov bx,input_handle
mov cx,0FFFFh ; to read entire file
mov dx,offset input_begin
int 21h
jnc rf_good_read
mov dx,offset bad_read_errmsg
ret ; immediately pass back c on error
rf_good_read:
add input_end,ax ; count of bytes read in
mov bx,input_handle
mov ah,3Eh ; DOS - close file handle bx
int 21h
mov si,offset input_begin
mov table_end,offset ethercard_tbl
jmp short rf_get_line
rf_comment_line:
call skip_crlf
jmp short rf_get_line
rf_get_line:
cmp byte ptr [si],' '
je rf_comment_line
cmp byte ptr [si],09h
je rf_comment_line
cmp byte ptr [si],0Dh
je rf_comment_line
rf_get_entry:
mov cx,5
mov di,table_end
rf_get_ether_loop:
mov dx,3A3Ah ; ethernet card # delimited with colons
call convert_hex
jc rf_drop_last
loop rf_get_ether_loop
mov dx,0909h ; last digit delimited by tab
call convert_hex
jc rf_drop_last
mov di,table_end
lea di,[di.IP_addr]
mov cx,size IP_addr - 3
call copy_string
jc rf_drop_last
cmp byte ptr [si],0Dh
je rf_drop_this
mov di,table_end
lea di,[di.host_name]
mov cx,size host_name - 3
call copy_string
jc rf_drop_last
mov di,table_end
lea di,[di.full_name]
mov cx,size full_name - 3
call copy_string
jc rf_last_entry
mov di,table_end
lea di,[di.special_label]
cmp byte ptr [si],0Dh
mov cx,5
je rf_special_label
rep movsb
jmp short rf_next_line
rf_special_label:
mov al,' '
rep stosb
rf_next_line:
add word ptr table_end,size table_entry
rf_drop_this:
call skip_crlf
jmp short rf_get_line
rf_cut_off:
rf_last_entry:
add table_end,size table_entry
rf_drop_last:
clc
ret
read_input_file endp
out_hex_nybble proc near
; output hexadecimal nybble - takes a four-bit hex digit and displays it in ASCII
; entry al nybble (0-0Fh)
; exit nybble printed to stdout
add al,'0'
cmp al,'9'
jle oh_do_it
add al,'A'-'9'-1
oh_do_it:
mov dl,al
mov ah,2
int 21h
ret
out_hex_nybble endp
get_ID_3Com_bytes proc near
; get and evaluate 3C523 ID bytes - read the six bytes at I/O location 300h-305h,
; and set the "invalid" flag if the first three are not 2:60:8C.
; entry irrelevant
; exit ID_3Com_bytes contains the six bytes
; ID_3Com_bad nonzero if no 3C523
mov ID_3Com_bad,0
mov dx,offset ID_3Com_msg
mov ah,9
int 21h
mov bx,offset ID_3Com_bytes
mov cx,6
mov dx,300h ; i/o address for 3Com523 card
g3_get_loop:
in al,dx
mov [bx],al
push dx
push ax
shr al,1
shr al,1
shr al,1
shr al,1
and al,0Fh
call out_hex_nybble
pop ax
and al,0Fh
call out_hex_nybble
mov dl,':'
cmp cx,1
jg g3_not_last
mov dl,0Dh
mov ah,2
int 21h
mov dl,0Ah
g3_not_last:
mov ah,2
int 21h
pop dx
inc bx
inc dx
loop g3_get_loop
cmp ID_3Com_bytes,2
jne g3_bad
cmp ID_3Com_bytes[1],60h
jne g3_bad
cmp ID_3Com_bytes[2],8Ch
je g3_good
g3_bad:
mov ID_3Com_bad,0FFh
g3_good:
ret
get_ID_3Com_bytes endp
get_ID_TR_bytes proc near
; get and evaluate TRA ID bytes - read the six bytes stored in pairs of duplicate
; nibbles at memory location 0CDF00h and set the "invalid" flag if the first
; three are not 10:0:5A.
; entry irrelevant
; exit ID_TR_bytes contains the six bytes
; ID_TR_bad nonzero if no 3C523
push es
mov ID_TR_bad,0 ; clear error flag
mov dx,offset ID_TR_msg
mov ah,9
int 21h
mov bx,offset ID_TR_bytes
mov cx,6
mov ax,0C000h ; Token Ring ID bytes encode at
mov es,ax
assume es:nothing
mov di,0DF00h ; memory location CDF00h
gT_get_loop:
mov ax,es:[di]
inc di
inc di
and ax,0F0Fh
cmp ah,al
jne gT_failed_redun_check ; fail if pair doesn't match
mov [bx],al
call out_hex_nybble
mov ax,es:[di]
inc di
inc di
and ax,0F0Fh
cmp ah,al
jne gT_failed_redun_check
push ax
call out_hex_nybble
pop ax
mov ah,[bx]
push cx
mov cl,4
shl al,cl
shr ax,cl
mov [bx],al
pop cx
cmp cx,1
mov dl,':'
jg gT_not_last
mov dl,0Dh
mov ah,2
int 21h
mov dl,0Ah
gT_not_last:
mov ah,2
int 21h
inc bx
loop gT_get_loop
cmp ID_TR_bytes,10h
jne gT_TR_bad
cmp ID_TR_bytes[1],0
jne gT_TR_bad
cmp ID_TR_bytes[2],5Ah
jne gT_TR_bad
gT_done:
pop es
ret
gT_failed_redun_check:
mov dx,offset ID_TR_err_msg
mov ah,9
int 21h
gT_TR_bad:
mov ID_TR_bad,0FFh
jmp short gT_done
assume es:cseg
get_ID_TR_bytes endp
choose_card proc near
; choose a card for which to configure - compare the results of the two card
; checks, configure if one unique card is indicated, ask if two cards indicated,
; abort if none.
; entry irrelevant
; exit [which_card] contains a pointer to the six valid bytes selected
; c = abort indicated or selected
test ID_3Com_bad,0FFh
jnz cc_no_3Com
test ID_TR_bad,0FFh
jnz cc_do_3Com
cc_both_loop:
mov dx,offset prompt_2_cards
mov ah,9
int 21h
mov dl,0FFh
mov ax,0C01h
int 21h
cmp al,'3'
je cc_do_3Com
and al,0DFh
cmp al,'T'
je cc_do_TR
cmp al,'A'
jne cc_both_loop
mov dx,offset abort_errmsg
stc
ret
cc_no_3Com:
test ID_TR_bad,0FFh
jz cc_do_TR
mov dx,offset no_card_errmsg
stc
ret
cc_do_TR:
mov which_card,offset ID_TR_bytes
jmp short cc_go_match
cc_do_3Com:
mov which_card,offset ID_3Com_bytes
cc_go_match:
mov si,offset ethercard_tbl
cc_match_loop:
cmp si,table_end
jae cc_no_matches
mov di,which_card
xor bx,bx
cc_cmp_loop:
mov al,[bx+di]
cmp al,[bx+si]
jne cc_not_match
inc bx
cmp bx,6
jl cc_cmp_loop
mov this_node,si
clc
ret
cc_not_match:
add si,size table_entry
jmp short cc_match_loop
cc_no_matches:
mov dx,offset no_match_errmsg
stc
ret
choose_card endp
do_DOS_exec proc near
; do DOS EXEC call - execute a program as a child process to this one
; entry param_block, registers already set up as per EXEC documentation
; exit es,ds,ss,sp retained
; c = error, [dx] has errmsg record if so
push ds
push es
mov ax,4B00h
mov save_stack_sp,sp
mov save_stack_ss,ss
int 21h
mov ss,cs:save_stack_ss
mov sp,cs:save_stack_sp
pop es
pop ds
jnc dD_good
mov dx,offset exec_errmsg
dD_good:
ret
do_DOS_exec endp
copy_file proc near
; copy a file
; entry [si] is source pathname in ASCIIZ
; [di] is destination pathname in ASCIIZ
; [buffer_seg] contains a block of 32K allocated for the copy
; exit c = error, [dx] has errmsg record if so
mov es,buffer_seg
assume es:nothing
mov dx,si
mov ax,3D20h
int 21h ; open source file for read
jnc cf_good_source
mov dx,offset read_src_errmsg
jmp short cf_end
cf_good_source:
mov source_handle,ax
mov dx,di
mov ah,3Ch
mov cx,20h
int 21h ; create dest file for write
jnc cf_good_dest
mov dx,offset bad_copy_errmsg
jmp short cf_end
cf_good_dest:
mov dest_handle,ax
push ds
push es
pop ds
pop es
assume ds:nothing,es:cseg
cf_copy_loop:
xor dx,dx
mov cx,8000h
mov ah,3Fh
mov bx,source_handle
int 21h
jnc cf_good_read
mov dx,offset read_src_errmsg
jmp short cf_end
cf_good_read:
or ax,ax
jz cf_copy_done
mov cx,ax
xor dx,dx
mov bx,dest_handle
mov ah,40h
int 21h
jnc cf_copy_loop
mov dx,offset bad_copy_errmsg
jmp short cf_end
cf_copy_done:
push es
pop ds
assume ds:cseg
mov bx,source_handle
mov ah,3Eh
int 21h
mov bx,dest_handle
mov ah,3Eh
int 21h
clc
ret
cf_end:
push cs
push cs
pop ds
pop es
ret
copy_file endp
setup_stuff proc near
; set up various stuff for configuration of this machine: deallocate excess
; memory from this program, allocate a chunk for file copying, delete any
; existing files that conflict, and copy the appropriate driver files for this
; machine to the workarea subdirectory. Delete the file copying memory when done.
; entry [this_node] points to this machine's entry in the table
; [which_card] points to the selected card's ID bytes
; exit c = error, [dx] has errmsg record if so
mov bx,this_node ; get number of paragraphs
add bx,size table_entry ; rounded up to include all
shr bx,1 ; of selected table_entry
shr bx,1
shr bx,1
shr bx,1
inc bx
mov ah,4Ah ; DOS - modify memory allocation
int 21h
jnc ss_dealloc_good
mov dx,offset bad_mem_errmsg
ret
ss_dealloc_good:
mov bx,800h
mov ah,48h
int 21h
jnc ss_alloc_good
mov dx,offset no_mem_errmsg
ret
ss_alloc_good:
mov buffer_seg,ax
mov dx,offset ipc_dest_fnam
mov ax,4320h
int 21h
mov ah,41h
int 21h
mov dx,offset ifc_dest_fnam
mov ax,4320h
int 21h
mov ah,41h
int 21h
mov dx,offset itr_dest_fnam
mov ax,4320h
int 21h
mov ah,41h
int 21h
ss_go_copy:
mov si,offset ipc_src_fnam
mov di,offset ipc_dest_fnam
call copy_file
jnc ss_copy_other
ret
ss_copy_other:
mov si,offset ifc_src_fnam
mov di,offset ifc_dest_fnam
cmp which_card,offset ID_3Com_bytes
jne ss_copy_for_TR
call copy_file
jnc ss_copies_done
ret
ss_copy_for_TR:
mov si,offset itr_src_fnam
mov di,offset itr_dest_fnam
cmp which_card,offset ID_TR_bytes
je ss_finish_copy
mov dx,offset internal_errmsg
stc
ret
ss_finish_copy:
call copy_file
jnc ss_copies_done
ret
ss_copies_done:
push es
mov es,buffer_seg
mov ah,49h
int 21h ; release memory block at es:0
pop es
ret
setup_stuff endp
ifconfig proc near
; ifconfig - configure the ifcust.sys or ibmtr.sys file, as appropriate, with
; this machine's unique IP number.
; entry [this_node] points to the table entry for this machine
; [which_card] points to the selected card's ID bytes
; exit c = error, [dx] has errmsg record if so
mov si,this_node ; copy IP addr from table_entry field
lea si,[si.IP_addr] ; to tail end of ifconfig command line
mov di,offset ifc_trailer_3C
cmp which_card,offset ID_3Com_bytes
je ifc_goahead
mov param_block.cmd_line_o,offset ifc_header_TR
mov di,offset ifc_trailer_TR
cmp which_card,offset ID_TR_bytes
je ifc_goahead
mov dx,offset internal_errmsg
stc
ret
ifc_goahead:
mov cx,size IP_addr
rep movsb
mov dx,offset ifconfig_cmd
mov bx,offset param_block
mov ax,cs
mov [bx.env_seg],ax ; Environment seg
mov [bx.cmd_line_s],ax ; Cmd line ptr seg
mov [bx.FCB_1_s],ax ; FCB 1 seg
mov [bx.FCB_2_s],ax ; FCB 2 seg
call do_DOS_exec
ret
ifconfig endp
ipconfig proc near
; ipconfig - configure the ipcust.sys file with this machine's unique hostname
; and fullname.
; entry [this_node] points to table_entry with configuration values
; exit c = error, [dx] has errmsg record if so
mov si,offset hostname_header
mov di,offset ipc_trailer
mov cx,9
rep movsb
mov si,this_node
lea si,[si.host_name]
mov cx,size host_name
rep movsb
mov dx,offset ipconfig_cmd
mov bx,offset param_block
mov [bx.cmd_line_o],offset ipc_header
call do_DOS_exec
jc ipc_exec_err
mov si,offset fullname_header
mov di,offset ipc_trailer
mov cx,9
rep movsb
mov si,this_node
lea si,[si.full_name]
mov cx,size full_name
rep movsb
mov dx,offset ipconfig_cmd
mov bx,offset param_block
call do_DOS_exec
ipc_exec_err:
ret
ipconfig endp
SUBTTL PD Master Environment subroutine from wuarchive
PAGE
;the following is taken verbatim but for commenting out documentation
;from mastrenv.arc, FTP'ed down from wuarchive.wustl.edu
;(/mirrors/msdos/asmutl/mastrenv.arc)
;==========
;tech.notes/pc.code #29, from pmaupin, 3407 chars, Sat Jun 4 22:40:45 1988
;----------
;TITLE: Finding DOS's master environment pointer
;This is a fragment of code that my SD.COM program uses to find
;the environment. This fragment is different than most ways of
;finding the environment, in that it finds the MASTER environment block,
;not the current process's parent's environment.
;This is useful in some cases, and has the added advantage that
;it does NOT behave differently when executing under CodeView,
;so you do NOT have to hard-code your system's DOS environment address
;into your program in order to debug it.
EnvPtr EQU 2CH ; Offset in PSP
CommandInterrupt EQU 2EH ; entry point into first Command.Com
; through interpreter
DosSegPtr EQU CommandInterrupt * 4 + 2
; FindEnvironment is passed:
; DS should point to program PSP
; FindEnvironment returns:
; ES points to master environment block, or program's copy if couldn't
; find the master.
; CX is length of block, or 0 if couldn't find the master.
; FindEnvironment destroys:
; AX, SI
FindEnvironment PROC NEAR
xor si,si ; Point to segment 0
mov es,si
mov si, word ptr es:[DosSegPtr]
mov ax,si
call VerifyBlock ; make sure we've found COMMAND
jnz GotBlock ; jump if not a good block --
; use process's environment
mov ax,es:[EnvPtr+10h] ; get COMMAND's environment ptr
or ax,ax ; jump if COMMAND has a
jnz MaybeGoodBlock ; subsidiary environment
mov ax,si ; If no subsidiary, just use
add ax,cx ; the allocation block
inc ax ; immediately after COMMAND
MaybeGoodBlock: call VerifyBlock ; verify that we have a good
; one, one way or another
GotBlock:
shl cx,1 ; multiply by 16 to get
shl cx,1 ; length in bytes
shl cx,1
shl cx,1
mov es,ax
ret
; VerifyBlock tries to insure that we're pointing to a valid DOS
; allocation block. If not, returns the current process's environment
; block.
VerifyBlock PROC NEAR
dec ax ; get block header into ES
mov es,ax
inc ax
cmp byte ptr es:[0],04Dh ; make sure signature is valid
jnz UseCurrent
cmp word ptr es:[1],si ; make sure owner is valid
jnz UseCurrent
mov cx, word ptr es:[3] ; retrieve the length
ret
UseCurrent: mov ax,word ptr ds:[EnvPtr] ; get current process's env
xor cx,cx ; zero length
ret
VerifyBlock ENDP
FindEnvironment ENDP
;So far, this seems to work. I would welcome any feedback on its
;efficacy, but if the feedback is negative, please give the DOS version
;and a detailed problem description. Thanks,
;Pat
SUBTTL Subroutines
PAGE
setenv_var proc near
; set environmental variable - set the environmental variable WIPECTRL_CARD_TYPE
; in the master environment either to a value reflecting [which_card], or to a
; special value from the table entry for this machine.
; entry [which_card] points to the selected card's ID bytes
; [this_node] points to this machine's table entry
; exit c = error, [dx] has errmsg record if so
assume es:nothing
call FindEnvironment
or cx,cx
jnz sv_found_master_env
mov dx,offset no_master_errmsg
stc
ret
sv_found_master_env:
assume es:nothing
xor di,di
mov al,env_match
sv_look_again:
repne scasb
je sv_found_first
mov dx,offset no_env_errmsg
stc
ret
sv_found_first:
mov si,offset env_match + 1
push cx
push di
mov cx,offset env_match_end - offset env_match - 1
repe cmpsb
pop di
pop cx
jne sv_look_again
add di, offset env_value - offset env_match - 1
mov si,this_node
lea si,[si.special_label]
cmp byte ptr [si],20h
jne sv_update_var
mov si,offset env_value_3Com
cmp which_card,offset ID_3Com_bytes
je sv_update_var
mov si,offset env_value_TR
cmp which_card,offset ID_TR_bytes
je sv_update_var
mov dx,offset internal_errmsg
stc
ret
sv_update_var:
mov cx,5
rep movsb
push cs
pop es
assume es:cseg
clc
ret
setenv_var endp
SUBTTL Main routine
PAGE
start proc near
call get_ID_3Com_bytes ; detect the hardware in this machine
call get_ID_TR_bytes
call read_input_file ; read in the table file
jc error
call choose_card ; evaluate the hardware detection
; results
jc error
call setup_stuff ; deallocate excess memory, and copy
; appropriate driver files to workarea
jc error
call ifconfig ; ifconfig driver files
jc error
call ipconfig ; ipconfig driver files
jc error
call setenv_var ; record configuration in WIPECTRL_CARD_TYPE
jc error
mov ax,4C00h ; Exit with no errors
int 21h
; ERROR WAS DETECTED - beep several times and print errmsg
; entry [dx] contains errmsg record
error:
mov bx,dx
mov al,[bx]
push ax
inc dx
mov cl,al
xor ch,ch
push cx
push dx
error_beep_loop1:
mov dl,7
mov ah,2
int 21h
loop error_beep_loop1
pop dx
mov ah,9
int 21h
mov dx,offset crlf
mov ah,9
int 21h
pop cx
error_beep_loop2:
mov dl,7
mov ah,2
int 21h
loop error_beep_loop2
pop ax
mov ah,4Ch
int 21h
ethercard_tbl equ $ ; table on which to match ethernet card numbers
; allocate room for 32 machines
input_begin equ $ + (32 * size table_entry) ; area for raw text
start endp
cseg ends
end entpt
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.