aboutsummaryrefslogtreecommitdiff
path: root/size.pl
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-01-12 03:43:23 -0500
committerB. Watson <yalhcru@gmail.com>2016-01-12 03:43:23 -0500
commitf90842d4decc6f9453e53785174c73674dc86a51 (patch)
treeec749af9e26555c8ea07d60e5de66ce174efc2ae /size.pl
parent235efa90197fe69b4c2cf681a277d10ed2eed4d2 (diff)
downloadtaipan-f90842d4decc6f9453e53785174c73674dc86a51.tar.gz
move memory layout around to free more code space
Diffstat (limited to 'size.pl')
-rw-r--r--size.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/size.pl b/size.pl
new file mode 100644
index 0000000..1d012bc
--- /dev/null
+++ b/size.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/perl -w
+
+my $stack_size = oct(shift) || die "no stack size";
+
+open MAP, "<taipan.map" or die $!;
+while(<MAP>) {
+ next unless /^BSS/;
+ (undef, $bss_start, $bss_end, undef) = split /\s+/;
+ $bss_start = hex $bss_start;
+ $bss_end = hex $bss_end;
+}
+close MAP;
+
+$free = (0xbc20 - $stack_size) - $bss_end + 1;
+
+printf " code ends at \$%04x\n", ($bss_start - 1);
+printf " BSS ends at \$%04x\n", $bss_end;
+printf "stack starts at \$%04x\n", 0xbc20 - $stack_size;
+printf "free code space \$%04x (%d, %.1fK)\n", $free, $free, $free / 1024;