Jump to content
IGNORED

xdt99: New TI 99 cross-development tools available


ralphb

Recommended Posts

Thanks for all your findings.  I fixed almost all:

  • % char: I forgot to add % to the list of forbidden chars for symbols
  • AORG, X#, and BANK: fixed the grammar
  • Alias registers: I already had numbers, but I forgot labels.  I've added those, but note that checking if numbers or labels are actually of value 0 to 15 is computationally prohibitive
  • R0 for shift instructions: added rule to grammar
  • version number: fixed (thanks!)

I also fixed the new warning about expressions with non-standard evaluation, which produced false positives.

 

Single quotes for filenames (COPY 'DSK1.FOO'), though, is a syntax error for both Editor/Assembler and xas99.  Thus, I'd rather not change this.

 

Unfortunately, for the non-working completion I have no idea, so I've asked Jetbrains support about this  I suppose IDEA cannot figure out which type to complete, but I don't know why.  Because of that open issue, I'll not release the fixed version just yet.

  • Like 3
  • Thanks 2
Link to comment
Share on other sites

On 2/12/2022 at 6:48 PM, Asmusr said:

Thank you, this is great. Everything I have reported appears to have been fixed, except the alias registers, which still generate errors for me.

Yes, unfortunately I forgot to add this to the relaxed version.  It shows that I don't have automated tests for this plugin, but I don't want to spend the enormous effort to create those.

 

Anyway, register symbols are fixed for version 3.3.2.  I also improved highlighting and code formatting (forgot sign handling, which was non-trivial to add) and fixed the tab stops for GPL.

 

EDIT: If everything is OK I'll do another release next weekend.

Edited by ralphb
  • Like 2
Link to comment
Share on other sites

48 minutes ago, ralphb said:

Yes, unfortunately I forgot to add this to the relaxed version.  It shows that I don't have automated tests for this plugin, but I don't want to spend the enormous effort to create those.

 

Anyway, register symbols are fixed for version 3.3.2.  I also improved highlighting and code formatting (forgot sign handling, which was non-trivial to add) and fixed the tab stops for GPL.

 

EDIT: If everything is OK I'll do another release next weekend.

I'm not getting errors with the alias registers and longer, but the labels for the aliases are marked as Unused where they are defined, and now I'm getting "Duplicate symbols" errors for multiple ! labels.

Link to comment
Share on other sites

2 minutes ago, Asmusr said:

I'm not getting errors with the alias registers and longer, but the labels for the aliases are marked as Unused where they are defined, and now I'm getting "Duplicate symbols" errors for multiple ! labels.

Thanks for the immediate feedback. ?  For the unused symbols used as registers, I thought that this might be OK, but now that I think about it I'll check if I can add registers to "label uses" without ruining the performance.  I also added the duplicate labels, but forgot about local labels. ?

Link to comment
Share on other sites

56 minutes ago, ralphb said:

Please let me know if anything else is amiss.

Here's some I found:

       BANK ALL           ; Undefined symbol
SPRLST EQU  >8380
       MOVB R0,@SPRLST+(4*6) ; <simple expressions> expected, got '('
GHINID EQU >000C ; Ghini ID
       LI R4,GHINID|>FF00 ; Undefined symbol

 

Link to comment
Share on other sites

 

57 minutes ago, PeteE said:

Here's some I found:


       MOVB R0,@SPRLST+(4*6) ; <simple expressions> expected, got '('

 

You never disappoint me! ?  In that case, though, I disallowed parentheses in @addresses because that could be mistaken for an indexed address.  In fact, if you drop the + sign, you got an indexed address. 

 

xas99 also throws an error for that line.  Allowing address expressions with parentheses and indexes (which again might contain parentheses) will be rather difficult to parse, especially as I'm not using a grammar in xas99 as in the plugin. 

 

I'll think about this some more, but sorry, no quick fix.

 

Link to comment
Share on other sites

45 minutes ago, ralphb said:

 

You never disappoint me! ?  In that case, though, I disallowed parentheses in @addresses because that could be mistaken for an indexed address.  In fact, if you drop the + sign, you got an indexed address. 

 

xas99 also throws an error for that line.  Allowing address expressions with parentheses and indexes (which again might contain parentheses) will be rather difficult to parse, especially as I'm not using a grammar in xas99 as in the plugin. 

 

I'll think about this some more, but sorry, no quick fix.

 

Oh, you're right that xas99.py no longer accepts it, although it used to work until recently.  This still seems okay: "MOV R6,@SPRLST+2(R7)"  (note: the intended address is (SPRLST+2) + R7)

Would it be possible to check if the expression inside the parenthesis is a single operand (treating it as indexed address) or multiple operands (treating it as an arithmetic expression)?  Since parenthesis around a single operand in an arithmetic expression aren't ever needed.  You wouldn't normally write "SPRLST+(7)" intending "SPRLST+7", and instead it could always be assumed that "SPRLST+(7)" means "SPRLST+R7".

 

 

Link to comment
Share on other sites

  • 2 weeks later...

What is the best way to assemble a load of assembly files together using xas99?

 

Ideally, i'd like a 'top-level' assembly file with nothing more than COPY directives in it. 

build.asm:
COPY "0-00-Header.asm"
COPY "0-01-Startup.asm"
COPY "0-02-Stack.asm"
...
...and so on (there are 45 files!)

Then, I have a simple script which invokes xas99 and calls build.asm, and all the source files are copied in and assembled. Is this possible?

go:
#! /bin/sh
python ~/TI/xdt99/xas99.py -R build.asm tf.obj

It looks like it sorta tries to work, but it trips up over the file names:

image.thumb.png.0532d43404c5c919898447215c35bc61.png

 

I tried placing the full path to the source files in build.asm - I was thinking maybe xas99 was looking for the files relative to its own directory, but the results were the same. 

 

Mark

Link to comment
Share on other sites

7 minutes ago, Willsy said:

It looks like it sorta tries to work, but it trips up over the file names:

image.thumb.png.0532d43404c5c919898447215c35bc61.png

I guess that your COPY statements in your build.asm start right in the first column.  You need spaces before COPY, though, or COPY is seen as label, and the file name is the mnemonic (even though in the example above, xas99 only sees 0 as mnemonic, which isn't the first char -- I'll have to check what's happening).  So just insert some spaces before all COPYs in all lines.

 

Now, as general strategy your approach is fine.  You can save some typing by using -I (that's capital i), where you then list all folders where the files you want to COPY are.  In your case that would probably be

-I bank0,bank1,bank2,bank3,...

By supplying -I ... you can drop all bank0/ (and bank1/ ...) prefixes from your COPY paths.

 

Finally, is tf.obj is the final output of the assembly, you need to prefix it with -o on the command line to tell xas99 that this is the output.  Otherwise, xas99 will try to assembly tf.obj, which will not work.

 

Please let me know if that works.

  • Like 3
Link to comment
Share on other sites

Oh brilliant - ah yes, the spaces before COPY makes perfect sense. Thank you for responding so quickly :thumbsup::)

 

Regarding the I option, if I just specify the folders, in what order will it assemble the files? Generally, I don't think the assembly order will be important, except for the two header files: one for bank 0, and one for bank 1. These have identical cartridge headers at identical addresses - the reason is, in a banked cart, the cart can potentially 'wake up' with either of the banks active.

 

So, I'm now getting tons of errors - but that's to be expected as I haven't yet included all the files so there are millions of missing labels - but it looks like I'm on my way. Can the assembler produced cart images for banked carts?

 

Many thanks

 

Mark

Link to comment
Share on other sites

35 minutes ago, Willsy said:

Regarding the I option, if I just specify the folders, in what order will it assemble the files? Generally, I don't think the assembly order will be important, except for the two header files: one for bank 0, and one for bank 1. These have identical cartridge headers at identical addresses - the reason is, in a banked cart, the cart can potentially 'wake up' with either of the banks active.

The order of assembly is given by your build.asm.  The -I just says where to look for files you name in your COPY statements.  So for, say, 1-00-Header.asm, the assembler will check if the file is in bank0/, which it isn't, then check in bank1/, where it is located, and then use that file.  This only works because -- I assume -- you also prefix the bank as first char in your filename.

 

This -I wouldn't work if you had identical filenames in all of bank0/, bank1/, ...

 

So -I isn't crucial at all, it just may save you some effort in creating your build.asm.  You don't have to use it, especially since you already have a working build.asm file.

 

35 minutes ago, Willsy said:

Can the assembler produced cart images for banked carts?

Yes, but to qualify that I'd have to know what you're looking for exactly. ? 

 

A ROM cartridge with 2 banks, for example, is just a contiguous 16K binary file.  Any assembler can produce this.  You just have to be careful that you cannot call directly from the first 8K of the file into the second 8K, and vice versa.  Similarly, you cannot use any data from the other 8K chunk.

 

Now xas99 merely checks that you don't so accidentally.  It can also generate each bank separately, or all joined together.  But you still have to program the actual bank switch yourself.

  • Like 1
Link to comment
Share on other sites

1 hour ago, ralphb said:

The order of assembly is given by your build.asm.  The -I just says where to look for files you name in your COPY statements.  So for, say, 1-00-Header.asm, the assembler will check if the file is in bank0/, which it isn't, then check in bank1/, where it is located, and then use that file.  This only works because -- I assume -- you also prefix the bank as first char in your filename.

 

This -I wouldn't work if you had identical filenames in all of bank0/, bank1/, ...

 

So -I isn't crucial at all, it just may save you some effort in creating your build.asm.  You don't have to use it, especially since you already have a working build.asm file.

Ah! Got it. Thanks. Well, I'll probably leave it as it is now as it is finding all the files, and assembling - however, I have 41 syntax errors and literally hundreds warnings. I have added --quiet-unused-syms to my make file:

 

#! /bin/sh
python ~/TI/xdt99/xas99.py -R build.asm --quiet-unused-syms -L listing.lst -S -o tf.obj

It seems to have calmed it down a bit :-) as I know there are a lot of un-used symbols in the code, but there is method/logic to my madness.

 

First thing will be to work through all the syntax errors. These puzzle me, as this code (10,000 source lines) assembles with 0 warnings in ASM99 (Cory Burr's assembler) - but I was expecting issues, so it's no biggie. I have to say, I'm hugely impresses. This is a serious tool. I've been reading the docs and I'm hugely impressed.

 

I have two categories of errors so far: 

  • Syntax errors
  • Warning: Treating XXXX as register, did you intend an @address?

The latter error is because I have aliased some register names with EQU directives:

next   equ R12
pc     equ R3
etc...

Is there a way to alias register names such that warnings are not produced? I have been studying the docs but I haven't seen anything yet.

image.thumb.png.dc3a70b27fe9d833dea7a451fc6ba69c.png

 

The syntax errors look more confusing and will require some effort I think - I haven't looked properly yet - I'm literally just getting this up and running having just git cloned the xdt99 repo :-)

image.thumb.png.87cb2fd54cf03a5bbd673476948f6d53.png

 

All the errors are on lines that use the DATA directive.

 

I'll continue to study the docs!

 

Cheers 

 

Mark

Link to comment
Share on other sites

The reason for the errors on lines with data might be this:

 

Quote

Two or more spaces as well as a tab character introduce the comment field.

I'll check the source this weekend. For now, I'm just happy to have the environment set up in Linux!

 

[edit]

 

Yes, I have multiple spaces in those data lines to make it nice and neat:

image.thumb.png.ea08068cb9c835df438557f12289e23f.png

Edited by Willsy
Added image
Link to comment
Share on other sites

Sorry to spam you with 'technical support' requests!

Quote

To deal with this problem, a new relaxed syntax enabled by option -r has been introduced. With relaxed syntax, there are no restrictions on whitespace, i.e., any mount of whitespace might be used anywhere. On the other hand, comments after the operand fields must be introduced with a semicolon ;.

When I add the -r option, I get a lot of errors that do not appear to be related to the -r option:

1441083001_Screenshotfrom2022-02-2822-12-32.thumb.png.5e17ef556d0e989cd932c98b10a152de.png

 

However, when I remove the -r option, the errors all go away.

 

Here's how I added the -r flag (I tried it in a few different places, but made no difference):

#! /bin/sh
python ~/TI/xdt99/xas99.py -r -R build.asm --quiet-unused-syms -L listing.lst -S -o tf.obj

Cheers

 

Mark

Link to comment
Share on other sites

Feature request! :)

When the assembler completes, it tells you how many errors it found. Can we also have it tell us how many warnings were issued? This would be very helpful when you are working with a massive code base and you're killing the warnings off one-by-one as you can see the warning count going down with each assembly run.

 

:thumbsup:

 

Okay, I added it myself! I was going to send you a pull request, but I couldn't figure it out. I'll send you a PM with the updated code (if you want to use it - feel free to ignore!)

  • Like 2
Link to comment
Share on other sites

Willsy, you figured out a lot yourself, that's great!

 

You're right that xas99 allows at most one space between things in the operands field, because as the original E/A, xas99 allows "free floating" comments, like this:

   LI   R0, VALUE + 2  * THIS IS THE INITIAL BOUNDARY

Should R0 be assigned to VALUE+2 or (VALUE+2)*THIS?  That's why I decided that two or more spaces introduce the comment field to avoid ambiguity.

 

And while that restriction serves my original writing style, I finally decided to introduce a more general way of writing assembly.  In relaxed syntax you can use any number of  spaces, but to prevent ambiguity, you need to separate comments with ;.

 

And since you introduce most comments with ; you can and should relaxed mode.  I think you still get errors with -r because some comments start with \.  But since \ is quite rare, maybe you can just replace all \ by ; ?

 

For the alias registers, I do not really have a solution but to disable those warnings with --quiet-usage.  It seems that assembly-wise you know what you're doing, so you won't need those warnings anyway. ?

 

Finally, thanks for the code, I'll add that to xas99.  I didn't count warnings so far as I didn't want to draw too much attention to them.  Warnings are meant as programming aid, not as requests for improvement.

  • Like 5
Link to comment
Share on other sites

I've release new versions of xdm99, xvm99 and xhm99 with support for archives, either on disk or stand-alone.  You can add, extract, delete, rename, or protect files in archives, and for archives on disks you can also add files from and extract files to disk.

 

Here is a summary of the new functionality.

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

  • 4 weeks later...

The new version of the IntelliJ IDEA plugin generally works great, but there's one thing I find annoying:

 

I type:

Quote

mov r1,r0

and IntelliJ suggests for instance:

Quote

mov r1,right_flipper_sprites_0

which is a label. When I press enter to finish the line that option is chosen, so I have to remember press Esc and then enter.

 

It helps to define equates for r0-r15 yourself (and drop the -R parameter), because then those labels are suggested first. That's actually a perfectly fine solution for me, but thought I would mention it.

  • Like 4
Link to comment
Share on other sites

20 hours ago, Asmusr said:

The new version of the IntelliJ IDEA plugin generally works great, but there's one thing I find annoying:

Oh, I didn't notice that (I guess I don't have matching label names in my code).  This happens because I added labels to the register rule.  I'll see if I can give higher precedence to registers than to labels.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...