a equ 0 b equ 1 c equ 2 d equ 3 output equ 4 .org 0x100 main: subge tmp,tmp,next subge tmp,a,next subge x,x,next subge x,tmp,next subge tmp,tmp,next subge tmp,b,next subge y,y,next subge y,tmp,next subge negMultRet,negMultRet,next subge negMultRet,L000,next .data L000: .word neg(triple(tmp,tmp,LretLabel000)) .text subge tmp,tmp,negMult LretLabel000: subge output,output,next subge output,negProd,next subge tmp,tmp,next subge tmp,c,next subge x,x,next subge x,tmp,next subge tmp,tmp,next subge tmp,d,next subge y,y,next subge y,tmp,next subge negMultRet,negMultRet,next subge negMultRet,L001,next .data L001: .word neg(triple(tmp,tmp,LretLabel001)) .text subge tmp,tmp,negMult LretLabel001: subge output,negProd,next done: subge tmp,tmp,done .data tmpSum: .word 0 tmp: .word 0 .text negMult: subge xx,xx,next subge xx,x,next ; xx = -x subge negProd,negProd,next ; negProd = 0 multLoop: subge xx,zero,negMultRet ; xx = xx + 0 ; = -x + 0 >= 0 ; or 0 >= x. subge negProd,y,next ; negProd = negProd - y subge xx,neg1,next ; xx = xx + 1 subge tmp,tmp,multLoop negMultRet: .word 0,0,0 ; negProd = -(x * y) .data zero: .word 0 neg1: .word neg(1) negProd: .word 0 x: .word 0 y: .word 0 xx: .word 0