-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathsym2sg1000.php
More file actions
23 lines (20 loc) · 796 Bytes
/
Copy pathsym2sg1000.php
File metadata and controls
23 lines (20 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
$content = file( $argv[1] );
foreach( $content as $line ) {
$p = strpos($line, "=");
if ( $p ) {
$symbol = trim(substr( $line, 0, $p-1 ) );
$offset = substr( $line, $p+3, 4 );
if ( strpos( $line, "const") !== FALSE ) {
echo $symbol.": equ ".dechex(hexdec($offset))."h\n";
} else if ( strpos( $line, "data_user") !== FALSE ) {
if ( hexdec($offset) < 0x7030 ) {
echo $symbol.": equ ".dechex(0xc000+hexdec($offset))."h\n";
} else {
echo $symbol.": equ ".dechex(hexdec($offset))."h\n";
}
} else {
echo $symbol.": equ ".dechex(0x0000+hexdec($offset))."h\n";
}
}
}