Search found 37 matches

by ker2x
Sat Nov 28, 2015 1:55 pm
Forum: Feature Requests and Wishlists
Topic: Reassemble modified code from IDE
Replies: 1
Views: 1540

Reassemble modified code from IDE

Friendly greetings \o/

When i work on a project a create 2 additionnal executable : produce-asm.exe and reassemble.exe.
They are just calling the pb compiler with the right option :
- to produce a .asm file
- to compile the asm code i just modified in a .exe

It can totally easily be done from ...
by ker2x
Fri Nov 27, 2015 5:22 pm
Forum: Assembly and C Programming in PureBasic
Topic: Source Level Disassembler for PureBasic?
Replies: 6
Views: 7290

Re: Source Level Disassembler for PureBasic?

You can use Bochs (x86 emulator), i love it !


When you're using Bochs with the internal debugger, you can trigger the debugger via a facility called magic breakpoints. To trigger a breakpoint, you can insert xchg bx, bx (in GAS syntax, xchgw %bx, %bx) anywhere in the code and Bochs will trap ...
by ker2x
Fri Nov 27, 2015 5:16 pm
Forum: Assembly and C Programming in PureBasic
Topic: Assembler problems
Replies: 15
Views: 8980

Re: Assembler problems

only very partially then. Since they have different function call conventions.
by ker2x
Fri Nov 27, 2015 5:13 pm
Forum: Assembly and C Programming in PureBasic
Topic: AES256 Hardware call -need ur help for implementation
Replies: 3
Views: 3229

Re: AES256 Hardware call -need ur help for implementation

This PDF from intel have a lot of AES related assembly code : http://www.intel.fr/content/dam/doc/white-paper/advanced-encryption-standard-new-instructions-set-paper.pdf
You probably checked https://en.wikipedia.org/wiki/AES_instruction_set i guess ?
The reference section seems to have a lot of ...
by ker2x
Thu Nov 26, 2015 4:44 pm
Forum: Assembly and C Programming in PureBasic
Topic: Assembler problems
Replies: 15
Views: 8980

Re: Assembler problems

wilbert wrote: It makes it very difficult to write cross platform code this way that works on all systems.
Cross platform assembly ??? :mrgreen:
by ker2x
Thu Nov 26, 2015 3:33 pm
Forum: Coding Questions
Topic: Passing array of struct to a threaded procedure
Replies: 3
Views: 840

Re: Passing array of struct to a threaded procedure

i know there is no lock on the array, it produce slightly inaccurate (imperceptible) result but that's on purpose.
It's massive performance tradeoff (i have a C++ version of this code that was profiled with Intel VTune)
by ker2x
Thu Nov 26, 2015 3:27 pm
Forum: Coding Questions
Topic: Passing array of struct to a threaded procedure
Replies: 3
Views: 840

Re: Passing array of struct to a threaded procedure

The full code. It's ugly and in progress :)
(but it produce a nice fractal)


;
; Buddhabrot generator

EnableExplicit


;RunProgram(#PB_Compiler_Home+"\Compilers\pbcompiler.exe", Chr(34)+ "E:\purebasic\buddhabrot3\main.pb" + Chr(34) + " /COMMENTED /SSE2 /EXE " + Chr(34)+ "E:\purebasic\buddhabrot3 ...
by ker2x
Thu Nov 26, 2015 2:55 pm
Forum: Coding Questions
Topic: Passing array of struct to a threaded procedure
Replies: 3
Views: 840

Re: Passing array of struct to a threaded procedure

Sure, as soon as i ask i find the solution ^^
(i'm on it since 1h ...)

Code: Select all

Procedure iterateThread(Array *exposure.ExposureStruct(1))
by ker2x
Thu Nov 26, 2015 2:53 pm
Forum: Coding Questions
Topic: Passing array of struct to a threaded procedure
Replies: 3
Views: 840

Passing array of struct to a threaded procedure

Hello ! I can'tt make it works, i have an invalid memory access error.

Here is the definition

Structure ExposureStruct
R.f
G.f
B.f
A.f
EndStructure

Global Dim exposure.ExposureStruct(screenSize2)




In the main code i call the thread :

CreateThread(@iterateThread(), exposure())


Here ...
by ker2x
Thu Nov 26, 2015 5:53 am
Forum: Assembly and C Programming in PureBasic
Topic: Bug or programming error?
Replies: 6
Views: 4800

Re: Bug or programming error?

TL;DR : programming error.

Your first loop go to 0 to 5
The 2nd loop go to 1 to 5

When i modify the 1st loop to go from 1 to 5 i get correct result.

1) Your code is pretty much unreadable
2) The output is horrible.
3) Comments in french (i speak french, that's why i could do it)

The modified ...
by ker2x
Fri Nov 13, 2015 9:03 pm
Forum: Assembly and C Programming in PureBasic
Topic: RDRAND ASM Syntax error
Replies: 5
Views: 4862

Re: RDRAND ASM Syntax error



Procedure.f mrdrand()
Define r.f
Define d.f = 536870911
Define two.f = 2
EnableASM
! RDRAND eax
! MOV dword [p.v_r], eax
! FILD dword [p.v_r]
! FDIV dword [p.v_d]
! FSUB dword [p.v_two]
! FST dword [p.v_d]
! MOV EAX, [p.v_d]
DisableASM
ProcedureReturn
EndProcedure
by ker2x
Fri Nov 13, 2015 8:07 pm
Forum: Assembly and C Programming in PureBasic
Topic: RDRAND ASM Syntax error
Replies: 5
Views: 4862

Re: RDRAND ASM Syntax error

well, it's in the manual of course !!

- It's possible to pass directly an assembly line to the assembler without being processed by the compiler by using the '!' character at the line start. This allow to have a full access to the assembler directives. When using this, it's possible to reference ...
by ker2x
Fri Nov 13, 2015 8:05 pm
Forum: Assembly and C Programming in PureBasic
Topic: RDRAND ASM Syntax error
Replies: 5
Views: 4862

Re: RDRAND ASM Syntax error

mine support it. (i7 4770k)

what is this ! operator ?
now i have an error on the next instruction :D

The code i created using /REASM :


_Procedure4:
;PS4=48
;SUB rsp,40
;
;
;
; ProcedureReturn ((Random(2147483647)/(536870911)) - 2.0)
;PUSH qword 2147483647
;POP rcx
;CALL PB_Random
;MOV ...
by ker2x
Fri Nov 13, 2015 7:49 pm
Forum: Assembly and C Programming in PureBasic
Topic: RDRAND ASM Syntax error
Replies: 5
Views: 4862

RDRAND ASM Syntax error


Procedure.f mrdrand()
EnableASM
;MOV RAX, 0
RDRAND EAX
DisableASM
ProcedureReturn
EndProcedure


I get a syntax error on RDRAND line.
(works if i comment it and uncomment the previous one. but... well... obviously, i want a random number as a result, not 0 :p )

btw, i rand some test, RDRAND ...