Commit Graph

84 Commits

Author SHA1 Message Date
phoebos a014cd8da9 (uxnasm) only ignore [ or ] if it is a whole token
Currently, tokens beginning with a [ or ] character are completely
ignored, which forbids a macro from beginning with these characters.
Specifically, a macro can be declared eg. as `%[x { ... }` but cannot be
dereferenced as `[x`.
This patch only ignores these tokens if they have a length of 1;
otherwise the switch falls through to the default case.
2022-06-05 16:29:06 -07:00
Devine Lu Linvega 17fd40af43 (uxnasm) Minor cleanup 2022-05-31 14:04:54 -07:00
Devine Lu Linvega 18b73f4861 (uxnasm)Optimize tail-call for subroutines too 2022-05-31 13:55:00 -07:00
Devine Lu Linvega 3c06af41c3 Tiny change to uxnasm 2022-05-31 13:38:21 -07:00
Devine Lu Linvega 5a0e0c56aa Added tail-call optimization 2022-05-26 20:26:21 -07:00
Andrew Alderwick e00e74b9d0 (uxnasm) Raise an error if the output rom would be empty. 2022-05-09 21:13:28 +01:00
Andrew Alderwick d5253086b5 Move stack opcodes. 2022-04-18 09:45:33 +01:00
Andrew Alderwick c2ffe63cc3 (uxnasm) Fix valid macro names being rejected.
Macro names that begin with the name of an opcode were being rejected
incorrectly. “STA” would not be a valid macro name since it is an
opcode, but “STACK” should be fine.
2022-04-14 18:24:48 +01:00
neauoire d49981c4ce Removed runes 2022-04-11 17:27:33 -07:00
neauoire a3c42c23b9 Fixed issue with oprunes 2022-04-11 17:16:05 -07:00
neauoire dcc37fd0d5 Added logic/arithmetic symbols to uxnasm 2022-04-11 16:07:15 -07:00
neauoire 60315ff3dc Raised label limit in uxnasm 2022-04-11 15:34:53 -07:00
Andrew Alderwick 0c819b9f59 clang-format 2022-02-19 01:02:47 +00:00
Andrew Alderwick 550aceee23 (uxnasm) Allow writing the 0xffff byte of RAM. 2022-02-19 00:29:40 +00:00
Andrew Alderwick 8b84813c6e (uxnasm) Raise error when memory is overwritten. 2022-02-19 00:27:28 +00:00
Andrew Alderwick da4f0e70a5 (uxnasm) Allow returning errors from writebyte(). 2022-02-19 00:26:55 +00:00
Andrew Alderwick 0ae6992089 (uxnasm) Fix calculation of usage. 2022-02-18 23:02:42 +00:00
Andrew Alderwick 2a825de2fd Switch void context increments from pre to post 2022-01-04 02:05:32 +00:00
Sigrid Solveig Haflínudóttir 148dae4ebd fix a few "set and not used" warnings 2021-12-29 18:33:23 +01:00
neauoire 385fa44f9d Prefixed globals with uxn_ 2021-12-29 09:11:03 -08:00
~d6 abd6a3a5da Support nested comments in uxnasm.
Previously, code like this would fail with an error
about an unrecognized ) token:

    ( this is a ( nested ) comment )

With this patch, the above code will now work.

Relatedly, it was previously possible to write code
that compiled but was confusing:

    (open parenthesis should have a space )
    ( in this case the ADD2 will be ignored )ADD2
    ( this comment with ( would have been fine )

With this commit, the first example will emit a warning
but continue to work as intended. The second and third
examples will continue searching for a matching ) token,
which due to the new nested coment behavior will probably
mean the rest of the file gets commented out.
2021-12-28 19:28:15 -08:00
Andrew Alderwick 2330320985 (readability) Use preincrements throughout in void context. 2021-12-14 23:17:32 +00:00
neauoire bae2d37fc2 (uxnasm) Only catch hex labels with slen of 2 or 4 2021-12-06 09:01:48 -08:00
Andrew Alderwick 60f04ca053 (uxnasm) Add error for relative references that are too far. 2021-12-01 11:42:44 +00:00
neauoire da797b33c6 (uxnasm) Stop on resolve failure 2021-11-30 10:27:35 -08:00
neauoire 074a049ff2 (uxnasm) Renamed conflicting function 2021-11-29 16:19:47 -08:00
neauoire 25df420607 (uxnasm) Improved errors 2021-11-29 08:48:12 -08:00
Andrew Alderwick 6ba2af5c62 Avoid combining literals across | or $ pads. 2021-11-28 18:07:22 +00:00
neauoire 6c0e39ad6f (uxnasm) Fixed issue with labels 2021-11-27 14:58:37 -08:00
neauoire b4e50165b6 (uxnasm) Warn for refs size limit 2021-11-27 14:44:28 -08:00
neauoire 78853ac5c6 (uxnasm) Removed lit flag for writebyte 2021-11-27 14:20:56 -08:00
neauoire fbbddf50d6 (uxnasm) Cleanup 2021-11-27 14:07:25 -08:00
neauoire 4b6efa6fc6 (uxnasm) Combine byte literals 2021-11-27 13:55:33 -08:00
neauoire 71e8177657 (uxnasm) Rewrite 2021-11-27 11:33:22 -08:00
neauoire b873f04789 Added tal syntax highlight for nano 2021-11-26 08:11:18 -08:00
Devine Lu Linvega 088897c6b4 (uxnasm) Display exact numberof bytes 2021-11-24 17:12:01 -05:00
Andrew Alderwick d4e033e715 Remove vestigial mention of "include". 2021-11-18 00:14:15 +00:00
Andrew Alderwick c3ac41c41d Change "include" word into ~ rune for includes. 2021-11-17 22:06:00 +00:00
Sigrid Solveig Haflínudóttir 4988b2214e
uxnasm: reset scope to avoid pointing at garbage 2021-11-08 18:51:28 +01:00
Andrew Alderwick 80b4e4f88d Use Keep mode for all LIT opcodes 2021-10-30 00:28:33 +01:00
Devine Lu Linvega 6f872feff5 Use Keep modes for byte and short literals 2021-10-29 16:02:07 -07:00
Devine Lu Linvega 8132a09e21 Test for valid destination in uxnasm 2021-10-29 09:29:23 -07:00
Claude Heiland-Allen 33e77e261c uxnasm errors-out if too many macros 2021-10-26 09:55:57 -07:00
Claude Heiland-Allen a373939544 uxnasm errors-out if too many labels 2021-10-26 09:54:29 -07:00
neauoire 5582816943 Removed unecessary error 2021-10-24 09:09:58 -07:00
Andrew Alderwick 5807e22fef Fixed corruption in ff00-ffff, improved checks for | and $, thanks karolbelina! 2021-10-23 23:15:07 +01:00
neauoire 6799b5f78e Warn for out of bounds 2021-10-23 08:48:11 -07:00
neauoire 04e4edf05f Fixed an issue with the ref counter in uxnasm 2021-10-17 19:10:29 -07:00
neauoire d6ef361383 Corrected raw short length 2021-10-11 13:35:01 -07:00
neauoire 037ab10b6a Fixed issue with raw bytes in macros 2021-10-11 13:27:20 -07:00