; ; main program. calls subr-sum, with inputs 0..M-1 ; results placed in locations 0x300..(0x300+M-1) ; ; M is stored in location 0 ; ; assume standard macros (see subr-sum.masm) are ; available ; M .equ 0 array .equ 0x0300 .org 0x0200 subge i,i,next loop: subge tmp,tmp,next subge tmp,i,next subge N,N,next subge N,tmp,next subge ret,ret,next subge ret,L00000,next subge tmp,tmp,gauss LretLabel00: subge tmp,tmp,next subge tmp,sum,next subge clearbuf,clearbuf,next subge clearbuf,clearTemplate,next subge clearbuf,clearOffset,next clearbuf: subge 0,0,0 ; placeholder subge clearOffset,clearIncr,next subge xferbuf,xferbuf,next subge xferbuf,xferTemplate,next subge xferbuf,xferOffset,next xferbuf: subge 0,0,0 ; placeholder subge xferOffset,xferIncr,next subge i,$-1,next subge tmp,tmp,next subge tmp,M,next subge tmp2,tmp2,next subge tmp2,tmp,next subge tmp2,i,loop endlabel: subge tmp,tmp,endlabel ;end clearTemplate: .word neg(triple(array,array,clearbuf+1)) xferTemplate: .word neg(triple(array,tmp,xferbuf+1)) clearOffset: .word 0 xferOffset: .word 0 clearIncr: .word triple(0x0001,0x0001,0x0000) xferIncr: .word triple(0x0001,0x0000,0x0000) i: .word 0 tmp: .word 0 tmp2: .word 0 L00000: .word neg(triple(tmp,tmp,LretLabel00))