I found a cheat sheet on arguments in assembler:
- rdi - first arg
- rsi - second arg
- rdx - third arg
- rcx - four arg
- r8-r15 - 5-12 arg
- and then through the addresses
I wrote such code that calls a method from glfw to create a window, but I get an Assertion failed: title != NULL:
mov rdi, 640
mov rsi, 480
mov rdx, title
mov rcx, 0
mov r8, 0
call glfwCreateWindow
If necessary, here is the title variable:
section .data
title db "Hi", 0
I asked ChatGPT how to solve this, and it gived me this code:
lea rdx, [title]
But an error occurs during compilation:
src\main.asm:(.text+0x20): relocation truncated to fit: IMAGE_REL_AMD64_ADDR32 against
.data'`
I also tried to write:
lea rdx, [rel title]
And I also get an Assertion error after that.
My os is: Windows x64 Assembly compiler: NASM x86-x64 elf64 Executable compiler: MinGW GCC 13.1.0