Skip to content

Commit

Permalink
declare all used registers so they can be typed in the future
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-johnson-4 committed Jan 3, 2024
1 parent d6aa869 commit 5de1c49
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions stdlib/helpers.lm
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
# }

# bootstrap register allocation
# r12 , r13 , r14 , r15 : open this
# rbx , rsp : closed reference 1, 2
# r8, r9, r10, r11 : volatile internal registers
# r12 , r13 , r14 , r15 : open this
# rbx , rsp : closed reference 1, 2
# r8, r9, r10, r11, rax, rcx : volatile internal registers

# put8 (%r8 bool[4], %r9: *char)
::put8 := (
\t mov %r8b, %axl \n # lower byte of %r11 goes into %rax
\t and $0xf, %axl \n # only show lower 4 bits
\t mov $__hex_buffer, %r10 \n # %r10 is index into hex buffer
\t add %axl, %r10b \n # %r10 is index into char in hex buffer
\t mov 0(%r10), %sil \n # %sil is a hexadecimal char
\t mov %sil, 0(%r9) \n # write char into buffer
\t mov 0(%r10), %cxl \n # %sil is a hexadecimal char
\t mov %cxl, 0(%r9) \n # write char into buffer
\t inc %r9 \n
);

Expand Down

0 comments on commit 5de1c49

Please sign in to comment.