Code: Select all
Define.I A
! mov [v_a], rax
Debug A
Code: Select all
Define.I A
! mov [v_a], rax
Debug A
There can always be something in the RAX register, as with all registers. After all, it is the main register with which one works.Olli wrote: ↑Sat May 08, 2021 1:04 pm Hello, I can see RAX has a non-zero initial value. Does anybody know if it means to anything ?Best regardsCode: Select all
Define.I A ! mov [v_a], rax Debug A
Code: Select all
ShowAssemblyViewer()
Global a
!mov [v_a], rax
Debug a
CallDebugger
Code: Select all
Procedure foo()
! mov rax, 999
ProcedureReturn ; exit procedure without change rax register
EndProcedure
Debug foo()
Hello,mk-soft wrote: ↑Sat May 08, 2021 2:16 pm And the rax register is the return register of function (not float or double)Code: Select all
Procedure foo() ! mov rax, 999 ProcedureReturn ; exit procedure without change rax register EndProcedure Debug foo()
Code: Select all
RAX Initial value
0x00000000NNNNNNNN
Code: Select all
! xor rax, rax
Code: Select all
! Mov bx, ax
! Shr rax, 16
! Xor ax, bx
Define.I A
! Mov [v_A], rax
Debug Hex(A)
Code: Select all
Define.I InitialRax
! Mov [v_initialrax], rax
! Xor rax, rax
Code: Select all
;
PureBasicStart:
;
SUB rsp,40
MOV r8,I_BSSEnd-I_BSSStart
XOR rdx,rdx
MOV rcx,I_BSSStart
CALL memset
XOR rcx,rcx
CALL GetModuleHandleW
MOV [PB_Instance],rax
XOR r8,r8
MOV rdx,4096
XOR rcx,rcx
CALL HeapCreate
MOV [PB_MemoryBase],rax
CALL SYS_InitString
CALL PB_InitDesktop
CALL PB_InitRequester
This means that these registers can be used and can also contain any old values.- On x86 processors, the available volatile registers are: eax, ecx and edx, xmm0, xmm1, xmm2 and xmm3. All others must be always preserved.
- On x64 processors, the available volatile registers are: rax, rcx, rdx, r8, r9, xmm0, xmm1, xmm2 and xmm3. All others must be always preserved.
...
global _main
_main:
MOV [PB_InitialStackValue],rsp
SUB rsp,40
MOV [_PB_ArgC],edi
MOV [_PB_ArgV],rsi
CALL _SYS_InitPureBasic
;;
; Define a
; a = foo()
CALL _Procedure0
MOV qword [v_a],rax
;
; Debug a
_PB_EOP:
_PB_EOP_NoValue:
CALL _PB_EndFunctions
MOV rsp,[PB_InitialStackValue]
MOV rax,[PB_ExitCode]
RET
_PB_EndFunctions:
SUB rsp,40
ADD rsp,40
RET
; Procedure foo()
_Procedure0:
%define PS0 64
XOR rax,rax
PUSH rax
PUSH rax
SUB rsp,40
; Protected r1
; r1 = 99
MOV qword [rsp+40],99
; ProcedureReturn r1
MOV rax,qword [rsp+40]
JMP _EndProcedure1
; EndProcedure
_EndProcedureZero1:
XOR rax,rax
_EndProcedure1:
ADD rsp,56
RET
...