Author Topic: BxbAsm  (Read 178771 times)

jcfuller

  • Guest
Re: BxbAsm
« Reply #285 on: May 11, 2012, 01:11:09 PM »
Here is the pelles screen at exception
Note the bottom right call stack
James

SteveA

  • Guest
Re: BxbAsm
« Reply #286 on: May 11, 2012, 03:52:32 PM »
James,
I was wondering if maybe you could try adding a CLEAR statement to test46.
Just after the CLOSE 1.
See what that does.
I'm trying to figure out what the circumstances are that sets up the problem.

Steve

jcfuller

  • Guest
Re: BxbAsm
« Reply #287 on: May 11, 2012, 05:53:24 PM »
Steve,
  Test46 with a CLEAR is fine.

James

SteveA

  • Guest
Re: BxbAsm
« Reply #288 on: May 11, 2012, 05:56:32 PM »
Hmm,
now that's interesting.
« Last Edit: July 17, 2012, 06:07:32 PM by SteveA »

jcfuller

  • Guest
Re: BxbAsm
« Reply #289 on: May 12, 2012, 03:21:28 AM »
Steve,
  This code causes bxbasm to crash in the translation process.

James

Code: [Select]
'  test.bas version 48X2
    DIM az#=1.012345, bz!=123.456
    DIM cz%=123456, dz = 12345, rec = 1, ix = 0
'    DIM A$ = "", B$ = "", C1$ = "", D$ = "", E$ = ""
    DIM A$ = "", B$ = "", C1$ = "", D$ = ""
    DIM w$ = "end"
    CLS
'
'    OPEN "R", #1, "test.txt", 34
    OPEN "R", #1, "test.txt", 24
'    FIELD #1, 4 AS A$, 4 AS B$, 8 AS C1$, 8 AS D$, 10 AS E$
    FIELD #1, 4 AS A$, 4 AS B$, 8 AS C1$, 8 AS D$
'    FOR ix = 1 TO 5 STEP 1
        LSET A$ = MKI$(dz)
        LSET B$ = MKI$(cz%)
        LSET C1$ = MKS$(bz!)
        LSET D$ = MKD$(az#)
'        RSET E$ = w$
        PUT 1, rec
        rec = rec + 1
'    NEXT ix
    CLOSE 1
    CLEAR
    PRINT "ALL DONE"
'
'    OPEN "R", #1, "test.txt", 34
'    FIELD #1, 4 AS A$, 4 AS B$, 8 AS C1$, 8 AS D$, 10 AS E$
'    GET 1, 1
'
'    az# = CVD(D$)
'    bz! = CVS(C1$)
'    cz% = CVI(B$)
'    dz =  CVI(A$)
'    PRINT "az#="; az#
'    PRINT "bz!="; bz!
'    PRINT "cz%="; cz%
'    PRINT "dz ="; dz
'    CLOSE 1
' ------- -----------------------------------
TheEnd:
  END
' ------------------------------------------


jcfuller

  • Guest
Re: BxbAsm
« Reply #290 on: May 12, 2012, 04:15:25 AM »
Steve,
  Not sure it's relevant but your comments do not reflect the names of the vars in clear_allvars when compared to comments in AInput.c

James



Code: [Select]

clear_allvars proc
; --------------------------------------------------
  mov  esi, _var_start
  mov  edi, _int_start        ; clear strings
  mov  ecx, 0
  add  esi, 4
@@:
  .if esi < edi
    mov  eax, [esi]
    .if eax != 0
      pushad
      invoke free, eax
      popad
      mov  [esi], ecx
    .endif
    add  esi, 4
    jmp  @B
  .endif
  mov  edi, _flt_start        ; clear integers
  add  esi, 4
@@:
  .if esi < edi
    mov  [esi], ecx
    add  esi, 4
    jmp  @B
  .endif
  mov  edi, _var_endzz        ; clear floats
  add  esi, 4
@@:
  .if esi < edi
    mov  [esi], ecx
    add  esi, 4
    mov  [esi], ecx
    add  esi, 4
    jmp  @B
  .endif
  ret
; --------------------------------------------------
clear_allvars endp

From AInput.c

Code: [Select]

    s_writeln("\t_var_start\tdd\t?");           /* string data */
    i_writeln("\t_int_start\tdd\t?");           /* integer data */
    f_writeln("\t_flt_start\tdd\t?");           /* float data */
    x_writeln("\t_arry_start\tdd\t?");          /* arrays data */

« Last Edit: May 12, 2012, 04:18:21 AM by jcfuller »

SteveA

  • Guest
Re: BxbAsm
« Reply #291 on: May 12, 2012, 04:05:42 PM »
Not sure it's relevant but your comments do not reflect the names of the vars in clear_allvars when compared to comments in AInput.c

Actually, it does, it's just not obvious.

_var_start :  is where the vars section (and strings) begin         /* string data */
_int_start  :  is where strings end and integers begin                 /* integer data */
_flt_start   :  is where integers end and floats begin                  /* float data */
_arry_start :  is where floats end and arrays begin                    /* arrays data */

So,...
when you see this:

; --------------------------------------------------
  mov  esi, _var_start
  mov  edi, _int_start        ; clear strings
  mov  ecx, 0
  add  esi, 4
@@:


esi is loaded with the address of the start of strings.
edi is loaded with the end of strings (start of integers).
When esi is equal to edi, strings are done.

Steve

jcfuller

  • Guest
Re: BxbAsm
« Reply #292 on: May 13, 2012, 01:44:45 PM »
Steve,
  Even with the current CLEAR problem I started a linux port and at this time it does not look good.
There is no such animal as _msize on linux nor does a work around exists. All references I found indicate it is the programmers
responsibility to store the size data from a malloc; so unless you can eliminate it there will be no linux port.

James

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: BxbAsm
« Reply #293 on: May 14, 2012, 08:11:48 AM »
Maybe #define _msize(...) malloc_usable_size(...)??

A.

jcfuller

  • Guest
Re: BxbAsm
« Reply #294 on: May 14, 2012, 08:24:25 AM »
Thanks Armando.
I do remember that now, but it did not show up in any of the discussions I found on a search _msize on linux.

James

SteveA

  • Guest
Re: BxbAsm
« Reply #295 on: May 14, 2012, 08:39:13 PM »
This code causes bxbasm to crash in the translation process.

I think it goes back to the original CLEAR issue.
If I narrow it down to just the two floats,

    FIELD #1, 8 AS C1$, 8 AS D$
        LSET C1$ = MKS$(bz!)
        LSET D$ = MKD$(az#)

followed by a clear, then it does throw an exception.
I've got to single step this, thru Olly, to see what's happening.

Steve

SteveA

  • Guest
Re: BxbAsm
« Reply #296 on: May 15, 2012, 11:22:15 AM »
Your attached library has the problems mentioned before.
It appears you can't use Lcc to create object modules.


James,
I posted a message for Jacob Navia regarding this matter:

Quote
Hello Jacob,
I'm using jwlink (originally open watcom) to build static libraries.
I consistantly get "unknown directive" warnings from the lcc
created .obj files that I add to my ".LIB".
This has been tested using polink as well, with the same warnings.
The EXE is created, but, I am annoyed by the warnings.

"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 mylib.lib(c:\lcc\projects\lib\floattostr2.c): unknown directive '-library' ignored
Warning! W1173: file mylib.lib(c:lcc\projects\lib\clearscreen.c): unknown directive '-library' ignored
Warning! W1173: file mylib.lib(c:\lcc\projects\lib\strtofloat.c): unknown directive '-library' ignored
creating a PE executable"

I searched the group archives, but, I find nothing.
Any suggestions ?


but, have not heard back from him yet.
I guess I should have emailed him.

In the mean time, I got this response from someone else:

Quote
From: "Fred J. Scipione" <FredJScipi...@alum.RPI.edu>

Near the bottom of his webpage http://www.japheth.de/JWlink.html,
Japheth notes that JWLink does not support MS link's /DEF option, which
is where the LIBRARY directives are used.  I expect that your most
direct course of action is to take advantage of the fact that JWLink is
open source, and add your own /DEF handling code :-).

The fact that the '-library' directive is reported with a leading dash
suggests that it may be a command-line directive.  How are you invoking
JWLink?


I suppose that another route might be to add an option to suppress the
'unknown directive' warnings for '-library' directives.  The suppression
could be implemented for either or both the command-line and /DEF cases.

===================================================================

From: steve <blunt.axe.ba...@gmail.com>

Hello Fred,
Actually I mis-spoke, I'm using wlib.exe and not jwlink.
Wlib.exe is the library tool for creating libraries from ".obj" files.
The commandline would be: wlib -b my.lib some.obj

s.

===================================================================

From: steve <blunt.axe.ba...@gmail.com>

The linker warning comes up when I link to the function in the
library.
I call the linker from a batch file: JWlink format windows pe file
"%1.obj"

s.

===================================================================

From: "Fred J. Scipione" <FredJScipi...@alum.RPI.edu>

If you follow the 'list of changes' link on Japheth's page to
http://www.japheth.de/JWlink/Changes.html, it says -

if the linker finds a directive in section ".directive" that it doesn't
understand, it will emit warning "unknown directive '-%s' ignored".


So, JWLink is adding the dash in the warning for an unknown 'library'
directive it finds inside the object modules.  That means that the
compiler is creating the 'library' directives (in a ".drectve" section)
within the object modules you are producing from the floattostr2.c,
clearscreen.c, and strtofloat.c sources.  The 'library' directive is a
valid MSLink-compatible directive.  The problem is that JWLink does not
implement handling of the 'library' directive.


Assuming that it is OK for JWLink to ignore the 'library' directives,
you must either -
1. Live with the warnings.
2. See if there is something special about those 3 .c sources which
produce the 'library' directive (which you can remove?).
3. See if there is some way to get the compiler to not generate the
'library' directives (does it not do so for certain other .c sources
going into your library?  Why?).
4. Change and re-compile JWLink to implement or quietly ignore the
'library' directives.
5. Create a program that deletes 'library' directives from object
modules.  Extract the offending modules from your library, delete their
'library' directives, and replace the modules in your library with the
modified ones.


It might be helpful to find and use an object module 'dumper', which
will give you a better view of where and how the 'library' directive
appears within your object modules.


SteveA

  • Guest
Re: BxbAsm
« Reply #297 on: May 15, 2012, 01:03:04 PM »
This code causes bxbasm to crash in the translation process.

James,
just on a hunch, I thought I'd run this code, (that causes an error), thru an earlier version of bxbasm that assembles using Masm:

Code: [Select]
'-----cut-n-paste------'
'  test.bas version 48X2
    DIM az#=1.012345, bz!=123.456
    DIM rec = 1
    DIM C1$ = "", D$ = ""
    CLS
'
    OPEN "R", #1, "test.txt", 16
    FIELD #1, 8 AS C1$, 8 AS D$
        LSET C1$ = MKS$(bz!)
        LSET D$ = MKD$(az#)
        PUT 1, rec
        rec = rec + 1
    CLOSE 1
    CLEAR
    PRINT "ALL DONE"
'
' ------------------------------------------
TheEnd:
  END
' ------------------------------------------
'-----cut-n-paste------'


It works perfectly and does not crash.
Odd !

That begs the questions:
what did I change between that version and this ?
is it Masm -vs- Jwasm ?

Steve

jcfuller

  • Guest
Re: BxbAsm
« Reply #298 on: May 15, 2012, 01:07:16 PM »
Steve,
  Isn't the library warning primarily the result of using the LCCWin32 console library?
I'll upload my version shortly using gcc.
James


jcfuller

  • Guest
Re: BxbAsm
« Reply #299 on: May 15, 2012, 01:19:31 PM »
Here is my complete Library source directory. I used make and a makefile to create it.
Note I used gcc for the "c" modules and ar to create the library.
Because of gcc/ld conventions for linking I named the library libbxblib.a
You can rename it any thing you want; I'd assume bxblib.lib

James