aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Update the README for open sourcing the projectMiquel Sabaté Solà2024-12-161-1/+1
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Fix the mapping of addresses on labelsMiquel Sabaté Solà2024-12-164-325/+864
| | | | | | | | | | | | | | | | | There was a big missunderstanding on how things were to be laid out in the end file, and so it was needed to create a proper understanding on what's a Mapping and what's a Segment. These turned out to be fundamental concepts that I failed to grok up until this commit. Hence, this commit re-arranges completely how variables and labels are stored in the Context, and how these objects can then be translated into bundles that can be spit out to the caller. This commit, besides introducing the new Mapping struct, also introduced a more general Object, which abstracts things from the Bundle struct, and allows us to pass certain metadata about the bundle at hand. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* parser: Fix crash on non-ASCII char literalsMiquel Sabaté Solà2024-12-131-3/+3
| | | | | | | | | | | | | If the given char literal was not an ASCII one, there was the chance for the character iterator to mess things up. Hence, when checking the closing single quote, it might encounter a None value. This is simply mitigated my moving the check of ASCII alphanumeric before checking for the closing quote. Fixes: b1623996c76f ("Add support for character literals") Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Be more informative on segment overflow errorsMiquel Sabaté Solà2024-12-121-2/+2
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* nasm: Add a parameter for linker configurationMiquel Sabaté Solà2024-12-121-0/+42
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add support for character literalsMiquel Sabaté Solà2024-12-121-2/+76
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Re-work the handling of segments in the assemblerMiquel Sabaté Solà2024-12-125-18/+286
| | | | | | | | There were a lot of assumptions on the assembler that stemmed from a fundamental missunderstanding from my side on how segments are laid out on the final file. This commit is the first step to address this. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add support for anonymous labelsMiquel Sabaté Solà2024-12-124-30/+329
| | | | | | | Allow for anonymous labels to be defined and referenced by using the same syntax as cc65. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Don't rely on the identifier for control identityMiquel Sabaté Solà2024-12-125-81/+156
| | | | | | | | | Instead, use a new enum type to identify the control statements that we actually support. This way the assembler is more easily aware on the control that it's dealing with, and can be more sure on certain aspects of the implementation on control support. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Fix bug on multiple arguments for macrosMiquel Sabaté Solà2024-12-121-5/+69
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Initial support for branchingMiquel Sabaté Solà2024-12-123-7/+114
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Re-work the support on labels, variables and jumpsMiquel Sabaté Solà2024-12-126-90/+283
| | | | | | | | | | | As a way to firstly adapt on the latest changes from the parser since 184c39579227 ("Re-work the parser from scratch"), the assembler had to leave out some features on 16114b2ca358 ("Adapt the assembler to the changes on the parser"). This commit reintroduces support for settings labels, variables and referencing them, while also providing a more robust implementation at that. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Allow for relative jumps at the parser levelMiquel Sabaté Solà2024-12-121-20/+153
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Allow for .byte/.address statementsMiquel Sabaté Solà2024-12-122-30/+143
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Implement the hibyte/lobyte functionsMiquel Sabaté Solà2024-12-121-2/+60
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Adapt the assembler to the changes on the parserMiquel Sabaté Solà2024-12-129-2851/+2160
| | | | | | | | | | | As of 184c39579227 ("Re-work the parser from scratch") the parser has a proper AST, and the assembler has to traverse it accordingly. Moreover, the assembler has been stripped from a lot of unneeded memory allocations and it's overall more keen on using mere references when possible. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* ci: Add fuzzy testing to the parserMiquel Sabaté Solà2024-12-121-2/+0
| | | | Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Re-work the parser from scratchMiquel Sabaté Solà2024-12-127-1622/+3275
| | | | | | | | | | | | | The initial implementation was incredibly naive on how complex an assembler can actually be. Because of this, it never bothered to define and produce a proper AST, and hence it was overall extremely fragile on (not so) corner cases. This commit re-writes everything from scratch for the parser, and it should really be the last fundamental change to the parser other than minor additions/features here and there. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add macros which can take argumentsMiquel Sabaté Solà2024-12-121-1/+46
| | | | | | | Adds to 5b1f387d451b ("Add basic support for macros") the possibility to add parameters to macros. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add basic support for macrosMiquel Sabaté Solà2024-12-123-194/+254
| | | | | | | Macros can now be described with the '.macro' control statement, but no parameters can be given and it's overall pretty brittle. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add support for proceduresMiquel Sabaté Solà2024-12-124-15/+219
| | | | | | | Procedures are marked with the '.proc' control statement and work both as a scoping mechanism and as a label that can be referenced. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add support for branchingMiquel Sabaté Solà2024-12-125-75/+295
| | | | | | | | This is a bare bones implementation of it, and there's a lot of nuance that it's being missed, but at least the fundamentals have been implemented already. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Add the notion of mappingMiquel Sabaté Solà2024-12-125-26/+190
| | | | | | | Mappings and segments are fundamental blocks on how code is distributed both on the actual ROM File and in the memory layout. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
* Initial commitMiquel Sabaté Solà2024-12-126-0/+2720
A lot is missing and there is a long road ahead to make the assembler even work. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>