Search found 4989 matches

by dodicat
Aug 21, 2018 18:15
Forum: Tips and Tricks
Topic: C-like for() statement using macros
Replies: 14
Views: 600

Re: C-like for() statement using macros

Using a label in a macro with repeat calls. (The parsed fb code uses labels anyway for for loops.) The scope is needed only for different variables, not for labels. #macro forloop(a,b,c,instruction) scope a #define labl label: labl instruction c if b then goto labl #undef label end scope #endmacro f...
by dodicat
Aug 20, 2018 16:17
Forum: Beginners
Topic: More on closing windows
Replies: 6
Views: 175

Re: More on closing windows

Thanks fxm. In that case perhaps, preserving the console: ' uses WinGUI(12) by Lothar Schirm '#Include "WinGUI.bi" #include "windows.bi" #Include "fbgfx.bi" function Window_Event_Close(h as hwnd, msg as msg) as boolean if msg.message=273 then return DestroyWindow(h) end...
by dodicat
Aug 20, 2018 15:34
Forum: General
Topic: Squares
Replies: 5957
Views: 332680

Re: Squares

Hi Albert. The highest power of two I can use is 32. The crt goes to 36 but that means using mod and div which is bound to slow things. So this type of reduction to a base will be too slow anyway I suppose. Here is the base 32 anyway: #include "crt.bi" function ULongToBase(N as ulongint,_b...
by dodicat
Aug 20, 2018 15:05
Forum: Beginners
Topic: More on closing windows
Replies: 6
Views: 175

Re: More on closing windows

I'll try. Although the help file says the handle via screencontrol is an hwnd, it must be a different flavour of hwnd, because it won't work. The help file says that gfx_null is a bridge between fb screen and api hwnd. So why not use this instead? I've tried to simulate Lothar's subs, but I have nev...
by dodicat
Aug 20, 2018 9:52
Forum: Tips and Tricks
Topic: Saving space when drawing rectangles
Replies: 15
Views: 284

Re: Saving space when drawing rectangles

jj2007 Works well on both compilers. Regarding #ifdef __FB_64BIT__ Yea, I shall remember dash dash FB dash 64BIT dash dash I have forgotten already. rdx and rcx and the mmx registers I note for 64 bit. Aside, non mmx cpu's don't work properly with fb since about version 18 I tested on my old Pentium...
by dodicat
Aug 20, 2018 8:35
Forum: Tips and Tricks
Topic: Saving space when drawing rectangles
Replies: 15
Views: 284

Re: Saving space when drawing rectangles

Or I find easier to remember:

Code: Select all

#if sizeof(integer)=8
print "64"
#else
print"32"
#endif
sleep 
by dodicat
Aug 20, 2018 0:34
Forum: Tips and Tricks
Topic: Saving space when drawing rectangles
Replies: 15
Views: 284

Re: Saving space when drawing rectangles

Instead of the asm, perhaps:

Code: Select all

sub SmallRectToRect(byref pDest as rect ptr, pSrc as small_rect ptr)
       pdest->left=pSrc->left
       pdest->top=pSrc->top
       pdest->right=pSrc->right
       pdest->bottom=pSrc->bottom
end sub

So it runs in 64 bit as well.
by dodicat
Aug 19, 2018 23:26
Forum: Tips and Tricks
Topic: Saving space when drawing rectangles
Replies: 15
Views: 284

Re: Saving space when drawing rectangles

I think that is very nice code jj2007
by dodicat
Aug 19, 2018 22:45
Forum: General
Topic: Squares
Replies: 5957
Views: 332680

Re: Squares

Hi Richard. If you byval your input strings then a switch from original to bin back to original then = original. Albert, not as fast as Richard's, but I have a new method. dec to hex then hex to bin. The dec to hex I have to speed up. The hex to bin is very fast. I have yet to make hex to dec. Funct...
by dodicat
Aug 18, 2018 15:37
Forum: Community Discussion
Topic: titles for posters?
Replies: 39
Views: 739

Re: titles for posters?

freeBASIC can handle old style line numbers. -gen gas is best 64 bit is useless 'rem prime factors #lang "fblite" 0 option gosub 1 lowers%=30000000 2 uppers%=30000100 10 For counts% = lowers% To uppers% 20 number% = counts% 30 40 Print number%;"= "; 50 divisor% = 2 60 if divisor%...
by dodicat
Aug 18, 2018 2:20
Forum: General
Topic: Two Ulongs to Double
Replies: 30
Views: 923

Re: Two Ulongs to Double

You can do a straight map using 0.. 2^31 -> 0...5 I am not sure how to incorporate the second parameter n2. The asm looks like an or then a subtraction. Function UlongToDouble( n1 As Ulong, n2 As Ulong = 0 ) As Double Asm movd xmm1, dword Ptr [n1] movd xmm0, dword Ptr [n2] punpckldq xmm0, xmm1 psrlq...
by dodicat
Aug 18, 2018 0:15
Forum: Tips and Tricks
Topic: Rect_t - optimized type definition
Replies: 36
Views: 876

Re: Rect_t - optimized type definition

In an image pointer there are three reserved spaces: [5],[6] and [7] These can be used to store the x,y co-ordinates of a rectangle position and the fill option. So all the information aforementioned as being required in a type can stored in the image, thus within the type. type rectangle as any ptr...
by dodicat
Aug 17, 2018 20:48
Forum: Beginners
Topic: How to close a window
Replies: 6
Views: 188

Re: How to close a window

..
by dodicat
Aug 17, 2018 15:14
Forum: Tips and Tricks
Topic: sub-pixel NN blit
Replies: 6
Views: 242

Re: sub-pixel NN blit

Paul Doe. Could you repair your model slightly. Press any key to refresh, esc to end. Function resize(im As Any Ptr,Wdth As Single,Hght As Single) As Any Ptr Dim As Integer iw,ih,imx,imy Imageinfo im,iw,ih Dim As Any Ptr OutImage=Imagecreate(Wdth,Hght) For y As Long=0 To Hght-1 imy= ih*y\(Hght-1) Fo...
by dodicat
Aug 16, 2018 23:20
Forum: Community Discussion
Topic: programming for fun
Replies: 44
Views: 1549

Re: programming for fun

Actually deltarho[] ... In the UK we had 'O' levels, at age 16, and 'A' levels, at age 18. ... Scotland had O grades and Highers. We must not forget the UK is composed of four countries and a few independent islands. Each with different educational systems. Nice story. Basiccoder2 Hard labour? We ca...

Go to advanced search