News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Where to get PowerBASIC?

Started by 2-Bit Chip, December 04, 2009, 04:56:08 AM

Previous topic - Next topic

Logman

I second your wish regarding static libraries.

I too have been using PowerBASIC since it originally appeared on the scene for DOS after Bob bought out the rights from Borland. I find myself much more experienced now and would really like to see both a 64-bit version of his compiler and the inclusion of a linker so I can use static libraries. In terms of a 64-bit  version, Bob must be working on one because 64-bit is the future and with so many other languages having gone 64-bit, I don't see how Bob can possibly not be addressing this.

One thing about PowerBASIC even though it is pricy the first time you buy it (updates cost much less), it is fast, powerful, and commercially viable in that it shouldn't disappear like so many "indie" basics out there. Besides, PowerBASIC comes from my home state.

Logman
If you read the fine print, you'll get an education. If you don't, you'll get experience!

BlackVortex

Can someone post a simple example exe, so I can take a look at it ?

hutch--

How simple, GUI, CONSOLE, source code and exe etc .... ?
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

BlackVortex

Just console , plz   :toothy

hutch--

 :bg

Easy,

This example is written like MASM code and steals a number of no stack frame procedures from the MASM32 library. Its a trick to get around the exclusion of module level code by setting up a SUB with assembler procedures in it, getting the start addresses and writing them to global scope DWORD variables then calling those addresses with normal push/call notation.


#IF 0  ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    No stack frame procedures in PowerBASIC

#ENDIF ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    GLOBAL slnth as DWORD
    GLOBAL lower as DWORD
    GLOBAL upper as DWORD
    GLOBAL monos as DWORD

' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

FUNCTION PBmain as LONG

    #REGISTER NONE

    LOCAL pstr as DWORD
    LOCAL lstr as DWORD
    LOCAL szText as ASCIIZ * 96

    WriteProcAddresses              ' get the address of each procedure

    szText = " THIS IS A STRING   TO TEST  THE  STRING LENGTH    ALGO "

    StdOut szText

    pstr = VarPtr(szText)

    ! push pstr
    ! call slnth                    ' get string length
    ! mov lstr, eax
    StdOut "Length ="+str$(lstr)

    ! push pstr
    ! call lower                    ' convert it to lower case

    StdOut szText

    ! push pstr
    ! call upper                    ' convert it to upper case

    StdOut szText

    ! push pstr
    ! call monos                    ' clean up the spacing and other junk

    StdOut szText

    ! push pstr
    ! call slnth                    ' get string length
    ! mov lstr, eax
    StdOut "Length ="+str$(lstr)

    StdOut "Press any key to say Bye Bye ...."

    Do
      Sleep 10
    Loop while inkey$ = ""

    FUNCTION = 0

End FUNCTION

' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

SUB WriteProcAddresses()

    #REGISTER NONE

    slnth = CodePtr(proc1)
    lower = CodePtr(proc2)
    upper = CodePtr(proc3)
    monos = CodePtr(proc4)

    Exit SUB

' --------------------------------------------------------
' string length
' --------------------------------------------------------
  #align 16
  proc1:
    ! mov eax, [esp+4]
    ! sub eax, 4

  lbl0:
    ! add eax, 4
    ! cmp BYTE PTR [eax], 0
    ! je lb1
    ! cmp BYTE PTR [eax+1], 0
    ! je lb2
    ! cmp BYTE PTR [eax+2], 0
    ! je lb3
    ! cmp BYTE PTR [eax+3], 0
    ! jne lbl0

    ! sub eax, [esp+4]
    ! add eax, 3
    ! ret 4
  lb3:
    ! sub eax, [esp+4]
    ! add eax, 2
    ! ret 4
  lb2:
    ! sub eax, [esp+4]
    ! add eax, 1
    ! ret 4
  lb1:
    ! sub eax, [esp+4]
    ! ret 4

' --------------------------------------------------------
' lower case
' --------------------------------------------------------
  #align 16
  proc2:
    ! mov eax, [esp+4]
    ! dec eax

  lbl4:
    ! add eax, 1
    ! cmp BYTE PTR [eax], 0
    ! je lbl5
    ! cmp BYTE PTR [eax], "A"
    ! jb lbl4
    ! cmp BYTE PTR [eax], "Z"
    ! ja lbl4
    ! add BYTE PTR [eax], 32
    ! jmp lbl4
  lbl5:

    ! mov eax, [esp+4]
    ! ret 4

' --------------------------------------------------------
' upper case
' --------------------------------------------------------
  #align 16
  proc3:
    ! mov eax, [esp+4]
    ! dec eax

  lbl6:
    ! add eax, 1
    ! cmp BYTE PTR [eax], 0
    ! je lbl7
    ! cmp BYTE PTR [eax], "a"
    ! jb lbl6
    ! cmp BYTE PTR [eax], "z"
    ! ja lbl6
    ! sub BYTE PTR [eax], 32
    ! jmp lbl6
  lbl7:

    ! mov eax, [esp+4]
    ! ret 4

' --------------------------------------------------------
' monospace and clean up text
' --------------------------------------------------------
  #align 16
  proc4:
    ! push ebx
    ! push esi
    ! push edi
    ! push ebp

    ! mov esi, 1
    ! mov edi, 32
    ! mov bl, 32
    ! mov ebp, 9

    ! mov ecx, [esp+20]
    ! xor eax, eax
    ! sub ecx, esi
    ! mov edx, [esp+20]
    ! jmp ftrim                       ; trim the start of the string

  wspace:
    ! mov BYTE PTR [edx], bl          ; always write a space
    ! add edx, esi

  ftrim:
    ! add ecx, esi
    ! movzx eax, BYTE PTR [ecx]
    ! cmp eax, edi                    ; throw away space
    ! je ftrim
    ! cmp eax, ebp                    ; throw away tab
    ! je ftrim
    ! sub ecx, esi

  stlp:
    ! add ecx, esi
    ! movzx eax, BYTE PTR [ecx]
    ! cmp eax, edi                    ; loop back on space
    ! je wspace
    ! cmp eax, ebp                    ; loop back on tab
    ! je wspace
    ! mov [edx], al                   ; write the non space character
    ! add edx, esi
    ! test eax, eax                   ; if its not zero, loop back
    ! jne stlp

    ! cmp BYTE PTR [edx-2], bl        ; test for a single trailing space
    ! jne quit
    ! mov BYTE PTR [edx-2], 0         ; overwrite it with zero if it is

  quit:
    ! mov eax, [esp+20]

    ! pop ebp
    ! pop edi
    ! pop esi
    ! pop ebx

    ! ret 4

' --------------------------------------------------------

END SUB

' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

GregL

Logman,

One of the PowerBASIC guys, I think it was Steve Rossell, said they were working on a 64-bit version of PB.  That post seems to have disappeared now.  Anyway, that's good news.