News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

JWasm continuation (our try) on GitHub

Started by XVilka, November 06, 2015, 12:58:40 AM

Previous topic - Next topic

GoneFishing

Hi Vortex,
Yes , I know . I read that thread and got a strong feeling that it was not Andreas but a trickster .
Lexicon and formatting of words  made me think so.
Though maybe I'm wrong and  my intuition plays tricks to me...

One more argument proving my wild guess  - his avatar image named Britney_Spears !
Google image search for this picture shows that it's taken  from the standart avatar set for forums . Who has such packages? Serious programmers like Andreas? Unlikely .
Goal?
Advertisement.



xanatose

Could it be possible to add
-nologo

or

-quiet

to suppress any output unless there is an error?

milabs

#17

hutch--

I guess my cynicism is showing but there was a good reason why I posted Japheth's version at the top of the page, its so folks know where the development started and stopped. While I have no doubt that various folks have done work on the source code after Japheth abandoned the project, with multiple versions you end up with a "Forked fork of a forked fork" (all puns intended).

ACP

Exactly my thoughts from few posts earlier. Anyway I wish you guys luck. Seems like putting the project on github, splitting regression tests and enabling ticket tracking is a good start, but you guys still need to somehow invite others from separate forks to cooperate. Otherwise we really may end up with a number of JWASM based assemblers with different syntax. I guess we have already large enough base of different syntaxes for x86/x64 so creating new set on already well established assembler will not help anyone in long turn.
ASM beyond Repair https://corexor.wordpress.com blog about assembly related stuff

bugthis

Could one of you GitHub account members that are working on JWASM improve the JWASM manual?

There should be especially a MASM compatibility chapter that shows what does work and what should be substituted by JWASM specific ways of solving things.

I'm reading an old assembler book written for MASM and DOS. And i ran into a bunch of problems while trying to adapt the code to JWASM.

Especially the Conditional Assembly (IF, ELSE etc.) with MACROs was a problem.

MASM code:

; MASM way
IF (parameter1 EQ BL) ; BL = BL register

didn't work and had to be substituted with:

; JWASM way
IFIDNI <parameter1>, <BL>

for JWASM

The same applies to all other operators of MASM's if:

EQ = equal 
NE = not equal
LT = less than
LE = less or equal
GT = greater
GE = greather or equal


Other incompatibility issues or things that had to be handled in a JWASM way were:

Linking:

; MASM way
; Creating object code + linking in one go
ML code1.asm code2.asm lib.bib


; JWASM + WLINK way
; Creating object code
jwasmr code1.asm code2.asm
; linking it with wlink (part of Open Watcom C Compiler)
; where
; prog = name of the executable
; name = cmd parameter of wlink
; file = cmd parameter of wlink
; code1 and code2 = oject files without extension
; lib.bib = library WITH extension
wlink name prog file code1, code2, lib.bib


When creating subroutines:

; MASM way
.MODEL SMALL
...
.CODE
TESTFUNC  PROC FAR USES AX, BX ; Where TESTFUNC is our routine name
[code]
[code]
;JWASM way
.MODEL SMALL, C  ; JWASM requests a language to use as calling convention here. C will do fine in most cases.
...
.CODE
TESTFUNC PROC FAR USES AX, BX


And when calling them in another file, for example main.asm

; MASM way
PUBLIC TESTFUNC
.MODEL SMALL
.CODE
....
CALL TESTFUNC
...


;JWASM way
PUBLIC _TESTFUNC ; JWASM expects a leading "_"
.MODEL SMALL C ; JWASM expects the corresponding calling convention
.CODE
....
CALL _TESTFUNC  ; JWASM expects a leading "_" again
...


I don't have a github account, thus i can't add that myself to the issues page.
Github does require too much contract text to accept just to register an account.

But you can use all the stuff i mentioned here if you need so. I put this comment under public domain.

jj2007

Quote from: bugthis on October 25, 2022, 08:32:40 AMMASM code:

; MASM way
IF (parameter1 EQ BL) ; BL = BL register

Hi bugthis,

That doesn't work even with my oldest MASM version, 6.14. It has always been ifidni <parameter1>, <bl>

If you don't agree, post a complete program. Which MASM version are you using?

I have a medium sized library with over 600 macros, and all of them work fine with MASM, UAsm and AsmC alike. I haven't tested them with JWasm recently, but I would be surprised if they were any problems.

P.S.: Just tested it with my editor, 24,000 lines, 160 macros, plus the 500+ of the library. No compatibility problem with JWasm (but assembly is a factor 3 slower than with UAsm).

bugthis

Quote from: jj2007 on October 25, 2022, 08:44:19 AM
Quote from: bugthis on October 25, 2022, 08:32:40 AMMASM code:

; MASM way
IF (parameter1 EQ BL) ; BL = BL register

Hi bugthis,

That doesn't work even with my oldest MASM version, 6.14. It has always been ifidni <parameter1>, <bl>

If you don't agree, post a complete program.
Well, that's what my book says.

Example slightly modified to get rid of some other macros: (The IF ELSE part is not modified)

filename: lib.bib

INPUT_X  MACRO Reg                                                             
         IF (Reg EQ AL) OR (Reg EQ AH)                                         
           PUSH DX                                                             
           PUSH AX                                                             
           MOV AH, 08h                                                         
           INT 21h                                                             
           MOV DL, AL                                                           
           POP AX                                                               
           MOV Reg, DL                                                         
           POP DX                                                               
         ELSE                                                                   
           PUSH AX                                                             
           MOV AH, 08h                                                         
           INT 21h                                                             
           MOV Reg, AL                                                         
           POP AX                                                               
         ENDIF                                                                 
         ENDM                                                                   


filename: main.asm

; Example                                                                       
INCLUDE lib.bib                                                         
.MODEL SMALL                                                                   
.STACK 256                                                                     
                                                                               
.CODE                                                                           
                                                                               
START:                                                                         
       MOV AL, 30h                                                             
       INPUT_X AL                                                               
                                                                               
       MOV DL, AL                                                               
       MOV AH, 02H                                                             
       INT 21h                                                                 
                                                                               
       MOV AH, 4Ch                                                             
       INT 21h                                                                 
       END START 


Quote
Which MASM version are you using?
I don't have MASM, thus i am using JWASM or in other words have to use JWASM.

The book gives a small hint about the MASM 6 version but the code and most of the book could also be written for older MASM versions.
The code is x86 Real Mode only for MS-DOS. And the newest CPU mentioned in the book is the Pentium (from 1993).

Quote
I have a medium sized library with over 600 macros, and all of them work fine with MASM, UAsm and AsmC alike. I haven't tested them with JWasm recently, but I would be surprised if they were any problems.
The above code will not work with JWASM without some modifications.
Especially the IF...ELSE statement will not work and throw an error because of the IF...ELSE part.

JWASM: Error A2189: Constant or relocatable label expected

zedd151

Since this thread is seven years old, possibly the work on github has been abandoned?? In any case, no posts here from the thread author since 2015. Doubtful if they even check here.

jj2007

Quote from: bugthis on October 25, 2022, 09:37:36 AM
QuoteIf you don't agree, post a complete program.
Well, that's what my book says.

You didn't post a complete program as requested, but out of curiosity I used your INPUT_X macro in a 16-bit template:

OPT_Assembler JWasm ; Error A2189: Constant or relocatable label expected
OPT_Assembler mlv614 ; Error A2095: Constant or relocatable label expected
OPT_Assembler UAsm64 ; Error A2190: Constant or relocatable label expected


Instead of reading the book and complaining about inexistent problems, you should start coding.

bugthis

#25
Quote from: jj2007 on October 25, 2022, 11:19:51 AM
Quote from: bugthis on October 25, 2022, 09:37:36 AM
QuoteIf you don't agree, post a complete program.
Well, that's what my book says.

You didn't post a complete program as requested, but out of curiosity I used your INPUT_X macro in a 16-bit template:
I did. The code is a complete program.

With the help of
https://www.pcjs.org/software/pcx86/sys/dos/microsoft/6.20/

i could even test it with MASM 5.
And it assembled like a charm and it run without problems.

I couldn't test it with MASM 6.11.
MASM 6.11 requires a 386 CPU and running ml.exe inside PCJS emulator with the compaq 386 model seems to trigger a bug inside the emulator.
ML quits with error message, thus an inevitable emulator error:
phar lab fatal sys error 10025: Unexpected processor exception occured.


OPT_Assembler JWasm        ; Error A2189: Constant or relocatable label expected
I already told you that. Didn't you read what i have written above?

OPT_Assembler mlv614        ; Error A2095: Constant or relocatable label expected
It works in MASM 5.00

QuoteInstead of reading the book and complaining about inexistent problems, you should start coding.
Instead of writing nonsense like this, maybe you should read what I wrote. In addition, you can see here now that it works in MASM 5.00 and you used an incompatible assembler.
See the screenshot.zip file of PCJS emulator as proof.

The MASM 6.11 files of the PCJS website seem to give a clue about changes from MASM 5.1 to 6.x. But i have to read that first. Didn't had the time.


bugthis

#26
Quote from: jj2007 on October 25, 2022, 11:19:51 AMOPT_Assembler mlv614        ; Error A2095: Constant or relocatable label expected
Instead of reading the book and complaining about inexistent problems, you should start coding.

Ok, i think i found something.
You didn't use your MASM 6 assembler correctly.

You have to apply the /Zm option to MASM 6.x.
QuoteIn many cases, MASM 5.1 code will assemble without modification under MASM
6.0. However, MASM 6.0 provides a new OPTION directive that lets you
selectively modify the assembly process. In particular, you can use the M510
argument with OPTION or the /Zm command-line option to set most features to
be compatible with version 5.1 code.

See Appendix A, "Differences between MASM 6.0 and 5.1," for information
about obsolete features that will not assemble correctly under MASM 6.0.

And in Appendix A i found this:
English isn't my native language, but this could describe the problem i found with JWASM and you hade with MASM 6 without MASM 5 compatibility mode.
QuoteComparing Types Using EQ and NE with OPTION M510 - With OPTION M510, types     
are converted to a constant value equal to the size of the data type before   
comparisons with EQ and NE. Code types are converted to 0FFFFh  (near) and     
0FFFEh  (far). If OPTION M510 is not enabled, types are converted to           
constants only when comparing them with constants; two types are equal only   
if they are equivalent qualified types.

See here for further reading:
https://www.pcjs.org/documents/books/mspl13/masm/mpguide/


jj2007

Quote from: bugthis on October 25, 2022, 01:42:39 PM
You didn't use your MASM 6 assembler correctly.

You are a joker, but I like you :tongue:

Version 6.0 was released in 1992, so you are talking about a software that is more than 30 years old :cool:

QuoteThe last freestanding commercial version of the Mirosoft assembler was version 6.11d released in 1993

OS/2 Museum (with a nice description of the two passes, unfortunately not quite correct):
QuoteLearn Something Old Every Day, Part III
Posted on September 8, 2021 by Michal Necasek
As part of a hobby project, I set out to reconstruct assembly source code that should be built with an old version of MASM and exactly match an existing old binary. In the process I learned how old MASM versions worked, and why programmers hated MASM. Note that "old versions" in this context means MASM 5.x and older, i.e. older than MASM 6.0.

_japheth

Hello bugthis,

I'm the author of jwasm. If you don't want a github account, you can post in this forum, but I'd suggest to use the "DOS 16-bit" sub-forum then. I'm perhaps not visiting here on a daily basis, but if I do, I check the DOS forum then.

Generally, jwasm is based on the Masm v6 assembly language style. For programs written in Masm v1⁻v5, it's better to use Masm directly ( for example, jwasm hasn't implemented the "option oldmacros" ).

I have to agree with jj, though: your code snippets are not full programs - that makes it unnecessarily cumbersome to reproduce your issues.

Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

_japheth


Quote
         IF (Reg EQ AL) OR (Reg EQ AH)                                         

I checked that syntax: it's indeed accepted by Masm v5.1 ( although you apparently cannot use any 8-bit register as macro argument!? ).
However, it's not accepted by Masm v6, no matter if the -Zm cmdline option is used or not. So jwasm also isn't supposed to support that syntax.

Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.