Search found 2095 matches

by caseih
Mar 17, 2023 17:39
Forum: General
Topic: Code request: Need an function that returns true when this function is called in an function or sub
Replies: 9
Views: 763

Re: Code request: Need an function that returns true when this function is called in an function or sub

I like the macro idea.

Another idea is to use a code profiler to trace the execution of the program and all the subroutine calls.
by caseih
Mar 17, 2023 15:03
Forum: General
Topic: Code request: Need an function that returns true when this function is called in an function or sub
Replies: 9
Views: 763

Re: Code request: Need an function that returns true when this function is called in an function or sub

I'm not clear at all on what you mean there.

Can you be more specific and explain what you want to do?
by caseih
Mar 17, 2023 14:40
Forum: Linux
Topic: STATIC and SHARED Libraries linking problem
Replies: 5
Views: 2794

Re: STATIC and SHARED Libraries linking problem

I just mean that when you're not sure what package ships a particular library in your distribution, you can use one of the RPM search sites to identify it, and then use your distro tools to install it from the official repos. Another way is just with the distro's own package manager search tool (apt...
by caseih
Mar 16, 2023 17:41
Forum: General
Topic: Store and Load the SUB's from file possible?
Replies: 2
Views: 378

Re: Store and Load the SUB's from file possible?

Ive tried to do this and got an Syntax Error.. xD Simply dumping and loading into memory won't work because in-memory code has been modified by the loader and linker to only work in that specific location of memory, with the specific memory layout of the running program at that time. Also some oper...
by caseih
Mar 16, 2023 17:35
Forum: Linux
Topic: STATIC and SHARED Libraries linking problem
Replies: 5
Views: 2794

Re: STATIC and SHARED Libraries linking problem

Just curious which distributions can libtinfo.so.5 not be installed from standard distro repos? Of all the major distros and their derivatives, Arch, Debian, Ubuntu, Fedora, and OpenSUSE all provide libtinfo.so.5 in a package. Although I'm least sure about OpenSUSE. One solution is to put the parts,...
by caseih
Mar 16, 2023 14:55
Forum: Beginners
Topic: return self exe name
Replies: 8
Views: 1294

Re: return self exe name

I forgot how to use zstring directly from QB. In the wiki docs, it lists the alternate names for keywords, types, functions, and subs you can use from the QB dialect.
by caseih
Mar 15, 2023 23:50
Forum: Beginners
Topic: return self exe name
Replies: 8
Views: 1294

Re: return self exe name

Many win32 calls expect to deal with pointers, which you can't easily do from QB dialect. But you can create a wrapper around the win32 calls using the normal FB dialect with pointers and zstring buffers etc, which wraps the final result in a a normal FB string which can be returned from a function....
by caseih
Mar 09, 2023 1:46
Forum: Community Discussion
Topic: It's it possible to translate FreeBasic for Atari2600 ?
Replies: 8
Views: 1607

Re: It's it possible to translate FreeBasic for Atari2600 ?

While only tangentially related to this topic, thinking about FB on the 2600 reminded me of this presentation on using modern C++17 to program a Commodore 64 which was fascinating: https://www.youtube.com/watch?v=zBkNBP00wJE So it's not a completely unreasonable thought that FB could be of use even ...
by caseih
Feb 21, 2023 14:31
Forum: General
Topic: Two's compliment [SOLVED]
Replies: 28
Views: 1901

Re: Two's compliment [SOLVED]

Thanks @fxm. I edited my post accordingly. Also fun to relearn about 2's and 1's complement.

Glad you got it working, @Dinosaur!
by caseih
Feb 21, 2023 5:16
Forum: General
Topic: Two's compliment [SOLVED]
Replies: 28
Views: 1901

Re: Two's compliment

Possibly. The Raspberry Pi is a little endian machine, so if you were to read the first byte of the memory where the integer lives, it would be the LSB first. I assume wireingPiI2CWriteReg16 just casts the short integer to a bytes and sends the first byte then the second byte, so on the Pi it's prob...
by caseih
Feb 21, 2023 5:05
Forum: General
Topic: Two's compliment [SOLVED]
Replies: 28
Views: 1901

Re: Two's compliment

Good to see some actual code. Yes you're definitely over thinking it. There's no need to do any bit twiddling except fixing the byte order of the number. wiringPiI2CReadReg16 already returns a 16-bit value that you are putting in a signed 16-bit variable. The only caveat is that this particular ADC ...
by caseih
Feb 21, 2023 3:05
Forum: General
Topic: Two's compliment [SOLVED]
Replies: 28
Views: 1901

Re: Two's compliment

Poor choice of words on his part, but I don't think he was attacking you personally in any way. Rather he pointed out that order of operations and operator precedence means the operations you stated don't work in the way you thought they did. Also in your example code you incorrectly defined negatin...
by caseih
Feb 21, 2023 0:31
Forum: General
Topic: Two's compliment [SOLVED]
Replies: 28
Views: 1901

Re: Two's compliment

I am getting a 16 bit number that is in Two's compliment format from an A2d converter. So, my true resolution is 15 bits with bit 16 the sign. You might be over thinking this. Provided the number being spit out from the A2D converter is little endian like your computer is, no handling is necessary ...
by caseih
Feb 20, 2023 19:14
Forum: General
Topic: Two's compliment [SOLVED]
Replies: 28
Views: 1901

Re: Two's compliment

To be clear you always add 1 after the NOT operation, regardless of which way you are going.
by caseih
Feb 20, 2023 17:03
Forum: General
Topic: Two's compliment [SOLVED]
Replies: 28
Views: 1901

Re: Two's compliment

I'm a bit confused. A number in two's compliment *is* an integer by definition. That's the whole idea. Are you really asking if there's a way to find the absolute value of the signed integer without bit twiddling? The answer to that is no; it always requires a negation operation, which is really a t...