XA vs. CA65 programming tips, tricks and more

Here you can ask questions or provide insights about how to use efficiently 6502 assembly code on the Oric.
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

XA vs. CA65 programming tips, tricks and more

Post by iss »

Hi, all!

In this topic I'll continuously add some infos about XA, CA65 and other assemblers which stacked as pile in my experience over the years.
I hope it will be helpful. Everyone is welcome to comment and contribute with own examples!

Index: (in order of appearance links to newer posts)

- the magic program counter (*) (XA vs CA65);
- strange string definitions (XA);
- watch your comments (;) (XA official);
- #define your comments (;) (XA);
- using XA sources with CC65 without pain.
- to be continued...
Last edited by iss on Mon Jul 18, 2022 8:53 pm, edited 2 times in total.
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: XA vs. CA65 programming tips, tricks and more

Post by iss »

The magic program counter *:

The source code is the same for XA and CA65:

Code: Select all

	.word	*,*,*,*
What do you expect as result if it's assembled from starting address #1000 ? The same binary? Wrong! :mrgreen:

"The truth is out there":

Code: Select all

$ ./compile.sh 
test-xa.bin:
00000000  00 10 00 10 00 10 00 10                           |........|
test-ca65.bin:
00000000  00 10 02 10 04 10 06 10                           |........|
Attached are the source (license free :D), binaries and the bash script to compile and dump.
Attachments
test-01.zip
(803 Bytes) Downloaded 81 times
Post Reply