Write a program in assembler tor an up8086 ACM86 to perform
Solution
II. up8086
III. MSP
; Macro Definition for the signed multiplication 16x16 bits
;
MPYS16 .MACRO arg1,arg2 ; Signed MPY 16x16 bits
MOV arg1,&0132h
MOV arg2,&0138h
.ENDM ; Result in SumExt|SumHi|SumLo
;
; Multiply the contents of two registers R4 and R5
;
MPYS16 R4,R5 ; MPY signed R4 and R5
MOV &SumLo,R6 ; LSBs of result to R6
MOV &SumHi,R7 ; MSBs of result to R7
MOV &SumExt,R8 ; Sign of result to R8
... ; Continue
; Multiply the contents located in a table, R6 points to
; The result is addressed in indirect mode: a NOP is necessary
; to allow the completion of the multiplication
;
MOV #SumLo,R5 ; Pointer to LSBs of result
MPYS16 @R6+,@R6 ; MPY signed table contents
NOP ; Allow completion of MPYS16
MOV @R5+,R7 ; LSBs of result to R7
MOV @R5+,R8 ; MSBs of result to R8
MOV @R5,R9 ; Sign of result to R9
... ; Continue
;
; Macro Definition for the signed multiplication–and–
; accumulation 16x16 bits. The accumulation is made in the
; RAM: MACHi, MACmid and MAClo. If more than 48 bits are used
; for the accumulation, the SumExt register is added to all
; further extensions (RAM or registers) here shown for only
; one extension (48 bits).
;
MACS16 .MACRO arg1,arg2 ; Signed MAC 16x16 bits
MOV arg1,&0132h ; Signed MPY is used
MOV arg2,&0138h
ADD &SumLo,MAClo ; Add LSBs to result
ADDC &SumHi,MACmid ; Add MSBs to result
ADDC &SumExt,MAChi ; Add SumExt to MSBs
.ENDM
;
; Multiply and accumulate signed the contents of two tables
;
MACS16 2(R6),@R5+ ; MAC for the table contents
.... ; Accumulation is yet made

