Browse Source
Some small amount of postprocessing is required after assembling bootstrap.asm with a56. Add a script and makefile for this. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>main
Ben Hutchings
13 years ago
3 changed files with 42 additions and 1 deletions
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
bootstrap.bin: bootstrap.asm concat-bootstrap.pl |
||||
a56 bootstrap.asm >/dev/null |
||||
perl concat-bootstrap.pl <a56.out >bootstrap.bin |
||||
|
||||
clean: |
||||
rm -f a56.out bootstrap.bin |
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
# Postprocessor for dsp56k bootstrap code. |
||||
# |
||||
# Copyright Ben Hutchings 2011. |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 2 of the License, or |
||||
# (at your option) any later version. |
||||
|
||||
use strict; |
||||
use warnings; |
||||
|
||||
my @memory; |
||||
my %symbol; |
||||
|
||||
# Reconstruct memory image and symbol table |
||||
while (<>) { |
||||
if (/^P ([0-9A-F]{4}) ([0-9A-F]{6})\n/) { |
||||
$memory[hex($1)] = hex($2); |
||||
} elsif (/^I ([0-9A-F]{6}) (\w+)\n/) { |
||||
$symbol{$2} = hex($1); |
||||
} else { |
||||
print STDERR "W: did not recognise line $.\n"; |
||||
} |
||||
} |
||||
|
||||
# Concatenate first and second stage. Second stage is assembled |
||||
# between 'upload' and 'upload_end', but initially loaded at |
||||
# 'real' (end of the first stage). |
||||
for (0 .. ($symbol{real} - 1), $symbol{upload} .. ($symbol{upload_end} - 1)) { |
||||
my $word = $memory[$_] || 0; |
||||
print pack('CCC', $word / 65536, ($word / 256) % 256, $word % 256); |
||||
} |
Loading…
Reference in new issue