Math works (more)!
This commit is contained in:
parent
ac72d8add8
commit
77eb521af4
|
@ -77,6 +77,8 @@ impl FasmCodegen {
|
|||
},
|
||||
// If the operator is division.
|
||||
MathOperator::OP_DIV => {
|
||||
asm_start.push_str("\tpop r10\n");
|
||||
asm_start.push_str("\tpop r11\n");
|
||||
asm_start.push_str("\tmov rax, r10\n");
|
||||
asm_start.push_str("\txor rdx, rdx\n");
|
||||
asm_start.push_str("\tidiv r11\n");
|
||||
|
@ -85,6 +87,8 @@ impl FasmCodegen {
|
|||
},
|
||||
// If the operators is subtraction.
|
||||
MathOperator::OP_SUB => {
|
||||
asm_start.push_str("\tpop r10\n");
|
||||
asm_start.push_str("\tpop r11\n");
|
||||
asm_start.push_str("\tsub r10, r11\n");
|
||||
asm_start.push_str("\tmov rax, r10\n");
|
||||
|
||||
|
@ -93,6 +97,8 @@ impl FasmCodegen {
|
|||
},
|
||||
// If the operator is modulo.
|
||||
MathOperator::OP_MOD => {
|
||||
asm_start.push_str("\tpop r10\n");
|
||||
asm_start.push_str("\tpop r11\n");
|
||||
asm_start.push_str("\tmov rax, r10\n");
|
||||
asm_start.push_str("\txor rdx, rdx\n");
|
||||
asm_start.push_str("\tidiv r11\n");
|
||||
|
|
Loading…
Reference in a new issue