Skip to content

Commit

Permalink
Merge branch 'master' into linkerscript-plus
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Dec 22, 2023
2 parents a32ee7e + d5cddb2 commit 4075438
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 75 deletions.
13 changes: 9 additions & 4 deletions man/gbz80.7
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" SPDX-License-Identifier: MIT
.\"
.Dd March 28, 2021
.Dd December 22, 2023
.Dt GBZ80 7
.Os
.Sh NAME
Expand Down Expand Up @@ -1947,10 +1947,15 @@ Flags: See
.Sx XOR A,r8
.Sh SEE ALSO
.Xr rgbasm 1 ,
.Xr rgblink 1 ,
.Xr rgbfix 1 ,
.Xr rgbgfx 1 ,
.Xr rgbds 7
.Sh HISTORY
.Nm rgbds
was originally written by Carsten S\(/orensen as part of the ASMotor package,
and was later packaged in RGBDS by Justin Lloyd.
.Xr rgbasm 1
was originally written by
.An Carsten S\(/orensen
as part of the ASMotor package, and was later repackaged in RGBDS by
.An Justin Lloyd .
It is now maintained by a number of contributors at
.Lk https://github.com/gbdev/rgbds .
12 changes: 8 additions & 4 deletions man/rgbasm.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" SPDX-License-Identifier: MIT
.\"
.Dd March 28, 2021
.Dd December 22, 2023
.Dt RGBASM 1
.Os
.Sh NAME
Expand Down Expand Up @@ -352,14 +352,18 @@ and then
Please report bugs on
.Lk https://github.com/gbdev/rgbds/issues GitHub .
.Sh SEE ALSO
.Xr rgbfix 1 ,
.Xr rgblink 1 ,
.Xr rgbasm 5 ,
.Xr rgblink 1 ,
.Xr rgbfix 1 ,
.Xr rgbgfx 1 ,
.Xr gbz80 7 ,
.Xr rgbds 5 ,
.Xr rgbds 7
.Sh HISTORY
.Nm
was originally written by Carsten S\(/orensen as part of the ASMotor package, and was later packaged in RGBDS by Justin Lloyd.
was originally written by
.An Carsten S\(/orensen
as part of the ASMotor package, and was later repackaged in RGBDS by
.An Justin Lloyd .
It is now maintained by a number of contributors at
.Lk https://github.com/gbdev/rgbds .
14 changes: 9 additions & 5 deletions man/rgbasm.5
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.\"
.\" SPDX-License-Identifier: MIT
.\"
.Dd March 28, 2021
.Dd December 22, 2023
.Dt RGBASM 5
.Os
.Sh NAME
Expand Down Expand Up @@ -2171,15 +2171,19 @@ Note that
is a shorthand for
.Ic ALIGN Ns Bq Ar align , No 0 .
.Sh SEE ALSO
.Xr gbz80 7 ,
.Xr rgbasm 1 ,
.Xr rgblink 1 ,
.Xr rgblink 5 ,
.Xr rgbfix 1 ,
.Xr rgbgfx 1 ,
.Xr gbz80 7 ,
.Xr rgbds 5 ,
.Xr rgbds 7
.Sh HISTORY
.Nm
was originally written by Carsten S\(/orensen as part of the ASMotor package,
and was later packaged in RGBDS by Justin Lloyd.
.Xr rgbasm 1
was originally written by
.An Carsten S\(/orensen
as part of the ASMotor package, and was later repackaged in RGBDS by
.An Justin Lloyd .
It is now maintained by a number of contributors at
.Lk https://github.com/gbdev/rgbds .
20 changes: 14 additions & 6 deletions man/rgbds.5
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" SPDX-License-Identifier: MIT
.\"
.Dd March 28, 2021
.Dd December 22, 2023
.Dt RGBDS 5
.Os
.Sh NAME
Expand Down Expand Up @@ -397,12 +397,20 @@ ID.
.El
.Sh SEE ALSO
.Xr rgbasm 1 ,
.Xr rgbasm 5 ,
.Xr rgblink 1 ,
.Xr rgbds 7 ,
.Xr gbz80 7
.Xr rgblink 5 ,
.Xr rgbfix 1 ,
.Xr rgbgfx 1 ,
.Xr gbz80 7 ,
.Xr rgbds 7
.Sh HISTORY
.Nm
was originally written by Carsten S\(/orensen as part of the ASMotor package,
and was later packaged in RGBDS by Justin Lloyd.
.Xr rgbasm 1
and
.Xr rgblink 1
were originally written by
.An Carsten S\(/orensen
as part of the ASMotor package, and was later repackaged in RGBDS by
.An Justin Lloyd .
It is now maintained by a number of contributors at
.Lk https://github.com/gbdev/rgbds .
71 changes: 46 additions & 25 deletions man/rgbds.7
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" SPDX-License-Identifier: MIT
.\"
.Dd March 28, 2021
.Dd December 22, 2023
.Dt RGBDS 7
.Os
.Sh NAME
Expand All @@ -9,44 +9,65 @@
.Sh EXAMPLES
To get a working ROM image from a single assembly source file:
.Bd -literal -offset indent
$ rgbasm \-o bar.o foo.asm
$ rgblink \-o baz.gb bar.o
$ rgbfix \-v \-p 0 baz.gb
$ rgbasm \-o game.o game.asm
$ rgblink \-o game.gb game.o
$ rgbfix \-v \-p 0 game.gb
.Ed
Or in a single command line:
.Pp
Or in a single command line, without creating an intermediate object file:
.Bd -literal -offset indent
$ rgbasm \-o - foo.asm | rgblink \-o - - | rgbfix \-v \-p 0 - > baz.gb
$ (rgbasm -o - - | rgblink -o - - | rgbfix -v -p 0) < game.asm > game.gb
.Ed
.Sh SEE ALSO
.Xr rgbasm 1 ,
.Xr rgbfix 1 ,
.Xr rgbasm 5 ,
.Xr rgblink 1 ,
.Xr rgbds 5 ,
.Xr gbz80 7
.Xr rgblink 5 ,
.Xr rgbfix 1 ,
.Xr rgbgfx 1 ,
.Xr gbz80 7 ,
.Xr rgbds 5
.Sh HISTORY
.Bl -item
.It
1997, Carsten S\(/orensen (AKA SurfSmurf) writes ASMotor as a general-purpose
assembler/linker system for DOS/Win32.
1996-10-01:
.An Carsten S\(/orensen
.Pq a.k.a. SurfSmurf
releases xAsm, xLink, and RGBFix, a Game Boy SM83 (GBZ80) assembler/linker system for DOS/Win32.
.It
1997-07-03: S\(/orensen releases ASMotor, packaging the three programs together and moving towards making them a general-purpose target-independent system.
.It
1999-08-01:
.An Justin Lloyd
.Pq a.k.a. Otaku no Zoku
adapts ASMotor to re-focus on SM83 assembly/machine code, and releases this version as RGBDS.
.It
2009-06-11:
.An Vegard Nossum
adapts the code to be more UNIX-like and releases this version as rgbds-linux.
.It
2010-01-12:
.An Anthony J. Bentley
forks Nossum's repository.
The fork becomes the reference implementation of RGBDS.
.It
1999, Justin Lloyd (AKA Otaku no Zoku) adapts ASMotor to read and produce GBZ80
assembly/machine code, and releases this version as RGBDS.
2015-01-18:
.An stag019
begins implementing rgbgfx, a PNG‐to‐Game Boy graphics converter, for eventual integration into RGBDS.
.It
2009, Vegard Nossum adapts the code to be more UNIX-like and releases this
version as rgbds-linux on GitHub.
2016-09-05: rgbgfx is integrated into Bentley's repository.
.It
2010, Anthony J. Bentley forks that repository.
The fork becomes the reference implementation of rgbds.
2017-02-23: Bentley's repository is moved to the
.Lk https://github.com/rednex/rgbds rednex
organization.
.It
2017, Bentley's repository is moved to a neutral name.
It is now maintained by a number of contributors at
.Lk https://github.com/rednex/rgbds .
2018-01-26: The codebase is relicensed under the MIT license.
.It
2018, codebase relicensed under the MIT license.
2020-09-15: The repository is moved to the
.Lk https://github.com/gbdev/rgbds gbdev
organization.
.It
2020, repository is moved to the gbdev organisation, at
.Lk https://github.com/gbdev/rgbds .
The
2022-05-17: The
.Lk https://rgbds.gbdev.io
website serving documentation and downloads is created.
website for RGBDS documentation and downloads is published.
.El
9 changes: 7 additions & 2 deletions man/rgbfix.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" SPDX-License-Identifier: MIT
.\"
.Dd March 28, 2021
.Dd December 22, 2023
.Dt RGBFIX 1
.Os
.Sh NAME
Expand Down Expand Up @@ -236,9 +236,14 @@ Please report bugs on
.Sh SEE ALSO
.Xr rgbasm 1 ,
.Xr rgblink 1 ,
.Xr rgbgfx 1 ,
.Xr gbz80 7 ,
.Xr rgbds 7
.Sh HISTORY
.Nm
was originally released by Carsten S\(/orensen as a standalone program called gbfix, and was later packaged in RGBDS by Justin Lloyd.
was originally written by
.An Carsten S\(/orensen
as a standalone program called GBFix, which was then packaged in ASMotor, and was later repackaged in RGBDS by
.An Justin Lloyd .
It is now maintained by a number of contributors at
.Lk https://github.com/gbdev/rgbds .
7 changes: 2 additions & 5 deletions man/rgbgfx.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.\"
.\" SPDX-License-Identifier: MIT
.\"
.Dd March 28, 2021
.Dd December 22, 2023
.Dt RGBGFX 1
.Os
.Sh NAME
Expand Down Expand Up @@ -653,17 +653,14 @@ Bug reports and feature requests about RGBDS are also welcome!
.Xr rgbasm 1 ,
.Xr rgblink 1 ,
.Xr rgbfix 1 ,
.Xr gbz80 7 ,
.Xr rgbds 7
.Pp
The Game Boy hardware reference
.Lk https://gbdev.io/pandocs/Graphics Pan Docs ,
particularly the section about graphics.
.Sh HISTORY
.Nm
was originally created by
.An stag019
to be included in RGBDS.
was originally written by stag019 as a program to be packaged in RGBDS.
It was later rewritten by
.An ISSOtm ,
and is now maintained by a number of contributors at
Expand Down
9 changes: 7 additions & 2 deletions man/rgblink.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" SPDX-License-Identifier: MIT
.\"
.Dd March 28, 2021
.Dd December 22, 2023
.Dt RGBLINK 1
.Os
.Sh NAME
Expand Down Expand Up @@ -204,10 +204,15 @@ Please report bugs on
.Xr rgbasm 1 ,
.Xr rgblink 5 ,
.Xr rgbfix 1 ,
.Xr rgbgfx 1 ,
.Xr gbz80 7 ,
.Xr rgbds 5 ,
.Xr rgbds 7
.Sh HISTORY
.Nm
was originally written by Carsten S\(/orensen as part of the ASMotor package, and was later packaged in RGBDS by Justin Lloyd.
was originally written by
.An Carsten S\(/orensen
as part of the ASMotor package, and was later repackaged in RGBDS by
.An Justin Lloyd .
It is now maintained by a number of contributors at
.Lk https://github.com/gbdev/rgbds .
12 changes: 8 additions & 4 deletions man/rgblink.5
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,18 @@ WRAMX 2 ; start another bank
.Ed
.Sh SEE ALSO
.Xr rgbasm 1 ,
.Xr rgbasm 5 ,
.Xr rgblink 1 ,
.Xr rgbfix 1 ,
.Xr rgbasm 5 ,
.Xr rgbgfx 1 ,
.Xr gbz80 7 ,
.Xr rgbds 5 ,
.Xr rgbds 7
.Sh HISTORY
.Nm
was originally written by Carsten S\(/orensen as part of the ASMotor package,
and was later packaged in RGBDS by Justin Lloyd.
.Xr rgblink 1
was originally written by
.An Carsten S\(/orensen
as part of the ASMotor package, and was later repackaged in RGBDS by
.An Justin Lloyd .
It is now maintained by a number of contributors at
.Lk https://github.com/gbdev/rgbds .
17 changes: 8 additions & 9 deletions src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,33 @@

static void vwarn(char const NONNULL(fmt), va_list ap)
{
const char *error = strerror(errno);

fprintf(stderr, "warning: ");
vfprintf(stderr, fmt, ap);
fputs(": ", stderr);
perror(NULL);
fprintf(stderr, ": %s\n", error);
}

static void vwarnx(char const NONNULL(fmt), va_list ap)
{
fprintf(stderr, "warning");
fputs(": ", stderr);
fprintf(stderr, "warning: ");
vfprintf(stderr, fmt, ap);
putc('\n', stderr);
}

[[noreturn]] static void verr(char const NONNULL(fmt), va_list ap)
{
const char *error = strerror(errno);

fprintf(stderr, "error: ");
vfprintf(stderr, fmt, ap);
fputs(": ", stderr);
fputs(strerror(errno), stderr);
putc('\n', stderr);
fprintf(stderr, ": %s\n", error);
exit(1);
}

[[noreturn]] static void verrx(char const NONNULL(fmt), va_list ap)
{
fprintf(stderr, "error");
fputs(": ", stderr);
fprintf(stderr, "error: ");
vfprintf(stderr, fmt, ap);
putc('\n', stderr);
exit(1);
Expand Down
15 changes: 6 additions & 9 deletions src/link/assign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,22 +297,19 @@ static void placeSection(struct Section *section)

if (section->isBankFixed && nbbanks(section->type) != 1) {
if (section->isAddressFixed)
snprintf(where, 64, "at $%02" PRIx32 ":%04" PRIx16,
snprintf(where, sizeof(where), "at $%02" PRIx32 ":%04" PRIx16,
section->bank, section->org);
else if (section->isAlignFixed)
snprintf(where, 64, "in bank $%02" PRIx32 " with align mask %" PRIx16,
snprintf(where, sizeof(where), "in bank $%02" PRIx32 " with align mask %" PRIx16,
section->bank, (uint16_t)~section->alignMask);
else
snprintf(where, 64, "in bank $%02" PRIx32,
section->bank);
snprintf(where, sizeof(where), "in bank $%02" PRIx32, section->bank);
} else {
if (section->isAddressFixed)
snprintf(where, 64, "at address $%04" PRIx16,
section->org);
snprintf(where, sizeof(where), "at address $%04" PRIx16, section->org);
else if (section->isAlignFixed)
snprintf(where, 64, "with align mask %" PRIx16 " and offset %" PRIx16,
(uint16_t)~section->alignMask,
section->alignOfs);
snprintf(where, sizeof(where), "with align mask %" PRIx16 " and offset %" PRIx16,
(uint16_t)~section->alignMask, section->alignOfs);
else
strcpy(where, "anywhere");
}
Expand Down

0 comments on commit 4075438

Please sign in to comment.