Author Topic: BxbAsm  (Read 178846 times)

SteveA

  • Guest
Re: BxbAsm
« Reply #120 on: April 16, 2012, 08:57:33 AM »
I've found some other things that I hadn't noticed prior.
I've got to take a deeper look at them and either fix them or disable them.
Bxb uses a lot of reusable code in many places, so, one problem can easily cascade.

SteveA

  • Guest
Re: BxbAsm
« Reply #121 on: April 16, 2012, 11:05:10 AM »
  I traced the Sub1 hang to an endless loop in str_func2.

I'd go back to the earliest examples in BXBASIC.TXT and try running those really simple tests before running the later examples.
Stripped down, I'm having trouble getting it to assemble and compile even the simplest: PRINT "Hello" test.
Not being able to use any of the win32 headers is a big problem.

I'm still working on it.
I've had to redo bxblib.lib, too.
So far, I can't get much of anything to compile and execute without error.

SteveA

  • Guest
Re: BxbAsm
« Reply #122 on: April 16, 2012, 07:29:50 PM »
Okay,
attachement is the latest "working" (maybe it's ready for Linux) version.
I had to rewrite some functions and eliminate others.

NOTE: Bxblib.lib needs to be recompiled.

Here are the console functions that no longer work:
CLS
LOCATE
BEEP
COLOR
SLEEP
MESSAGEBOX
DATE$
TIME$
TIMER

as they relied on win32 api function calls.

Everything else I tried was working as intended.
Now the question is, will any of it work on Linux ?

jcfuller

  • Guest
Re: BxbAsm
« Reply #123 on: April 17, 2012, 03:58:51 AM »
Now the question is, will any of it work on Linux ?

No.
Same results with ucase and Sub1 examples although without my added printf's I have no idea where they are hanging.

James

jcfuller

  • Guest
Re: BxbAsm
« Reply #124 on: April 17, 2012, 04:08:56 AM »
Steve,
  Ran it against test and test version 2 from BXBASIC.TXT and it converted by removing after I removed BEEP.

James

SteveA

  • Guest
Re: BxbAsm
« Reply #125 on: April 17, 2012, 06:36:11 AM »
No.
Same results with ucase and Sub1 examples although without my added printf's I have no idea where they are hanging.

Boy, that's funny, because I tested those, specifically.
Let me take another look.

Quote
Ran it against test and test version 2 from BXBASIC.TXT and it converted by removing after I removed BEEP.

Yeh, I got everything in Bxbasic.txt to run, after I removed BEEP, LOCATE, etc.



« Last Edit: April 17, 2012, 06:38:08 AM by SteveA »

SteveA

  • Guest
Re: BxbAsm
« Reply #126 on: April 17, 2012, 07:24:36 AM »
No.
Same results with ucase ....I have no idea where they are hanging.

Okay,
here is the definition for _strupr and _strlwr, in string.inc:
Quote
@DefProto _CRTIMP, strchr, c, , <:ptr SBYTE, :DWORD>
@DefProto _CRTIMP, _strcmpi, c, , <:ptr SBYTE, :ptr SBYTE>
@DefProto _CRTIMP, _stricmp, c, , <:ptr SBYTE, :ptr SBYTE>
@DefProto _CRTIMP, strcoll, c, , <:ptr SBYTE, :ptr SBYTE>
@DefProto _CRTIMP, _stricoll, c, , <:ptr SBYTE, :ptr SBYTE>
@DefProto _CRTIMP, _strncoll, c, , <:ptr SBYTE, :ptr SBYTE, :size_t>
@DefProto _CRTIMP, _strnicoll, c, , <:ptr SBYTE, :ptr SBYTE, :size_t>
@DefProto _CRTIMP, strcspn, c, , <:ptr SBYTE, :ptr SBYTE>
@DefProto _CRTIMP, _strdup, c, , <:ptr SBYTE>
@DefProto _CRTIMP, _strerror, c, , <:ptr SBYTE>
@DefProto _CRTIMP, strerror, c, , <:DWORD>
@DefProto _CRTIMP, _strlwr, c, , <:ptr SBYTE>
@DefProto _CRTIMP, strncat, c, , <:ptr SBYTE, :ptr SBYTE, :size_t>
@DefProto _CRTIMP, strncmp, c, , <:ptr SBYTE, :ptr SBYTE, :size_t>
@DefProto _CRTIMP, _strnicmp, c, , <:ptr SBYTE, :ptr SBYTE, :size_t>
@DefProto _CRTIMP, strncpy, c, , <:ptr SBYTE, :ptr SBYTE, :size_t>
@DefProto _CRTIMP, _strnset, c, , <:ptr SBYTE, :DWORD, :size_t>
@DefProto _CRTIMP, strpbrk, c, , <:ptr SBYTE, :ptr SBYTE>
@DefProto _CRTIMP, strrchr, c, , <:ptr SBYTE, :DWORD>
@DefProto _CRTIMP, _strrev, c, , <:ptr SBYTE>
@DefProto _CRTIMP, strspn, c, , <:ptr SBYTE, :ptr SBYTE>
@DefProto _CRTIMP, strstr, c, , <:ptr SBYTE, :ptr SBYTE>
@DefProto _CRTIMP, strtok, c, , <:ptr SBYTE, :ptr SBYTE>
@DefProto _CRTIMP, _strupr, c, , <:ptr SBYTE>
@DefProto _CRTIMP, strxfrm, c, , <:ptr SBYTE, :ptr SBYTE, :size_t>

Take a look at your Linux version of string.inc (or .h, or whatever) and make sure it's the same.

Here is the asm code that calls it:
Code: [Select]
 lea  eax, StringBffr
  mov  [eax], byte ptr 0 ; clear string-copy buffer
  push eax
  invoke  _strupr, string ; CRT function str-to-uppercase
  mov esi, eax
  pop eax
  call copystrng

This is the only place it can possibly fail.
« Last Edit: April 17, 2012, 07:29:00 AM by SteveA »

SteveA

  • Guest
Re: BxbAsm
« Reply #127 on: April 17, 2012, 07:35:38 AM »
No.
Same results with ucase and Sub1 examples although without my added printf's I have no idea where they are hanging.

Wait a minute...
I had to go back and re-read prior posts...,

I need to be clear on what's happening...,

a)  those programs will not compile, or,
b)  they do compile, but, fail to execute ?


jcfuller

  • Guest
Re: BxbAsm
« Reply #128 on: April 17, 2012, 07:45:58 AM »
Steve,
  Sub1,bas and ucase.bas cause Bxbasm to hang when trying to translate *.bas -> *.asm.

Also note linux file names are case sensitive:
#include "Ainput.c" -> #include "AInput.c"

If I compile gcc -Wall there are numerous warnings. I have had issues in the past where warnings meant failure of the executable?


James
Code: [Select]
gcc -Wall -o "Bxbasm" "Bxbasm.c" (in directory: /home/james/bxbasmx/source)
In file included from Bxbasm.c:18:0:
globals.h:141:32: warning: "/*" within comment [-Wcomment]
globals.h:150:32: warning: "/*" within comment [-Wcomment]
In file included from Bxbasm.c:21:0:
Input.c: In function ‘line_cnt’:
Input.c:61:39: warning: "/*" within comment [-Wcomment]
Input.c: In function ‘loader_1’:
Input.c:153:13: warning: variable ‘len’ set but not used [-Wunused-but-set-variable]
In file included from Bxbasm.c:23:0:
AInput.c: In function ‘load_tmpdata’:
AInput.c:308:9: warning: variable ‘x’ set but not used [-Wunused-but-set-variable]
In file included from Bxbasm.c:25:0:
AFunct.c: At top level:
AFunct.c:266:1: warning: "/*" within comment [-Wcomment]
AFunct.c:488:40: warning: "/*" within comment [-Wcomment]
AFunct.c:500:1: warning: "/*" within comment [-Wcomment]
AFunct.c:1114:1: warning: "/*" within comment [-Wcomment]
AFunct.c:1149:1: warning: "/*" within comment [-Wcomment]
AFunct.c:1171:1: warning: "/*" within comment [-Wcomment]
AFunct.c:1195:1: warning: "/*" within comment [-Wcomment]
AFunct.c:1212:1: warning: "/*" within comment [-Wcomment]
AFunct.c:1257:1: warning: "/*" within comment [-Wcomment]
AFunct.c: In function ‘Do_print’:
AFunct.c:1582:37: warning: "/*" within comment [-Wcomment]
AFunct.c:1606:52: warning: "/*" within comment [-Wcomment]
AFunct.c:1683:40: warning: "/*" within comment [-Wcomment]
AFunct.c:1702:40: warning: "/*" within comment [-Wcomment]
AFunct.c: At top level:
AFunct.c:1775:5: warning: "/*" within comment [-Wcomment]
AFunct.c:1779:1: warning: "/*" within comment [-Wcomment]
AFunct.c:1783:27: warning: "/*" within comment [-Wcomment]
AFunct.c:1787:1: warning: "/*" within comment [-Wcomment]
AFunct.c:1854:40: warning: "/*" within comment [-Wcomment]
AFunct.c:1856:40: warning: "/*" within comment [-Wcomment]
AFunct.c:1859:35: warning: "/*" within comment [-Wcomment]
AFunct.c:1864:35: warning: "/*" within comment [-Wcomment]
AFunct.c:1867:35: warning: "/*" within comment [-Wcomment]
AFunct.c:1869:40: warning: "/*" within comment [-Wcomment]
AFunct.c:1876:40: warning: "/*" within comment [-Wcomment]
AFunct.c:1882:1: warning: "/*" within comment [-Wcomment]
AFunct.c:1906:1: warning: "/*" within comment [-Wcomment]
In file included from Bxbasm.c:27:0:
AVars.c:17:1: warning: "/*" within comment [-Wcomment]
AVars.c: In function ‘Do_redimArray’:
AVars.c:35:45: warning: "/*" within comment [-Wcomment]
AVars.c: In function ‘Do_erase’:
AVars.c:115:18: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
AVars.c: In function ‘Do_dimVar’:
AVars.c:191:41: warning: "/*" within comment [-Wcomment]
AVars.c:209:55: warning: "/*" within comment [-Wcomment]
AVars.c:234:50: warning: "/*" within comment [-Wcomment]
AVars.c:187:18: warning: unused variable ‘ndx’ [-Wunused-variable]
AVars.c: In function ‘Do_dimArray’:
AVars.c:247:43: warning: "/*" within comment [-Wcomment]
AVars.c:259:65: warning: "/*" within comment [-Wcomment]
AVars.c:263:57: warning: "/*" within comment [-Wcomment]
AVars.c: At top level:
AVars.c:358:1: warning: "/*" within comment [-Wcomment]
AVars.c: In function ‘Do_let’:
AVars.c:438:36: warning: "/*" within comment [-Wcomment]
AVars.c:453:52: warning: "/*" within comment [-Wcomment]
AVars.c:434:18: warning: unused variable ‘ndx’ [-Wunused-variable]
In file included from Bxbasm.c:28:0:
ARdp.c: In function ‘asn_numarry’:
ARdp.c:327:40: warning: "/*" within comment [-Wcomment]
ARdp.c: At top level:
ARdp.c:1354:1: warning: "/*" within comment [-Wcomment]
In file included from Bxbasm.c:30:0:
ALoops.c: In function ‘Do_while’:
ALoops.c:154:9: warning: variable ‘pi’ set but not used [-Wunused-but-set-variable]
ALoops.c: In function ‘wboolexpress’:
ALoops.c:244:32: warning: "/*" within comment [-Wcomment]
ALoops.c:230:42: warning: unused variable ‘x’ [-Wunused-variable]
ALoops.c:230:30: warning: unused variable ‘ab_code’ [-Wunused-variable]
ALoops.c:230:9: warning: variable ‘pi’ set but not used [-Wunused-but-set-variable]
In file included from Bxbasm.c:31:0:
AIf.c: In function ‘Do_if’:
AIf.c:12:9: warning: variable ‘pi’ set but not used [-Wunused-but-set-variable]
AIf.c: In function ‘get_Exptype’:
AIf.c:477:63: warning: "/*" within comment [-Wcomment]
AIf.c: In function ‘Do_Switch’:
AIf.c:852:9: warning: variable ‘pi’ set but not used [-Wunused-but-set-variable]
In file included from Bxbasm.c:32:0:
AString.c: At top level:
AString.c:420:32: warning: "/*" within comment [-Wcomment]
AString.c:427:1: warning: "/*" within comment [-Wcomment]
AString.c:431:32: warning: "/*" within comment [-Wcomment]
AString.c:438:1: warning: "/*" within comment [-Wcomment]
AString.c: In function ‘strsval’:
AString.c:521:29: warning: unused variable ‘tmp’ [-Wunused-variable]
In file included from Bxbasm.c:33:0:
AFile.c: In function ‘lineinput_io’:
AFile.c:415:10: warning: variable ‘ch’ set but not used [-Wunused-but-set-variable]
AFile.c: In function ‘input_io’:
AFile.c:897:30: warning: unused variable ‘wflag’ [-Wunused-variable]
In file included from Bxbasm.c:35:0:
Scandim.c: In function ‘dim_array’:
Scandim.c:394:42: warning: "/*" within comment [-Wcomment]
Scandim.c:406:54: warning: "/*" within comment [-Wcomment]
Scandim.c:431:41: warning: "/*" within comment [-Wcomment]
Scandim.c: In function ‘parse_local_dim’:
Scandim.c:593:18: warning: unused variable ‘ndx’ [-Wunused-variable]
In file included from Bxbasm.c:36:0:
Scanlet.c: In function ‘ScanLet’:
Scanlet.c:15:20: warning: unused variable ‘x’ [-Wunused-variable]
Scanlet.c:15:9: warning: unused variable ‘ab_code’ [-Wunused-variable]
Scanlet.c: In function ‘ScanString’:
Scanlet.c:119:29: warning: "/*" within comment [-Wcomment]
Scanlet.c: In function ‘ScanMathFunc’:
Scanlet.c:369:43: warning: "/*" within comment [-Wcomment]
Scanlet.c:425:38: warning: "/*" within comment [-Wcomment]
Scanlet.c: In function ‘ScanNumeric’:
Scanlet.c:438:41: warning: "/*" within comment [-Wcomment]
Scanlet.c:446:35: warning: "/*" within comment [-Wcomment]
Scanlet.c:453:60: warning: "/*" within comment [-Wcomment]
Scanlet.c:486:53: warning: "/*" within comment [-Wcomment]
Scanlet.c:503:42: warning: "/*" within comment [-Wcomment]
Scanlet.c:523:41: warning: "/*" within comment [-Wcomment]
Scanlet.c:435:20: warning: unused variable ‘x’ [-Wunused-variable]
Scanlet.c:435:9: warning: unused variable ‘ab_code’ [-Wunused-variable]
Scanlet.c: In function ‘Sav_Destin_A’:
Scanlet.c:537:37: warning: "/*" within comment [-Wcomment]
In file included from Bxbasm.c:37:0:
Scanprint.c: In function ‘ScanPrint’:
Scanprint.c:17:40: warning: "/*" within comment [-Wcomment]
Scanprint.c:24:56: warning: "/*" within comment [-Wcomment]
Scanprint.c:44:52: warning: "/*" within comment [-Wcomment]
Scanprint.c:80:64: warning: "/*" within comment [-Wcomment]
Scanprint.c:104:58: warning: "/*" within comment [-Wcomment]
Scanprint.c:130:55: warning: "/*" within comment [-Wcomment]
Scanprint.c:148:56: warning: "/*" within comment [-Wcomment]
Scanprint.c:152:40: warning: "/*" within comment [-Wcomment]
Scanprint.c: In function ‘ScanFPrint’:
Scanprint.c:227:36: warning: "/*" within comment [-Wcomment]
Scanprint.c:250:37: warning: "/*" within comment [-Wcomment]
Scanprint.c:161:24: warning: unused variable ‘wflag’ [-Wunused-variable]
Scanprint.c: In function ‘ScanLPrint’:
Scanprint.c:321:35: warning: "/*" within comment [-Wcomment]
Scanprint.c:258:24: warning: unused variable ‘wflag’ [-Wunused-variable]
In file included from Bxbasm.c:38:0:
Scanmisc.c: In function ‘ScanIf’:
Scanmisc.c:79:36: warning: "/*" within comment [-Wcomment]
Scanmisc.c: In function ‘ScanMsgBox’:
Scanmisc.c:184:18: warning: unused variable ‘type’ [-Wunused-variable]
Scanmisc.c:184:13: warning: unused variable ‘len’ [-Wunused-variable]
In file included from Bxbasm.c:40:0:
Scanfile.c: In function ‘ScanField’:
Scanfile.c:214:39: warning: "/*" within comment [-Wcomment]
Scanfile.c:258:36: warning: "/*" within comment [-Wcomment]
In file included from Bxbasm.c:41:0:
Output.c: At top level:
Output.c:23:30: warning: "/*" within comment [-Wcomment]
Output.c:24:37: warning: "/*" within comment [-Wcomment]
Output.c:29:35: warning: "/*" within comment [-Wcomment]
Output.c:40:5: warning: "/*" within comment [-Wcomment]
Output.c:43:1: warning: "/*" within comment [-Wcomment]
Output.c:59:25: warning: "/*" within comment [-Wcomment]
Output.c:65:40: warning: "/*" within comment [-Wcomment]
Output.c:81:25: warning: "/*" within comment [-Wcomment]
Output.c:83:42: warning: "/*" within comment [-Wcomment]
Output.c:97:25: warning: "/*" within comment [-Wcomment]
Output.c:99:42: warning: "/*" within comment [-Wcomment]
Output.c:103:25: warning: "/*" within comment [-Wcomment]
Output.c:105:1: warning: "/*" within comment [-Wcomment]
In file included from Bxbasm.c:42:0:
ASubs.c: In function ‘Do_sub_functions’:
ASubs.c:233:9: warning: variable ‘x’ set but not used [-Wunused-but-set-variable]
Compilation finished successfully.

« Last Edit: April 17, 2012, 07:48:40 AM by jcfuller »

SteveA

  • Guest
Re: BxbAsm
« Reply #129 on: April 17, 2012, 07:50:35 AM »
Okay,
I'm looking at this last post.


Okay,
most of those are just comments, like: 
  /* some code here;  /* my comment */

Quote
AFunct.c:1783:27: warning: "/*" within comment [-Wcomment]
AFunct.c:1787:1: warning: "/*" within comment [-Wcomment]
AFunct.c:1854:40: warning: "/*" within comment [-Wcomment]
AFunct.c:1856:40: warning: "/*" within comment [-Wcomment]
AFunct.c:1859:35: warning: "/*" within comment [-Wcomment]
AFunct.c:1864:35: warning: "/*" within comment [-Wcomment]
AFunct.c:1867:35: warning: "/*" within comment [-Wcomment]
AFunct.c:1869:40: warning: "/*" within comment [-Wcomment]
AFunct.c:1876:40: warning: "/*" within comment [-Wcomment]
AFunct.c:1882:1: warning: "/*" within comment [-Wcomment]

those mean nothing.
« Last Edit: April 17, 2012, 07:54:25 AM by SteveA »

jcfuller

  • Guest
Re: BxbAsm
« Reply #130 on: April 17, 2012, 07:57:27 AM »
Steve,
  Here are jwasm includes for the standard "c" libray.

James

SteveA

  • Guest
Re: BxbAsm
« Reply #131 on: April 17, 2012, 08:08:21 AM »
Quote
Input.c:153:13: warning: variable ‘len’ set but not used
AInput.c:308:9: warning: variable ‘x’ set but not used
AVars.c:115:18: warning: variable ‘type’ set but not used
AVars.c:187:18: warning: unused variable ‘ndx’ [-Wunused-variable]
AVars.c:434:18: warning: unused variable ‘ndx’ [-Wunused-variable]
ALoops.c:154:9: warning: variable ‘pi’ set but not used
ALoops.c:230:30: warning: unused variable ‘ab_code’ [-Wunused-variable]
ALoops.c:230:9: warning: variable ‘pi’ set but not used
AIf.c:12:9: warning: variable ‘pi’ set but not used
AIf.c:852:9: warning: variable ‘pi’ set but not used
AString.c:521:29: warning: unused variable ‘tmp’ [-Wunused-variable]
AFile.c:415:10: warning: variable ‘ch’ set but not used
AFile.c:897:30: warning: unused variable ‘wflag’ [-Wunused-variable]
Scandim.c:593:18: warning: unused variable ‘ndx’ [-Wunused-variable]
Scanlet.c:15:20: warning: unused variable ‘x’ [-Wunused-variable]
Scanlet.c:15:9: warning: unused variable ‘ab_code’ [-Wunused-variable]
Scanlet.c:435:20: warning: unused variable ‘x’ [-Wunused-variable]
Scanlet.c:435:9: warning: unused variable ‘ab_code’ [-Wunused-variable]
Scanprint.c:161:24: warning: unused variable ‘wflag’ [-Wunused-variable]
Scanmisc.c:184:18: warning: unused variable ‘type’ [-Wunused-variable]
Scanmisc.c:184:13: warning: unused variable ‘len’ [-Wunused-variable]
ASubs.c:233:9: warning: variable ‘x’ set but not used


All of these are very non-critical variable declarations, that I ended up not using, within functions.
Nothing that would cause a crash.

Everything else is just a comment.

SteveA

  • Guest
Re: BxbAsm
« Reply #132 on: April 17, 2012, 08:22:10 AM »
 Here are jwasm includes for the standard "c" libray.

Okay,
it looks like Linux has no _strupr or _strlwr.
So, UCASE$ and LCASE$ are out.

That doesn't explain why it hangs on compiling tho'.

And I'm at a loss about SUB1, too.

The only thing they have in common, is that they are both late additions to Bxbasm.
But, they use the same exact code as everything else.

edit:
funny thing..., MingW does include those functions:
Quote
_CRTIMP int __cdecl __MINGW_NOTHROW   _strcmpi (const char*, const char*);
_CRTIMP int __cdecl __MINGW_NOTHROW   _stricmp (const char*, const char*);
_CRTIMP int __cdecl __MINGW_NOTHROW   _stricoll (const char*, const char*);
_CRTIMP char* __cdecl __MINGW_NOTHROW   _strlwr (char*);
_CRTIMP int __cdecl __MINGW_NOTHROW   _strnicmp (const char*, const char*, size_t);
_CRTIMP char* __cdecl __MINGW_NOTHROW   _strnset (char*, int, size_t);
_CRTIMP char* __cdecl __MINGW_NOTHROW   _strrev (char*);
_CRTIMP char* __cdecl __MINGW_NOTHROW   _strset (char*, int);
_CRTIMP char* __cdecl __MINGW_NOTHROW   _strupr (char*);
_CRTIMP void __cdecl __MINGW_NOTHROW   _swab (const char*, char*, size_t);
« Last Edit: April 17, 2012, 09:00:54 AM by SteveA »

jcfuller

  • Guest
Re: BxbAsm
« Reply #133 on: April 17, 2012, 09:26:18 AM »
Steve,
  I believe they are not ansi standard.
This is what ubx uses:
James

Code: [Select]

char *_strupr_(char *string)
{
  char *s;
  if (string)
     {
      for(s = string; *s; ++s)
         *s = toupper(*s);
     }
   return string;
}

char *_strlwr_(char *string)
{
    char *s;

    if (string)
    {
       for (s = string; *s; ++s)
           *s = tolower(*s);
    }
    return string;
}


« Last Edit: April 17, 2012, 09:37:56 AM by jcfuller »

SteveA

  • Guest
Re: BxbAsm
« Reply #134 on: April 17, 2012, 10:18:27 AM »
 I believe they are not ansi standard.

Yeh,
I figured I'd have to use toupper/tolower, in a loop, to make the conversion.