Learning Assembler

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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
 
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).
 

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 :)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Staff online

Members online

Top