-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildasm.php
More file actions
executable file
·35 lines (28 loc) · 827 Bytes
/
buildasm.php
File metadata and controls
executable file
·35 lines (28 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
declare(strict_types=1);
if ($argc < 2) {
echo "Usage: {$argc[0]} <assembly_file> [output_file]";
echo "\nOptions:\n";
echo " assembly_file - Source program\n";
echo " out_putfile - Resulting ROM name\n";
exit(1);
}
$assemblyFile = $argv[1];
$binFile = pathinfo($argv[1])['filename'];
$outputFile = isset($argv[2]) ? $argv[2] : "$binFile.bin";
if (!file_exists($assemblyFile)) {
echo "Error: File not found: {$assemblyFile}\n";
exit(1);
}
$output = [];
$returnCode = 0;
exec("./bin/vasm6502_oldstyle -Fbin -dotdir $assemblyFile -o $outputFile", $output, $returnCode);
if ($returnCode == 0) {
echo "Binary built successfully.\n";
echo "Output:\n";
foreach ($output as $line) {
echo "$line\n";
}
} else {
echo "Program failed with exit code: $returnCode\n";
}