4 added 1 character in body
source | link

I can't find anywhere online to compile and run a mix of C++ and nasm source code, so I might write some small wrapper code for this to prove it works.I can't find anywhere online to compile and run a mix of C++ and nasm source code, so I might write some small wrapper code for this to prove it works. Otherwise you should be able to compile and run this with the makefile in the link I gave with the command:

I can't find anywhere online to compile and run a mix of C++ and nasm source code, so I might write some small wrapper code for this to prove it works. Otherwise you should be able to compile and run this with the makefile in the link I gave with the command:

I can't find anywhere online to compile and run a mix of C++ and nasm source code, so I might write some small wrapper code for this to prove it works. Otherwise you should be able to compile and run this with the makefile in the link I gave with the command:

3 added 1398 characters in body
source | link

I was able to format the assembly to something acceptable by gcc, so try it online!

I was able to format the assembly to something acceptable by gcc, so try it online!

2 deleted 311 characters in body
source | link
0000000000004ae00000000000000000 <oreo_asm>:
    4ae00:       56                      push   %rsi
    4ae11:       57                      push   %rdi

0000000000004ae20000000000000002 <len>:
    4ae22:       48 ff c7                inc    %rdi
    4ae55:       80 3f 00                cmpb   $0x0,(%rdi)
    4ae88:       75 f8                   jne    4ae22 <len>
    4aeaa:       49 89 fc                mov    %rdi,%r12
    4aedd:       5f                      pop    %rdi
    4aeee:       49 29 fc                sub    %rdi,%r12
    4af111:       4d 31 f6                xor    %r14,%r14
    4af414:       eb 18                   jmp    4b0e2e <outer_loop.skip>

0000000000004af60000000000000016 <extra>:
    4af616:       41 c6 01 20             movb   $0x20,(%r9)
    4afa1a:       c6 03 20                movb   $0x20,(%rbx)
    4afd1d:       49 ff ce                dec    %r14
    4b0020:       eb 06                   jmp    4b0828 <outer_loop>

0000000000004b020000000000000022 <newline>:
    4b0222:       c6 06 0a                movb   $0xa,(%rsi)
    4b0525:       48 ff c6                inc    %rsi

0000000000004b080000000000000028 <outer_loop>:
    4b0828:       49 ff c6                inc    %r14
    4b0b2b:       48 ff c7                inc    %rdi

0000000000004b0e000000000000002e <outer_loop.skip>:
    4b0e2e:       44 8a 07                mov    (%rdi),%r8b
    4b1131:       41 80 f8 65             cmp    $0x65,%r8b
    4b1535:       74 df                   je     4af616 <extra>
    4b1737:       45 84 c0                test   %r8b,%r8b
    4b1a3a:       74 23                   je     4b3f5f <done>
    4b1c3c:       48 89 f3                mov    %rsi,%rbx

0000000000004b1f000000000000003f <inner_loop>:
    4b1f3f:       44 88 06                mov    %r8b,(%rsi)
    4b2242:       49 89 f1                mov    %rsi,%r9
    4b2545:       48 ff c6                inc    %rsi
    4b2848:       48 31 d2                xor    %rdx,%rdx
    4b2b4b:       48 89 f0                mov    %rsi,%rax
    4b2e4e:       48 2b 04 24             sub    (%rsp),%rax
    4b3252:       4c 29 f0                sub    %r14,%rax
    4b3555:       49 f7 f4                div    %r12
    4b3858:       48 85 d2                test   %rdx,%rdx
    4b3b5b:       74 c5                   je     4b0222 <newline>
    4b3d5d:       eb e0                   jmp    4b1f3f <inner_loop>

0000000000004b3f000000000000005f <done>:
    4b3f5f:       5e                      pop    %rsi
    4b4060:       c3                      retq
0000000000004ae0 <oreo_asm>:
    4ae0:       56                      push   %rsi
    4ae1:       57                      push   %rdi

0000000000004ae2 <len>:
    4ae2:       48 ff c7                inc    %rdi
    4ae5:       80 3f 00                cmpb   $0x0,(%rdi)
    4ae8:       75 f8                   jne    4ae2 <len>
    4aea:       49 89 fc                mov    %rdi,%r12
    4aed:       5f                      pop    %rdi
    4aee:       49 29 fc                sub    %rdi,%r12
    4af1:       4d 31 f6                xor    %r14,%r14
    4af4:       eb 18                   jmp    4b0e <outer_loop.skip>

0000000000004af6 <extra>:
    4af6:       41 c6 01 20             movb   $0x20,(%r9)
    4afa:       c6 03 20                movb   $0x20,(%rbx)
    4afd:       49 ff ce                dec    %r14
    4b00:       eb 06                   jmp    4b08 <outer_loop>

0000000000004b02 <newline>:
    4b02:       c6 06 0a                movb   $0xa,(%rsi)
    4b05:       48 ff c6                inc    %rsi

0000000000004b08 <outer_loop>:
    4b08:       49 ff c6                inc    %r14
    4b0b:       48 ff c7                inc    %rdi

0000000000004b0e <outer_loop.skip>:
    4b0e:       44 8a 07                mov    (%rdi),%r8b
    4b11:       41 80 f8 65             cmp    $0x65,%r8b
    4b15:       74 df                   je     4af6 <extra>
    4b17:       45 84 c0                test   %r8b,%r8b
    4b1a:       74 23                   je     4b3f <done>
    4b1c:       48 89 f3                mov    %rsi,%rbx

0000000000004b1f <inner_loop>:
    4b1f:       44 88 06                mov    %r8b,(%rsi)
    4b22:       49 89 f1                mov    %rsi,%r9
    4b25:       48 ff c6                inc    %rsi
    4b28:       48 31 d2                xor    %rdx,%rdx
    4b2b:       48 89 f0                mov    %rsi,%rax
    4b2e:       48 2b 04 24             sub    (%rsp),%rax
    4b32:       4c 29 f0                sub    %r14,%rax
    4b35:       49 f7 f4                div    %r12
    4b38:       48 85 d2                test   %rdx,%rdx
    4b3b:       74 c5                   je     4b02 <newline>
    4b3d:       eb e0                   jmp    4b1f <inner_loop>

0000000000004b3f <done>:
    4b3f:       5e                      pop    %rsi
    4b40:       c3                      retq
0000000000000000 <oreo_asm>:
   0:   56                      push   %rsi
   1:   57                      push   %rdi

0000000000000002 <len>:
   2:   48 ff c7                inc    %rdi
   5:   80 3f 00                cmpb   $0x0,(%rdi)
   8:   75 f8                   jne    2 <len>
   a:   49 89 fc                mov    %rdi,%r12
   d:   5f                      pop    %rdi
   e:   49 29 fc                sub    %rdi,%r12
  11:   4d 31 f6                xor    %r14,%r14
  14:   eb 18                   jmp    2e <outer_loop.skip>

0000000000000016 <extra>:
  16:   41 c6 01 20             movb   $0x20,(%r9)
  1a:   c6 03 20                movb   $0x20,(%rbx)
  1d:   49 ff ce                dec    %r14
  20:   eb 06                   jmp    28 <outer_loop>

0000000000000022 <newline>:
  22:   c6 06 0a                movb   $0xa,(%rsi)
  25:   48 ff c6                inc    %rsi

0000000000000028 <outer_loop>:
  28:   49 ff c6                inc    %r14
  2b:   48 ff c7                inc    %rdi

000000000000002e <outer_loop.skip>:
  2e:   44 8a 07                mov    (%rdi),%r8b
  31:   41 80 f8 65             cmp    $0x65,%r8b
  35:   74 df                   je     16 <extra>
  37:   45 84 c0                test   %r8b,%r8b
  3a:   74 23                   je     5f <done>
  3c:   48 89 f3                mov    %rsi,%rbx

000000000000003f <inner_loop>:
  3f:   44 88 06                mov    %r8b,(%rsi)
  42:   49 89 f1                mov    %rsi,%r9
  45:   48 ff c6                inc    %rsi
  48:   48 31 d2                xor    %rdx,%rdx
  4b:   48 89 f0                mov    %rsi,%rax
  4e:   48 2b 04 24             sub    (%rsp),%rax
  52:   4c 29 f0                sub    %r14,%rax
  55:   49 f7 f4                div    %r12
  58:   48 85 d2                test   %rdx,%rdx
  5b:   74 c5                   je     22 <newline>
  5d:   eb e0                   jmp    3f <inner_loop>

000000000000005f <done>:
  5f:   5e                      pop    %rsi
  60:   c3                      retq
1
source | link