• Re: beginner assembler for windows?

    From paul@nospam@nospicedham.nospam.invalid to comp.lang.asm.x86 on Wed Jan 20 14:04:01 2021
    From Newsgroup: comp.lang.asm.x86

    Herbert Kleebauer wrote:

    If you think a simple tutorial can teach you assembly programing,
    then maybe are misunderstanding something. There are 3 parts of
    assembly programming:

    I wasn't clear in my opening post if I said I wanted to "learn" assembly language programming.

    Just as a person can hike an existing trail that someone else dug out and
    put all the steps and bridges and maps in place years before, I just want to "walk the trail" of an existing assembly language programming tutorial.

    If I had wanted to build my own trail, cutting steps in the snow, attaching belay lines across the Hillary Step, staking down ladders across the Khombu Icefall, designing my own oxygen cylinder breathing apparatus, designing my
    own insulating clothing, testing out the chemicals for the rubber soles of
    my boots, designing my own shoe laces, etc., I would have started with my existing books by Peter Norton & Jeff Duntemann on Assembly Language Programming, step by step.

    I don't want to build the trail - I just want to follow the existing trail.

    I'm not Lewis & Clark, where I have to build my own bridges and dig out my
    own canoes just to figure out what's at the end of a river, where if I don't portage across the waterfall, I'm dead (that's no fun).

    I apologize that I wasn't clear in the opening post because I was under an illusion that there existed an assembly language tutorial (much like the Android Studio tutorial that exists) which simply walks you though the
    steps, so that in an hour or two, you've already got a half dozen programs working.

    It's fun to follow a trail that someone else already built, but if I have to chop down a tree to build my own canoe just to get across to the other side
    of the river, then it's no fun anymore.

    When I get to the other side of the river, I will find that there is no
    trail, and worse, all there is on the other side is a never ending swamp of
    bog after bog, which is "no fun".

    Fun is a trail to get you to the river, and then a bridge to get across the river, and then on the other side, someone put down duckboard to get across
    the swamp, where they already knew the shortest way through the swamp to get
    to the flowers that are growing at the piedmont.

    Fun is an assembly language tutorial to get you across the river of
    installing and assembling your first program, and then across the swamp of a few examples, so that in an hour or two, you already have a half dozen
    assembly language programs working.

    After that, if you still want to step off into the peat bog, if you think that's fun, you can do it - knowing that you can back up if you step into quicksand, and you'll be back on the working duckboards.

    Back to the original need, I will endeavor to find a tutorial that works on
    the most common computer platform in the world, using whatever assembler
    that tutorial suggests.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Tavis Ormandy@taviso@nospicedham.gmail.com to comp.lang.asm.x86 on Wed Jan 20 15:38:24 2021
    From Newsgroup: comp.lang.asm.x86

    On 2021-01-20, paul <nospam@nospicedham.nospam.invalid> wrote:
    Which, seems odd to me that a boolean operation that always returns FALSE would be the result, but hey, I didn't write the code explorer - I'm just testing it (someone is going to have to explain that one to me!). :)

    To make different pieces of code work together, all the code has to
    follow certain rules - called calling conventions. You don't *have* to
    follow those rules, but it means your code will work well with others.

    One of those conventions is to put the return code (the result) in the
    eax register. So in this case, that's just letting other code know
    everything was okay.

    Which returns, surprise!
    main:
    xor eax, eax
    ret

    There is no "compilation error", but it says "Compiler returned: 0",
    which, I guess, maybe, perhaps, I dunno, is that an error or did it work?

    It worked, but compilers are smart - it knew that you didn't use the
    result of the computation, and so it didn't matter if it did it or not.
    That means it can generate a program that does exactly the same thing
    but *faster* by not doing it at all.

    There are a ton of these you'll notice, some are really confusing when
    you first run into them. I think I was fascinated by that, understanding
    things like strength reduction (that's where the compiler replaces
    expensive operations like multiplication with equivalent cheaper ones
    like shifts and adds) - but if you think you'll be frustrated by it,
    maybe this won't work.

    It's what everyone would want who is a noob who just wants a working set of examples (aka a tutorial) on the most common computer platform there ever was.

    I don't know if there is a good answer. If you want to skip the
    introductory classes, you can't complain that you have to work harder to
    catch up :)

    Tavis.
    --
    _o) $ lynx lock.cmpxchg8b.com
    /\\ _o) _o) $ finger taviso@sdf.org
    _\_V _( ) _( ) @taviso

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Kerr-Mudd,John@notsaying@nospicedham.127.0.0.1 to comp.lang.asm.x86 on Wed Jan 20 16:01:21 2021
    From Newsgroup: comp.lang.asm.x86

    On Wed, 20 Jan 2021 13:04:01 GMT, paul
    <nospam@nospicedham.nospam.invalid> wrote:
    []

    Back to the original need, I will endeavor to find a tutorial that
    works on the most common computer platform in the world, using
    whatever assembler that tutorial suggests.


    Sorry we couldn't help; x86 is ancient technology that requires a lot of effort to get into. I doubt there's much impetus to create a slick modern streamlined tutorial.
    --
    Bah, and indeed, Humbug.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Herbert Kleebauer@klee@nospicedham.unibwm.de to comp.lang.asm.x86 on Wed Jan 20 17:03:47 2021
    From Newsgroup: comp.lang.asm.x86

    On 20.01.2021 14:04, paul wrote:

    Just as a person can hike an existing trail that someone else dug out and
    put all the steps and bridges and maps in place years before, I just want to "walk the trail" of an existing assembly language programming tutorial.

    I suppose, you are joking. It's like asking for a tutorial to write
    a German novel, but refusing to first learn the German language. You
    don't need instructions how to put an empty sheet of paper into the
    typewriter and how to transfer letters to the paper as long as you
    don't understand the language you want to use for your novel. But
    if you refuse to learn German, you can write the novel in English and
    use Google to translate it to German.

    So, start to read the few thousands pages of documentation I gave you.
    And once you have understood them, you can start to read the additional
    10 pages how to use the assembler to generate a binary from your source
    code. But if you refuse to learn the assembly language and the OS interface, you can write your code in any HLL and use an automatic translator to
    convert it to assembly code (called compiler). But that has nothing
    to do with assembly programming.

    An other way to start assembly programming would be to not use an
    x86 CPU and Windows 64 but a simple micro-controller with no
    OS at all (like AVR). The instruction set is much simpler and there
    is no OS interface to understand, so you can start programming after
    a few hours reading the processor manual. And in this case you will
    also find the sort of tutorial you want.






    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From =?UTF-8?Q?Pavel_vitsoft_=C5=A0ruba=C5=99?=@pavel.srubar@nospicedham.gmail.com to comp.lang.asm.x86 on Wed Jan 20 14:16:01 2021
    From Newsgroup: comp.lang.asm.x86

    On Wednesday, January 20, 2021 at 2:13:32 PM UTC+1, paul wrote:
    Just as a person can hike an existing trail that someone else dug out and put all the steps and bridges and maps in place years before, I just want to "walk the trail" of an existing assembly language programming tutorial.
    re4ASM with its macrolibraries might be the right "trail" for you.
    Download and unzip "euroasm.zip",
    copy "Hello world" source text from the yellow box at https://euroassembler.eu/eadoc/#HelloWorld
    paste it to "hello.asm",
    assemble and link with "euroasm hello.asm"
    and try to run "Hello32.exe" and "Hello64.exe".
    When it works, feel free to extend the source with instructions retrieved from tutorials enumerated at
    https://euroassembler.eu/eadoc/links.htm#Tutorials
    vitsoft
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Rod Pemberton@nomailings@nospicedham.trgzxcqvbe.cpm to comp.lang.asm.x86 on Thu Jan 21 02:16:19 2021
    From Newsgroup: comp.lang.asm.x86

    On Wed, 20 Jan 2021 14:04:01 +0100
    paul <nospam@nospicedham.nospam.invalid> wrote:

    Just as a person can hike an existing trail that someone else dug out
    and put all the steps and bridges and maps in place years before, I
    just want to "walk the trail" of an existing assembly language
    programming tutorial.


    So, you want a tutorial for which you can view the executing
    x86 instructions via a debugger or disassembler or interpreter?

    The really old way of doing this was to get some binary code and
    disassemble it, looking up each instruction in the programmer's
    reference manual, and mentally following along with what the code was
    doing.

    The next really old way of doing this was to get some binary code and
    step through it in a debugger, dumping the registers as you went, while
    looking up each instruction in the programmer's reference manual, and
    mentally following along with what the code was doing.

    I don't recall if there is any modern, in-browser, online website for
    x86 code which does something like either of those. Travis pointed you
    to Mr. Godbolt's emulator.

    You might want to run some emulator, like DOSBox or MAME/MESS or QEMU
    or Bochs or one of numerous others, depending on what computer and
    operating system you use, to boot up a 16-bit DOS machine, e.g.,
    FreeDOS. Then, experiment with DOS .com's, use DEBUG the debugger and disassembler for DOS, and some assembler such as MASM or perhaps NASM.
    NASM also comes with a disassembler.

    https://www.freedos.org/
    https://www.nasm.us/

    https://www.dosbox.com/
    https://www.mamedev.org/
    http://bochs.sourceforge.net/
    https://www.qemu.org/
    --

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Rod Pemberton@nomailings@nospicedham.trgzxcqvbe.cpm to comp.lang.asm.x86 on Thu Jan 21 02:16:27 2021
    From Newsgroup: comp.lang.asm.x86

    On Wed, 20 Jan 2021 13:47:47 +0100
    paul <nospam@nospicedham.nospam.invalid> wrote:

    When I asked the question originally, I had no idea it would be this
    hard.

    I figured it would be like any freshman level physics lab.
    1. You check out the equipment (e.g., a capacitance tester)
    2. You grab a ziplock bag of pre-prepared capacitors of various types
    3. You measure their capacitance, and write up a report

    Notice that the lab is designed to work.
    The student simply follows the steps.
    The learning is in watching it work.


    This is a return to the 8-bit microprocessors of the 1980's. You're
    jumping in after decades of microprocessor development.

    It's a bit more like learning calculus. There are centuries of
    knowledge which came before you got to class. You get to start at the
    very beginning. Lucky you.

    The reason I dropped the comp sci curriculum was syntax, where every
    language does the same damn thing using completely different syntax.

    Just use C. TIOBE's index shows that it has been at the top of the
    programming language usage charts for decades. (I have to apologize to
    wolfgang every time I say that.) Although, C is a huge time suck to
    learn as well, but it'll be around - or it's many derivatives which
    dominate the TIOBE index - for a while at least.

    https://www.tiobe.com/tiobe-index/

    For example, Fortran's trenchant yet precise syntax resulted in a
    terse "Error 50", which you had to look up in a book in the computer
    room locked down to a table with half the pages missing.

    FORTRAN was a horrible language.

    On the
    opposite side of the spectrum, COBOL was downright loquacious, with
    bombastic divisions and gabby data types.

    I never programmed in COBOL but have seen it IRL. Very verbose.

    Somewhere in between was
    PL/1 but my point is they all do the same damn thing, but with
    completely different syntax.

    I programmed in the Stratus VOS variant of PL/1, but it was more like
    souped up Pascal with the power of C and some weird structs. I saw
    IBM's mainframe PL/I code once, and it seemed very different and block structured from what I saw.

    I swore I'd never learn another programming language in the early
    seventies, and I stuck to my word,

    1970's? Which language did you decide was your last to learn? E.g.,

    BASIC
    Pascal
    Fortran
    Cobol
    Lisp
    C
    Logo
    Snobol
    PL/I

    and even now, I don't want to learn assembly language just like I
    don't want to learn how to design a microprocessor.

    I don't think anyone has /wanted/ to design a microprocessor since Byte magazine of the 1980's.

    Did you once learn any 8-bit assembly, e.g., 6502 or Z80?

    If so, the early 8086 instructions are similar in terms of
    functionality. That's a starting point for you. Get an early 8086
    manual.

    http://bitsavers.trailing-edge.com/ http://bitsavers.trailing-edge.com/components/intel/8086/

    It's the layering of x86 instructions over the decades of the numerous additional more advanced instruction sets, operating system
    instructions, numerous operating modes, and mode specific instructions,
    that will cause plenty of mental grief.

    If you want to check out the complexity of x86, try getting lost on
    this website:

    https://www.sandpile.org/

    I don't want to write my own assembly language programs.
    I just want to watch it happen which is why I seek a tutorial.

    There are some in browser emulators around. I don't recall if any
    works for x86 code.

    In my not too distant past, I had, like everyone did, all the SAMS
    books,

    Not too distant past? Dude, SAMS was late 1980's and early 1990's,
    roughly 3 decades ago. Did you just come out of a coma? ;-)
    --

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From wolfgang kern@nowhere@nospicedham.never.at to comp.lang.asm.x86 on Thu Jan 21 11:12:24 2021
    From Newsgroup: comp.lang.asm.x86

    On 20.01.2021 13:47, paul wrote:
    ...
    I just want to learn about assembly language by running a simple tutorial.

    windoze is NOT simple. In terms of easy programming it is the WORST.

    I'm a low level programmer and know x86 instructions very well, but ASM
    tools are all different therefore I've gone the pure metal hex-way.
    And once (1999) I needed to learn about windoze in general because a
    paying client asked for such.

    similar to your problem I had no idea where to start and how to get info
    about available M$-functions.

    I found RosAsm (for 32bit windoze) and a lot of tutorials within it.
    With some help of alt.asm and clax I figured the basics of it.

    So after a few weeks I could sell my very first (also my last) win-app.
    Not sure if the RosAsm forum is still active. just check on it.

    Nasm is merely used by Loonix coders, Fasm(Fasmw) is fine for windoze.
    Masm is M$-crap (you already figured that)
    Masm32 is/was? an attempt to replace Masm.
    __
    wolfgang

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From wolfgang kern@nowhere@nospicedham.never.at to comp.lang.asm.x86 on Thu Jan 21 11:24:48 2021
    From Newsgroup: comp.lang.asm.x86

    On 20.01.2021 17:01, Kerr-Mudd,John wrote:
    On Wed, 20 Jan 2021 13:04:01 GMT, paul
    []
    Back to the original need, I will endeavor to find a tutorial that
    works on the most common computer platform in the world, using
    whatever assembler that tutorial suggests.

    Sorry we couldn't help; x86 is ancient technology that requires a lot of effort to get into. I doubt there's much impetus to create a slick modern streamlined tutorial.

    The Basics weren't much to tell. Bernhard could do a few lines on it :)
    I still have the twelve lessons from good old RosAsm. most lines
    describe just the different syntax, but beside this it explains a lot
    how win32 work at all. Even windoze10 is 64bit but it must support
    32-bit programs as well.
    __
    wolfgang

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Kerr-Mudd,John@notsaying@nospicedham.127.0.0.1 to comp.lang.asm.x86 on Thu Jan 21 12:54:49 2021
    From Newsgroup: comp.lang.asm.x86

    On Thu, 21 Jan 2021 10:12:24 GMT, wolfgang kern
    <nowhere@nospicedham.never.at> wrote:

    On 20.01.2021 13:47, paul wrote:
    ...
    I just want to learn about assembly language by running a simple
    tutorial.

    windoze is NOT simple. In terms of easy programming it is the WORST.

    I'm a low level programmer and know x86 instructions very well, but
    ASM tools are all different therefore I've gone the pure metal
    hex-way. And once (1999) I needed to learn about windoze in general
    because a paying client asked for such.

    similar to your problem I had no idea where to start and how to get
    info about available M$-functions.

    I found RosAsm (for 32bit windoze) and a lot of tutorials within it.
    With some help of alt.asm and clax I figured the basics of it.

    So after a few weeks I could sell my very first (also my last)
    win-app. Not sure if the RosAsm forum is still active. just check on
    it.

    Nasm is merely used by Loonix coders, Fasm(Fasmw) is fine for windoze.
    Masm is M$-crap (you already figured that)
    Masm32 is/was? an attempt to replace Masm.
    __
    wolfgang


    I use nasm for DOS programs, but I've never graduated to an IDE, just an
    edit, asm, debug cycle
    --
    Bah, and indeed, Humbug.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Bernhard Schornak@schornak@nospicedham.web.de to comp.lang.asm.x86 on Thu Jan 21 19:06:43 2021
    From Newsgroup: comp.lang.asm.x86

    wolfgang kern wrote:


    The Basics weren't much to tell. Bernhard could do a few lines on it :)


    I doubt "paul" is interested in learning AT&T syntax. If I understood
    his posts right, he tries to execute 16 bit DOS low level calls in 64
    bit windoze. Never will work without an extender (DOSEMU), because 64
    bit windoze denies execution of 16 bit programs - no way to get a DOS tutorial's examples running on modern hardware.

    Nevertheless, my libraries can be found here:

    https://drive.google.com/file/d/0B1OgMlxNnSNEVnJNeTNSeEM1bTQ/view?usp=sharing

    There is a (incomplete) HTML-Documentation for the functions and some
    tutorials about basics of my programming system. (The 7z archive also
    includes full source code of working programs using my libraries, all
    written in 100% assembler.)


    Pfnat'Di!

    Greetings from Augsburg

    Bernhard Schornak

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From George Neuner@gneuner2@nospicedham.comcast.net to comp.lang.asm.x86 on Thu Jan 21 14:39:48 2021
    From Newsgroup: comp.lang.asm.x86

    On Thu, 21 Jan 2021 11:12:24 +0100, wolfgang kern <nowhere@nospicedham.never.at> wrote:

    On 20.01.2021 13:47, paul wrote:
    ...
    I just want to learn about assembly language by running a simple tutorial.

    windoze is NOT simple. In terms of easy programming it is the WORST.

    Programming any GUI is complicated: working with X[*] on Unix/Linux is
    not easier (and can be much harder, depending) than working with GDI
    on Windows.

    For command line programming, Unix/Linux and Windows use different
    APIs, but the complexity of just using OS calls is roughly equivalent.

    YMMV,
    George

    [*] typically using high(er) level Qt or GTK libraries - very few
    people stoop to using the raw X API nowadays.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From George Neuner@gneuner2@nospicedham.comcast.net to comp.lang.asm.x86 on Thu Jan 21 14:57:00 2021
    From Newsgroup: comp.lang.asm.x86

    On Wed, 20 Jan 2021 09:41:17 +0100, "R.Wieser" <address@nospicedham.not.available> wrote:

    Paul,

    I press the Windows key & the "r" key, and then I type "cmd"
    and then I press the "enter" key. Whatever CLI that happens to
    be called, is what I want the program I assemble to work inside of.

    The problem is that you can run true (16-bit) DOS programs[1] (using INT 21h >and whatnot) as well as CLI (Command Line Interface - Windows Console) >programs (using the full gamut of Windows DLLs) in there.

    [1] Caveat emptor: I'm using Win XP myself. I have no idea if still works >under Win10.

    Win10 does not natively run 16-bit software.

    There *was* an XP subsystem - separate from the "compatibility"
    settings - available for Win7 Professional (or higher). It still
    works on Win10 ... but most people who could have installed it on Win7
    never did, and it won't install on Win10 - the only way to have it is
    via in-place upgrade of Win7 to Win10.

    Best to set up a VM and run an older version of Windows (or DOS).

    George

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Bogus@Bogus@Embarq.com (Steve) to comp.lang.asm.x86 on Sat Jan 23 12:32:20 2021
    From Newsgroup: comp.lang.asm.x86

    paul <nospam@nospicedham.nospam.invalid> writes:

    All I'm asking for is a working noob tutorial, with an assembler, on the
    most common desktop platform on the planet.

    Hi paul,

    Have you looked at the MASM32 forum?

    http://www.masm32.com/board/index.php?

    One of the subforums is

    Mikl__'s ml64 examples

    which has a 64-bit Windows tutorial/


    And the The MASM32 SDK is available at

    http://masm32.com/

    which has a old version of MASM to install and
    has 32-bit Windows examples. A full install gives
    you quite a lot of MASM code examples.

    Regards,

    Steve N.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Kerr-Mudd,John@notsaying@nospicedham.127.0.0.1 to comp.lang.asm.x86 on Sat Jan 23 13:07:10 2021
    From Newsgroup: comp.lang.asm.x86

    On Sat, 23 Jan 2021 07:24:16 GMT, paul
    <nospam@nospicedham.nospam.invalid> wrote:

    Rod Pemberton wrote:

    This is a return to the 8-bit microprocessors of the 1980's.

    Yes. (IMHO)

    All I'm asking for is a working noob tutorial, with an assembler, on
    the most common desktop platform on the planet.

    []

    All I want is a working noob tutorial with a working freeware
    assembler (on the most common home desktop computing platform on the
    planet).

    I don't think you can have it; all existing asm tutorials are historic
    and will, generally, use DOS on an IBM PC in real mode. No 64 bit
    (probably not 32bit), no Windows (especially 7/10).

    If you truly want to do this (rather than repeatedly ask for the
    unavailable) then you'll have to install a DOS emulator, install the
    tutorial of choice, learn x86 asm, move up to 32 bit then do some windows calls, look at 64 bit, and *then* you can put together asm code for
    Windows 10.

    I think this has been said before, so I'll stop now.
    --
    Bah, and indeed, Humbug.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Rod Pemberton@nomailings@nospicedham.trgzxcqvbe.cpm to comp.lang.asm.x86 on Sun Jan 24 02:07:13 2021
    From Newsgroup: comp.lang.asm.x86

    On Sat, 23 Jan 2021 08:24:16 +0100
    paul <nospam@nospicedham.nospam.invalid> wrote:

    Rod Pemberton wrote:

    This is a return to the 8-bit microprocessors of the 1980's.

    Yes. (IMHO)

    All I'm asking for is a working noob tutorial, with an assembler, on
    the most common desktop platform on the planet.


    Unfortunately, it almost appears that assembly, not just for x86,
    almost isn't being taught anymore.

    After a bunch of different Google searches, I'm not sure if there is
    anything that will meet all your requirements in a single complete lab tutorial. There is plenty of stuff online though.

    Youtube (videos)
    https://www.youtube.com/results?search_query=x86+assembly

    Google (pdf)
    https://www.google.com/search?&q=x86+assembly+pdf https://www.google.com/search?&q=university+x86+assembly+pdf

    NASM tutorial (text) https://www.tutorialspoint.com/assembly_programming/index.htm

    x86 tutorials, calling the host OS (text/image) https://cs.lmu.edu/~ray/notes/x86assembly/

    Hackr.io's assembly tutorials (free & paid) https://hackr.io/tutorials/learn-assembly-language

    Udemy's Assembly language courses (paid) https://www.udemy.com/topic/assembly-language/

    MIT OpenCourseWare "Intro to Assembly Language" (video) https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2017/c10/c10s2/intro-to-assembly-language-8-13-/

    x86-64 Assembly Language Programming with Ubuntu (pdf) http://www.egr.unlv.edu/~ed/x86.html

    There are lots of other course websites, some 50+ besides Udemy, like
    Coursera & edX, including another dozen or so that specialize in
    programming courses. That doesn't include free Computer Science courses
    online at major universities. For the most part, I don't see any
    assembly courses. These sites seem to focus on high-level programming
    languages used by Silicon Valley software tech companies, and
    certifications.
    --

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From George Neuner@gneuner2@nospicedham.comcast.net to comp.lang.asm.x86 on Sun Jan 24 10:40:31 2021
    From Newsgroup: comp.lang.asm.x86

    On Sat, 23 Jan 2021 08:24:16 +0100, paul
    <nospam@nospicedham.nospam.invalid> wrote:

    Rod Pemberton wrote:

    This is a return to the 8-bit microprocessors of the 1980's.

    Yes. (IMHO)

    All I'm asking for is a working noob tutorial, with an assembler, on the
    most common desktop platform on the planet.

    You're jumping in after decades of microprocessor development.

    No. (IMHO).

    The reason for the yes and for the no is...
    Nothing has actually changed even when everything seems to have changed.

    The problem is that a noob can't sensibly write anything in assembler
    for a modern 64-bit chip. Whether or not you care to admit it, LOTS
    of things have changed since the old days. You say you learned IBM
    assembler (700? 360?) ... if you remember any of it that is a good
    start, but a modern x86 has a vastly larger instruction set. https://stefanheule.com/blog/how-many-x86-64-instructions-are-there-anyway/

    You really do need to start with something simpler and work up. There
    are plenty of good guides for 8086 assembler. Set up a virtual
    machine running DOS or an old version of Windows[*] and learn on that.
    Once you get reasonably good at 8086, then tackle 80386.


    [*] XP or earlier (at least 32-bit versions) will run 16-bit code, and
    much of what you learn about using the Windows API will carry forward.
    Argument widths have changed and new functions have been introduced,
    but nearly all of the functions that were available in Windows 3 circa
    1990 are still in Windows 10 today.



    Nothing has really changed even when everything seems to have changed.

    Wrong. The biggest change is that modern operating systems require
    programs be run in protected mode. Moreover, as x86 moved from 16 to
    32 to 64 bit, certain architecture changes have forced newer programs
    to be structured differently.



    All I'm asking for... is the lab.
    Labs always work.
    In a well-designed lab, the learning is in watching it work.

    What school did you go to? Labs always have been about screwing up
    and discovering why you DIDN'T get the right result. If you were
    lucky you got to repeat the labs until you finally did them correctly.



    1970's? Which language did you decide was your last to learn? E.g.,

    (a) BASIC <== I wrote plenty in the early days of "home computers"
    (b) Pascal <== never touched the stuff
    (c) Fortran <== of course - every engineer learned Fortran
    (d) Cobol <== why I took COBOL then still astounds me today
    (e) Lisp <== no but many interpreted software interfaces are similar
    (f) C <== no but we used to have to run Makefiles more often then than now >(g) Logo <== never even heard of it
    (h) Snobol <== no, thank God
    (i) PL/I <== yes, of course - but we called it PL/1 (Pea El One)
    (j) Assembly Language <== everyone learned the IBM Assembly language
    (k) Shell scripting <== didn't we all learn c-shell & tsh

    So, except for the one assembler, you only learned relatively high
    level languages. Some C would have been helpful.


    I used to love Forest Mims' simplicity of TTL code where everybody had the >yellow Texas Instruments books next to the blue National Semiconductor books >for digital and analog chips of the early days of ICs.

    Then your head will explode when you look at x86-64 and the prospect
    of interfacing with any modern operating system.


    George

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From anton@anton@nospicedham.mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.asm.x86 on Sun Jan 24 16:39:12 2021
    From Newsgroup: comp.lang.asm.x86

    George Neuner <gneuner2@nospicedham.comcast.net> writes:
    The problem is that a noob can't sensibly write anything in assembler
    for a modern 64-bit chip.

    I teach about 70 noobs every year to write something in assembler for
    a modern 64-bit chip, so I obviously disagree.

    Whether or not you care to admit it, LOTS
    of things have changed since the old days. You say you learned IBM
    assembler (700? 360?) ... if you remember any of it that is a good
    start, but a modern x86 has a vastly larger instruction set.

    So what? You don't need to know every instruction to sensibly write
    something in assembler. And I expect that nearly all of these
    instructions also work in 16-bit mode; conversely, if you want to
    pretend that the 64-bit CPU you use is only an 8086, you can just as
    well pretend that this CPU has no 80387, no MMX, no SSE, no AVX and
    later extensions, and you end up with a similar number of instructions
    as the 8086, and probably fewer that you really want to use (on the
    8086 you wanted to use instructions like XLAT and LODS, you normally
    don't on a modern CPU).

    You really do need to start with something simpler and work up. There
    are plenty of good guides for 8086 assembler. Set up a virtual
    machine running DOS or an old version of Windows[*] and learn on that.
    Once you get reasonably good at 8086, then tackle 80386.

    I don't think that's a good approach. If you can write a program for
    a task for the 8086, it's easier and better to write it for IA-32 or
    AMD64 (the 32-bit and 64-bit descendant architectures; the 8086 is
    quite different from them, while they are relatively similar to each
    other), and you don't need more different instructions for it, rather
    on the contrary, see above.

    There may be fewer good guides; but using a search engine ("assembler
    guide"), I find on the first page two IA-32 guides, one AMD64 guide,
    some for other architectures, none for 8086. When looking for AMD64
    guides, note that this architecture is also known as x86-64, x86_64,
    x64, and Intel 64.

    - anton
    --
    M. Anton Ertl Some things have to be seen to be believed anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen http://www.complang.tuwien.ac.at/anton/home.html

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From paul@nospam@nospicedham.nospam.invalid to comp.lang.asm.x86 on Mon Jan 25 06:06:12 2021
    From Newsgroup: comp.lang.asm.x86

    Anton Ertl wrote:

    I teach about 70 noobs every year to write something in assembler for
    a modern 64-bit chip, so I obviously disagree.

    At some point, rather soon, I'm going to have to give up on asking and just start following _somebody's_ tutorial on my X64 Windows 10 desktop.

    Given that, what do you think of this "Understanding Windows x64 Assembly? https://sonictk.github.io/asm_tutorial/

    And, what do you think of these Windows x64 assembly language guides? https://sonictk.github.io/asm_tutorial/#additionalresources

    There may be fewer good guides; but using a search engine ("assembler guide"), I find on the first page two IA-32 guides, one AMD64 guide,
    some for other architectures, none for 8086.

    If nobody proposes anything better, I'm gonna just start with that stuff.
    Even so, the guy (sonictk) says his web page is not a tutorial for noobs.

    Yet the guy (sonictk) claims the starting environment only needs to have:
    (1) A Windows 10 PC (x64)
    (2) He claims we need Emacs https://github.com/sonictk/lightweight-emacs
    But, due to muscle memory, I'd vastly prefer editing in GVim (aka "vi")
    https://www.vim.org//download.php/#pc
    (3) He used "Visual Studio 2017" for his C/C++ development environment
    where I've learned over the years it's almost always best to use the
    EXACT sub version of tools the tutorial author used himself.
    (4) He used the "Netwide Assembler" compiler version 2.13.03
    https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/

    I think it's crazy to need "Visual Studio" just to assemble on a Windows x64 PC, but if nothing better comes up, that's what I'll start with, as it seems
    I am forced to write my own noob tutorial from scratch (simply because, shockingly so, a decent x64 tutorial for noobs hasn't yet been proposed (or,
    if it has, I must have missed it).

    Anyway, I'll write my own tutorial - but it's crazy that I have to do that.
    All I'm asking in this post is if the sonictk site seems reasonable to you.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From anton@anton@nospicedham.mips.complang.tuwien.ac.at (Anton Ertl) to comp.lang.asm.x86 on Mon Jan 25 08:28:06 2021
    From Newsgroup: comp.lang.asm.x86

    paul <nospam@nospicedham.nospam.invalid> writes:
    Given that, what do you think of this "Understanding Windows x64 Assembly? >https://sonictk.github.io/asm_tutorial/

    It discusses more stuff than I do (in particular, I focus on
    architecture when teaching assembly and discuss microarchitectural
    stuff like caches and TLBs only in my "efficient programs" course),
    but otherwise seems ok. Whether it works as a tutorial, is probably
    up to you to determine; I have no checklist for assembly tutorials.

    And, what do you think of these Windows x64 assembly language guides? >https://sonictk.github.io/asm_tutorial/#additionalresources

    Maybe it would be a good idea to start with the introduction by Chris
    Lomont and only then continue with the guide by sonictk.

    Yet the guy (sonictk) claims the starting environment only needs to have:
    (1) A Windows 10 PC (x64)
    (2) He claims we need Emacs https://github.com/sonictk/lightweight-emacs
    But, due to muscle memory, I'd vastly prefer editing in GVim (aka "vi")
    https://www.vim.org//download.php/#pc

    I see only one mention of Emacs on the page, but only as an example of
    "a C/C++ development environment". So I think you can just as well
    use vi.

    I think it's crazy to need "Visual Studio" just to assemble on a Windows x64 >PC

    Looks crazy to me, too, but then, I don't program on Windows; I guess
    Visual studio is used for what I would do with xterm (have a window
    for command-line interaction), bash (the command-line interpreter),
    and make (a build tool).

    - anton
    --
    M. Anton Ertl Some things have to be seen to be believed anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen http://www.complang.tuwien.ac.at/anton/home.html

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From wolfgang kern@nowhere@nospicedham.never.at to comp.lang.asm.x86 on Mon Jan 25 14:32:36 2021
    From Newsgroup: comp.lang.asm.x86

    On 25.01.2021 06:06, paul wrote:
    Anton Ertl wrote:

    I teach about 70 noobs every year to write something in assembler for
    a modern 64-bit chip, so I obviously disagree.

    At some point, rather soon, I'm going to have to give up on asking and just start following _somebody's_ tutorial on my X64 Windows 10 desktop.

    Given that, what do you think of this "Understanding Windows x64 Assembly? https://sonictk.github.io/asm_tutorial/

    now there you got your win64 hello world tutorial :)

    bits 64
    default rel

    segment .data
    msg db "Hello world!", 0xd, 0xa, 0

    segment .text
    global main
    extern ExitProcess

    extern printf

    main:
    push rbp
    mov rbp, rsp
    sub rsp, 32

    lea rcx, [msg]
    call printf

    xor rax, rax
    call ExitProcess
    ...
    Anyway, I'll write my own tutorial - but it's crazy that I have to do that. All I'm asking in this post is if the sonictk site seems reasonable to you.

    good luck.
    __
    wolfgang

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From paul@nospam@nospicedham.nospam.invalid to comp.lang.asm.x86 on Mon Jan 25 18:59:40 2021
    From Newsgroup: comp.lang.asm.x86

    wolfgang kern wrote:

    Given that, what do you think of this "Understanding Windows x64 Assembly? >> https://sonictk.github.io/asm_tutorial/

    now there you got your win64 hello world tutorial :)

    We already had a hello world working in this thread on January 18th.
    Message-ID: <ru342u$p8t$1@gioia.aioe.org>
    But, as others may recall, it didn't use Microsoft MASM but MASM32 from
    http://www.masm32.com/
    Which came with its own linker
    C:\mypath\masm32\bin\ml.exe /c /Zd /coff hello.asm
    C:\mypath\masm32\bin\Link /SUBSYSTEM:CONSOLE hello.obj
    Which worked fine following the steps in this hello world tutorial
    https://doc.lagout.org/operating%20system%20/Windows/winasmtut.pdf

    But that used "MASM32" and not Microsoft MASM (nor NASM).

    Nobody responded when I had asked if that's a decent assembler & linker.
    For example, can we use _that_ linker instead of the MS Visual C link.exe?

    The linker is the important step as it has to work with the assembler.
    *Can someone clarify where we can get a decent linker for object modules?*

    Anyway, I'll write my own tutorial - but it's crazy that I have to do that. >> All I'm asking in this post is if the sonictk site seems reasonable to you.

    good luck.

    *I need to _simplify_ the step of obtaining a linker for the basic noob.*

    I spent _hours_ downloading & creating offline installers for Visual Studio. Just to get a linker (MS link.exe).

    Given MS Visual Studio is astoundingly huge bloatware just for that linker
    https://visualstudio.microsoft.com/downloads/

    A very important question to resolve for a noob is _where_ to get a linker!
    For example, for the assembly code that works with Nasm, can we just
    substitute the MASM32 linker above instead of the MS Visual Studio linker?

    I don't know what the requirements are for the linker, but I do know that
    the way I obtained the linker via Visual Studio is horribly complex for a
    basic noob tutorial that I'm just starting to write.

    Given I need to _simplify_ the step of obtaining a linker for use with Nasm, *can someone explain where we can get a decent linker for object modules?* (Without having to first download & then install immense MS VS bloatware?)

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From paul@nospam@nospicedham.nospam.invalid to comp.lang.asm.x86 on Tue Jan 26 08:23:26 2021
    From Newsgroup: comp.lang.asm.x86

    Anton Ertl wrote:

    Given that, what do you think of this "Understanding Windows x64 Assembly? >>https://sonictk.github.io/asm_tutorial/

    Whether it works as a tutorial, is probably
    up to you to determine; I have no checklist for assembly tutorials.

    Success (of sorts), at last (I think) for the 10-step hello world tutorial.

    Following the previous instructions from "Tavis Ormandy" to check the "Individual components" Visual Studio Community 2019 checkbox for
    "MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.28)", I finally have
    the necessary Microsoft "link.exe" linker installed (I think).

    Here's where I am while trying to faithfully follow the tutorial at https://sonictk.github.io/asm_tutorial/

    (1) Onto my Win10 x64 20H2 computer, I install the latest Nasm from
    https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-installer-x64.exe

    (2) I then install the latest Microsoft link.exe from
    https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16

    (3) After installing Nasm, I check the version of nasm on Windows 10 x64
    nasm -v
    NASM version 2.15.05 compiled on Aug 28 2020

    (4) Then I download the "hello_world.asm" text file to my Win10 x64 system
    https://github.com/sonictk/asm_tutorial/blob/master/hello_world.asm

    (5) I then assemble that asm file into a hello_world.obj object module
    nasm -f win64 -o hello_world.obj hello_world.asm

    (6) Then I try the Microsoft Visual Studio Community 2019 linker
    "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64\link.exe" hello_world.obj /subsystem:console /entry:main /out:hello_world_basic.exe

    (7) Drat. Errors result even when I follow the tutorial exactly.
    Microsoft (R) Incremental Linker Version 14.28.29336.0
    Copyright (C) Microsoft Corporation. All rights reserved.

    hello_world.obj : error LNK2001: unresolved external symbol ExitProcess
    hello_world_basic.exe : fatal error LNK1120: 1 unresolved externals

    (8) Given "ExitProcess" is the last line, I commented it out & tried again,
    resulting in no errors and the creation of "hello_world_basic.exe"

    (9) Yet, when I ran "hello_world_basic.exe" on the Win10 x64 command line
    (or in the Win10 x64 File Explorer GUI), it didn't display the expected
    output (it actually displayed nothing - but no errors came out either).

    (10) I tried "ExitProcess@4" as per this stackoverflow question
    https://stackoverflow.com/questions/4123013/error-lnk2001-unresolved-external-symbol-messagebox
    But what I simply need now is an assembly language program that works
    as the point, at the point of a "hello world" is NOT to be debugging
    bad assembly language coding (debugging programs should come way later).
    https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk2001?view=msvc-160
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/71a80e19-4e6a-41fe-b1db-26e331da474d/linking-errors-lnk2001-unresolved-external-symbol-when-compiled-by-nasm
    http://www.masmforum.com/board/index.php?topic=15872;prev_next=next

    So the hello world is, finally, a bit closer to working with the latest Nasm
    & the latest Visual Studio Community 2019, but the syntax in the hello world example is, somehow, still a bit wrong for running at the Windows 10 x64 CLI.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From wolfgang kern@nowhere@nospicedham.never.at to comp.lang.asm.x86 on Tue Jan 26 09:29:18 2021
    From Newsgroup: comp.lang.asm.x86

    On 25.01.2021 18:59, paul wrote:
    wolfgang kern wrote:

    Given that, what do you think of this "Understanding Windows x64 Assembly? >>> https://sonictk.github.io/asm_tutorial/

    now there you got your win64 hello world tutorial :)

    We already had a hello world working in this thread on January 18th.
    Message-ID: <ru342u$p8t$1@gioia.aioe.org>
    But, as others may recall, it didn't use Microsoft MASM but MASM32 from
    http://www.masm32.com/
    Which came with its own linker
    C:\mypath\masm32\bin\ml.exe /c /Zd /coff hello.asm
    C:\mypath\masm32\bin\Link /SUBSYSTEM:CONSOLE hello.obj
    Which worked fine following the steps in this hello world tutorial
    https://doc.lagout.org/operating%20system%20/Windows/winasmtut.pdf

    But that used "MASM32" and not Microsoft MASM (nor NASM).

    Nobody responded when I had asked if that's a decent assembler & linker.
    For example, can we use _that_ linker instead of the MS Visual C link.exe?

    The linker is the important step as it has to work with the assembler.
    *Can someone clarify where we can get a decent linker for object modules?*

    Sorry I never needed nor used any LINKer. Someone else might answer it.
    RosAsm compiled text source to PEexe incl.debugger w/o a link process.
    FASMW compiled asm-source to either binary (.COM) or winPE w/o linker.

    NASM wont link with MASM nor MASM32 tools, but Frank knows it for sure.
    __
    wolfgang

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From James Van Buskirk@not_valid@nospicedham.comcast.net to comp.lang.asm.x86 on Tue Jan 26 05:49:50 2021
    From Newsgroup: comp.lang.asm.x86

    "paul" wrote in message news:ruog1d$m34$1@gioia.aioe.org...

    Success (of sorts), at last (I think) for the 10-step hello world
    tutorial.

    Following the previous instructions from "Tavis Ormandy" to check the "Individual components" Visual Studio Community 2019 checkbox for
    "MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.28)", I finally have
    the necessary Microsoft "link.exe" linker installed (I think).

    Here's where I am while trying to faithfully follow the tutorial at https://sonictk.github.io/asm_tutorial/

    (1) Onto my Win10 x64 20H2 computer, I install the latest Nasm from

    https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-installer-x64.exe

    (2) I then install the latest Microsoft link.exe from

    https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16

    (3) After installing Nasm, I check the version of nasm on Windows 10 x64
    nasm -v
    NASM version 2.15.05 compiled on Aug 28 2020

    (4) Then I download the "hello_world.asm" text file to my Win10 x64 system
    https://github.com/sonictk/asm_tutorial/blob/master/hello_world.asm

    (5) I then assemble that asm file into a hello_world.obj object module
    nasm -f win64 -o hello_world.obj hello_world.asm

    (6) Then I try the Microsoft Visual Studio Community 2019 linker
    "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64\link.exe" hello_world.obj /subsystem:console /entry:main /out:hello_world_basic.exe

    (7) Drat. Errors result even when I follow the tutorial exactly.
    Microsoft (R) Incremental Linker Version 14.28.29336.0
    Copyright (C) Microsoft Corporation. All rights reserved.

    hello_world.obj : error LNK2001: unresolved external symbol
    ExitProcess
    hello_world_basic.exe : fatal error LNK1120: 1 unresolved externals

    ExitProcess is documented here (usually I try searching for something like ExitProcess MSDN on google) https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitprocess
    The critical component it says you are missing is Kernel32.lib. You
    should be able to fix that by adding the switch
    /defaultlib:Kernel32
    I found this by searching for link.exe in google and then got to https://docs.microsoft.com/en-us/cpp/build/reference/defaultlib-specify-default-library?view=msvc-160

    (8) Given "ExitProcess" is the last line, I commented it out & tried
    again,
    resulting in no errors and the creation of "hello_world_basic.exe"

    (9) Yet, when I ran "hello_world_basic.exe" on the Win10 x64 command line
    (or in the Win10 x64 File Explorer GUI), it didn't display the
    expected
    output (it actually displayed nothing - but no errors came out
    either).

    Yeah, that's because your program doesn't do anything obvious. You could use the Win32 API function wsprintfA to do some output. That needs User32.lib. alternatively you could use printf from the C library, that wold require something
    like ucrt.lib. Hopefully you know or can figure out how to do basic I/O in
    C.

    (10) I tried "ExitProcess@4" as per this stackoverflow question

    https://stackoverflow.com/questions/4123013/error-lnk2001-unresolved-external-symbol-messagebox
    But what I simply need now is an assembly language program that works
    as the point, at the point of a "hello world" is NOT to be debugging
    bad assembly language coding (debugging programs should come way later).

    https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk2001?view=msvc-160

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/71a80e19-4e6a-41fe-b1db-26e331da474d/linking-errors-lnk2001-unresolved-external-symbol-when-compiled-by-nasm
    http://www.masmforum.com/board/index.php?topic=15872;prev_next=next

    That won't fly because it says to use name-mangling that the STDCALL
    convention uses in 32-bit Windows. In 64-bit Windows there is no name
    mangling. Well there is for C++ functions, but we aren't going to go there
    if we can help it. You will find https://agner.org/optimize/calling_conventions.pdf
    quite useful in this context.

    So the hello world is, finally, a bit closer to working with the latest
    Nasm
    & the latest Visual Studio Community 2019, but the syntax in the hello
    world
    example is, somehow, still a bit wrong for running at the Windows 10 x64 CLI.

    From your bio you have most of the hard stuff under control; you just
    need to get over a little stumbling block!

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@nospicedham.gmail.com to comp.lang.asm.x86 on Wed Jan 27 20:33:23 2021
    From Newsgroup: comp.lang.asm.x86

    advise for a good beginner windoze assembler?

    Begin with 32 bit programming and use the inline-assembler of
    MSVC (64 bit MSVC++ hasn't any inline-assembler any more). With
    naked functions (functions without a compiler generated prologue
    and epilogue) you don't have to learn the directives for an
    assembler.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Rickey Bowers@bitrake@nospicedham.gmail.com to comp.lang.asm.x86 on Mon Feb 8 10:48:31 2021
    From Newsgroup: comp.lang.asm.x86

    On Saturday, January 16, 2021 at 2:54:06 PM UTC-7, paul wrote:
    advise for a good beginner windoze assembler?
    https://flatassembler.net/
    fasm requires no installation beyond setting the include directory and has plenty of examples in 32-bit/64-bit windows. Besides comp.lang.asm.x86 it's probably the longest running community on x86. The assembler is written in x86, and open source. At just over a megabyte, it might be the smallest option as well.
    disclaimer: I'm approaching 20 years of working fasm/fasmg. My x86 path was: debug, tasm, nasm, masm, fasm.
    --- Synchronet 3.21d-Linux NewsLink 1.2