EASy68K  
It is currently Thu Sep 21, 2017 7:32 pm

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Spaces in assembly code
PostPosted: Wed Jan 24, 2007 3:15 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1046
A constant source of confusion for new assembly language programmers is the use of spaces as the delimeter between fields of an instruction. EASy68K is patterned after the original Motorola 68000 assembler. That assembler, as do many assemblers, uses whitespace characters as delimiters between different fields of an instruction. For example:

Code:
LABEL     MOVEM.L     D0/D1,-(A7)     comment


If whitespaces are added inside any of the fields of the instruction the assembler may interpret them as delimeters resulting in a syntax error when assembling. For example:

Code:
LABEL     MOVEM.L     D0/D1,   -(A7)     comment


OR the result may be different than the programmer intended. For example:

Code:
N       EQU     LABEL+5     comment


If the code is entered with spaces:
Code:
N       EQU     LABEL + 5   comment


The assembler interprets it as:
Code:
N       EQU     LABEL       + 5   comment


While it might seem strange to start a comment with a + symbol there is no restriction that says you can't. Other languages deal with the problem by requiring a special prefix symbol before a comment. The double forward slash // in C++ is an example.

_________________
Prof. Kelly


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group