70 }
else if( access(
"run6809.exe", F_OK ) == 0 ) {
71 sprintf(executableName,
"%s",
"run6809.exe" );
73 sprintf(executableName,
"%s",
"run6809" );
76 sprintf( commandLine,
"\"%s\" -i \"%s\" -R 3000 -b -l 3000 \"%s\" -p \"%s\" %d",
85 printf(
"The profiling of assembly program failed.\n\n");
101static unsigned int sum=0;
102static unsigned char chk=0;
103static unsigned short l;
112 int p=strcspn(ptr,
point);
132#if ( defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN ) || \
133 defined(__BIG_ENDIAN__) || \
134 defined(__ARMEB__) || \
135 defined(__THUMBEB__) || \
136 defined(__AARCH64EB__) || \
137 defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)
139 static void swapen(
unsigned short *num)
146 static void swapen(
unsigned short *num)
148 unsigned short swapped;
149 swapped = (*num>>8) | (*num<<8);
155static void crc (
unsigned char * data,
int l,
unsigned int * old)
159 for (
int i= 0;i<l;i++)
166static unsigned char cmpl(
unsigned int n)
168 return 0x100- ((
unsigned char)n);
182 unsigned short start=0x8100;
184 unsigned short runaddr=0x8100;
195 remove( temporaryFileName );
199 fr=fopen(temporaryFileName,
"rb");
207 if(
frmt(_environment,
"main.exe",strlen(
"main.exe"),nome))
214 unsigned char h[]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x3c,0x5a};
215 unsigned char h1[]={1,0,0};
216 unsigned char h2[]={1,0};
217 unsigned char n[]={0x00,0x10};
218 unsigned char n1[]={0x02,0x00,0x00};
219 unsigned char end[]={0xff,0x02,0x00};
222 unsigned char preend[]={0xff,0x00,0x00};
223 fr=fopen(temporaryFileName,
"rb");
231 fw=fopen(destin,
"wb");
232 fseek(fr, 0
L, SEEK_END);
235 nblock=floor((
size+12)/254);
238 rest=
size+12-nblock*254;
241 unsigned char restByte = (
unsigned char)rest;
247 fwrite(&h,
sizeof(h),1,fw);
248 fwrite(&n,
sizeof(n),1,fw);
249 fwrite(&nome,
sizeof(nome)-1,1,fw);
258 fwrite(&h,
sizeof(h),1,fw);
261 fwrite(&h1,
sizeof(h1),1,fw);
265 fwrite(&u,
sizeof(u),1,fw);
267 fwrite(&restByte,1,1,fw);
268 fwrite(&z,
sizeof(z),1,fw);
272 fwrite(&start,
sizeof(start),1,fw);
273 crc((
unsigned char *)&
size,
sizeof(
size),&sum);
274 crc((
unsigned char *)&start,
sizeof(start),&sum);
275 for (
int i=0;i<l;i++)
284 fwrite(&h,
sizeof(h),1,fw);
286 fwrite(&h2,
sizeof(h2),1,fw);
289 fwrite(&u,
sizeof(u),1,fw);
291 fwrite(&restByte,1,1,fw);
297 (void)!fread(&byt,1,1,fr);
299 (void)!fwrite(&byt,1,1,fw);
301 crc((
unsigned char *)&preend,3,&sum);
302 fwrite(&preend,3,1,fw);
303 crc((
unsigned char *)&runaddr,2,&sum);
304 fwrite(&runaddr,2,1,fw);
308 fwrite(&h,
sizeof(h),1,fw);
309 fwrite(&
end,
sizeof(
end),1,fw);
int system_call(Environment *_environment, char *_commandline)
Call an external executable.
char * get_temporary_filename(Environment *_environment)
void target_linkage(Environment *_environment)
Convert C64's assembly to executable.
void target_cleanup(Environment *_environment)
void target_analysis(Environment *_environment)
Variable * point(Environment *_environment, char *_x, char *_y)
int frmt(Environment *_environment, char *ptr, char size, char *out)
void end(Environment *_environment)
Emit ASM code for END.
int convertbintok7(Environment *_environment)
OutputFileType outputFileType
int mo5_convertbintok7_original(Environment *_environment)
int to8_convertbintok7_original(Environment *_environment)
#define BUILD_TOOLCHAIN_ASM6809_GET_LISTING_FILE(_environment, listingFileName)
@ OUTPUT_FILE_TYPE_K7_NEW
@ OUTPUT_FILE_TYPE_K7_ORIGINAL
#define BUILD_SAFE_REMOVE(_environment, filename)
#define MAX_TEMPORARY_STORAGE
#define BUILD_TOOLCHAIN_ASM6809EXEC(_environment, flag, startingAddress, executableName, listingFileName)
struct _Environment Environment
Structure of compilation environment.
#define CRITICAL_CANNOT_OPEN_EXECUTABLE_FILE(c)
#define CRITICAL_BUILD_INVALID_FILENAME_K7(f)
#define BUILD_TOOLCHAIN_ASM6809_GET_EXECUTABLE(_environment, executableName)
#define BUILD_SAFE_MOVE(_environment, source, destination)
#define CRITICAL_UNSUPPORTED_OUTPUT_FILE_TYPE(t)
char OUTPUT_FILE_TYPE_AS_STRING[][16]
char * strcopy(char *_dest, char *_source)