Home » CEEFAX disks » telesoftware4.adl » 15-01-88/T\OSB10

15-01-88/T\OSB10

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » CEEFAX disks » telesoftware4.adl
Filename: 15-01-88/T\OSB10
Read OK:
File size: 3C48 bytes
Load address: 0000
Exec address: FFFFFFFF
File contents
OSBITS - An Exploration of the BBC Micro at Machine Level

By Programmer

...........................................................


Part 10: Opcodes and Error Messages

Two things in this module.  Later I will be looking briefly
at errors and exceptions, in other words things that can go
awry and how to cope with them.  Firstly though a summary of
the commands that a 6502 microprocessor will understand. 
These are in the form of mnemonics and are known as its
opcodes (a piece of jargon I have avoided until now but a
useful shorthand nonetheless!).

Most reference books on the 6502 give the opcodes in
alphabetical order, so I shall be different and group them
according to function.  This will, I hope, make it easy to
pick the one you want for a particular purpose.  I shall not
give details of how many bytes go with the opcode or how
many ticks of the micro's clock it takes to execute one
since this information is more of use when you are refining
your code writing rather than when you are starting out. 
This information should be found in your advanced reference
guides or indeed any book on a 6502.  If this series were a
book then this would be an appendix (with all the bytes and
timings) but in a telesoftware transmission it's more of a
useful aside.

A reminder about addressing modes.  I have talked about the
various modes of addressing in previous modules.  Rather
than describe them by their names, like immediate or
pre-indexed indirect, I shall give you the form of the
opcode if it is available from the 6502.  In all cases all
you need to remember is this:

  #         after the opcode means use a number directly
            (a byte sized number)
  A         means act on the accumulator
  zp        means act on an address in zero page
  mem       means act on an address anywhere else in memory
  (mem)     means act on an address held in location mem
            and mem+1
  mem, Reg  means act on the address mem plus the value
            in Reg

In some cases you will find that where you might expect
(mem) you will find (zp).  In these cases you need to be in
zero page to use that particular addressing mode.  Basically
if it's in brackets it's an indirect address.

There are several cases where you will find an indexed
address in zero page using the X register but not with the Y
register.  Now the assembler will not flag an error if you
try to do, say, an  LDA zp, Y  by mistake, and the assembled
code will almost certainly run correctly.  The only effect
of doing this is that you will not be using a zero page
addressing mode, simply an ordinary mode in zero page.  The
difference is that you will take up one more byte with your
code and use a little more time because of this.  If you use
the incorrect index with one of the indirect modes the
assembler will tell you.

____________________________________________________________

Group 1: Loading and Saving Bytes

LDA - Load the accumulator

LDA #     LDA mem      LDA mem, X     LDA mem, Y
LDA zp    LDA zp, X    LDA (zp, X)    LDA (zp), Y

LDX - Load the X register

LDX #    LDX mem    LDY mem, Y    LDX zp    LDX zp, Y

LDY - Load the Y register

LDY #    LDY mem    LDY mem, X    LDY zp    LDY zp, X

In all these cases after the operation the zero flag and the
negative flag are affected, reflecting the number loaded.

STA - Store the accumulator

STA mem    STA mem, X    STA mem, Y    STA zp    STA zp, X
STA (zp, X)   STA (zp), Y

STX - Store the X register

STX mem    STY zp    STY zp, Y

STY - Store the Y register

STY mem    STY zp    STY zp, X

No flags are affected by storing a byte and the byte still
remains in the register.

____________________________________________________________

Group 2: Transferring between registers, and between a
register and the stack.

The opcodes in this group have only one addressing mode,
called implied mode.

TAX - Transfer the accumulator into the X register

TAY - Transfer the accumulator into the Y register

TXA - Transfer the X register into the accumulator

TYA - Transfer the Y register into the accumulator

TSX - Transfer the stack pointer into the X register

TSX - Transfer the X register to the stack pointer

PHA - Push the accumulator onto the stack

PLA - Pull the accumulator from the stack

PHP - Push the processor status register (the flags byte)
onto the stack.

PLP - Pull the processor status register from the stack

Transfers to a register (not to the stack) affect the zero
and negative flags.  Transfers from a register (again not
the stack) will leave the byte in the original register. 
Pulling the status register from the stack will affect every
flag because the status register is the byte containing the
flags.

The stack pointer should be handled with extreme care or you
will probably crash the machine and have to start again by
pressing BREAK.  Every push to the stack must be balanced by
a pull from the stack later in the execution of the program.

____________________________________________________________

Group 3: Adding, Subtracting and Shifting

ADC - Add to the accumulator, plus the value of the carry
flag, and store in the accumulator.  Addressing modes
exactly as for LDA.

SBC - Subtract from the accumulator, using the carry flag to
borrow from an adjacent byte.  Addressing modes exactly as
for LDA.

The carry, zero, overflow and negative flags are affected by
an ADC and an SBC.

ASL - Arithmetic shift left.  This shifts the bits of
memory, or the accumulator, to the left.  This multiplies
the value of the byte by 2.  Bit 7 moves into the carry flag
and a zero is shifted into bit 0.

ASL A    ASL mem    ASL mem, X    ASL zp    ASL zp, X

The carry flag becomes the old value of bit 7, the negative
flag is set to the value of bit 7 (the old bit 6), the zero
flag is also affected.

LSR - Logical shift right.  The opposite of an ASL this
shifts the bits to the right, moves a zero into bit 7 and
moves bit 0 into the carry flag.  The operation effectively
divides the byte by 2.

Addressing modes as for ASL.  The carry flag is set to the
old value of bit 0, the negative flag is always cleared and
the zero flag is affected.

ROL - Rotate left one bit.  Similar to ASL except that the
carry flag value is transferred into bit 0.  Otherwise the
flags and address modes are as for ASL.

ROR - Rotate right one bit.  Similar to LSR except that the
carry flag value is transferred into bit 7.  Otherwise the
flags and address modes are as for LSR.

In these last two cases, if you were to carry out the
operation 9 times you would be back where you started!  Also
note that as the carry flag is pushed into your byte by ROL
and ROR you should know its state beforehand.

____________________________________________________________

Group 4: Increasing and Decreasing by One

INC - Increase the byte held in a memory location by one.

INC mem    INC mem, X    INC zp    INC zp, X

DEC - Decrease the byte held in a memory location by one.

Addressing modes as for INC.

INX - Increase the X register by one

DEX - Decrease the X register by one

INY - Increase the Y register by one

DEY - Decrease the Y register by one

In all cases in this group the zero and negative flags are
affected by the operation.  Note that if a location or
register contains 255 and is increased it will wrap around
to zero and set the zero flag.  Also decreasing zero by one
produces 255 in the location.

____________________________________________________________

Group 5:  Comparisons

These three opcodes compare the register concerned with a
byte, either in immediate mode (i.e. #) or a byte in memory. 
The processor flags are set accordingly but the register
itself is unchanged.  In fact the processor is subtracting
the number from the accumulator but not storing the result
and the state of the flags reflects this operation.  These
opcodes are very useful.

CMP - Compare with accumulator.  Addressing modes as for
LDA.  Flags as follows:

Carry set if the number was >= to A
Zero set if the number = A
Negative set if bit 7 of the result is set (less useful)

CPX - Compare with the X register

CPX #    CPX mem    CPX zp

Flags as for CMP

CPY - Compare with the Y register.  Addressing and flags as
for CPX.

____________________________________________________________

Group 6:  Branching

All opcodes in this group have a single addressing mode
called relative.  You can only branch +127 or -128 bytes
from your present position.  Any attempt to go further will
result in a 'Branch out of range' error.  (Often a sign that
you ought to be using more subroutines in your loops.)


BCC - Branch when carry is clear

BCS - Branch when carry is set

BEQ - Branch when zero flag is set

BNE - Branch when zero flag is clear

BMI - Branch when negative flag is set

BPL - Branch when negative flag is clear

BVC - Branch when overflow flag is clear

BVS - Branch when overflow flag is set

No flags are affected by a branch and note that the settings
of flags after a CMP, CPX or CPY are given in the previous
section.

You can perform a branch of over the 127/-128 limit by
branching to a label where you have placed a JMP.  This
is known as a long branch.

____________________________________________________________

Group 7:  Jumps

JSR - Jump to a subroutine

JSR mem

RTS - Return from a subroutine

JMP - Jump to a new location

JMP mem    JMP (mem)

In all cases no flags are affected.  Note that with JSR and
RTS the top of the stack is used to hold return addresses
and so no pulls or pushes of registers should occur either
side as they will not work correctly.  There is also a bug
in the 6502 which stops JMP (mem) working correctly if mem
is at the top of a page (i.e. if it ends in &FF).  You will
have to watch for this in your code yourself if you use this
indirect jump.


____________________________________________________________

Group 8:  Logic

AND - AND location with the accumulator and store the result
in the accumulator.

Addressing modes as for LDA.  Zero and negative flags are
affected.

BIT - And location with accumulator but do not store the
result.  Zero flag is set if the result is zero and bits 6
and 7 of the byte held at the location are transferred into
the overflow and negative flags respectively.

BIT mem    BIT zp

EOR - EOR location with the accumulator and store the result
in the accumulator.

Addressing modes as for LDA.  Zero and negative flags are
affected.

ORA - OR location with the accumulator and store the result
in the accumulator.

Addressing modes as for LDA.  Zero and negative flags are
affected.

____________________________________________________________

Group 9:  Setting/Clearing Flags

There is only one addressing mode for this group, implied.

SEC - Set carry flag

CLC - Clear carry flag

SED - Set decimal flag (calculate in BCD)

CLD - Clear decimal flag (calculate in binary)

SEI - Set interrupt disable flag (more on interrupts in a
later module, use with caution.)

CLI - Clear interrupt flag i.e. enable interrupts.

CLV - Clear overflow flag (no implicit setting of this flag)

____________________________________________________________

Group 10:  Others

BRK - BREAK (not like the BREAK key) and force an interrupt. 
This is used in error trapping and sets the break flag.

NOP - No operation, do nothing.  Useful to slow down a loop
or to force bytes onto even byte boundaries for 16bit
working.  Affects no flags.

RTI - Return from an interrupt.  A specialist equivalent to
RTS which I will come onto in a later module.


Recent versions of the 6502 (like the 65C02) contain extra
opcodes which can make for more efficient code.  Things like
storing zero directly with an STZ or a BRA branch always
opcode are useful additions.  However if you want your code
to run in every BBC micro the above list is the limit of
your opcodes.  There were some earlier versions of the 6502
which did not have all these opcodes.  ROR is a code that is
missing from some early 6502s.


Finally a few words about errors and exceptions.  In general
most errors are actually exceptions.  They are where the
result of an operation is outside the limits of correct
operation.  This could be because the user has entered too
large a number or because the program will attempt to divide
by zero.  It could be that the user has entered a number
when you wanted a letter.  Alternatively the escape key
might have been pressed or there might not have been a disc
in the drive when the user tried to write to a file.

I think it is safe to say that you should anticipate every
error condition or exception and build something into your
routine to cope.  In some circumstances your code would
report the error and ask for a re-try and you would not
actually exit the routine.  This is what I am calling
an exception.  In other circumstances your code would exit
and drop you back to the language from which you had called
the routine.  A utility ROM might refuse to carry out an
improper instruction and return you to BASIC; this would be
an error.

Dealing with errors is actually very simple with the BBC
Micro because there is a default routine available in BASIC. 
Other languages I have tried on the BBC Micro also have
error routines which operate in the same way.  Now you could
intercept the break vector and write an error handling
routine of your own but I submit that it is probably not
worth it.  Here's how you use the default routine.

Imagine that you want to generate an error condition when
the code branches to a label called error.  Here is what you
would put at that label.

         .error
         BRK
         EQUB 255
         EQUS "You have just done something silly."
         EQUB 0

The BRK forces a software interrupt and when this happens
the processor automatically jumps down the break vector to
the default routine.  The default routine expects an error
number in the byte following the BRK.  In this example I
have given the number 255.  This is then followed by a
string which the routine will print out.  The string is
terminated by a null (zero) byte.

There is one occasion when this system will fail, and that
is when your code is in a sideways ROM and is not a
language.  To counter this you have to copy your sequence of
bytes into the bottom of the stack (from location &100) and
then point the code there.  I'll deal with this in more
detail when I get onto sideways ROM formatting in a later
module so don't worry about it for the moment.

The assembler routine in this module is a small one which
illustrates this error handling.  You press a key and if you
press a number (0-9) the routine loops but if you press
anything else an error is generated and a message is printed
out.  I have included a special bit of code that deals with
an escape in a different way to the standard escape by
printing a different message.

If you can call this routine from another language (like
View) you will see how it still operates.  If you have a
6502 second processor or a MASTER the easiest way to do so
is using the OS command *GO nnnn where nnnn is the value of
code% in HEX.

The next five modules deal in some detail with input and
output.  Anything involving input needs copious error
handling.  These will also introduce multiplication and
division and by the end of them we will have a way of
inputting and outputting numbers of any size within reason
and our arithmetical work on integers will be complete.
00000000  4f 53 42 49 54 53 20 2d  20 41 6e 20 45 78 70 6c  |OSBITS - An Expl|
00000010  6f 72 61 74 69 6f 6e 20  6f 66 20 74 68 65 20 42  |oration of the B|
00000020  42 43 20 4d 69 63 72 6f  20 61 74 20 4d 61 63 68  |BC Micro at Mach|
00000030  69 6e 65 20 4c 65 76 65  6c 0d 0d 42 79 20 50 72  |ine Level..By Pr|
00000040  6f 67 72 61 6d 6d 65 72  0d 0d 2e 2e 2e 2e 2e 2e  |ogrammer........|
00000050  2e 2e 2e 2e 2e 2e 2e 2e  2e 2e 2e 2e 2e 2e 2e 2e  |................|
*
00000080  2e 2e 2e 2e 2e 0d 0d 0d  50 61 72 74 20 31 30 3a  |........Part 10:|
00000090  20 4f 70 63 6f 64 65 73  20 61 6e 64 20 45 72 72  | Opcodes and Err|
000000a0  6f 72 20 4d 65 73 73 61  67 65 73 0d 0d 54 77 6f  |or Messages..Two|
000000b0  20 74 68 69 6e 67 73 20  69 6e 20 74 68 69 73 20  | things in this |
000000c0  6d 6f 64 75 6c 65 2e 20  20 4c 61 74 65 72 20 49  |module.  Later I|
000000d0  20 77 69 6c 6c 20 62 65  20 6c 6f 6f 6b 69 6e 67  | will be looking|
000000e0  20 62 72 69 65 66 6c 79  0d 61 74 20 65 72 72 6f  | briefly.at erro|
000000f0  72 73 20 61 6e 64 20 65  78 63 65 70 74 69 6f 6e  |rs and exception|
00000100  73 2c 20 69 6e 20 6f 74  68 65 72 20 77 6f 72 64  |s, in other word|
00000110  73 20 74 68 69 6e 67 73  20 74 68 61 74 20 63 61  |s things that ca|
00000120  6e 20 67 6f 0d 61 77 72  79 20 61 6e 64 20 68 6f  |n go.awry and ho|
00000130  77 20 74 6f 20 63 6f 70  65 20 77 69 74 68 20 74  |w to cope with t|
00000140  68 65 6d 2e 20 20 46 69  72 73 74 6c 79 20 74 68  |hem.  Firstly th|
00000150  6f 75 67 68 20 61 20 73  75 6d 6d 61 72 79 20 6f  |ough a summary o|
00000160  66 0d 74 68 65 20 63 6f  6d 6d 61 6e 64 73 20 74  |f.the commands t|
00000170  68 61 74 20 61 20 36 35  30 32 20 6d 69 63 72 6f  |hat a 6502 micro|
00000180  70 72 6f 63 65 73 73 6f  72 20 77 69 6c 6c 20 75  |processor will u|
00000190  6e 64 65 72 73 74 61 6e  64 2e 20 0d 54 68 65 73  |nderstand. .Thes|
000001a0  65 20 61 72 65 20 69 6e  20 74 68 65 20 66 6f 72  |e are in the for|
000001b0  6d 20 6f 66 20 6d 6e 65  6d 6f 6e 69 63 73 20 61  |m of mnemonics a|
000001c0  6e 64 20 61 72 65 20 6b  6e 6f 77 6e 20 61 73 20  |nd are known as |
000001d0  69 74 73 0d 6f 70 63 6f  64 65 73 20 28 61 20 70  |its.opcodes (a p|
000001e0  69 65 63 65 20 6f 66 20  6a 61 72 67 6f 6e 20 49  |iece of jargon I|
000001f0  20 68 61 76 65 20 61 76  6f 69 64 65 64 20 75 6e  | have avoided un|
00000200  74 69 6c 20 6e 6f 77 20  62 75 74 20 61 0d 75 73  |til now but a.us|
00000210  65 66 75 6c 20 73 68 6f  72 74 68 61 6e 64 20 6e  |eful shorthand n|
00000220  6f 6e 65 74 68 65 6c 65  73 73 21 29 2e 0d 0d 4d  |onetheless!)...M|
00000230  6f 73 74 20 72 65 66 65  72 65 6e 63 65 20 62 6f  |ost reference bo|
00000240  6f 6b 73 20 6f 6e 20 74  68 65 20 36 35 30 32 20  |oks on the 6502 |
00000250  67 69 76 65 20 74 68 65  20 6f 70 63 6f 64 65 73  |give the opcodes|
00000260  20 69 6e 0d 61 6c 70 68  61 62 65 74 69 63 61 6c  | in.alphabetical|
00000270  20 6f 72 64 65 72 2c 20  73 6f 20 49 20 73 68 61  | order, so I sha|
00000280  6c 6c 20 62 65 20 64 69  66 66 65 72 65 6e 74 20  |ll be different |
00000290  61 6e 64 20 67 72 6f 75  70 20 74 68 65 6d 0d 61  |and group them.a|
000002a0  63 63 6f 72 64 69 6e 67  20 74 6f 20 66 75 6e 63  |ccording to func|
000002b0  74 69 6f 6e 2e 20 20 54  68 69 73 20 77 69 6c 6c  |tion.  This will|
000002c0  2c 20 49 20 68 6f 70 65  2c 20 6d 61 6b 65 20 69  |, I hope, make i|
000002d0  74 20 65 61 73 79 20 74  6f 0d 70 69 63 6b 20 74  |t easy to.pick t|
000002e0  68 65 20 6f 6e 65 20 79  6f 75 20 77 61 6e 74 20  |he one you want |
000002f0  66 6f 72 20 61 20 70 61  72 74 69 63 75 6c 61 72  |for a particular|
00000300  20 70 75 72 70 6f 73 65  2e 20 20 49 20 73 68 61  | purpose.  I sha|
00000310  6c 6c 20 6e 6f 74 0d 67  69 76 65 20 64 65 74 61  |ll not.give deta|
00000320  69 6c 73 20 6f 66 20 68  6f 77 20 6d 61 6e 79 20  |ils of how many |
00000330  62 79 74 65 73 20 67 6f  20 77 69 74 68 20 74 68  |bytes go with th|
00000340  65 20 6f 70 63 6f 64 65  20 6f 72 20 68 6f 77 0d  |e opcode or how.|
00000350  6d 61 6e 79 20 74 69 63  6b 73 20 6f 66 20 74 68  |many ticks of th|
00000360  65 20 6d 69 63 72 6f 27  73 20 63 6c 6f 63 6b 20  |e micro's clock |
00000370  69 74 20 74 61 6b 65 73  20 74 6f 20 65 78 65 63  |it takes to exec|
00000380  75 74 65 20 6f 6e 65 0d  73 69 6e 63 65 20 74 68  |ute one.since th|
00000390  69 73 20 69 6e 66 6f 72  6d 61 74 69 6f 6e 20 69  |is information i|
000003a0  73 20 6d 6f 72 65 20 6f  66 20 75 73 65 20 77 68  |s more of use wh|
000003b0  65 6e 20 79 6f 75 20 61  72 65 20 72 65 66 69 6e  |en you are refin|
000003c0  69 6e 67 0d 79 6f 75 72  20 63 6f 64 65 20 77 72  |ing.your code wr|
000003d0  69 74 69 6e 67 20 72 61  74 68 65 72 20 74 68 61  |iting rather tha|
000003e0  6e 20 77 68 65 6e 20 79  6f 75 20 61 72 65 20 73  |n when you are s|
000003f0  74 61 72 74 69 6e 67 20  6f 75 74 2e 20 0d 54 68  |tarting out. .Th|
00000400  69 73 20 69 6e 66 6f 72  6d 61 74 69 6f 6e 20 73  |is information s|
00000410  68 6f 75 6c 64 20 62 65  20 66 6f 75 6e 64 20 69  |hould be found i|
00000420  6e 20 79 6f 75 72 20 61  64 76 61 6e 63 65 64 20  |n your advanced |
00000430  72 65 66 65 72 65 6e 63  65 0d 67 75 69 64 65 73  |reference.guides|
00000440  20 6f 72 20 69 6e 64 65  65 64 20 61 6e 79 20 62  | or indeed any b|
00000450  6f 6f 6b 20 6f 6e 20 61  20 36 35 30 32 2e 20 20  |ook on a 6502.  |
00000460  49 66 20 74 68 69 73 20  73 65 72 69 65 73 20 77  |If this series w|
00000470  65 72 65 20 61 0d 62 6f  6f 6b 20 74 68 65 6e 20  |ere a.book then |
00000480  74 68 69 73 20 77 6f 75  6c 64 20 62 65 20 61 6e  |this would be an|
00000490  20 61 70 70 65 6e 64 69  78 20 28 77 69 74 68 20  | appendix (with |
000004a0  61 6c 6c 20 74 68 65 20  62 79 74 65 73 20 61 6e  |all the bytes an|
000004b0  64 0d 74 69 6d 69 6e 67  73 29 20 62 75 74 20 69  |d.timings) but i|
000004c0  6e 20 61 20 74 65 6c 65  73 6f 66 74 77 61 72 65  |n a telesoftware|
000004d0  20 74 72 61 6e 73 6d 69  73 73 69 6f 6e 20 69 74  | transmission it|
000004e0  27 73 20 6d 6f 72 65 20  6f 66 20 61 0d 75 73 65  |'s more of a.use|
000004f0  66 75 6c 20 61 73 69 64  65 2e 0d 0d 41 20 72 65  |ful aside...A re|
00000500  6d 69 6e 64 65 72 20 61  62 6f 75 74 20 61 64 64  |minder about add|
00000510  72 65 73 73 69 6e 67 20  6d 6f 64 65 73 2e 20 20  |ressing modes.  |
00000520  49 20 68 61 76 65 20 74  61 6c 6b 65 64 20 61 62  |I have talked ab|
00000530  6f 75 74 20 74 68 65 0d  76 61 72 69 6f 75 73 20  |out the.various |
00000540  6d 6f 64 65 73 20 6f 66  20 61 64 64 72 65 73 73  |modes of address|
00000550  69 6e 67 20 69 6e 20 70  72 65 76 69 6f 75 73 20  |ing in previous |
00000560  6d 6f 64 75 6c 65 73 2e  20 20 52 61 74 68 65 72  |modules.  Rather|
00000570  0d 74 68 61 6e 20 64 65  73 63 72 69 62 65 20 74  |.than describe t|
00000580  68 65 6d 20 62 79 20 74  68 65 69 72 20 6e 61 6d  |hem by their nam|
00000590  65 73 2c 20 6c 69 6b 65  20 69 6d 6d 65 64 69 61  |es, like immedia|
000005a0  74 65 20 6f 72 0d 70 72  65 2d 69 6e 64 65 78 65  |te or.pre-indexe|
000005b0  64 20 69 6e 64 69 72 65  63 74 2c 20 49 20 73 68  |d indirect, I sh|
000005c0  61 6c 6c 20 67 69 76 65  20 79 6f 75 20 74 68 65  |all give you the|
000005d0  20 66 6f 72 6d 20 6f 66  20 74 68 65 0d 6f 70 63  | form of the.opc|
000005e0  6f 64 65 20 69 66 20 69  74 20 69 73 20 61 76 61  |ode if it is ava|
000005f0  69 6c 61 62 6c 65 20 66  72 6f 6d 20 74 68 65 20  |ilable from the |
00000600  36 35 30 32 2e 20 20 49  6e 20 61 6c 6c 20 63 61  |6502.  In all ca|
00000610  73 65 73 20 61 6c 6c 0d  79 6f 75 20 6e 65 65 64  |ses all.you need|
00000620  20 74 6f 20 72 65 6d 65  6d 62 65 72 20 69 73 20  | to remember is |
00000630  74 68 69 73 3a 0d 0d 20  20 23 20 20 20 20 20 20  |this:..  #      |
00000640  20 20 20 61 66 74 65 72  20 74 68 65 20 6f 70 63  |   after the opc|
00000650  6f 64 65 20 6d 65 61 6e  73 20 75 73 65 20 61 20  |ode means use a |
00000660  6e 75 6d 62 65 72 20 64  69 72 65 63 74 6c 79 0d  |number directly.|
00000670  20 20 20 20 20 20 20 20  20 20 20 20 28 61 20 62  |            (a b|
00000680  79 74 65 20 73 69 7a 65  64 20 6e 75 6d 62 65 72  |yte sized number|
00000690  29 0d 20 20 41 20 20 20  20 20 20 20 20 20 6d 65  |).  A         me|
000006a0  61 6e 73 20 61 63 74 20  6f 6e 20 74 68 65 20 61  |ans act on the a|
000006b0  63 63 75 6d 75 6c 61 74  6f 72 0d 20 20 7a 70 20  |ccumulator.  zp |
000006c0  20 20 20 20 20 20 20 6d  65 61 6e 73 20 61 63 74  |       means act|
000006d0  20 6f 6e 20 61 6e 20 61  64 64 72 65 73 73 20 69  | on an address i|
000006e0  6e 20 7a 65 72 6f 20 70  61 67 65 0d 20 20 6d 65  |n zero page.  me|
000006f0  6d 20 20 20 20 20 20 20  6d 65 61 6e 73 20 61 63  |m       means ac|
00000700  74 20 6f 6e 20 61 6e 20  61 64 64 72 65 73 73 20  |t on an address |
00000710  61 6e 79 77 68 65 72 65  20 65 6c 73 65 20 69 6e  |anywhere else in|
00000720  20 6d 65 6d 6f 72 79 0d  20 20 28 6d 65 6d 29 20  | memory.  (mem) |
00000730  20 20 20 20 6d 65 61 6e  73 20 61 63 74 20 6f 6e  |    means act on|
00000740  20 61 6e 20 61 64 64 72  65 73 73 20 68 65 6c 64  | an address held|
00000750  20 69 6e 20 6c 6f 63 61  74 69 6f 6e 20 6d 65 6d  | in location mem|
00000760  0d 20 20 20 20 20 20 20  20 20 20 20 20 61 6e 64  |.            and|
00000770  20 6d 65 6d 2b 31 0d 20  20 6d 65 6d 2c 20 52 65  | mem+1.  mem, Re|
00000780  67 20 20 6d 65 61 6e 73  20 61 63 74 20 6f 6e 20  |g  means act on |
00000790  74 68 65 20 61 64 64 72  65 73 73 20 6d 65 6d 20  |the address mem |
000007a0  70 6c 75 73 20 74 68 65  20 76 61 6c 75 65 0d 20  |plus the value. |
000007b0  20 20 20 20 20 20 20 20  20 20 20 69 6e 20 52 65  |           in Re|
000007c0  67 0d 0d 49 6e 20 73 6f  6d 65 20 63 61 73 65 73  |g..In some cases|
000007d0  20 79 6f 75 20 77 69 6c  6c 20 66 69 6e 64 20 74  | you will find t|
000007e0  68 61 74 20 77 68 65 72  65 20 79 6f 75 20 6d 69  |hat where you mi|
000007f0  67 68 74 20 65 78 70 65  63 74 0d 28 6d 65 6d 29  |ght expect.(mem)|
00000800  20 79 6f 75 20 77 69 6c  6c 20 66 69 6e 64 20 28  | you will find (|
00000810  7a 70 29 2e 20 20 49 6e  20 74 68 65 73 65 20 63  |zp).  In these c|
00000820  61 73 65 73 20 79 6f 75  20 6e 65 65 64 20 74 6f  |ases you need to|
00000830  20 62 65 20 69 6e 0d 7a  65 72 6f 20 70 61 67 65  | be in.zero page|
00000840  20 74 6f 20 75 73 65 20  74 68 61 74 20 70 61 72  | to use that par|
00000850  74 69 63 75 6c 61 72 20  61 64 64 72 65 73 73 69  |ticular addressi|
00000860  6e 67 20 6d 6f 64 65 2e  20 20 42 61 73 69 63 61  |ng mode.  Basica|
00000870  6c 6c 79 0d 69 66 20 69  74 27 73 20 69 6e 20 62  |lly.if it's in b|
00000880  72 61 63 6b 65 74 73 20  69 74 27 73 20 61 6e 20  |rackets it's an |
00000890  69 6e 64 69 72 65 63 74  20 61 64 64 72 65 73 73  |indirect address|
000008a0  2e 0d 0d 54 68 65 72 65  20 61 72 65 20 73 65 76  |...There are sev|
000008b0  65 72 61 6c 20 63 61 73  65 73 20 77 68 65 72 65  |eral cases where|
000008c0  20 79 6f 75 20 77 69 6c  6c 20 66 69 6e 64 20 61  | you will find a|
000008d0  6e 20 69 6e 64 65 78 65  64 0d 61 64 64 72 65 73  |n indexed.addres|
000008e0  73 20 69 6e 20 7a 65 72  6f 20 70 61 67 65 20 75  |s in zero page u|
000008f0  73 69 6e 67 20 74 68 65  20 58 20 72 65 67 69 73  |sing the X regis|
00000900  74 65 72 20 62 75 74 20  6e 6f 74 20 77 69 74 68  |ter but not with|
00000910  20 74 68 65 20 59 0d 72  65 67 69 73 74 65 72 2e  | the Y.register.|
00000920  20 20 4e 6f 77 20 74 68  65 20 61 73 73 65 6d 62  |  Now the assemb|
00000930  6c 65 72 20 77 69 6c 6c  20 6e 6f 74 20 66 6c 61  |ler will not fla|
00000940  67 20 61 6e 20 65 72 72  6f 72 20 69 66 20 79 6f  |g an error if yo|
00000950  75 0d 74 72 79 20 74 6f  20 64 6f 2c 20 73 61 79  |u.try to do, say|
00000960  2c 20 61 6e 20 20 4c 44  41 20 7a 70 2c 20 59 20  |, an  LDA zp, Y |
00000970  20 62 79 20 6d 69 73 74  61 6b 65 2c 20 61 6e 64  | by mistake, and|
00000980  20 74 68 65 20 61 73 73  65 6d 62 6c 65 64 0d 63  | the assembled.c|
00000990  6f 64 65 20 77 69 6c 6c  20 61 6c 6d 6f 73 74 20  |ode will almost |
000009a0  63 65 72 74 61 69 6e 6c  79 20 72 75 6e 20 63 6f  |certainly run co|
000009b0  72 72 65 63 74 6c 79 2e  20 20 54 68 65 20 6f 6e  |rrectly.  The on|
000009c0  6c 79 20 65 66 66 65 63  74 0d 6f 66 20 64 6f 69  |ly effect.of doi|
000009d0  6e 67 20 74 68 69 73 20  69 73 20 74 68 61 74 20  |ng this is that |
000009e0  79 6f 75 20 77 69 6c 6c  20 6e 6f 74 20 62 65 20  |you will not be |
000009f0  75 73 69 6e 67 20 61 20  7a 65 72 6f 20 70 61 67  |using a zero pag|
00000a00  65 0d 61 64 64 72 65 73  73 69 6e 67 20 6d 6f 64  |e.addressing mod|
00000a10  65 2c 20 73 69 6d 70 6c  79 20 61 6e 20 6f 72 64  |e, simply an ord|
00000a20  69 6e 61 72 79 20 6d 6f  64 65 20 69 6e 20 7a 65  |inary mode in ze|
00000a30  72 6f 20 70 61 67 65 2e  20 20 54 68 65 0d 64 69  |ro page.  The.di|
00000a40  66 66 65 72 65 6e 63 65  20 69 73 20 74 68 61 74  |fference is that|
00000a50  20 79 6f 75 20 77 69 6c  6c 20 74 61 6b 65 20 75  | you will take u|
00000a60  70 20 6f 6e 65 20 6d 6f  72 65 20 62 79 74 65 20  |p one more byte |
00000a70  77 69 74 68 20 79 6f 75  72 0d 63 6f 64 65 20 61  |with your.code a|
00000a80  6e 64 20 75 73 65 20 61  20 6c 69 74 74 6c 65 20  |nd use a little |
00000a90  6d 6f 72 65 20 74 69 6d  65 20 62 65 63 61 75 73  |more time becaus|
00000aa0  65 20 6f 66 20 74 68 69  73 2e 20 20 49 66 20 79  |e of this.  If y|
00000ab0  6f 75 20 75 73 65 0d 74  68 65 20 69 6e 63 6f 72  |ou use.the incor|
00000ac0  72 65 63 74 20 69 6e 64  65 78 20 77 69 74 68 20  |rect index with |
00000ad0  6f 6e 65 20 6f 66 20 74  68 65 20 69 6e 64 69 72  |one of the indir|
00000ae0  65 63 74 20 6d 6f 64 65  73 20 74 68 65 0d 61 73  |ect modes the.as|
00000af0  73 65 6d 62 6c 65 72 20  77 69 6c 6c 20 74 65 6c  |sembler will tel|
00000b00  6c 20 79 6f 75 2e 0d 0d  5f 5f 5f 5f 5f 5f 5f 5f  |l you...________|
00000b10  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00000b40  5f 5f 5f 5f 0d 0d 47 72  6f 75 70 20 31 3a 20 4c  |____..Group 1: L|
00000b50  6f 61 64 69 6e 67 20 61  6e 64 20 53 61 76 69 6e  |oading and Savin|
00000b60  67 20 42 79 74 65 73 0d  0d 4c 44 41 20 2d 20 4c  |g Bytes..LDA - L|
00000b70  6f 61 64 20 74 68 65 20  61 63 63 75 6d 75 6c 61  |oad the accumula|
00000b80  74 6f 72 0d 0d 4c 44 41  20 23 20 20 20 20 20 4c  |tor..LDA #     L|
00000b90  44 41 20 6d 65 6d 20 20  20 20 20 20 4c 44 41 20  |DA mem      LDA |
00000ba0  6d 65 6d 2c 20 58 20 20  20 20 20 4c 44 41 20 6d  |mem, X     LDA m|
00000bb0  65 6d 2c 20 59 0d 4c 44  41 20 7a 70 20 20 20 20  |em, Y.LDA zp    |
00000bc0  4c 44 41 20 7a 70 2c 20  58 20 20 20 20 4c 44 41  |LDA zp, X    LDA|
00000bd0  20 28 7a 70 2c 20 58 29  20 20 20 20 4c 44 41 20  | (zp, X)    LDA |
00000be0  28 7a 70 29 2c 20 59 0d  0d 4c 44 58 20 2d 20 4c  |(zp), Y..LDX - L|
00000bf0  6f 61 64 20 74 68 65 20  58 20 72 65 67 69 73 74  |oad the X regist|
00000c00  65 72 0d 0d 4c 44 58 20  23 20 20 20 20 4c 44 58  |er..LDX #    LDX|
00000c10  20 6d 65 6d 20 20 20 20  4c 44 59 20 6d 65 6d 2c  | mem    LDY mem,|
00000c20  20 59 20 20 20 20 4c 44  58 20 7a 70 20 20 20 20  | Y    LDX zp    |
00000c30  4c 44 58 20 7a 70 2c 20  59 0d 0d 4c 44 59 20 2d  |LDX zp, Y..LDY -|
00000c40  20 4c 6f 61 64 20 74 68  65 20 59 20 72 65 67 69  | Load the Y regi|
00000c50  73 74 65 72 0d 0d 4c 44  59 20 23 20 20 20 20 4c  |ster..LDY #    L|
00000c60  44 59 20 6d 65 6d 20 20  20 20 4c 44 59 20 6d 65  |DY mem    LDY me|
00000c70  6d 2c 20 58 20 20 20 20  4c 44 59 20 7a 70 20 20  |m, X    LDY zp  |
00000c80  20 20 4c 44 59 20 7a 70  2c 20 58 0d 0d 49 6e 20  |  LDY zp, X..In |
00000c90  61 6c 6c 20 74 68 65 73  65 20 63 61 73 65 73 20  |all these cases |
00000ca0  61 66 74 65 72 20 74 68  65 20 6f 70 65 72 61 74  |after the operat|
00000cb0  69 6f 6e 20 74 68 65 20  7a 65 72 6f 20 66 6c 61  |ion the zero fla|
00000cc0  67 20 61 6e 64 20 74 68  65 0d 6e 65 67 61 74 69  |g and the.negati|
00000cd0  76 65 20 66 6c 61 67 20  61 72 65 20 61 66 66 65  |ve flag are affe|
00000ce0  63 74 65 64 2c 20 72 65  66 6c 65 63 74 69 6e 67  |cted, reflecting|
00000cf0  20 74 68 65 20 6e 75 6d  62 65 72 20 6c 6f 61 64  | the number load|
00000d00  65 64 2e 0d 0d 53 54 41  20 2d 20 53 74 6f 72 65  |ed...STA - Store|
00000d10  20 74 68 65 20 61 63 63  75 6d 75 6c 61 74 6f 72  | the accumulator|
00000d20  0d 0d 53 54 41 20 6d 65  6d 20 20 20 20 53 54 41  |..STA mem    STA|
00000d30  20 6d 65 6d 2c 20 58 20  20 20 20 53 54 41 20 6d  | mem, X    STA m|
00000d40  65 6d 2c 20 59 20 20 20  20 53 54 41 20 7a 70 20  |em, Y    STA zp |
00000d50  20 20 20 53 54 41 20 7a  70 2c 20 58 0d 53 54 41  |   STA zp, X.STA|
00000d60  20 28 7a 70 2c 20 58 29  20 20 20 53 54 41 20 28  | (zp, X)   STA (|
00000d70  7a 70 29 2c 20 59 0d 0d  53 54 58 20 2d 20 53 74  |zp), Y..STX - St|
00000d80  6f 72 65 20 74 68 65 20  58 20 72 65 67 69 73 74  |ore the X regist|
00000d90  65 72 0d 0d 53 54 58 20  6d 65 6d 20 20 20 20 53  |er..STX mem    S|
00000da0  54 59 20 7a 70 20 20 20  20 53 54 59 20 7a 70 2c  |TY zp    STY zp,|
00000db0  20 59 0d 0d 53 54 59 20  2d 20 53 74 6f 72 65 20  | Y..STY - Store |
00000dc0  74 68 65 20 59 20 72 65  67 69 73 74 65 72 0d 0d  |the Y register..|
00000dd0  53 54 59 20 6d 65 6d 20  20 20 20 53 54 59 20 7a  |STY mem    STY z|
00000de0  70 20 20 20 20 53 54 59  20 7a 70 2c 20 58 0d 0d  |p    STY zp, X..|
00000df0  4e 6f 20 66 6c 61 67 73  20 61 72 65 20 61 66 66  |No flags are aff|
00000e00  65 63 74 65 64 20 62 79  20 73 74 6f 72 69 6e 67  |ected by storing|
00000e10  20 61 20 62 79 74 65 20  61 6e 64 20 74 68 65 20  | a byte and the |
00000e20  62 79 74 65 20 73 74 69  6c 6c 0d 72 65 6d 61 69  |byte still.remai|
00000e30  6e 73 20 69 6e 20 74 68  65 20 72 65 67 69 73 74  |ns in the regist|
00000e40  65 72 2e 0d 0d 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |er...___________|
00000e50  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00000e80  5f 0d 0d 47 72 6f 75 70  20 32 3a 20 54 72 61 6e  |_..Group 2: Tran|
00000e90  73 66 65 72 72 69 6e 67  20 62 65 74 77 65 65 6e  |sferring between|
00000ea0  20 72 65 67 69 73 74 65  72 73 2c 20 61 6e 64 20  | registers, and |
00000eb0  62 65 74 77 65 65 6e 20  61 0d 72 65 67 69 73 74  |between a.regist|
00000ec0  65 72 20 61 6e 64 20 74  68 65 20 73 74 61 63 6b  |er and the stack|
00000ed0  2e 0d 0d 54 68 65 20 6f  70 63 6f 64 65 73 20 69  |...The opcodes i|
00000ee0  6e 20 74 68 69 73 20 67  72 6f 75 70 20 68 61 76  |n this group hav|
00000ef0  65 20 6f 6e 6c 79 20 6f  6e 65 20 61 64 64 72 65  |e only one addre|
00000f00  73 73 69 6e 67 20 6d 6f  64 65 2c 0d 63 61 6c 6c  |ssing mode,.call|
00000f10  65 64 20 69 6d 70 6c 69  65 64 20 6d 6f 64 65 2e  |ed implied mode.|
00000f20  0d 0d 54 41 58 20 2d 20  54 72 61 6e 73 66 65 72  |..TAX - Transfer|
00000f30  20 74 68 65 20 61 63 63  75 6d 75 6c 61 74 6f 72  | the accumulator|
00000f40  20 69 6e 74 6f 20 74 68  65 20 58 20 72 65 67 69  | into the X regi|
00000f50  73 74 65 72 0d 0d 54 41  59 20 2d 20 54 72 61 6e  |ster..TAY - Tran|
00000f60  73 66 65 72 20 74 68 65  20 61 63 63 75 6d 75 6c  |sfer the accumul|
00000f70  61 74 6f 72 20 69 6e 74  6f 20 74 68 65 20 59 20  |ator into the Y |
00000f80  72 65 67 69 73 74 65 72  0d 0d 54 58 41 20 2d 20  |register..TXA - |
00000f90  54 72 61 6e 73 66 65 72  20 74 68 65 20 58 20 72  |Transfer the X r|
00000fa0  65 67 69 73 74 65 72 20  69 6e 74 6f 20 74 68 65  |egister into the|
00000fb0  20 61 63 63 75 6d 75 6c  61 74 6f 72 0d 0d 54 59  | accumulator..TY|
00000fc0  41 20 2d 20 54 72 61 6e  73 66 65 72 20 74 68 65  |A - Transfer the|
00000fd0  20 59 20 72 65 67 69 73  74 65 72 20 69 6e 74 6f  | Y register into|
00000fe0  20 74 68 65 20 61 63 63  75 6d 75 6c 61 74 6f 72  | the accumulator|
00000ff0  0d 0d 54 53 58 20 2d 20  54 72 61 6e 73 66 65 72  |..TSX - Transfer|
00001000  20 74 68 65 20 73 74 61  63 6b 20 70 6f 69 6e 74  | the stack point|
00001010  65 72 20 69 6e 74 6f 20  74 68 65 20 58 20 72 65  |er into the X re|
00001020  67 69 73 74 65 72 0d 0d  54 53 58 20 2d 20 54 72  |gister..TSX - Tr|
00001030  61 6e 73 66 65 72 20 74  68 65 20 58 20 72 65 67  |ansfer the X reg|
00001040  69 73 74 65 72 20 74 6f  20 74 68 65 20 73 74 61  |ister to the sta|
00001050  63 6b 20 70 6f 69 6e 74  65 72 0d 0d 50 48 41 20  |ck pointer..PHA |
00001060  2d 20 50 75 73 68 20 74  68 65 20 61 63 63 75 6d  |- Push the accum|
00001070  75 6c 61 74 6f 72 20 6f  6e 74 6f 20 74 68 65 20  |ulator onto the |
00001080  73 74 61 63 6b 0d 0d 50  4c 41 20 2d 20 50 75 6c  |stack..PLA - Pul|
00001090  6c 20 74 68 65 20 61 63  63 75 6d 75 6c 61 74 6f  |l the accumulato|
000010a0  72 20 66 72 6f 6d 20 74  68 65 20 73 74 61 63 6b  |r from the stack|
000010b0  0d 0d 50 48 50 20 2d 20  50 75 73 68 20 74 68 65  |..PHP - Push the|
000010c0  20 70 72 6f 63 65 73 73  6f 72 20 73 74 61 74 75  | processor statu|
000010d0  73 20 72 65 67 69 73 74  65 72 20 28 74 68 65 20  |s register (the |
000010e0  66 6c 61 67 73 20 62 79  74 65 29 0d 6f 6e 74 6f  |flags byte).onto|
000010f0  20 74 68 65 20 73 74 61  63 6b 2e 0d 0d 50 4c 50  | the stack...PLP|
00001100  20 2d 20 50 75 6c 6c 20  74 68 65 20 70 72 6f 63  | - Pull the proc|
00001110  65 73 73 6f 72 20 73 74  61 74 75 73 20 72 65 67  |essor status reg|
00001120  69 73 74 65 72 20 66 72  6f 6d 20 74 68 65 20 73  |ister from the s|
00001130  74 61 63 6b 0d 0d 54 72  61 6e 73 66 65 72 73 20  |tack..Transfers |
00001140  74 6f 20 61 20 72 65 67  69 73 74 65 72 20 28 6e  |to a register (n|
00001150  6f 74 20 74 6f 20 74 68  65 20 73 74 61 63 6b 29  |ot to the stack)|
00001160  20 61 66 66 65 63 74 20  74 68 65 20 7a 65 72 6f  | affect the zero|
00001170  0d 61 6e 64 20 6e 65 67  61 74 69 76 65 20 66 6c  |.and negative fl|
00001180  61 67 73 2e 20 20 54 72  61 6e 73 66 65 72 73 20  |ags.  Transfers |
00001190  66 72 6f 6d 20 61 20 72  65 67 69 73 74 65 72 20  |from a register |
000011a0  28 61 67 61 69 6e 20 6e  6f 74 0d 74 68 65 20 73  |(again not.the s|
000011b0  74 61 63 6b 29 20 77 69  6c 6c 20 6c 65 61 76 65  |tack) will leave|
000011c0  20 74 68 65 20 62 79 74  65 20 69 6e 20 74 68 65  | the byte in the|
000011d0  20 6f 72 69 67 69 6e 61  6c 20 72 65 67 69 73 74  | original regist|
000011e0  65 72 2e 20 0d 50 75 6c  6c 69 6e 67 20 74 68 65  |er. .Pulling the|
000011f0  20 73 74 61 74 75 73 20  72 65 67 69 73 74 65 72  | status register|
00001200  20 66 72 6f 6d 20 74 68  65 20 73 74 61 63 6b 20  | from the stack |
00001210  77 69 6c 6c 20 61 66 66  65 63 74 20 65 76 65 72  |will affect ever|
00001220  79 0d 66 6c 61 67 20 62  65 63 61 75 73 65 20 74  |y.flag because t|
00001230  68 65 20 73 74 61 74 75  73 20 72 65 67 69 73 74  |he status regist|
00001240  65 72 20 69 73 20 74 68  65 20 62 79 74 65 20 63  |er is the byte c|
00001250  6f 6e 74 61 69 6e 69 6e  67 20 74 68 65 0d 66 6c  |ontaining the.fl|
00001260  61 67 73 2e 0d 0d 54 68  65 20 73 74 61 63 6b 20  |ags...The stack |
00001270  70 6f 69 6e 74 65 72 20  73 68 6f 75 6c 64 20 62  |pointer should b|
00001280  65 20 68 61 6e 64 6c 65  64 20 77 69 74 68 20 65  |e handled with e|
00001290  78 74 72 65 6d 65 20 63  61 72 65 20 6f 72 20 79  |xtreme care or y|
000012a0  6f 75 0d 77 69 6c 6c 20  70 72 6f 62 61 62 6c 79  |ou.will probably|
000012b0  20 63 72 61 73 68 20 74  68 65 20 6d 61 63 68 69  | crash the machi|
000012c0  6e 65 20 61 6e 64 20 68  61 76 65 20 74 6f 20 73  |ne and have to s|
000012d0  74 61 72 74 20 61 67 61  69 6e 20 62 79 0d 70 72  |tart again by.pr|
000012e0  65 73 73 69 6e 67 20 42  52 45 41 4b 2e 20 20 45  |essing BREAK.  E|
000012f0  76 65 72 79 20 70 75 73  68 20 74 6f 20 74 68 65  |very push to the|
00001300  20 73 74 61 63 6b 20 6d  75 73 74 20 62 65 20 62  | stack must be b|
00001310  61 6c 61 6e 63 65 64 20  62 79 0d 61 20 70 75 6c  |alanced by.a pul|
00001320  6c 20 66 72 6f 6d 20 74  68 65 20 73 74 61 63 6b  |l from the stack|
00001330  20 6c 61 74 65 72 20 69  6e 20 74 68 65 20 65 78  | later in the ex|
00001340  65 63 75 74 69 6f 6e 20  6f 66 20 74 68 65 20 70  |ecution of the p|
00001350  72 6f 67 72 61 6d 2e 0d  0d 5f 5f 5f 5f 5f 5f 5f  |rogram..._______|
00001360  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00001390  5f 5f 5f 5f 5f 0d 0d 47  72 6f 75 70 20 33 3a 20  |_____..Group 3: |
000013a0  41 64 64 69 6e 67 2c 20  53 75 62 74 72 61 63 74  |Adding, Subtract|
000013b0  69 6e 67 20 61 6e 64 20  53 68 69 66 74 69 6e 67  |ing and Shifting|
000013c0  0d 0d 41 44 43 20 2d 20  41 64 64 20 74 6f 20 74  |..ADC - Add to t|
000013d0  68 65 20 61 63 63 75 6d  75 6c 61 74 6f 72 2c 20  |he accumulator, |
000013e0  70 6c 75 73 20 74 68 65  20 76 61 6c 75 65 20 6f  |plus the value o|
000013f0  66 20 74 68 65 20 63 61  72 72 79 0d 66 6c 61 67  |f the carry.flag|
00001400  2c 20 61 6e 64 20 73 74  6f 72 65 20 69 6e 20 74  |, and store in t|
00001410  68 65 20 61 63 63 75 6d  75 6c 61 74 6f 72 2e 20  |he accumulator. |
00001420  20 41 64 64 72 65 73 73  69 6e 67 20 6d 6f 64 65  | Addressing mode|
00001430  73 0d 65 78 61 63 74 6c  79 20 61 73 20 66 6f 72  |s.exactly as for|
00001440  20 4c 44 41 2e 0d 0d 53  42 43 20 2d 20 53 75 62  | LDA...SBC - Sub|
00001450  74 72 61 63 74 20 66 72  6f 6d 20 74 68 65 20 61  |tract from the a|
00001460  63 63 75 6d 75 6c 61 74  6f 72 2c 20 75 73 69 6e  |ccumulator, usin|
00001470  67 20 74 68 65 20 63 61  72 72 79 20 66 6c 61 67  |g the carry flag|
00001480  20 74 6f 0d 62 6f 72 72  6f 77 20 66 72 6f 6d 20  | to.borrow from |
00001490  61 6e 20 61 64 6a 61 63  65 6e 74 20 62 79 74 65  |an adjacent byte|
000014a0  2e 20 20 41 64 64 72 65  73 73 69 6e 67 20 6d 6f  |.  Addressing mo|
000014b0  64 65 73 20 65 78 61 63  74 6c 79 20 61 73 0d 66  |des exactly as.f|
000014c0  6f 72 20 4c 44 41 2e 0d  0d 54 68 65 20 63 61 72  |or LDA...The car|
000014d0  72 79 2c 20 7a 65 72 6f  2c 20 6f 76 65 72 66 6c  |ry, zero, overfl|
000014e0  6f 77 20 61 6e 64 20 6e  65 67 61 74 69 76 65 20  |ow and negative |
000014f0  66 6c 61 67 73 20 61 72  65 20 61 66 66 65 63 74  |flags are affect|
00001500  65 64 20 62 79 0d 61 6e  20 41 44 43 20 61 6e 64  |ed by.an ADC and|
00001510  20 61 6e 20 53 42 43 2e  0d 0d 41 53 4c 20 2d 20  | an SBC...ASL - |
00001520  41 72 69 74 68 6d 65 74  69 63 20 73 68 69 66 74  |Arithmetic shift|
00001530  20 6c 65 66 74 2e 20 20  54 68 69 73 20 73 68 69  | left.  This shi|
00001540  66 74 73 20 74 68 65 20  62 69 74 73 20 6f 66 0d  |fts the bits of.|
00001550  6d 65 6d 6f 72 79 2c 20  6f 72 20 74 68 65 20 61  |memory, or the a|
00001560  63 63 75 6d 75 6c 61 74  6f 72 2c 20 74 6f 20 74  |ccumulator, to t|
00001570  68 65 20 6c 65 66 74 2e  20 20 54 68 69 73 20 6d  |he left.  This m|
00001580  75 6c 74 69 70 6c 69 65  73 0d 74 68 65 20 76 61  |ultiplies.the va|
00001590  6c 75 65 20 6f 66 20 74  68 65 20 62 79 74 65 20  |lue of the byte |
000015a0  62 79 20 32 2e 20 20 42  69 74 20 37 20 6d 6f 76  |by 2.  Bit 7 mov|
000015b0  65 73 20 69 6e 74 6f 20  74 68 65 20 63 61 72 72  |es into the carr|
000015c0  79 20 66 6c 61 67 0d 61  6e 64 20 61 20 7a 65 72  |y flag.and a zer|
000015d0  6f 20 69 73 20 73 68 69  66 74 65 64 20 69 6e 74  |o is shifted int|
000015e0  6f 20 62 69 74 20 30 2e  0d 0d 41 53 4c 20 41 20  |o bit 0...ASL A |
000015f0  20 20 20 41 53 4c 20 6d  65 6d 20 20 20 20 41 53  |   ASL mem    AS|
00001600  4c 20 6d 65 6d 2c 20 58  20 20 20 20 41 53 4c 20  |L mem, X    ASL |
00001610  7a 70 20 20 20 20 41 53  4c 20 7a 70 2c 20 58 0d  |zp    ASL zp, X.|
00001620  0d 54 68 65 20 63 61 72  72 79 20 66 6c 61 67 20  |.The carry flag |
00001630  62 65 63 6f 6d 65 73 20  74 68 65 20 6f 6c 64 20  |becomes the old |
00001640  76 61 6c 75 65 20 6f 66  20 62 69 74 20 37 2c 20  |value of bit 7, |
00001650  74 68 65 20 6e 65 67 61  74 69 76 65 0d 66 6c 61  |the negative.fla|
00001660  67 20 69 73 20 73 65 74  20 74 6f 20 74 68 65 20  |g is set to the |
00001670  76 61 6c 75 65 20 6f 66  20 62 69 74 20 37 20 28  |value of bit 7 (|
00001680  74 68 65 20 6f 6c 64 20  62 69 74 20 36 29 2c 20  |the old bit 6), |
00001690  74 68 65 20 7a 65 72 6f  0d 66 6c 61 67 20 69 73  |the zero.flag is|
000016a0  20 61 6c 73 6f 20 61 66  66 65 63 74 65 64 2e 0d  | also affected..|
000016b0  0d 4c 53 52 20 2d 20 4c  6f 67 69 63 61 6c 20 73  |.LSR - Logical s|
000016c0  68 69 66 74 20 72 69 67  68 74 2e 20 20 54 68 65  |hift right.  The|
000016d0  20 6f 70 70 6f 73 69 74  65 20 6f 66 20 61 6e 20  | opposite of an |
000016e0  41 53 4c 20 74 68 69 73  0d 73 68 69 66 74 73 20  |ASL this.shifts |
000016f0  74 68 65 20 62 69 74 73  20 74 6f 20 74 68 65 20  |the bits to the |
00001700  72 69 67 68 74 2c 20 6d  6f 76 65 73 20 61 20 7a  |right, moves a z|
00001710  65 72 6f 20 69 6e 74 6f  20 62 69 74 20 37 20 61  |ero into bit 7 a|
00001720  6e 64 0d 6d 6f 76 65 73  20 62 69 74 20 30 20 69  |nd.moves bit 0 i|
00001730  6e 74 6f 20 74 68 65 20  63 61 72 72 79 20 66 6c  |nto the carry fl|
00001740  61 67 2e 20 20 54 68 65  20 6f 70 65 72 61 74 69  |ag.  The operati|
00001750  6f 6e 20 65 66 66 65 63  74 69 76 65 6c 79 0d 64  |on effectively.d|
00001760  69 76 69 64 65 73 20 74  68 65 20 62 79 74 65 20  |ivides the byte |
00001770  62 79 20 32 2e 0d 0d 41  64 64 72 65 73 73 69 6e  |by 2...Addressin|
00001780  67 20 6d 6f 64 65 73 20  61 73 20 66 6f 72 20 41  |g modes as for A|
00001790  53 4c 2e 20 20 54 68 65  20 63 61 72 72 79 20 66  |SL.  The carry f|
000017a0  6c 61 67 20 69 73 20 73  65 74 20 74 6f 20 74 68  |lag is set to th|
000017b0  65 0d 6f 6c 64 20 76 61  6c 75 65 20 6f 66 20 62  |e.old value of b|
000017c0  69 74 20 30 2c 20 74 68  65 20 6e 65 67 61 74 69  |it 0, the negati|
000017d0  76 65 20 66 6c 61 67 20  69 73 20 61 6c 77 61 79  |ve flag is alway|
000017e0  73 20 63 6c 65 61 72 65  64 20 61 6e 64 0d 74 68  |s cleared and.th|
000017f0  65 20 7a 65 72 6f 20 66  6c 61 67 20 69 73 20 61  |e zero flag is a|
00001800  66 66 65 63 74 65 64 2e  0d 0d 52 4f 4c 20 2d 20  |ffected...ROL - |
00001810  52 6f 74 61 74 65 20 6c  65 66 74 20 6f 6e 65 20  |Rotate left one |
00001820  62 69 74 2e 20 20 53 69  6d 69 6c 61 72 20 74 6f  |bit.  Similar to|
00001830  20 41 53 4c 20 65 78 63  65 70 74 20 74 68 61 74  | ASL except that|
00001840  20 74 68 65 0d 63 61 72  72 79 20 66 6c 61 67 20  | the.carry flag |
00001850  76 61 6c 75 65 20 69 73  20 74 72 61 6e 73 66 65  |value is transfe|
00001860  72 72 65 64 20 69 6e 74  6f 20 62 69 74 20 30 2e  |rred into bit 0.|
00001870  20 20 4f 74 68 65 72 77  69 73 65 20 74 68 65 0d  |  Otherwise the.|
00001880  66 6c 61 67 73 20 61 6e  64 20 61 64 64 72 65 73  |flags and addres|
00001890  73 20 6d 6f 64 65 73 20  61 72 65 20 61 73 20 66  |s modes are as f|
000018a0  6f 72 20 41 53 4c 2e 0d  0d 52 4f 52 20 2d 20 52  |or ASL...ROR - R|
000018b0  6f 74 61 74 65 20 72 69  67 68 74 20 6f 6e 65 20  |otate right one |
000018c0  62 69 74 2e 20 20 53 69  6d 69 6c 61 72 20 74 6f  |bit.  Similar to|
000018d0  20 4c 53 52 20 65 78 63  65 70 74 20 74 68 61 74  | LSR except that|
000018e0  20 74 68 65 0d 63 61 72  72 79 20 66 6c 61 67 20  | the.carry flag |
000018f0  76 61 6c 75 65 20 69 73  20 74 72 61 6e 73 66 65  |value is transfe|
00001900  72 72 65 64 20 69 6e 74  6f 20 62 69 74 20 37 2e  |rred into bit 7.|
00001910  20 20 4f 74 68 65 72 77  69 73 65 20 74 68 65 0d  |  Otherwise the.|
00001920  66 6c 61 67 73 20 61 6e  64 20 61 64 64 72 65 73  |flags and addres|
00001930  73 20 6d 6f 64 65 73 20  61 72 65 20 61 73 20 66  |s modes are as f|
00001940  6f 72 20 4c 53 52 2e 0d  0d 49 6e 20 74 68 65 73  |or LSR...In thes|
00001950  65 20 6c 61 73 74 20 74  77 6f 20 63 61 73 65 73  |e last two cases|
00001960  2c 20 69 66 20 79 6f 75  20 77 65 72 65 20 74 6f  |, if you were to|
00001970  20 63 61 72 72 79 20 6f  75 74 20 74 68 65 0d 6f  | carry out the.o|
00001980  70 65 72 61 74 69 6f 6e  20 39 20 74 69 6d 65 73  |peration 9 times|
00001990  20 79 6f 75 20 77 6f 75  6c 64 20 62 65 20 62 61  | you would be ba|
000019a0  63 6b 20 77 68 65 72 65  20 79 6f 75 20 73 74 61  |ck where you sta|
000019b0  72 74 65 64 21 20 20 41  6c 73 6f 0d 6e 6f 74 65  |rted!  Also.note|
000019c0  20 74 68 61 74 20 61 73  20 74 68 65 20 63 61 72  | that as the car|
000019d0  72 79 20 66 6c 61 67 20  69 73 20 70 75 73 68 65  |ry flag is pushe|
000019e0  64 20 69 6e 74 6f 20 79  6f 75 72 20 62 79 74 65  |d into your byte|
000019f0  20 62 79 20 52 4f 4c 0d  61 6e 64 20 52 4f 52 20  | by ROL.and ROR |
00001a00  79 6f 75 20 73 68 6f 75  6c 64 20 6b 6e 6f 77 20  |you should know |
00001a10  69 74 73 20 73 74 61 74  65 20 62 65 66 6f 72 65  |its state before|
00001a20  68 61 6e 64 2e 0d 0d 5f  5f 5f 5f 5f 5f 5f 5f 5f  |hand..._________|
00001a30  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00001a60  5f 5f 5f 0d 0d 47 72 6f  75 70 20 34 3a 20 49 6e  |___..Group 4: In|
00001a70  63 72 65 61 73 69 6e 67  20 61 6e 64 20 44 65 63  |creasing and Dec|
00001a80  72 65 61 73 69 6e 67 20  62 79 20 4f 6e 65 0d 0d  |reasing by One..|
00001a90  49 4e 43 20 2d 20 49 6e  63 72 65 61 73 65 20 74  |INC - Increase t|
00001aa0  68 65 20 62 79 74 65 20  68 65 6c 64 20 69 6e 20  |he byte held in |
00001ab0  61 20 6d 65 6d 6f 72 79  20 6c 6f 63 61 74 69 6f  |a memory locatio|
00001ac0  6e 20 62 79 20 6f 6e 65  2e 0d 0d 49 4e 43 20 6d  |n by one...INC m|
00001ad0  65 6d 20 20 20 20 49 4e  43 20 6d 65 6d 2c 20 58  |em    INC mem, X|
00001ae0  20 20 20 20 49 4e 43 20  7a 70 20 20 20 20 49 4e  |    INC zp    IN|
00001af0  43 20 7a 70 2c 20 58 0d  0d 44 45 43 20 2d 20 44  |C zp, X..DEC - D|
00001b00  65 63 72 65 61 73 65 20  74 68 65 20 62 79 74 65  |ecrease the byte|
00001b10  20 68 65 6c 64 20 69 6e  20 61 20 6d 65 6d 6f 72  | held in a memor|
00001b20  79 20 6c 6f 63 61 74 69  6f 6e 20 62 79 20 6f 6e  |y location by on|
00001b30  65 2e 0d 0d 41 64 64 72  65 73 73 69 6e 67 20 6d  |e...Addressing m|
00001b40  6f 64 65 73 20 61 73 20  66 6f 72 20 49 4e 43 2e  |odes as for INC.|
00001b50  0d 0d 49 4e 58 20 2d 20  49 6e 63 72 65 61 73 65  |..INX - Increase|
00001b60  20 74 68 65 20 58 20 72  65 67 69 73 74 65 72 20  | the X register |
00001b70  62 79 20 6f 6e 65 0d 0d  44 45 58 20 2d 20 44 65  |by one..DEX - De|
00001b80  63 72 65 61 73 65 20 74  68 65 20 58 20 72 65 67  |crease the X reg|
00001b90  69 73 74 65 72 20 62 79  20 6f 6e 65 0d 0d 49 4e  |ister by one..IN|
00001ba0  59 20 2d 20 49 6e 63 72  65 61 73 65 20 74 68 65  |Y - Increase the|
00001bb0  20 59 20 72 65 67 69 73  74 65 72 20 62 79 20 6f  | Y register by o|
00001bc0  6e 65 0d 0d 44 45 59 20  2d 20 44 65 63 72 65 61  |ne..DEY - Decrea|
00001bd0  73 65 20 74 68 65 20 59  20 72 65 67 69 73 74 65  |se the Y registe|
00001be0  72 20 62 79 20 6f 6e 65  0d 0d 49 6e 20 61 6c 6c  |r by one..In all|
00001bf0  20 63 61 73 65 73 20 69  6e 20 74 68 69 73 20 67  | cases in this g|
00001c00  72 6f 75 70 20 74 68 65  20 7a 65 72 6f 20 61 6e  |roup the zero an|
00001c10  64 20 6e 65 67 61 74 69  76 65 20 66 6c 61 67 73  |d negative flags|
00001c20  20 61 72 65 0d 61 66 66  65 63 74 65 64 20 62 79  | are.affected by|
00001c30  20 74 68 65 20 6f 70 65  72 61 74 69 6f 6e 2e 20  | the operation. |
00001c40  20 4e 6f 74 65 20 74 68  61 74 20 69 66 20 61 20  | Note that if a |
00001c50  6c 6f 63 61 74 69 6f 6e  20 6f 72 0d 72 65 67 69  |location or.regi|
00001c60  73 74 65 72 20 63 6f 6e  74 61 69 6e 73 20 32 35  |ster contains 25|
00001c70  35 20 61 6e 64 20 69 73  20 69 6e 63 72 65 61 73  |5 and is increas|
00001c80  65 64 20 69 74 20 77 69  6c 6c 20 77 72 61 70 20  |ed it will wrap |
00001c90  61 72 6f 75 6e 64 0d 74  6f 20 7a 65 72 6f 20 61  |around.to zero a|
00001ca0  6e 64 20 73 65 74 20 74  68 65 20 7a 65 72 6f 20  |nd set the zero |
00001cb0  66 6c 61 67 2e 20 20 41  6c 73 6f 20 64 65 63 72  |flag.  Also decr|
00001cc0  65 61 73 69 6e 67 20 7a  65 72 6f 20 62 79 20 6f  |easing zero by o|
00001cd0  6e 65 0d 70 72 6f 64 75  63 65 73 20 32 35 35 20  |ne.produces 255 |
00001ce0  69 6e 20 74 68 65 20 6c  6f 63 61 74 69 6f 6e 2e  |in the location.|
00001cf0  0d 0d 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |..______________|
00001d00  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00001d20  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 0d 0d  |______________..|
00001d30  47 72 6f 75 70 20 35 3a  20 20 43 6f 6d 70 61 72  |Group 5:  Compar|
00001d40  69 73 6f 6e 73 0d 0d 54  68 65 73 65 20 74 68 72  |isons..These thr|
00001d50  65 65 20 6f 70 63 6f 64  65 73 20 63 6f 6d 70 61  |ee opcodes compa|
00001d60  72 65 20 74 68 65 20 72  65 67 69 73 74 65 72 20  |re the register |
00001d70  63 6f 6e 63 65 72 6e 65  64 20 77 69 74 68 20 61  |concerned with a|
00001d80  0d 62 79 74 65 2c 20 65  69 74 68 65 72 20 69 6e  |.byte, either in|
00001d90  20 69 6d 6d 65 64 69 61  74 65 20 6d 6f 64 65 20  | immediate mode |
00001da0  28 69 2e 65 2e 20 23 29  20 6f 72 20 61 20 62 79  |(i.e. #) or a by|
00001db0  74 65 20 69 6e 20 6d 65  6d 6f 72 79 2e 20 0d 54  |te in memory. .T|
00001dc0  68 65 20 70 72 6f 63 65  73 73 6f 72 20 66 6c 61  |he processor fla|
00001dd0  67 73 20 61 72 65 20 73  65 74 20 61 63 63 6f 72  |gs are set accor|
00001de0  64 69 6e 67 6c 79 20 62  75 74 20 74 68 65 20 72  |dingly but the r|
00001df0  65 67 69 73 74 65 72 0d  69 74 73 65 6c 66 20 69  |egister.itself i|
00001e00  73 20 75 6e 63 68 61 6e  67 65 64 2e 20 20 49 6e  |s unchanged.  In|
00001e10  20 66 61 63 74 20 74 68  65 20 70 72 6f 63 65 73  | fact the proces|
00001e20  73 6f 72 20 69 73 20 73  75 62 74 72 61 63 74 69  |sor is subtracti|
00001e30  6e 67 0d 74 68 65 20 6e  75 6d 62 65 72 20 66 72  |ng.the number fr|
00001e40  6f 6d 20 74 68 65 20 61  63 63 75 6d 75 6c 61 74  |om the accumulat|
00001e50  6f 72 20 62 75 74 20 6e  6f 74 20 73 74 6f 72 69  |or but not stori|
00001e60  6e 67 20 74 68 65 20 72  65 73 75 6c 74 0d 61 6e  |ng the result.an|
00001e70  64 20 74 68 65 20 73 74  61 74 65 20 6f 66 20 74  |d the state of t|
00001e80  68 65 20 66 6c 61 67 73  20 72 65 66 6c 65 63 74  |he flags reflect|
00001e90  73 20 74 68 69 73 20 6f  70 65 72 61 74 69 6f 6e  |s this operation|
00001ea0  2e 20 20 54 68 65 73 65  0d 6f 70 63 6f 64 65 73  |.  These.opcodes|
00001eb0  20 61 72 65 20 76 65 72  79 20 75 73 65 66 75 6c  | are very useful|
00001ec0  2e 0d 0d 43 4d 50 20 2d  20 43 6f 6d 70 61 72 65  |...CMP - Compare|
00001ed0  20 77 69 74 68 20 61 63  63 75 6d 75 6c 61 74 6f  | with accumulato|
00001ee0  72 2e 20 20 41 64 64 72  65 73 73 69 6e 67 20 6d  |r.  Addressing m|
00001ef0  6f 64 65 73 20 61 73 20  66 6f 72 0d 4c 44 41 2e  |odes as for.LDA.|
00001f00  20 20 46 6c 61 67 73 20  61 73 20 66 6f 6c 6c 6f  |  Flags as follo|
00001f10  77 73 3a 0d 0d 43 61 72  72 79 20 73 65 74 20 69  |ws:..Carry set i|
00001f20  66 20 74 68 65 20 6e 75  6d 62 65 72 20 77 61 73  |f the number was|
00001f30  20 3e 3d 20 74 6f 20 41  0d 5a 65 72 6f 20 73 65  | >= to A.Zero se|
00001f40  74 20 69 66 20 74 68 65  20 6e 75 6d 62 65 72 20  |t if the number |
00001f50  3d 20 41 0d 4e 65 67 61  74 69 76 65 20 73 65 74  |= A.Negative set|
00001f60  20 69 66 20 62 69 74 20  37 20 6f 66 20 74 68 65  | if bit 7 of the|
00001f70  20 72 65 73 75 6c 74 20  69 73 20 73 65 74 20 28  | result is set (|
00001f80  6c 65 73 73 20 75 73 65  66 75 6c 29 0d 0d 43 50  |less useful)..CP|
00001f90  58 20 2d 20 43 6f 6d 70  61 72 65 20 77 69 74 68  |X - Compare with|
00001fa0  20 74 68 65 20 58 20 72  65 67 69 73 74 65 72 0d  | the X register.|
00001fb0  0d 43 50 58 20 23 20 20  20 20 43 50 58 20 6d 65  |.CPX #    CPX me|
00001fc0  6d 20 20 20 20 43 50 58  20 7a 70 0d 0d 46 6c 61  |m    CPX zp..Fla|
00001fd0  67 73 20 61 73 20 66 6f  72 20 43 4d 50 0d 0d 43  |gs as for CMP..C|
00001fe0  50 59 20 2d 20 43 6f 6d  70 61 72 65 20 77 69 74  |PY - Compare wit|
00001ff0  68 20 74 68 65 20 59 20  72 65 67 69 73 74 65 72  |h the Y register|
00002000  2e 20 20 41 64 64 72 65  73 73 69 6e 67 20 61 6e  |.  Addressing an|
00002010  64 20 66 6c 61 67 73 20  61 73 0d 66 6f 72 20 43  |d flags as.for C|
00002020  50 58 2e 0d 0d 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |PX...___________|
00002030  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00002060  5f 0d 0d 47 72 6f 75 70  20 36 3a 20 20 42 72 61  |_..Group 6:  Bra|
00002070  6e 63 68 69 6e 67 0d 0d  41 6c 6c 20 6f 70 63 6f  |nching..All opco|
00002080  64 65 73 20 69 6e 20 74  68 69 73 20 67 72 6f 75  |des in this grou|
00002090  70 20 68 61 76 65 20 61  20 73 69 6e 67 6c 65 20  |p have a single |
000020a0  61 64 64 72 65 73 73 69  6e 67 20 6d 6f 64 65 0d  |addressing mode.|
000020b0  63 61 6c 6c 65 64 20 72  65 6c 61 74 69 76 65 2e  |called relative.|
000020c0  20 20 59 6f 75 20 63 61  6e 20 6f 6e 6c 79 20 62  |  You can only b|
000020d0  72 61 6e 63 68 20 2b 31  32 37 20 6f 72 20 2d 31  |ranch +127 or -1|
000020e0  32 38 20 62 79 74 65 73  0d 66 72 6f 6d 20 79 6f  |28 bytes.from yo|
000020f0  75 72 20 70 72 65 73 65  6e 74 20 70 6f 73 69 74  |ur present posit|
00002100  69 6f 6e 2e 20 20 41 6e  79 20 61 74 74 65 6d 70  |ion.  Any attemp|
00002110  74 20 74 6f 20 67 6f 20  66 75 72 74 68 65 72 20  |t to go further |
00002120  77 69 6c 6c 0d 72 65 73  75 6c 74 20 69 6e 20 61  |will.result in a|
00002130  20 27 42 72 61 6e 63 68  20 6f 75 74 20 6f 66 20  | 'Branch out of |
00002140  72 61 6e 67 65 27 20 65  72 72 6f 72 2e 20 20 28  |range' error.  (|
00002150  4f 66 74 65 6e 20 61 20  73 69 67 6e 20 74 68 61  |Often a sign tha|
00002160  74 0d 79 6f 75 20 6f 75  67 68 74 20 74 6f 20 62  |t.you ought to b|
00002170  65 20 75 73 69 6e 67 20  6d 6f 72 65 20 73 75 62  |e using more sub|
00002180  72 6f 75 74 69 6e 65 73  20 69 6e 20 79 6f 75 72  |routines in your|
00002190  20 6c 6f 6f 70 73 2e 29  0d 0d 0d 42 43 43 20 2d  | loops.)...BCC -|
000021a0  20 42 72 61 6e 63 68 20  77 68 65 6e 20 63 61 72  | Branch when car|
000021b0  72 79 20 69 73 20 63 6c  65 61 72 0d 0d 42 43 53  |ry is clear..BCS|
000021c0  20 2d 20 42 72 61 6e 63  68 20 77 68 65 6e 20 63  | - Branch when c|
000021d0  61 72 72 79 20 69 73 20  73 65 74 0d 0d 42 45 51  |arry is set..BEQ|
000021e0  20 2d 20 42 72 61 6e 63  68 20 77 68 65 6e 20 7a  | - Branch when z|
000021f0  65 72 6f 20 66 6c 61 67  20 69 73 20 73 65 74 0d  |ero flag is set.|
00002200  0d 42 4e 45 20 2d 20 42  72 61 6e 63 68 20 77 68  |.BNE - Branch wh|
00002210  65 6e 20 7a 65 72 6f 20  66 6c 61 67 20 69 73 20  |en zero flag is |
00002220  63 6c 65 61 72 0d 0d 42  4d 49 20 2d 20 42 72 61  |clear..BMI - Bra|
00002230  6e 63 68 20 77 68 65 6e  20 6e 65 67 61 74 69 76  |nch when negativ|
00002240  65 20 66 6c 61 67 20 69  73 20 73 65 74 0d 0d 42  |e flag is set..B|
00002250  50 4c 20 2d 20 42 72 61  6e 63 68 20 77 68 65 6e  |PL - Branch when|
00002260  20 6e 65 67 61 74 69 76  65 20 66 6c 61 67 20 69  | negative flag i|
00002270  73 20 63 6c 65 61 72 0d  0d 42 56 43 20 2d 20 42  |s clear..BVC - B|
00002280  72 61 6e 63 68 20 77 68  65 6e 20 6f 76 65 72 66  |ranch when overf|
00002290  6c 6f 77 20 66 6c 61 67  20 69 73 20 63 6c 65 61  |low flag is clea|
000022a0  72 0d 0d 42 56 53 20 2d  20 42 72 61 6e 63 68 20  |r..BVS - Branch |
000022b0  77 68 65 6e 20 6f 76 65  72 66 6c 6f 77 20 66 6c  |when overflow fl|
000022c0  61 67 20 69 73 20 73 65  74 0d 0d 4e 6f 20 66 6c  |ag is set..No fl|
000022d0  61 67 73 20 61 72 65 20  61 66 66 65 63 74 65 64  |ags are affected|
000022e0  20 62 79 20 61 20 62 72  61 6e 63 68 20 61 6e 64  | by a branch and|
000022f0  20 6e 6f 74 65 20 74 68  61 74 20 74 68 65 20 73  | note that the s|
00002300  65 74 74 69 6e 67 73 0d  6f 66 20 66 6c 61 67 73  |ettings.of flags|
00002310  20 61 66 74 65 72 20 61  20 43 4d 50 2c 20 43 50  | after a CMP, CP|
00002320  58 20 6f 72 20 43 50 59  20 61 72 65 20 67 69 76  |X or CPY are giv|
00002330  65 6e 20 69 6e 20 74 68  65 20 70 72 65 76 69 6f  |en in the previo|
00002340  75 73 0d 73 65 63 74 69  6f 6e 2e 0d 0d 59 6f 75  |us.section...You|
00002350  20 63 61 6e 20 70 65 72  66 6f 72 6d 20 61 20 62  | can perform a b|
00002360  72 61 6e 63 68 20 6f 66  20 6f 76 65 72 20 74 68  |ranch of over th|
00002370  65 20 31 32 37 2f 2d 31  32 38 20 6c 69 6d 69 74  |e 127/-128 limit|
00002380  20 62 79 0d 62 72 61 6e  63 68 69 6e 67 20 74 6f  | by.branching to|
00002390  20 61 20 6c 61 62 65 6c  20 77 68 65 72 65 20 79  | a label where y|
000023a0  6f 75 20 68 61 76 65 20  70 6c 61 63 65 64 20 61  |ou have placed a|
000023b0  20 4a 4d 50 2e 20 20 54  68 69 73 0d 69 73 20 6b  | JMP.  This.is k|
000023c0  6e 6f 77 6e 20 61 73 20  61 20 6c 6f 6e 67 20 62  |nown as a long b|
000023d0  72 61 6e 63 68 2e 0d 0d  5f 5f 5f 5f 5f 5f 5f 5f  |ranch...________|
000023e0  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00002410  5f 5f 5f 5f 0d 0d 47 72  6f 75 70 20 37 3a 20 20  |____..Group 7:  |
00002420  4a 75 6d 70 73 0d 0d 4a  53 52 20 2d 20 4a 75 6d  |Jumps..JSR - Jum|
00002430  70 20 74 6f 20 61 20 73  75 62 72 6f 75 74 69 6e  |p to a subroutin|
00002440  65 0d 0d 4a 53 52 20 6d  65 6d 0d 0d 52 54 53 20  |e..JSR mem..RTS |
00002450  2d 20 52 65 74 75 72 6e  20 66 72 6f 6d 20 61 20  |- Return from a |
00002460  73 75 62 72 6f 75 74 69  6e 65 0d 0d 4a 4d 50 20  |subroutine..JMP |
00002470  2d 20 4a 75 6d 70 20 74  6f 20 61 20 6e 65 77 20  |- Jump to a new |
00002480  6c 6f 63 61 74 69 6f 6e  0d 0d 4a 4d 50 20 6d 65  |location..JMP me|
00002490  6d 20 20 20 20 4a 4d 50  20 28 6d 65 6d 29 0d 0d  |m    JMP (mem)..|
000024a0  49 6e 20 61 6c 6c 20 63  61 73 65 73 20 6e 6f 20  |In all cases no |
000024b0  66 6c 61 67 73 20 61 72  65 20 61 66 66 65 63 74  |flags are affect|
000024c0  65 64 2e 20 20 4e 6f 74  65 20 74 68 61 74 20 77  |ed.  Note that w|
000024d0  69 74 68 20 4a 53 52 20  61 6e 64 0d 52 54 53 20  |ith JSR and.RTS |
000024e0  74 68 65 20 74 6f 70 20  6f 66 20 74 68 65 20 73  |the top of the s|
000024f0  74 61 63 6b 20 69 73 20  75 73 65 64 20 74 6f 20  |tack is used to |
00002500  68 6f 6c 64 20 72 65 74  75 72 6e 20 61 64 64 72  |hold return addr|
00002510  65 73 73 65 73 0d 61 6e  64 20 73 6f 20 6e 6f 20  |esses.and so no |
00002520  70 75 6c 6c 73 20 6f 72  20 70 75 73 68 65 73 20  |pulls or pushes |
00002530  6f 66 20 72 65 67 69 73  74 65 72 73 20 73 68 6f  |of registers sho|
00002540  75 6c 64 20 6f 63 63 75  72 20 65 69 74 68 65 72  |uld occur either|
00002550  0d 73 69 64 65 20 61 73  20 74 68 65 79 20 77 69  |.side as they wi|
00002560  6c 6c 20 6e 6f 74 20 77  6f 72 6b 20 63 6f 72 72  |ll not work corr|
00002570  65 63 74 6c 79 2e 20 20  54 68 65 72 65 20 69 73  |ectly.  There is|
00002580  20 61 6c 73 6f 20 61 20  62 75 67 0d 69 6e 20 74  | also a bug.in t|
00002590  68 65 20 36 35 30 32 20  77 68 69 63 68 20 73 74  |he 6502 which st|
000025a0  6f 70 73 20 4a 4d 50 20  28 6d 65 6d 29 20 77 6f  |ops JMP (mem) wo|
000025b0  72 6b 69 6e 67 20 63 6f  72 72 65 63 74 6c 79 20  |rking correctly |
000025c0  69 66 20 6d 65 6d 0d 69  73 20 61 74 20 74 68 65  |if mem.is at the|
000025d0  20 74 6f 70 20 6f 66 20  61 20 70 61 67 65 20 28  | top of a page (|
000025e0  69 2e 65 2e 20 69 66 20  69 74 20 65 6e 64 73 20  |i.e. if it ends |
000025f0  69 6e 20 26 46 46 29 2e  20 20 59 6f 75 20 77 69  |in &FF).  You wi|
00002600  6c 6c 0d 68 61 76 65 20  74 6f 20 77 61 74 63 68  |ll.have to watch|
00002610  20 66 6f 72 20 74 68 69  73 20 69 6e 20 79 6f 75  | for this in you|
00002620  72 20 63 6f 64 65 20 79  6f 75 72 73 65 6c 66 20  |r code yourself |
00002630  69 66 20 79 6f 75 20 75  73 65 20 74 68 69 73 0d  |if you use this.|
00002640  69 6e 64 69 72 65 63 74  20 6a 75 6d 70 2e 0d 0d  |indirect jump...|
00002650  0d 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |._______________|
00002660  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00002680  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 0d 0d 47  |_____________..G|
00002690  72 6f 75 70 20 38 3a 20  20 4c 6f 67 69 63 0d 0d  |roup 8:  Logic..|
000026a0  41 4e 44 20 2d 20 41 4e  44 20 6c 6f 63 61 74 69  |AND - AND locati|
000026b0  6f 6e 20 77 69 74 68 20  74 68 65 20 61 63 63 75  |on with the accu|
000026c0  6d 75 6c 61 74 6f 72 20  61 6e 64 20 73 74 6f 72  |mulator and stor|
000026d0  65 20 74 68 65 20 72 65  73 75 6c 74 0d 69 6e 20  |e the result.in |
000026e0  74 68 65 20 61 63 63 75  6d 75 6c 61 74 6f 72 2e  |the accumulator.|
000026f0  0d 0d 41 64 64 72 65 73  73 69 6e 67 20 6d 6f 64  |..Addressing mod|
00002700  65 73 20 61 73 20 66 6f  72 20 4c 44 41 2e 20 20  |es as for LDA.  |
00002710  5a 65 72 6f 20 61 6e 64  20 6e 65 67 61 74 69 76  |Zero and negativ|
00002720  65 20 66 6c 61 67 73 20  61 72 65 0d 61 66 66 65  |e flags are.affe|
00002730  63 74 65 64 2e 0d 0d 42  49 54 20 2d 20 41 6e 64  |cted...BIT - And|
00002740  20 6c 6f 63 61 74 69 6f  6e 20 77 69 74 68 20 61  | location with a|
00002750  63 63 75 6d 75 6c 61 74  6f 72 20 62 75 74 20 64  |ccumulator but d|
00002760  6f 20 6e 6f 74 20 73 74  6f 72 65 20 74 68 65 0d  |o not store the.|
00002770  72 65 73 75 6c 74 2e 20  20 5a 65 72 6f 20 66 6c  |result.  Zero fl|
00002780  61 67 20 69 73 20 73 65  74 20 69 66 20 74 68 65  |ag is set if the|
00002790  20 72 65 73 75 6c 74 20  69 73 20 7a 65 72 6f 20  | result is zero |
000027a0  61 6e 64 20 62 69 74 73  20 36 0d 61 6e 64 20 37  |and bits 6.and 7|
000027b0  20 6f 66 20 74 68 65 20  62 79 74 65 20 68 65 6c  | of the byte hel|
000027c0  64 20 61 74 20 74 68 65  20 6c 6f 63 61 74 69 6f  |d at the locatio|
000027d0  6e 20 61 72 65 20 74 72  61 6e 73 66 65 72 72 65  |n are transferre|
000027e0  64 20 69 6e 74 6f 0d 74  68 65 20 6f 76 65 72 66  |d into.the overf|
000027f0  6c 6f 77 20 61 6e 64 20  6e 65 67 61 74 69 76 65  |low and negative|
00002800  20 66 6c 61 67 73 20 72  65 73 70 65 63 74 69 76  | flags respectiv|
00002810  65 6c 79 2e 0d 0d 42 49  54 20 6d 65 6d 20 20 20  |ely...BIT mem   |
00002820  20 42 49 54 20 7a 70 0d  0d 45 4f 52 20 2d 20 45  | BIT zp..EOR - E|
00002830  4f 52 20 6c 6f 63 61 74  69 6f 6e 20 77 69 74 68  |OR location with|
00002840  20 74 68 65 20 61 63 63  75 6d 75 6c 61 74 6f 72  | the accumulator|
00002850  20 61 6e 64 20 73 74 6f  72 65 20 74 68 65 20 72  | and store the r|
00002860  65 73 75 6c 74 0d 69 6e  20 74 68 65 20 61 63 63  |esult.in the acc|
00002870  75 6d 75 6c 61 74 6f 72  2e 0d 0d 41 64 64 72 65  |umulator...Addre|
00002880  73 73 69 6e 67 20 6d 6f  64 65 73 20 61 73 20 66  |ssing modes as f|
00002890  6f 72 20 4c 44 41 2e 20  20 5a 65 72 6f 20 61 6e  |or LDA.  Zero an|
000028a0  64 20 6e 65 67 61 74 69  76 65 20 66 6c 61 67 73  |d negative flags|
000028b0  20 61 72 65 0d 61 66 66  65 63 74 65 64 2e 0d 0d  | are.affected...|
000028c0  4f 52 41 20 2d 20 4f 52  20 6c 6f 63 61 74 69 6f  |ORA - OR locatio|
000028d0  6e 20 77 69 74 68 20 74  68 65 20 61 63 63 75 6d  |n with the accum|
000028e0  75 6c 61 74 6f 72 20 61  6e 64 20 73 74 6f 72 65  |ulator and store|
000028f0  20 74 68 65 20 72 65 73  75 6c 74 0d 69 6e 20 74  | the result.in t|
00002900  68 65 20 61 63 63 75 6d  75 6c 61 74 6f 72 2e 0d  |he accumulator..|
00002910  0d 41 64 64 72 65 73 73  69 6e 67 20 6d 6f 64 65  |.Addressing mode|
00002920  73 20 61 73 20 66 6f 72  20 4c 44 41 2e 20 20 5a  |s as for LDA.  Z|
00002930  65 72 6f 20 61 6e 64 20  6e 65 67 61 74 69 76 65  |ero and negative|
00002940  20 66 6c 61 67 73 20 61  72 65 0d 61 66 66 65 63  | flags are.affec|
00002950  74 65 64 2e 0d 0d 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |ted...__________|
00002960  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00002990  5f 5f 0d 0d 47 72 6f 75  70 20 39 3a 20 20 53 65  |__..Group 9:  Se|
000029a0  74 74 69 6e 67 2f 43 6c  65 61 72 69 6e 67 20 46  |tting/Clearing F|
000029b0  6c 61 67 73 0d 0d 54 68  65 72 65 20 69 73 20 6f  |lags..There is o|
000029c0  6e 6c 79 20 6f 6e 65 20  61 64 64 72 65 73 73 69  |nly one addressi|
000029d0  6e 67 20 6d 6f 64 65 20  66 6f 72 20 74 68 69 73  |ng mode for this|
000029e0  20 67 72 6f 75 70 2c 20  69 6d 70 6c 69 65 64 2e  | group, implied.|
000029f0  0d 0d 53 45 43 20 2d 20  53 65 74 20 63 61 72 72  |..SEC - Set carr|
00002a00  79 20 66 6c 61 67 0d 0d  43 4c 43 20 2d 20 43 6c  |y flag..CLC - Cl|
00002a10  65 61 72 20 63 61 72 72  79 20 66 6c 61 67 0d 0d  |ear carry flag..|
00002a20  53 45 44 20 2d 20 53 65  74 20 64 65 63 69 6d 61  |SED - Set decima|
00002a30  6c 20 66 6c 61 67 20 28  63 61 6c 63 75 6c 61 74  |l flag (calculat|
00002a40  65 20 69 6e 20 42 43 44  29 0d 0d 43 4c 44 20 2d  |e in BCD)..CLD -|
00002a50  20 43 6c 65 61 72 20 64  65 63 69 6d 61 6c 20 66  | Clear decimal f|
00002a60  6c 61 67 20 28 63 61 6c  63 75 6c 61 74 65 20 69  |lag (calculate i|
00002a70  6e 20 62 69 6e 61 72 79  29 0d 0d 53 45 49 20 2d  |n binary)..SEI -|
00002a80  20 53 65 74 20 69 6e 74  65 72 72 75 70 74 20 64  | Set interrupt d|
00002a90  69 73 61 62 6c 65 20 66  6c 61 67 20 28 6d 6f 72  |isable flag (mor|
00002aa0  65 20 6f 6e 20 69 6e 74  65 72 72 75 70 74 73 20  |e on interrupts |
00002ab0  69 6e 20 61 0d 6c 61 74  65 72 20 6d 6f 64 75 6c  |in a.later modul|
00002ac0  65 2c 20 75 73 65 20 77  69 74 68 20 63 61 75 74  |e, use with caut|
00002ad0  69 6f 6e 2e 29 0d 0d 43  4c 49 20 2d 20 43 6c 65  |ion.)..CLI - Cle|
00002ae0  61 72 20 69 6e 74 65 72  72 75 70 74 20 66 6c 61  |ar interrupt fla|
00002af0  67 20 69 2e 65 2e 20 65  6e 61 62 6c 65 20 69 6e  |g i.e. enable in|
00002b00  74 65 72 72 75 70 74 73  2e 0d 0d 43 4c 56 20 2d  |terrupts...CLV -|
00002b10  20 43 6c 65 61 72 20 6f  76 65 72 66 6c 6f 77 20  | Clear overflow |
00002b20  66 6c 61 67 20 28 6e 6f  20 69 6d 70 6c 69 63 69  |flag (no implici|
00002b30  74 20 73 65 74 74 69 6e  67 20 6f 66 20 74 68 69  |t setting of thi|
00002b40  73 20 66 6c 61 67 29 0d  0d 5f 5f 5f 5f 5f 5f 5f  |s flag).._______|
00002b50  5f 5f 5f 5f 5f 5f 5f 5f  5f 5f 5f 5f 5f 5f 5f 5f  |________________|
*
00002b80  5f 5f 5f 5f 5f 0d 0d 47  72 6f 75 70 20 31 30 3a  |_____..Group 10:|
00002b90  20 20 4f 74 68 65 72 73  0d 0d 42 52 4b 20 2d 20  |  Others..BRK - |
00002ba0  42 52 45 41 4b 20 28 6e  6f 74 20 6c 69 6b 65 20  |BREAK (not like |
00002bb0  74 68 65 20 42 52 45 41  4b 20 6b 65 79 29 20 61  |the BREAK key) a|
00002bc0  6e 64 20 66 6f 72 63 65  20 61 6e 20 69 6e 74 65  |nd force an inte|
00002bd0  72 72 75 70 74 2e 20 0d  54 68 69 73 20 69 73 20  |rrupt. .This is |
00002be0  75 73 65 64 20 69 6e 20  65 72 72 6f 72 20 74 72  |used in error tr|
00002bf0  61 70 70 69 6e 67 20 61  6e 64 20 73 65 74 73 20  |apping and sets |
00002c00  74 68 65 20 62 72 65 61  6b 20 66 6c 61 67 2e 0d  |the break flag..|
00002c10  0d 4e 4f 50 20 2d 20 4e  6f 20 6f 70 65 72 61 74  |.NOP - No operat|
00002c20  69 6f 6e 2c 20 64 6f 20  6e 6f 74 68 69 6e 67 2e  |ion, do nothing.|
00002c30  20 20 55 73 65 66 75 6c  20 74 6f 20 73 6c 6f 77  |  Useful to slow|
00002c40  20 64 6f 77 6e 20 61 20  6c 6f 6f 70 0d 6f 72 20  | down a loop.or |
00002c50  74 6f 20 66 6f 72 63 65  20 62 79 74 65 73 20 6f  |to force bytes o|
00002c60  6e 74 6f 20 65 76 65 6e  20 62 79 74 65 20 62 6f  |nto even byte bo|
00002c70  75 6e 64 61 72 69 65 73  20 66 6f 72 20 31 36 62  |undaries for 16b|
00002c80  69 74 0d 77 6f 72 6b 69  6e 67 2e 20 20 41 66 66  |it.working.  Aff|
00002c90  65 63 74 73 20 6e 6f 20  66 6c 61 67 73 2e 0d 0d  |ects no flags...|
00002ca0  52 54 49 20 2d 20 52 65  74 75 72 6e 20 66 72 6f  |RTI - Return fro|
00002cb0  6d 20 61 6e 20 69 6e 74  65 72 72 75 70 74 2e 20  |m an interrupt. |
00002cc0  20 41 20 73 70 65 63 69  61 6c 69 73 74 20 65 71  | A specialist eq|
00002cd0  75 69 76 61 6c 65 6e 74  20 74 6f 0d 52 54 53 20  |uivalent to.RTS |
00002ce0  77 68 69 63 68 20 49 20  77 69 6c 6c 20 63 6f 6d  |which I will com|
00002cf0  65 20 6f 6e 74 6f 20 69  6e 20 61 20 6c 61 74 65  |e onto in a late|
00002d00  72 20 6d 6f 64 75 6c 65  2e 0d 0d 0d 52 65 63 65  |r module....Rece|
00002d10  6e 74 20 76 65 72 73 69  6f 6e 73 20 6f 66 20 74  |nt versions of t|
00002d20  68 65 20 36 35 30 32 20  28 6c 69 6b 65 20 74 68  |he 6502 (like th|
00002d30  65 20 36 35 43 30 32 29  20 63 6f 6e 74 61 69 6e  |e 65C02) contain|
00002d40  20 65 78 74 72 61 0d 6f  70 63 6f 64 65 73 20 77  | extra.opcodes w|
00002d50  68 69 63 68 20 63 61 6e  20 6d 61 6b 65 20 66 6f  |hich can make fo|
00002d60  72 20 6d 6f 72 65 20 65  66 66 69 63 69 65 6e 74  |r more efficient|
00002d70  20 63 6f 64 65 2e 20 20  54 68 69 6e 67 73 20 6c  | code.  Things l|
00002d80  69 6b 65 0d 73 74 6f 72  69 6e 67 20 7a 65 72 6f  |ike.storing zero|
00002d90  20 64 69 72 65 63 74 6c  79 20 77 69 74 68 20 61  | directly with a|
00002da0  6e 20 53 54 5a 20 6f 72  20 61 20 42 52 41 20 62  |n STZ or a BRA b|
00002db0  72 61 6e 63 68 20 61 6c  77 61 79 73 0d 6f 70 63  |ranch always.opc|
00002dc0  6f 64 65 20 61 72 65 20  75 73 65 66 75 6c 20 61  |ode are useful a|
00002dd0  64 64 69 74 69 6f 6e 73  2e 20 20 48 6f 77 65 76  |dditions.  Howev|
00002de0  65 72 20 69 66 20 79 6f  75 20 77 61 6e 74 20 79  |er if you want y|
00002df0  6f 75 72 20 63 6f 64 65  0d 74 6f 20 72 75 6e 20  |our code.to run |
00002e00  69 6e 20 65 76 65 72 79  20 42 42 43 20 6d 69 63  |in every BBC mic|
00002e10  72 6f 20 74 68 65 20 61  62 6f 76 65 20 6c 69 73  |ro the above lis|
00002e20  74 20 69 73 20 74 68 65  20 6c 69 6d 69 74 20 6f  |t is the limit o|
00002e30  66 0d 79 6f 75 72 20 6f  70 63 6f 64 65 73 2e 20  |f.your opcodes. |
00002e40  20 54 68 65 72 65 20 77  65 72 65 20 73 6f 6d 65  | There were some|
00002e50  20 65 61 72 6c 69 65 72  20 76 65 72 73 69 6f 6e  | earlier version|
00002e60  73 20 6f 66 20 74 68 65  20 36 35 30 32 0d 77 68  |s of the 6502.wh|
00002e70  69 63 68 20 64 69 64 20  6e 6f 74 20 68 61 76 65  |ich did not have|
00002e80  20 61 6c 6c 20 74 68 65  73 65 20 6f 70 63 6f 64  | all these opcod|
00002e90  65 73 2e 20 20 52 4f 52  20 69 73 20 61 20 63 6f  |es.  ROR is a co|
00002ea0  64 65 20 74 68 61 74 20  69 73 0d 6d 69 73 73 69  |de that is.missi|
00002eb0  6e 67 20 66 72 6f 6d 20  73 6f 6d 65 20 65 61 72  |ng from some ear|
00002ec0  6c 79 20 36 35 30 32 73  2e 0d 0d 0d 46 69 6e 61  |ly 6502s....Fina|
00002ed0  6c 6c 79 20 61 20 66 65  77 20 77 6f 72 64 73 20  |lly a few words |
00002ee0  61 62 6f 75 74 20 65 72  72 6f 72 73 20 61 6e 64  |about errors and|
00002ef0  20 65 78 63 65 70 74 69  6f 6e 73 2e 20 20 49 6e  | exceptions.  In|
00002f00  20 67 65 6e 65 72 61 6c  0d 6d 6f 73 74 20 65 72  | general.most er|
00002f10  72 6f 72 73 20 61 72 65  20 61 63 74 75 61 6c 6c  |rors are actuall|
00002f20  79 20 65 78 63 65 70 74  69 6f 6e 73 2e 20 20 54  |y exceptions.  T|
00002f30  68 65 79 20 61 72 65 20  77 68 65 72 65 20 74 68  |hey are where th|
00002f40  65 0d 72 65 73 75 6c 74  20 6f 66 20 61 6e 20 6f  |e.result of an o|
00002f50  70 65 72 61 74 69 6f 6e  20 69 73 20 6f 75 74 73  |peration is outs|
00002f60  69 64 65 20 74 68 65 20  6c 69 6d 69 74 73 20 6f  |ide the limits o|
00002f70  66 20 63 6f 72 72 65 63  74 0d 6f 70 65 72 61 74  |f correct.operat|
00002f80  69 6f 6e 2e 20 20 54 68  69 73 20 63 6f 75 6c 64  |ion.  This could|
00002f90  20 62 65 20 62 65 63 61  75 73 65 20 74 68 65 20  | be because the |
00002fa0  75 73 65 72 20 68 61 73  20 65 6e 74 65 72 65 64  |user has entered|
00002fb0  20 74 6f 6f 0d 6c 61 72  67 65 20 61 20 6e 75 6d  | too.large a num|
00002fc0  62 65 72 20 6f 72 20 62  65 63 61 75 73 65 20 74  |ber or because t|
00002fd0  68 65 20 70 72 6f 67 72  61 6d 20 77 69 6c 6c 20  |he program will |
00002fe0  61 74 74 65 6d 70 74 20  74 6f 20 64 69 76 69 64  |attempt to divid|
00002ff0  65 0d 62 79 20 7a 65 72  6f 2e 20 20 49 74 20 63  |e.by zero.  It c|
00003000  6f 75 6c 64 20 62 65 20  74 68 61 74 20 74 68 65  |ould be that the|
00003010  20 75 73 65 72 20 68 61  73 20 65 6e 74 65 72 65  | user has entere|
00003020  64 20 61 20 6e 75 6d 62  65 72 0d 77 68 65 6e 20  |d a number.when |
00003030  79 6f 75 20 77 61 6e 74  65 64 20 61 20 6c 65 74  |you wanted a let|
00003040  74 65 72 2e 20 20 41 6c  74 65 72 6e 61 74 69 76  |ter.  Alternativ|
00003050  65 6c 79 20 74 68 65 20  65 73 63 61 70 65 20 6b  |ely the escape k|
00003060  65 79 0d 6d 69 67 68 74  20 68 61 76 65 20 62 65  |ey.might have be|
00003070  65 6e 20 70 72 65 73 73  65 64 20 6f 72 20 74 68  |en pressed or th|
00003080  65 72 65 20 6d 69 67 68  74 20 6e 6f 74 20 68 61  |ere might not ha|
00003090  76 65 20 62 65 65 6e 20  61 20 64 69 73 63 0d 69  |ve been a disc.i|
000030a0  6e 20 74 68 65 20 64 72  69 76 65 20 77 68 65 6e  |n the drive when|
000030b0  20 74 68 65 20 75 73 65  72 20 74 72 69 65 64 20  | the user tried |
000030c0  74 6f 20 77 72 69 74 65  20 74 6f 20 61 20 66 69  |to write to a fi|
000030d0  6c 65 2e 0d 0d 49 20 74  68 69 6e 6b 20 69 74 20  |le...I think it |
000030e0  69 73 20 73 61 66 65 20  74 6f 20 73 61 79 20 74  |is safe to say t|
000030f0  68 61 74 20 79 6f 75 20  73 68 6f 75 6c 64 20 61  |hat you should a|
00003100  6e 74 69 63 69 70 61 74  65 20 65 76 65 72 79 0d  |nticipate every.|
00003110  65 72 72 6f 72 20 63 6f  6e 64 69 74 69 6f 6e 20  |error condition |
00003120  6f 72 20 65 78 63 65 70  74 69 6f 6e 20 61 6e 64  |or exception and|
00003130  20 62 75 69 6c 64 20 73  6f 6d 65 74 68 69 6e 67  | build something|
00003140  20 69 6e 74 6f 20 79 6f  75 72 0d 72 6f 75 74 69  | into your.routi|
00003150  6e 65 20 74 6f 20 63 6f  70 65 2e 20 20 49 6e 20  |ne to cope.  In |
00003160  73 6f 6d 65 20 63 69 72  63 75 6d 73 74 61 6e 63  |some circumstanc|
00003170  65 73 20 79 6f 75 72 20  63 6f 64 65 20 77 6f 75  |es your code wou|
00003180  6c 64 0d 72 65 70 6f 72  74 20 74 68 65 20 65 72  |ld.report the er|
00003190  72 6f 72 20 61 6e 64 20  61 73 6b 20 66 6f 72 20  |ror and ask for |
000031a0  61 20 72 65 2d 74 72 79  20 61 6e 64 20 79 6f 75  |a re-try and you|
000031b0  20 77 6f 75 6c 64 20 6e  6f 74 0d 61 63 74 75 61  | would not.actua|
000031c0  6c 6c 79 20 65 78 69 74  20 74 68 65 20 72 6f 75  |lly exit the rou|
000031d0  74 69 6e 65 2e 20 20 54  68 69 73 20 69 73 20 77  |tine.  This is w|
000031e0  68 61 74 20 49 20 61 6d  20 63 61 6c 6c 69 6e 67  |hat I am calling|
000031f0  0d 61 6e 20 65 78 63 65  70 74 69 6f 6e 2e 20 20  |.an exception.  |
00003200  49 6e 20 6f 74 68 65 72  20 63 69 72 63 75 6d 73  |In other circums|
00003210  74 61 6e 63 65 73 20 79  6f 75 72 20 63 6f 64 65  |tances your code|
00003220  20 77 6f 75 6c 64 20 65  78 69 74 0d 61 6e 64 20  | would exit.and |
00003230  64 72 6f 70 20 79 6f 75  20 62 61 63 6b 20 74 6f  |drop you back to|
00003240  20 74 68 65 20 6c 61 6e  67 75 61 67 65 20 66 72  | the language fr|
00003250  6f 6d 20 77 68 69 63 68  20 79 6f 75 20 68 61 64  |om which you had|
00003260  20 63 61 6c 6c 65 64 0d  74 68 65 20 72 6f 75 74  | called.the rout|
00003270  69 6e 65 2e 20 20 41 20  75 74 69 6c 69 74 79 20  |ine.  A utility |
00003280  52 4f 4d 20 6d 69 67 68  74 20 72 65 66 75 73 65  |ROM might refuse|
00003290  20 74 6f 20 63 61 72 72  79 20 6f 75 74 20 61 6e  | to carry out an|
000032a0  0d 69 6d 70 72 6f 70 65  72 20 69 6e 73 74 72 75  |.improper instru|
000032b0  63 74 69 6f 6e 20 61 6e  64 20 72 65 74 75 72 6e  |ction and return|
000032c0  20 79 6f 75 20 74 6f 20  42 41 53 49 43 3b 20 74  | you to BASIC; t|
000032d0  68 69 73 20 77 6f 75 6c  64 20 62 65 0d 61 6e 20  |his would be.an |
000032e0  65 72 72 6f 72 2e 0d 0d  44 65 61 6c 69 6e 67 20  |error...Dealing |
000032f0  77 69 74 68 20 65 72 72  6f 72 73 20 69 73 20 61  |with errors is a|
00003300  63 74 75 61 6c 6c 79 20  76 65 72 79 20 73 69 6d  |ctually very sim|
00003310  70 6c 65 20 77 69 74 68  20 74 68 65 20 42 42 43  |ple with the BBC|
00003320  0d 4d 69 63 72 6f 20 62  65 63 61 75 73 65 20 74  |.Micro because t|
00003330  68 65 72 65 20 69 73 20  61 20 64 65 66 61 75 6c  |here is a defaul|
00003340  74 20 72 6f 75 74 69 6e  65 20 61 76 61 69 6c 61  |t routine availa|
00003350  62 6c 65 20 69 6e 20 42  41 53 49 43 2e 20 0d 4f  |ble in BASIC. .O|
00003360  74 68 65 72 20 6c 61 6e  67 75 61 67 65 73 20 49  |ther languages I|
00003370  20 68 61 76 65 20 74 72  69 65 64 20 6f 6e 20 74  | have tried on t|
00003380  68 65 20 42 42 43 20 4d  69 63 72 6f 20 61 6c 73  |he BBC Micro als|
00003390  6f 20 68 61 76 65 0d 65  72 72 6f 72 20 72 6f 75  |o have.error rou|
000033a0  74 69 6e 65 73 20 77 68  69 63 68 20 6f 70 65 72  |tines which oper|
000033b0  61 74 65 20 69 6e 20 74  68 65 20 73 61 6d 65 20  |ate in the same |
000033c0  77 61 79 2e 20 20 4e 6f  77 20 79 6f 75 20 63 6f  |way.  Now you co|
000033d0  75 6c 64 0d 69 6e 74 65  72 63 65 70 74 20 74 68  |uld.intercept th|
000033e0  65 20 62 72 65 61 6b 20  76 65 63 74 6f 72 20 61  |e break vector a|
000033f0  6e 64 20 77 72 69 74 65  20 61 6e 20 65 72 72 6f  |nd write an erro|
00003400  72 20 68 61 6e 64 6c 69  6e 67 0d 72 6f 75 74 69  |r handling.routi|
00003410  6e 65 20 6f 66 20 79 6f  75 72 20 6f 77 6e 20 62  |ne of your own b|
00003420  75 74 20 49 20 73 75 62  6d 69 74 20 74 68 61 74  |ut I submit that|
00003430  20 69 74 20 69 73 20 70  72 6f 62 61 62 6c 79 20  | it is probably |
00003440  6e 6f 74 0d 77 6f 72 74  68 20 69 74 2e 20 20 48  |not.worth it.  H|
00003450  65 72 65 27 73 20 68 6f  77 20 79 6f 75 20 75 73  |ere's how you us|
00003460  65 20 74 68 65 20 64 65  66 61 75 6c 74 20 72 6f  |e the default ro|
00003470  75 74 69 6e 65 2e 0d 0d  49 6d 61 67 69 6e 65 20  |utine...Imagine |
00003480  74 68 61 74 20 79 6f 75  20 77 61 6e 74 20 74 6f  |that you want to|
00003490  20 67 65 6e 65 72 61 74  65 20 61 6e 20 65 72 72  | generate an err|
000034a0  6f 72 20 63 6f 6e 64 69  74 69 6f 6e 20 77 68 65  |or condition whe|
000034b0  6e 0d 74 68 65 20 63 6f  64 65 20 62 72 61 6e 63  |n.the code branc|
000034c0  68 65 73 20 74 6f 20 61  20 6c 61 62 65 6c 20 63  |hes to a label c|
000034d0  61 6c 6c 65 64 20 65 72  72 6f 72 2e 20 20 48 65  |alled error.  He|
000034e0  72 65 20 69 73 20 77 68  61 74 20 79 6f 75 0d 77  |re is what you.w|
000034f0  6f 75 6c 64 20 70 75 74  20 61 74 20 74 68 61 74  |ould put at that|
00003500  20 6c 61 62 65 6c 2e 0d  0d 20 20 20 20 20 20 20  | label...       |
00003510  20 20 2e 65 72 72 6f 72  0d 20 20 20 20 20 20 20  |  .error.       |
00003520  20 20 42 52 4b 0d 20 20  20 20 20 20 20 20 20 45  |  BRK.         E|
00003530  51 55 42 20 32 35 35 0d  20 20 20 20 20 20 20 20  |QUB 255.        |
00003540  20 45 51 55 53 20 22 59  6f 75 20 68 61 76 65 20  | EQUS "You have |
00003550  6a 75 73 74 20 64 6f 6e  65 20 73 6f 6d 65 74 68  |just done someth|
00003560  69 6e 67 20 73 69 6c 6c  79 2e 22 0d 20 20 20 20  |ing silly.".    |
00003570  20 20 20 20 20 45 51 55  42 20 30 0d 0d 54 68 65  |     EQUB 0..The|
00003580  20 42 52 4b 20 66 6f 72  63 65 73 20 61 20 73 6f  | BRK forces a so|
00003590  66 74 77 61 72 65 20 69  6e 74 65 72 72 75 70 74  |ftware interrupt|
000035a0  20 61 6e 64 20 77 68 65  6e 20 74 68 69 73 20 68  | and when this h|
000035b0  61 70 70 65 6e 73 0d 74  68 65 20 70 72 6f 63 65  |appens.the proce|
000035c0  73 73 6f 72 20 61 75 74  6f 6d 61 74 69 63 61 6c  |ssor automatical|
000035d0  6c 79 20 6a 75 6d 70 73  20 64 6f 77 6e 20 74 68  |ly jumps down th|
000035e0  65 20 62 72 65 61 6b 20  76 65 63 74 6f 72 20 74  |e break vector t|
000035f0  6f 0d 74 68 65 20 64 65  66 61 75 6c 74 20 72 6f  |o.the default ro|
00003600  75 74 69 6e 65 2e 20 20  54 68 65 20 64 65 66 61  |utine.  The defa|
00003610  75 6c 74 20 72 6f 75 74  69 6e 65 20 65 78 70 65  |ult routine expe|
00003620  63 74 73 20 61 6e 20 65  72 72 6f 72 0d 6e 75 6d  |cts an error.num|
00003630  62 65 72 20 69 6e 20 74  68 65 20 62 79 74 65 20  |ber in the byte |
00003640  66 6f 6c 6c 6f 77 69 6e  67 20 74 68 65 20 42 52  |following the BR|
00003650  4b 2e 20 20 49 6e 20 74  68 69 73 20 65 78 61 6d  |K.  In this exam|
00003660  70 6c 65 20 49 0d 68 61  76 65 20 67 69 76 65 6e  |ple I.have given|
00003670  20 74 68 65 20 6e 75 6d  62 65 72 20 32 35 35 2e  | the number 255.|
00003680  20 20 54 68 69 73 20 69  73 20 74 68 65 6e 20 66  |  This is then f|
00003690  6f 6c 6c 6f 77 65 64 20  62 79 20 61 0d 73 74 72  |ollowed by a.str|
000036a0  69 6e 67 20 77 68 69 63  68 20 74 68 65 20 72 6f  |ing which the ro|
000036b0  75 74 69 6e 65 20 77 69  6c 6c 20 70 72 69 6e 74  |utine will print|
000036c0  20 6f 75 74 2e 20 20 54  68 65 20 73 74 72 69 6e  | out.  The strin|
000036d0  67 20 69 73 0d 74 65 72  6d 69 6e 61 74 65 64 20  |g is.terminated |
000036e0  62 79 20 61 20 6e 75 6c  6c 20 28 7a 65 72 6f 29  |by a null (zero)|
000036f0  20 62 79 74 65 2e 0d 0d  54 68 65 72 65 20 69 73  | byte...There is|
00003700  20 6f 6e 65 20 6f 63 63  61 73 69 6f 6e 20 77 68  | one occasion wh|
00003710  65 6e 20 74 68 69 73 20  73 79 73 74 65 6d 20 77  |en this system w|
00003720  69 6c 6c 20 66 61 69 6c  2c 20 61 6e 64 20 74 68  |ill fail, and th|
00003730  61 74 0d 69 73 20 77 68  65 6e 20 79 6f 75 72 20  |at.is when your |
00003740  63 6f 64 65 20 69 73 20  69 6e 20 61 20 73 69 64  |code is in a sid|
00003750  65 77 61 79 73 20 52 4f  4d 20 61 6e 64 20 69 73  |eways ROM and is|
00003760  20 6e 6f 74 20 61 0d 6c  61 6e 67 75 61 67 65 2e  | not a.language.|
00003770  20 20 54 6f 20 63 6f 75  6e 74 65 72 20 74 68 69  |  To counter thi|
00003780  73 20 79 6f 75 20 68 61  76 65 20 74 6f 20 63 6f  |s you have to co|
00003790  70 79 20 79 6f 75 72 20  73 65 71 75 65 6e 63 65  |py your sequence|
000037a0  20 6f 66 0d 62 79 74 65  73 20 69 6e 74 6f 20 74  | of.bytes into t|
000037b0  68 65 20 62 6f 74 74 6f  6d 20 6f 66 20 74 68 65  |he bottom of the|
000037c0  20 73 74 61 63 6b 20 28  66 72 6f 6d 20 6c 6f 63  | stack (from loc|
000037d0  61 74 69 6f 6e 20 26 31  30 30 29 20 61 6e 64 0d  |ation &100) and.|
000037e0  74 68 65 6e 20 70 6f 69  6e 74 20 74 68 65 20 63  |then point the c|
000037f0  6f 64 65 20 74 68 65 72  65 2e 20 20 49 27 6c 6c  |ode there.  I'll|
00003800  20 64 65 61 6c 20 77 69  74 68 20 74 68 69 73 20  | deal with this |
00003810  69 6e 20 6d 6f 72 65 0d  64 65 74 61 69 6c 20 77  |in more.detail w|
00003820  68 65 6e 20 49 20 67 65  74 20 6f 6e 74 6f 20 73  |hen I get onto s|
00003830  69 64 65 77 61 79 73 20  52 4f 4d 20 66 6f 72 6d  |ideways ROM form|
00003840  61 74 74 69 6e 67 20 69  6e 20 61 20 6c 61 74 65  |atting in a late|
00003850  72 0d 6d 6f 64 75 6c 65  20 73 6f 20 64 6f 6e 27  |r.module so don'|
00003860  74 20 77 6f 72 72 79 20  61 62 6f 75 74 20 69 74  |t worry about it|
00003870  20 66 6f 72 20 74 68 65  20 6d 6f 6d 65 6e 74 2e  | for the moment.|
00003880  0d 0d 54 68 65 20 61 73  73 65 6d 62 6c 65 72 20  |..The assembler |
00003890  72 6f 75 74 69 6e 65 20  69 6e 20 74 68 69 73 20  |routine in this |
000038a0  6d 6f 64 75 6c 65 20 69  73 20 61 20 73 6d 61 6c  |module is a smal|
000038b0  6c 20 6f 6e 65 20 77 68  69 63 68 0d 69 6c 6c 75  |l one which.illu|
000038c0  73 74 72 61 74 65 73 20  74 68 69 73 20 65 72 72  |strates this err|
000038d0  6f 72 20 68 61 6e 64 6c  69 6e 67 2e 20 20 59 6f  |or handling.  Yo|
000038e0  75 20 70 72 65 73 73 20  61 20 6b 65 79 20 61 6e  |u press a key an|
000038f0  64 20 69 66 20 79 6f 75  0d 70 72 65 73 73 20 61  |d if you.press a|
00003900  20 6e 75 6d 62 65 72 20  28 30 2d 39 29 20 74 68  | number (0-9) th|
00003910  65 20 72 6f 75 74 69 6e  65 20 6c 6f 6f 70 73 20  |e routine loops |
00003920  62 75 74 20 69 66 20 79  6f 75 20 70 72 65 73 73  |but if you press|
00003930  0d 61 6e 79 74 68 69 6e  67 20 65 6c 73 65 20 61  |.anything else a|
00003940  6e 20 65 72 72 6f 72 20  69 73 20 67 65 6e 65 72  |n error is gener|
00003950  61 74 65 64 20 61 6e 64  20 61 20 6d 65 73 73 61  |ated and a messa|
00003960  67 65 20 69 73 20 70 72  69 6e 74 65 64 0d 6f 75  |ge is printed.ou|
00003970  74 2e 20 20 49 20 68 61  76 65 20 69 6e 63 6c 75  |t.  I have inclu|
00003980  64 65 64 20 61 20 73 70  65 63 69 61 6c 20 62 69  |ded a special bi|
00003990  74 20 6f 66 20 63 6f 64  65 20 74 68 61 74 20 64  |t of code that d|
000039a0  65 61 6c 73 20 77 69 74  68 0d 61 6e 20 65 73 63  |eals with.an esc|
000039b0  61 70 65 20 69 6e 20 61  20 64 69 66 66 65 72 65  |ape in a differe|
000039c0  6e 74 20 77 61 79 20 74  6f 20 74 68 65 20 73 74  |nt way to the st|
000039d0  61 6e 64 61 72 64 20 65  73 63 61 70 65 20 62 79  |andard escape by|
000039e0  0d 70 72 69 6e 74 69 6e  67 20 61 20 64 69 66 66  |.printing a diff|
000039f0  65 72 65 6e 74 20 6d 65  73 73 61 67 65 2e 0d 0d  |erent message...|
00003a00  49 66 20 79 6f 75 20 63  61 6e 20 63 61 6c 6c 20  |If you can call |
00003a10  74 68 69 73 20 72 6f 75  74 69 6e 65 20 66 72 6f  |this routine fro|
00003a20  6d 20 61 6e 6f 74 68 65  72 20 6c 61 6e 67 75 61  |m another langua|
00003a30  67 65 20 28 6c 69 6b 65  0d 56 69 65 77 29 20 79  |ge (like.View) y|
00003a40  6f 75 20 77 69 6c 6c 20  73 65 65 20 68 6f 77 20  |ou will see how |
00003a50  69 74 20 73 74 69 6c 6c  20 6f 70 65 72 61 74 65  |it still operate|
00003a60  73 2e 20 20 49 66 20 79  6f 75 20 68 61 76 65 20  |s.  If you have |
00003a70  61 0d 36 35 30 32 20 73  65 63 6f 6e 64 20 70 72  |a.6502 second pr|
00003a80  6f 63 65 73 73 6f 72 20  6f 72 20 61 20 4d 41 53  |ocessor or a MAS|
00003a90  54 45 52 20 74 68 65 20  65 61 73 69 65 73 74 20  |TER the easiest |
00003aa0  77 61 79 20 74 6f 20 64  6f 20 73 6f 0d 69 73 20  |way to do so.is |
00003ab0  75 73 69 6e 67 20 74 68  65 20 4f 53 20 63 6f 6d  |using the OS com|
00003ac0  6d 61 6e 64 20 2a 47 4f  20 6e 6e 6e 6e 20 77 68  |mand *GO nnnn wh|
00003ad0  65 72 65 20 6e 6e 6e 6e  20 69 73 20 74 68 65 20  |ere nnnn is the |
00003ae0  76 61 6c 75 65 20 6f 66  0d 63 6f 64 65 25 20 69  |value of.code% i|
00003af0  6e 20 48 45 58 2e 0d 0d  54 68 65 20 6e 65 78 74  |n HEX...The next|
00003b00  20 66 69 76 65 20 6d 6f  64 75 6c 65 73 20 64 65  | five modules de|
00003b10  61 6c 20 69 6e 20 73 6f  6d 65 20 64 65 74 61 69  |al in some detai|
00003b20  6c 20 77 69 74 68 20 69  6e 70 75 74 20 61 6e 64  |l with input and|
00003b30  0d 6f 75 74 70 75 74 2e  20 20 41 6e 79 74 68 69  |.output.  Anythi|
00003b40  6e 67 20 69 6e 76 6f 6c  76 69 6e 67 20 69 6e 70  |ng involving inp|
00003b50  75 74 20 6e 65 65 64 73  20 63 6f 70 69 6f 75 73  |ut needs copious|
00003b60  20 65 72 72 6f 72 0d 68  61 6e 64 6c 69 6e 67 2e  | error.handling.|
00003b70  20 20 54 68 65 73 65 20  77 69 6c 6c 20 61 6c 73  |  These will als|
00003b80  6f 20 69 6e 74 72 6f 64  75 63 65 20 6d 75 6c 74  |o introduce mult|
00003b90  69 70 6c 69 63 61 74 69  6f 6e 20 61 6e 64 0d 64  |iplication and.d|
00003ba0  69 76 69 73 69 6f 6e 20  61 6e 64 20 62 79 20 74  |ivision and by t|
00003bb0  68 65 20 65 6e 64 20 6f  66 20 74 68 65 6d 20 77  |he end of them w|
00003bc0  65 20 77 69 6c 6c 20 68  61 76 65 20 61 20 77 61  |e will have a wa|
00003bd0  79 20 6f 66 0d 69 6e 70  75 74 74 69 6e 67 20 61  |y of.inputting a|
00003be0  6e 64 20 6f 75 74 70 75  74 74 69 6e 67 20 6e 75  |nd outputting nu|
00003bf0  6d 62 65 72 73 20 6f 66  20 61 6e 79 20 73 69 7a  |mbers of any siz|
00003c00  65 20 77 69 74 68 69 6e  20 72 65 61 73 6f 6e 0d  |e within reason.|
00003c10  61 6e 64 20 6f 75 72 20  61 72 69 74 68 6d 65 74  |and our arithmet|
00003c20  69 63 61 6c 20 77 6f 72  6b 20 6f 6e 20 69 6e 74  |ical work on int|
00003c30  65 67 65 72 73 20 77 69  6c 6c 20 62 65 20 63 6f  |egers will be co|
00003c40  6d 70 6c 65 74 65 2e 0d                           |mplete..|
00003c48
15-01-88/T\OSB10.m0
15-01-88/T\OSB10.m1
15-01-88/T\OSB10.m2
15-01-88/T\OSB10.m4
15-01-88/T\OSB10.m5