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 \
|
-Wall -Wextra -Wpedantic -Wconversion \
|
||||||
-pedantic -pedantic-errors \
|
-pedantic -pedantic-errors \
|
||||||
-Wno-unused-variable \
|
-Wno-unused-variable \
|
||||||
-Wno-unused-parameter \
|
|
||||||
-I. \
|
-I. \
|
||||||
|
|
||||||
L_FLAGS = -pthread
|
L_FLAGS = -pthread
|
||||||
|
@ -114,7 +114,7 @@ typedef struct {
|
|||||||
uint16_t offset;
|
uint16_t offset;
|
||||||
} Line;
|
} Line;
|
||||||
|
|
||||||
uint16_t assemble_to_binary(
|
uint16_t assemble_lines_with_labels(
|
||||||
uint16_t* out, const Line* lines, size_t lines_size);
|
uint16_t* out, const Line* lines, size_t lines_size);
|
||||||
|
|
||||||
Line s_label(int label);
|
Line s_label(int label);
|
||||||
|
@ -105,6 +105,7 @@ Line s_jnz_l(Reg op1_reg, int op2_label)
|
|||||||
{
|
{
|
||||||
return (Line) {
|
return (Line) {
|
||||||
.ty = LineTy_Jnz_Label,
|
.ty = LineTy_Jnz_Label,
|
||||||
|
.op1 = (Ex) { .reg = (uint16_t)op1_reg },
|
||||||
.op2 = (Ex) { .label = op2_label },
|
.op2 = (Ex) { .label = op2_label },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
-pedantic
|
-pedantic
|
||||||
-pedantic-errors
|
-pedantic-errors
|
||||||
-Wno-unused-variable
|
-Wno-unused-variable
|
||||||
-Wno-unused-parameter
|
# -Wno-unused-parameter
|
||||||
# -Wno-unused-function
|
# -Wno-unused-function
|
||||||
-I.
|
-I.
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ void write_program(FILE* fp)
|
|||||||
|
|
||||||
printf("assembling program...\n");
|
printf("assembling program...\n");
|
||||||
uint16_t program_size
|
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("done!\n");
|
||||||
printf("program size = %d\n", program_size);
|
printf("program size = %d\n", program_size);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user