News:

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

Main Menu

Beginner...Masm64 new install Richard-001.asm

Started by Richard, December 27, 2020, 12:29:45 PM

Previous topic - Next topic

TimoVJL

May the source be with you

Richard

@TimoVL

Thanks for info.

Just in case I will need same - will search for dll file (first will try in my Visual Studio Folder).

When I do source the file - EXACTLY where do I place it in my MASM32 folder?

TimoVJL

Hutch can explain a directory structure for you.
Just use a private folder for source code, as it will be easier for making backups.
May the source be with you

hutch--

Richard,

If you need that DLL, put it in the bin64 directory.

Richard

This reply is just for reference (will be constantly edited with updates) on my adding all necessary files. The zip file is a screenshot summarizing changes etc.  If something goes wrong, eg incorrect file version used, this might be a useful way for someone to check my system.

Notation used for the empty folders...

first line full path on my computer where I sourced files for inclusion into masm32 folder
present... the already exisiting files (with size in bytes)
Q... major relative size difference compared to hutch-- dir list
replacing... exisiting (6) files showing the original file sizes
xxx... not sure yet


This reply will be edited without notice  mainly by addition of date labeled zip files

morgot

Sorry for the bad English

TimoVJL

#21
14.28.29333
tbbmalloc.dll
vcruntime140_1.dll
msvcp140_atomic_wait.dll


http://masm32.com/board/index.php?topic=8119.msg89111#msg89111
May the source be with you

TouEnMasm


Tested on my computer adwcleaner.
It has stopped the false alert to virus on this forum and other locations.
He is free,test it and report which results go with it.

Fa is a musical note to play with CL

Richard

(have not finished adding files as mentioned above...)

Background - my assembly experience is limited to 8086 only (not 80186+) using MASM 5.1 (16 bit). Because of various problems with DOSbox (which is only written as an emulator for Games) - I am (trying to) converting to present day assembly and giving MASM64 SDK a try (rather than 32). I appreciate that programming 64 bit can be "messy" and is "not for the faint hearted". I am very slowly going through all the 64 bit examples I can find to try out and learn from. Initially also I will try to convert my 16 bit code into hopefully working 64 bit code and my first program is Richard-001.asm included here.

Help with Richard-001.asm (too many errors) would be appreciated. Screen shot from DOSbox and errors (MASM64 SDK) attached in zip file. Note the screenshot (DOSbox) did not capture the flashing Yellow X's but they were visible when running DOSbox.

Eventually I will also try to write the code with newer style layout (eg console boxes) but for now I would like the classic DOS screen look.




;  Richard-001.asm
;
;  This program puts YELLOW flashing X in TOP ROW CORNERS and WHITE X in BOTTOM ROW CORNERS
;  works with DOSbox + MASM 5.1(16 bit)
   
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:   
   
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)   ;0],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




Note that the target computer is INTEL i7 processor x64 only.


EDIT 2020dec30   INTEL i7 processor x64 Windows 10 latest build 20H2
EDIT 2020dec31   changed code to Courier Bold Size=15pt (gives monospaced display)
EDIT 2020dec31   removed "[" in commented line of TRHC... (I don't know why this effect with "[")    ZIP file NOT EDITED
EDIT 2020dec31   NOT MENTIONED ANYWHERE - program assumes 25 row 80 column text screen (classic DOS style text screen)



jj2007

Assembles and works mostly fine on my Win7-64 machine. The X is yellow but doesn't flash :sad:
One minor typo: the line with 0x0e58 must move up behind the comment.

Richard

@jj2007

Could you send me the exe file etc and screenshot you successfully generated. I would especially like to try the .exe file in windows 10.

Thanks

EDIT just looked at FourX.zip BUT Windows 10 says for FourX.exe...


This App cannot run on your PC.

EDIT When attempted to launch FourX.exe from Windows 10 x64 (build 20H2) File Explorer


hutch--

Hi Richard,

Its been a while since I saw genuine 16 bit real mode code. Humour is I started MASM with version 6.0 that was structured differently from 5.1 and while I have seen notation for the older versions, I never used them. I never try to discourage anyone but the jump from 16 bit real mode code to 64 bit protected mode code may be a bit too much in one go, 32 bit MASM code is reasonably straight forward and is no slouch performance wise.

Once you get a feel for 32 bit protected mode programming and the Windows API functions, 64 bit Windows code is another large jump as it has different internal architecture and it very intolerant to the slightest errors. Its great stuff once you get the swing of it and the range of what it can do is impressive but ML64 has the characteristic of "Biting the hand that feeds it" for the tiniest error. On the bright side, it will certainly improve your coding style.

Richard

@hutch--

Thanks for comments.

I was "pre-warned" but since I am on a "learning curve" whether it be 64 bit or 32 bit - I may as well take on the challenge of 64. I will also learn 32 bit - to this end I did a "fresh install" of MASM32 SDK but on a G:\ drive (MASM64 SDK is on C:\ drive) as I cannot seem to have both 32 and 64 on the C:\ drive (maybe I did something wrong in this respect).

Yes - I will simultaneously now do Richard-001.asm in 32 bit (as well as 64 bit) - and dual-mode (32/64) from now on for future programs. It would be nice if (eventually) everything of mine (assembly) that sort-of works in DOSbox + MASM 5.1(16bit) is ported to 64 bit (as well as 32 bit).

I don't know if I did something wrong but so far I have not got a version (32 or 64 bit) of Richard-001.exe that works on my Windows 10 x64 (Intel i7 Processor) Build 20H2. the exe file from jj2007 (FourX.exe) does not work for me (ERROR MESSAGE - This App cannot run on your computer - when trying to launch FourX.exe from Windows 10 x64 Build 20H2 File Explorer). Can someone enlighten me on this. I would appreciate a copy of the exe file that forum members produce for Richard-001.asm (for both 32 bit and 64 bit).

Challenge to everyone (no prizes rewarded) - produce an exe code of ALL or ANY PART(s) (eg only say one X routine) of Richard-001.asm and supply the exe with attached notes on what (if anything) was needed to be done to make it work - this will assist me greatly in my learning curve 32/64

In a "nut-shell" initially with my old 16 bit code - using 64 (as well as 32) is like using a "sledge hammer to hit a pin into a pin-cushion" (a bit of a overkill), but it may be the best way for me to go in learning the SDK. Certainly I am studying any examples of all code supplied on the forum and supplied with SDK installs (a very large collection).

PS I am still getting the "hang of it" re presentation aspects of replies for this forum. Just a few minutes ago I "discovered how to display as "monospace"" (I hate proportional space for code)

Ps I still have not finished adding all needed/recommended files for MASM64 .

jj2007

Quote from: Richard on December 31, 2020, 11:11:30 AMthe exe file from jj2007 (FourX.exe) does not work for me (ERROR MESSAGE - This App cannot run on your computer - when trying to launch FourX.exe from Windows 10 x64 Build 20H2 File Explorer). Can someone enlighten me on this.

Your source and my exe are 16-bit code. It will not run directly on x64 Windows versions. If you open the *.asc file I posted with RichMasm, you will see at the end the secret that makes it assemble and run:

OPT_Run \Masm32\bin\msdos.exe FourX.exe         ; download; use binary\i486_x64\msdos.exe

Since you seem to like BASIC: With a MasmBasic installation, you get a little extra: \Masm32\MasmBasic\Res\HelloWorld16.asc is a template with a number of BASIC macros as 16-bit Assembly. However, this is history - you should go for 32-bit Assembly. If you were a young programmer in his twenties, or a seasoned 32-bit assembly expert who must earn a living with coding, then I would recommend 64-bit Assembly, too.