1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Learning Assembler

Discussion in 'Software Development' started by pawitter, Jan 27, 2005.

Thread Status:
Not open for further replies.
  1. pawitter

    pawitter Thread Starter

    Joined:
    Jan 1, 2005
    Messages:
    3
    Hello,
    I have been a MAINFRAME assembler programmer for quite a few years and I have decided to learn how to code in assembler on the PC. I have downloaded a free compiler / linker (GoAsm) and read a few notes on PC assembler. Different tutorials seem to present different commands which I find odd as I would have thought that assembler is assembler. For example, one of the commands shown is MOV DX, SEG myvariable. However, the compiler throws this out. Therefore, I have created my first PC assembler pgm which crashes my PC faster than ever before. Great. Can anyone give me any resons why.... ?
    Code:
    .DATA 
    FirstString DB "Is this a great pgm$" 
    ;
    .CODE 
    START:
    LEA DX, FirstString              ;offset from current segment         
    MOV AH, 9	     	;VALUE OF 9h in AH for 'write to screen'	
    INT 21h			;call dos
    MOV AX, 4C00h		;parm 4c for 'return from dos' 
    INT 21h			;call dos 
    RET
    
     
  2. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    Try Nasm. I don't know assembly much at all, but Nasm has been the easiest to mess with.

    hello.asm
    Code:
    org 100h
    mov dx,msg
    mov ah,9
    int 21h
    mov ah,4Ch
    int 21h
    msg db 'Hello, World!',0Dh,0Ah,'$'
    
    nasm hello.asm -o hello.exe

    That produces a 27 Byte Hello World com file. (with an exe extension).
     
  3. IMM

    IMM

    Joined:
    Feb 1, 2002
    Messages:
    3,257
    Never seen that assembler.
    What's the memory model in what you wrote ?
    If you write 8086/88 code using the 16 bit registers such as dx rather than the later processors with 32 bit registers like edx - you'll have to watch near vs. far etc. for where you place segments.
    There should be .processor directive available in that one ?

    Here's a start (good windows pdf or chm book)
    http://webster.cs.ucr.edu/AoA/Windows/
    or this one has a link to 16 bit editions and a variety of assemblers
    http://webster.cs.ucr.edu/AoA/

    -------
    I guess I didn't ask how ASSUME was used to set sections - eg:
    assume ds:DATA
    to use constructs like lea dx,ds:[whatever] but you will figure out the register pairs for addresses when you look at the memory models.

    You're REALLY going to enjoy differing register widths and leaving flat memory behind for this segmented architecture :)
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Learning Assembler
  1. jijouna7
    Replies:
    1
    Views:
    581
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/324093

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice