Search found 199 matches

by greenink
Jan 30, 2017 23:26
Forum: Community Discussion
Topic: Best Programming Language
Replies: 34
Views: 6236

Re: Best Programming Language

Try finding a simple, well defined low level programming language. There are none. C2 looks like it will never be finished and I didn't see in the documentation that it is fully defined (2's complement arithmetic.) There are a few others in the same kind of state. With FB I can do low level programm...
by greenink
Jan 19, 2017 14:33
Forum: Beginners
Topic: How to "reverse" a byte?
Replies: 69
Views: 5562

Re: How to "reverse" a byte?

Code: Select all

for i as ulong=0 to 255
   dim as ubyte x=i
   x=((x and &h55) shl 1) or ((x and not &h55) shr 1)
   x=((x and &h33) shl 2) or ((x and not &h33) shr 2)
   x=((x and &h0f) shl 4) or ((x and not &h0f) shr 4)
   print bin(i,8), bin(x,8)
next
by greenink
Jan 19, 2017 6:38
Forum: Beginners
Topic: How to "reverse" a byte?
Replies: 69
Views: 5562

Re: How to "reverse" a byte?

Code: Select all

for i as ulong=0 to 255
   dim as ubyte x=i
   print bin(x,8), bin(((x * &H0802 And &H22110) Or (x * &H8020 and &h88440)) * &H10101 Shr 16,8)
next
by greenink
Jan 19, 2017 0:07
Forum: Beginners
Topic: How to "reverse" a byte?
Replies: 69
Views: 5562

Re: How to "reverse" a byte?

the bswap instruction reverses the order of bytes in a 32 bit/64 bit integer. The first byte is swapped with the last, the second with the second last etc. It doesn't reverse the bit order within a byte. It's useful for random number generators, hashing etc.
by greenink
Jan 18, 2017 13:04
Forum: Beginners
Topic: How to "reverse" a byte?
Replies: 69
Views: 5562

Re: How to "reverse" a byte?

The book here has many delightful bit hacks:
http://www.jjj.de/fxt/
by greenink
Jan 17, 2017 21:55
Forum: Game Dev
Topic: Isometric shadow casting light.
Replies: 148
Views: 15163

Re: Isometric shadow casting light.

-O 3 sets the optimization level of the compiler to maximum. It works great with those versions of FB that use GCC (a C compiler) to produce the final code. I guess it depends on what OS you use. I also have heard that FB graphics is rather slow on windows 10 for some reason, maybe that is causing t...
by greenink
Jan 17, 2017 12:54
Forum: Game Dev
Topic: Isometric shadow casting light.
Replies: 148
Views: 15163

Re: Isometric shadow casting light.

It still works fast for me even with other threads putting my CPU usage to 100% on both cores. Are you using the -O 3 command line option when compiling? Also multiplication is much faster than division. I would do most of the calculations in single floating point. For If aupd=0 Then alphac=(curpixe...
by greenink
Jan 08, 2017 15:59
Forum: Tips and Tricks
Topic: Book Chat
Replies: 0
Views: 438

Book Chat

This text prediction thing was done before. However after predicting a certain amount it fell into repeating loops. By using multiple prediction trees (with different root nodes) and randomly switching between them you can hope to break the loops. type robinhood count as ulongint 'total items in the...
by greenink
Jan 07, 2017 0:50
Forum: Community Discussion
Topic: Java & FreeBasic
Replies: 6
Views: 4750

Re: Java & FreeBasic

C is defined as much by the compiler settings you use as by the code. I find that very problematic. With FreeBasic most all of the behavior is defined in the code. Actually the core Java language is rather well defined and there is some access to things like bit rotates. Unfortunately there are no s...
by greenink
Jan 07, 2017 0:29
Forum: Community Discussion
Topic: Licensing...
Replies: 26
Views: 2337

Re: Licensing...

Who's making you add a license, why should the average person even bother? Some one could resell my code, patent it. It makes no difference to me. My view point is, I'm not a lawyer, why should I be forced to add legal terms I don't fully understand.
by greenink
Jan 03, 2017 1:02
Forum: Tips and Tricks
Topic: Water Wave Simulation
Replies: 3
Views: 1027

Re: Water Wave Simulation

German universities are number 1. Unfortunately somewhat starved of cash. The US universities are funded by 1 trillion dollars of student debt, giving them plenty of money for research.
by greenink
Dec 28, 2016 2:32
Forum: Community Discussion
Topic: BASIC was meant to be easy to learn, read and understand
Replies: 45
Views: 4664

Re: BASIC was meant to be easy to learn, read and understand

Even very old versions of Basic (eg zx spectrum) had graphics and other io operations as standard. Many languages now don't, that's the main reason I never switched over to D, Go, Swift or some of those other languages. FB has a very stable graphics system.
by greenink
Dec 24, 2016 10:34
Forum: General
Topic: GUI design
Replies: 47
Views: 4395

Re: GUI design

Tcl/Tk could be an option.
https://www.tcl.tk/software/tcltk/
by greenink
Dec 22, 2016 23:02
Forum: Community Discussion
Topic: 1024 core CPU
Replies: 2
Views: 647

Re: 1024 core CPU

It looks like you will get about 2 Tflops. I would say it would be almost as difficult to program as a GPU but for people who just need to run one or two key algorithms on the thing it should work great.

Go to advanced search