beebasm
changeset 20:befc7f8a05db v1.03
BeebASM v1.03 - first released Jul 27 2009 21:35:01
| author | Samwise <samwise@bagshot-row.org> |
|---|---|
| date | Sun May 02 12:27:35 2010 +0100 |
| parents | a22280331a87 |
| children | 5db9dbc9a87d |
| files | about.txt beebasm.exe demo.ssd src/Makefile src/asmexception.h src/expression.cpp src/main.cpp |
| diffstat | 7 files changed, 39 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/about.txt Sun May 02 12:26:00 2010 +0100 1.2 +++ b/about.txt Sun May 02 12:27:35 2010 +0100 1.3 @@ -368,10 +368,10 @@ 1.4 specified), or to the current directory as a standalone file. A 1.5 source file must have at least one SAVE statement in it, otherwise nothing 1.6 will be output. BeebAsm will warn if this is the case. 1.7 - 1.8 + 1.9 'exec' can be optionally specified as the execution address of the file when 1.10 saved to a disc image. 1.11 - 1.12 + 1.13 'reload' can additionally be specified to save the file on the disc image to 1.14 a different address to that which it was saved from. Use this to assemble 1.15 code at its 'native' address, but which loads at a DFS-friendly address, 1.16 @@ -583,6 +583,10 @@ 1.17 1.18 9. VERSION HISTORY 1.19 1.20 +27/07/2009 1.03 Bugfix: Corrected the unary < and > operators to 1.21 + correspond to HI and LO as appropriate. 1.22 + Added '$' as a valid hex literal prefix. 1.23 + Added '%' as a binary literal prefix. 1.24 06/11/2008 1.02 Bugfix: now it's possible to save location &FFFF. 1.25 Added 'reload address' parameter to SAVE. 1.26 Properly integrated the GPL License text into the
2.1 Binary file beebasm.exe has changed
3.1 Binary file demo.ssd has changed
4.1 --- a/src/Makefile Sun May 02 12:26:00 2010 +0100 4.2 +++ b/src/Makefile Sun May 02 12:27:35 2010 +0100 4.3 @@ -51,7 +51,7 @@ 4.4 4.5 # Parameters to the executable 4.6 4.7 -PARAMS := -i ..\demo.asm -do ..\demo.ssd -boot Code 4.8 +PARAMS := -i ..\demo.asm -do ..\demo.ssd -boot Code -v 4.9 4.10 4.11
5.1 --- a/src/asmexception.h Sun May 02 12:26:00 2010 +0100 5.2 +++ b/src/asmexception.h Sun May 02 12:27:35 2010 +0100 5.3 @@ -170,6 +170,7 @@ 5.4 DEFINE_SYNTAX_EXCEPTION( NumberTooBig, "Number too big." ); 5.5 DEFINE_SYNTAX_EXCEPTION( SymbolNotDefined, "Symbol not defined." ); 5.6 DEFINE_SYNTAX_EXCEPTION( BadHex, "Bad hex." ); 5.7 +DEFINE_SYNTAX_EXCEPTION( BadBin, "Bad binary expression." ); 5.8 DEFINE_SYNTAX_EXCEPTION( MissingValue, "Missing value in expression." ); 5.9 DEFINE_SYNTAX_EXCEPTION( InvalidCharacter, "Bad expression." ); 5.10 DEFINE_SYNTAX_EXCEPTION( ExpressionTooComplex, "Expression too complex." );
6.1 --- a/src/expression.cpp Sun May 02 12:26:00 2010 +0100 6.2 +++ b/src/expression.cpp Sun May 02 12:27:35 2010 +0100 6.3 @@ -78,8 +78,8 @@ 6.4 { "+", 8, &LineParser::EvalPosate }, 6.5 { "HI", 10, &LineParser::EvalHi }, 6.6 { "LO", 10, &LineParser::EvalLo }, 6.7 - { "<", 10, &LineParser::EvalHi }, 6.8 - { ">", 10, &LineParser::EvalLo }, 6.9 + { ">", 10, &LineParser::EvalHi }, 6.10 + { "<", 10, &LineParser::EvalLo }, 6.11 { "SIN", 10, &LineParser::EvalSin }, 6.12 { "COS", 10, &LineParser::EvalCos }, 6.13 { "TAN", 10, &LineParser::EvalTan }, 6.14 @@ -127,7 +127,7 @@ 6.15 str >> value; 6.16 m_column = str.tellg(); 6.17 } 6.18 - else if ( m_line[ m_column ] == '&' ) 6.19 + else if ( m_line[ m_column ] == '&' || m_line[ m_column ] == '$' ) 6.20 { 6.21 // get a hex digit 6.22 6.23 @@ -152,6 +152,33 @@ 6.24 value = static_cast< double >( hexValue ); 6.25 } 6.26 } 6.27 + else if ( m_line[ m_column ] == '%' ) 6.28 + { 6.29 + // get binary 6.30 + 6.31 + m_column++; 6.32 + 6.33 + if ( m_line[ m_column ] != '0' && m_line[ m_column ] != '1' ) 6.34 + { 6.35 + // badly formed bin literal 6.36 + throw AsmException_SyntaxError_BadBin( m_line, m_column ); 6.37 + } 6.38 + else 6.39 + { 6.40 + // parse binary number 6.41 + 6.42 + int binValue = 0; 6.43 + 6.44 + do 6.45 + { 6.46 + binValue = ( binValue * 2 ) + ( m_line[ m_column ] - '0' ); 6.47 + m_column++; 6.48 + } 6.49 + while ( m_line[ m_column ] == '0' || m_line[ m_column ] == '1' ); 6.50 + 6.51 + value = static_cast< double >( binValue ); 6.52 + } 6.53 + } 6.54 else if ( m_line[ m_column ] == '*' ) 6.55 { 6.56 // get current PC
7.1 --- a/src/main.cpp Sun May 02 12:26:00 2010 +0100 7.2 +++ b/src/main.cpp Sun May 02 12:27:35 2010 +0100 7.3 @@ -39,7 +39,7 @@ 7.4 using namespace std; 7.5 7.6 7.7 -#define VERSION "1.02" 7.8 +#define VERSION "1.03" 7.9 7.10 7.11 /*************************************************************************************************/
