News:

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

Main Menu

.FOR built in JWasm

Started by habran, July 03, 2012, 11:38:29 PM

Previous topic - Next topic

habran

Quote... another MB promotion thread ... 
thanks again Japheth  :eusa_clap:

Look at this ugly code:
QuotePrint Str$(ebx), Tb$, Files$(ebx), CrLf$

only mother can love such an ugly child :lol:
I fill like I will sting my eyes on all of these $$$$$$$ :dazzled:
sorry JJ I like you but I can not like this ugly code, look at this line:
Quote
Inkey Str$("Size of Windows.inc=\t%i bytes", Lof("Windows.inc")), Str$("\nSize of WinExtra.inc=\t%4f MB", Lof("WinExtra.inc")/1024/1024)
it looks like swearing in comic books
I fill sea-sick looking at it ::)
jj2007,
you have a great programmer's skills, use it to create some beautiful code  :biggrin:
Cod-Father

jj2007


habran

I admire your great sense of humour JJ 
Cod-Father

jj2007

Same to you, young friend :t
By the way:

Quote from: habran on February 05, 2013, 06:05:05 AM
....I can not like this ugly code, look at this line:
Quote
Inkey Str$("Size of Windows.inc=\t%i bytes", Lof("Windows.inc")), Str$("\nSize of WinExtra.inc=\t%4f MB", Lof("WinExtra.inc")/1024/1024)
it looks like swearing in comic books
I fill sea-sick looking at it ::)
jj2007,
you have a great programmer's skills, use it to create some beautiful code  :biggrin:

Can you show me how to do that in C, with beautiful code? Same functionality, of course.

habran

Hi jj2007,
if you find yourself offended I apologize, that was not my intent

I am an assembler programmer, primarily :t
secondarily, I am C, C#, java, C++ (in that order from left to right)
100 years ago I was a BASIC programmer (or maybe only 30... years ago) on C64
for very short time and switched to ASM and fell in love with it :icon_redface:
C is closest to ASM but produces a lot of unnecessary repetition of same codes
while hll ASM looks similarly and is easy to read but is many-fold shorter and faster
I am a perfectionist as well as an artist, I enjoy in a simple natural beauty
and ASM is closest to the nature of processors (except 01001011)
when programming in ASM I am the master and in hll I am a slave
If you want me to show you how to write your code in C or ASM, compile your code and post it here,
or somewhere else, and I can try to make it look beautiful  :eusa_boohoo:
however, in my opinion japheth is the greatest C programmer in this forum
and if you look through JWasm source code you will find the beauty of C programming :eusa_clap:
best regards

   
Cod-Father

jj2007

Quote from: habran on February 05, 2013, 01:47:27 PM
If you want me to show you how to write your code in C or ASM, compile your code and post it here,
or somewhere else, and I can try to make it look beautiful  :eusa_boohoo:

You showed it already above, here the complete example:
Quoteinclude \masm32\MasmBasic\MasmBasic.inc        ; download
        Init
        Inkey Str$("Size of Windows.inc=\t%i bytes", Lof("Windows.inc")), Str$("\nSize of WinExtra.inc=\t%4f MB", Lof("WinExtra.inc")/1024/1024)
        Exit
end start

Output:
Size of Windows.inc=    977412 bytes
Size of WinExtra.inc=   1.019 MB


Inkey = string to screen ("cout" seems to be the C equivalent) plus wait for a keypress
Str$(n) = the string representation of the number n
Lof(path or #n) = the length of a file

I am curious to see how this five-liner can be made more beautiful. Really, no joke.
(you see of course that it has to be started from \masm32\include to show results)

Quotehowever, in my opinion japheth is the greatest C programmer in this forum

The overall level here is remarkably high; among the C coders subset, qWord (for example) is very bright, too. But I agree that japheth has done an outstanding job with JWasm, and if he can solve his problems, he will certainly make a career.

habran

Quote("cout" seems to be the C equivalent)

"cout" is not "Inkey" it is "Outkey" and not in C but in C++

examples:

//C++ C example
#include <iostream>

using namespace std;

int main()
{
     string answer;
     cout << "Please enter your name: " << endl;
     cin >> answer;
     cout << "Your name is: " << answer;
return 0;
}

/* C example */
#include <stdio.h>

int main()
{
  char answer[256];
  printf ("Please enter your name: ");
  fgets(answer, 256, stdin)
  printf ("Your name is: %s\n", answer);
  return 0;
}

can you see that C++ looks ugly?
and C looks nice
Cod-Father

Gunther

Hi habran,

Quote from: habran on February 05, 2013, 08:51:54 PM

//C++ C example
#include <iostream>

using namespace std;

int main()
{
     string answer;
     cout << "Please enter your name: " << endl;
     cin >> answer;
     cout << "Your name is: " << answer;
return 0;
}

/* C example */
#include <stdio.h>

int main()
{
  char answer[256];
  printf ("Please enter your name: ");
  fgets(answer, 256, stdin)
  printf ("Your name is: %s\n", answer);
  return 0;
}

can you see that C++ looks ugly?
and C looks nice

My first language is assembly language; I started with IBM 360 assembly language and PL/1 35 years ago. I've written programs in FORTRAN, COBOL, PASCAL, Modula2, BASIC and yes, in C and
C++. C was developed to write operating systems; in its first version it couldn't do normal mathematics. Period.

Everyone has the freedom to write programs in his prefered language. I'm not such a sophisticated C programmer like Japheth, you know, but Jochens code is very densed. I'm sure he could write the same in a better readable form with the same functionality and it'll do the same job as your C equivalent. What is the advantage of your C++ code? Your code has a lot of red band (calling a constructor, calling a destructor, name mangling, name decoration) and depending on the used compiler different mangling schemes. Please have a look at the assembly language output and you'll see what I'm speaking about.

Gunther   
You have to know the facts before you can distort them.

jj2007

Quote from: habran on February 05, 2013, 08:51:54 PM
"cout" is not "Inkey" it is "Outkey" and not in C but in C++
Sorry, got confused :redface:

Quote#include <stdio.h>

int main()
{
  char answer[256];
  printf ("Please enter your name: ");
  fgets(answer, 256, stdin)
  printf ("Your name is: %s\n", answer);
  return 0;
}

can you see that C++ looks ugly?
and C looks nice

Indeed nicer then C++ :biggrin:

include \masm32\MasmBasic\MasmBasic.inc
        Init
        Print "Your name is ", Input$("Please enter your name: ", "Habran")
        Exit
end start

(note the added functionality - try to do that in C ;))

habran

Hi Gunther,
you are right, C++ is ugly and produces to much unnecessary code
that is why I said I fell in love with ASM 30... years ago
QuoteI am an assembler programmer, primarily
means my preferable language is the assembly language
lately I do only 64 bit programming with the best assembler ever, JWasm
there is so much advantage in using all possible registers
if there was no assembly language I would probably give up programming and play chess
so, all in all I agree with everything your said :lol:
jj2007,
QuoteSorry, got confused
apology accepted
Quote(note the added functionality )
did you mean:
Quote"Habran")
:biggrin:
Cod-Father

habran

jj2007,
did you try to run your "InputHabran.exe" ??? :icon_eek:
if not do it now  :badgrin:
;)
Cod-Father

japheth


I know C pretty good, but I'm no expert ( had to learn very recently that in the jwasm source I used strcpy() for overlapping regions - which may give undefined results ).

And I'm not going to "make a career", because I'm in an age where a career has already been made - or doesn't happen at all, as in my case  :bgrin:.
 


jj2007

Sure I ran it. Any problems? I can't test it right now under Win7-64 but with Win7-32 it simply shows this:
Please enter your name: Habran
<< you can edit that
... and, when you hit Enter:
Your name is Habran

So what's the problem on your end? Which OS?

habran

first empty window with a prompt and than you can not do nothing with window
but when you type something after quite a while it appears:
"Please enter your name:" and that what you tipped in
Cod-Father

jj2007

Same for second attempt? It could be an AV problem. Which OS are you running? Anybody else having the same problem?