News:

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

Main Menu

Re: Beginner...Masm64 new install VIRUS ???? (not a virus)...Richard-001.asm

Started by jj2007, December 31, 2020, 10:34:45 PM

Previous topic - Next topic

Richard

Quote
This is what confuses me, the Win10 64 console CMD.EXE works just fine.

Not to complain (or anything) - the two exe's

FourX.exe (from jj2007)
Richard-001a.exe (from _japheth)

were also run in CMD LINE mode (Windows 10 x64 Build 20H2 Intel i7) and screen shot attached.

Previously were just run in Windows File Explorer

I appreciate that anything from as above is a DOS exe (as opposed to run of the mill WINDOWS exe) and so MAY require a different launch platform (other than Windows Explorer to actually run the exe) - this is all part of "my learning curve" (new things for me to appreciate).

I am restarting myself into pure MASM32 SDK - certainly I am INTERESTED in learning/using all the other "tangent" stuff already touched on by others here.

I did not realize that a simple task (to me) of putting X's onto a retro-style window would cause such a "hassle" - SORRY

EDIT I did also try msdos.exe the 486x64 version (from some Japanese ???) site but could not understand how to use

jj2007

To get your 4X code running, you need to use msdos.exe FourX.exe (i.e. your exe becomes a commandline argument for msdos.exe)

RichMasm does it via the OPT_Run msdos.exe FourX.exe at the end of the file, but you can do it from the DOS prompt, too.

In contrast, Japheth's exe is a totally different animal - a 64-bit DOS application. It will apparently not run in a standard configuration, but I admit I haven't fully understood what it needs to run.

Richard

@jj2007 + everyone else interested

Just when I was giving up (on all the "tangents") - refer attachement

At last something "works" - I hope no one is "offended".

EDIT as mentioned much earlier by jj2007 - the YELLOW X's do not flash (but it is a helpful start for me - must always use "msdos.exe my.exe")

jj2007

FourX as 32-bit code, flashing :tongue:

include \masm32\MasmBasic\MasmBasic.inc
  Init
  xor ebx, ebx
  .Repeat
xor ebx, 1
.if Zero?
ConsoleColor cRed
.else
ConsoleColor cBlue
.endif
Print At(0,0) "X"
Print At(20) "X"
Print At(0, 15) "X"
Print At(20) "X"
Delay 500
invoke GetKeyState, VK_SHIFT
test ah, ah
  .Until Sign? ; quit when Shift is pressed
EndOfCode

Richard

@jj2007

Thanks for include stuff which I added (refer attachment)...

Silly question - did F6 - see result on screen (see attachment) - where is the exe file???

The output is "much cleaner" (no prompt stuff) and the blinking cursor at row 25 column 80 (and as mentioned earlier by you YELLOW X not flashing).

The excitement (for me) continues...

jj2007


Richard

@jj2007

I still cannot find the exe refer attachment.

I did a complete C:\ search for    FourX-as  (to find FourX-as32bitcode(reply#53).asm)

only the .asm and .bak files found

NO .obj or .exe

Maybe my file rename (rather long) is causing problems??

jj2007

Do a search for FourX.exe or FourX*, not FourX.as

Since your program runs, there must be an exe...

Quote from: Richard on January 01, 2021, 09:30:22 PM
FourX-as32bitcode(reply#53).asm
...
Maybe my file rename (rather long) is causing problems??

Long file names are not a problem, but brackets are; maybe also the # character. Try renaming to FourX-as32bitcode_reply53_.asm

Try to use the *.asc version for your editing - it keeps all settings and formatting. Once a source gets bigger, this has major advantages. You can always export a plain text version with OPT_Tmp2Asm 1 (at the end of the source; see here for some details on options).

Also, if you want to run 16-bit code on a 64-bit OS, you need the OPT_Run \Masm32\bin\msdos.exe [name of project].exe (and you need to adjust it if the name changes). In the moment when you switch to 32-bit code, disable the option.

Richard

@jj2007

Because I added your include code I changed the name (FourX.asm) to

FourX-as32bitcode(reply#53).asm

so as not to confuse with FourX.asm.

listed below is FourX-as32bitcode(reply#53).asm which when F6 get output but no obj or exe file produced

Quote
; OPT_Res   0      ; RichMasm thinks this code needs no resources - delete if rsrc.rc is needed
name     Xy                   ; Richard-001.asm
   .model    small
   .stack  100
   .data
MSG DB 'X$'                   ; Message to print is "X"   $ terminated string    MSG DB "X$",0
   .code
start:   
   include \masm32\MasmBasic\MasmBasic.inc
  Init
  xor ebx, ebx
  .Repeat
   xor ebx, 1
   .if Zero?
      ConsoleColor cRed
   .else
      ConsoleColor cBlue
   .endif
   Print At(0,0) "X"
   Print At(20) "X"
   Print At(0, 15) "X"
   Print At(20) "X"
   Delay 500
   invoke GetKeyState, VK_SHIFT
   test ah, ah
  .Until Sign?      ; quit when Shift is pressed
EndOfCode
push  ds


                              ; put YELLOW flashing X at TLHC (Top Left Hand Corner)
mov ah,02h
mov bh,00h                    ; page number 0
mov dh,00h                    ; 00h is top row
mov dl,00h                    ; 00h is left column
int 10h                       ; VIDEO - set cursor position (FirstRow, FirstColumn)     
mov ah,09h
mov al,58h                    ; "X" char to display
mov bh,0                      ; page number
mov bl,8eh                    ; attribute e= 14. = YELLOW   8x = flashing
mov cx,01h                    ; number of times to write character
int 10h                       ; VIDEO - write character and attribute at cursor position       


                              ; put YELLOW flashing X at TRHC (Top Right Hand Corner)
push  ds
mov ax, 0b800h                ; need preceeding 0 else is name    ;mov ax,0xb800
push ax
pop ds
mov word ptr ds:[0+158],8e58h ; YELLOW flashing X TRHC (FirstRow, LastColumn)   ; ,0x0e58       

pop ds                        ; LastColumn(=79.)*2 since WORD (CharByte+AttributeByte)


                              ; put X (only WHITE) at BLHC (Bottom Left Hand Cormer)
mov ah,02h
mov bh,00h                    ; page number 0
mov dh,18h                    ; 00h is top row
mov dl,00h                    ; 00h is left column
int 10h                       ; VIDEO - set cursor position  (LastRow, FirstColumn)     
mov dl,58h                    ; X @ cursor
INT 21h                       ; DOS 1+ - write character to standard output


                              ; put X (only WHITE) AT ~BRHC (approx Bottom Right Hand Corner)
mov ah,02h
mov bh,00h                    ; page number 0
mov dh,18h                    ; 00h is top row
mov dl,79-1                   ; 00h is left column - cannot write to LastColumn (=79.) since CrLf
int 10h                       ; VIDEO - set cursor position (LastRow, LastColumn-1)
push ds       
mov ax,@DATA                  ; resolved by linker
mov ds, ax
lea dx, MSG
mov ah,09h                    ; DOS 1+ write string to standard output
int 21h                       ; DS:DX -> $ terminated string  return al = 24h the "$" terminating the string
pop ds


                              ;  SET CURSOR POSITION ~HALF-WAY UP SCREEN
mov ah,02h
mov bh,00h                    ; page number 0
mov dh,08h                    ; 00h is top row
mov dl,40h                    ; 00h is left column
int 10h                       ; VIDEO - set cursor position mid screen       

pop ds
MOV Ax,4C00H                  ; - terminate with return code
INT 21h                       ; EXIT     

retf

end start

RichMasm options:
OPT_Verbose      1   ; show files created
OPT_Run      \Masm32\bin\msdos.exe FourX.exe   ; download; use binary\i486_x64\msdos.exe
OPT_Tmp2Asm    1


jj2007

Quote from: Richard on January 01, 2021, 11:44:15 PM
@jj2007

Because I added your include code I changed the name (FourX.asm) to

FourX-as32bitcode(reply#53).asm

so as not to confuse with FourX.asm.

Richard,

Windows is pretty tolerant, but certain filename constructs should be avoided, as explained in Reply #57 above. Rename it to something without brackets, and it will work.

Btw a filename like C:\Masm32\MasmBasic\Res\временная папка\Добро пожаловать.asc (with spaces and Unicode) works just fine on my Italian OS. Not all editors allow that...

Richard

@jj2007

I must have missed before re filename constraints.

I edited FourX.asc  to have the include code - refer attachment for what happened


jj2007

You are mixing 16- and 32-bit code here, which is not possible. Delete the lines above include ..., then choose another name for MSG (an important Win32 structure), and it will work :thumbsup:


jj2007

Please save and zip the *.asc file and post it here. I must have a look at the source to understand what's going on...