PDA

View Full Version : BASM - BASIC to ASM compiler



John Spikowski
22-11-2014, 08:18
BASM is a fork the KoolB/Chameleon BASIC to ASM compiler/assembler/linker (written C++) that claims to be cross platform. (Windows & Linux) I have created a forum and Bitbucket repository for the project. If you have any interest in helping out with the project, come join us. It looks like a great way to learn ASM programming.

BASIC-Compiler.com - BASM Forum (http://www.basic-compiler.com/forum)

BASM @ Bitbucket (https://bitbucket.org/BASIC-Compiler/basm)

Note: Registration is instant with an e-mail verification.

ErosOlmi
23-11-2014, 14:09
John,

I think you should change name for your fork.
BASM was already used by Kevin Diggins in http://www.bcxbasic.com/ (see bottom of the page)

Ciao
Eros

John Spikowski
23-11-2014, 19:55
I think you should change name for your fork.

BASM was already used by Kevin Diggins in http://www.bcxbasic.com/ (see bottom of the page)




Actually, BASM is also the name of a Basic to Assembly translator written by Kevin Diggins (the author of BCX)

http://www.bcxbasic.com/basm286.zip

The source code is in PowerBasic: http://www.powerbasic.com/support/forums/Forum3/HTML/001746.html

Unfortunately, it emits only 16 bit assembly, also, it is abandoned (the author used his time to work on BCX).

So, you should change the name of your compiler.


Here is my response on the BASM forum (www.BASIC-Compiler.com/org) about the issue/subject.



Thanks for the research and info.

I really like the name and I'm not going to worry about dead efforts complaining. If it becomes a problem, I'll deal with it.

It's ironic that BASM was used by Kevin as I hosted and put a huge effort on this URL for the BCX project. Kevin only believed in Yahoo Groups at the time and now has his own forum for BCX after seeing the light. Maybe Mr. BCX will find time to contribute to carry on with this open source project. (please stop saying it's mine - been through that for years with SB)

ErosOlmi
23-11-2014, 21:12
Ok then.

Ciao
Eros

John Spikowski
24-11-2014, 02:23
FYI: I posted BASM Version 1 Build 1 to the Bitbucket repository. Testing and feedback welcome. If there is more than a casual interest, please join the BASM Forum (http://www.basic-compiler.com/forum).

Here is an example of using BASM



C:\BASM\Examples\Manifest>compile Manifest.bas

C:\BASM\Examples\Manifest>C:\BASM\Bin\BASM.exe "Manifest.bas" C:\BASM\Inc\

BASM - Version 1.0 Build 1
Currently compiling "Manifest.bas":
- Compile time -> 0.070000 seconds
- Assemble time -> 0.130000 seconds
- Linking time -> 0.140000 seconds
-------------------------------
- Total time -> 0.340000 seconds

C:\BASM\Examples\Manifest>dir
Volume in drive C has no label.
Volume Serial Number is 1415-F200

Directory of C:\BASM\Examples\Manifest

11/23/2014 02:43 PM <DIR> .
11/23/2014 02:43 PM <DIR> ..
11/23/2014 02:43 PM 32,405 Manifest.asm
07/27/2006 11:36 PM 818 Manifest.bas
07/27/2006 11:36 PM 876 Manifest.dlg
11/23/2014 02:43 PM 9,728 Manifest.exe
11/23/2014 02:43 PM 562 Manifest.manifest
11/23/2014 02:43 PM 32,744 Manifest.obj
11/23/2014 02:43 PM 925 Manifest.rc
11/23/2014 02:43 PM 1,362 Manifest.res
11/23/2014 02:43 PM 0 results.txt
9 File(s) 79,420 bytes
2 Dir(s) 68,190,101,504 bytes free

C:\BASM\Examples\Manifest>


http://www.basic-compiler.com/forum/screenshots/basm_themed.png http://www.basic-compiler.com/forum/screenshots/manifest_win7.png



'****************
'* Manifest.bas *
'****************

' Manifest.bas does absolutely nothing.
' It does however demonstrate the use of $XPStyle.

' Worth pointing out, is that when using $Resource
' and dialogs, the varible "StupidDialog" is never
' used. Refer to the name in the "dlg" file when
' working with them (in this case 102).

$AppType GUI
$XPStyle

$Include "Windows.inc"

$Resource StupidDialog As "Manifest.dlg"

Function DialogProc(hWndDlg As Integer, uMsg As Integer, _
wParam As Integer, lParam As Integer) As Integer
If uMsg = WM_CLOSE then
EndDialog(hwndDlg, 0)
Result = 0
Else
Result = 0
End If
End Function

DialogBoxParam(GetModuleHandle(0), MakeIntResource(102), _
HWND_DESKTOP, CodePtr(DialogProc), 0)


Manifest.dlg


102 DIALOGEX 0,0,210,134
LANGUAGE 9,1
CAPTION "Manifest Dialog"
FONT 8,"MS Sans Serif",0,0
STYLE 0x00C80800
BEGIN
CONTROL "OK",1,"Button",0x50010001,76,108,50,15
CONTROL "Cancel",2,"Button",0x50010000,132,108,50,15
CONTROL "Check1",1001,"Button",0x50010003,8,24,50,11
CONTROL "Radio1",1002,"Button",0x50000009,8,42,50,11
CONTROL "",1003,"ComboBox",0x50210102,8,60,50,30
CONTROL "",1004,"ListBox",0x50A10103,8,84,50,41
CONTROL "",1005,"ScrollBar",0x50000000,78,88,104,11
CONTROL "",1006,"ScrollBar",0x50000001,192,40,10,41
CONTROL "Spin1",1007,"msctls_updown32",0x50000020,192,7,11,15
CONTROL "Progress1",1008,"msctls_progress32",0x50800000,78,5,104,13
CONTROL "Static",-1,"Button",0x50000007,78,27,104,32
CONTROL "Slider1",1009,"msctls_trackbar32",0x50010018,78,66,104,13
CONTROL "",103,"Edit",0x50010000,8,5,50,14,0x00000200
END


Here is a Windows graphics example. (screen shot attached)



'**************
'* Spiral.bas *
'**************

' Based on a Petzold example.

$AppType GUI
$Optimize Off
$Compress Off

$Include "Windows.inc"
$Include "Math.inc"

$Const iNumRevs = 20
$Const crAppleGreen = 0x0044AA00
$Const PI = 3.14159

Dim message As MSG
Dim wc As WNDCLASS
Dim ps As PAINTSTRUCT
Dim strClassName As String
Dim strAppTitle As String
Dim hWindow As Integer
Dim cxClient As Integer
Dim cyClient As Integer

Function OnSize(hWnd As Integer, uMsg As Integer, _
wParam As Integer, lParam As Integer) As Integer
cxClient = LoWord(lparam)
cyClient = HiWord(lparam)
Result = 0
End Function

Function OnPaint(hWnd As Integer, uMsg As Integer, _
wParam As Integer, lParam As Integer) As Integer
Dim hdc As Integer
Dim iNumPoints As Integer
Dim ptX As Integer
Dim ptY As Integer
Dim i As Integer
Dim fAngle As Double
Dim fScale As Double

hdc = BeginPaint(hWnd, ps)
iNumPoints = iNumRevs * 2 * (cxClient + cyClient)
i = 0
While i < iNumPoints
fAngle = i * 2.0 * PI / (iNumPoints / iNumRevs)
fScale = 1.0 - i / iNumPoints
ptX = cxClient / 2.0 * (1.0 + fScale * Cos(fAngle))
ptY = cyClient / 2.0 * (1.0 + fScale * Sin(fAngle))
SetPixel(hdc, ptX, ptY, crAppleGreen)
i = i +1
Wend
EndPaint(hWnd, ps)
Result = 0
End Function

Function WindowProc(hWnd As Integer, uMsg As Integer, _
wParam As Integer, lParam As Integer) As Integer
If uMsg = WM_SIZE Then
Result = OnSize(hWnd, uMsg, wParam, lParam)
ElseIf uMsg = WM_PAINT Then
Result = OnPaint(hWnd, uMsg, wParam, lParam)
ElseIf uMsg = WM_DESTROY Then
PostQuitMessage(0)
Result = 0
Else
Result = DefWindowProc(hWnd, uMsg, wParam, lParam)
End If
End Function

'***

strAppTitle = "Spiral"
strClassName = "SpiralClass"

wc.style = CS_HREDRAW + CS_VREDRAW
wc.lpfnWndProc = CodePtr(WindowProc)
wc.cbClsExtra = 0
wc.hInstance = GetModuleHandle(0)
wc.hIcon = LoadIcon(0, MakeIntResource(IDI_APPLICATION))
wc.hCursor = LoadCursor(0, MakeIntResource(IDC_ARROW))
wc.hbrBackground = GetStockObject(WHITE_BRUSH)
wc.lpszMenuName = ""
wc.lpszClassName = strClassName

If (RegisterClass(wc)) = 0 Then
MessageBox(0, "RegisterClass failed.", strAppTitle, MB_OK)
ExitProcess(0)
End If

hWindow = CreateWindowEx(0, strClassName, strAppTitle, _
WS_OVERLAPPEDWINDOW, _
165, 50, 380, 435, _
0, 0, wc.hInstance, 0)
If hWindow = 0 Then
MessageBox(0, "CreateWindowEx failed.", strAppTitle, MB_OK)
ExitProcess(0)
End If

ShowWindow(hWindow, SW_SHOWNORMAL)
UpdateWindow(hWindow)

While GetMessage(message, 0, 0, 0) > 0
TranslateMessage(message)
DispatchMessage(message)
Wend

zlatkoAB
27-11-2014, 23:59
BASM -> manifest ?

youu hooo yaaa -hoooo
fantastic :D

John Spikowski
28-11-2014, 02:04
Aurel,

If you are interested in BASM and are willing to contribute to the project, you may join the forum. I have a ZERO tolerance for any unjustified negative comments or member abuse.

John