Search found 110 matches

by fzabkar
May 26, 2021 1:48
Forum: Beginners
Topic: Return information from a Shell
Replies: 17
Views: 555

Re: Return information from a Shell

Can you redirect the output of the shell command to a file, and then read the file in FB?
by fzabkar
Apr 11, 2021 19:08
Forum: Beginners
Topic: Valulng, Vallng, Valuint, Valint hex notation
Replies: 6
Views: 357

Re: Valulng, Vallng, Valuint, Valint hex notation

I'm converting a ddrescue map file into another format. Ddrescue produces a human readable log (map), eg ... # Mapfile. Created by GNU ddrescue version 1.25 # Command line: ddrescue -d -c18 /dev/fd0 fdimage mapfile # Start time: 2015-07-21 09:37:44 # Current time: 2015-07-21 09:38:19 # Copying non-t...
by fzabkar
Apr 11, 2021 8:44
Forum: Beginners
Topic: Valulng, Vallng, Valuint, Valint hex notation
Replies: 6
Views: 357

Re: Valulng, Vallng, Valuint, Valint hex notation

Perhaps I didn't explain myself very well. I understand that "&H" is standard BASIC notation. However, I ask myself, under what circumstances would my program execute the following code? ulivar = Valulng( "&H1234") Does it make sense for a string such as "&H1234&...
by fzabkar
Apr 11, 2021 6:01
Forum: Beginners
Topic: Valulng, Vallng, Valuint, Valint hex notation
Replies: 6
Views: 357

Valulng, Vallng, Valuint, Valint hex notation

I'm having difficulty understanding the purpose of the Valulng, Vallng, Valuint, Valint keywords. I understand what they do, but I don't understand why they go about in the way that they do. Specifically, I don't understand why a hexadecimal string is expected to have a prefix of "&H"....
by fzabkar
Apr 09, 2021 1:40
Forum: Beginners
Topic: Exiting from ASM
Replies: 7
Views: 516

Re: Exiting from ASM

Any "exit asm" command would just be a high-level syntactic sugar for the exact same jump. Since the goal of ASM is to allow low-level assembly code directly in your program, I would assume any user of this facility would want to do their own jumps explicitly. That's the point of ASM afte...
by fzabkar
Apr 08, 2021 23:35
Forum: Beginners
Topic: Exiting from ASM
Replies: 7
Views: 516

Re: Exiting from ASM

Thanks.
by fzabkar
Apr 08, 2021 22:43
Forum: Beginners
Topic: Exiting from ASM
Replies: 7
Views: 516

Exiting from ASM

Is there a proper way to exit this ASM block? I'm JMP-ing to an empty line because I can't see any other way to do it. Is there a "quit" command which I could use in place of "jmp Fin"? Dim bytvar As Byte Dim bstatus As Byte Do Input "Enter a byte value (0 to quit): ", ...
by fzabkar
Apr 05, 2021 18:47
Forum: Beginners
Topic: Execution speed of nested loops
Replies: 24
Views: 1045

Re: Execution speed of nested loops

I get 3.7s versus 5.8s. I'm wondering if I could use the XMM0-15 and YMM0-15 registers for the INCs within my ASM loop, and "MOV dword Ptr [dwSumx], XMMx" outside the loop. (I realise that the op codes may be incorrect -- should I use movups instead of mov?) Would I need to push and pop th...
by fzabkar
Apr 05, 2021 4:00
Forum: Beginners
Topic: Execution speed of nested loops
Replies: 24
Views: 1045

Re: Execution speed of nested loops

@jj2007, here is my test code. I hope it's what you wanted. #include "vbcompat.bi" dim as ushort i, j, k dim b as byte dim uliBit( 0 To 31 ) as ulongint dim bufptr as any ptr dim dwbufptr as ulong ptr dim t as double dim as ushort imax, jmax, kmax dim buffsiz as ushort imax = 99 jmax = 999...
by fzabkar
Apr 05, 2021 2:51
Forum: Beginners
Topic: Execution speed of nested loops
Replies: 24
Views: 1045

Re: Execution speed of nested loops

This is working code which processes the bit frequency in a file: http://www.users.on.net/~fzabkar/FreeBasic_W32/Utils/bitcount32.bas http://www.users.on.net/~fzabkar/FreeBasic_W32/Utils/bitcount32.exe That's what I'm using for my testing (on a 1.2GB file). Note that I have commented out 3 alternati...
by fzabkar
Apr 03, 2021 7:08
Forum: Beginners
Topic: Execution speed of nested loops
Replies: 24
Views: 1045

Re: Execution speed of nested loops

This code executes in 38s as opposed to 59s: Dim dwSum31 As ULong Dim dwSum30 As ULong Dim dwSum29 As ULong Dim dwSum28 As ULong Dim dwSum27 As ULong Dim dwSum26 As ULong Dim dwSum25 As ULong Dim dwSum24 As ULong Dim dwSum23 As ULong Dim dwSum22 As ULong Dim dwSum21 As ULong Dim dwSum20 As ULong Dim...
by fzabkar
Apr 03, 2021 6:24
Forum: Beginners
Topic: Execution speed of nested loops
Replies: 24
Views: 1045

Re: Execution speed of nested loops

The assemby instruction inc typically works on registers: ASM ' ... inc cl shl eax, cl ' ... End ASM The ASM docs use this example: ' Assuming "n" is a FB global or local ULONG variable mov eax, [n] ' OK: size is apparent from eax inc [n] ' Not OK: size is not given inc dword [n] ' Not OK...
by fzabkar
Apr 03, 2021 5:52
Forum: Beginners
Topic: Execution speed of nested loops
Replies: 24
Views: 1045

Re: Execution speed of nested loops

This is what I'm trying to do: ASM mov ecx, [dwNumLongs] mov esi, [dwInptr] L31: lodsd ' load EAX with contents of address pointed to by ESI - ESI increments by 4 shl eax, 1 ' shift EAX left 1 bit jnc L30 inc [dwSumOne32(31)] L30: shl eax, 1 jnc L29 inc [dwSumOne32(30)] L29: shl eax, 1 jnc L28 inc [...
by fzabkar
Apr 03, 2021 3:27
Forum: Beginners
Topic: Execution speed of nested loops
Replies: 24
Views: 1045

Re: Execution speed of nested loops

I've written an ASM routine, but there is one op code which I can't get right.

Code: Select all

inc [dwSumOne32(31)]

dwSumOne32(n) is an array of Longs which I'm trying to increment whenever the carry bit is set.

I do this 32 times in a long loop.
by fzabkar
Apr 02, 2021 23:02
Forum: Beginners
Topic: Execution speed of nested loops
Replies: 24
Views: 1045

Re: Execution speed of nested loops

I reversed each loop in turn, but there was no difference in execution time.

However, there was one weird result. When loop counter, i, is defined as a ULongInt, the execution time is 59s. Otherwise, if I redefine it as a ULong, the execution time is then 72s.

Go to advanced search