56 switch( variable->
type ) {
191 memset(
string, 0, variable->
size + 1 );
197 for (i=0; i<(variable->
size-1); ++i ) {
198 if ( ( ( i + 1 ) % 16 ) == 0 ) {
215 memset(
string, 0, variable->
size + 1 );
221 for (i=0; i<(variable->
size-1); ++i ) {
249 for (i=0; i<(variable->
size-1); ++i ) {
253 }
else if ( variable->
value ) {
258 for(
int i=0; i<(variable->
size/4)-1; ++i ) {
259 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 ) );
261 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 ) );
267 for(
int i=0; i<(variable->
size/2)-1; ++i ) {
268 out2(
"$%2.2x, $%2.2x,", (
unsigned int)( ( variable->
value >> 8 ) & 0xff ), (
unsigned int)( variable->
value & 0xff ) );
270 out2(
"$%2.2x, $%2.2x", (
unsigned int)( ( variable->
value >> 8 ) & 0xff ), (
unsigned int)( variable->
value & 0xff ) );
299 variable = variable->
next;
319 switch( variable->
type ) {
327 if ( bitCount == 8 ) {
335 variable = variable->
next;
339 if ( bitCount > 0 ) {
368 actual = actual->
next;
379 for( i=0; i<actual->
count; ++i ) {
381 if ( i < ( actual->
count - 1 ) ) {
389 while( actualVariable ) {
395 actualVariable = actualVariable->
next;
407 actual = actual->
next;
416 values[count] = actual->
size;
418 sprintf( address[count],
"fs%4.4xoffsetframe", actual->
size );
419 actual = actual->
next;
442 variable_cleanup_entry( _environment, variable );
443 variable_cleanup_entry_bit( _environment, variable );
452 variable_cleanup_entry( _environment, variable );
453 variable_cleanup_entry_bit( _environment, variable );
458 variable_cleanup_entry( _environment, variable );
459 variable_cleanup_entry_bit( _environment, variable );
467 actual = actual->
next;
474 while( dataSegment ) {
476 if ( dataSegment->
data ) {
482 while( dataDataSegment ) {
483 if ( dataSegment->
type ) {
485 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
size) );
486 out1(
"\"%s\"", dataDataSegment->
data );
488 for( i=0; i<(dataDataSegment->
size-1); ++i ) {
489 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
491 out1(
"$%2.2x", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
495 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
type) );
496 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
size) );
497 out1(
"\"%s\"", dataDataSegment->
data );
499 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
type) );
500 for( i=0; i<(dataDataSegment->
size-1); ++i ) {
501 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
503 out1(
"$%2.2x", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
506 if ( dataDataSegment->
next && dataDataSegment->
size ) {
509 dataDataSegment = dataDataSegment->
next;
512 dataSegment = dataSegment->
next;
520 while( staticStrings ) {
521 outhead2(
"cstring%d fcb %d", staticStrings->
id, (
int)strlen(staticStrings->
value) );
522 if ( strlen( staticStrings->
value ) > 0 ) {
525 staticStrings = staticStrings->
next;
545 outhead1(
"BANKWINDOWID%2.2x fcb $FF, $FF", i );
551 outhead0(
"BITMASK fcb $01,$02,$04,$08,$10,$20,$40,$80");
552 outhead0(
"BITMASKN fcb $fe,$fd,$fb,$f7,$ef,$df,$bf,$7f");
570 outhead0(
"IRQSTACKEND fcb $00, 00");
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.
void plot(Environment *_environment, char *_x, char *_y, char *_c, int _preserve_color)
#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)
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 _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 CRITICAL_INVALID_PROGRAM_START(a)
#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 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]