diff options
Diffstat (limited to 'subx/ex7.subx')
-rw-r--r-- | subx/ex7.subx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/subx/ex7.subx b/subx/ex7.subx index 07b2e016..b386df82 100644 --- a/subx/ex7.subx +++ b/subx/ex7.subx @@ -38,7 +38,7 @@ factorial: b8/copy . . . . . . . 1/imm32 # copy 1 to EAX # if (n <= 1) jump exit 81 7/subop/compare 3/mod/direct 2/rm32/EDX . . . . . 1/imm32 # compare EDX with 1 - 7e/jump-if-<= . . . . . . factorial:exit/disp8 # jump if <= to exit + 7e/jump-if-<= . . . . . . $exit/disp8 # jump if <= to $exit # EBX: n-1 89/copy 3/mod/direct 3/rm32/EBX . . . 2/r32/EDX . . # copy EDX to EBX 81 5/subop/subtract 3/mod/direct 3/rm32/EBX . . . . . 1/imm32 # subtract 1 from EBX @@ -58,7 +58,7 @@ factorial: # return n * factorial(n-1) 0f af/multiply 3/mod/direct 2/rm32/EDX . . . 0/r32/EAX . . # multiply EDX (n) into EAX (factorial(n-1)) # TODO: check for overflow -factorial:exit: +$exit: c3/return # vim:ft=subx:nowrap:so=0 |