;*****************************************************************
;* This stationery serves as the framework for a                 *
;* user application (single file, absolute assembly application) *
;* For a more comprehensive program that                         *
;* demonstrates the more advanced functionality of this          *
;* processor, please see the demonstration applications          *
;* located in the examples subdirectory of the                   *
;* Freescale CodeWarrior for the HC12 Program directory          *
;*****************************************************************

; export symbols
            XDEF Entry            ; export 'Entry' symbol
            ABSENTRY Entry        ; for absolute assembly: mark this as application entry point
ROMStart    EQU  $4000  ; absolute address to place my code/constant data

;ECE331   Quiz 3  9/17/2009
;"Constant Offset Indexed" and "Offset Indexed Indirect" Addressing 
;         
;     Name: _________________________________   CM Box#: ___________
;
            XDEF Entry            
            ABSENTRY Entry        
            INCLUDE 'mc9s12c128.inc'

            ORG $400
DataBytes:  DC.B $04, $04, $04, $07, $9A, $BC, $DE, $F1, $EC, $D7
DataWords:  DC.W $123, $AB, $CDEF, DataBytes+3
LocX:       DS.B 3    ;Allocate 3 RAM bytes

            ORG   $4000
Entry:
            LDS   #$1000       ; initialize the stack pointer
            LDX   #DataBytes   ;X = $_____________________
            LDAA  0,X          ;A = $_____________________
            LDAA  3,X          ;A = $_____________________
            LDD   5,X          ;D = $_____________________
            INX                ;X = $_____________________
            LDD   5,X          ;D = $_____________________
            LDX   #DataWords   ;X = $_____________________
            LDD   2,X          ;D = $_____________________
            LDAA  5,X          ;A = $_____________________
            LDAA  -3,X         ;A = $_____________________
            LDY   -3,X         ;Y = $_____________________
            LDY   #LocX        ;Y = $_____________________
            STY   1,Y         
            LDAB  2,Y          ;B = $_____________________
            LDAA  1,Y          ;A = $_____________________
                               ;Y = $_____________________
            LDY   #DataBytes
            LDAA  2,Y          ;A = $_____________________
            LDAA  [2,Y]        ;A = $_____________________
            INY
            INY
            LDAA  [-2,Y]        ;A = $_____________________
            LDY   [-2,Y]        ;Y = $_____________________
            LDX   #DataWords
            LDAA  [6,X]        ;A = $_____________________
		        LDD   6,X	      ;D = $_____________________
		        TFR   A,B		 ;D = $_____________________
            LDD   X            ; Note: the "0," is implied, so this 
                                ; is equivalent to "LDD 0,X"
                               ;D = $_____________________
            ORG   $FFFE
            DC.W  Entry        ; Reset Vector