beebasm

changeset 16:81643f346e60 v1.01

BeebASM v1.01 - first released Apr 14 2008 14:21:36
author Samwise <samwise@bagshot-row.org>
date Sun May 02 12:22:44 2010 +0100
parents 418906016281
children f8817ed0d5c1
files about.txt beebasm.exe demo.ssd src/assemble.cpp src/discimage.cpp src/lineparser.cpp src/main.cpp
diffstat 7 files changed, 56 insertions(+), 15 deletions(-) [+]
line diff
     1.1 --- a/about.txt	Sun May 02 12:21:28 2010 +0100
     1.2 +++ b/about.txt	Sun May 02 12:22:44 2010 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4  *******************************************************************************
     1.5  *                                                                             *
     1.6 -*                               BeebAsm V1.00                                 *
     1.7 +*                               BeebAsm V1.01                                 *
     1.8  *                                                                             *
     1.9  *             A portable 6502 assembler with BBC Micro style syntax           *
    1.10  *                                                                             *
    1.11 @@ -552,6 +552,9 @@
    1.12  
    1.13  9. VERSION HISTORY
    1.14  
    1.15 +14/04/2008  1.01  Bugfixes: allow lower case index in abs,x or abs,y.
    1.16 +                  Fails if file already exists in output disc image.
    1.17 +                  Symbol names may now begin with assembler opcode names.
    1.18  30/03/2008  1.00  First stable release.  Corrected a few C++ compliance
    1.19                    issues in the source code.
    1.20  22/01/2008  0.06  Fixed bug with forward-referenced labels in indirect
     2.1 Binary file beebasm.exe has changed
     3.1 Binary file demo.ssd has changed
     4.1 --- a/src/assemble.cpp	Sun May 02 12:21:28 2010 +0100
     4.2 +++ b/src/assemble.cpp	Sun May 02 12:22:44 2010 +0100
     4.3 @@ -703,7 +703,7 @@
     4.4  		throw AsmException_SyntaxError_BadAbsolute( m_line, m_column );
     4.5  	}
     4.6  
     4.7 -	if ( toupper( m_line[ m_column ] == 'X' ) )
     4.8 +	if ( toupper( m_line[ m_column ] ) == 'X' )
     4.9  	{
    4.10  		m_column++;
    4.11  
    4.12 @@ -734,7 +734,7 @@
    4.13  		}
    4.14  	}
    4.15  
    4.16 -	if ( toupper( m_line[ m_column ] == 'Y' ) )
    4.17 +	if ( toupper( m_line[ m_column ] ) == 'Y' )
    4.18  	{
    4.19  		m_column++;
    4.20  
     5.1 --- a/src/discimage.cpp	Sun May 02 12:21:28 2010 +0100
     5.2 +++ b/src/discimage.cpp	Sun May 02 12:22:44 2010 +0100
     5.3 @@ -170,7 +170,7 @@
     5.4  	{
     5.5  		bool bTheSame = true;
     5.6  
     5.7 -		for ( size_t j = 0; j < 7 || j < strlen( pName ); j++ )
     5.8 +		for ( size_t j = 0; j < strlen( pName ); j++ )
     5.9  		{
    5.10  			if ( toupper( pName[ j ] ) != toupper( m_aCatalog[ i + j ] ) )
    5.11  			{
     6.1 --- a/src/lineparser.cpp	Sun May 02 12:21:28 2010 +0100
     6.2 +++ b/src/lineparser.cpp	Sun May 02 12:22:44 2010 +0100
     6.3 @@ -62,15 +62,50 @@
     6.4  
     6.5  		int oldColumn = m_column;
     6.6  
     6.7 +		// Priority: check if it's symbol assignment and let it take priority over keywords
     6.8 +		// This means symbols can begin with reserved words, e.g. PLAyer, but in the case of
     6.9 +		// the line 'player = 1', the meaning is unambiguous, so we allow it as a symbol
    6.10 +		// assignment.
    6.11 +
    6.12 +		bool bIsSymbolAssignment = false;
    6.13 +
    6.14 +		if ( isalpha( m_line[ m_column ] ) || m_line[ m_column ] == '_' )
    6.15 +		{
    6.16 +			do
    6.17 +			{
    6.18 +				m_column++;
    6.19 +
    6.20 +			} while ( ( isalpha( m_line[ m_column ] ) ||
    6.21 +						isdigit( m_line[ m_column ] ) ||
    6.22 +						m_line[ m_column ] == '_' ||
    6.23 +						m_line[ m_column ] == '%' ) &&
    6.24 +						m_line[ m_column - 1 ] != '%' );
    6.25 +
    6.26 +			if ( AdvanceAndCheckEndOfStatement() )
    6.27 +			{
    6.28 +				if ( m_line[ m_column ] == '=' )
    6.29 +				{
    6.30 +					// if we have a valid symbol name, followed by an '=', it is definitely
    6.31 +					// a symbol assignment.
    6.32 +					bIsSymbolAssignment = true;
    6.33 +				}
    6.34 +			}
    6.35 +		}
    6.36 +
    6.37 +		m_column = oldColumn;
    6.38 +
    6.39  		// first check tokens - they have priority over opcodes, so that they can have names
    6.40  		// like INCLUDE (which would otherwise be interpreted as INC LUDE)
    6.41  
    6.42 -		int token = GetTokenAndAdvanceColumn();
    6.43 +		if ( !bIsSymbolAssignment )
    6.44 +		{
    6.45 +			int token = GetTokenAndAdvanceColumn();
    6.46  
    6.47 -		if ( token != -1 )
    6.48 -		{
    6.49 -			HandleToken( token, oldColumn );
    6.50 -			continue;
    6.51 +			if ( token != -1 )
    6.52 +			{
    6.53 +				HandleToken( token, oldColumn );
    6.54 +				continue;
    6.55 +			}
    6.56  		}
    6.57  
    6.58  		// Next we see if we should even be trying to execute anything.... maybe the if condition is false
    6.59 @@ -84,12 +119,15 @@
    6.60  
    6.61  		// No token match - check against opcodes
    6.62  
    6.63 -		token = GetInstructionAndAdvanceColumn();
    6.64 +		if ( !bIsSymbolAssignment )
    6.65 +		{
    6.66 +			int token = GetInstructionAndAdvanceColumn();
    6.67  
    6.68 -		if ( token != -1 )
    6.69 -		{
    6.70 -			HandleAssembler( token );
    6.71 -			continue;
    6.72 +			if ( token != -1 )
    6.73 +			{
    6.74 +				HandleAssembler( token );
    6.75 +				continue;
    6.76 +			}
    6.77  		}
    6.78  
    6.79  		// Check to see if it's symbol assignment
     7.1 --- a/src/main.cpp	Sun May 02 12:21:28 2010 +0100
     7.2 +++ b/src/main.cpp	Sun May 02 12:22:44 2010 +0100
     7.3 @@ -23,7 +23,7 @@
     7.4  using namespace std;
     7.5  
     7.6  
     7.7 -#define VERSION "1.00"
     7.8 +#define VERSION "1.01"
     7.9  
    7.10  
    7.11  /*************************************************************************************************/