CryptoRndIV

General FreeBASIC programming questions.
Post Reply
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: CryptoRndIV

Post by deltarho[1859] »

dodicat wrote:All derived filetypes from the source, (.exe,.asm,.c,.a,.dll, . . . ) appear alongside the original .bas file, direct console compile will at least guarantee this behaviour.
(Just a thought)
I didn't understand a word of that. :)
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: CryptoRndIV

Post by SARG »

I guess he means when using options in command line and not with #cmdline you will get all the associated files without any problem.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: CryptoRndIV

Post by dodicat »

deltarho
myfile.bas in myfolder
examples:
#cmdline " -s console" myfile.exe in myfolder
#cmdline " -RR" myfile.exe and myfile.asm in myfolder
#cmdline " -R" myfile.exe and myfile.c in myfolder
#cmdline " -lib" libmyfile.a in myfolder
e.t.c.
If by any chance a quickrun in an ide puts the temp.bas file in a different location then the .asm file may not be not be in myfolder.
Try a straight compile and then run the executable.
You can delete everything manually when done.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: CryptoRndIV

Post by dodicat »

WinFBE_Suite (64 bit) question [SOLVED]
Last edited by dodicat on Mar 14, 2023 6:18, edited 1 time in total.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: CryptoRndIV

Post by deltarho[1859] »

@dodicat

I don't understand what you are doing again.
You will notice that the target compiler is 32 bits with gas backend even although I started WinFBE64.exe
WinFBE64.exe is a 64-bit version of WinFBE32.exe and has nothing to do with the build configuration. WinFBE32.exe is for those who only have a 32-bit version of Windows.

If you want to switch from 32-bit to 64-bit don't use 'Build Configurations' use the SetCompilerSwitches form.

This will give you 32_bit

Image

This will give you 64_bit

Image

If you click on the '-gen gas64' button, then use the second image. For '-gen gas' use the first image.

For the various gcc options then use whichever image is appropriate.

The whole point of SetCompilerSwitches is to make life easier.

I have SetCompilerSwitches displayed on the far right of WinFBE's edit window and invoked immediately after WinFBE starts. It remains open for the entire WinFBE session. In 'Environment Options>Code Editor' I have 'Show edge margin' positioned just to the left of the SeCompilerSwitches form. When editing code, I make sure that I do not go past the edge margin; because SeCompilerSwitches is topmost. I wish that I was this organized in my private life – I am very absent-minded. I should put a reminder in my 'phone for my car's oil level and tyre pressure, which tend to be rare events. Blimey, I could get a £2,500 fine for a poor tyre pressure in the UK!


If you use the latest version of SetCompilerSwitches, from opening post here, click on the Edit button, to get a child window, and add -RR – you don't have to use 'Compiler Setup'. Click on OK. We don't have to click on 'Apply' in the parent window – it is applied when we click on OK in the child window.

So, how the blazes are folk to know the above? In the above link is drWinFBETools.chm which explains all, but who reads Help files? Muggins here does. :)
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: CryptoRndIV

Post by dodicat »

OK
file/preferences/build configurations/
Set as default FBC 64 bit.
This does the job.
onerror.bas

Code: Select all

#cmdline "-exx -gen gcc -RR"
#macro errload
Print "Error handler active."
Dim errnum as long
On Error Goto ehandler
#endmacro

#macro errhandle
Goto skipover
	ehandler:
    Errnum = Err()
    Print "ERROR ";Errnum;"  ";
    Select Case as const Errnum
    case 0: Print " ... "
    Case 1 :Print  "Illegal function call" 
    Case 2 :Print  "File not found signal" 
    Case 3 :Print  "File I/O error" 
    Case 4 :Print  "Out of memory" 
    Case 5 :Print  "Illegal resume" 
    Case 6 :Print "Out of bounds array access" 
    Case 7 :Print  "Null Pointer Access" 
    Case 8 :Print  "No privileges" 
    Case 9 :Print  "interrupted signal" 
    Case 10 :Print  "illegal instruction signal" 
    Case 11 :Print  "floating point error signal" 
    Case 12 :Print  "segmentation violation signal" 
    Case 13 :Print  "Termination request signal" 
    Case 14 :Print  "abnormal termination signal" 
    Case 15 :Print  "quit request signal" 
    Case 16 :Print  "return without gosub" 
    Case 17 :Print  "end of file" 
    End Select
    Print "Function: " &__function__
    #ifdef __FB_LANG__
    #if __FB_LANG__ = "qb"
    Print "Module: " & *__Ermn
    #else
     Print "Module: " & *Ermn
    #endif
    #endif
    Print "Line: " & Erl
    Print "Press a key to exit"
    'Sleep
    'End 
skipover: 
#endmacro

errload

type tudt
		aaa as INTEGER
		bbb as INTEGER
End Type
dim as tudt udt
dim as any ptr ptrbuffer
dim as uinteger tempvar
asm nop '''added for an easy search
TempVar = *Cast(Uinteger Ptr, ptrBuffer)
asm nop
errhandle

var file= rtrim(command(0),".exe")+".asm"

shell "notepad "+file
kill file

sleep 
compile
then
run executable
does the job.
No need to set switches in 64 bits, #cmdline does the job.
job done.
Thanks.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: CryptoRndIV

Post by deltarho[1859] »

@dodicat

Do you have an aversion to using SetCompilerSwitches?

I have just added a warning in drWinFBE_Tools.chm.

WARNING

If you use 'Build configurations...' for any reason, then clear the command line in SetCompilerSwithesII by clicking on the 'Clear' button.. If you change the architecture in 'Build configurations...' this will not be reflected in the SetCompilerSwithesII form. SetCompilerSwithesII has its own way of remembering which architecture was chosen.

I did that and then tried to compile your last code and I still got the three errors.

Ah, I used Quick Run. So, I compiled to the desktop and ran the exe from there.

If you put "-exx -gen gcc -RR", sans quotes, into SetCompilerSwitches and use my second image above, you don't need to use 'Build Configurations...'

I wouldn't touch #cmdline with a barge pole. :)

Added: Oops, that is all very well me saying that – it is handy for those not using WinFBE. :)
Last edited by deltarho[1859] on Mar 14, 2023 7:12, edited 1 time in total.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: CryptoRndIV

Post by deltarho[1859] »

Actually, it is easier by choosing '-gen gcc' in SetCompilerSwitchesII, select -exx, and the second image above regarding '-arch ?'

Now Edit until we only have '-exx -gen gcc' and add -RR.

No need for #cmdline or 'Build Configurations'.

BTW, you should let Paul Squires know about the 'Quick Run' issue – he doesn't come to these forums often, and I doubt that he would come to this thread.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: CryptoRndIV

Post by dodicat »

I think maybe Paul Squires would do a forum search for winfbe now and then, quite a few folk use it I believe.
Using #cmdline has given fbide a new lease of life, given it's problem with uppercase switches.
And it is neat, no need to tell people what switches to use, it is done for them.
Maybe you could mention the quick run thing in winfbe since you are involved in the project.
Back to fbide now, my ancient trusted cronie.
I can do no more here until I get a newer computer with the hardware random number generator.
Regarding 32 bits, it is still the first choice for many because it will run on nearly every computer at this stage in time.

I have just noticed
dim as string file= rtrim(command(0),".exe")+".asm"
is OK with quick run
Strange??
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: CryptoRndIV

Post by deltarho[1859] »

dodicat wrote:Maybe you could mention the quick run thing in winfbe since you are involved in the project.
I'll take care of it. I don't even talk to Paul via PlanetSquires - all communications are done via email. He gets back to me fairly quickly.
I can do no more here until I get a newer computer with the hardware random number generator.
You could always get a new motherboard. However, I would be loathed to do that with a 2011 machine. A friend of mine did that recently, and it cost him £200. Come to think of it, the joints on your current motherboard are well past their normal life expectancy and could go down anytime. That happened to me with my Win98 box.

Have a look at Mesh Computers. Click on DESKTOP PCS. Their gaming machines may be a bit expensive, but their Home Office PCs are very affordable. I've had three machines from them since 2000, and they are exceptionally well-built. They have won more awards than you can shake a stick at.

I noticed that you are still using the 486.

With SetCompilerSwitchesII gas and gcc 32 have these added to the command line automatically.

-w all -fpmode fast -fpu sse -arch 686
-w all -fpmode fast -fpu sse -arch 686

With gas64 and gcc 64 these are added automatically.

-w all -fpmode fast -fpu sse
-w all -fpmode fast -fpu sse

Why SSE? I cannot find my post now, but I had an issue using gcc (any version) in 32-bit mode with the X87, so I switched to using SSE. PowerBASIC has Extended Precision (64 bits precision) via the FPU with Double Precision (53 bits precision) and Single Precision (24 bits precision). We don't have Extended Precision (Why not?) so we don't lose any precision by using SSE. I may be wrong but I think SSE is faster than the FPU.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: CryptoRndIV

Post by deltarho[1859] »

@dodicat

Where did you first mention an issue with Quick Run? I need to give Paul a link.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: CryptoRndIV

Post by dodicat »

Just use this:
64 bits windows.
var file= rtrim(command(0),".exe")+".asm" -- Doesn't work with WinFBE quick run'
dim as string file= rtrim(command(0),".exe")+".asm" -- Works with quick run
below:

Code: Select all

#cmdline "-exx -gen gcc -RR"
#macro errload
Print "Error handler active."
Dim errnum as long
On Error Goto ehandler
#endmacro

#macro errhandle
Goto skipover
	ehandler:
    Errnum = Err()
    Print "ERROR ";Errnum;"  ";
    Select Case as const Errnum
    case 0: Print " ... "
    Case 1 :Print  "Illegal function call" 
    Case 2 :Print  "File not found signal" 
    Case 3 :Print  "File I/O error" 
    Case 4 :Print  "Out of memory" 
    Case 5 :Print  "Illegal resume" 
    Case 6 :Print "Out of bounds array access" 
    Case 7 :Print  "Null Pointer Access" 
    Case 8 :Print  "No privileges" 
    Case 9 :Print  "interrupted signal" 
    Case 10 :Print  "illegal instruction signal" 
    Case 11 :Print  "floating point error signal" 
    Case 12 :Print  "segmentation violation signal" 
    Case 13 :Print  "Termination request signal" 
    Case 14 :Print  "abnormal termination signal" 
    Case 15 :Print  "quit request signal" 
    Case 16 :Print  "return without gosub" 
    Case 17 :Print  "end of file" 
    End Select
    Print "Function: " &__function__
    #ifdef __FB_LANG__
    #if __FB_LANG__ = "qb"
    Print "Module: " & *__Ermn
    #else
     Print "Module: " & *Ermn
    #endif
    #endif
    Print "Line: " & Erl
    Print "Press a key to exit"
    'Sleep
    'End 
skipover: 
#endmacro

errload

type tudt
		aaa as INTEGER
		bbb as INTEGER
End Type
dim as tudt udt
dim as any ptr ptrbuffer
dim as uinteger tempvar
asm nop '''added for an easy search
TempVar = *Cast(Uinteger Ptr, ptrBuffer)
asm nop
errhandle
'var file= rtrim(command(0),".exe")+".asm"
dim as string file= rtrim(command(0),".exe")+".asm"

shell "notepad "+file
kill file

sleep 
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: CryptoRndIV

Post by deltarho[1859] »

@dodicat

I have just sent Paul an email.

For what it is worth, I never use var and neither does fxm. It is a flaky command, and there is no guarantee that it will do what you think it should.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: CryptoRndIV

Post by dodicat »

Var is an neat way to dimension a variable. It is very handy in winapi say where it takes upon itself to become the correct typeof(whatever is thrown at it) most of the time.
It is a valuable fb keyword.
But the question here is why it doesn't work with quick run, but works with compile - run executable?
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: CryptoRndIV

Post by deltarho[1859] »

@dodicat

Paul got back to me. The power of email. :)

He reckons that in your context 'var' should have worked. He'll look into it later when he fires up his development machine. Development machine? I wonder what that is.
Post Reply