about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-10-02 13:34:19 -0700
committerKartik Agaram <vc@akkartik.com>2018-10-02 13:34:19 -0700
commit66aa96ecc74140e0f2f920deb47c12a7f6f6e515 (patch)
treeac07c415c27e4e7e33f3cb14085975318114a698
parent8871cd05a9d09ade1e61771661a126c43b4a7f02 (diff)
downloadmu-66aa96ecc74140e0f2f920deb47c12a7f6f6e515.tar.gz
4651
-rw-r--r--subx/apps/factorial.subx4
1 files changed, 3 insertions, 1 deletions
diff --git a/subx/apps/factorial.subx b/subx/apps/factorial.subx
index d223b692..49d71dd7 100644
--- a/subx/apps/factorial.subx
+++ b/subx/apps/factorial.subx
@@ -68,9 +68,11 @@ factorial:
   8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none              3/r32/EBX   8/disp8         .                 # copy *(EBP+8) to EBX
   81          5/subop/subtract    3/mod/direct    3/rm32/EBX    .           .             .           .           .               1/imm32           # subtract from EBX
   # EAX: factorial(n-1)
+    # push args
   53/push-EBX
+    # call
   e8/call                         .               .             .           .             .           .           factorial/disp32
-  # discard arg
+    # discard arg
   81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
   # return n * factorial(n-1)
   f7          4/subop/multiply    1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none                          8/disp8         .                 # multiply *(EBP+8) into EAX