Re: RE : RE : [fpc-pascal] Reversing bit-order of byte

2012-05-03 Thread Koenraad Lelong
On 03-05-12 13:27, Thomas Schatzl wrote: ... function reverse(b : byte) : byte; assembler; nostackframe; asm rbit r0, r0 // rbit reverses the whole word, so now you have // your value in bits 31-24... so shift right by that amount // should fix this up (bits 23-0 contain junk, we shif

Re: [fpc-pascal] TBufDataSet: ApplyUpdates

2012-05-03 Thread Marcos Douglas
On Thu, May 3, 2012 at 1:01 PM, Sven Barth wrote: > On 03.05.2012 15:40, Marcos Douglas wrote: >> >> On Thu, May 3, 2012 at 10:01 AM, LacaK  wrote: >>> >>> Marcos Douglas  wrote / napísal(a): >>> >>> On Thu, May 3, 2012 at 2:52 AM, LacaK  wrote: >>> >>> >>> I saw the TBufDataSet.ApplyUpdates and i

Re: [fpc-pascal] TBufDataSet: ApplyUpdates

2012-05-03 Thread Sven Barth
On 03.05.2012 15:40, Marcos Douglas wrote: On Thu, May 3, 2012 at 10:01 AM, LacaK wrote: Marcos Douglas wrote / napísal(a): On Thu, May 3, 2012 at 2:52 AM, LacaK wrote: I saw the TBufDataSet.ApplyUpdates and it calls ApplyRecUpdate. The ApplyRecUpdate just raises an exception... Yes it

Re: [fpc-pascal] Reversing bit-order of byte

2012-05-03 Thread Sven Barth
On 03.05.2012 10:50, David Butler wrote: If you want to go assembly: function ReverseBits(const Value: LongWord): LongWord; register; assembler; asm BSWAP EAX MOV EDX, EAX AND EAX, 0h SHR EAX, 1 AND EDX, 0h SHL EDX,

Re: [fpc-pascal] TBufDataSet: ApplyUpdates

2012-05-03 Thread Marcos Douglas
On Thu, May 3, 2012 at 10:01 AM, LacaK wrote: > Marcos Douglas  wrote / napísal(a): > > On Thu, May 3, 2012 at 2:52 AM, LacaK wrote: > > > I saw the TBufDataSet.ApplyUpdates and it calls ApplyRecUpdate. > The ApplyRecUpdate just raises an exception... > > > > Yes it is virtual method, which can b

Re: [fpc-pascal] TBufDataSet: ApplyUpdates

2012-05-03 Thread LacaK
Marcos Douglas wrote / napísal(a): On Thu, May 3, 2012 at 2:52 AM, LacaK wrote: I saw the TBufDataSet.ApplyUpdates and it calls ApplyRecUpdate. The ApplyRecUpdate just raises an exception... Yes it is virtual method, which can be overriden by descendants There is some imple

Re: [fpc-pascal] TBufDataSet: ApplyUpdates

2012-05-03 Thread Marcos Douglas
On Thu, May 3, 2012 at 2:52 AM, LacaK wrote: > >> >> I saw the TBufDataSet.ApplyUpdates and it calls ApplyRecUpdate. >> The ApplyRecUpdate just raises an exception... >> > > Yes it is virtual method, which can be overriden by descendants > > >> There is some implementation, in some place, to work

Re: RE : RE : [fpc-pascal] Reversing bit-order of byte

2012-05-03 Thread Thomas Schatzl
Hi, On Thu, 2012-05-03 at 12:54 +0200, Ludo Brands wrote: > > Thanks all for your replies. > > I already found the RBIT-instruction. I also found out I need > > to study > > the arm assembly language ;-) > > > > But how do I get my variable ? Is that in some register ? Is > > there any > > do

RE : RE : [fpc-pascal] Reversing bit-order of byte

2012-05-03 Thread Ludo Brands
> Thanks all for your replies. > I already found the RBIT-instruction. I also found out I need > to study > the arm assembly language ;-) > > But how do I get my variable ? Is that in some register ? Is > there any > documentation about such things ? Then I can use inline assembly. > ARM has

Re: [fpc-pascal] c to pascal converters

2012-05-03 Thread Marco van de Voort
In our previous episode, dhkblas...@zeelandnet.nl said: > > c2pas32 often gives acceptable results. Definitely the best results so far. If it is enough, I don't know yet, but then it will at least be good enough to speed up fragments. Thanks! ___ fpc-p

Re: [fpc-pascal] c to pascal converters

2012-05-03 Thread dhkblaszyk
c2pas32 often gives acceptable results. On 3 mei '12, mar...@stack.nl wrote: > Hello, > > I'm in the process of converting an old MSVC6 application to FPC/Delphi, > so I'm thinking about using a c to pascal converter. > > The code is older 6-10kloc, and is plain C in a MFC C++ framework.

Re: RE : [fpc-pascal] Reversing bit-order of byte

2012-05-03 Thread Koenraad Lelong
On 03-05-12 10:45, Ludo Brands wrote: You might also look into the RBIT instruction which does this in one cpu cycle. See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/Cihjgdi d.html and applied to the STM32 USART http://forum.micromouseonline.com/viewtopic.php?f=7&t=460

Re: [fpc-pascal] Reversing bit-order of byte

2012-05-03 Thread David Butler
If you want to go assembly: function ReverseBits(const Value: LongWord): LongWord; register; assembler; asm BSWAP EAX MOV EDX, EAX AND EAX, 0h SHR EAX, 1 AND EDX, 0h SHL EDX, 1 OR EAX, EDX MOV EDX, EAX

RE : [fpc-pascal] Reversing bit-order of byte

2012-05-03 Thread Ludo Brands
> Hi, > > I'm porting a driver, originally written in C, for an LCD to be used > with an embedded arm-processor (STM32). > The original driver uses SPI, my driver will use a USART in > synchronous > mode because the STM32 has no SPI for 9-bit. Unfortunately, the > bit-order is reversed between

[fpc-pascal] c to pascal converters

2012-05-03 Thread Marco van de Voort
Hello, I'm in the process of converting an old MSVC6 application to FPC/Delphi, so I'm thinking about using a c to pascal converter. The code is older 6-10kloc, and is plain C in a MFC C++ framework. It does nothing but processing samples (array handling and transformation), and drawing a graph o

Re: [fpc-pascal] Reversing bit-order of byte

2012-05-03 Thread Thomas Schatzl
Hi, On Thu, 2012-05-03 at 07:55 +, Mark Morgan Lloyd wrote: > Koenraad Lelong wrote: > > Hi, > > > > I'm porting a driver, originally written in C, for an LCD to be used > > with an embedded arm-processor (STM32). > > The original driver uses SPI, my driver will use a USART in synchronous >

Re: [fpc-pascal] Reversing bit-order of byte

2012-05-03 Thread Mark Morgan Lloyd
Koenraad Lelong wrote: Hi, I'm porting a driver, originally written in C, for an LCD to be used with an embedded arm-processor (STM32). The original driver uses SPI, my driver will use a USART in synchronous mode because the STM32 has no SPI for 9-bit. Unfortunately, the bit-order is reversed

Re: [fpc-pascal] Reversing bit-order of byte

2012-05-03 Thread Honza
Dne 3.5.2012 9:11 "Koenraad Lelong" napsal(a): > > Does anyone knows an efficient way to reverse bit-order of a byte for the arm-processor ? Lookup from a 256 byte precomputed table? Or I misunderstood the task. -jan ___ fpc-pascal maillist - fpc-pa

[fpc-pascal] Reversing bit-order of byte

2012-05-03 Thread Koenraad Lelong
Hi, I'm porting a driver, originally written in C, for an LCD to be used with an embedded arm-processor (STM32). The original driver uses SPI, my driver will use a USART in synchronous mode because the STM32 has no SPI for 9-bit. Unfortunately, the bit-order is reversed between SPI and USART t