;******************************************************************+
;* Group:                                                         *
;* Group Members and andrew id:                                   *
;* Lab/Prelab:                                                    *
;******************************************************************+

;***************************************************************+
;* This stationery serves as the framework for a                *
;* user application (single file, absolute assembly application *
;* for 18-348)                                                  *
;***************************************************************+

; export symbols
            XDEF Entry            ; export 'Entry' symbol
            ABSENTRY Entry        ; for absolute assembly: mark this 
                                  ; as application entry point


; include derivative specific macros
            INCLUDE 'mc9s12c128.inc'

; variable/data section
            INCLUDE 'RAMLocation.inc'
            
;****************************************************
; ADD GLOBAL VARIABLES HERE
;****************************************************

;TODO define any RAM variables

ROMStart    EQU  $4000  ; absolute address to place my code/constant data

; code section
            ORG   ROMStart
Entry:
            INCLUDE 'StackInfo.inc'

            CLI                   ; enable interrupts

;*****************************************************
; ADD CODE HERE
;*****************************************************

;BEGIN code for question 2 of Prelab 3

            LDAA #$65             ; first value
            LDAB #$10             ; second value
            ;TODO call customRoutine here
            
            LDAA #$37             ; first value
            LDAB #$A5             ; second value
            ;TODO call swapRoutine here

loopForever:
            BRA loopForever       ;infinite loop
            
            
; ************************************************
            
;custom routine, depending on lab group -- put low 8 bits of result in A
;  lab group 1:   A = A + 3*B;
;  lab group 2:   A = A - 5*B;
;  lab group 3:   A = A + 7*B;
;  lab group 4:   A = A - 9*B;
;  lab group 5:   A = 3*A + B;
;  lab group 6:   A = 5*A - B;
;  lab group 7:   A = 7*A + B;
;  lab group 8:   A = 9*A - B;
;  lab group 9:   A = A - 3*B;
customRoutine:
            ;TODO define function

            RTS

; ************************************************

;Swap A with B
swapRoutine:
            ;TODO define function

            RTS
                                 
;END code for question 2 of Prelab 3


;*****************************************************
; DO NOT MODIFY OR ADD ANYTHING AFTER THIS POINT!
;*****************************************************

;*********************************************************
;*            Interrupt Vectors                          *
;*********************************************************
            ORG   $FFFE
            DC.W  Entry           ; Reset Vector
