Recent Posts

Pages: [1] 2 3 ... 10
1
The Soap Box / Re: A really good looking salt water crocodile.
« Last post by HSE on Today at 10:11:40 PM »
Impresive.   :t

How close you was?
2
The Workshop / Re: Introduction + Silly Question :)
« Last post by hutch-- on Today at 09:23:45 PM »
Depends on how much typing you want to do, push/call notation works fine but its a bit cluttery with large amounts of API and similar HLL code. This is where "invoke" notation does the job better and makes your code more readable. The real action in 32 bit and later assembler is in writing algorithms and here pure mnemonic code is the way to go.
3
The Workshop / Re: Introduction + Silly Question :)
« Last post by jj2007 on Today at 09:22:52 PM »
Don't listen to him Rob, some of us don't need our hands held  :biggrin:

That's true! As a rule, if your IQ is well above 140 and your code never exceeds, say, a thousand lines, you can comfortably push your paras without the invoke macro. I've done the pushpushpop thing myself when I started assembler programming.
4
The Workshop / Re: Introduction + Silly Question :)
« Last post by sinsi on Today at 08:20:22 PM »
Regarding the use of invoke.....I still feel dirty using it , lol. I'm a bit of a purist :)
As a purist, if you code in C, do you still use the original Kernighan & Ritchie compiler?
Don't listen to him Rob, some of us don't need our hands held  :biggrin:
5
The Workshop / Re: Introduction + Silly Question :)
« Last post by jj2007 on Today at 07:38:07 PM »
I would have posted the total code but its already around 300 lines. Too much for a forum post ?

No problem, you have 32k if I remember well. If it's more, zip the source and attach it. The limit is 524,288 bytes then.

Regarding the use of invoke.....I still feel dirty using it , lol. I'm a bit of a purist :)

As a purist, if you code in C, do you still use the original Kernighan & Ritchie compiler?
6
The Workshop / Re: Introduction + Silly Question :)
« Last post by Rob260z on Today at 07:00:28 PM »
In future I'll create self-contained , executable code before posting up any example code. This way I would have actually realised what the problem was.
7
The Workshop / Re: Introduction + Silly Question :)
« Last post by Rob260z on Today at 06:49:32 PM »
Hi jj2007 :)

Thank you for your time , very much appreciated.

Sorry , but I appear to have wasted it ( your time ). I was just typing a new comment when you replied.

I'm very embarrassed , but I forgot to put a RET instruction at the end of the procedure **** hangs head in shame ****

I would have posted the total code but its already around 300 lines. Too much for a forum post ?

Regarding the use of invoke.....I still feel dirty using it , lol. I'm a bit of a purist :)
8
The Workshop / Re: Introduction + Silly Question :)
« Last post by jj2007 on Today at 06:42:35 PM »
Hi Robert,
First things first: Welcome to the Forum :icon14:

Your code works fine. It took me ten minutes of my precious time, though, to set up the missing headers, insert the variables etc - be prepared that this is the last time that I help you unless you decide to post complete code with detailed comments in future.

Code: [Select]
include \masm32\include\masm32rt.inc ; obligatory in this forum, for practical reasons!

.data
Str_DataLogText db "..........",13,10
Var_DataLogBytesWritten dd ?
Hdl_DataLogFile dd ?
.code
start:
mov EBX , offset Str_DataLogText
   inc EBX          ;??????????????????????????????????????????????
   mov EDX , 49d
   mov byte ptr [ EBX ] , DL
mov Hdl_DataLogFile, fopen("tmp.txt")
        push 0
        push offset Var_DataLogBytesWritten
        push 12d
       push offset Str_DataLogText
       push Hdl_DataLogFile
       call WriteFile

       fclose Hdl_DataLogFile
  exit

end start

You should also get used to the invoke macro. The old habit of pushing parameters around is error-prone, especially if a function needs a dozen parameters, like e.g. CreateWindowEx.

So your code crashes. Weird, mine doesn't  8)

It could remain forever a mystery, but there is a solution: In case of little programs that crash, it is a good habit to zip the exe and attach it here, so that we can launch Olly and analyse the problem. For example, without a crystal ball we won't know which parameters you used for the unknown API call that you used to open the file.
9
The Workshop / Introduction + Silly Question :)
« Last post by Rob260z on Today at 06:18:35 PM »
Hi All :)

Well , in order to prove I'm not a bot, I thought I should introduce myself. My name is Robert and I have returned to Assembly programming after nearly 15 years. Looking for a bit of an intellectual challenge , plus I absolutely love the pure nature of Assembly.

Last time I did any programming I was using Boralnd Turbo Assembler. After a bit of a look around I have decided to settle on MASM.


Well , I'm going to start with a simple question. What am I doing wrong in the example below. I know I'm going to kick myself when I get the answer , but it's got me stumped. This approach works fine in NASM , but I obviously don't understand exactly how MASM pointers/referencing/stack works. Despite finding examples that appear to do the same thing.

A simple test function. I'm writing the modified string to a text file using WIN32 WriteFile. The issue appears to be the use of the INC instruction. With or without the INC instruction successfully writes to the file , but with the INC instruction the program crashes immediately after writing the file ( succsessfully ). Am I somehow corrupting the stack ?

        Str_DataLogText db "..........",13,10

     mov EBX , offset Str_DataLogText
   inc EBX          ;??????????????????????????????????????????????
   mov EDX , 49d
   mov byte ptr [ EBX ] , DL

        push 0
        push offset Var_DataLogBytesWritten
        push 12d
       push offset Str_DataLogText
       push Hdl_DataLogFile
       call WriteFile

     

      cheers ,
      Rob
10
The Soap Box / A really good looking salt water crocodile.
« Last post by hutch-- on Today at 04:33:47 PM »
These guys are so friendly they will eat anyone with prejudice at all.

Pages: [1] 2 3 ... 10