Author Topic: SDK style programming with FreeBASIC  (Read 4253 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9988
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: SDK style programming with FreeBASIC
« Reply #15 on: November 18, 2020, 11:11:24 PM »
Erol,

I have tended to leave it alone as I did not want to take over Pelle's usage of POASM. The other factor is I have a mountain of work to do in 64 bit MASM and I don't have enough time to do both. I write some PowerBASIC from time to time as I need it for certain tools but I have to keep grinding away on 64 bit MASM.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

Vortex

  • Member
  • *****
  • Posts: 2716
Re: SDK style programming with FreeBASIC
« Reply #16 on: February 17, 2021, 02:09:01 AM »
Example with inline assembly targetting both of the 32-bit and 64-bit platforms :

Code: [Select]
#include once "windows.bi"
#include once "crt.bi"

#ifdef __FB_64BIT__

    #define CallConvention
    #define ptrsize QWORD

#else

    #define CallConvention Cdecl
    #define ptrsize WORD

#endif

Declare Function main() As Any Ptr

Sub mainCRTStartup CallConvention Alias "mainCRTStartup"()

    main()
    ExitProcess(0)

End Sub


Function main() As Any Ptr

Dim As UInteger i

     asm    mov ptrsize PTR [i],0     

_loop:

     printf !"Hello world!\n"

     asm    inc ptrsize PTR [i]
     asm    cmp ptrsize PTR [i],10
     asm    jne _loop

     Function=0

End Function

Gunther

  • Member
  • *****
  • Posts: 4115
  • Forgive your enemies, but never forget their names
Re: SDK style programming with FreeBASIC
« Reply #17 on: February 17, 2021, 03:07:32 AM »
Erol,

nice examples. I didn't know you were a BASIC fan.

Gunther
You have to know the facts before you can distort them.

Vortex

  • Member
  • *****
  • Posts: 2716
Re: SDK style programming with FreeBASIC
« Reply #18 on: March 20, 2021, 09:16:27 PM »
The GNU assembler Gas supports the INCBIN statement :

Code: [Select]
Asm

.data

icondata:

     .incbin "Bug.ico"

.text

End Asm

jj2007

  • Member
  • *****
  • Posts: 13274
  • Assembly is fun ;-)
    • MasmBasic
Re: SDK style programming with FreeBASIC
« Reply #19 on: March 20, 2021, 09:19:31 PM »
Is there a big difference to 123 RCDATA "bug.ico" in the resource section? I try to remain MASM-compatible...
Masm32 Tips, Tricks and Traps

Some members can't live without insulting others. It tells us a lot about them.

Vortex

  • Member
  • *****
  • Posts: 2716
Re: SDK style programming with FreeBASIC
« Reply #20 on: March 20, 2021, 09:24:49 PM »
Hi Jochen,

123 RCDATA "bug.ico" is better. My example is based on the CreateIconFromResource API. This is why I used the INCBIN statement. You can embed images with INCBIN into your executable.

jj2007

  • Member
  • *****
  • Posts: 13274
  • Assembly is fun ;-)
    • MasmBasic
Re: SDK style programming with FreeBASIC
« Reply #21 on: March 20, 2021, 09:30:09 PM »
Hi Erol,

Firefox complains that your archive contains dangerous stuff. I opened it nonetheless, and now I understand: your code is very, very buggy :eusa_naughty:
Masm32 Tips, Tricks and Traps

Some members can't live without insulting others. It tells us a lot about them.

Vortex

  • Member
  • *****
  • Posts: 2716
Re: SDK style programming with FreeBASIC
« Reply #22 on: February 11, 2022, 04:41:57 AM »
Hello,

Small command line tool retrieving your WAN IP address from the internet. Converted from Poasm to FreeBASIC.

TimoVJL

  • Member
  • *****
  • Posts: 1223
Re: SDK style programming with FreeBASIC
« Reply #23 on: February 11, 2022, 08:58:57 AM »
64-bit is small too

EDIT: those who likes BASIC, can have a free option to develop even small applications with it.
« Last Edit: February 11, 2022, 08:43:39 PM by TimoVJL »
May the source be with you