aboutsummaryrefslogtreecommitdiff
path: root/size.pl
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-02-18 13:08:23 -0500
committerB. Watson <urchlay@slackware.uk>2026-02-18 13:08:23 -0500
commit48feffd829f30d393b39ae1cbdc7bf3eddca7652 (patch)
tree0db282f0c9b9a0fd9825426a51742fc37afbe128 /size.pl
parentf1bf0a483e917b67cf9db6483072db261f7688c3 (diff)
downloadfujinet-chat-48feffd829f30d393b39ae1cbdc7bf3eddca7652.tar.gz
WIP, still not working.
Diffstat (limited to 'size.pl')
-rw-r--r--size.pl26
1 files changed, 26 insertions, 0 deletions
diff --git a/size.pl b/size.pl
new file mode 100644
index 0000000..f6cb19f
--- /dev/null
+++ b/size.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/perl -w
+
+# from src/atari.cfg:
+my $code_start = 0x2000;
+my $stack_size = 0x0800;
+
+# from memsetup.asm:
+my $ramtop = 0xa000;
+
+open MAP, "client.xex.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 = ($ramtop - $stack_size) - $bss_end + 1;
+$code_size = $bss_start - $code_start;
+$bss_size = $bss_end - $bss_start + 1;
+
+printf "===> code ends at \$%04x (%d, %.1fK)\n", ($bss_start - 1), $code_size, $code_size / 1024;
+printf "===> BSS ends at \$%04x (%d, %.1fK)\n", $bss_end, $bss_size, $bss_size / 1024;
+printf "===> stack starts at \$%04x\n", $ramtop - $stack_size;
+printf "===> free code space \$%04x (%d, %.1fK)\n", $free, $free, $free / 1024;