Search code examples
assemblymasmirvine32

MASM32 error when I use call DumpRegs


So I have looked around the site and have not found a solution to my problem. I tried adding the following lines that was the answer for someone else's question but it did not work for me.

includelib C:\full\path\to\Kernel32.Lib
includelib C:\full\path\to\User32.Lib
includelib C:\full\path\to\Irvine32.lib

; include C:\full\path\to\Irvine32.inc

Here is my entire code.

includelib C:\Irvine\Irvine32.inc
includelib C:\Irvine\Kernel32.Lib
includelib C:\Irvine\User32.Lib
includelib C:\Irvine\Irvine32.lib

.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword



.data
    num BYTE 126d
    num2 SBYTE -26d
    num3 WORD   692Ah
    num4 SWORD -32789
    num5 DWORD 12345678h
    num6 SDWORD -2147483648

.code
main proc
    mov al, num
    call DumpRegs   ; I get the error when I put this in.

    mov ah, num2
    mov cx, num3
    mov dx, num4
    mov eax, num5
    mov ebx, num6


    invoke ExitProcess,0
main endp
end main

And here is the output that I get.

1>------ Build started: Project: Project, Configuration: Debug Win32 ------ 1> Assembling ..\ch03\AddTwo.asm... 1>..\ch03\AddTwo.asm(25): error A2006: undefined symbol : dumpRegs 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\masm.targets(50,5): error MSB3721: The command "ml.exe /c /nologo /Sg /WX /Zi /Fo"Debug\AddTwo.obj" /Fl"Project.lst" /I "c:\Irvine" /W3 /errorReport:prompt /Ta..\ch03\AddTwo.asm" exited with code 1. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Solution

  • My professor told me to delete some of the code so this is what I am left with

    TITLE Add and Subtract          (AddSub.asm)
    
    ; This program adds and subtracts 32-bit integers.
    
    INCLUDE Irvine32.inc
    
    .data
        num BYTE 126d
        num2 SBYTE -26d
        num3 WORD   692Ah
        num4 SWORD -32789
        num5 DWORD 12345678h
        num6 SDWORD -2147483648
    
    .code
    main PROC
    
        mov al, num
        call DumpRegs
    
        mov ah, num2
        mov cx, num3
        mov dx, num4
        mov eax, num5
        mov ebx, num6
    
        exit
    main ENDP
    END main
    

    and my code works.

    He told me not to use

    .386
    .model flat,stdcall
    .stack 4096
    ExitProcess proto,dwExitCode:dword
    

    at the beginning of our programs. or the

    invoke ExitProcess,0
    

    at the end.