Compare commits

..

No commits in common. "dd8c65ef79645f2337550946035060f0cfd7c6cd" and "ee162a70ed4d7bffaf3d869edfe0aef0ca672872" have entirely different histories.

2 changed files with 6 additions and 13 deletions

View File

@ -3,12 +3,5 @@ Example of self-repeating code section
*/ */
.main: .main:
//TODO loop example
.loop exit
const8 datum "ITERATION!!! "
movc ax 1
movc bx 1
movc cx @datum
movc dx #datum
sys
jmp @loop

View File

@ -148,6 +148,10 @@ static bool compileBinary(Compiler* cmp){
for(u32 i = 0; i < cmp->binary.section_list.len; i++){ for(u32 i = 0; i < cmp->binary.section_list.len; i++){
CompiledSection* sec = &cmp->binary.section_list.data[i]; CompiledSection* sec = &cmp->binary.section_list.data[i];
total_size += sec->bytes.len; total_size += sec->bytes.len;
if(str_equals(sec->name, main_sec_name))
continue;
prev_sec->next = sec;
sec->offset = prev_sec->offset + prev_sec->bytes.len;
ConstDataProps cd = ConstDataProps_construct(sec->name, sec->bytes.len, sec->offset); ConstDataProps cd = ConstDataProps_construct(sec->name, sec->bytes.len, sec->offset);
if(!HashMap_ConstDataProps_tryPush(&cmp->binary.const_data_map, cd.name, cd)){ if(!HashMap_ConstDataProps_tryPush(&cmp->binary.const_data_map, cd.name, cd)){
@ -161,10 +165,6 @@ static bool compileBinary(Compiler* cmp){
} }
} }
if(str_equals(sec->name, main_sec_name))
continue;
prev_sec->next = sec;
sec->offset = prev_sec->offset + prev_sec->bytes.len;
prev_sec = sec; prev_sec = sec;
} }