flat assembler
Message board for the users of flat assembler.
Index
> MenuetOS > subroutine int2asc |
Author |
|
CandyMan 21 Dec 2017, 11:51
Code: int2asc: ; function to convert int to ascii ; args in: integer(RDI), ptr buffer(RSI) xchg rdi,rsi mov rax,rsi mov r15d,10 np: xor edx,edx div r15 add dl,48 mov [rdi],dl inc rdi or rax,rax jnz np ret stack frame and "dec rax" is unnecessary _________________ smaller is better |
|||
21 Dec 2017, 11:51 |
|
C.H.R 21 Dec 2017, 21:56
Thanks CandyMan. I will test it inmediatly. Thanks for the push.
|
|||
21 Dec 2017, 21:56 |
|
tthsqe 22 Dec 2017, 06:12
It looks like CandyMan reads the digits backwards or has quite a unique system.
Code: PrintUnsignedInteger: ; in: rax unsigned integer ; io: rdi string mov ecx, 10 mov r8, rsp .l1: xor edx, edx div rcx push rdx test rax, rax jnz .l1 .l2: pop rax add al, '0' stosb cmp rsp, r8 jb .l2 ret |
|||
22 Dec 2017, 06:12 |
|
revolution 22 Dec 2017, 08:41
tthsqe wrote: It looks like CandyMan reads the digits backwards or has quite a unique system. |
|||
22 Dec 2017, 08:41 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.