"convert" function overflow when its works in this function --> bool op_ld(t_cursor *cursor, t_vm *vm);. You can see it with player turtle.cor.
The part of the function op_ld where is problem hidden:
else if (args[0] == DIR && args[1] == REG)
{
cursor->reg[vm->arena[cursor->pos + 6] - 1] =
vm->arena[cursor->pos + convert(&vm->arena[cursor->pos + 2], 4)];
ft_printf("loaded %d into r%d = %d\n", vm->arena[cursor->pos + convert(&vm->arena[cursor->pos + 2], 4)],
vm->arena[cursor->pos + 6], cursor->reg[vm->arena[cursor->pos + 6] - 1]);
}
I changed a bit. Not sure if it's better now ...
else if (args[0] == DIR && args[1] == REG)
{
reg_num = vm->arena[cursor->pos + 6] - 1;
reg_val = vm->arena[cursor->pos + 2];
// ft_printf("\nREG NUM [%d] DIR VAL dec(%d) hex[%x] ", reg_num, reg_val, reg_val);
// ft_printf("Dir val converted: %d\n", convert(&vm->arena[cursor->pos + 2], 4));
cursor->reg[reg_num] = reg_val;
cursor->carry = (reg_val == 0) ? true : false;
}

"convert" function overflow when its works in this function -->
bool op_ld(t_cursor *cursor, t_vm *vm);. You can see it with player turtle.cor.The part of the function op_ld where is problem hidden:
I changed a bit. Not sure if it's better now ...