beebasm

changeset 12:143fa2918f6f v0.06

BeebASM v0.06 - first released Jan 22 2008 19:21:21
author Samwise <samwise@bagshot-row.org>
date Sun May 02 12:18:50 2010 +0100
parents ba36b411d841
children 55c5cbd4025e
files about.txt beebasm.exe demo.ssd src/Makefile.inc src/expression.cpp src/lineparser.cpp src/lineparser.h src/main.cpp
diffstat 8 files changed, 52 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/about.txt	Sun May 02 12:16:07 2010 +0100
     1.2 +++ b/about.txt	Sun May 02 12:18:50 2010 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4  *******************************************************************************
     1.5  *                                                                             *
     1.6 -*                               BeebAsm V0.05                                 *
     1.7 +*                               BeebAsm V0.06                                 *
     1.8  *                                                                             *
     1.9  *             A portable 6502 assembler with BBC Micro style syntax           *
    1.10  *                                                                             *
    1.11 @@ -552,6 +552,8 @@
    1.12  
    1.13  9. VERSION HISTORY
    1.14  
    1.15 +22/01/2008  0.06  Fixed bug with forward-referenced labels in indirect
    1.16 +                  instructions.
    1.17  09/01/2008  0.05  Added MAPCHAR.  Fixed SKIPTO (see, told you I was doing
    1.18                    it quickly!).  Enforce '%' as an end-of-symbol
    1.19                    character.  Fixed bug in overlayed assembly.  Warns if
     2.1 Binary file beebasm.exe has changed
     3.1 Binary file demo.ssd has changed
     4.1 --- a/src/Makefile.inc	Sun May 02 12:16:07 2010 +0100
     4.2 +++ b/src/Makefile.inc	Sun May 02 12:18:50 2010 +0100
     4.3 @@ -64,7 +64,7 @@
     4.4  
     4.5  # Declare default number of CPUs
     4.6  
     4.7 -CPUS			?=		1
     4.8 +CPUS			?=		2
     4.9  
    4.10  
    4.11  # Set variables according to VERBOSE
     5.1 --- a/src/expression.cpp	Sun May 02 12:16:07 2010 +0100
     5.2 +++ b/src/expression.cpp	Sun May 02 12:18:50 2010 +0100
     5.3 @@ -206,6 +206,10 @@
     5.4  	m_valueStackPtr = 0;
     5.5  	m_operatorStackPtr = 0;
     5.6  
     5.7 +	// Count brackets
     5.8 +
     5.9 +	int bracketCount = 0;
    5.10 +
    5.11  	TYPE expected = VALUE_OR_UNARY;
    5.12  
    5.13  	// Iterate through the expression
    5.14 @@ -257,12 +261,9 @@
    5.15  					if ( GlobalData::Instance().IsFirstPass() )
    5.16  					{
    5.17  						// On first pass, we have to continue gracefully.
    5.18 -						// This loop moves the string pointer to beyond the expression
    5.19 +						// This moves the string pointer to beyond the expression
    5.20  
    5.21 -						while ( AdvanceAndCheckEndOfSubStatement() )
    5.22 -						{
    5.23 -							m_column++;
    5.24 -						}
    5.25 +						SkipExpression( bracketCount, bAllowOneMismatchedCloseBracket );
    5.26  					}
    5.27  
    5.28  					// Whatever happens, we throw the exception
    5.29 @@ -293,6 +294,10 @@
    5.30  						( this->*opHandler )();
    5.31  					}
    5.32  				}
    5.33 +				else
    5.34 +				{
    5.35 +					bracketCount++;
    5.36 +				}
    5.37  
    5.38  				if ( m_operatorStackPtr == MAX_OPERATORS )
    5.39  				{
    5.40 @@ -362,6 +367,8 @@
    5.41  			{
    5.42  				// is a close bracket
    5.43  
    5.44 +				bracketCount--;
    5.45 +
    5.46  				bool bFoundMatchingBracket = false;
    5.47  
    5.48  				while ( m_operatorStackPtr > 0 )
     6.1 --- a/src/lineparser.cpp	Sun May 02 12:16:07 2010 +0100
     6.2 +++ b/src/lineparser.cpp	Sun May 02 12:18:50 2010 +0100
     6.3 @@ -192,6 +192,40 @@
     6.4  
     6.5  /*************************************************************************************************/
     6.6  /**
     6.7 +	LineParser::SkipExpression()
     6.8 +
     6.9 +	Moves past the current expression to the next
    6.10 +*/
    6.11 +/*************************************************************************************************/
    6.12 +void LineParser::SkipExpression( int bracketCount, bool bAllowOneMismatchedCloseBracket )
    6.13 +{
    6.14 +	while ( AdvanceAndCheckEndOfSubStatement() )
    6.15 +	{
    6.16 +		if ( bAllowOneMismatchedCloseBracket )
    6.17 +		{
    6.18 +			if ( m_line[ m_column ] == '(' )
    6.19 +			{
    6.20 +				bracketCount++;
    6.21 +			}
    6.22 +			else if ( m_line[ m_column ] == ')' )
    6.23 +			{
    6.24 +				bracketCount--;
    6.25 +
    6.26 +				if ( bracketCount < 0 )
    6.27 +				{
    6.28 +					break;
    6.29 +				}
    6.30 +			}
    6.31 +		}
    6.32 +
    6.33 +		m_column++;
    6.34 +	}
    6.35 +}
    6.36 +
    6.37 +
    6.38 +
    6.39 +/*************************************************************************************************/
    6.40 +/**
    6.41  	LineParser::HandleToken()
    6.42  
    6.43  	Calls the handler for the specified token
     7.1 --- a/src/lineparser.h	Sun May 02 12:16:07 2010 +0100
     7.2 +++ b/src/lineparser.h	Sun May 02 12:18:50 2010 +0100
     7.3 @@ -89,6 +89,7 @@
     7.4  	bool			AdvanceAndCheckEndOfStatement();
     7.5  	bool			AdvanceAndCheckEndOfSubStatement();
     7.6  	void			SkipStatement();
     7.7 +	void			SkipExpression( int bracketCount, bool bAllowOneMismatchedCloseBracket );
     7.8  	std::string		GetSymbolName();
     7.9  
    7.10  	// assembler generating methods
     8.1 --- a/src/main.cpp	Sun May 02 12:16:07 2010 +0100
     8.2 +++ b/src/main.cpp	Sun May 02 12:18:50 2010 +0100
     8.3 @@ -23,7 +23,7 @@
     8.4  using namespace std;
     8.5  
     8.6  
     8.7 -#define VERSION "0.05"
     8.8 +#define VERSION "0.06"
     8.9  
    8.10  
    8.11  /*************************************************************************************************/