*
*
*               LOGICAL INSTRUCTIONS
*
*
RAMStart        EQU     $0040
RomStart        EQU     $E000
ResetVector     EQU     $FFFE

                ORG     ResetVector
                FDB     MAIN

                ORG     RAMStart
MEM1            FCB     $FF
MEM2            FCB     $15

                ORG     RomStart

*
*               Constants are specific numbers entered into
*               assembly language instructions.
*               The default base for all constants in the assembler is hexadecimal.
*               Either a prefix or a suffix is used, not both.  
*
*                       Base	Prefix	Suffix
*                       02	%	Q
*                       10	!	T
*                       16	$	H 
* 
*                       Ex : 10010111Q = %10010111 = 97H = $97
*
*                Additionally, a character $ or  *  by itself is used to mean
*                "the current program counter".
*
*                       JMP $	; jump to itself
*                       JMP *	; jump to itself
*
*




MAIN            LDA     #%11111111    ; Load A to $FF

*
*               AND, OR, EXCLUSIVE OR INSTRUCTIONS
*

                AND     #%11110001    ; And A with #F1

                ORA     MEM1          ; Or A with MEM2

                LDA     #%01010101
                EOR     #%00001111    ; Exclusive A with #$0F 
                
                NOP

*
*               ONE'S COMLEMENT INSTRUCTIONS
*                
                LDA     #%00001111
                LDX     #%10101010

                COMA                   ; One's complement of A
                
                COMX                   ; One's complement of X
                
                COM     MEM1           ; One's complemet of MEM1
                
*
*               BIT TEST INSTRUCTION
*               PERFORMS LOGICAL AND OF A OR A MEMORY LOCATION
*               DO NOT CHANGE THE CONTENTS OF ACCUMULATOR
*               MODIFIES CONDITION CODES
*
*               THIS INSTRUCTION IS TYPICALLY USED TO SEE IF A
*               PARTICULAR BIT, OR ANY OF SEVERAL BITS IN A BYTE 1S.
*                
                LDA     #%00110000
                BIT     #%11001111      ; AFTER AND, IF ALL BITS ARE ZERO, THEN Z=0
                BNE     NOTEQUAL
                LDX     #$FF            ; IF EQUAL, X=FF
                BRA     CONTINUE
NOTEQUAL        LDX     #$00            ; IF NOT EQUAL, X=00
CONTINUE        NOP



           
