56 switch( variable->
type ) {
191 memset(
string, 0, variable->
size + 1 );
197 for (i=0; i<(variable->
size-1); ++i ) {
210 memset(
string, 0, variable->
size + 1 );
216 for (i=0; i<(variable->
size-1); ++i ) {
232 for (i=0; i<(variable->
size-1); ++i ) {
236 if ( variable->
size & 0x01 ) {
241 }
else if ( variable->
value ) {
246 for(
int i=0; i<(variable->
size/4)-1; ++i ) {
247 out4(
"$%2.2x, $%2.2x, $%2.2x, $%2.2x, ", (
unsigned int)( ( variable->
value >> 24 ) & 0xff ), (
unsigned int)( ( variable->
value >> 16 ) & 0xff ), (
unsigned int)( ( variable->
value >> 8 ) & 0xff ), (
unsigned int)( variable->
value & 0xff ) );
249 out4(
"$%2.2x, $%2.2x, $%2.2x, $%2.2x", (
unsigned int)( ( variable->
value >> 24 ) & 0xff ), (
unsigned int)( ( variable->
value >> 16 ) & 0xff ), (
unsigned int)( ( variable->
value >> 8 ) & 0xff ), (
unsigned int)( variable->
value & 0xff ) );
255 for(
int i=0; i<(variable->
size/2)-1; ++i ) {
256 out2(
"$%2.2x, $%2.2x,", (
unsigned int)( ( variable->
value >> 8 ) & 0xff ), (
unsigned int)( variable->
value & 0xff ) );
258 out2(
"$%2.2x, $%2.2x", (
unsigned int)( ( variable->
value >> 8 ) & 0xff ), (
unsigned int)( variable->
value & 0xff ) );
273 if ( variable->
size & 0x01 ) {
287 if ( variable->
size & 0x01 ) {
297 if ( variable->
size & 0x01 ) {
319 variable = variable->
next;
339 switch( variable->
type ) {
347 if ( bitCount == 8 ) {
355 variable = variable->
next;
359 if ( bitCount > 0 ) {
388 actual = actual->
next;
400 for( i=0; i<actual->
count; ++i ) {
402 if ( i < ( actual->
count - 1 ) ) {
409 if ( actual->
count == 1 ) {
411 while( actualVariable ) {
417 actualVariable = actualVariable->
next;
424 while( actualVariable ) {
430 actualVariable = actualVariable->
next;
443 actual = actual->
next;
452 values[count] = actual->
size;
454 sprintf( address[count],
"fs%4.4xoffsetframe", actual->
size );
455 actual = actual->
next;
474 variable_cleanup_entry( _environment, variable );
475 variable_cleanup_entry_bit( _environment, variable );
484 variable_cleanup_entry( _environment, variable );
485 variable_cleanup_entry_bit( _environment, variable );
490 variable_cleanup_entry( _environment, variable );
491 variable_cleanup_entry_bit( _environment, variable );
499 actual = actual->
next;
523 while( dataSegment ) {
525 if ( dataSegment->
data ) {
531 while( dataDataSegment ) {
532 if ( dataSegment->
type ) {
534 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
size) );
535 out1(
"\"%s\"", dataDataSegment->
data );
537 for( i=0; i<(dataDataSegment->
size-1); ++i ) {
538 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
540 out1(
"$%2.2x", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
544 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
type) );
545 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
size) );
546 out1(
"\"%s\"", dataDataSegment->
data );
548 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
type) );
549 for( i=0; i<(dataDataSegment->
size-1); ++i ) {
550 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
552 out1(
"$%2.2x", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
555 dataDataSegment = dataDataSegment->
next;
556 if ( dataDataSegment ) {
561 dataSegment = dataSegment->
next;
569 while( staticStrings ) {
570 outhead2(
"cstring%d fcb %d", staticStrings->
id, (
int)strlen(staticStrings->
value) );
571 if ( strlen( staticStrings->
value ) > 0 ) {
574 staticStrings = staticStrings->
next;
578 outhead0(
"BITMASK fcb $01,$02,$04,$08,$10,$20,$40,$80");
579 outhead0(
"BITMASKN fcb $fe,$fd,$fb,$f7,$ef,$df,$bf,$7f");
598 outhead1(
"BANKWINDOWID%2.2x fcb $FF, $FF", i );
630 int realBank = ( ( bank->
id & 0xfc ) << 2 ) | ( bank->
id & 0x03 );
631 realBank = realBank | 0x0c;
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_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)
void vars_emit_byte(Environment *_environment, char *_name, int _value)
void buffered_prepend_output(Environment *_environment)
char * escape_newlines(char *_string)
void buffered_push_output(Environment *_environment)
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 generate_cgoto_address_table(Environment *_environment)
void variable_on_memory_init(Environment *_environment, int _imported_too)
struct _DataDataSegment * next
struct _DataSegment * next
Variable * tempResidentVariables
BankAccessOptimization bankAccessOptimization
Bank * banks[BANK_TYPE_COUNT]
int maxExpansionBankSize[MAX_RESIDENT_SHAREDS]
Variable * tempVariables[MAX_PROCEDURES]
DataSegment * dataSegment
FILE * debuggerLabelsFile
TileDescriptors * descriptors
struct _Offsetting * next
OffsettingVariable * variables
struct _Variable * variable
struct _OffsettingVariable * next
struct _StaticString * next
unsigned char * valueBuffer
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 _OffsettingVariable OffsettingVariable
#define deploy_preferred(s, e)
#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]