Skip to main content
8 events
when toggle format what by license comment
Jun 17, 2020 at 9:04 history edited CommunityBot
Commonmark migration
May 18, 2018 at 23:39 history edited qwr CC BY-SA 4.0
added 178 characters in body
May 18, 2018 at 20:04 comment added Peter Cordes I'd be more inclined to have the caller pass a char*buf and produce the string in that, with manual formatting. e.g. like this (awkwardly optimized for speed) asm FizzBuzz, where I got string data into register and then stored it with mov, because the strings were short and fixed-length.
May 18, 2018 at 20:02 comment added Peter Cordes Yeah, int 0x80 in 32-bit code, or syscall in 64-bit code, to invoke sys_write, is the only good way. It's what I used for Extreme Fibonacci. In 64-bit code, __NR_write = 1 = STDOUT_FILENO, so you can mov eax, edi. Or if the upper bytes of EAX are zero, mov al, 4 in 32-bit code. You could also call printf or puts, I guess, and write a "x86 asm for Linux+glibc" answer. I think it's reasonable to not count the PLT or GOT entry space, or the library code itself.
May 18, 2018 at 19:23 comment added qwr @PeterCordes unrelated, what is the best way to print in x86? So far I've avoided challenges that require printing. DOS looks like it has useful interrupts for I/O but I am only planning on writing 32/64 bit answers. The only way I know of is int 0x80 which requires a bunch of setup.
May 18, 2018 at 5:05 comment added Peter Cordes I finally got around to posting my own answer on this question about making up calling conventions, and what's reasonable vs unreasonable.
Apr 6, 2018 at 22:10 history edited qwr CC BY-SA 3.0
added 114 characters in body
Apr 6, 2018 at 19:59 history answered qwr CC BY-SA 3.0