Author Topic: BxbAsm  (Read 178755 times)

SteveA

  • Guest
Re: BxbAsm
« Reply #60 on: February 04, 2012, 03:22:44 PM »
I did manage to compile with gcc by commenting out :
//#define LccWin32

That might work.
Originally, when I was compiling under 2 different compilers, that was there for that reason.
With Lcc I was using the TCCONIO library for lowlevel console graphics I/O.

Quote
//#include <winuser.h>.

so linux port may be possible after all?
Have not tried running it yet.

I don't remember what the reason is that I was using winuser.h.
But, at some point I needed it for something.
It's entirely possible that I don't and I just didn't remove it.
Any way, try running it.

edit:
Remember..., this is still a ruff cut.
« Last Edit: February 04, 2012, 03:25:20 PM by SteveA »

jcfuller

  • Guest
Re: BxbAsm
« Reply #61 on: February 05, 2012, 08:25:36 AM »
Steve,
  Don't forget Raymond's FPU library is available for use.
http://www.ray.masmcode.com/fpu.html#fpulib

James

SteveA

  • Guest
Re: BxbAsm
« Reply #62 on: February 06, 2012, 09:15:21 AM »
  Don't forget Raymond's FPU library is available for use.

Right.
I have conversed a bit with Ray recently and I consider him to be a genuine authority on the FPU routines.
I have studied a number of his routines in the past.
He certainly knows the FPU like not many people do.
I rank his work quite highly.

jcfuller

  • Guest
Re: BxbAsm
« Reply #63 on: February 07, 2012, 04:26:37 AM »
Steve,
  Observations.
I managed to compile and link this example with the bxbasm created with MinGw.
Code: [Select]
'-----cut-n-paste------'
REM  test.bas version 1
PRINT "hello world!"
BEEP
END
'-----cut-n-paste------'

I do not have conio.inc in jwasm or masm32 include directories.

I created a console mode app using the batch file below.
I noticed all your batch files are creating a windows gui?
I may be wrong as it's been awhile since I studied jwlink.

These are the batch files I am using.

for console:
jwcon.bat:
Code: [Select]
@setlocal
@ECHO OFF
@SET LIB=\jwasm\wininc\lib
@SET PATH=C:\jwasm;C:\jwasm\jwlink;c:\jwasm\wininc\lib;c:\jwasm\wininc;c:\jwasm\wininc\Include;%PATH%
@REM add more libraries below
@REM SET LIBS=LIBRARY kernel32.lib, msvcrt.lib, user32.lib
@REM @SET LIBS=LIBRARY libc.lib

jwasm  %1.asm
jwlink  system pe_con name %1.exe file %1.obj %LIBS% %2 %3 %4
REM ECHO All Done
endlocal

for gui:
jwgui.bat:

Code: [Select]
@setlocal
@ECHO OFF
@SET LIB=\jwasm\wininc\lib;\jwasm\samples\jcfuller
@SET PATH=C:\jwasm;C:\jwasm\jwlink;c:\jwasm\wininc\lib;c:\jwasm\wininc;c:\jwasm\wininc\Include;%PATH%
@REM add more libraries below
@SET LIBS=LIBRARY kernel32.lib, msvcrt.lib,  user32.lib

jwasm  %1.asm
jwlink  system pe_gui name %1.exe file %1.obj %LIBS% %2 %3 %4 %5 %6
REM ECHO All Done
endlocal


James

jcfuller

  • Guest
Re: BxbAsm
« Reply #64 on: February 07, 2012, 06:13:26 AM »
Steve,
  While I had luck compiling with gcc, g++ (as well as borland bc5++) balked at all your malloc's.
I added casts and all is fine.
attached is modified source.

James

SteveA

  • Guest
Re: BxbAsm
« Reply #65 on: February 07, 2012, 07:39:19 AM »

I noticed all your batch files are creating a windows gui?
I may be wrong as it's been awhile since I studied jwlink.

Yes..., maybe..., you could be right.

That was the only way I could seem to get everything working.
I found the documentation very hard to understand.
Way too much information and no real examples.
See attachment:

I wasn't trying to build a gui app, it was supposed to be console:

JWlink format windows pe file "%1.obj" library bxblib.lib > jwlink.err

Quote
jwlink  system pe_con name %1.exe file %1.obj %LIBS% %2 %3 %4
jwlink  system pe_gui name %1.exe file %1.obj %LIBS% %2 %3 %4 %5 %6
« Last Edit: February 07, 2012, 08:04:27 AM by SteveA »

SteveA

  • Guest
Re: BxbAsm
« Reply #66 on: February 07, 2012, 07:46:28 AM »
....g++ (as well as borland bc5++) balked at all your malloc's.
I added casts and all is fine.

Yeh...,
I have read that (in C) mallocs should not be type-cast.
Sometimes I do, only when a compiler requires it.
It could be because you were using g++ (and Borland C++), which may be assuming that it is a C++ file, with C code inserted.
C and C++ compilers are not the same.

Things like that happen when I use VC++.
I have to tell VC++ to compile C, otherwise I get warnings and errors.

edit:
C code should not be compiled as C++ code.
Even though all C++ compilers will compile C code (not really, tho) they expect the code to conform to C++ requirements.

You have to specifically tell the compiler to compile C source code as a C file.
Otherwise, you are compiling and producing a C++ file and executable.
LccWin32 only compiles plain-jane C.

Most compilers out there (link MingW) are C/C++.
Meaning that they contain both a C and C++ compiler.
« Last Edit: February 07, 2012, 08:00:30 AM by SteveA »

jcfuller

  • Guest
Re: BxbAsm
« Reply #67 on: February 07, 2012, 08:05:46 AM »
Steve,
Yeah I know and I was purposely converting to c++. I am hooked on objects and the STL.  :)
vectors and strings make a whole world of difference.

Edit:
  Now that I added the casts you have the opportunity to switch to a c++ compiler while you are still
in the early stages of redevelopment :)

James
 
« Last Edit: February 07, 2012, 08:10:58 AM by jcfuller »

SteveA

  • Guest
Re: BxbAsm
« Reply #68 on: February 07, 2012, 08:11:05 AM »
Yeah I know and I was purposely converting to c++.

James,
step back a couple of posts.
I modified one of my posts to add a .txt file, regarding the linker.


edit:
oops, I forgot my original train of thought........back to your quote:

Okay, I wasn't sure, but that makes perfect sense, now.
I have on several occasions compiled using C++ just to make sure my code would compile and work.
I have MingW, gcc/c++, Pelles-C, VC++....etc.
« Last Edit: February 07, 2012, 08:20:15 AM by SteveA »

jcfuller

  • Guest
Re: BxbAsm
« Reply #69 on: February 07, 2012, 10:03:49 AM »
It took me awhile to track down where I got the info for my batch files:
Code: [Select]
In the JWlink.chm file:
Linking Executable Files for Various Systems
    Linking 32-and 64-bit Executable Files
        Linking Win32/Win64 Console Executable Files
        Linking Win32/Win64 GUI Executable Files

James

SteveA

  • Guest
Re: BxbAsm
« Reply #70 on: February 07, 2012, 10:59:13 AM »
It took me awhile to track down where I got the info for my batch files:

Thanks James


SteveA

  • Guest
Re: BxbAsm
« Reply #71 on: February 07, 2012, 11:39:49 AM »
Quote
jwlink  system pe_con name %1.exe file %1.obj

Odd...,
I remember, when I was first setting up jwlink to use the first time, I was getting a bunch of linker errors.
Code: [Select]
...\bin\JWlink system pe_con file "%1.obj" library bxblib.lib > jwlink.err
The above code produces those same linker errors:
Quote
JWlink Version 1.9
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
Warning! W1107: undefined system name: pe_con
loading object files
searching libraries
Warning! W1008: cannot open bxblib.lib : No such file or directory
Warning! W1014: stack segment not found
creating an OS/2 linear extended executable

When I use my version:
Code: [Select]
...\bin\JWlink format windows pe file "%1.obj" library bxblib.lib > jwlink.err

I get no errors.
I don't get what I'm missing here.

jcfuller

  • Guest
Re: BxbAsm
« Reply #72 on: February 07, 2012, 02:13:04 PM »
Maybe system pe_con does not work with file, only name %1.exe?

James

« Last Edit: February 07, 2012, 02:17:39 PM by jcfuller »

jcfuller

  • Guest
Re: BxbAsm
« Reply #73 on: February 07, 2012, 02:22:38 PM »
Here is the output from translation,compile,link using the jwcon.bat file
I added:
@SET LIBS=LIBRARY bxblib.lib to the bat file

James

Code: [Select]
C:\BcxRadAsm\RadAsm3\Bcx\Projects\BcxBxbAsm>bcxbxbasm hello.bas
Copyright: Blunt_Axe_Basic, BxbAsm, Bxbasic (c) sarbayo, 2004-2012
Alpha Release: 1.06.3, Bxbasm Compiler

Destination file: hello.asm
Lines compiled: 6
Done.

C:\BcxRadAsm\RadAsm3\Bcx\Projects\BcxBxbAsm>\jwasm\jwcon hello
JWasm v2.07pre, Nov  2 2011, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

hello.asm: 137 lines, 2 passes, 172 ms, 0 warnings, 0 errors
JWlink Version 1.9
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
loading object files
searching libraries
creating a PE executable

jcfuller

  • Guest
Re: BxbAsm
« Reply #74 on: February 08, 2012, 03:53:26 AM »
Steve,
  This is an FYI when compiling bxbasm with Pelles C.

James

Code: [Select]
Setting 32-bit environment for Pelles C...
Compiling "BCXBXBASM.c"..........
bxbasm163\AInput.c(97): warning #2114: Local 'pi' is not referenced.
bxbasm163\AInput.c(96): warning #2114: Local 'varname' is not referenced.
bxbasm163\AInput.c(96): warning #2114: Local 'ch' is not referenced.
bxbasm163\AUtils.c(496): warning #2114: Local 'count' is not referenced.
bxbasm163\AUtils.c(721): warning #2114: Local 'ch' is not referenced.
bxbasm163\AUtils.c(754): warning #2114: Local 'ch' is not referenced.
bxbasm163\AFunct.c(1632): warning #2114: Local 'pi' is not referenced.
bxbasm163\AFunct.c(1631): warning #2114: Local 'varname' is not referenced.
bxbasm163\AFunct.c(1631): warning #2114: Local 'ch' is not referenced.
bxbasm163\AFunct.c(1751): warning #2114: Local 'temp' is not referenced.
bxbasm163\AFunct.c(1762): warning #2114: Local 'ch' is not referenced.
bxbasm163\AVars.c(318): warning #2114: Local 'ch' is not referenced.
bxbasm163\AVars.c(347): warning #2114: Local 'ch' is not referenced.
bxbasm163\AVars.c(415): warning #2114: Local 'ch' is not referenced.
bxbasm163\AVars.c(771): warning #2114: Local 'value' is not referenced.
bxbasm163\AVars.c(771): warning #2114: Local 'ndx' is not referenced.
bxbasm163\AVars.c(770): warning #2114: Local 'temp' is not referenced.
bxbasm163\AVars.c(770): warning #2114: Local 'ch' is not referenced.
bxbasm163\AVars.c(813): warning #2114: Local 'ndx' is not referenced.
bxbasm163\AVars.c(895): warning #2114: Local 'temp' is not referenced.
bxbasm163\AVars.c(895): warning #2114: Local 'ch' is not referenced.
bxbasm163\AVars.c(942): warning #2114: Local 'temp' is not referenced.
bxbasm163\AVars.c(942): warning #2114: Local 'ch' is not referenced.
bxbasm163\ARdp.c(102): warning #2114: Local 'Value' is not referenced.
bxbasm163\ARdp.c(239): warning #2114: Local 'ch' is not referenced.
bxbasm163\ARdp.c(724): warning #2114: Local 'ch' is not referenced.
bxbasm163\ARdp.c(955): warning #2114: Local 'varname' is not referenced.
bxbasm163\ARdp.c(988): warning #2114: Local 'varname' is not referenced.
bxbasm163\ARdp.c(1019): warning #2114: Local 'varname' is not referenced.
bxbasm163\ANinput.c(17): warning #2114: Local 'ch' is not referenced.
bxbasm163\ANinput.c(34): warning #2114: Local 'ch' is not referenced.
bxbasm163\ALoops.c(12): warning #2114: Local 'mark_or' is not referenced.
bxbasm163\ALoops.c(12): warning #2114: Local 'pi' is not referenced.
bxbasm163\ALoops.c(37): warning #2114: Local 'pi' is not referenced.
bxbasm163\ALoops.c(257): warning #2114: Local 'len' is not referenced.
bxbasm163\ALoops.c(382): warning #2114: Local 'type' is not referenced.
bxbasm163\ALoops.c(571): warning #2114: Local 'ab_code' is not referenced.
bxbasm163\ALoops.c(569): warning #2114: Local 'ch' is not referenced.
bxbasm163\ALoops.c(640): warning #2114: Local 'ch' is not referenced.
bxbasm163\AIf.c(73): warning #2114: Local 'len' is not referenced.
bxbasm163\AIf.c(596): warning #2114: Local 'len' is not referenced.
bxbasm163\AIf.c(818): warning #2114: Local 'varname' is not referenced.
bxbasm163\AString.c(75): warning #2114: Local 'size' is not referenced.
bxbasm163\AString.c(74): warning #2114: Local 'ndx' is not referenced.
bxbasm163\AString.c(73): warning #2114: Local 'ch' is not referenced.
bxbasm163\AString.c(233): warning #2114: Local 'ch' is not referenced.
bxbasm163\AString.c(264): warning #2114: Local 'ch' is not referenced.
bxbasm163\AString.c(381): warning #2114: Local 'ch' is not referenced.
bxbasm163\AString.c(597): warning #2114: Local 'ch' is not referenced.
bxbasm163\AString.c(635): warning #2114: Local 'ch' is not referenced.
bxbasm163\AString.c(673): warning #2114: Local 'ch' is not referenced.
bxbasm163\AString.c(692): warning #2114: Local 'ch' is not referenced.
bxbasm163\AFile.c(276): warning #2114: Local 'ch' is not referenced.
bxbasm163\AFile.c(420): warning #2114: Local 'size' is not referenced.
bxbasm163\AFile.c(641): warning #2114: Local 'size' is not referenced.
bxbasm163\AFile.c(718): warning #2114: Local 'fld_len' is not referenced.
bxbasm163\AFile.c(716): warning #2114: Local 'ch' is not referenced.
bxbasm163\AFile.c(815): warning #2114: Local 'format' is not referenced.
bxbasm163\Scandim.c(454): warning #2114: Local 'ch' is not referenced.
bxbasm163\Scandim.c(491): warning #2114: Local 'ch' is not referenced.
bxbasm163\Scanmisc.c(140): warning #2114: Local 'size' is not referenced.
bxbasm163\Scanmisc.c(139): warning #2114: Local 'ii' is not referenced.
bxbasm163\Scanmisc.c(138): warning #2114: Local 'NVar' is not referenced.
bxbasm163\Scanfor.c(11): warning #2114: Local 'ch' is not referenced.
bxbasm163\Scanfor.c(206): warning #2114: Local 'ch' is not referenced.
bxbasm163\Scanfile.c(14): warning #2114: Local 'value' is not referenced.
bxbasm163\Scanfile.c(12): warning #2114: Local 'file' is not referenced.
bxbasm163\Scanfile.c(263): warning #2114: Local 'ch' is not referenced.
bxbasm163\Scanfile.c(345): warning #2114: Local 'ch' is not referenced.
bxbasm163\Scanfile.c(373): warning #2114: Local 'ival' is not referenced.
Linking ................
Finished!