News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Hey, this actually doesn't work.

Started by $nooc, February 09, 2008, 11:13:21 PM

Previous topic - Next topic

$nooc

after i set up MASM32 correctly my first step was to try if i can compile this sample: http://www.masm32.com/board/index.php?topic=257.0

but i get this error:

Quote
RC: fatal error RC1110: could not open rsrc.rc!

CVTRES: fatal error CVT1101: cannot open rsrc.res for reading

sry, i don't have any idea whats wrong..

GregL

$nooc,

Looks like you're trying to compile a resource file that doesn't exist. I assume you are using the MASM32 Editor. Select Project and then Console Assemble & Link from the menu.


$nooc

ok that works, but how can i check if my code is correct and doesn't has any mistakes for example syntax errors..

or another question:
does anyone know a link where the syntax of assembler is explained? because i don't even know how to call a function like getchar()
-> my program closes right after it appears on the screen..

i am an absolute beginner and it's quiet hard for me to learn that stuff in english.. so i really could need a page or something where everything is good explained for someone that doesn't know anything about assembler ^^

GregL

$nooc,

Glad to hear it's working.

Forum Links and Website (at the top of this page). There is a lot of stuff there, under "Technical Reference" get the "Intel Manuals", also "Iczelion's Tutorials" for a Windows tutorial.

Something I didn't see listed there is the MASM Programmer's Guide.

Also, some free chapters of a pretty good (although expensive) book. I recommend you start with these.



$nooc

thank you Greg!

i'll check those links as soon as i got home :)

god bless the internet   :cheekygreen:


thank you for your help!


edit:

one question (thats maybe a stupid one):
i red the first lines of chapter one of the book you advised me to. it says that it uses MASM 8.0 but i have the MASM 10.0 beta..
does this matter?

GregL

$nooc,

Quotedoes this matter?

No, there isn't anything he is doing in that book that MASM 6.14 can't handle. He's just using what was the latest and greatest at that time, it's not necessarily better. If you want to strictly follow along with his examples and use his libraries then you will need to download Visual Studio 2005 and MASM 8.0. MASM 8.0 can be downloaded here. I think you can get a lot out of the book without doing that though. Just adapt what he's doing to your own code and MASM32.

Quoteit says that it uses MASM 8.0 but i have the MASM 10.0 beta..

You mean you have MASM32 10.0 Beta. There is a difference between MASM32 and MASM. MASM32 is a package that includes MASM 6.14 along with include files, libraries, macros, tutorials and documentation. MASM is the Microsoft Macro Assembler itself (ML.EXE).







$nooc

hi guys!

i had to do a lot for school and so i didn't tried to learn assembler for that time.. bur now i got some ^^


maybe someone can answer me that questions:

when i compile the program that's listet below an error occurs..

R1110: file rsrc.rc could not be found..

i don't really know what that .rc file is and why my program need this file.. i don't even know 'where' the assembler is looking for that file..

but although.. the program seems to be executable.. the console appears and disappears the same second ( i know that's normal ^^)

at first i thought i should know how to call a function in assembler..

so i added the line:

invoke Beep,750,300

but nothing happens..
msdn says Bepp() requires Kernel32.dll.

i included that like this:

include \masm32\include\kernel32.inc

and i didn't forget the definitions:

includelib \masm32\lib\kernel32.lib

so why it doesnt make a sound?

$nooc


MichaelW

The R1110 error is from the resource compiler, and since it ran without a resource definition file present it must have been invoked (if you are using Quick Editor you would do this by selecting Compile Resource File on the Project menu). The code for a complete application that uses the Beep function is here. Again, if you are using Quick Editor you could build the EXE by pasting the source into the edit window, then save the source by selecting Save on the File menu, or by clicking the Save button on the toolbar, then select Console Assemble & Link from the Projects menu. Assuming the assemble and link succeeded (it should), you could then use the Run command on the Project menu to run it.
eschew obfuscation

$nooc

well.. the program from the link (http://www.masm32.com/board/index.php?topic=4311.msg32253#msg32253) works, but if i try to call Beep in the other code:


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

;                 Build this with the "Project" menu using
;                       "Console Assemble and Link"

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    .486                                    ; create 32 bit code
    .model flat, stdcall                    ; 32 bit memory model
    option casemap :none                    ; case sensitive

    include \masm32\include\windows.inc     ; always first
    include \masm32\macros\macros.asm       ; MASM support macros

  ; -----------------------------------------------------------------
  ; include files that have MASM format prototypes for function calls
  ; -----------------------------------------------------------------
    include \masm32\include\masm32.inc
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc

  ; ------------------------------------------------
  ; Library files that have definitions for function
  ; exports and tested reliable prebuilt code.
  ; ------------------------------------------------
    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib

    .code                       ; Tell MASM where the code starts

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

start:                          ; The CODE entry point to the program

   
    print chr$("Hey, this actually works1",13,10)
    print chr$("Hey, this actually words2",13,10)
    invoke Beep, 750,300
   
    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start                       ; Tell MASM where the program ends



i only get a syntax error...

Vortex

Masm assembles the code above without any problem. What is the error message you receive?

$nooc

oh it was my fault! masm didn't save it!

if i save the code i always use CTRL+S but it seems like this doesn't always work..

masm assembles it and my speaker says: beeeep ^^

thank you !

but i have still some questions:

why is there no "invoke" in front of print?
what does the chr$ makro do? it is a makro, isn't it?

Vortex

print is a macro defined in macros.asm :

    print MACRO arg1:REQ,varname:VARARG      ;; display zero terminated string
        invoke StdOut,reparg(arg1)
      IFNB <varname>
        invoke StdOut,chr$(varname)
      ENDIF
    ENDM


chr$ is another macro defining NULL terminated strings in the data section :


chr$ MACRO any_text:VARARG
        LOCAL txtname
        .data
          txtname db any_text,0
        .code
        EXITM <OFFSET txtname>
      ENDM

MichaelW

Here is a version that uses only API functions:

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .data
      hStdOut   dd 0
      byteCount dd 0
      msg1      db "Hey, this actually does work!",13,10,13,10,0
      msg2      db "Press Enter to exit...",0
      buffer    db 0,0
    .code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    invoke GetStdHandle,STD_OUTPUT_HANDLE
    mov hStdOut, eax
    invoke WriteFile,hStdOut,ADDR msg1,SIZEOF msg1 - 1,ADDR byteCount,NULL
    invoke Beep,750,300
    invoke Sleep,200
    invoke Beep,750,300
    invoke WriteFile,hStdOut,ADDR msg2,SIZEOF msg2 - 1,ADDR byteCount,NULL
    invoke GetStdHandle,STD_INPUT_HANDLE
    invoke ReadFile,eax,ADDR buffer,1,ADDR byteCount,NULL
    invoke ExitProcess,0
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start


eschew obfuscation

Adamanteus

Here is a version of another name of macro :

TextAddr  MACRO any_text:VARARG
    EXITM chr$ (any_text)
ENDM