64bit ASM question

Bare metal programming in PureBasic, for experienced users
eriansa
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Mar 17, 2004 12:31 am
Contact:

64bit ASM question

Post by eriansa »

This is valid in 32Bit :

Code: Select all

!use32
!push edi
But not in 64Bit. Why?

A workaround :

Code: Select all

compilerif SizeOf(Integer)=8
!push rbp
!push rdi
CompilerElse
!push ebp
!push edi
CompilerEndIf
!mov eax,10
compilerif SizeOf(Integer)=8
!pop rdi
!pop rbp
CompilerElse
!pop edi
!pop ebp
CompilerEndIf
MessageRequester("Hallo","Why?")
But the question remains...
Thorium
Addict
Addict
Posts: 1271
Joined: Sat Aug 15, 2009 6:59 pm

Re: 64bit ASM question

Post by Thorium »

Because stack items allways have the native register size. So for 64bit you allways need to push a 64bit value, on 32bit you have to push a 32bit value.
Post Reply