56 switch( variable->
type ) {
175 memset(
string, 0, variable->
size + 1 );
181 for (i=0; i<(variable->
size-1); ++i ) {
182 if ( ( ( i + 1 ) % 16 ) == 0 ) {
199 memset(
string, 0, variable->
size + 1 );
205 for (i=0; i<(variable->
size-1); ++i ) {
236 for (i=0; i<(variable->
size-1); ++i ) {
243 if ( variable->
value ) {
248 for(
int i=0; i<(variable->
size/4)-1; ++i ) {
249 out4(
"$%2.2x, $%2.2x, $%2.2x, $%2.2x, ", (
unsigned int)( variable->
value & 0xff ), (
unsigned int)( ( variable->
value >> 8 ) & 0xff ), (
unsigned int)( ( variable->
value >> 16 ) & 0xff ), (
unsigned int)( ( variable->
value >> 24 ) & 0xff ) );
251 out4(
"$%2.2x, $%2.2x, $%2.2x, $%2.2x", (
unsigned int)( variable->
value & 0xff ), (
unsigned int)( ( variable->
value >> 8 ) & 0xff ), (
unsigned int)( ( variable->
value >> 16 ) & 0xff ), (
unsigned int)( ( variable->
value >> 24 ) & 0xff ) );
257 for(
int i=0; i<(variable->
size/2)-1; ++i ) {
258 out2(
"$%2.2x, $%2.2x,", (
unsigned int)( variable->
value & 0xff ), (
unsigned int)( ( variable->
value >> 8 ) & 0xff ) );
260 out2(
"$%2.2x, $%2.2x", (
unsigned int)( variable->
value & 0xff ), (
unsigned int)( ( variable->
value >> 8 ) & 0xff ) );
290 variable = variable->
next;
295static void variable_cleanup_memory_mapped(
Environment * _environment,
Variable * _variable ) {
300 switch( _variable->
type ) {
335 int * data =
malloc( bytes *
sizeof(
int ) );
344 for(
int i=0; i<bytes; ++i ) {
345 outline1(
" .byte $%2.2x", (
unsigned char)( ( data[i] ) & 0xff ) );
376 char *
string =
malloc( _variable->
size + 1 );
377 memset(
string, 0, _variable->
size + 1 );
383 for (i=0; i<(_variable->
size-1); ++i ) {
415 for (i=0; i<(_variable->
size-1); ++i ) {
420 if ( _variable->
value ) {
421 outhead2(
" .res %d, $%2.2x", _variable->
size, (
unsigned char)(_variable->
value&0xff));
429 if ( _variable->
strips ) {
455 switch( variable->
type ) {
463 if ( bitCount == 8 ) {
471 variable = variable->
next;
475 if ( bitCount > 0 ) {
504 actual = actual->
next;
506 outline0(
".word $ffff, DATAPTRE" );
513 out1(
"OFFSETS%4.4x: .word ", actual->
size );
514 for( i=0; i<actual->
count; ++i ) {
516 if ( i < ( actual->
count - 1 ) ) {
524 while( actualVariable ) {
530 actualVariable = actualVariable->
next;
551 actual = actual->
next;
560 values[count] = actual->
size;
562 sprintf( address[count],
"fs%4.4xsoffsetframe", actual->
size );
563 actual = actual->
next;
586 variable_cleanup_entry( _environment, variable );
587 variable_cleanup_entry_bit( _environment, variable );
594 outhead0(
"BITMASK: .byte $01,$02,$04,$08,$10,$20,$40,$80");
595 outhead0(
"BITMASKN: .byte $fe,$fd,$fb,$f7,$ef,$df,$bf,$7f");
603 variable_cleanup_entry( _environment, variable );
604 variable_cleanup_entry_bit( _environment, variable );
609 variable_cleanup_entry( _environment, variable );
610 variable_cleanup_entry_bit( _environment, variable );
618 actual = actual->
next;
655 while( memoryArea ) {
661 outhead1(
".segment \"MA%3.3x\"", memoryArea->
id );
662 for( i=memoryArea->
start; i<memoryArea->
end; ++i ) {
666 variable_cleanup_memory_mapped( _environment, variable );
670 variable = variable->
next;
676 variable_cleanup_memory_mapped( _environment, variable );
680 variable = variable->
next;
686 variable_cleanup_memory_mapped( _environment, variable );
690 variable = variable->
next;
693 memoryArea = memoryArea->
next;
700 outhead1(
"BANKWINDOWID%2.2x: .byte $FF, $FF", i );
712 while( dataSegment ) {
714 if ( dataSegment->
data ) {
720 while( dataDataSegment ) {
721 if ( dataSegment->
type ) {
723 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
size) );
724 out1(
"\"%s\"", dataDataSegment->
data );
726 for( i=0; i<(dataDataSegment->
size-1); ++i ) {
727 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
729 out1(
"$%2.2x", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
733 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
type) );
734 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
size) );
735 out1(
"\"%s\"", dataDataSegment->
data );
737 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
type) );
738 for( i=0; i<(dataDataSegment->
size-1); ++i ) {
739 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
741 out1(
"$%2.2x", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
744 dataDataSegment = dataDataSegment->
next;
745 if ( dataDataSegment ) {
750 dataSegment = dataSegment->
next;
758 while( staticStrings ) {
760 staticStrings = staticStrings->
next;
void vars_emit_constants(Environment *_environment)
void vars_emit_strips(Environment *_environment, char *_name, Strip *_strips)
void cpu_address_table_build(Environment *_environment, char *_table, int *_values, char *_address[], int _count)
void cpu_float_fast_from_double_to_int_array(Environment *_environment, double _value, int _result[])
void cpu_float_single_from_double_to_int_array(Environment *_environment, double _value, int _result[])
void cpu_mem_move_direct_size(Environment *_environment, char *_source, char *_destination, int _size)
void cpu_address_table_lookup(Environment *_environment, char *_table, int _count)
void vars_emit_word(Environment *_environment, char *_name, int _value)
void vars_emit_dword(Environment *_environment, char *_name, int _value)
void vars_emit_number(Environment *_environment, char *_name, int _value)
#define VT_FLOAT_BITWIDTH(p)
void vars_emit_byte(Environment *_environment, char *_name, int _value)
char * escape_newlines(char *_string)
void variable_cleanup(Environment *_environment)
Emit source and configuration lines for variables.
char BANK_TYPE_AS_STRING[][16]
Description of BANK TYPE, in readable format.
#define DSTRING_DEFAULT_SPACE
void banks_generate(Environment *_environment)
void generate_cgoto_address_table(Environment *_environment)
void variable_on_memory_init(Environment *_environment, int _imported_too)
void end(Environment *_environment)
Emit ASM code for END.
struct _DataDataSegment * next
struct _DataSegment * next
Variable * tempResidentVariables
Bank * banks[BANK_TYPE_COUNT]
int maxExpansionBankSize[MAX_RESIDENT_SHAREDS]
Variable * tempVariables[MAX_PROCEDURES]
DataSegment * dataSegment
FILE * debuggerLabelsFile
TileDescriptors * descriptors
struct _MemoryArea * next
struct _Offsetting * next
OffsettingVariable * variables
struct _Variable * variable
struct _OffsettingVariable * next
struct _StaticString * next
unsigned char * valueBuffer
FloatTypePrecision precision
StaticString * valueString
#define out4(s, a, b, c, d)
#define deploy_inplace_preferred(s, e)
#define BANK_TYPE_COUNT
Maximum number of bank types.
#define MAX_TEMPORARY_STORAGE
struct _Offsetting Offsetting
#define MAX_RESIDENT_SHAREDS
struct _Variable Variable
Structure of a single variable.
#define outline2(s, a, b)
struct _Environment Environment
Structure of compilation environment.
struct _MemoryArea MemoryArea
struct _OffsettingVariable OffsettingVariable
#define outhead4(s, a, b, c, d)
#define outhead3(s, a, b, c)
struct _StaticString StaticString
Structure of a single (static) string.
#define outhead2(s, a, b)
#define CRITICAL_DATATYPE_UNSUPPORTED(k, v)
struct _DataDataSegment DataDataSegment
struct _DataSegment DataSegment
struct _Bank Bank
Structure of a single bank.
char DATATYPE_AS_STRING[][16]