Hello,
I start to experiment some ASM embedded in my SGDK projects ...
I use the default SGDK tool chain with GNU as ...
Can i tweak something for write my ASM with Motorola syntax, or maybe i must change the assembler in my makefile ?
Thank
Nainain
SGDK\ ASM with Motorola syntax
Moderator: Stef
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: SGDK\ ASM with Motorola syntax
Hey Nainain
If you speak about the '%' register prefix, you can indeed disable it with the "--register-prefix-optional" switch, you just need to modify the makefile.gen
If you speak about the '%' register prefix, you can indeed disable it with the "--register-prefix-optional" switch, you just need to modify the makefile.gen
Re: SGDK\ ASM with Motorola syntax
Hello Stef,
But i dont know if it can works well with the hexa notation too
0x1A is $1A with Motorola syntax
But i dont know if it can works well with the hexa notation too
0x1A is $1A with Motorola syntax
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: SGDK\ ASM with Motorola syntax
No, i don't think you can do that, just remove the '%' prefix for register. '$' is used as a special character in GAS.
But now i'm thinking about it, there is a tool in SGDK, which, i believe, convert from motorola assembly syntax in GAS (tool is called mac68k).
If you write your assembly code inside a .asm file SGDK will assume it as motorola assembly where .s are taken as classic GAS assembly file.
But now i'm thinking about it, there is a tool in SGDK, which, i believe, convert from motorola assembly syntax in GAS (tool is called mac68k).
If you write your assembly code inside a .asm file SGDK will assume it as motorola assembly where .s are taken as classic GAS assembly file.
-
- Very interested
- Posts: 616
- Joined: Thu Nov 30, 2006 6:30 am
Re: SGDK\ ASM with Motorola syntax
For what it's worth, vasm (which has a Motorola syntax module) supports ELF output that can theoretically be linked in with a gcc project.
Re: SGDK\ ASM with Motorola syntax
I do believe there's a command line argument that makes GAS take Motorola syntax (still not 100% compatible though, mostly directives). The problem is that if I recall correctly that makes it incompatible with GCC's output, so you can't use it for inline asm. I need to look into it again.
Sik is pronounced as "seek", not as "sick".
Re: SGDK\ ASM with Motorola syntax
A bit late, but here is a snippet of code I converted from the Atari ST Star Raiders to the GCC .asm file. It was a pain at first but you start getting the idea after awhile... Hope this might help
*
* INITSTAFT Initializes AFT stars
*
* Given:
* STARLIST = address of list of stars X and Y
*
* Returns:
* all stars X and Y randomly initialized
*
* Register Usage:
* destroys a0 and d0-d6
*
* Externals:
* randu
*
initStarsAft:
movea.l #starAftlist,%a0
movea.l #startime,%a1
move #(nstarsaft-1),%d6 | FOR (all stars) DO
instarlp:
jsr random32 | get 24-bit random number
swap %d0
ori #2,%d0 | ensure non-zero
ext %d0
asr #1,%d0
swap %d0 | sign-extended to a 32-bit random
move.l %d0,(%a0)+ | Xpos = {-64 .. 63}
jsr random32 | get 24-bit random number
swap %d0
ori #4,%d0 | ensure non-zero
ext %d0
asr #2,%d0
swap %d0 | sign-extended to a 32-bit random
move.l %d0,(%a0)+ | Ypos = {-32 .. 31}
jsr random32
and #starlife,%d0
move %d0,(%a1)+ | Start Star Timer
dbra %d6,instarlp
rts
*
* DATA STORAGE
*
.bss
.globl starAftlist
starAftlist:
.ds.l nstarsaft | X-position (lo-word=fractional part)
.ds.l nstarsaft | Y-position (lo-word=fractional part)
startime:
.ds.w nstarsaft | Star Lifetime Counter
*
* INITSTAFT Initializes AFT stars
*
* Given:
* STARLIST = address of list of stars X and Y
*
* Returns:
* all stars X and Y randomly initialized
*
* Register Usage:
* destroys a0 and d0-d6
*
* Externals:
* randu
*
initStarsAft:
movea.l #starAftlist,%a0
movea.l #startime,%a1
move #(nstarsaft-1),%d6 | FOR (all stars) DO
instarlp:
jsr random32 | get 24-bit random number
swap %d0
ori #2,%d0 | ensure non-zero
ext %d0
asr #1,%d0
swap %d0 | sign-extended to a 32-bit random
move.l %d0,(%a0)+ | Xpos = {-64 .. 63}
jsr random32 | get 24-bit random number
swap %d0
ori #4,%d0 | ensure non-zero
ext %d0
asr #2,%d0
swap %d0 | sign-extended to a 32-bit random
move.l %d0,(%a0)+ | Ypos = {-32 .. 31}
jsr random32
and #starlife,%d0
move %d0,(%a1)+ | Start Star Timer
dbra %d6,instarlp
rts
*
* DATA STORAGE
*
.bss
.globl starAftlist
starAftlist:
.ds.l nstarsaft | X-position (lo-word=fractional part)
.ds.l nstarsaft | Y-position (lo-word=fractional part)
startime:
.ds.w nstarsaft | Star Lifetime Counter