This program prints small numbers fine but not big numbers and I don't know why.
For example print 1346269 will print out as "c1346269"
and print 40000 will print out as "40000" just like it's supposed to.
Here's the macro:
%macro print 1
    mov rax, %1
    %%printInt:
        mov rcx, digit      ; set rcx to digit memory address
        mov rbx, 10         ; moving a newline into rbx
        mov [rcx], rbx      ; setting digit to rbx
        inc rcx             ; increment rcx position by one byte
    %%storeLoop:
        xor rdx, rdx        ; zero out rdx
        mov rbx, 10         
        div rbx             ; rax / rbx (10)
                            ; rdx holds the remainder of the divison
        add rdx, 48         ; add 48 to rdx to make in ascii character
                            
        mov [rcx], dl       ; get the character part of rdx
        inc rcx             ; increment digit position again
        cmp rax, 0
        jnz %%storeLoop     ; continue looping until rax is 0
    %%printLoop:
        push rcx
        ;perform sys write
        mov rax, SYSWRITE
        mov rdi, 1
        mov rsi, rcx
        mov rdx, 1
        syscall
        pop rcx
        dec rcx
        cmp rcx, digit      ; first byte of digit (10)
        jge %%printLoop
%endmacro
And here is how I use it:
    _start:
        
        print 40000
        exit
 
    