mirror of
https://github.com/stevenhowes/wbios.git
synced 2026-05-26 15:53:34 +01:00
Initial commit of 1.11 source as released by PC Engines
Original source https://www.pcengines.ch/file/wbios111s.zip
This commit is contained in:
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,186 @@
|
||||
{$r-,i-,s-}
|
||||
|
||||
{ BIOS checksum utility
|
||||
|
||||
(C)2001 Pascal Dornier / PC Engines
|
||||
This file is licensed pursuant to the COMMON PUBLIC LICENSE Rev. 0.5.
|
||||
|
||||
- find _32_ (paragraph aligned), insert checksum byte for 32 bit
|
||||
PCI BIOS header
|
||||
|
||||
- find _DAT (word aligned), insert checksum byte for BIOS read/write
|
||||
data area
|
||||
|
||||
- insert BIOS date
|
||||
|
||||
- insert model byte
|
||||
|
||||
- insert overall checksum byte
|
||||
|
||||
Compile using Borland Pascal 7.0 (older versions likely to work too)
|
||||
}
|
||||
|
||||
uses dos;
|
||||
|
||||
const
|
||||
zero=ord('0');
|
||||
hx:array[0..15] of char = '0123456789ABCDEF';
|
||||
|
||||
type
|
||||
bios=array[0..$fffe] of byte;
|
||||
|
||||
var
|
||||
b:^bios;
|
||||
fi:file;
|
||||
blen:word;
|
||||
startofs,datofs,pciofs:word;
|
||||
i:word;
|
||||
sum:byte;
|
||||
yy,mm,dd,dw:word;
|
||||
|
||||
procedure hexw(i:word);
|
||||
begin
|
||||
write(hx[i shr 12],hx[hi(i) and 15],hx[lo(i) shr 4],hx[i and 15]);
|
||||
end;
|
||||
|
||||
begin
|
||||
if paramcount<>2 then begin
|
||||
writeln('BIOSSUM usage: BIOSSUM infile outfile');
|
||||
halt(1);
|
||||
end;
|
||||
|
||||
{ read input file }
|
||||
|
||||
new(b);
|
||||
assign(fi,paramstr(1));
|
||||
reset(fi,1);
|
||||
if ioresult<>0 then begin
|
||||
write('Could not open input file ',paramstr(1));
|
||||
halt(1);
|
||||
end;
|
||||
blockread(fi,b^,sizeof(b^),blen);
|
||||
close(fi);
|
||||
|
||||
if blen<>$fff7 then writeln('Warning: input file length incorrect ?');
|
||||
|
||||
{ get start offset }
|
||||
|
||||
startofs:=b^[$fff5]+swap(b^[$fff6]); { stored just after the reset vector }
|
||||
|
||||
{ find _32_ (paragraph aligned), insert checksum byte for 32 bit
|
||||
PCI BIOS header }
|
||||
|
||||
asm
|
||||
xor bx,bx { clear offset }
|
||||
les di,b { pointer to BIOS buffer }
|
||||
mov di,startofs
|
||||
db $66 { mov eax,"_32" }
|
||||
mov ax,$335f
|
||||
dw $5f32
|
||||
@l1: db $66 { cmp [di],eax }
|
||||
cmp [es:di],ax
|
||||
jz @l2 { :found header }
|
||||
add di,16 { next paragraph }
|
||||
jnz @l1 { :keep looking }
|
||||
jmp @l9 { not found }
|
||||
|
||||
@l2: mov bx,di { remember start address }
|
||||
xor al,al { calculate checksum }
|
||||
mov cx,10
|
||||
@l3: add al,[es:di]
|
||||
inc di
|
||||
loop @l3
|
||||
neg al
|
||||
stosb
|
||||
|
||||
@l9: mov pciofs,bx { return offset, 0 if not found }
|
||||
end;
|
||||
if pciofs=0 then
|
||||
writeln('_32_ area not found.')
|
||||
else begin
|
||||
write('_32_ area found at '); hexw(pciofs); writeln;
|
||||
end;
|
||||
|
||||
{ find _DAT (word aligned), insert checksum byte for BIOS read/write
|
||||
data area }
|
||||
|
||||
asm
|
||||
xor bx,bx { clear offset }
|
||||
les di,b { pointer to BIOS buffer }
|
||||
mov di,startofs
|
||||
mov cx,di
|
||||
neg cx
|
||||
shr cx,1
|
||||
mov ax,$445F { _D }
|
||||
@l1: jcxz @l9 { bail if nothing left }
|
||||
repnz scasw
|
||||
jnz @l9 { :not found }
|
||||
cmp word [es:di],$5441 { AT ? }
|
||||
jnz @l1 { :keep searching }
|
||||
lea bx,[di-2] { save offset }
|
||||
|
||||
mov cx,[es:di+2] { get byte count }
|
||||
int 3 {&&&}
|
||||
add di,4
|
||||
xor al,al
|
||||
@l2: add al,[es:di] { calculate checksum }
|
||||
inc di
|
||||
loop @l2
|
||||
neg al { store checksum }
|
||||
stosb
|
||||
|
||||
@l9: mov datofs,bx { return offset, 0 if not found }
|
||||
end;
|
||||
if datofs=0 then
|
||||
writeln('_DAT area not found.')
|
||||
else begin
|
||||
write('_DAT area found at '); hexw(datofs); writeln;
|
||||
end;
|
||||
|
||||
{ insert BIOS date }
|
||||
|
||||
getdate(yy,mm,dd,dw);
|
||||
b^[$fff5]:=(mm div 10)+zero;
|
||||
b^[$fff6]:=(mm mod 10)+zero;
|
||||
b^[$fff7]:=ord('/');
|
||||
b^[$fff8]:=(dd div 10)+zero;
|
||||
b^[$fff9]:=(dd mod 10)+zero;
|
||||
b^[$fffa]:=ord('/');
|
||||
b^[$fffb]:=((yy mod 100)div 10)+zero;
|
||||
b^[$fffc]:=(yy mod 10)+zero;
|
||||
b^[$fffd]:=$ff;
|
||||
|
||||
{ insert AT model byte }
|
||||
|
||||
b^[$fffe]:=$fc;
|
||||
|
||||
{ calculate overall checksum }
|
||||
|
||||
sum:=0;
|
||||
for i:=startofs to $fffe do
|
||||
inc(sum,b^[i]);
|
||||
|
||||
i:=$ffff;
|
||||
b^[i]:=-sum;
|
||||
|
||||
{ write output file }
|
||||
|
||||
assign(fi,paramstr(2));
|
||||
rewrite(fi,1);
|
||||
if ioresult<>0 then begin
|
||||
write('Could not create output file ',paramstr(1));
|
||||
halt(1);
|
||||
end;
|
||||
|
||||
if startofs=0 then begin
|
||||
blockwrite(fi,b^[0],$8000); { write 64KB in two pieces }
|
||||
blockwrite(fi,b^[$8000],$8000);
|
||||
end else
|
||||
blockwrite(fi,b^[startofs],$10000-startofs);
|
||||
|
||||
if ioresult<>0 then begin
|
||||
write('Write error !');
|
||||
halt(1);
|
||||
end;
|
||||
close(fi);
|
||||
end.
|
||||
Binary file not shown.
BIN
Binary file not shown.
+231
@@ -0,0 +1,231 @@
|
||||
Calling the editor
|
||||
------------------
|
||||
|
||||
Call ED.COM using
|
||||
|
||||
ED [-m=macfile] [file]
|
||||
|
||||
File is the (optional) name of the file to be edited. If this file is invalid
|
||||
or doesn't exist yet, "Disk error" is indicated. If the -m=macfile option is
|
||||
specified (macfile is the name of the keyboard macro file), the macro file is
|
||||
read on startup.
|
||||
|
||||
On errors the editor expects you to hit the space bar as an acknowledgement.
|
||||
|
||||
Some control characters can modify video attributes (if the editor is installed
|
||||
properly for your screen). Insert the chars using the ^P command:
|
||||
|
||||
^B Boldface on
|
||||
^U Underline on
|
||||
^N Normal (bold and underline off)
|
||||
|
||||
Hard tabs are expanded. As usual, tab positions are at column 9, 17, 25 etc.
|
||||
The end of the file is displayed by a gray area.
|
||||
|
||||
Editor commands
|
||||
---------------
|
||||
|
||||
For many commands function keys can also be used.
|
||||
|
||||
^A word left
|
||||
^C page down
|
||||
^D character right
|
||||
^E line up
|
||||
^F word right
|
||||
^G delete char right
|
||||
^H backspace, delete left
|
||||
^I tabulator (insert a hard tab)
|
||||
^J jump to symbol = search
|
||||
Enter word to be searched. The search is case-sensitive.
|
||||
Cursor jumps to first instance in text (search next: ^L)
|
||||
^K prefix for block, file and assembler commands
|
||||
^L repeat previous search (& replace)
|
||||
^N insert line break
|
||||
^O prefix for macro commands
|
||||
^P prefix for entering control chars
|
||||
(to enter ^_ type ^_^P^_<Enter>)
|
||||
^Q prefix for jump commands
|
||||
^R page up
|
||||
^S character left
|
||||
^T delete word right
|
||||
^U cursor line -> middle of the screen
|
||||
^V toggle insert / overwrite
|
||||
^W scroll up
|
||||
^X line down
|
||||
^Y delete line
|
||||
^Z scroll down
|
||||
ESC exit editor - also see file management.
|
||||
|
||||
Block operations
|
||||
----------------
|
||||
|
||||
All block operations are line-oriented, i.e. they always treat entire lines.
|
||||
|
||||
^KA block = all (entire text)
|
||||
^KB mark block beg
|
||||
^KC copy block
|
||||
^KE mark block end
|
||||
^KJ append (join) block to file (ignores ^Z)
|
||||
^KK mark block end
|
||||
^KN block = nothing
|
||||
^KR read block
|
||||
^KV move block
|
||||
^KW write block
|
||||
^KY delete block
|
||||
|
||||
Quick jump commands
|
||||
-------------------
|
||||
|
||||
^QA Search and replace. Asks for options. Valid options are:
|
||||
|
||||
g = global (start from beginning)
|
||||
n = don't prompt for replacement
|
||||
u = don't distinguish upper and lower case
|
||||
w = search whole words only
|
||||
|
||||
Valid answers to the prompt are:
|
||||
|
||||
y = ok, do replace
|
||||
n = don't replace this one
|
||||
* = go ahead, don't ask me any more
|
||||
Esc = stop it
|
||||
|
||||
^QB jump to block beg
|
||||
^QC jump to text end
|
||||
^QD jump to line end
|
||||
^QE jump to block end
|
||||
^QF search (same options as ^QA)
|
||||
^QI toggle auto-indent option
|
||||
^QK jump to block end
|
||||
^QL undo changes in current line
|
||||
^QR jump to text beg
|
||||
^QS jump to line beg
|
||||
^QY delete to end of line
|
||||
^QZ delete to beg of line
|
||||
|
||||
File management
|
||||
---------------
|
||||
|
||||
When calling ED from DOS a main file may be specified on the command line which
|
||||
is then read into the text buffer.
|
||||
|
||||
Files are written back without query (there is a special command to throw away
|
||||
changes made to the file). ED does not make .BAK files (the MS-DOS file system
|
||||
is too damn slow).
|
||||
|
||||
The editor can quickly switch between two files: main and include. Both files
|
||||
must fit into the text buffer (about 64 K) together.
|
||||
|
||||
Esc Exit ED
|
||||
- from main: save main, return to DOS
|
||||
- from incl: save incl, return to main
|
||||
|
||||
^KI Back to the previous include file (name displayed in status line)
|
||||
|
||||
^KL Load/change include file
|
||||
- from main: load new include file
|
||||
- from incl: save incl, load new include file
|
||||
|
||||
^KM Load/change main file
|
||||
- from main: save main, load new main file
|
||||
- from incl: save incl, back to main
|
||||
|
||||
^KQ Throw away changes (query)
|
||||
- from main: don't save main, return to DOS
|
||||
- from incl: don't save incl, return to main
|
||||
|
||||
^KS Save current file (manual save)
|
||||
|
||||
Should it be impossible to save a file the usual way (disk full etc.), mark the
|
||||
text with ^KA, write it with ^KW to another disk and exit ED with ^KQ. If you
|
||||
are prompted for a save filename, but want to throw away the file, enter 'nul'
|
||||
as filename. DOS will dutifully write the file to the null device.
|
||||
|
||||
Function keys
|
||||
-------------
|
||||
|
||||
Function keys can be used for some commands:
|
||||
|
||||
up cursor up
|
||||
down cursor down
|
||||
left cursor left ^left word left
|
||||
right cursor right ^right word right
|
||||
PgUp page up ^PgUp mark block beg
|
||||
PgDn page down ^PgDn mark block end
|
||||
Home jump to line beg ^Home jump to text beg
|
||||
End jump to line end ^End jump to text end
|
||||
|
||||
Ins toggle insert/overwrite mode
|
||||
Del delete char right
|
||||
^BS delete to end of line
|
||||
|
||||
ScrLock Lock cursor line. The cursor will always remain in the same line of the
|
||||
screen (as far as possible). This is nice for bulk revisions. The
|
||||
cursor line can be moved with ^W, ^Z and ^U.
|
||||
|
||||
Keyboard Macros
|
||||
---------------
|
||||
|
||||
The following keys can be programmed with macros of (nearly) any length (all
|
||||
together up to 868 bytes, where each keystroke takes 1..2 bytes). Which keys
|
||||
can be used may also depend on your keyboard driver.
|
||||
|
||||
F1..F10
|
||||
Shift F1..F10
|
||||
Ctrl F1..F10
|
||||
Alt F1..F10
|
||||
Alt A..Z
|
||||
Alt 1..9,0,-,= (all keys in the number row)
|
||||
|
||||
^OL Record keyboard macro
|
||||
|
||||
Hit the destination key, then enter the command sequence (which is
|
||||
executed as usual, so you have visual feedback). Terminate the sequence
|
||||
with ^Break. Mistakes will also be recorded faithfully and cannot be
|
||||
edited except by recording the macro again.
|
||||
|
||||
Macros can also be used during recording. Nesting is limited to
|
||||
15 levels, everything beyond is ignored. A macro that calls itself
|
||||
once will repeat 16 times, if it calls itself twice it will repeat
|
||||
2^16 times... Macros may be interrupted by ^Break.
|
||||
|
||||
^_ This suspends macro execution and lets the user enter data (no macros)
|
||||
terminated by <Enter>; macro execution will then resume. The user's
|
||||
<Enter> is ignored: The macro may edit or extend the entry (e.g. add a
|
||||
default extension to a filename).
|
||||
|
||||
^OW Write macros to file
|
||||
|
||||
^OR Read macros from file. This automatically executes the Alt-0 macro,
|
||||
making it possible to "chain" macros.
|
||||
|
||||
^OV Update the display. Normally, the display is not updated during macro
|
||||
execution (resulting in fast execution of macros). This command can be
|
||||
used to show intermediate results.
|
||||
|
||||
Status line
|
||||
-----------
|
||||
|
||||
The editor status is displayed in the top line of the screen:
|
||||
|
||||
^K no 3 main + include filename
|
||||
|
||||
^K Command prefix. Displayed while entering commands such as ^KB.
|
||||
|
||||
n Indicates automatic indentation switched off. Toggle with ^QI.
|
||||
|
||||
o Indicates overwrite mode. Toggle with ^V or INS.
|
||||
|
||||
3 Indicates cursor position in line.
|
||||
|
||||
Editing in the status line is similar to normal editing, but:
|
||||
|
||||
- Trailing spaces are not cut off.
|
||||
- ^A jumps to beg of line
|
||||
- ^F jumps to end of line
|
||||
- Esc breaks the command.
|
||||
- When a default is given, if the first key pressed is a char,
|
||||
the default is cleared and the char is entered. If the first
|
||||
key is an editor command, the default can be edited. To insert
|
||||
something at the beginning of the default, first hit the
|
||||
cursor left key.
|
||||
Reference in New Issue
Block a user