beebasm

changeset 36:9988a3cb5311

Updated file headers with correct dates. Updated manual.
author RichTW <richtw1@gmail.com>
date Mon Apr 25 02:40:57 2011 +0200
parents 5fedd5b15bd7
children bc0355ba8a53
files about.txt src/Makefile src/asmexception.cpp src/asmexception.h src/assemble.cpp src/commands.cpp src/discimage.cpp src/discimage.h src/expression.cpp src/globaldata.cpp src/globaldata.h src/lineparser.cpp src/lineparser.h src/macro.cpp src/main.cpp src/main.h src/objectcode.cpp src/objectcode.h src/sourcecode.cpp src/sourcecode.h src/sourcefile.cpp src/sourcefile.h src/stringutils.cpp src/stringutils.h src/symboltable.cpp src/symboltable.h
diffstat 26 files changed, 111 insertions(+), 30 deletions(-) [+]
line diff
     1.1 --- a/about.txt	Mon Apr 25 01:14:59 2011 +0200
     1.2 +++ b/about.txt	Mon Apr 25 02:40:57 2011 +0200
     1.3 @@ -1,11 +1,11 @@
     1.4  *******************************************************************************
     1.5  *                                                                             *
     1.6 -*                               BeebAsm V1.04                                 *
     1.7 +*                               BeebAsm V1.05                                 *
     1.8  *                                                                             *
     1.9  *             A portable 6502 assembler with BBC Micro style syntax           *
    1.10  *                                                                             *
    1.11 -*              Copyright (C) Rich Talbot-Watkins 2007, 2008, 2009             *
    1.12 -*                            <rich_tw@hotmail.com>                            *
    1.13 +*                  Copyright (C) Rich Talbot-Watkins 2007-2011                *
    1.14 +*                             <richtw1@gmail.com>                             *
    1.15  *                                                                             *
    1.16  *    This program is free software: you can redistribute it and/or modify     *
    1.17  *    it under the terms of the GNU General Public License as published by     *
    1.18 @@ -503,6 +503,84 @@
    1.19        }
    1.20  
    1.21  
    1.22 +PUTFILE <host filename>, [<beeb filename>,] <start addr> [,<exec addr>]
    1.23 +
    1.24 +  This provides a convenient way of copying a file from the host OS directly
    1.25 +  to the output disc image.  If no 'beeb filename' is provided, the host
    1.26 +  filename will be used (and must therefore be 7 characters or less in length).
    1.27 +  A start address must be provided (and optionally an execution address can
    1.28 +  be provided too).
    1.29 +  
    1.30 +  
    1.31 +PUTBASIC <host filename> [,<beeb filename>]
    1.32 +
    1.33 +  This takes a BASIC program as a plain text file on the host OS, tokenises it,
    1.34 +  and outputs it to the disc image as a native BASIC file.  Credit to Thomas
    1.35 +  Harte for the BASIC tokenising routine.
    1.36 +  
    1.37 +  
    1.38 +MACRO <name> [,<parameter list...>]
    1.39 +ENDMACRO
    1.40 +
    1.41 +  This pair of commands is used to define assembler macros.  Their use is best
    1.42 +  illustrated by an example:
    1.43 +  
    1.44 +      MACRO ADDI8 addr, val
    1.45 +		  IF val=1
    1.46 +			  INC addr
    1.47 +		  ELIF val>1
    1.48 +			  CLC
    1.49 +			  LDA addr
    1.50 +			  ADC #val
    1.51 +			  STA addr
    1.52 +		  ENDIF
    1.53 +	  ENDMACRO
    1.54 +
    1.55 +  This defines a macro called ADDI8 ("ADD Immediate 8-bit") whose function is
    1.56 +  to add a constant to a memory address.  It expects two parameters: the
    1.57 +  memory address and the constant value.  The body of the macro contains an IF
    1.58 +  block which will generate the most appropriate code according to the constant
    1.59 +  value passed in.
    1.60 +  
    1.61 +  Then, at any point afterwards, the macro can be used as follows:
    1.62 +  
    1.63 +      ADDI8 &900, 1            ; increment address &900 by 1
    1.64 +	  ADDI8 bonus, 10          ; add 10 to the memory location 'bonus'
    1.65 +	  ADDI8 pills, pill_add    ; pills += pill_add
    1.66 +
    1.67 +  Macros can also be nested, as demonstrated by this somewhat contrived
    1.68 +  example:
    1.69 +  
    1.70 +  	  MACRO ADDI16 addr, val
    1.71 +	      IF val=0
    1.72 +		      ; do nothing
    1.73 +		  ELIF val=1
    1.74 +			  INC addr
    1.75 +			  BNE skip1
    1.76 +			  INC addr+1
    1.77 +			  .skip1
    1.78 +		  ELIF HI(val)=0
    1.79 +			  ADDI8 addr, val
    1.80 +			  BCC skip2
    1.81 +			  INC addr+1
    1.82 +			  .skip2
    1.83 +		  ELSE
    1.84 +		      CLC
    1.85 +			  LDA addr
    1.86 +			  ADC #LO(val)
    1.87 +			  STA addr
    1.88 +			  LDA addr+1
    1.89 +			  ADC #HI(val)
    1.90 +			  STA addr+1
    1.91 +		  ENDIF
    1.92 +	  ENDMACRO
    1.93 +
    1.94 +  Care should be taken with macros, as the details of the code assembled are
    1.95 +  hidden.  In the above ADDI16 example, the C flag is not set consistently,
    1.96 +  depending on the inputs to the macro (e.g. it remains unchanged if val=0 or
    1.97 +  1, and will not be correct if val<256).
    1.98 +
    1.99 +
   1.100  
   1.101  7. TIPS AND TRICKS
   1.102  
   1.103 @@ -608,6 +686,9 @@
   1.104  
   1.105  9. VERSION HISTORY
   1.106  
   1.107 +25/04/2011  1.05  Added macros.
   1.108 +                  Added PUTFILE and PUTBASIC (to tokenise a plaintext BASIC
   1.109 +				  file, using code by Thomas Harte).
   1.110  02/12/2009  1.04  Additions by Kevin Bracey:
   1.111                    Added 65C02 instruction set and CPU directive.
   1.112                    Added ELIF, EQUD.
   1.113 @@ -649,6 +730,6 @@
   1.114  
   1.115  There are bound to be loads.  I wrote it quickly!  Please help me zap all the
   1.116  problems by reporting any bugs to me, Rich Talbot-Watkins, at
   1.117 -<rich_tw@hotmail.com>, or join the forum at <http://www.retrosoftware.co.uk>.
   1.118 +<richtw1@gmail.com>, or join the forum at <http://www.retrosoftware.co.uk>.
   1.119  
   1.120  Thank you!
     2.1 --- a/src/Makefile	Mon Apr 25 01:14:59 2011 +0200
     2.2 +++ b/src/Makefile	Mon Apr 25 02:40:57 2011 +0200
     2.3 @@ -51,8 +51,8 @@
     2.4  
     2.5  # Parameters to the executable
     2.6  
     2.7 -PARAMS			:=		-i ../demo.6502 -do ../demo.ssd -boot Code -v
     2.8 -#PARAMS			:=		-i ../test.6502 -v
     2.9 +#PARAMS			:=		-i ../demo.6502 -do ../demo.ssd -boot Code -v
    2.10 +PARAMS			:=		-i ../test.6502 -v
    2.11  
    2.12  
    2.13  
     3.1 --- a/src/asmexception.cpp	Mon Apr 25 01:14:59 2011 +0200
     3.2 +++ b/src/asmexception.cpp	Mon Apr 25 02:40:57 2011 +0200
     3.3 @@ -5,7 +5,7 @@
     3.4  	Exception handling for the app
     3.5  
     3.6  
     3.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
     3.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
     3.9  
    3.10  	This file is part of BeebAsm.
    3.11  
     4.1 --- a/src/asmexception.h	Mon Apr 25 01:14:59 2011 +0200
     4.2 +++ b/src/asmexception.h	Mon Apr 25 02:40:57 2011 +0200
     4.3 @@ -3,7 +3,7 @@
     4.4  	asmexception.h
     4.5  
     4.6  
     4.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
     4.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
     4.9  
    4.10  	This file is part of BeebAsm.
    4.11  
     5.1 --- a/src/assemble.cpp	Mon Apr 25 01:14:59 2011 +0200
     5.2 +++ b/src/assemble.cpp	Mon Apr 25 02:40:57 2011 +0200
     5.3 @@ -5,7 +5,7 @@
     5.4  	Contains all the LineParser methods for assembling code
     5.5  
     5.6  
     5.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
     5.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
     5.9  
    5.10  	This file is part of BeebAsm.
    5.11  
     6.1 --- a/src/commands.cpp	Mon Apr 25 01:14:59 2011 +0200
     6.2 +++ b/src/commands.cpp	Mon Apr 25 02:40:57 2011 +0200
     6.3 @@ -5,7 +5,7 @@
     6.4  	Contains all the LineParser methods for parsing and handling assembler commands
     6.5  
     6.6  
     6.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
     6.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
     6.9  
    6.10  	This file is part of BeebAsm.
    6.11  
     7.1 --- a/src/discimage.cpp	Mon Apr 25 01:14:59 2011 +0200
     7.2 +++ b/src/discimage.cpp	Mon Apr 25 02:40:57 2011 +0200
     7.3 @@ -3,7 +3,7 @@
     7.4  	discimage.cpp
     7.5  
     7.6  
     7.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
     7.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
     7.9  
    7.10  	This file is part of BeebAsm.
    7.11  
     8.1 --- a/src/discimage.h	Mon Apr 25 01:14:59 2011 +0200
     8.2 +++ b/src/discimage.h	Mon Apr 25 02:40:57 2011 +0200
     8.3 @@ -3,7 +3,7 @@
     8.4  	discimage.h
     8.5  
     8.6  
     8.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
     8.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
     8.9  
    8.10  	This file is part of BeebAsm.
    8.11  
     9.1 --- a/src/expression.cpp	Mon Apr 25 01:14:59 2011 +0200
     9.2 +++ b/src/expression.cpp	Mon Apr 25 02:40:57 2011 +0200
     9.3 @@ -5,7 +5,7 @@
     9.4  	Contains all the LineParser methods for parsing and evaluating expressions
     9.5  
     9.6  
     9.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
     9.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
     9.9  
    9.10  	This file is part of BeebAsm.
    9.11  
    10.1 --- a/src/globaldata.cpp	Mon Apr 25 01:14:59 2011 +0200
    10.2 +++ b/src/globaldata.cpp	Mon Apr 25 02:40:57 2011 +0200
    10.3 @@ -3,7 +3,7 @@
    10.4  	globaldata.cpp
    10.5  
    10.6  
    10.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    10.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    10.9  
   10.10  	This file is part of BeebAsm.
   10.11  
    11.1 --- a/src/globaldata.h	Mon Apr 25 01:14:59 2011 +0200
    11.2 +++ b/src/globaldata.h	Mon Apr 25 02:40:57 2011 +0200
    11.3 @@ -3,7 +3,7 @@
    11.4  	globaldata.h
    11.5  
    11.6  
    11.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    11.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    11.9  
   11.10  	This file is part of BeebAsm.
   11.11  
    12.1 --- a/src/lineparser.cpp	Mon Apr 25 01:14:59 2011 +0200
    12.2 +++ b/src/lineparser.cpp	Mon Apr 25 02:40:57 2011 +0200
    12.3 @@ -5,7 +5,7 @@
    12.4  	Represents a line of the source file
    12.5  
    12.6  
    12.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    12.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    12.9  
   12.10  	This file is part of BeebAsm.
   12.11  
    13.1 --- a/src/lineparser.h	Mon Apr 25 01:14:59 2011 +0200
    13.2 +++ b/src/lineparser.h	Mon Apr 25 02:40:57 2011 +0200
    13.3 @@ -3,7 +3,7 @@
    13.4  	lineparser.h
    13.5  
    13.6  
    13.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    13.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    13.9  
   13.10  	This file is part of BeebAsm.
   13.11  
    14.1 --- a/src/macro.cpp	Mon Apr 25 01:14:59 2011 +0200
    14.2 +++ b/src/macro.cpp	Mon Apr 25 02:40:57 2011 +0200
    14.3 @@ -3,7 +3,7 @@
    14.4  	macro.cpp
    14.5  
    14.6  
    14.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    14.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    14.9  
   14.10  	This file is part of BeebAsm.
   14.11  
    15.1 --- a/src/main.cpp	Mon Apr 25 01:14:59 2011 +0200
    15.2 +++ b/src/main.cpp	Mon Apr 25 02:40:57 2011 +0200
    15.3 @@ -5,7 +5,7 @@
    15.4  	Main entry point for the application
    15.5  
    15.6  
    15.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    15.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    15.9  
   15.10  	This file is part of BeebAsm.
   15.11  
    16.1 --- a/src/main.h	Mon Apr 25 01:14:59 2011 +0200
    16.2 +++ b/src/main.h	Mon Apr 25 02:40:57 2011 +0200
    16.3 @@ -3,7 +3,7 @@
    16.4  	main.h
    16.5  
    16.6  
    16.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    16.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    16.9  
   16.10  	This file is part of BeebAsm.
   16.11  
    17.1 --- a/src/objectcode.cpp	Mon Apr 25 01:14:59 2011 +0200
    17.2 +++ b/src/objectcode.cpp	Mon Apr 25 02:40:57 2011 +0200
    17.3 @@ -3,7 +3,7 @@
    17.4  	objectcode.cpp
    17.5  
    17.6  
    17.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    17.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    17.9  
   17.10  	This file is part of BeebAsm.
   17.11  
    18.1 --- a/src/objectcode.h	Mon Apr 25 01:14:59 2011 +0200
    18.2 +++ b/src/objectcode.h	Mon Apr 25 02:40:57 2011 +0200
    18.3 @@ -3,7 +3,7 @@
    18.4  	objectcode.h
    18.5  
    18.6  
    18.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    18.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    18.9  
   18.10  	This file is part of BeebAsm.
   18.11  
    19.1 --- a/src/sourcecode.cpp	Mon Apr 25 01:14:59 2011 +0200
    19.2 +++ b/src/sourcecode.cpp	Mon Apr 25 02:40:57 2011 +0200
    19.3 @@ -5,7 +5,7 @@
    19.4  	Represents a piece of source code, whether from a file, or a macro definition.
    19.5  
    19.6  
    19.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    19.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    19.9  
   19.10  	This file is part of BeebAsm.
   19.11  
    20.1 --- a/src/sourcecode.h	Mon Apr 25 01:14:59 2011 +0200
    20.2 +++ b/src/sourcecode.h	Mon Apr 25 02:40:57 2011 +0200
    20.3 @@ -3,7 +3,7 @@
    20.4  	sourcecode.h
    20.5  
    20.6  
    20.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    20.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    20.9  
   20.10  	This file is part of BeebAsm.
   20.11  
    21.1 --- a/src/sourcefile.cpp	Mon Apr 25 01:14:59 2011 +0200
    21.2 +++ b/src/sourcefile.cpp	Mon Apr 25 02:40:57 2011 +0200
    21.3 @@ -5,7 +5,7 @@
    21.4  	Assembles a file
    21.5  
    21.6  
    21.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    21.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    21.9  
   21.10  	This file is part of BeebAsm.
   21.11  
    22.1 --- a/src/sourcefile.h	Mon Apr 25 01:14:59 2011 +0200
    22.2 +++ b/src/sourcefile.h	Mon Apr 25 02:40:57 2011 +0200
    22.3 @@ -3,7 +3,7 @@
    22.4  	sourcefile.h
    22.5  
    22.6  
    22.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    22.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    22.9  
   22.10  	This file is part of BeebAsm.
   22.11  
    23.1 --- a/src/stringutils.cpp	Mon Apr 25 01:14:59 2011 +0200
    23.2 +++ b/src/stringutils.cpp	Mon Apr 25 02:40:57 2011 +0200
    23.3 @@ -3,7 +3,7 @@
    23.4  	stringutils.cpp
    23.5  
    23.6  
    23.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    23.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    23.9  
   23.10  	This file is part of BeebAsm.
   23.11  
    24.1 --- a/src/stringutils.h	Mon Apr 25 01:14:59 2011 +0200
    24.2 +++ b/src/stringutils.h	Mon Apr 25 02:40:57 2011 +0200
    24.3 @@ -3,7 +3,7 @@
    24.4  	stringutils.h
    24.5  
    24.6  
    24.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    24.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    24.9  
   24.10  	This file is part of BeebAsm.
   24.11  
    25.1 --- a/src/symboltable.cpp	Mon Apr 25 01:14:59 2011 +0200
    25.2 +++ b/src/symboltable.cpp	Mon Apr 25 02:40:57 2011 +0200
    25.3 @@ -3,7 +3,7 @@
    25.4  	symboltable.cpp
    25.5  
    25.6  
    25.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    25.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    25.9  
   25.10  	This file is part of BeebAsm.
   25.11  
    26.1 --- a/src/symboltable.h	Mon Apr 25 01:14:59 2011 +0200
    26.2 +++ b/src/symboltable.h	Mon Apr 25 02:40:57 2011 +0200
    26.3 @@ -3,7 +3,7 @@
    26.4  	symboltable.h
    26.5  
    26.6  
    26.7 -	Copyright (C) Rich Talbot-Watkins 2007, 2008
    26.8 +	Copyright (C) Rich Talbot-Watkins 2007 - 2011
    26.9  
   26.10  	This file is part of BeebAsm.
   26.11