Learning ASM

  • DNS Benchmark v2 is Finished and Available!
    Guest:
    That's right. It took an entire year, but the result far more accurate and feature laden than we originally planned. The world now has a universal, multi-protocol, super-accurate, DNS resolver performance-measuring tool. This major second version is not free. But the deal is, purchase it once for $9.95 and you own it — and it's entire future — without ever being asked to pay anything more. For an overview list of features and more, please see The DNS Benchmark page at GRC. If you decide to make it your own, thanks in advance. It's a piece of work I'm proud to offer for sale. And if you should have any questions, many of the people who have been using and testing it throughout the past year often hang out here.
    /Steve.
  • Be sure to checkout “Tips & Tricks”
    Dear Guest Visitor → Once you register and log-in please checkout the “Tips & Tricks” page for some very handy tips!

    /Steve.
  • BootAble – FreeDOS boot testing freeware

    To obtain direct, low-level access to a system's mass storage drives, SpinRite runs under a GRC-customized version of FreeDOS which has been modified to add compatibility with all file systems. In order to run SpinRite it must first be possible to boot FreeDOS.

    GRC's “BootAble” freeware allows anyone to easily create BIOS-bootable media in order to workout and confirm the details of getting a machine to boot FreeDOS through a BIOS. Once the means of doing that has been determined, the media created by SpinRite can be booted and run in the same way.

    The participants here, who have taken the time to share their knowledge and experience, their successes and some frustrations with booting their computers into FreeDOS, have created a valuable knowledgebase which will benefit everyone who follows.

    You may click on the image to the right to obtain your own copy of BootAble. Then use the knowledge and experience documented here to boot your computer(s) into FreeDOS. And please do not hesitate to ask questions – nowhere else can better answers be found.

    (You may permanently close this reminder with the 'X' in the upper right.)

I heard of this years ago and somewhat forgot about it. It looks like there is a cloud version now. I wonder if trying to design a CPU would help for understanding? I searched for CPU and it is like there is per-made CPUs designs. The is one problem however, I have started to use configurations that are not connected to the internet more and more. That means most of the software I buy needs to be able to run while not connected to the internet. I think this company has a version that will run on the OS, but I think it costs a lot. I am not sure if there is a version that is affordable and offline.


I guess a person has to almost waste time when time to learn these things because there is so much unknown.
 
If you want to focus on MASM style assembler there are good places on the internet for too!


I used the firefox extension "Down them all" to download all these samples from the MASM32 forums.
Am am thinking that some day I could study the code and maybe learn something.



With the growth of GitHub there are some things there too, I found these two users that have some stuff.
It would be nice if there were more on GitHub for assembler, studying others peoples code is a good way to learn I think.

I do know that someone on GitHub took the time to create the masm32 include files to program to the Windows API, this is something that sometimes assembler programmers have to do, converting from the C++ .h files I think. I could not file it quickly, so I am not sure of the address, but it is on there some place.

In fact, Steve has a download that might be helpful:


I downloaded that a few years time ago and studied some of it, if I remember correctly it has some of the marcos he talked about on the podcast, like the "free" macro are in there.
 
Ok, I have 80x86 Assembly Language and Computer Architecture, I disabled the DRM and I have speechify for the next year to read it to me. How could this possibly go wrong? If this works, I will do the same with the Irvine book and then maybe Jeff Duntemann's linux assembly book. It is easier to do Linux assembly now because of WSL anyhow.
 
Well I did this today to make it more easy and convenient to program in 16bit DOS ASM, setting up this stuff take a long time. If anyone has any question about how I did this, let me know. (the preview makes it look like I am playing doom, but that is not the what the video is about, I was just showing that FreeDOS has sound over remote desktop).

 
LLM moved me thought the learning curve faster than what would have happened otherwise. @Steve said something about being able to code assembler comfortably. I've got a few screen shots of his code and I decided to write the simplest and useful app I could think of and try to make it look like GRC code. I did use gemini to answer questions, but most of this code is not from gemini. But I have a problem, around line 125, when Windows will that the user clicked the button to start the count down timer, I need a way to the values entered into the EDIT controls for hours, minutes and seconds. Currently "GetWindowText" returns the UNICODE value, so if I enter "1", I would get 0x31 or 49, which is a unicode "1".

This is not the first time I have coded in ASM and needed some way to convert a character value to a binary value that my assembly code can treat as a integer. And that seems like something any assembler programmer should be able to do. I looked in the Irvine32 library and he does have a ParseInt function, but I am finding it a bit confusing.


 
I also made a Video to covering the debugging of masm code in visual studio vs windbg. I am trying to understand why windbg is so much easier. I would rather just stay in visual studio. If anyone has an useful ideas, feel free to make a video with your tooling you use to code in asm/masm. Thank you.

 
I also made a Video to covering the debugging of masm code in visual studio vs windbg. I am trying to understand why windbg is so much easier. I would rather just stay in visual studio. If anyone has an useful ideas, feel free to make a video with your tooling you use to code in asm/masm. Thank you.

Well adding:

__UNICODE__ equ 1

before my includes does make it use UNICODE, but then changing everything to unicode seems like it would be hard work, I wounder how people that use MASM32 alot would do it?
 
Well adding:

__UNICODE__ equ 1

before my includes does make it use UNICODE, but then changing everything to unicode seems like it would be hard work, I wounder how people that use MASM32 alot would do it?
Well by looking at the SIB source, it looks like that is using the ANSI versions, but that is from 1996, I am not sure if @Steve or most people would have moved over to UNICODE, but I have got to figure this out.
 
Well by looking at the SIB source, it looks like that is using the ANSI versions, but that is from 1996, I am not sure if @Steve or most people would have moved over to UNICODE, but I have got to figure this out.
ok, ok, there is a file c:\masm32\help\hlhelp.chm that tells how to do unicode support, but I just got that overwhelmed feeling so I need to clear my head. I do think the newest version of MASM32 supports unicode based on that help file.
 
So I was correct that hlhelp.chm (high level help, i think) is useful and it explains some concepts on macros and unicode. The following is written in that help help:

1746661631153.png


Also youtube recommend this video, which I found helpful:


and that video reminded me @Steve had a chatgpt expience that was helpful with strings and I believe that was episode 1004 if anyone is looking more insight on strings and macros.

Also, if you:

__UNICODE__ equ 1

before your include files in asm files and then you assemble at the command prompt you will get:
1746662021337.png


and guess what? If you DON'T you get:



1746662092972.png




So hopefully this is helpful information. This is weird for me, for a long time I felt like assembler was a bit to difficult to really use it for anything, but at this point my feelings are changing a bit. I had some problems using the "sval" macro which is meant to convert a string to interger and is part of MASM32 and is in the c:\masm32\macros\macros.asm file and that same file lets you create UNICODE strings like this:

1746662291407.png
 
If anyone is interrested I just figured out a way to see what the string contains in windbg, it is by casting to (char*) if ansi. It also looked like I could use the windbg .string command, but I could not get that to work. Here is a screen shot that I made using GRC TranscribeNumericalString function from one of @Steve code screen shots. You can see in the call stack that memory address of the string 00404000 and then you can see in the watch window the contains of that memory location "abc123..."

1747100723791.png
 
And then here you can see the results of @Steve's TranscribeNumericalString function, it removes the letters and symbols from a string and only leaves the number values.

1747101097764.png
 
Well, this video is a little better for debugging. It is using WinDBG. If I could get quality up, maybe I could make a tutorial series with a focus on debugging. This video is kinda long and I not sure if this is helping anyone. It is clear I need more practice; my understanding is not rock solid yet. Sometime the concepts do not come to mind quickly. I think I got the amount of bytes wrong when describing the EBP register and stack frames. It also seems like I miss spoke a few times. Code and video below.

https://gist.github.com/coffeeprogrammer/c7cf3f07ed34d471c1c38e160de0f4d4