Skip to content

Commit

Permalink
Build: Log segment padding in addition to other stats
Browse files Browse the repository at this point in the history
Points out where there is excessive padding at the end of a segment,
which can guide reducing the segment size.

No functional changes.
  • Loading branch information
inexorabletash committed Feb 9, 2025
1 parent c558da3 commit 3d1cfe2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions desktop/desktop.s
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
DEFSEG SegmentLoader, $2000, $0200
DEFSEG SegmentDeskTopAux, $4000, $8000
DEFSEG SegmentDeskTopLC, $D000, $2100
DEFSEG SegmentDeskTopMain, $4000, $7400
DEFSEG SegmentInitializer, $0800, $0900
DEFSEG SegmentDeskTopMain, $4000, $7300
DEFSEG SegmentInitializer, $0800, $0800
DEFSEG SegmentInvoker, $0290, $0160

;; Dynamically loaded overlays
Expand Down
10 changes: 8 additions & 2 deletions inc/macros.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1408,11 +1408,17 @@ skip:
;; Padding to block-align this segment in the file
.res .ident(.sprintf("k%sAlignmentPadding", .string(name)))

.out .sprintf("Segment: %20s addr: $%04X len: $%04X offset: $%06X", .string(name), .ident(.sprintf("k%sAddress", .string(name))), .ident(.sprintf("k%sLength", .string(name))), .ident(.sprintf("k%sOffset", .string(name))))

.org .ident(.sprintf("k%sAddress", .string(name)))
.endmacro

.macro ENDSEG name
.out .sprintf("Segment: %20s addr: $%04X len: $%04X offset: $%06X padding: $%04X", \
.string(name), \
.ident(.sprintf("k%sAddress", .string(name))),\
.ident(.sprintf("k%sLength", .string(name))),\
.ident(.sprintf("k%sOffset", .string(name))),\
.ident(.sprintf("k%sAddress", .string(name))) + .ident(.sprintf("k%sLength", .string(name))) - *\
)

PAD_TO .ident(.sprintf("k%sAddress", .string(name))) + .ident(.sprintf("k%sLength", .string(name)))
.endmacro

0 comments on commit 3d1cfe2

Please sign in to comment.