Home / Microsoft / Microsoft DOS / What's the point of remarks?
0 Members and 2 Guests are viewing this topic. « previous next »
Pages: 1 2 3 [All] - (Bottom) Print
Author Topic: What's the point of remarks?  (Read 4689 times)
BatchRocks
Topic Starter
Hopeful



Thanked: 3
Posts: 326




« on: January 15, 2009, 12:44:07 PM »

Hello!

What's the point of remarks as I see no use in them?

Is it just like if someone is editing, it tells what it is? I don't know, please help :O.

BR
IP logged
Dias de verano
Guest
« Reply #1 on: January 15, 2009, 01:17:58 PM »

I agree that if you are writing little toy batch scripts to play around with, that nobody else will ever see, it may be hard to see the usefulness of remarks. However, professional programmers especially those who work as part of a team, and people writing code to teach or help others often see remarks as a good thing.  Remarks help both you and other programmers who might modify and update your code in the future. Remarks offer descriptive messages that explain in English (or whatever language you prefer) what's going on in the program's code.

IP logged
BatchRocks
Topic Starter
Hopeful



Thanked: 3
Posts: 326




« Reply #2 on: January 15, 2009, 01:43:13 PM »

Oh, I see. Thanks. So, it's like if it's a team project, Team member A is like:

Rem ************Team  A************

ect.

Cool. Thanks. And thanks for not insulting me this time >.<  >:(
IP logged
Helpmeh
Egghead



Thanked: 117
Posts: 3,608

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #3 on: January 17, 2009, 07:36:54 AM »

I remember reading somewhere on CH about how too many remarks will actually lagg the script, but if you do

::Your Remark Here

it completely skips the line. Remark gets read through, but not executed...
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
Dias de verano
Guest
« Reply #4 on: January 17, 2009, 07:40:01 AM »

I remember reading somewhere on CH about how too many remarks will actually lagg the script, but if you do

::Your Remark Here

it completely skips the line. Remark gets read through, but not executed...

Unless your machine is something like a 1995 Pentium 100 MHz, you won't notice any speed difference, and even then it would be very small. People who want speed don't use batch files.

IP logged
Helpmeh
Egghead



Thanked: 117
Posts: 3,608

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #5 on: January 17, 2009, 07:45:56 AM »

I was just repeating what I read...and I've managed to make my computer lagg so much to the point of crashing using too many rems...(that was on purpose though).

Edit: Found the post explaining the :: thing. Here's the quote.

When you start talking with us "old-schoolers" you will hear some funny stories.

I was working for ITT Servcom in the early 80's and I was in a bank presidents office one day when I noticed a bright colored DOS menu on his computer screen.
I asked "How do you do that" and for the next hour, I sat there getting my first formal training in DOS batch file and menu creation, from a Bank President.

A practical use of the @ sign would be to blank out just one line, in a batch file where all the other lines are being echoed to the screen.

When you start a batch file with Echo OFF, you put the @ sign at the start of the line so the command Echo Off won't be echo'ed to the screen.

I was taught to put:
@Echo Off
cls


at the beginning of every batch file.  I do that to this very day.
It clears the screen ( CLS ) and keeps it clean while the batch file runs, unless you instruct it to echo certain lines to the screen.

For batch file testing, you may want to disable the @Echo Off command during the testing procedure.  Then you can see if there are any error messages to your commands.

To disable any line, just put two colons (  ::  ) at the beginning of the line and DOS will totally ignore that line.  If you use REM, then DOS will continue to read the entire line, even though it will not (usually) execute it.  There are a few instances where the line or part of it MAY be executed, that's why I never use REM, but always the double colon.  Now it's just a habit.

Also, the batch file runs faster if DOS doesn't have to read the remark lines.

Cheers Mates, keep up the good work!

The Shadow  8)
« Last Edit: January 17, 2009, 07:57:51 AM by Helpmeh » IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
Dias de verano
Guest
« Reply #6 on: January 17, 2009, 08:04:52 AM »

I don't think this person is an expert, the advice about using :: instead of REM is a mistake, as I pointed out later in that thread.
IP logged
macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #7 on: January 17, 2009, 09:23:56 AM »

and remarks are also good for pointing out bugs in some parts of code that you can debugged later on.
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #8 on: January 17, 2009, 10:05:52 AM »

Quote
I don't think this person is an expert, the advice about using :: instead of REM is a mistake, as I pointed out later in that thread.

So is there a way we could test this?
Like two version of a batch file with lots of long lines
of remarks and a timer at the end of the file?

Curious minds want to know.  ;D
IP logged

macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #9 on: January 17, 2009, 10:22:06 AM »

from what my ye olde MS-DOS book says:
"Remarks are skipped by the command proccessor..."

so i dont think it would make a difference in speed, and besides with proccessors getting faster and faster Batch programs dont have to worry about speed and processor time.  ;)
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
Dias de verano
Guest
« Reply #10 on: January 17, 2009, 11:28:04 AM »

Rem.bat

@echo off
REM a REM remark

Dot.bat

@echo off
:: a dot remark

run each bat 50000 times

REM.bat
start  17:59:33.90
finish 18:06:41.40

7 minutes 7.5 seconds (427.50 seconds)

Dot.bat
start  18:06:41.43
finish 18:14:41.68

8 minutes 0.25 seconds (480.25 seconds)

So the dots were slower.

Moral:

Don't believe everything you read on web forums.

IP logged
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #11 on: January 17, 2009, 12:11:05 PM »

Quote
run each bat 50000 times

Full diskclosure requested.
How do you run a batch file 5000 times?
Maybe you are testing only the speed of the
robot that is hitting the enter key 5000 times.
While model aneroid way it?
IP logged

macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #12 on: January 17, 2009, 12:19:18 PM »

Rem.bat

@echo off
REM a REM remark

Dot.bat

@echo off
:: a dot remark

run each bat 50000 times

REM.bat
start  17:59:33.90
finish 18:06:41.40

7 minutes 7.5 seconds (427.50 seconds)

Dot.bat
start  18:06:41.43
finish 18:14:41.68

8 minutes 0.25 seconds (480.25 seconds)

So the dots were slower.

Moral:

Don't believe everything you read on web forums.



it was from a book, and i when it said "..skips.." i thought it didnt take time anyways, but since cmd has to check to see what command it is on each line, that would take up some time.
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
Dias de verano
Guest
« Reply #13 on: January 17, 2009, 12:58:06 PM »

How do you run a batch file 5000 times?

It was 50,000 times, not 5,000.

This is Timer.bat. You call it with the number of repetitions required, e.g. Timer.bat 50000

Code: [Select]
@echo off
echo run each bat %1 times
echo.
echo REM.bat
echo start  %time%
for /L %%N in (1,1,%1) do call rem.bat
echo finish %time%
echo.
echo Dot.bat
echo start  %time%
for /L %%N in (1,1,%1) do call dot.bat %%N
echo finish %time%
echo.


Quote
While model aneroid way it?

Don't understand.



« Last Edit: January 17, 2009, 01:50:58 PM by Dias de verano » IP logged
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #14 on: January 17, 2009, 02:35:51 PM »

How are you getting it to repeat 5000 times? Do you have a robot (android) that bangs on the F3 and ENTER key 5000 times? How do we know the 7 o 8 minutes are not being mostly the time it takes to hit the keys 5000 times. You did not explain how you got the batch file to do 5000 times.
IP logged

Dias de verano
Guest
« Reply #15 on: January 17, 2009, 02:40:20 PM »

How are you getting it to repeat 5000 times? Do you have a robot (android) that bangs on the F3 and ENTER key 5000 times? How do we know the 7 o 8 minutes are not being mostly the time it takes to hit the keys 5000 times. You did not explain how you got the batch file to do 5000 times.

Yes I did. Read the code. And its fifty thousand, not five thousand, as I have already told you.  ::)
IP logged
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #16 on: January 17, 2009, 03:02:16 PM »

Code: [Select]
for /L %%N in (1,1,%1) do call dot.bat %%N
OK. I missed it. By beady little eyes did not see that.
Thank you.

Now the nest question is how much time was used by the loop?
Please try it again for 3 bat files the third bat file is here:
Code: [Select]

Just one blank line. Can you do that please? I what to see what the loop overhead is. This will help answer the question about remark skipping.
Due to my age I can DOS challenged, and besides, my machine will give different results.
IP logged

Dias de verano
Guest
« Reply #17 on: January 17, 2009, 05:09:48 PM »

1. REM   426.67 seconds
2. dots  480.02 seconds
3. empty 293.15 seconds
IP logged
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #18 on: January 17, 2009, 05:59:20 PM »

Quote
1. REM   426.67 seconds
2. dots  480.02 seconds
3. empty 293.15 seconds

Thus one might conclude that the FOR and CALL have an overhead of about 293 seconds.
Therefor:
 Rem takes 133 seconds
 Dot takes 187 seconds
So using dots instead of REM will add 54 seconds ti the test. That represents an increase of nearly 40%   :o
From this I would conclude that you want to document your program, use REM rather that the dots. Unless you want to slow down your batch.
IP logged

BC_Programmer
Mastermind


Thanked: 697
Posts: 15,881

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #19 on: January 17, 2009, 07:14:26 PM »

And Dias already pointed out a much better reason in the other thread. Even if :: was faster, it breaks with for and command extensions. In which case code that is slower is better then code that doesn't work.

It doesn't matter how fast your code is if it doesn't work.


But- :: is slower. I imagine the command processor needs to do extra processing to try to interpret it as a line label.

besides. None of this discussion is even relevant:

People who want speed don't use batch files.


Hello!

What's the point of remarks as I see no use in them?

Is it just like if someone is editing, it tells what it is? I don't know, please help :O.

BR

have you ever come back to your own (uncommented) code 5 years down the road? Obviously not. There is a point where comments are stupid- here is useless documentation:

Code: [Select]
REM perform copy command.
copy %source1% %dest1%

It states the obvious. The code is self-documenting without the remark.

The only time one should try to comment is for complicated constructs; portions of code that aren't self-documenting. That in and of itself says that every line of Perl code needs 3 comments explaining it. Unfortunately Perl programmers usually come from a *nix background where unfortunately commenting code is regarded as a sign of weakness.



IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #20 on: January 17, 2009, 08:54:55 PM »

Code: [Select]
Unfortunately Perl programmers usually come from a
*nix background where unfortunately commenting code is
regarded as a sign of weakness.

NOT documenting code is a weakness.
Never have such a person on your team.
IP logged

Dias de verano
Guest
« Reply #21 on: January 18, 2009, 05:58:25 AM »

OK folks. Way back in the day, when a Commodore 64 was considered a
powerful computer, people used to say that comments slowed down
interpreted BASICs, and those machines were so slow that it really made
a difference.

Another thing: anybody can create a benchmark program that does not
actually do anything useful. Real world programs that people create
to do useful tasks are something else. File and text processing are
typical batch tasks.

So:

In a folder, I created

10 text files containing the phrase "horse and pony"

Quote
I used to convert wmv to avi using TMPGEnc Express 3 or 4.   More
recently I have been using VirtualDub, which, theoretically, cannot
handle wmv files but can be fooled into doing so.   You have to have
the latest ffdshow software loaded - search for
ffdshow_beta5_rev2033_20080705_clsid.ex e - and then use Notepad to
create a .avs file of the form:

DirectShowSource("C:\Conversions\file.wmv")

- obviously change the path in quotes to fit your path to file.

Open the .avs file in VDub and then you can do a Fast Re-compress,
setting the bit-rate in the XviD or DivX set-up screens to the same as
for the wmv file. I love my horse and pony.

Conversions this way are as good, quality wise as with TMPGEnc but
take a fraction of the time.

Of course, either way, you have to have the XviD and/or DivX codecs

... and 10 text files without the phrase.

Quote
I used to convert wmv to avi using TMPGEnc Express 3 or 4.   More
recently I have been using VirtualDub, which, theoretically, cannot
handle wmv files but can be fooled into doing so.   You have to have
the latest ffdshow software loaded - search for
ffdshow_beta5_rev2033_20080705_clsid.ex e - and then use Notepad to
create a .avs file of the form:

DirectShowSource("C:\Conversions\file.wmv")

- obviously change the path in quotes to fit your path to file.

Open the .avs file in VDub and then you can do a Fast Re-compress,
setting the bit-rate in the XviD or DivX set-up screens to the same as
for the wmv file.

Conversions this way are as good, quality wise as with TMPGEnc but
take a fraction of the time.

Of course, either way, you have to have the XviD and/or DivX codecs

2. Then I created a typical batch file to process all the .txt files in the folder
and show which files contained the phrase.

I created 3 versions

(a) with a typical (I feel) number of REMs, that is, the number I would put in
if I was explaining my ideas to another person.

Code: [Select]
@echo off
REM Find lines in text files
REM Containing a phrase

REM Store phrase in variable
set phrase=horse and pony

REM Loop through all .txt files in folder
REM Use FIND to check for phrase in each file

set /a foundcount=0
for /f "delims=" %%F in ('dir /b *.txt') do (
type "%%F" | find /I "%phrase%">nul && (
echo Phrase: %phrase% was found in file: %%F
set /a foundcount+=1
)
)
REM Display count of phrases found
Echo found: %foundcount%

(b) with double colons instead of REMs

Code: [Select]
@echo off
:: Find lines in text files
:: Containing a phrase

:: Store phrase in variable
set phrase=horse and pony

:: Loop through all .txt files in folder
:: Use FIND to check for phrase in each file

set /a foundcount=0
for /f "delims=" %%F in ('dir /b *.txt') do (
type "%%F" | find /I "%phrase%">nul && (
echo Phrase: %phrase% was found in file: %%F
set /a foundcount+=1
)
)
:: Display count of phrases found
Echo found: %foundcount%

(c) with no remarks at all

Code: [Select]
@echo off
set phrase=horse and pony
set /a foundcount=0
for /f "delims=" %%F in ('dir /b *.txt') do (
type "%%F" | find /I "%phrase%">nul && (
echo Phrase: %phrase% was found in file: %%F
set /a foundcount+=1
)
)
Echo found: %foundcount%

Then I ran them 1, 10, 25, 50 and 100 times each

REM = batch with REM remarks
CLN = batch with double colon remarks
NOC = batch with no remarks at all

1 run - not surprisingly, identical results, as the number of runs
grows, any differences may become apparent...

REM elapsed 3 seconds
CLN elapsed 3 seconds
NOC elapsed 3 seconds

10 runs

REM elapsed 30 seconds
CLN elapsed 34 seconds
NOC elapsed 28 seconds

25 runs

REM elapsed 82 seconds
CLN elapsed 76 seconds
NOC elapsed 75 seconds

50 runs

REM elapsed 154 seconds
CLN elapsed 154 seconds
NOC elapsed 156 seconds

100 runs

REM elapsed 286 seconds
CLN elapsed 313 seconds
NOC elapsed 313 seconds

As you can see, there ain't much in it, and any delay from
remarks is (heavily) swamped by other things.

While all these runs were taking place, my computer being a real
world computer, I was also

-using Mencoder to save a web tv ASF stream into an mpeg file
-using Xnews to download a bunch of binaries from a news server
-using Firefox to browse the web

My PC is a Shuttle ST62K with a 3.0 GHz P4 hyperthreading (Prescott core) with 1 GB RAM and a 7200 rpm IDE HD


IP logged
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #22 on: January 18, 2009, 09:22:13 AM »

Quote
As you can see, there ain't much in it, and any delay from
remarks is (heavily) swamped by other things.

You made your point very well.
No problem with REM. Case Closed.  ;D
IP logged

BC_Programmer
Mastermind


Thanked: 697
Posts: 15,881

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #23 on: January 18, 2009, 09:43:40 AM »

And Compiled languages don't compile remarks so comment away!  :P
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #24 on: January 18, 2009, 01:02:32 PM »

Code: [Select]
And Compiled languages don't compile remarks so comment away!
True. In some cases that may change the results.
Look at this:

Code: [Select]
echo on
REM In this operation we have %1 as the source and
REM item %2 will be the destination. This is subject to  the %3 option.
:: ...  more code
echo off

What happens if you compile that  ???
I have no idea. Never compiled a batch file!  :P
IP logged

macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #25 on: January 18, 2009, 04:53:51 PM »

the OP hasn't responded back....  ::)
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
BatchRocks
Topic Starter
Hopeful



Thanked: 3
Posts: 326




« Reply #26 on: January 18, 2009, 04:57:12 PM »

Hi thar? I don't know what you guys are talking about, so I was just watching.
IP logged
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #27 on: January 18, 2009, 05:22:03 PM »

OK. Now the question is :
What happens to the REM statements if you compile a Batch file?
The REM statements can echo different things, depends on the context.
The REM statements are parsed like anything else.
IP logged

BC_Programmer
Mastermind


Thanked: 697
Posts: 15,881

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #28 on: January 18, 2009, 06:15:33 PM »

OK. Now the question is :
What happens to the REM statements if you compile a Batch file?
The REM statements can echo different things, depends on the context.
The REM statements are parsed like anything else.


you cannot compile a batch file.

the so-called "compilers" simply plop a stub in front of a batch in a exe and call it good. The better ones compress the EXE afterwards. The REALLY good ones turn it into asm, but even then- they don't work with the extended syntax.
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
BatchFileCommand
Hopeful



Thanked: 1
Posts: 339




« Reply #29 on: January 19, 2009, 08:47:56 AM »

Code: [Select]
The REALLY good ones turn it into asm

Is that even more complicated then EXE  :D?!?
IP logged

οτη άβγαλτος μεταφ βαθμολογία
macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #30 on: January 19, 2009, 09:20:58 AM »

ASM is source code, machine code very very complex yet very very powerful its not an exeacuteable like EXE.
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
BatchFileCommand
Hopeful



Thanked: 1
Posts: 339




« Reply #31 on: January 19, 2009, 09:22:10 AM »

I need a batch to asm converter. (make it free if possible). I want to be able to send it to my friends so they can edit some of the code too ( yeah I use remarks  :P).
IP logged

οτη άβγαλτος μεταφ βαθμολογία
macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #32 on: January 19, 2009, 09:24:38 AM »

BFC,

Batch and ASM are completely different and there isnt any converter for this kinda stuff. read about ASM here
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
BatchFileCommand
Hopeful



Thanked: 1
Posts: 339




« Reply #33 on: January 19, 2009, 09:33:51 AM »

That would be cool if there was one. But yeah, it's complicated. But there are even more complicated.
IP logged

οτη άβγαλτος μεταφ βαθμολογία
Dias de verano
Guest
« Reply #34 on: January 19, 2009, 10:53:27 AM »

Code: [Select]
The REALLY good ones turn it into asm

Is that even more complicated then EXE  :D?!?

To you it would be, yes.
IP logged
BatchFileCommand
Hopeful



Thanked: 1
Posts: 339




« Reply #35 on: January 19, 2009, 12:24:48 PM »

Actually, I looked it up more. Pretty comparable  :P. Dias, you won't be able to go everywhere being the
"wise guy" you claim everybody else to be.
IP logged

οτη άβγαλτος μεταφ βαθμολογία
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #36 on: January 19, 2009, 01:27:19 PM »

When there is a great need, somebody will do it. If a compile of a batch file is really needed, it will be done. Somehow. But it is seldom done. Here is why.

In very complex operations the higher level of code is in a form the people can modify and use right away. The Edit, Compile, Link, Debug, Verify, Deploy and Revise business can take too long in a real-time process where a revision in the logic, settings or performance  has to bee done quickly.

IT administrators often use batch files, because batch files are quicker in the over-all process. It is not so much have many milliseconds it takes the batch to run. It is the time it takes to get it up and running from the point where a new task is needed until the user has in on her computer.
IP logged

macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #37 on: January 19, 2009, 03:03:24 PM »

Actually, I looked it up more. Pretty comparable  :P. Dias, you won't be able to go everywhere being the
"wise guy" you claim everybody else to be.

BFC,

your getting a bit to big for your britches; he's been here longer so he's more experienced than you.
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
Dias de verano
Guest
« Reply #38 on: January 19, 2009, 03:31:46 PM »

Everybody has a "batch to ASM converter". Here's a picture of one

IP logged
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,881

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #39 on: January 19, 2009, 07:07:06 PM »

I believe there was a Batch to ASM conversion program at some point- but it only worked with Pure DOS (no NT commands).


Actually, I looked it up more. Pretty comparable  :P.

what? an straight machine code executable comparable to Assembly? I suppose somebody could say that... until they realize that it's a bit more difficult to memorize and interpret the meaning of a set of hexadecimal bytes then it is to read a assembly display of those same set of bytes.



Everybody has a "batch to ASM converter". Here's a picture of one

<image>

Except some people are missing the ASM module completely.
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
BatchFileCommand
Hopeful



Thanked: 1
Posts: 339




« Reply #40 on: January 19, 2009, 07:38:45 PM »

Wait a minute, you people are doing all the work for me. You say that it's harder to convert batch to asm ( a much easier language then exe) But then you say that it's easier to convert batch to exe. There's no logic in that. When you say "experience", there are two and more meanings.
1. you're a smart-*censored* who knows everything
2. you're a real helpful person who knows everybody.
3. you're a lazy "thing" that has been in the forum for years and posts stuff like, cool, and i like that.
IP logged

οτη άβγαλτος μεταφ βαθμολογία
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,881

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #41 on: January 19, 2009, 07:48:48 PM »

Wait a minute, you people are doing all the work for me. You say that it's harder to convert batch to asm ( a much easier language then exe) But then you say that it's easier to convert batch to exe. There's no logic in that. When you say "experience", there are two and more meanings.
1. you're a smart-*censored* who knows everything
2. you're a real helpful person who knows everybody.
3. you're a lazy "thing" that has been in the forum for years and posts stuff like, cool, and i like that.

you obviously don't understand jack-*censored* about what we're saying.

It's easier to convert to EXE because one could create a Stub executable in C or C++ for example that loads batch code that is appended to the executable. the C program, upon being run, loads the batch code from the end of itself (argv[0], of course), saves it in a temporary file, shells the batch file, deletes the temporary file, and closes.

EXE is machine code. it translates DIRECTLY into assembly. That's why it's called "dissasembly" not "decompiling" to ASM source. The comments are gone, which are kind of important to understanding anything that is happening in a ASM program. Which ironically answers your topics question.

conversely- you don't "Compile" an ASM program but rather "assemble" it, which is a fairly simple task at a basic level- strip out comments and right out each ASM instruction as the directly corresponding piece of machine code. ASM is just a symbolic way of looking at the machine code.

This is why, with most "batch compiling" systems (which, as stated before simply prepend some cheap C program to the front of the batch code and call it a day) you can simply open the executable and copy the code- comments and all. More "sophisiticated" batch compiling programs try to further obfuscate the code by performing EXE compression on the resulting executable, appended batch code and all. Of course, this prepends ANOTHER executable to the front of the current one, meaning that the decompression routine needs to save a temporary file containing the original executable, which can be opened and the batch code once again copied out as if the compression algorithm wasn't there (and in fact it's quite transparent)
« Last Edit: January 19, 2009, 10:53:08 PM by BC_Programmer » IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
Geek-9pm
Sage



Thanked: 373
Posts: 8,930

Computer: Specs
Experience: Expert
OS: Windows XP


Geek After Dark

Geek 9pm blog
« Reply #42 on: January 19, 2009, 10:13:45 PM »

Quote
you obviously don't understand
jack- about what we're saying.

It would be easier if you could make it clear what you are saying.

Source code translators are available. But they are not used by the average person because they represent a huge amount of research for a taks that a small number of system designers need. Like mega bucks of code that has to be ported onto another system. Some of the major programs we have today stated out as translations of programs written for other CPUs and systems. Then there were later re written in better quality code. If the original code was in C, the process did not need much in the way of an automatic translation. Bur if the program was written in PL/1 or FORTRAN or COBOL, it could be a major job porting it to another platform.
Munch of the early work on small personal computers had to be done in Assembler because good C compiles were no available at first. In fact, they were very bad. A early language from Intel was called PL/M and was used to speed up the process and put some structure into our code. And you have to pay big bucks to get a copy.
Noways you can get free development tools from Microsoft for your favorite language. (Sorry, no Pascal.) Visual stdio versions of BASIC, C, C++ and J++ plus a Web Builder.

But a visual ASM? Foo! That is hard to do. You hive to use MASM32, which is a real pain. look here:
http://www.masm32.com/
IP logged

BC_Programmer
Mastermind


Thanked: 697
Posts: 15,881

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #43 on: January 19, 2009, 11:04:39 PM »

porting from one architecture to another is only vaguely related to the idea of converting from one language to another,but they definitely fall into the same domain.

batch, obviously presents a trouble spot since all the various constructs and possible switches and so forth will need to be handled properly; and even so you gain nothing but code obfuscation anyway, since any language it translates too will need to shell to dos to perform the commands such as FIND and MORE and so forth.


ASM is source code, machine code very very complex yet very very powerful its not an exeacuteable like EXE.


close ! :D

ASM is simply a symbolic form of machine code, and as such it would be foolish to voluntarily select machine code over ASM for programming- as it isn't any more powerful, and much harder to read or interpret; besides- in order to do anything with machine code, one must know (in a way) ASM.

As for the second part- not all Executables are machine code, but they almost always have some machine code to get started- for example, some Microsoft C compilers allow the source to be compiled to P-code. the program itself starts with machine code- and the only machine code present is the P-code interpreter. It was similar to the way Java does it, except the program contained the entire JVM for the platform.

IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
macdad-
Expert



Thanked: 39
Posts: 2,520


LoneWolf's Circuits
« Reply #44 on: January 20, 2009, 12:18:03 PM »

thats true...
ASM would be the more "brushed up" version of Machine code yet ASM is not interchangable with all computers since all computers dont have the same proccessor. which makes it easier to program in higher lvl languages, such as VB and C, they are independent from the proccessor and ASM which makes them interchangeable.
IP logged

If you dont know DOS, you dont know Windows...

Thats why Bill Gates created the Windows NT Family.
Pages: 1 2 3 [All] - (Top) Print 
Home / Microsoft / Microsoft DOS / What's the point of remarks? « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.202 seconds with 19 queries.