Skip to content

Commit

Permalink
Address some review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ISSOtm committed Dec 24, 2023
1 parent 4075438 commit 2efaafa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions man/rgblink.5
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The possible types are:
.Ic ROM0 , ROMX , VRAM , SRAM , WRAM0 , WRAMX , OAM ,
and
.Ic HRAM .
However, if the type only contains a single bank, then the number can be omitted.
If the type only contains a single bank, then the number can be omitted.
The applicable types are:
.Ic ROM0 ,
.Ic ROMX No if Fl t No is passed to Xr rgblink 1 ,
Expand All @@ -96,7 +96,9 @@ sets the
.Dq current address
to
.Ar addr .
The new address cannot be less than the old one.
THis directive cannot be used to move the address backwards:
.Ar addr
must be greater than or equal to the current address.
.Pp
.Ql Ic FLOATING
causes all sections between it and the next
Expand All @@ -116,17 +118,18 @@ If
is omitted, it is implied to be 0.
For example, if the
.Dq current address
is $007,
is $0007,
.Ql ALIGN 8
would set it to $100, and
would set it to $0100, and
.Ql ALIGN 8 , 10
would set it to $00A.
would set it to $000A.
.Pp
.Ql Ic DS Ar size
increases the
.Dq current address
by
.Ar size .
The gap is not allocated, thus smaller floating sections can later be placed there.
.El
.Ss Section placement
A section can be placed simply by naming it (with a string).
Expand Down
4 changes: 2 additions & 2 deletions src/link/script.y
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ static void alignTo(uint32_t alignment, uint32_t alignOfs) {
static void pad(uint32_t length) {
auto const &context = lexerStack.back();
if (activeType == SECTTYPE_INVALID) {
scriptError(context, "Cannot pad: no memory region is active");
scriptError(context, "Cannot increase the current address: no memory region is active");
return;
}

Expand All @@ -484,7 +484,7 @@ static void pad(uint32_t length) {

assert(pc >= typeInfo.startAddr);
if (uint16_t offset = pc - typeInfo.startAddr; length + offset > typeInfo.size) {
scriptError(context, "Cannot pad by %u bytes: only %u bytes to $%04" PRIx16,
scriptError(context, "Cannot increase the current address by %u bytes: only %u bytes to $%04" PRIx16,
length, typeInfo.size - offset, (uint16_t)(endaddr(activeType) + 1));
} else {
pc += length;
Expand Down

0 comments on commit 2efaafa

Please sign in to comment.