Author Topic: BxbAsm  (Read 178832 times)

jcfuller

  • Guest
Re: BxbAsm
« Reply #240 on: May 08, 2012, 07:38:33 AM »
Steve,
  I had a feeling it was from compiling ClearScreen and locate with lcc.
  I extracted all the object files from bxblib.lib and replaced ClearScreen and locate with:
ClearScreen:
Code: [Select]
; *************BxbAsm Compiler*************
; Copyright: sarbayo (c) 2004-2012
; =========================================================================
    .486                       ; use 486 instructions
    .model flat, stdcall       ; Win32 memory model
    option casemap:none        ; case sensitive

    include windows.inc
    include stdlib.inc
  

  .code
CStr macro pszText:VARARG
local szText
.const
szText db pszText,0
.code
exitm <offset szText>
endm
;------------------------------------------------------------------------------
ClearScreen proc
; --------------------------------------------------
invoke system,CStr("cls")
  ret
; --------------------------------------------------
ClearScreen endp

end

locate:
Code: [Select]
   .486                      
    .model flat, stdcall      
    option casemap:none        
    include windows.inc

.code
locate proc col:DWORD,row:DWORD
    local coordScreen:COORD,hConsole:HANDLE
mov eax,col
    mov coordScreen.X,ax
    mov eax,row
    mov coordScreen.Y,ax
    invoke GetStdHandle,STD_OUTPUT_HANDLE
    mov hConsole,eax
    invoke SetConsoleCursorPosition,hConsole,coordScreen
    ret
locate endp

end


I then created a new library with ar and used jwlink to link.
output:
Code: [Select]
C:\bxb-linux>jwasm /c /coff /Cp "test6.asm"
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.

test6.asm: 137 lines, 2 passes, 187 ms, 0 warnings, 0 errors

C:\bxb-linux>jwlink  system pe_con name test6.exe file test6.obj  LIBRARY kernel
32.lib,msvcrt.lib, user32.lib,fpu.lib, bxblib.lib
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
C:\bxb-linux>

All is well:)
Now time for more testing and then a try at porting

James

Edit: test6.bas
Code: [Select]
1  REM  test.bas version 6
   DIM Row = 0, Column = 0
2  CLS
3  PRINT "hello world!"
4  LET Row = 2
5  LET Column = 10
6  LOCATE Row, Column
7  PRINT "hello world!"
8  LET Row = 4
9  LET Column = 20
10 LOCATE Row, Column
11 PRINT "hello world!"
12 END

« Last Edit: May 08, 2012, 07:40:31 AM by jcfuller »

SteveA

  • Guest
Re: BxbAsm
« Reply #241 on: May 08, 2012, 07:53:41 AM »
James,
read my latest post, on prior page.

Steve

jcfuller

  • Guest
Re: BxbAsm
« Reply #242 on: May 08, 2012, 09:22:10 AM »
Steve,
  I don't follow. I have not recompiled bxbasm.c -> exe yet. I'm using the one in the zip.
Does this exe not create correct asm code?
Please forgive my slowness but I don't see how that is related to my last post?

James

SteveA

  • Guest
Re: BxbAsm
« Reply #243 on: May 08, 2012, 09:28:19 AM »
  I don't follow. I have not recompiled bxbasm.c -> exe yet. I'm using the one in the zip.
Does this exe not create correct asm code?
Please forgive my slowness but I don't see how that is related to my last post?

It's okay.
The EXE in the zip is good.
I thought you recompiled.
If that was the case, then the C source would have been the wrong one.
When you are ready to recompile, toss the first one and use the second one I posted.

Steve

SteveA

  • Guest
Re: BxbAsm
« Reply #244 on: May 08, 2012, 09:32:21 AM »
That still makes me wonder why it was calling for tcconio. (?)
I looked at the sources and could find no reference.

That's when I looked inside the zip I posted, to see what that source had.
That's how I discovered I zipped the wrong folder, because that code did call for tcconio.

Steve

jcfuller

  • Guest
Re: BxbAsm
« Reply #245 on: May 08, 2012, 10:09:25 AM »
Steve,
  What library app did you use to create bxblib.lib? Maybe that is the culprit or maybe lcc embedded something in the locate and ClearScreen object files, as tcconio is lcc specific.

  It also appears you attached the wrong bxblib asm-procs source too.
The time date functions use SYSTEMTIME instead of tm while the time date functions in bxblib.lib work correctly with tm.

James

SteveA

  • Guest
Re: BxbAsm
« Reply #246 on: May 08, 2012, 11:34:08 AM »
Okay, I feel like a total idiot.
I must have been more rushed, yesterday, than I thought I was.

What library app did you use to create bxblib.lib?

I used jwasm's "wlib.exe".


Quote
Maybe that is the culprit or maybe lcc embedded something in the locate and ClearScreen object files, as tcconio is lcc specific.

No, I don't think that was it, but, I'm puzzled.

Quote
It also appears you attached the wrong bxblib asm-procs source too.
The time date functions use SYSTEMTIME instead of tm while the time date functions in bxblib.lib work correctly with tm.

Yeh...,
I was supposed to delete those "TIME" related files from that zip, (asm.procs.zip).
The "TIME" files in "disabled" are the correct ones.
Those are the ones used to create the .LIB.

I just forgot to delete the others.

Steve


EDIT:
You may be right on this count:
Quote
Maybe that is the culprit or maybe lcc embedded something in the locate and ClearScreen object files, as tcconio is lcc specific.

looking back, I noticed that the ".OBJ" files for locate and ClearScreen were created with LCC.
Since they were still using C source code, they had to be created with LCC.

All the rest were created (asm source) with jwasm.
Those two C ".OBJ"s were added to bxblib.lib using wlib.exe.

That should explain it.

Steve
« Last Edit: May 08, 2012, 11:48:15 AM by SteveA »

jcfuller

  • Guest
Re: BxbAsm
« Reply #247 on: May 09, 2012, 05:10:45 AM »
Steve,
 
Quote
looking back, I noticed that the ".OBJ" files for locate and ClearScreen were created with LCC.
Since they were still using C source code, they had to be created with LCC.

All the rest were created (asm source) with jwasm.
Those two C ".OBJ"s were added to bxblib.lib using wlib.exe.

That should explain it.

I think I mentioned that above :)

You probably have your lcc directories in your path so you would not notice.
As I said lcc uses it's own library for coino while gcc and vcc use the msvcrt library.

You are going to run into this with many "c" library routines compiled with lcc.

James

jcfuller

  • Guest
Re: BxbAsm
« Reply #248 on: May 09, 2012, 08:13:10 AM »
Steve,
  I went through all the asm/c sources for bxblib.lib and created obj files for all.
I used gcc for the "c" ones.
I seem to have a problem with StdOut.asm

Code: [Select]
C:\bxb-linux>jwasm /c /coff /Cp "test6.asm"
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.

test6.asm: 137 lines, 2 passes, 172 ms, 0 warnings, 0 errors

C:\bxb-linux>jwlink  system pe_con name test6.exe file test6.obj  LIBRARY kernel
32.lib,msvcrt.lib, user32.lib,fpu.lib, bxblib.lib
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
Error! E2028: _stdout is an undefined reference
Error! E2028: _strng is an undefined reference
creating a PE executable
file bxblib.lib(StdOut.asm): undefined symbol _strng
file bxblib.lib(StdOut.asm): undefined symbol _stdout
C:\bxb-linux>jwcon test6

but if I use the StdOut.obj file extracted from  your last bxblib.lib post and add it to mine all is well???

This is the code using your include files:

Code: [Select]
; *************BxbAsm Compiler*************
; Copyright: sarbayo (c) 2004-2012
; =========================================================================
  .486                       ; use 486 instructions
  .model flat, stdcall       ; Win32 memory model
  option casemap:none        ; case sensitive


    include \jwasm\jw-inc\windows.inc
    include \jwasm\jw-inc\stdio.inc

    EXTERNDEF strng:BYTE

  .code

StdOut proc lpszText:DWORD
; --------------------------------------------------
    invoke fprintf, stdout, addr strng, lpszText
    ret
; --------------------------------------------------
StdOut endp
end



James

SteveA

  • Guest
Re: BxbAsm
« Reply #249 on: May 09, 2012, 09:01:46 AM »
Code: [Select]
; *************BxbAsm Compiler*************
; Copyright: sarbayo (c) 2004-2012
; =========================================================================
  .486                       ; use 486 instructions
  .model flat, stdcall       ; Win32 memory model
  option casemap:none        ; case sensitive


    include \jwasm\jw-inc\windows.inc
    include \jwasm\jw-inc\stdio.inc

    EXTERNDEF strng:BYTE

  .code

StdOut proc lpszText:DWORD
; --------------------------------------------------
    invoke fprintf, stdout, addr strng, lpszText
    ret
; --------------------------------------------------
StdOut endp
end


Add this line to BXB.INC:

    EXTERNDEF strng:BYTE

at the bottom of the other EXTERNDEF's.


jcfuller

  • Guest
Re: BxbAsm
« Reply #250 on: May 09, 2012, 03:10:48 PM »
Steve,
  I'm working through the examples from BxbBasic.txt and found a couple of problems.
Test 21,22,24 have issues with variable name conflict and test32  is not working correctly.
If I enter James for First it leaves the es on screen when prompting for Initial.

James

SteveA

  • Guest
Re: BxbAsm
« Reply #251 on: May 09, 2012, 06:05:42 PM »
Test 21,22,24 have issues with variable name conflict and test32  is not working correctly.
If I enter James for First it leaves the es on screen when prompting for Initial.

Regarding var-names:
Let me guess...."test" and "ten".
yes,
I have encountered situations where asm does not decorate names, var-names cannot conflict with reserved words.
Like: test, ten, cx, bx, and/or constants, etc.

I am working on some new docs to clarify that.


EDIT:
It sounds to me like "locate" and/or "wherexy" are not working.

Fixed wherexy.asm: (attached)

I included a test.bas for it, too.
Works good on my end.

Steve

P.S.
I've added a revised bxbasic.txt, that has some corrections in the samples.
« Last Edit: May 09, 2012, 07:41:13 PM by SteveA »

jcfuller

  • Guest
Re: BxbAsm
« Reply #252 on: May 10, 2012, 02:50:57 AM »
Steve,
  The attached wherexy.asm is the same one I have.

James

Edit: the attached bxblib.lib has the same problem.


« Last Edit: May 10, 2012, 03:01:51 AM by jcfuller »

jcfuller

  • Guest
Re: BxbAsm
« Reply #253 on: May 10, 2012, 03:23:53 AM »
Steve,
  Your attached library has the problems mentioned before.
It appears you can't use Lcc to create object modules.

James

Code: [Select]
C:\bxb-linux\examples>build test1x

C:\bxb-linux\examples>..\bxbasm test1x.bas
Copyright: Blunt_Axe_Basic, BxbAsm, Bxbasic (c) sarbayo, 2004-2012
Alpha Release: 1.06.3, Bxbasm Compiler

** stripped down version for Linux

Destination file: test1x.asm
Lines compiled: 20
Done.



C:\bxb-linux\examples>jwasm /c /coff /Cp "test1x.asm"
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.

test1x.asm: 304 lines, 2 passes, 172 ms, 0 warnings, 0 errors

C:\bxb-linux\examples>jwlink  system pe_con name test1x.exe file test1x.obj  LIB
RARY kernel32.lib,msvcrt.lib, user32.lib,fpu.lib, bxblib.lib
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
Warning! W1173: file bxblib.lib(c:\programming\lcc\projects\bxblib\lib\floattost
r2.c): unknown directive '-library' ignored
Warning! W1173: file bxblib.lib(c:\programming\lcc\projects\bxblib\lib\clearscre
en.c): unknown directive '-library' ignored
Warning! W1173: file bxblib.lib(c:\programming\lcc\projects\bxblib\lib\strtofloa
t.c): unknown directive '-library' ignored
creating a PE executable
C:\bxb-linux\examples>

jcfuller

  • Guest
Re: BxbAsm
« Reply #254 on: May 10, 2012, 05:03:28 AM »
Steve,
  Test 52 has problems.

James