gnupic: gpasm numbers


Previous by date: 24 Aug 2004 05:52:37 +0100 Re: Documentation wanted, Gabor Kiss [Bitman]
Next by date: 24 Aug 2004 05:52:37 +0100 gpasm numbers, pico
Previous in thread:
Next in thread: 24 Aug 2004 05:52:37 +0100 gpasm numbers, pico

Subject: gpasm numbers
From: Craig Franklin ####@####.####
Date: 24 Aug 2004 05:52:37 +0100
Message-Id: <4129DA4D.40905@users.sourceforge.net>

A few questions have come up recently about gpasm number representations.

Section 3.2.3 of the gputils manual covers numbers for gpasm.  This 
section recommends that you represent all numbers using the formats:

base     general syntax  21 decimal written as
===============================================
binary   B'[01]*'        B'10101'
octal    O'[0-7]*'       O'25'
decimal  D'[0-9]*'       D'21'
hex      H'[0-F]*'       H'15'
hex      0x[0-F]*        0x15

There are several other legacy formats that gpasm supports for mpasm 
compatibility.  Most of these formats have shortcomings.  For example 
"21d" is another way to represent "21 decimal".  The problem is that 'd' 
is a hex character so "21d" could also mean "0x21d".  So gpasm uses the 
same hack that mpasm does, if the default radix is hex, "21d" is a hex 
number, otherwise it is decimal 21.  This is one example, there are many 
more.  So please don't use the other representations.

Using the numbers above are also immune to an inadvertent default radix 
change.  I don't recommend relying on the default radix for your code to 
assemble correctly.  There are too many ways that it can cause problems.

There is one real bug in gpasm's number representations.  Certain 
numbers like "14000" are treated as processor names instead of numbers.  
This is a hack that really needs to be fixed.  I haven't had time.  
Although if you use one of the recommended representations in the table 
above you won't have a problem.

Previous by date: 24 Aug 2004 05:52:37 +0100 Re: Documentation wanted, Gabor Kiss [Bitman]
Next by date: 24 Aug 2004 05:52:37 +0100 gpasm numbers, pico
Previous in thread:
Next in thread: 24 Aug 2004 05:52:37 +0100 gpasm numbers, pico


Powered by ezmlm-browse 0.20.