input
Code: Select all
EnableExplicit
Macro FIM(query)
;FIM query
EndMacro
Procedure foo()
gg.s = "hello foo"
PrintN(gg)
EndProcedure
Structure m128
StructureUnion
a.a[16]
u.u[8]
l.l[4]
q.q[2]
EndStructureUnion
EndStructure
FIM("please write bswap128 using the m128 Structure with both inline c using __builtin_bswap64 And inline Asm For x86 And x64" +
"using appropriate CompilerIf CompilerElse statements For c backend and for x86 and x64 asm versions eg #PB_Compiler_Backend = #PB_Backend_C, " +
"and #PB_Compiler_Processor=#PB_Processor_x64. use intel format asm with ! to denote inline asm, use movbe instruction for swap" +
"variables in inline c are prefixed with v_ like !v_h = __builtin_bswap64(v_h); asm variables preceeded by p.v_ eg !mov [p.v_l],rax")
Procedure bswap128(*m.m128)
Protected h.q = *m\q[1]
Protected l.q = *m\q[0]
!movbe edx,[p.v_h]
!movbe eax,[p.v_h+ 4]
!mov [p.v_h], dword eax
!mov [p.v_h+4], dword edx
!movbe edx,[p.v_l]
!movbe eax,[p.v_l + 4]
!mov [p.v_l], dword eax
!mov [p.v_l+4], dword edx
*m\q[1] = l
*m\q[0] = h
EndProcedure
Structure vec2
x.f
y.f
EndStructure
FIM("write vecScale using structure vec2 and scale *v1 by scale")
Procedure vecScale(*v1.vec2,scale.f)
EndProcedure
FIM("write vecSubtract using vec2 structure eg *v1\x = *v2\x")
Procedure vecSubtract(*v1.vec2,*v2.vec2)
EndProcedure
gg.s = "hello World"
x.i = @gg & $ffff
OpenConsole("test")
PrintN(gg.s)
foo()
Inpu()
CloseConsole(
Code: Select all
CallDebugger
EnableExplicit
Macro FIM(query)
;FIM query
EndMacro
Procedure foo()
Global gg.s
gg.s = "hello foo"
PrintN(gg)
EndProcedure
Structure m128
StructureUnion
a.a[16]
u.u[8]
l.l[4]
q.q[2]
EndStructureUnion
EndStructure
;FIM("please write bswap128 using the m128 Structure with both inline c using __builtin_bswap64 And inline Asm For x86 And x64" +
; "using appropriate CompilerIf CompilerElse statements For c backend and for x86 and x64 asm versions eg #PB_Compiler_Backend = #PB_Backend_C, " +
; "and #PB_Compiler_Processor=#PB_Processor_x64. use intel format asm with ! to denote inline asm, use movbe instruction for swap" +
; "variables in inline c are prefixed with v_ like !v_h = __builtin_bswap64(v_h); asm variables preceeded by p.v_ eg !mov [p.v_l],rax")
Procedure bswap128(*m.m128)
Protected h.q = *m\q[1]
Protected l.q = *m\q[0]
CompilerIf #PB_Compiler_Backend = #PB_Backend_C
!v_h = __builtin_bswap64(v_h)
!v_l = __builtin_bswap64(v_l)
CompilerElse
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
!movbe edx,[p.v_h]
!movbe eax,[p.v_h+ 4]
!mov [p.v_h], dword eax
!mov [p.v_h+4], dword edx
!movbe edx,[p.v_l]
!movbe eax,[p.v_l + 4]
!mov [p.v_l], dword eax
!mov [p.v_l+4], dword edx
CompilerElse
!mov eax, [p.v_h]
!bswap eax
!mov [p.v_h], eax
!mov eax, [p.v_h+4]
!bswap eax
!mov [p.v_h+4], eax
!mov eax, [p.v_l]
!bswap eax
!mov [p.v_l], eax
!mov eax, [p.v_l+4]
!bswap eax
!mov [p.v_l+4], eax
CompilerEndIf
CompilerEndIf
*m\q[1] = l
*m\q[0] = h
EndProcedure
Structure vec2
x.f
y.f
EndStructure
;FIM("write vecScale using structure vec2 and scale *v1 by scale")
Procedure vecScale(*v1.vec2, scale.f)
*v1\x = *v1\x * scale
*v1\y = *v1\y * scale
EndProcedure
;FIM("write vecSubtract using vec2 structure eg *v1\x = *v2\x")
Procedure vecSubtract(*v1.vec2, *v2.vec2)
*v1\x = *v1\x - *v2\x
*v1\y = *v1\y - *v2\y
EndProcedure
Global gg.s
gg.s = "hello World"
Global x.i
x.i = @gg & $ffff
OpenConsole("test")
PrintN(gg.s)
foo()
Input()
CloseConsole()