HWmult

HWmult - #include"msp430x44x.h NAME PUBLIC x y z HW_Mul main Program name Make main visible to other files ORG 0200h DS16 1 DS16 1 DS32 ORG DW 4

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include "msp430x44x.h" # NAME HW_Mul // Program name PUBLIC main // Make main visible to other files ORG 0200h x DS16 1 ; allocate space for one 16-bit word labeled x y DS16 1 ; allocate space for one 16-bit word labeled y y z DS32 4 ; allocate space for one 32-bit word labeled z ORG 0FFFEh ; Setup the RESET vector DW main RSEG CODE ; define a relocatable code segment main MOV #0xA00,SP ; set the address of SP MOV #100, x ; assign value to x MOV #298, y ; assign value to y CLR R4 ; set R4 = 0 DINT ; Disable interrupts, as precaution ; unsigned multiply => MPY MOV x, MPY ; x is OP1 for unsigned multiply MOV y, OP2 ; assigning z to OP2 initiates multiply NOP ; Wait an instruction cycle ; 100*298 = 29800 = 00007468h MOV RESLO, z(R4) ; save low word of result at z + 0 INCD R4 ; double increment R4 = R4+2 MOV RESHI, z(R4) ; save high word of result in z + 2 ; signed multiply => MPYS MOV #100, x ; assign value to x = 100 MOV #0FFFFh, y ; assign value to z = -1 INCD R4 ; set R4 = R4+2 MOV x, MPYS
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/04/2010 for the course ECE 2801 taught by Professor Jarvis during the Spring '08 term at WPI.

Page1 / 2

HWmult - #include"msp430x44x.h NAME PUBLIC x y z HW_Mul main Program name Make main visible to other files ORG 0200h DS16 1 DS16 1 DS32 ORG DW 4

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online