Fixed wrong instruction data label offsets.
1 files changed, 30 insertions(+), 19 deletions(-)

M jasm/processor/45gs02/processor_45gs02.cpp
M jasm/processor/45gs02/processor_45gs02.cpp +30 -19
@@ 877,11 877,12 @@ const SyntaxToken *Processor45gs02::pars
 				assembler._hex_source_writer->write_data(static_cast<uint32_t>(assembler._program_counter.integer_value), &data[data.size() - 2], increase, 2, instruction_token.source_location.file_index, instruction_token.source_location.row, instruction_token.source_location.row + 1);
 			}
 		}
+		uint8_t isize = instruction_size(instruction, AddressingModeType::Immediate);
 		if (UNLIKELY(instruction_token.has_instruction_data_label[0])) {
-			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + 1, 0, 1);
+			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + isize, 0, 1);
 		}
 
-		assembler._program_counter.integer_value += instruction_size(instruction, AddressingModeType::Immediate) + 1;
+		assembler._program_counter.integer_value += isize + 1;
 		return t;
 	}
 	if (addr_mode == AddressingModeMask::ImmW) {

          
@@ 901,11 902,12 @@ const SyntaxToken *Processor45gs02::pars
 				assembler._hex_source_writer->write_data(static_cast<uint32_t>(assembler._program_counter.integer_value), &data[data.size() - 3], increase, 3, instruction_token.source_location.file_index, instruction_token.source_location.row, instruction_token.source_location.row + 1);
 			}
 		}
+		uint8_t isize = instruction_size(instruction, AddressingModeType::ImmediateWord);
 		if (UNLIKELY(instruction_token.has_instruction_data_label[0])) {
-			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + 1, 0, 2);
+			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + isize, 0, 2);
 		}
 
-		assembler._program_counter.integer_value += instruction_size(instruction, AddressingModeType::ImmediateWord) + 2;
+		assembler._program_counter.integer_value += isize + 2;
 		return t;
 	}
 

          
@@ 957,10 959,11 @@ const SyntaxToken *Processor45gs02::pars
 				assembler._hex_source_writer->write_data(static_cast<uint32_t>(assembler._program_counter.integer_value), &data[data.size() - 2], increase, 2, instruction_token.source_location.file_index, instruction_token.source_location.row, instruction_token.source_location.row + 1);
 			}
 		}
+		uint8_t isize = instruction_size(instruction, mask_to_addressing_mode(addr_mode));
 		if (UNLIKELY(instruction_token.has_instruction_data_label[0])) {
-			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + 1, 0, 1);
+			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + isize, 0, 1);
 		}
-		assembler._program_counter.integer_value += instruction_size(instruction, mask_to_addressing_mode(addr_mode)) + 1;
+		assembler._program_counter.integer_value += isize + 1;
 		return t;
 	}
 

          
@@ 986,10 989,11 @@ const SyntaxToken *Processor45gs02::pars
 				assembler._hex_source_writer->write_data(static_cast<uint32_t>(assembler._program_counter.integer_value), &data[data.size() - 3], increase, 3, instruction_token.source_location.file_index, instruction_token.source_location.row, instruction_token.source_location.row + 1);
 			}
 		}
+		uint8_t isize = instruction_size(instruction, mask_to_addressing_mode(addr_mode));
 		if (UNLIKELY(instruction_token.has_instruction_data_label[0])) {
-			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + 1, 0, 2);
+			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + isize, 0, 2);
 		}
-		assembler._program_counter.integer_value += instruction_size(instruction, mask_to_addressing_mode(addr_mode)) + 2;
+		assembler._program_counter.integer_value += isize + 2;
 		return t;
 	}
 

          
@@ 1012,10 1016,11 @@ const SyntaxToken *Processor45gs02::pars
 				assembler._hex_source_writer->write_data(static_cast<uint32_t>(assembler._program_counter.integer_value), &data[data.size() - 2], increase, 2, instruction_token.source_location.file_index, instruction_token.source_location.row, instruction_token.source_location.row + 1);
 			}
 		}
+		uint8_t isize = instruction_size(instruction, mask_to_addressing_mode(addr_mode));
 		if (UNLIKELY(instruction_token.has_instruction_data_label[0])) {
-			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + 1, 0, 1);
+			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + isize, 0, 1);
 		}
-		assembler._program_counter.integer_value += instruction_size(instruction, mask_to_addressing_mode(addr_mode)) + 1;
+		assembler._program_counter.integer_value += isize + 1;
 		return t;
 	}
 	if (addr_mode == AddressingModeMask::RelW) {

          
@@ 1036,10 1041,11 @@ const SyntaxToken *Processor45gs02::pars
 				assembler._hex_source_writer->write_data(static_cast<uint32_t>(assembler._program_counter.integer_value), &data[data.size() - 3], increase, 3, instruction_token.source_location.file_index, instruction_token.source_location.row, instruction_token.source_location.row + 1);
 			}
 		}
+		uint8_t isize = instruction_size(instruction, mask_to_addressing_mode(addr_mode));
 		if (UNLIKELY(instruction_token.has_instruction_data_label[0])) {
-			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + 1, 0, 2);
+			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 0, assembler._program_counter.integer_value + isize, 0, 2);
 		}
-		assembler._program_counter.integer_value += instruction_size(instruction, mask_to_addressing_mode(addr_mode)) + 2;
+		assembler._program_counter.integer_value += isize + 2;
 		return t;
 	}
 

          
@@ 1087,10 1093,6 @@ const SyntaxToken *Processor45gs02::pars
 		}
 	}
 	
-	if (UNLIKELY(instruction_token.has_instruction_data_label[1])) {
-		generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 1, assembler._program_counter.integer_value + 1, 0, 1);
-	}
-
 	if (addr_mode == AddressingModeMask::Bb) {
 		if (generate) {
 			auto &data = assembler._section->generated_data(ending_instruction);

          
@@ 1102,7 1104,12 @@ const SyntaxToken *Processor45gs02::pars
 				assembler._hex_source_writer->write_data(static_cast<uint32_t>(assembler._program_counter.integer_value), &data[data.size() - 2], increase, 2, instruction_token.source_location.file_index, instruction_token.source_location.row, instruction_token.source_location.row + 1);
 			}
 		}
-		assembler._program_counter.integer_value += instruction_size(instruction, mask_to_addressing_mode(addr_mode)) + 1;
+		uint8_t isize = instruction_size(instruction, mask_to_addressing_mode(addr_mode));
+		if (UNLIKELY(instruction_token.has_instruction_data_label[1])) {
+			generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 1, assembler._program_counter.integer_value + isize, 0, 1);
+		}
+
+		assembler._program_counter.integer_value += isize + 1;
 		return t;
 	}
 

          
@@ 1142,10 1149,14 @@ const SyntaxToken *Processor45gs02::pars
 			assembler._hex_source_writer->write_data(static_cast<uint32_t>(assembler._program_counter.integer_value), &data[data.size() - 3], increase, 3, instruction_token.source_location.file_index, instruction_token.source_location.row, instruction_token.source_location.row + 1);
 		}
 	}
+	uint8_t isize = instruction_size(instruction, mask_to_addressing_mode(addr_mode));
+	if (UNLIKELY(instruction_token.has_instruction_data_label[1])) {
+		generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 1, assembler._program_counter.integer_value + isize, 0, 1);
+	}
 	if (UNLIKELY(instruction_token.has_instruction_data_label[2])) {
-		generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 2, assembler._program_counter.integer_value + 2, 0, 1);
+		generate_instruction_data_label(assembler, generate, export_enabled, instruction_token, 2, assembler._program_counter.integer_value + isize + 1, 0, 1);
 	}
-	assembler._program_counter.integer_value += instruction_size(instruction, mask_to_addressing_mode(addr_mode)) + 2;
+	assembler._program_counter.integer_value += isize + 2;
 	return t;
 }