57 switch( variable->
type ) {
180 memset(
string, 0, variable->
size + 1 );
186 for (i=0; i<(variable->
size-1); ++i ) {
187 if ( ( ( i+1 ) % 16 ) == 0 ) {
204 memset(
string, 0, variable->
size + 1 );
210 for (i=0; i<(variable->
size-1); ++i ) {
229 if ( ( ( i + 1 ) % 8 ) == 0 ) {
255 memset(
string, 0, variable->
size + 1 );
261 for (i=0; i<(variable->
size-1); ++i ) {
262 if ( ( ( i+1 ) % 16 ) == 0 ) {
279 memset(
string, 0, variable->
size + 1 );
285 for (i=0; i<(variable->
size-1); ++i ) {
315 for (i=0; i<(variable->
size-1); ++i ) {
322 if ( variable->
value ) {
326 for(
int i=0; i<(variable->
size/4)-1; ++i ) {
327 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 ) );
329 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 ) );
335 for(
int i=0; i<(variable->
size/2)-1; ++i ) {
336 out2(
"$%2.2x, $%2.2x,", (
unsigned int)( variable->
value & 0xff ), (
unsigned int)( ( variable->
value >> 8 ) & 0xff ) );
338 out2(
"$%2.2x, $%2.2x", (
unsigned int)( variable->
value & 0xff ), (
unsigned int)( ( variable->
value >> 8 ) & 0xff ) );
368 variable = variable->
next;
373static void variable_cleanup_memory_mapped(
Environment * _environment,
Variable * _variable ) {
377 switch( _variable->
type ) {
380 if ( _variable->
value >= 32 ) {
467 char *
string =
malloc( _variable->
size + 1 );
468 memset(
string, 0, _variable->
size + 1 );
474 for (i=0; i<(_variable->
size-1); ++i ) {
495 char *
string =
malloc( _variable->
size + 1 );
496 memset(
string, 0, _variable->
size + 1 );
502 for (i=0; i<(_variable->
size-1); ++i ) {
532 for (i=0; i<(_variable->
size-1); ++i ) {
533 out1(
"$%2.2x,", (
unsigned char) ( _variable->
valueBuffer[i] & 0xff ) );
539 if ( _variable->
value ) {
543 for(
int i=0; i<(_variable->
size/4)-1; ++i ) {
544 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 ) );
546 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 ) );
552 for(
int i=0; i<(_variable->
size/2)-1; ++i ) {
553 out2(
"$%2.2x, $%2.2x,", (
unsigned int)( _variable->
value & 0xff ), (
unsigned int)( ( _variable->
value >> 8 ) & 0xff ) );
555 out2(
"$%2.2x, $%2.2x", (
unsigned int)( _variable->
value & 0xff ), (
unsigned int)( ( _variable->
value >> 8 ) & 0xff ) );
579 if ( _variable->
strips ) {
600 switch( variable->
type ) {
608 if ( bitCount == 8 ) {
616 variable = variable->
next;
620 if ( bitCount > 0 ) {
649 actual = actual->
next;
651 outline0(
".word $ffff, DATAPTRE" );
658 out1(
"OFFSETS%4.4x: .word ", actual->
size );
659 for( i=0; i<actual->
count; ++i ) {
661 if ( i < ( actual->
count - 1 ) ) {
669 while( actualVariable ) {
675 actualVariable = actualVariable->
next;
696 actual = actual->
next;
705 values[count] = actual->
size;
707 sprintf( address[count],
"fs%4.4xsoffsetframe", actual->
size );
708 actual = actual->
next;
731 variable_cleanup_entry( _environment, variable );
732 variable_cleanup_entry_bit( _environment, variable );
739 outhead0(
"BITMASK: .byte $01,$02,$04,$08,$10,$20,$40,$80");
740 outhead0(
"BITMASKN: .byte $fe,$fd,$fb,$f7,$ef,$df,$bf,$7f");
748 variable_cleanup_entry( _environment, variable );
749 variable_cleanup_entry_bit( _environment, variable );
754 variable_cleanup_entry( _environment, variable );
755 variable_cleanup_entry_bit( _environment, variable );
763 actual = actual->
next;
784 while( memoryArea ) {
790 outhead1(
".segment \"MA%3.3x\"", memoryArea->
id );
791 for( i=memoryArea->
start; i<memoryArea->
end; ++i ) {
797 variable_cleanup_memory_mapped( _environment, variable );
801 variable = variable->
next;
809 variable_cleanup_memory_mapped( _environment, variable );
813 variable = variable->
next;
821 variable_cleanup_memory_mapped( _environment, variable );
825 variable = variable->
next;
828 memoryArea = memoryArea->
next;
839 outline0(
".byte $01,$1c,$0b,$1c,$00,$00,$9e");
840 outline5(
".byte $%2.2x,$%2.2x,$%2.2x,$%2.2x,$%2.2x",
877 if ( lastAddress < actual->loadAddress + actual->
size ) {
880 actual = actual->
next;
907 while( dataSegment ) {
909 if ( dataSegment->
data ) {
915 while( dataDataSegment ) {
918 for(
int j=0; j<dataDataSegment->
size; ++j ) {
919 if (dataDataSegment->
data[j] == 34 || dataDataSegment->
data[j] < 32 || dataDataSegment->
data[j] > 128 ) {
924 if ( dataSegment->
type ) {
927 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
size) );
928 for( i=0; i<(dataDataSegment->
size-1); ++i ) {
929 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
931 out1(
"$%2.2x", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
933 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
size) );
934 out1(
"\"%s\"", dataDataSegment->
data );
937 for( i=0; i<(dataDataSegment->
size-1); ++i ) {
938 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
940 out1(
"$%2.2x", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
945 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
type) );
946 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
size) );
947 for( i=0; i<(dataDataSegment->
size-1); ++i ) {
948 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
950 out1(
"$%2.2x", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
952 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
type) );
953 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
size) );
954 out1(
"\"%s\"", dataDataSegment->
data );
957 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
type) );
958 for( i=0; i<(dataDataSegment->
size-1); ++i ) {
959 out1(
"$%2.2x,", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
961 out1(
"$%2.2x", (
unsigned char)(dataDataSegment->
data[i]&0xff) );
964 dataDataSegment = dataDataSegment->
next;
965 if ( dataDataSegment ) {
970 dataSegment = dataSegment->
next;
978 while( staticStrings ) {
980 staticStrings = staticStrings->
next;
985 outhead1(
"BANKWINDOWID%2.2x: .byte $FF, $FF", i );
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)
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 chain(Environment *_environment, char *_filename)
void dload(Environment *_environment, char *_filename, char *_offset, char *_address, char *_bank, char *_size)
Emit code for DLOAD(...).
void dsave(Environment *_environment, char *_filename, char *_offset, char *_address, char *_size)
Emit code for DLOAD(...).
#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 console(Environment *_environment, int _x1, int _y1, int _x2, int _y2)
Emit code for CONSOLE.
void end(Environment *_environment)
Emit ASM code for END.
unsigned char src_hw_vic2_vscroll_text_up_asm[]
unsigned char src_hw_vic2_vars_asm[]
unsigned char src_hw_vic2_hscroll_text_asm[]
unsigned char src_hw_vic2_vscroll_text_down_asm[]
unsigned char src_hw_vic2_console_asm[]
unsigned char src_hw_vic2_startup_asm[]
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
NumberConfig numberConfig
TileDescriptors * descriptors
struct _MemoryArea * next
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
#define CRITICAL_CANNOT_LOAD_SID_FILE_NO_SPACE()
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 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
#define outline5(s, a, b, c, d, e)
struct _DataSegment DataSegment
struct _Bank Bank
Structure of a single bank.
char DATATYPE_AS_STRING[][16]