extract assembling line
This commit is contained in:
parent
af0214739c
commit
0bdbaa7f1f
1
Makefile
1
Makefile
@ -8,7 +8,6 @@ C_FLAGS = \
|
||||
-Wall -Wextra -Wpedantic -Wconversion \
|
||||
-pedantic -pedantic-errors \
|
||||
-Wno-unused-variable \
|
||||
-Wno-unused-parameter \
|
||||
-I. \
|
||||
|
||||
L_FLAGS = -pthread
|
||||
|
@ -114,7 +114,7 @@ typedef struct {
|
||||
uint16_t offset;
|
||||
} Line;
|
||||
|
||||
uint16_t assemble_to_binary(
|
||||
uint16_t assemble_lines_with_labels(
|
||||
uint16_t* out, const Line* lines, size_t lines_size);
|
||||
|
||||
Line s_label(int label);
|
||||
|
@ -105,6 +105,7 @@ Line s_jnz_l(Reg op1_reg, int op2_label)
|
||||
{
|
||||
return (Line) {
|
||||
.ty = LineTy_Jnz_Label,
|
||||
.op1 = (Ex) { .reg = (uint16_t)op1_reg },
|
||||
.op2 = (Ex) { .label = op2_label },
|
||||
};
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
-pedantic
|
||||
-pedantic-errors
|
||||
-Wno-unused-variable
|
||||
-Wno-unused-parameter
|
||||
# -Wno-unused-parameter
|
||||
# -Wno-unused-function
|
||||
-I.
|
||||
|
||||
|
@ -203,7 +203,7 @@ void write_program(FILE* fp)
|
||||
|
||||
printf("assembling program...\n");
|
||||
uint16_t program_size
|
||||
= assemble_to_binary(program, program_asm, program_asm_size);
|
||||
= assemble_lines_with_labels(program, program_asm, program_asm_size);
|
||||
printf("done!\n");
|
||||
printf("program size = %d\n", program_size);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user