Welcome, Guest. Please login or register.

Author Topic: compiling assembly.s files in gcc ... was: gcc wont compile with // comments?  (Read 13535 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline NovaCoder

To continue this old thread....

I'm having the same kind of issues as this guy was. In theory you should just be able to add assembler sources directly to a project in StormC V4 when using the gcc compiler but that doesn't work for me (or him).

So now I'm using PhxAss to compile the assembly files to object files and adding them to my StormC project. I then have to use a special header file declaration as follows:


Code:
#define REG(reg,arg) arg __asm(#reg)
 
void setVol (REG(d0, int vol));

This works great as long as the project is in plain C but if I want to create a C++ project I get linker errors (adding extern to function definition doesn't help).

Anyone got any ideas?
Life begins at 100 MIPS!


Nice Ports on AmiNet!
 

Offline NovaCoder

Re: compiling assembly.s files in gcc was: gcc wont compile with // comments?
« Reply #1 on: December 09, 2009, 01:23:29 AM »
Nope, that gives a syntax error :(
Life begins at 100 MIPS!


Nice Ports on AmiNet!
 

Offline NovaCoder

Re: compiling assembly.s files in gcc was: gcc wont compile with // comments?
« Reply #2 on: December 09, 2009, 03:09:13 AM »
Update:  Seems to work with a 'simple' prototype

eg void setVol(int vol);
Life begins at 100 MIPS!


Nice Ports on AmiNet!
 

Offline NovaCoder

Quick update (for reference):

So now I'm using PhxAss to compile the assembly files to object files and adding them to my StormC project. I then have to use a stub declaration as follows to call the underlying assembler function:

Code: [Select]

void c2p1x1_cpu3blit1_queue_stub(UBYTE *c2pscreen, UBYTE *bitplanes) {

UBYTE * _c2pscreen = (c2pscreen);
UBYTE * _bitplanes = (bitplanes);

register UBYTE * __c2pscreen __asm("a0") = _c2pscreen;
register UBYTE * __bitplanes __asm("a1") = _bitplanes;
__asm volatile ( "jsr _c2p1x1_cpu3blit1_queue" : : "r" (__c2pscreen), "r" (__bitplanes) : "d2", "d3", "d4", "d5", "d6", "d7", "a2", "a3", "a4", "cc", "memory");
}
Life begins at 100 MIPS!


Nice Ports on AmiNet!