{ AWE 32 ROM samples are the best. Dump'em with this. By .\\isterGun 1995 }
{ BIG thanx to Cygnus-X1 for his code. This is mostly a translation in BP7}
{ Type One for little C++ help & Giving me the one upstairs :}
uses crt;
var awe32base : integer; {Programma engineerae tempum : 2 hoursam }
cpt : longint; { --> Loware Qualitas Codim excusaere }
fil : text;
name:string; { █████████ CONTACTS : ████████ }
b1,b2 : byte; { █ CEDRIC.AMAND@LINKLINE.BE █ }
w : word; { █████████████████████████████ }
{REMARK : I removed "ASM cli end;" & "ASM sti end;" lines that are in my
original code. You should however put such line before (cli) and after (sti)
any access to AWE bus. }
procedure awe32regW( command, dataport : integer; data :word);
begin {Write WORD in AWE register}
portw[awe32BASE + $802] := command;
portw[awe32BASE - $620 + dataport] := data;
end;
procedure awe32regDW( command, dataport : integer; data : longint);
begin {Write fake "Double in register, BEWARE OF SIGN ERRORS !}
portw[awe32BASE + $802] := command;
portw[awe32BASE - $620 + dataport] := data;
portw[awe32BASE - $620 + dataport +2] := data shr 16;
end;
function awe32regR(command,dataport : integer) : word;
begin {Read WORD}
portw[AWE32Base+$802] :=Command;
awe32regR := portw[AWE32Base-$620+DataPort];
end;
function awe32regDR(command,dataport : integer) : longint;
var k,temp : longint; {Read fake "double" }
begin {Beware of sign ! (Check it!) }
portw[AWE32Base+$802] :=Command;
k := portw[AWE32Base-$620+DataPort];
temp := portw[AWE32Base-$620+DataPort+2];
AWE32REGDR := k+(temp shl 16);
awe32regDR := portw[AWE32Base-$620+DataPort];
end;
procedure enableDRAM; {Enables DRAM access. Don't ask me why.}
var scratch : longint; {Forward your questions to Cygnus X1 :)}
k : integer;
begin
AWE32RegW($3E,$A20,$20);
for k := 0 to 29 do
begin
AWE32RegW ($A0+k,$A20,$80); {?}
AWE32RegDW($60+k,$620,0); {?}
AWE32RegDW($40+k,$620,0); {etc...}
AWE32RegDW($C0+k,$620,0);
AWE32RegDW($E0+k,$620,0);
AWE32RegDW($20+k,$620,$40000000); {??}
AWE32RegDW(0+k,$620,$40000000); {??}
Scratch := ( ((k and 1) shl 9) +$400 ); { !¿! }
Scratch := Scratch shl 16;
AWE32RegDW(0+k,$A20,Scratch); {?????¿¿¿!!!!}
end
end;
procedure AWE32WAIT(clocks : word); {Wait CLOCKS number of AWE ticks}
var k,time : word; {1 AWE tick is 1/44100 sec}
begin {AWE DAC can go up to 45454.}
k := AWE32RegR($3B,$A22);
time := k;
while clocks> (time-k) do time := awe32REGR($3B,$A22);
end;
procedure disableDRAM; {Guess...}
var k : integer;
begin
for k := 0 to 29 do { 30 iterations ? Why ? Where ? When ? }
begin
AWE32RegDW(k,$A20,0);
AWE32RegW($A0+k,$A20,$807F); {Why those values ? What do they do ?}
end;
end;
function ramsize : longint; {Return RAM size in KB}
var f,dramsize : longint;
begin {NOTE:COMMENTS ARE WHAT I -GUESS- A FUNCTION TO DO}
EnableDRAM;
AWE32RegDW($36,$A20,$200000); {Sure it sets Address for writing}
AWE32RegW($3A,$A20,$1234); {Something particular to search for.}
AWE32RegW($3A,$A20,$7777); {So; you writed 2 words in AWE's RAM}
f:=0;
dramsize :=0;
while (DRAMSize < 28*1024) and (f=0) do { 28 MB is max onboard memory}
begin
AWE32Wait(2); {AWE's reactions maybe not immediate ?}
AWE32RegDW($34,$A20,$200000); {Sets address for reading}
AWE32RegR($3A,$A20); {?? Skips first word ??}
if(AWE32RegR($3A,$A20) <> $1234) then f:=1; {Poor, but easy.}
if(AWE32RegR($3A,$A20) <> $7777) then f:=1; { :) }
inc(DRAMSize,32);
AWE32RegDW($36,$A20,$200000+DRAMSize*512); {Search for more memory}
AWE32RegW($3A,$A20,$FFFF); {What the fuck ?}
end;
DisableDRAM;
ramsize := dramsize-32;
end;
procedure init; { Comment for all following lines : "?????" :) }
var k : word;
begin
AWE32RegW($BE,$A20,$80);
AWE32RegDW($DE,$620,$FFFFFFE0);
AWE32RegDW($FE,$620,$FFFFE8);
AWE32RegDW($3E,$620,0);
AWE32RegDW($1E,$620,0);
AWE32RegDW($1E,$A20,$FFFFE3);
AWE32RegW($BF,$A20,$80); {Remark the symetry $BE-->$BF, etc...}
AWE32RegDW($DF,$620,$FFFFF0); {Should be done with a FOR TO}
AWE32RegDW($FF,$620,$FFFFF8);
AWE32RegDW($3F,$620,$FF);
AWE32RegDW($1F,$620,$8000);
AWE32RegDW($1F,$A20,$FFFFF3);
portw[AWE32Base+$802] :=$3E;
portw[AWE32Base] :=0;
while k=0 do k := portw[AWE32Base+$802] and $10;
while k=$10 do k := portw[AWE32Base+$802] and $10; {The same thing !}
portw[AWE32Base+2] := $4828;
portw[AWE32Base+$802] := $3C;
portw[AWE32Base+$400] := 0;
AWE32RegDW($7E,$620,$FFFFFFFF); {Two times the same}
AWE32RegDW($7F,$620,$FFFFFFFF);
end;
begin
awe32BASE := $620; {Hope it is yours ! If not : CHANGE JUMPERS >;) }
clrscr;
writeln('╔══════════════════════════════════╦════════════════════╗');
Writeln('║AWE-32 ROM Samples Dumping Proggy ║ By .\\rGun (c) 1995║');
writeln('╚══════════════════════════════════╩════════════════════╝');
writeln;
write('Init AWE 32...');
init;
writeln('done!');
writeln('Your AWE on $620 has ',ramsize,'Kb RAM on board.');
writeln;
write('Name of dumping file (path+8 char; no extension) ? : ');
readln(name);
assign(fil,name+'.RAW');
rewrite(fil);
write('INIT ram/rom Access...');
EnableDRAM;
writeln('done!');
writeln;
writeln('Dumping 1024 Kb of ROM can take a while... Please wait...');
AWE32RegDW($34,$A20,0); { Sets reading at ROM }
cpt := 0;
repeat {Known bug: any test (<,>,=) bugs.}
w := awe32regR($3A,$A20); {Certainly an CLI/STI bug... }
b1 := w;
b2 := w shr 8;
write(fil, chr(b1),chr(B2)); {Bis repetita placent}
inc(cpt);
until cpt=524288; {1MB/2 (i write 2 bytes) }
close(fil);
DisableDRAM;
writeln(' /\ You should have your ROM DUMP now.');
writeln(' //\/\\ (Despite of bugs :)');
writeln('// .\\ Well... I hope so... ');
end.
I was waiting since a long time for somethin 2 dump the ROM samples.
Nobody was thinking to that sort of thing, so I had to do it myself.