Page 2 of 3

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 1:57 pm
by Dbug
XA 2.2.5 works for me as expected.
Thanks :)
christian wrote:
Thu Apr 13, 2017 1:34 pm
@Dbug: I'm used to use XA and I'm now testing CA65 due to the lack of a real macros support with XA.
Is there any particular macro stuff you are looking for?

There are two things I'd like to add to XA one day: Ability to include binary files directly (incbin) and possibility to repeat a number of lines of code with some variables evaluation - for example to expand a block of lines of code while automatically computing absolute addresses of each instruction -

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 2:23 pm
by jede
Dbug wrote:
Thu Apr 13, 2017 12:08 pm
christian wrote:
Thu Apr 13, 2017 11:39 am
We can also fork co65, modify 1 line and we get a new tool for xa

I'm still not quite sure why Jede is mixing XA and CC65,
In fact, i don't like ca65 syntax, when i code something in assembly, i use xa.

The problem is that i use cc65 for Orix tool (with telemon3.0). I wrote a new tool in assembly, but i need to add command line parameter, i am too lazy to code it in assembly. That is why, i want to link xa code with cc65

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 2:31 pm
by Dbug
jede wrote:
Thu Apr 13, 2017 2:23 pm
The problem is that i use cc65 for Orix tool (with telemon3.0). I wrote a new tool in assembly, but i need to add command line parameter, i am too lazy to code it in assembly. That is why, i want to link xa code with cc65
Hmm, so cc65 has native command line support, how does that work exactly?

I assume the command line parameters are written somewhere, like maybe in the BASIC interpreter line buffer, and then it's parsed?

If we can have something standard, we can probably add that to the OSDK, that sound like a reasonable extension to have :)

And yes, ca65 was mostly designed as a "assembler for tools", I can't imagine anyone sane wanting to use write code in ca65 syntax.

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 2:32 pm
by jede
Dbug wrote:
Thu Apr 13, 2017 1:57 pm
XA 2.2.5 works for me as expected.
Thanks :)
christian wrote:
Thu Apr 13, 2017 1:34 pm
@Dbug: I'm used to use XA and I'm now testing CA65 due to the lack of a real macros support with XA.
Is there any particular macro stuff you are looking for?

There are two things I'd like to add to XA one day: Ability to include binary files directly (incbin) and possibility to repeat a number of lines of code with some variables evaluation - for example to expand a block of lines of code while automatically computing absolute addresses of each instruction -
It's a bit tricky to do macro in XA, but 100% of my own needs are working with Xa macro.

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 2:34 pm
by christian
For example, sometimes I need to have strings with last byte having the most significant bit set, or preceded by the length of the string.
I can create 2 macros like:

Code: Select all

.macro string80 arg
        ; Place la chaine avec le bit7 du dernier caratère à 1
        .repeat .strlen(arg)-1, I
                .byte .strat(arg,I)
        .endrepeat
        .byte .strat(arg,.strlen(arg)-1) ^ $80
.endmacro

.macro pstring arg
    .byte strlen(arg)
    .byte arg
.endmacro

Then

Code: Select all

string80 "test"
pstring "test"
is expanded as

Code: Select all

.byte "tes",$74
.byte 4,"test"

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 2:38 pm
by jede
Dbug wrote:
Thu Apr 13, 2017 2:31 pm
jede wrote:
Thu Apr 13, 2017 2:23 pm
I assume the command line parameters are written somewhere, like maybe in the BASIC interpreter line buffer, and then it's parsed?

If we can have something standard, we can probably add that to the OSDK, that sound like a reasonable extension to have :)
Args management are handle here : https://github.com/cc65/cc65/blob/maste ... mainargs.s

Syntax is :

"Command-line arguments can be passed to main(). Since that is not
supported directly by BASIC, the following syntax was chosen:

RUN:REM arg1 " ARG2 IS QUOTED" ARG3 "" ARG5
"

I did the same for telestrat (https://github.com/cc65/cc65/blob/maste ... mainargs.s), but i used BUFEDT buffer (110 bytes in telemon rom). Each program are compiled with this code.

That is why in Orix, i can do "./mybin -x -y"

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 2:38 pm
by christian
I've just realized I'm not using the same version of XA, mine is v2.3.7... :o

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 2:57 pm
by Dbug
christian wrote:
Thu Apr 13, 2017 2:38 pm
I've just realized I'm not using the same version of XA, mine is v2.3.7... :o
The OSDK XA is not the same as the "official" XA.

Basically the version in the OSDK is based from the 1998 source code snapshot of XA when André stopped maintaining it.

Fast forward more than a decade, I've been releasing a bunch of updates, fixed a bunch of bugs, etc... and then the official XA reappeared with new maintainers and coders.

I wanted to renamed mine, but that would have caused compatibility problems on my stuff.

Feature wise, I believe the only major difference is the '.bin' command

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 3:06 pm
by christian
Ok, thanks for clarifying.
Yes, the '.bin' command seems to be the only difference

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 3:13 pm
by Dbug
What I could do, is to add an explanation on the top of the XA documentation page on OSDK.org explaining that this is not the official version, and redirect people to http://www.floodgap.com/retrotech/xa/ if they want the official one.

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 3:48 pm
by christian
Good idea!

- The last revision is 2.3.7 dated Dec 2014 on http://www.floodgap.com/retrotech/xa/ (no more evolution)
- André put all versions up to v2.3.6 at https://github.com/fachat/xa65 as backup

I will switch to your version and make a package for my Linux distribution.

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 4:17 pm
by Dbug

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 5:31 pm
by christian
I'm doing some tests with your latest version (v2.2.5)

Silly program:

Code: Select all

;
; a: AUTOEXEC: 0 / 4
; t: Nom du programme
;


#define TAPE_HEADER(a,t) .db $16, $16, $16, $16, $24, $ff, $ff, $80, a, >end, <end, >start, <start, $09, t, $00
#define TAPE_HEADER_BUG(t,a) .db $16, $16, $16, $16, $24, $ff, $ff, $80, a, >end, <end, >start, <start, $09, t, $00

#define TAPE_TITLE "BRK-HANDLER"
#define AUTOEXEC $04

TAPE_HEADER(AUTOEXEC,TAPE_TITLE)
TAPE_HEADER_BUG(TAPE_TITLE,AUTOEXEC)

start:
	lda #$01
	rts
end:
With original XA, I need to use the command xa -M test.s because of chacracter ':' in comments (MASM compatibility) but it failed with:

Code: Select all

TAPE_HEADER_BUG(TAPE_TITLE,AUTOEXEC)
test.s:line 21: 101a:Syntax error
Never found why TAPE_HEADER_BUG(TAPE_TITLE,AUTOEXEC) failed and TAPE_HEADER_BUG("BRK-HANDLER",AUTOEXEC) pass...

With your version, if I use the same command, it fails too but not for the same reason:

Code: Select all

xAss65: Pass 1: test.s
start:
test.s(23):  1034:Syntax error
end:
test.s(26):  1037:Syntax error
But pass if I type xa test.s without '-M'...

The good news is: your version can pass this test
The not so bad news are: I don't understand the error with your version and '-M' option and why this option is not needed in this case?

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 5:53 pm
by Dbug
This option probably got broken when I did some work on the pre-processor to fix some bugs and other weird behavior.
If all -M does is to allow/disallow the parsing of : in commented lines, maybe I should just remove it.

Re: xa and o65 format (and CC65)

Posted: Thu Apr 13, 2017 6:38 pm
by christian
Yes this is the only function of this option.

As your version handles correctly ':' in comments without the '-M', I think you can remove it or lets it for compatibility only but as a "do nothing function"