2008-05-15 22:39:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$cfg = chr($_GET['addr-a']).chr($_GET['addr-b']).chr($_GET['addr-c']).chr($_GET['addr-d']);
|
|
|
|
$cfg .= chr($_GET['mask-a']).chr($_GET['mask-b']).chr($_GET['mask-c']).chr($_GET['mask-d']);
|
|
|
|
$cfg .= chr($_GET['dgw-a']). chr($_GET['dgw-b']). chr($_GET['dgw-c']). chr($_GET['dgw-d']);
|
|
|
|
$cfg .= chr($_GET['dns-a']). chr($_GET['dns-b']). chr($_GET['dns-c']). chr($_GET['dns-d']);
|
|
|
|
|
|
|
|
switch ($_GET['machine']) {
|
|
|
|
case "apple2":
|
|
|
|
$hex = $_GET['apple2-addr'];
|
|
|
|
$drv = $_GET['apple2-drv'];
|
2008-06-07 00:26:44 +00:00
|
|
|
$ext = 'dsk';
|
2010-02-04 00:01:59 +00:00
|
|
|
$ofs = 0x05B00;
|
2008-05-15 22:39:30 +00:00
|
|
|
break;
|
|
|
|
case "c64":
|
|
|
|
$hex = strtok($_GET['c64-addr-drv'], '-');
|
|
|
|
$drv = strtok('-');
|
2008-06-07 00:26:44 +00:00
|
|
|
$ext = 'd64';
|
2010-02-04 00:01:59 +00:00
|
|
|
$ofs = 0x15002;
|
2008-05-15 22:39:30 +00:00
|
|
|
break;
|
|
|
|
case "c128":
|
|
|
|
$hex = strtok($_GET['c128-addr-drv'], '-');
|
|
|
|
$drv = strtok('-');
|
2008-06-07 00:26:44 +00:00
|
|
|
$ext = 'd71';
|
2010-02-04 00:01:59 +00:00
|
|
|
$ofs = 0x15002;
|
2008-05-15 22:39:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$addr = hexdec($hex);
|
|
|
|
$cfg .= chr($addr % 0x100).chr($addr / 0x100);
|
|
|
|
$cfg .= $drv;
|
|
|
|
|
2008-06-07 00:26:44 +00:00
|
|
|
if ($_GET['disk']) {
|
|
|
|
$out = substr_replace(file_get_contents('contiki.' . $ext), $cfg, $ofs, strlen($cfg));
|
|
|
|
} else {
|
|
|
|
$ext = 'cfg';
|
|
|
|
$out = $cfg;
|
|
|
|
}
|
|
|
|
|
2008-05-15 22:39:30 +00:00
|
|
|
header('Content-Type: application/octetstream');
|
2008-06-07 00:26:44 +00:00
|
|
|
header('Content-Disposition: attachment; filename=contiki.' . $ext);
|
|
|
|
print($out);
|
2008-05-15 22:39:30 +00:00
|
|
|
|
2008-06-07 00:26:44 +00:00
|
|
|
?>
|