Search found 349 matches

by Armoured
Sun Feb 09, 2025 12:55 am
Forum: Coding Questions
Topic: Question about inline assembler and C backend.
Replies: 17
Views: 3237

Re: Question about inline assembler and C backend.

Ok! Thanks Fred, Jack, Idle, Brezee4me and Mk-soft.
This discussion was helpful to me.
by Armoured
Sat Feb 08, 2025 9:44 am
Forum: Coding Questions
Topic: Question about inline assembler and C backend.
Replies: 17
Views: 3237

Re: Question about inline assembler and C backend.

idle wrote: Sat Feb 08, 2025 1:26 am
Armoured wrote: Sat Feb 08, 2025 12:37 am
idle wrote: Fri Feb 07, 2025 7:10 pm You can easily use asm insrinsics in c backend if you need atomics.
How?
what functions do you need?
I need a function like InterlockedIncrement.
by Armoured
Sat Feb 08, 2025 12:37 am
Forum: Coding Questions
Topic: Question about inline assembler and C backend.
Replies: 17
Views: 3237

Re: Question about inline assembler and C backend.

idle wrote: Fri Feb 07, 2025 7:10 pm You can easily use asm insrinsics in c backend if you need atomics.
How?
by Armoured
Fri Feb 07, 2025 12:20 pm
Forum: Coding Questions
Topic: Question about inline assembler and C backend.
Replies: 17
Views: 3237

Re: Question about inline assembler and C backend.


I thought about this for awhile as it would be nice to still be able to use intel asm from the c backend
and while the demo isn't particularly useful it wouldn't be to hard to turn into a compiler tool so it generates a data section and loads it.
https://www.purebasic.fr/english/viewtopic.php?t ...
by Armoured
Fri Feb 07, 2025 12:19 pm
Forum: Coding Questions
Topic: Question about inline assembler and C backend.
Replies: 17
Views: 3237

Re: Question about inline assembler and C backend.


If you use ASM code in C-Backend, you have problems at the latest if you want to run the code on a machine with ARM (Raspberry, Window for ARM) or M1 (macOS).

So I never become ASM in C-backend.


You are absolutely right, but unfortunately I need to generate an atomic variable to optimize a ...
by Armoured
Thu Feb 06, 2025 6:34 pm
Forum: Coding Questions
Topic: Question about inline assembler and C backend.
Replies: 17
Views: 3237

Re: Question about inline assembler and C backend.

Thanks Jack! Your examples have been really helpful for understanding how to insert inline assembly code, which I couldn’t find in the PureBasic manual. I have one last question: could you point me to some tutorials or books on assembly that support this syntax (AT&T, if I understood correctly)?
by Armoured
Thu Feb 06, 2025 1:41 pm
Forum: Coding Questions
Topic: Question about inline assembler and C backend.
Replies: 17
Views: 3237

Re: Question about inline assembler and C backend.

With the asm{} keyword? Could you also provide a simple example?
Thanks.
by Armoured
Thu Feb 06, 2025 11:12 am
Forum: Coding Questions
Topic: Question about inline assembler and C backend.
Replies: 17
Views: 3237

Question about inline assembler and C backend.

I don't have experience with assembly programming, but after testing various examples, I noticed that they only work if the C backend is not used.
I was wondering if it is currently possible to use inline assembly with the C backend, and if so, how?

Thanks
by Armoured
Wed Nov 06, 2024 1:57 am
Forum: Coding Questions
Topic: Console resize
Replies: 16
Views: 3817

Re: Console resize


you can do it this way....

Procedure DisableWindowSizing(hWnd, State)
Protected currStyle

currStyle = GetWindowLongPtr_(hwnd, #GWL_STYLE)
If State
Style = currStyle & ~#WS_SIZEBOX ; <-- remove style flag #WS_SIZEBOX
Else
Style = currStyle | #WS_SIZEBOX ; <-- add style flag #WS_SIZEBOX ...
by Armoured
Tue Nov 05, 2024 4:10 pm
Forum: Coding Questions
Topic: Console resize
Replies: 16
Views: 3817

Re:


How about this one?

OpenConsole()
ConsoleTitle("Console fixed size")

stdout = GetStdHandle_(#STD_OUTPUT_HANDLE)

OpenLibrary(0, "kernel32.dll")
hWin = CallFunction(0, "GetConsoleWindow")
CloseLibrary(0)
;...Remove the Size option from the menu
system_menu = GetSystemMenu_(hWin, #False ...
by Armoured
Sun Oct 20, 2024 3:41 pm
Forum: Coding Questions
Topic: Issue with Resizing the Console Window
Replies: 4
Views: 524

Re: Issue with Resizing the Console Window



SetConsoleScreenBufferSize : The specified width and height cannot be less than the width and height of the console screen buffer's window.
To get around, you can shrink the window to a minimum before changing the buffer size

Procedure ResizeConsole(Cx, Cy)
If Cx <= 0 Or Cy <= 0 ...
by Armoured
Sun Oct 20, 2024 3:02 pm
Forum: Coding Questions
Topic: Issue with Resizing the Console Window
Replies: 4
Views: 524

Re: Issue with Resizing the Console Window


SetConsoleScreenBufferSize : The specified width and height cannot be less than the width and height of the console screen buffer's window.
To get around, you can shrink the window to a minimum before changing the buffer size

Procedure ResizeConsole(Cx, Cy)
If Cx <= 0 Or Cy <= 0 ...
by Armoured
Sun Oct 20, 2024 9:02 am
Forum: Coding Questions
Topic: Issue with Resizing the Console Window
Replies: 4
Views: 524

Issue with Resizing the Console Window

Hi,
The purpose of this procedure is to resize the console window and its buffer.
Unfortunately, I keep getting error 87 ("The parameter is incorrect.").
What am I doing wrong? :?

Thanks


Procedure ResizeConsole(Cx, Cy)
Protected stdout = GetStdHandle_(#STD_OUTPUT_HANDLE)

; Set the buffer ...
by Armoured
Tue Jul 09, 2024 11:43 pm
Forum: Coding Questions
Topic: Question about the dimensions of an image.
Replies: 12
Views: 1638

Re: Question about the dimensions of an image.

I’ve found a fix for the “problem” related to ImageGadget when the DPI aware option is enabled in the compiler settings. NetMaestro provided the solution, and you can find it here: https://www.purebasic.fr/english/viewtopic.php?t=82172.

Thanks to all for the help!
by Armoured
Tue Jul 09, 2024 9:14 pm
Forum: Coding Questions
Topic: Question about the dimensions of an image.
Replies: 12
Views: 1638

Re: Question about the dimensions of an image.


I ran your program:

#Image_0 = 1

CreateImage(#Image_0,600,270)
OpenWindow(0, 0, 0, 480, 329, "", #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
CreateMenu(0,WindowID(0))
MenuTitle("Test")
SetWindowColor(0, RGB(0,255,0))

ImageGadget(#Image_0, 0, 0, 480, 209, ImageID ...