57 switch( variable->
type ) {
66 if ( strcmp( variable->
name,
"PEN" ) == 0 ) {
184 memset(
string, 0, variable->
size + 1 );
190 for (i=0; i<(variable->
size-1); ++i ) {
191 if ( ( ( i+1 ) % 16 ) == 0 ) {
208 memset(
string, 0, variable->
size + 1 );
214 for (i=0; i<(variable->
size-1); ++i ) {
233 if ( ( ( i + 1 ) % 8 ) == 0 ) {
259 memset(
string, 0, variable->
size + 1 );
265 for (i=0; i<(variable->
size-1); ++i ) {
266 if ( ( ( i+1 ) % 16 ) == 0 ) {
283 memset(
string, 0, variable->
size + 1 );
289 for (i=0; i<(variable->
size-1); ++i ) {
319 for (i=0; i<(variable->
size-1); ++i ) {
326 if ( variable->
value ) {
330 for(
int i=0; i<(variable->
size/4)-1; ++i ) {
331 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 ) );
333 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 ) );
339 for(
int i=0; i<(variable->
size/2)-1; ++i ) {
340 out2(
"$%2.2x, $%2.2x,", (
unsigned int)( variable->
value & 0xff ), (
unsigned int)( ( variable->
value >> 8 ) & 0xff ) );
342 out2(
"$%2.2x, $%2.2x", (
unsigned int)( variable->
value & 0xff ), (
unsigned int)( ( variable->
value >> 8 ) & 0xff ) );
373 variable = variable->
next;
378static void variable_cleanup_memory_mapped(
Environment * _environment,
Variable * _variable ) {
382 switch( _variable->
type ) {
385 if ( _variable->
value >= 32 ) {
395 if ( strcmp( _variable->
name,
"PEN" ) == 0 ) {
479 char *
string =
malloc( _variable->
size + 1 );
480 memset(
string, 0, _variable->
size + 1 );
486 for (i=0; i<(_variable->
size-1); ++i ) {
507 char *
string =
malloc( _variable->
size + 1 );
508 memset(
string, 0, _variable->
size + 1 );
514 for (i=0; i<(_variable->
size-1); ++i ) {
544 for (i=0; i<(_variable->
size-1); ++i ) {
545 out1(
"$%2.2x,", (
unsigned char) ( _variable->
valueBuffer[i] & 0xff ) );
551 if ( _variable->
value ) {
555 for(
int i=0; i<(_variable->
size/4)-1; ++i ) {
556 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 ) );
558 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 ) );
564 for(
int i=0; i<(_variable->
size/2)-1; ++i ) {
565 out2(
"$%2.2x, $%2.2x,", (
unsigned int)( _variable->
value & 0xff ), (
unsigned int)( ( _variable->
value >> 8 ) & 0xff ) );
567 out2(
"$%2.2x, $%2.2x", (
unsigned int)( _variable->
value & 0xff ), (
unsigned int)( ( _variable->
value >> 8 ) & 0xff ) );
592 if ( _variable->
strips ) {
614 switch( variable->
type ) {
622 if ( bitCount == 8 ) {
630 variable = variable->
next;
634 if ( bitCount > 0 ) {
657 out1(
"OFFSETS%4.4x: .word ", actual->
size );
658 for( i=0; i<actual->
count; ++i ) {
660 if ( i < ( actual->
count - 1 ) ) {
668 while( actualVariable ) {
674 actualVariable = actualVariable->
next;
695 actual = actual->
next;
704 values[count] = actual->
size;
706 sprintf( address[count],
"fs%4.4xsoffsetframe", actual->
size );
707 actual = actual->
next;
728 variable_cleanup_entry( _environment, variable );
729 variable_cleanup_entry_bit( _environment, variable );
737 variable_cleanup_entry( _environment, variable );
738 variable_cleanup_entry_bit( _environment, variable );
743 variable_cleanup_entry( _environment, variable );
744 variable_cleanup_entry_bit( _environment, variable );
752 actual = actual->
next;
773 while( memoryArea ) {
779 outhead1(
".segment \"MA%3.3x\"", memoryArea->
id );
780 for( i=memoryArea->
start; i<memoryArea->
end; ++i ) {
786 variable_cleanup_memory_mapped( _environment, variable );
790 variable = variable->
next;
798 variable_cleanup_memory_mapped( _environment, variable );
802 variable = variable->
next;
810 variable_cleanup_memory_mapped( _environment, variable );
814 variable = variable->
next;
817 memoryArea = memoryArea->
next;
828 outline0(
".byte $01,$08,$0b,$08,$00,$00,$9e" );
829 outline5(
".byte $%2.2x,$%2.2x,$%2.2x,$%2.2x,$%2.2x",
845 if ( lastAddress < actual->loadAddress + actual->
size ) {
848 actual = actual->
next;
875 outline0(
"STA C64REUBANKFILENAME+4" );
889 char * data =
malloc( 0x10000 );
890 memset( data, 0, 0x10000 );
893 while( dataSegment ) {
896 while( dataDataSegment ) {
897 if ( dataSegment->
type ) {
899 data[dataOffset] = (
unsigned char)(dataDataSegment->
size);
900 for( i=0; i<(dataDataSegment->
size); ++i ) {
901 unsigned char letter = (
unsigned char)(dataDataSegment->
data[i]&0xff);
902 if ( letter >=
'a' && letter <=
'z' ) {
903 letter = letter -
'a' +
'A';
904 }
else if ( letter >=
'a' && letter <=
'z' ) {
905 letter = letter -
'A' +
'a';
907 data[dataOffset+i+1] = letter;
909 dataOffset += ( dataDataSegment->
size + 1 );
911 for( i=0; i<(dataDataSegment->
size); ++i ) {
912 data[dataOffset+i] = (
unsigned char)(dataDataSegment->
data[i]&0xff);
914 dataOffset += ( dataDataSegment->
size );
918 data[dataOffset] = (
unsigned char)(dataDataSegment->
type);
919 data[dataOffset+1] = (
unsigned char)(dataDataSegment->
size);
920 for( i=0; i<(dataDataSegment->
size); ++i ) {
921 unsigned char letter = (
unsigned char)(dataDataSegment->
data[i]&0xff);
922 if ( letter >=
'a' && letter <=
'z' ) {
923 letter = letter -
'a' +
'A';
924 }
else if ( letter >=
'a' && letter <=
'z' ) {
925 letter = letter -
'A' +
'a';
927 data[dataOffset+i+2] = letter;
929 dataOffset += ( dataDataSegment->
size + 2 );
931 data[dataOffset] = (
unsigned char)(dataDataSegment->
type);
932 for( i=0; i<(dataDataSegment->
size); ++i ) {
933 data[dataOffset+i+1] = (
unsigned char)(dataDataSegment->
data[i]&0xff);
935 dataOffset += ( dataDataSegment->
size + 1 );
938 dataDataSegment = dataDataSegment->
next;
940 dataSegment = dataSegment->
next;
943 outhead1(
"DATABANKC = $%2.2x", dataBank );
944 outhead0(
"DATABANK: .byte DATABANKC");
946 outhead0(
"DATAFIRSTSEGMENT = $0000" );
954 actual = actual->
next;
966 while( staticStrings ) {
968 staticStrings = staticStrings->
next;
972 outhead0(
"BITMASK: .byte $01,$02,$04,$08,$10,$20,$40,$80");
973 outhead0(
"BITMASKN: .byte $fe,$fd,$fb,$f7,$ef,$df,$bf,$7f");
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.
#define DSTRING_DEFAULT_SPACE
int banks_store_data(Environment *_environment, char *_data, int _size)
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]
OutputFileType outputFileType
Variable * tempVariables[MAX_PROCEDURES]
DataSegment * dataSegment
FILE * debuggerLabelsFile
TileDescriptors * descriptors
int dataLastAbsoluteAddress
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 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 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]