News:

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

Main Menu

Build Problems

Started by oex, June 27, 2015, 10:13:24 AM

Previous topic - Next topic

oex

Hey guys, it's been so long since I used MASM.

grrr too long, but making some headway again ::)

dedndave

hiya Peter - long time no see   :P

oex

Very slowly getting back into MASM....

The below is building ok but not running ok, not sure why? It has occassionally accepted input as shown which suggests to me a memory issue but memory doesnt serve me well on the first day back on MASM in over 4 years  :dazzled:

.586
.MMX
.K3D
.XMM

    .model  flat, stdcall
    option  casemap:none

    include   \masm32\include\windows.inc

    include \masm32\macros\macros.asm

x MACRO FuncName:REQ,args:VARARG
     arg equ <invoke FuncName> ;; construct invoke and function name
     FOR var,<args> ;; loop through all arguments
          arg CATSTR arg,<,reparg(var)> ;; replace quotes and append arg
     ENDM
     arg ;; write the invoke macro
ENDM

    xR MACRO FuncName:REQ,args:VARARG
      arg equ <x FuncName>         ;; construct invoke and function name
      FOR var,<args>                    ;; loop through all arguments
        arg CATSTR arg,<,reparg(var)>   ;; replace quotes and append arg
      ENDM
      arg                               ;; write the invoke macro
   EXITM <eax>
    ENDM

    uselib wsock32,user32,kernel32,gdi32,msvcrt,opengl32,glu32,winmm,shell32,Shlwapi,masm32

.const

.data

    CommandLine      dd   0
    hInstance      dd   0

.code

YN PROC   USES esi   String:DWORD

   x SetConsoleTitle, chr$("? Select")

TryAgain:

   print String

   mov esi, input("(Y/N): ")

   x SetConsoleTitle, chr$("Select")

   cmp BYTE PTR [esi], 'Y'
   jz Yes
   cmp BYTE PTR [esi], 'y'
   jz Yes

   cmp BYTE PTR [esi], 'N'
   jz No
   cmp BYTE PTR [esi], 'n'
   jz No

   jmp TryAgain

No:
   cmp BYTE PTR [esi], 'Y'

   mov eax, -1

   ret

Yes:

   mov eax, 0

   ret

YN ENDP

; --------------- Procedures Declarations
MainInit      PROTO   :DWORD,:DWORD,:DWORD,:DWORD

; --------------- Program start
start:

    mov hInstance, xR(GetModuleHandle,NULL)
    mov CommandLine, xR(GetCommandLine)
    x MainInit,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
    invoke ExitProcess,1

; --------------- Program main inits
MainInit       PROC   USES esi edi hInst:DWORD,hPrevInst:DWORD,CmdLine:DWORD,CmdShow:DWORD

    mov eax, input("Enter number here ",62," ")

        print chr$("Hello")

   ;x SetConsoleTitle, chr$("cvdskjidjuifj")

   ;x YN, chr$("Hello")

   ret

MainInit       ENDP

end start

hutch--

Peter,

Just make sure your build environment is working correctly first. Just see if you can build the examples. If so then its OK and you can see what is wrong with the app.

oex

Building win examples fine, have a working console example from the past that I wrote (which wont build now but that could be for any number of reasons, this was a fresh MASM install....

Is there a packaged console example with text input?

Will stop bugging you with stupid questions (I hope) once I can input/output to debug again  :biggrin:

Zen

#5
Hi, PETER,
Your code compiles, but doesn't really do anything.

oex

    mov eax, input("Enter number here ",62," ")

        print chr$("Hello")

Isn't it meant to call for input and when entered print "Hello"?

It just falls through and quits for me

jj2007

Quote from: oex on June 28, 2015, 10:35:58 AMIt just falls through and quits for me

Hi Peter,
most IDEs are not intelligent enough to realise that the user might want to see the output of a console app. Use inkey "hello world", or run the exe from a separate console window.

oex

It is running from a separate command prompt window, also tried inkey but still failed

jj2007

Strange. I get this with your original, non-modified code:0

Enter number here > 123
Hello


It works. Do you get any error messages when building this? Which editor or IDE are you using? Command line options?

oex

Quote from: jj2007 on June 28, 2015, 06:30:11 PM
Strange. I get this with your original, non-modified code:0

Enter number here > 123
Hello


It works. Do you get any error messages when building this? Which editor or IDE are you using? Command line options?

It's the default QEditor Script I believe

?.qsc maybe when you click 'Build All'

Absolutely no build errors


Microsoft (R) Windows (R) Resource Compiler, Version 5.00.1823.1 - Build 1823
Copyright (C) Microsoft Corp. 1985-1998. All rights reserved.

Using codepage 936 as default
Creating rsrc.RES
RC: RCPP -CP 936 -f E:\masm32\x\RCa03464 -g E:\masm32\x\RDa03464 -DRC_INVOKED -D
_WIN32 -pc\:/ -E -I. -I .

rsrc.rc.
Writing ICON:1, lang:0x409,     size 744
Writing GROUP_ICON:100, lang:0x409,     size 20.
Writing 24:1,   lang:0x409,     size 369
Microsoft (R) Windows Resource To Object Converter Version 5.00.1736.1
Copyright (C) Microsoft Corp. 1992-1997. All rights reserved.

Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: E:\masm32\x\X1.asm

***********
ASCII build
***********

Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

驱动器 E 中的卷没有标签。
卷的序列号是 0004-17DE

E:\masm32\x 的目录

2015/06/28  16:14             2,053 X1.asm
2015/06/28  20:49             4,608 X1.exe
2015/06/28  20:49             1,995 X1.obj
               3 个文件          8,656 字节
               0 个目录 194,047,303,680 可用字节
请按任意键继续. . .

Script continues to run (process in task manager) even though it falls through on the commandline

e:\masm32\x>x1

e:\masm32\x>x1

e:\masm32\x>

jj2007

Peter,

Sometimes resource file and console mode are incompatible. Try building without resources.

oex

Turns out I'm a complete idiot, didnt select 'Console Build All' Just 'Build All'....

All working now, ty all, so much I have just forgotten :/

jj2007

Quote from: oex on June 29, 2015, 02:49:16 AMTurns out I'm a complete idiot, didnt select 'Console Build All' Just 'Build All'....

Don't worry, most IDEs have no subsystem autodetect... not your fault ;-)

Zen

Quote from: PETER...Turns out I'm a complete idiot,...
We have something in common,...I do stuff like that all the time,...:bgrin: