Created
February 25, 2014 00:02
-
-
Save Hardolaf/9199921 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; MSP430 Assembler Code Template for use with TI Code Composer Studio | |
; | |
; | |
;------------------------------------------------------------------------------- | |
.cdecls C,LIST,"msp430.h" ; Include device header file | |
;------------------------------------------------------------------------------- | |
.text ; Assemble into program memory | |
.retain ; Override ELF conditional linking | |
; and retain current section | |
.retainrefs ; Additionally retain any sections | |
; that have references to current | |
; section | |
;------------------------------------------------------------------------------- | |
RESET mov.w #__STACK_END,SP ; Initialize stackpointer | |
StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer | |
;------------------------------------------------------------------------------- | |
; Main loop here | |
;Main function/routine ;Setup for the call | |
push A | |
push B | |
call #srmult | |
pop A | |
pop B | |
;----------------------------------------------------------------------- | |
push F | |
push G | |
call #srmult | |
pop F | |
pop G | |
;----------------------------------------------------------------------- | |
push E | |
push M | |
call #srmult | |
pop E | |
pop M | |
;------------------------------------------------------------------------ | |
push H | |
push I | |
call #srmult | |
pop H | |
pop I | |
;--------------------------------------------------------------------------- | |
push J | |
push K | |
call #srmult | |
pop J | |
pop K | |
loop: jmp loop | |
;here we will start the subroutine | |
srmult mov 2(SP),R6 ;This will sent to R6 | |
mov 4(SP),R5 ;This will sent to R5 | |
clr R7 | |
mlp add R6,R7 | |
dec R5 | |
jne mlp | |
mov R7,4(SP) | |
ret ;end of the subroutine | |
;This is where we declare the variables | |
A .word 0x0003 | |
B .word 0x0003 | |
;----------------------------- | |
E .word 0x0006 | |
M .word 0x0007 | |
;------------------------------ | |
F .word 0x0008 | |
G .word 0x0009 | |
;----------------------------- | |
H .word 0x0008 | |
I .word 0x0001 | |
;---------------------------- | |
J .word 0x0002 | |
K .word 0x0002 | |
;------------------------------------------------------------------------------- | |
;------------------------------------------------------------------------------- | |
; Stack Pointer definition | |
;------------------------------------------------------------------------------- | |
.global __STACK_END | |
.sect .stack | |
;------------------------------------------------------------------------------- | |
; Interrupt Vectors | |
;------------------------------------------------------------------------------- | |
.sect ".reset" ; MSP430 RESET Vector | |
.short RESET |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment