Skip to content

Commit

Permalink
xga99: add strict syntax (-s), Ryte Data symbols (-R)
Browse files Browse the repository at this point in the history
  • Loading branch information
endlos99 committed Apr 3, 2024
1 parent 6c14d55 commit a77bd31
Show file tree
Hide file tree
Showing 15 changed files with 3,828 additions and 51 deletions.
22 changes: 22 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
Changes Version 3.6.5
=====================

xga99 GPL Cross-Assembler
-------------------------

The native `xga99` syntax style is more modern in that it supports lower case
sources, extended expressions, relaxed labels, local labels, and relaxed use of
whitespace.

To assemble legacy sources written for the Ryte Data or RAG assemblers, we need
to provide the _strict syntax option_ `-s`, which also disables various `xga99`
extensions. To add the predefined symbols provided by the Ryte Data assembler,
we can use the _Ryte Data symbols_ option `-R`.

In contrast, the _relaxed syntax mode_ `-r` enables the least
restrictive syntax, where whitespace can be used freely, but comments must be
introduced by `;`.

The `xga99` preprocessor is identical to the `xas99` one.


Changes Version 3.6.1
=====================

Expand Down
26 changes: 18 additions & 8 deletions doc/MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ this manual.
Tutorial <a name="tutorial"></a>
--------

The xdt99 tools are command line tools that lack a graphical user interface.
The xdt99 tools are command line tolls that lack a graphical user interface.
While this choice will somewhat steepen the learning curve for some users, the
command line is ultimately very suited for repetitive tasks, as encountered
while developing programs.
Expand Down Expand Up @@ -2547,23 +2547,33 @@ manual.

As the Graphics Programming Language was never intended for public release,
existing tools for assembling GPL source code differ substantially in the syntax
they use. `xga99` adopts a combination of the Ryte Data and the RAG GPL
Assemblers' syntax as its native format.
they use. `xga99` supports both the Ryte Data and the RAG assemblers' syntax as
its native format.

We can choose other syntax styles, however, with the _syntax option_ `-y`.
Currently, the only extra syntax is the syntax of the TI Image Tool
disassembler, available with name `mizapf` (named after the creator of the image
Currently, the only other syntax supported is the syntax of the TI Image Tool
disassembler, available with `mizapf` (named after the creator of the image
tool).

$ xga99.py gahello_timt.gpl -y mizapf

Note that the original GPL syntax described in TI's _GPL Programmer's Guide_ is
considered too arcane to be included in `xga99`.

The native `xga99` syntax style is more "modern" in that it supports lower case
The native `xga99` syntax style is more modern in that it supports lower case
sources, extended expressions, relaxed labels, local labels, and relaxed use of
whitespace, including the relaxed syntax mode, similar to `xas99`. Both
cross-assemblers also share the same preprocessor.
whitespace.

To assemble legacy sources written for the Ryte Data or RAG assemblers, we need
to provide the _strict syntax option_ `-s`, which also disables various `xga99`
extensions. To add the predefined symbols provided by the Ryte Data assembler,
we can use the _Ryte Data symbols_ option `-R`.

In contrast, the _relaxed syntax mode_ `-r` enables the least
restrictive syntax, where whitespace can be used freely, but comments must be
introduced by `;`.

The `xga99` preprocessor is identical to the `xas99` one.

As for `xas99`, warnings and errors are _colored_ by default, which may be
controlled with the `--color` option. Frequently used options can be stored in
Expand Down
9 changes: 9 additions & 0 deletions test/as-checkerr.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,15 @@ def runtest():
with open(Files.error, 'w') as ferr:
xas(source, '-o', Files.output, stderr=ferr, rc=1)

# parser error
source = os.path.join(Dirs.sources, 'aserrpar.asm')
with open(Files.error, 'w') as ferr:
xas(source, '-R', '-o', Files.output, stderr=ferr, rc=1)
errs = content_line_array(Files.error)[1:-1:2]
lines = set(e[22] for e in errs)
if lines != set(str(i) for i in range(1, 9)):
error('parser', f'Missing error message: {lines}')

# cleanup
delfile(Dirs.tmp)

Expand Down
9 changes: 9 additions & 0 deletions test/asm/aserrpar.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
mov r0,@2(r1
mov @0(r1,r0
mov r0,@2(r1))
mov @(r1,@2)
mov r0,@r2)
mov @2(r1,r2)
mov r1,r2(r3)
mov @(r2),r0 ;WARN
end
5 changes: 5 additions & 0 deletions test/ga-checkcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ def runtest():
data[0x4001] != 0x2e):
error('cart', 'Incorrect cart with GPL header')

# strict syntax, should not throw errors
source = os.path.join(Dirs.gplsources, 'srxb6.gpl')
with open(Files.error, 'w') as ferr:
xga(source, '-s', '-R', '-o', Files.output, stderr=ferr, rc=0)

# cleanup
delfile(Dirs.tmp)

Expand Down
4 changes: 2 additions & 2 deletions test/ga-checkext.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def runtest():
source = os.path.join(Dirs.gplsources, 'gauusym.gpl')
with open(Files.error, 'w') as ferr:
xga(source, '--color', 'off', '-o', Files.output, stderr=ferr, rc=0)
expected = """> gauusym.gpl <-> **** -
expected = """> gauusym.gpl <*> **** -
***** Warning: Unused constants: s1:5
> gauusymi.gpl <-> **** -
> gauusymi.gpl <*> **** -
***** Warning: Unused constants: si:1
"""
if content_lines(Files.error, skip=1) != expected:
Expand Down
Loading

0 comments on commit a77bd31

Please sign in to comment.