Author Topic: AsmJunkError  (Read 6538 times)

0 Members and 1 Guest are viewing this topic.

Charles Pegge

  • Guest
Re: AsmJunkError
« Reply #15 on: December 13, 2011, 11:53:56 AM »
Hi Peter,

Using the MS64 calling convention in Assembler:

You need to provide a 32 byte spill zone for the first four params in registers. (The stack pointer must also be aligned to 16 bytes whenever a call is made. It's okay here)

Code: [Select]

$ FileName "t.exe"
#include "..\..\inc\RTL64.inc"

Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long

zstring tit[]="The 64Bit world of OxygenBasic..."
zstring msg[]="Hello Christmas"

sub  rsp,32
mov  r9d, 0      
lea  r8,  tit  
lea  rdx, msg  
mov  rcx, 0      
call MessageBox
add  rsp,32

I'll add this one with the rest of your demo code :)

Charles
« Last Edit: December 13, 2011, 11:57:59 AM by Charles Pegge »

Aurel

  • Guest
Re: AsmJunkError
« Reply #16 on: December 13, 2011, 12:32:33 PM »
Yes i have PureBasic version 4.51 and i can say that PureBasic is very well
basic compiler.I use them in first place because i have whole bunch of source
code written in Pure Basic( from small programs to big application).

And yes Charles talk about Power Basic.
I don't know why ,but i simply don't like Power Basic. 

Charles Pegge

  • Guest
Re: AsmJunkError
« Reply #17 on: December 13, 2011, 01:29:02 PM »
I should warn everybody that the standard used for O2 native functions differs from MS64 in that when a function is called it reads all its param from the stack. This is not cast in stone yet! And I am so cross about having to use the simd registers to pass floats that I may ditch this as well and go  to cdecl as the internal standard.

Functions which have extern, external, callback or export tags, use the proper MS64 standard.

Charles
« Last Edit: December 13, 2011, 01:31:03 PM by Charles Pegge »