ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
_build.c
Go to the documentation of this file.
1/*****************************************************************************
2 * ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
3 *****************************************************************************
4 * Copyright 2021-2026 Marco Spedaletti (asimov@mclink.it)
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *----------------------------------------------------------------------------
18 * Concesso in licenza secondo i termini della Licenza Apache, versione 2.0
19 * (la "Licenza"); è proibito usare questo file se non in conformità alla
20 * Licenza. Una copia della Licenza è disponibile all'indirizzo:
21 *
22 * http://www.apache.org/licenses/LICENSE-2.0
23 *
24 * Se non richiesto dalla legislazione vigente o concordato per iscritto,
25 * il software distribuito nei termini della Licenza è distribuito
26 * "COSÌ COM'È", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o
27 * implicite. Consultare la Licenza per il testo specifico che regola le
28 * autorizzazioni e le limitazioni previste dalla medesima.
29 ****************************************************************************/
30
31/****************************************************************************
32 * INCLUDE SECTION
33 ****************************************************************************/
34
35#include "../../ugbc.h"
36
37/****************************************************************************
38 * CODE SECTION
39 ****************************************************************************/
40
41extern char OUTPUT_FILE_TYPE_AS_STRING[][16];
42
43void target_linkage( Environment * _environment ) {
44
45 char commandLine[8*MAX_TEMPORARY_STORAGE];
46 char executableName[MAX_TEMPORARY_STORAGE];
47 char listingFileName[MAX_TEMPORARY_STORAGE];
48
50
51 BUILD_SAFE_REMOVE( _environment, _environment->exeFileName );
52
53 BUILD_TOOLCHAIN_ASM6809_GET_EXECUTABLE( _environment, executableName );
54
55 BUILD_TOOLCHAIN_ASM6809_GET_LISTING_FILE( _environment, listingFileName );
56
57 BUILD_TOOLCHAIN_ASM6809EXEC( _environment, "-D", 10240, executableName, listingFileName );
58
59 if ( _environment->listingFileName ) {
60
61 if ( _environment->profileFileName && _environment->profileCycles ) {
62 if ( _environment->executerFileName ) {
63 sprintf(executableName, "%s", _environment->executerFileName );
64 } else if( access( "run6809.exe", F_OK ) == 0 ) {
65 sprintf(executableName, "%s", "run6809.exe" );
66 } else {
67 sprintf(executableName, "%s", "run6809" );
68 }
69
70 sprintf( commandLine, "\"%s\" -i \"%s\" -R 2800 -b -l 27f7 \"%s\" -p \"%s\" %d",
71 executableName,
72 _environment->listingFileName,
73 _environment->exeFileName,
74 _environment->profileFileName,
75 _environment->profileCycles ? _environment->profileCycles : 1000000
76 );
77
78 if ( system_call( _environment, commandLine ) ) {
79 printf("The profiling of assembly program failed.\n\n");
80 return;
81 };
82
83 }
84
85 }
86
87}
88
89void target_cleanup( Environment * _environment ) {
90
91 remove( _environment->asmFileName );
92
93 if ( _environment->analysis && _environment->listingFileName ) {
94 target_analysis( _environment );
95 }
96
97}
int system_call(Environment *_environment, char *_commandline)
Call an external executable.
void target_linkage(Environment *_environment)
Convert C64's assembly to executable.
Definition _build.c:327
void target_cleanup(Environment *_environment)
Definition _build.c:343
void target_analysis(Environment *_environment)
Definition _cleanup.c:68
char * listingFileName
Definition ugbc.h:2305
int analysis
Definition ugbc.h:2365
char * executerFileName
Definition ugbc.h:2315
char * profileFileName
Definition ugbc.h:2310
char * asmFileName
Definition ugbc.h:2285
int profileCycles
Definition ugbc.h:2375
char * exeFileName
Definition ugbc.h:2290
#define BUILD_TOOLCHAIN_ASM6809_GET_LISTING_FILE(_environment, listingFileName)
Definition ugbc.h:4872
@ OUTPUT_FILE_TYPE_BIN
Definition ugbc.h:258
#define BUILD_CHECK_FILETYPE(_environment, _filetype)
Definition ugbc.h:4743
#define BUILD_SAFE_REMOVE(_environment, filename)
Definition ugbc.h:4748
#define MAX_TEMPORARY_STORAGE
Definition ugbc.h:563
#define BUILD_TOOLCHAIN_ASM6809EXEC(_environment, flag, startingAddress, executableName, listingFileName)
Definition ugbc.h:4880
struct _Environment Environment
Structure of compilation environment.
#define BUILD_TOOLCHAIN_ASM6809_GET_EXECUTABLE(_environment, executableName)
Definition ugbc.h:4855
char OUTPUT_FILE_TYPE_AS_STRING[][16]