News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Variable output

Started by Timofeyka, July 13, 2021, 10:42:32 PM

Previous topic - Next topic

Timofeyka

Hello.
I need help - I don't know how to print a variable through normal print, without masmBasic and kip irvines library. Who knows, tell me. :undecided:
http://easyprogramminglanguage.rf.gd/

jj2007

print str$(myvar), 13, 10

Timofeyka

http://easyprogramminglanguage.rf.gd/

Timofeyka

Quote from: jj2007 on July 13, 2021, 10:44:07 PM
print str$(myvar), 13, 10
My code with this is not working
  .686
  .model flat, stdcall
  option casemap :none
  include C:\masm32\include\masm32rt.inc
  .data
    s db "SS",0
  .code
  main:
    print str$(s)
  end main
http://easyprogramminglanguage.rf.gd/

jj2007

include \masm32\include\masm32rt.inc

.data
myvar dd 12345

.code
start:
  print str$(myvar), " is the value of myvar", 13, 10
  inkey "press any key"
  exit

end start


Quote from: jj2007 on July 09, 2021, 06:47:06 PM
- use include \Masm32\include\..., not C:\Masm32; many members use other drives

Timofeyka

Quote from: jj2007 on July 13, 2021, 10:50:24 PM
include \masm32\include\masm32rt.inc

.data
myvar dd 12345

.code
start:
  print str$(myvar), " is the value of myvar", 13, 10
  inkey "press any key"
  exit

end start


Quote from: jj2007 on July 09, 2021, 06:47:06 PM
- use include \Masm32\include\..., not C:\Masm32; many members use other drives

no errors, but no output
http://easyprogramminglanguage.rf.gd/

jj2007

- did you use "console assembly"?
- was an exe file created?
- did you see any error messages?

Timofeyka

Quote from: jj2007 on July 13, 2021, 10:56:27 PM
- did you use "console assembly"?
- was an exe file created?
- did you see any error messages?
1. Yes(Subsystem in Link).
2. Yes.
3. No.
I have now specially compiled and linked manually.
http://easyprogramminglanguage.rf.gd/

jj2007

How many bytes does your executable have?
What exactly do you see when you run the exe from a DOS prompt?

The only reason I could imagine that you don't see anything would be an AV that silently blocks the exe.

Timofeyka

Quote from: jj2007 on July 13, 2021, 11:28:00 PM
How many bytes does your executable have?
What exactly do you see when you run the exe from a DOS prompt?

The only reason I could imagine that you don't see anything would be an AV that silently blocks the exe.
The size is 2.50 kilobytes. I run the file from the console, half a second passes, and the program closes.
http://easyprogramminglanguage.rf.gd/

jj2007

Size is ok. Mysterious - please zip the exe and attach it to a post here.

Timofeyka

http://easyprogramminglanguage.rf.gd/

jj2007

Thanks. You are victim of a very old MASM bug:
Address   Hex dump          Command                                  Comments
00401000  /$  68 03304000   push offset 00403003
00401005  |.  6A 00         push 0                                   ; /Arg2 = 0
00401007  |.  A0 00304000   mov al, [403000]                         ; |ASCII "SS"
0040100C  |.  66:0FB6C0     movzx ax, al                             ; |
00401010  |.  66:50         push ax                                  ; |Arg1<<<<<<<<<<<<<< BUG <<<
00401012  |.  E8 19000000   call 00401030                            ; \main.00401030


Use UAsm.

hutch--

You may need to add that you don't normally PUSH a 16 bit register in 32 bit as an argument. He probably needs UASM where MASM requires correct code.

jj2007

Hutch,

This is the code that I proposed, and that he apparently used. No idea where the push ax comes from :cool:

include \masm32\include\masm32rt.inc

.data
myvar dd 12345

.code
start:
  print str$(myvar), " is the value of myvar", 13, 10
  inkey "press any key"
  exit

end start