News:

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

Main Menu

Variable output

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

Previous topic - Next topic

Vortex

Hi Timo,

Here is another example :

include     \masm32\include\masm32rt.inc

.data

var         dd  100
string      db 'var = %u',13,10,0

.code

start:

    invoke  crt_printf,ADDR string,var

    invoke  ExitProcess,0

END start

Timofeyka

Quote from: jj2007 on July 13, 2021, 11:55:33 PM
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.
There are other options? I need only MASM
http://easyprogramminglanguage.rf.gd/

Timofeyka

Quote from: Vortex on July 14, 2021, 02:13:45 AM
Hi Timo,

Here is another example :

include     \masm32\include\masm32rt.inc

.data

var         dd  100
string      db 'var = %u',13,10,0

.code

start:

    invoke  crt_printf,ADDR string,var

    invoke  ExitProcess,0

END start

I need only MASM/WinAPI functions, no C
http://easyprogramminglanguage.rf.gd/

jj2007

Quote from: Timofeyka on July 14, 2021, 04:13:39 AM
Quote
Use UAsm.
There are other options? I need only MASM

Actually, the code that I posted above, and that you claim to have used, assembles fine with MASM. Save your source code, then assemble it, zip both the source and the exe and post it here.

Timofeyka

Quote from: jj2007 on July 14, 2021, 04:21:03 AM
Quote from: Timofeyka on July 14, 2021, 04:13:39 AMUse UAsm.
There are other options? I need only MASM

Actually, the code that I posted above, and that you claim to have used, assembles fine with MASM. Save your source code, then assemble it, zip both the source and the exe and post it here.
[/quote]
http://easyprogramminglanguage.rf.gd/

jj2007

  .data
    sd db "SS",0


So you did not use the code I posted. Please don't waste members' time with such games.

Timofeyka

Quote from: jj2007 on July 14, 2021, 04:25:45 AM
  .data
    sd db "SS",0


So you did not use the code I posted. Please don't waste members' time with such games.
Sorry, I thought it wouldn't affect the code, thanks everyone for the answers
http://easyprogramminglanguage.rf.gd/

Timofeyka

Quote from: jj2007 on July 14, 2021, 04:25:45 AM
  .data
    sd db "SS",0


So you did not use the code I posted. Please don't waste members' time with such games.
Sorry, but it only displays a numerical value
http://easyprogramminglanguage.rf.gd/

jj2007

Quote from: Timofeyka on July 14, 2021, 04:29:53 AM
Quote from: jj2007 on July 14, 2021, 04:25:45 AM
  .data
    sd db "SS",0


So you did not use the code I posted. Please don't waste members' time with such games.
Sorry, I thought it wouldn't affect the code, thanks everyone for the answers

Every single character affects the code. There is a huge difference between
myvar dd 12345 ; my code: a numeric DWORD variable, ok for str$()
sd db "SS",0 ; a string variable, nonsense for str$()

Timofeyka

Quote from: jj2007 on July 14, 2021, 04:33:36 AM
Quote from: Timofeyka on July 14, 2021, 04:29:53 AM
Quote from: jj2007 on July 14, 2021, 04:25:45 AM
  .data
    sd db "SS",0


So you did not use the code I posted. Please don't waste members' time with such games.
Sorry, I thought it wouldn't affect the code, thanks everyone for the answers
Every single character affects the code. There is a huge difference between
myvar dd 12345 ; my code: a DWORD variable, ok for str$()
sd db "SS",0 ; a string variable, nonsense for str$()

I tried to make a variable with
myvar dd "Hi",0
http://easyprogramminglanguage.rf.gd/

Timofeyka

Quote from: Timofeyka on July 14, 2021, 04:35:05 AM
Quote from: jj2007 on July 14, 2021, 04:33:36 AM
Quote from: Timofeyka on July 14, 2021, 04:29:53 AM
Quote from: jj2007 on July 14, 2021, 04:25:45 AM
  .data
    sd db "SS",0


So you did not use the code I posted. Please don't waste members' time with such games.
Sorry, I thought it wouldn't affect the code, thanks everyone for the answers
Every single character affects the code. There is a huge difference between
myvar dd 12345 ; my code: a DWORD variable, ok for str$()
sd db "SS",0 ; a string variable, nonsense for str$()

I tried to make a variable with
myvar dd "Hi",0
If I don't use str$ is don't output anything
http://easyprogramminglanguage.rf.gd/

jj2007

Quote from: Timofeyka on July 14, 2021, 04:35:05 AMI tried to make a variable with
myvar dd "Hi",0

Great. Trial and error is what you need as a programmer. Did you succeed? If yes, do you understand why it prints 18537? What about reading a book about numbers and all that stuff?

Timofeyka

Quote from: jj2007 on July 14, 2021, 04:39:38 AM
Quote from: Timofeyka on July 14, 2021, 04:35:05 AMI tried to make a variable with
myvar dd "Hi",0

Great. Trial and error is what you need as a programmer. Did you succeed? If yes, do you understand why it prints 18537? What about reading a book about numbers and all that stuff?
Sorry, I just work with assembler only to create a mini-OS for i386, but I'm not very familiar with newer processors, and I can ask stupid questions
http://easyprogramminglanguage.rf.gd/

jj2007

Quote from: Timofeyka on July 14, 2021, 04:43:05 AMI just work with assembler only to create a mini-OS for i386

You made my day :mrgreen:

Timofeyka

Quote from: jj2007 on July 14, 2021, 04:45:23 AM
Quote from: Timofeyka on July 14, 2021, 04:43:05 AMI just work with assembler only to create a mini-OS for i386

You made my day :mrgreen:
str $ is only intended for converting to a string, but without it nothing is output - at the same time, Uasm / JWasm and C functions do not suit me, is there any other option?
http://easyprogramminglanguage.rf.gd/