Commit Graph

411 Commits

Author SHA1 Message Date
AntonioND
fa962b9470 Merge pull request #139 from chastai/escape-cb
Allow { and } to be escaped in string literals
2017-03-18 23:54:59 +00:00
Christophe Staïesse
b8642bf3af Allow { and } to be escaped in string literals
As stated in the documentation but that was not actually implemented.
2017-03-18 16:23:41 +01:00
AntonioND
317b206fa8 Improve map file output
Print the name of each section along with the size, base and end
addresses. If a section is empty, don't print the end address, as it
can overflow if the base address is 0.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-03-15 23:52:56 +00:00
AntonioND
469e3e7c86 Merge branch 'contiguous-wram' of git://github.com/TwitchPlaysPokemon/rgbds into TwitchPlaysPokemon-contiguous-wram 2017-03-15 21:00:06 +00:00
AntonioND
9193710ff9 Merge pull request #131 from Sanqui/overlay
Add overlay to rgblink
2017-03-15 20:42:32 +00:00
Sanqui
263c9222ab Require all sections to be fixed when using overlay 2017-03-13 17:08:27 +01:00
AntonioND
947d767c64 Merge pull request #135 from Ben10do/improve-assign-error-messages
Improve assignment error messages
2017-03-12 17:06:54 +00:00
AntonioND
82cf3eb48f Merge pull request #134 from Ben10do/oam-sections
Add support for OAM Sections
2017-03-11 12:18:40 +00:00
Ben10do
a75c15ec46 Improve assignment error messages
Make the error messages in assign.c more descriptive, including the name of the section that caused the error, and its alignment.
2017-03-10 23:21:59 +00:00
Ben10do
3dcfe2b9f6 Add support for OAM Sections
Allows sections (and labels within) to be defined that correspond to the Game Boy’s Object Attributes Memory.
2017-03-10 22:18:14 +00:00
Ben10do
523b7538f0 Replace magic numbers with BANK_COUNT_* constants
Previously, some instances of the number of banks for each section remained hardcoded. These have been replaced with BANK_COUNT_* constants.

As a side-effect, this could fix a theoretical bug when using BANK(label) when the label is in a high SRAM bank (≥ 4).
2017-03-10 19:24:54 +00:00
Sanqui
bc2f885d29 Also require ROM0 sections to be fixed when using overlay 2017-03-02 23:02:56 +01:00
Sanqui
bd00b9ab59 Merge branch 'master' of github.com:rednex/rgbds into overlay 2017-03-02 22:46:19 +01:00
AntonioND
4f86a12539 Merge pull request #125 from Ben10do/section-alignment
Implement byte alignment for data
2017-03-02 09:17:46 +00:00
Ben
7e2457c9be Re-allow alignment of 0 bits 2017-03-02 08:29:28 +00:00
Ben10do
7993d3455d Update alignment error handling
Ensure (in rgbasm) that the alignment value is between 1-16. Replaces the previous “alignment must not be negative” check.
2017-03-02 08:02:05 +00:00
Sanqui
c9daf80f11 Merge github.com:rednex/rgbds into overlay 2017-02-28 18:58:58 +01:00
Sanqui
5a7faa7dff Add overlay to rgblink manpage 2017-02-28 18:48:09 +01:00
AntonioND
7b8d4de35c Merge pull request #16 from yenatch/eval-rpn-bank
rgbasm: Evaluate BANK() arguments to verify they exist.
v0.2.5
2017-02-27 21:21:45 +00:00
AntonioND
c7fe281c86 Merge pull request #114 from Ben10do/fix-asm-tests
Fix issues in rgbasm raised by the tests
2017-02-27 21:09:04 +00:00
AntonioND
fa8f25a4de Merge pull request #123 from Ben10do/deduplicate-e-doc
Remove duplicate documentation of -E
2017-02-27 20:35:13 +00:00
AntonioND
7c2cae7a32 Merge pull request #127 from rogersachan/patch-1
Convert README to markdown
2017-02-26 22:28:10 +00:00
AntonioND
92b81b1d5a Merge pull request #79 from yenatch/longer-charmap
Increase the length of charmaps.
2017-02-26 22:04:26 +00:00
AntonioND
42b5be24b4 Merge pull request #120 from TwitchPlaysPokemon/extra-sram
16-bank SRAM
2017-02-26 21:53:57 +00:00
AntonioND
14fea5f659 Merge pull request #119 from Ben10do/add-end-checks
Verify that IFs, REPTs and MACROs are terminated
2017-02-26 21:49:22 +00:00
AntonioND
1e16a0ff85 Merge pull request #121 from TwitchPlaysPokemon/master
Fix WRAM0 symbols returning bank 512 to BANK() expression in linker
2017-02-26 21:45:53 +00:00
Roger
7adf1dd502 Convert README to markdown 2017-02-25 16:15:05 -05:00
Anthony J. Bentley
0588e42520 Link to HTML documentation from the manpage. 2017-02-23 21:09:32 -07:00
Anthony J. Bentley
2eb748278b Move HTML docs to a different repo. 2017-02-23 21:07:11 -07:00
Ben10do
1ab93a194e Implement ALIGN keyword in rgbasm
The ALIGN keyword specifies the number of bits that should be zero at the start of a section. It works in a simliar fashion to BANK.
2017-02-23 15:00:57 +00:00
Ben10do
1b05c43b97 Implement byte alignment in section assingment
Yay, more refactoring of the section assignment… This version of the linker will allocate sections by their alignment, and then by their size (largest first, in both cases).

In future, this may be improved by using dense packing (as suggested by #83).
2017-02-19 22:43:45 +00:00
Ben10do
e4cbf773f6 Add alignment of sections to objects
Aligned sections can now be created with out_NewAlignedSection(). This information is stored in created object files, and read by the linker.

The names of each section are also included in the object file, enabling potential improvements to error messages in the future.
2017-02-19 22:35:32 +00:00
Ben10do
b07c04cd74 Implement a malloc-based readasciiz()
Instead of reading into a pre-sized buffer, this function now uses malloc to create a buffer, and resizes it if necessary.

This reduces the risk of memory issues if a long string (< 255 chars) was encountered.
2017-02-19 22:20:21 +00:00
Ben10do
9be7c4c849 Remove duplicate documentation of -E
Remove Sanqui’s documentation of the -E argument to rgbasm, in favour of bentley’s better-worded one.
2017-02-07 11:05:35 +00:00
scnorton
6d1c60b0a6 Contiguous WRAM 2017-02-06 16:31:57 -05:00
PikalaxALT
c485ad94f2 Fix WRAM0 symbols returning bank 512 to BANK() expression in linker 2017-02-06 08:38:07 -05:00
PikalaxALT
998cfe1bdd 16-bank SRAM 2017-02-06 08:27:32 -05:00
Anthony J. Bentley
5ee058f217 Merge branch 'linker-refactor-assign' of https://github.com/Ben10do/rgbds 2017-02-05 23:24:13 -07:00
Ben10do
38372c59ed Verify that IFs, REPTs and MACROs are terminated
Ensure that IF constructs, REPT blocks, and MACRO defintions are terminated with ENDC, ENDR, or ENDM respectively. If they are not, print an error and stop assembly.

As well as aiding a forgetful programmer, this reduces the risk of memory problems if the file ends less than four bytes after the block starts.
2017-02-02 16:27:53 +00:00
Ben10do
420ea638a7 Refactor section assignment in linker
Deduplicates and generalises a lot of code in assign.c:

- Replace area_AllocAbs*AnyBank() with area_AllocAbsAnyBank() function
that accepts a section type parameter
- Replace area_Alloc*AnyBank() with area_AllocAnyBank()
- Replace FindLargest*() with FindLargestSection()
- Replace Assign*Sections() with AssignBankedSections()
- Add VerifyAndSetBank(), which enables bank checks (and addition with
BANK_*) to be centralised
- Refactor the initialisation of AssignSections(), removing some magic
numbers and only setting MaxAvail[i] once
- Overhaul the duplicated cases throughout AssignSections()
2017-01-27 08:56:36 +00:00
Ben10do
951c9b66f4 Don't segfault on null bytes in REPTs and MACROs
Previously, the copyrept() and copymacro() functions would halt their
first loop (in which they determine the length of the block)
prematurely,  causing an underflow when setting len, eventually causing
memory issues.

Whilst this doesn’t solve the len underflow entirely (e.g. if the file
ends immediately without an ENDR/ENDM), it should help with this exact
scenario of null bytes (as #50).
2017-01-26 22:01:03 +00:00
Ben10do
0a66e14307 Fix division by zero crashes in instructions
Previously, rgbasm could crash with a floating point exception if an
instruction includes a division or modulo by 0. Fixes #49.
2017-01-26 21:32:06 +00:00
Ben10do
b40c567aee Add ldi a, [hl] and ldd a, [hl] instructions
These are equivalent to ld a, [hl+] and ld a, [hl-] respectively.
2017-01-26 16:55:00 +00:00
Anthony J. Bentley
547abfefc1 Merge branch 'fatal-error-noreturn' of https://github.com/Ben10do/rgbds 2017-01-25 00:47:25 -07:00
Ben10do
06f0472f81 Emit a single error when using BANK incorrectly
Previously, if BANK is used when defining a section that’s not ROMX,
WRMAX, SRAM or VRAM, a second error message would appear, e.g. “(null)
bank value $1 out of range $5d to $0”.

This would appear due to the usage of uninitialised variables. This
change ensures that the uninitialised variables are not accessed when
using an invalid section.

This also silences compiler warnings about usage of uninitialised
variables.
2017-01-24 11:50:18 +00:00
Ben10do
defd4f589e Add noreturn attribute to fatalerror()
Should silence compiler warnings that expect fatalerror() to return.
2017-01-24 11:38:26 +00:00
Anthony J. Bentley
dc4a98048d Simplify string copy by using strlcpy(). 2017-01-24 01:26:55 -07:00
Anthony J. Bentley
efaa6d9ff7 Add .gitignore. 2017-01-24 01:19:16 -07:00
Anthony J. Bentley
ab19dab899 Merge branch 'include-cli' of https://github.com/AntonioND/rgbds 2017-01-24 01:18:28 -07:00
Ben10do
e86a70d2cb Fix the name of the GNUmakefile
GNU make actually looks for ‘GNUmakefile’, not ‘GNUMakefile’.

Consequently, GNU make would erroneously attempt to use the standard
makefile, instead of the GNU-specific one. This would cause an error
when attempting to import png.h, due to PNGFLAGS not being correctly
set.
2017-01-23 23:46:44 +00:00