All pastes #921829 Raw Edit

Stuff

public text v1 · immutable
#921829 ·published 2008-02-28 11:01 UTC
rendered paste body
set talk off
set safe off

CREATE TABLE MODULE ( ;
instance   N (2,0) ,;
class	   C (1)   ,;
HeadLen    N (2,0) ,;
Compr_type N (1,0) ,;
Offset     N (10,0),;
Segment    N (10,0),;
expand1_sz N (6,0),;
compr_sz   N (6,0),;
footpr_sz  N (6,0),;
expand2_sz N (6,0),;
prev_start N (11,0),;
start      N (10,0),;
len        N (10,0),;
end        N (10,0),;
name       C (12),;
switch     C (30))

use module.dbf
append blank

bios="YU-V115.ABL"
=adir(ARRAY1,bios)
_bios=fopen(bios)
*? ARRAY1[1,2]
*********************************************
for a=0 to ARRAY1[1,2]
=fseek(_bios,a)
*****
_byte=fread(_bios,3)
if _byte=chr(00)+chr(49)+chr(49)"
*****
=fseek(_bios,a-4)
_prs4=fread(_bios,1)
=fseek(_bios,a-3)
_prs3=fread(_bios,1)
=fseek(_bios,a-2)
_prs2=fread(_bios,1)
=fseek(_bios,a-1)
_prs1=fread(_bios,1)
*****
=fseek(_bios,a+3)
_Instance=fread(_bios,1)
*****
=fseek(_bios,a+4)
_Class=fread(_bios,1)
*****
=fseek(_bios,a+5)
_HeadLen=fread(_bios,1)
=fseek(_bios,a+6)
_Compr_type=fread(_bios,1)
*****
=fseek(_bios,a+7)
_Offset2=fread(_bios,1)
=fseek(_bios,a+8)
_Offset1=fread(_bios,1)
*****
=fseek(_bios,a+9)
_Segment2=fread(_bios,1)
=fseek(_bios,a+10)
_Segment1=fread(_bios,1)
*****
=fseek(_bios,a+11)
_len2=fread(_bios,1)
=fseek(_bios,a+12)
_len1=fread(_bios,1)
*****
=fseek(_bios,a+15)
_len4=fread(_bios,1)
=fseek(_bios,a+16)
_len3=fread(_bios,1)
*****
=fseek(_bios,a+19)
_len6=fread(_bios,1)
=fseek(_bios,a+20)
_len5=fread(_bios,1)
*****
=fseek(_bios,a+23)
_len8=fread(_bios,1)
=fseek(_bios,a+24)
_len7=fread(_bios,1)
*****
=fseek(_bios,a)
 ? "Модуль: "+_Class
append blank
repl prev_start with hexstrword(_prs1+_prs2+_prs3+_prs4)-4294443008
repl Instance   with hexstrword(_Instance)
repl class      with _Class
repl HeadLen    with hexstrword(_HeadLen)
repl Compr_type with hexstrword(_Compr_type)
repl offset     with hexstrword(_offset1+_offset2)
repl segment    with hexstrword(_segment1+_segment2)
repl expand1_sz with hexstrword(_len1+_len2)
repl compr_sz   with hexstrword(_len3+_len4)
repl footpr_sz  with hexstrword(_len5+_len6)
repl expand2_sz with hexstrword(_len7+_len8)
repl start      with a-4
_st=start
skip -1
repl len with _st-start
repl end with module.start+module.len-1
skip 1
do case 
*------------------------*
case _class="*"	
repl name with "AUTOGEN"                   
case _class="$" 
repl name with "MAC"
case _class="@" 
repl name with "STARTUP"     
case _class="C"	                  
repl name with "UPDATE"           
case _class="F"	                  
repl name with "MARKS"            
case _class="L"	                  
repl name with "LOGO"             
case _class="O"	                  
repl name with "NETWORK"          
case _class="S"	                  
repl name with "STRINGS"          
case _class="W"	                  
repl name with "WAV"              
case _class="A"	                  
repl name with "ACPI"             
case _class="D"	                  
repl name with "DISPLAY"          
case _class="G"	                  
repl name with "DECOMPCODE"       
case _class="M"	                  
repl name with "MISER"            
case _class="P"	                  
repl name with "ROMPILOTINIT"
case _class="T"	
repl name with "TEMPLATE"
case _class="X"	
repl name with "ROMEXEC"
case _class="B"	
repl name with "BIOSCODE"
case _class="E"	
repl name with "SETUP"
case _class="I"	
repl name with "BOOTBLOCK"
case _class="N"	
repl name with "ROMPILOTLOAD"
case _class="R"	
repl name with "OPROM"
case _class="U"	
repl name with "USER"
*------------------------*
case _class="Q"	
repl name with "MODULE"
repl switch with "-C:"+class+alltrim(str(instance))
case _class="H"	
repl name with "MODULE"
repl switch with "-C:"+class+alltrim(str(instance))
case _class=chr(00)
repl name with "BOTTOM"
*------------------------*
otherwise
repl name with "UFO"
endcase
endif
endfor
*********************************************
=fclose(_bios)
******** Add switch -Z (Disable Shadow) **** 
repl switch with alltrim(switch)+" -Z" for module.name="ROMEXEC" .and. module.instance=1
******** Add switch -X (Disable Compression) ****
repl switch with alltrim(switch)+" -X" for Compr_type=0

repl switch with strtran(switch,"-X","") for NAME="ROMEXEC"
repl switch with strtran(switch,"-X","") for NAME="DECOMPCODE"
repl switch with strtran(switch,"-X","") for NAME="UPDATE"
******** Find & Add Hole ******
append blank
repl Instance  with 0
repl start     with 491520
repl len       with 32768
repl end       with start+len-1
repl name      with "BOOTBLOCK"
repl switch    with "-S:32"
_end=start-1
_end2=end
go top 
locate for name="DISPLAY" .and. instance=0
if found()=.t.
	repl end with _end
	repl len with _end-start+1
endif
go top 
locate for end=_end2
if found()=.t.
	delete
endif

*******************************
append blank
repl Instance  with 0
repl start     with 16384
repl len       with 6144
repl end       with start+len-1
repl name      with "HOLE"
repl switch    with "-A:0xFFF84000 -SB:6144"
*****
append blank
repl Instance  with 1
repl start     with 65536
repl len       with 6144
repl end       with start+len-1
repl name      with "HOLE"
repl switch    with "-A:0xFFF90000 -SB:6144"
_hl=len
go top 
locate for name="BIOSCODE" .and. instance=3
if found()=.t.
	repl end with end-_hl
	repl len with end-start+1
endif
*****
append blank
repl Instance  with 2
repl start     with 131072
repl len       with 2048
repl end       with start+len-1
repl name      with "HOLE"
repl switch    with "-A:0xFFFA0000 -SB:2048"
_hl=len
go top 
locate for name="BIOSCODE" .and. instance=2
if found()=.t.
	repl end with end-_hl
	repl len with end-start+1
endif
*****
*brow for compr_sz+headlen<>len
*repl len with compr_sz+headlen for name="ROMEXEC" .or. name="BIOSCODE"

go top
delete
pack
quit
********************************************************
Function Hex2Dec
********************************************************
*
* Written by: Ralph P. Morse Jr.  (c) 1995
*             RalphMorse@msn.com
*
*  Parameter: Character string from "00" to "FF"
*
*    Returns: Numeric value (0-255)
*
********************************************************
Parameter PCHexCode
Private JCHex1, JCHex2
Store Asc(Upper(SubStr(PCHexCode, 1, 1))) To JCHex1
Store Asc(Upper(SubStr(PCHexCode, 2, 1))) To JCHex2
Store JCHex1 - IIf(JCHex1 > 60, 55, 48) To JCHex1
Store JCHex2 - IIf(JCHex2 > 60, 55, 48) To JCHex2
Return JCHex1 * 16 + JCHex2

********************************************************
FUNCTION hexstrword
PARAMETER hexstr
PRIVATE hexword, inputstr, ch, i,  ;
        j
hexword = 0
inputstr = hexstr
FOR i = 1 TO LEN(inputstr)
     ch = SUBSTR(inputstr, i, 1)
     j = ASC(ch)
     hexword = (hexword * 256) +  ;
               j
ENDFOR
RETURN hexword
********************************************************