diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-12-08 13:56:46 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-12-08 23:31:05 -0800 |
commit | 2a2a5b1e43b6aa650a41ab1ec68d9778c14cb649 (patch) | |
tree | 734619639755cf5b95490bdc4362bbef0a504881 /075print-int-decimal.subx | |
parent | a93cd189c95fc82a8f1db4e42e5f278bc642bb0c (diff) | |
download | mu-2a2a5b1e43b6aa650a41ab1ec68d9778c14cb649.tar.gz |
5804
Try to make the comments consistent with the type system we'll eventually have.
Diffstat (limited to '075print-int-decimal.subx')
-rw-r--r-- | 075print-int-decimal.subx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/075print-int-decimal.subx b/075print-int-decimal.subx index a9cfa5fc..8e8c7da4 100644 --- a/075print-int-decimal.subx +++ b/075print-int-decimal.subx @@ -5,7 +5,7 @@ # . op subop mod rm32 base index scale r32 # . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes -print-int32-decimal: # out : (address stream), n : int32 +print-int32-decimal: # out : (address stream byte), n : int32 # works by generating characters from lowest to highest and pushing them # to the stack, before popping them one by one into the stream # @@ -44,11 +44,11 @@ print-int32-decimal: # out : (address stream), n : int32 52/push-edx 53/push-ebx 57/push-edi - # ten/ecx = 10 + # const ten/ecx = 10 b9/copy-to-ecx 0xa/imm32 # push sentinel 68/push 0/imm32/sentinel - # eax = abs(n) + # var eax : int = abs(n) 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 . # copy *(ebp+12) to eax 3d/compare-eax-with 0/imm32 7d/jump-if-greater-or-equal $print-int32-decimal:read-loop/disp8 @@ -74,11 +74,11 @@ $print-int32-decimal:push-negative: $print-int32-decimal:write: # edi = out 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi - # w/edx = out->write + # var w/edx : int = out->write 8b/copy 0/mod/indirect 7/rm32/edi . . . 2/r32/edx . . # copy *edi to edx - # curr/ecx = &out->data[out->write] + # var curr/ecx : (address byte) = &out->data[out->write] 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 2/index/edx . 1/r32/ecx 0xc/disp8 . # copy ebx+edx+12 to ecx - # max/ebx = &out->data[out->length] + # var max/ebx : (address byte) = &out->data[out->length] 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 8/disp8 . # copy *(edi+8) to ebx 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 3/index/ebx . 3/r32/ebx 0xc/disp8 . # copy edi+ebx+12 to ebx $print-int32-decimal:write-loop: |