endlos99 / xdt99

xdt99: TMS 99xx Cross-Development Tools
http://endlos99.github.io/xdt99
GNU General Public License v3.0
52 stars 8 forks source link

xas99 pragma for starting data definition directives on even addresses #39

Open MirrorPusher opened 2 years ago

MirrorPusher commented 2 years ago

Would be cool to have a pragma that allows one to start data definition directives on even addresses. That would be especially useful if you for example have a sequence of multiple stri, text or byte directives. Would save one from having a bunch of even directives littering the source code.

Example:

        stri ' '
        even
        byte    35
        byte    1,1,1,1,1,1,1,1,1,1,1,1,1
        text    ' Cursor '
        byte    1,1,1,1,1,1,1,1,1,1,1,1,1,1
        even                          
        stri 'Fctn s        Left'             : Some pragma for even addresses instead of 'even' on every 2nd line
        even
        stri 'Fctn d        Right'
        even
        stri 'Fctn e        Up'
        even
        stri 'Fctn x        Down'
        even
        stri 'Fctn h        Home'
        even
        stri 'Fctn l        End'
        even
        stri 'Fctn j        Prev word'
        ...
endlos99 commented 2 years ago

That'll be possible, but may I ask why you actually want to start each string on an even address?

Note that in your example, the first cluster from byte 35 to byte 1,1,... would then have three additional evens inserted. Also, is this per statement, or per string:

 text 'FOO', 'BAR'   # even between FOO and BAR?
MirrorPusher commented 2 years ago

Starting strings or other data definition statements on even addresses allows the use of mov statements instead of movb. Also do not need to check for uneven addresses.

So in this use case, it's basically keeping the display or memory copy statements trivial on the expense of wasting some memory space, but with for example the benefit of improved speed. (and with the final grom, SAMS and similar devices memory pressure is becoming a mood point).

Could imagine that for game development, it may be beneficial if you could specify the boundary as a multiple of 2 (2,4,8,16,..) but that's probably something for the game devs to judge.

To the question if this would be per statement or per string. I have to say that so far I always had a new statement for each string. But looking at it from a more general perspective, perhaps it'd make sense to have it for each item instead of for each statement.