; ; 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 ; 0x0200 ; .org 0x0200 0x022102210201 ;0x0200 subge i,i,next 0x022202220202 ;0x0201 loop: subge tmp,tmp,next 0x022202210203 ;0x0202 subge tmp,i,next 0x011001100204 ;0x0203 subge N,N,next 0x011002220205 ;0x0204 subge N,tmp,next 0x010801080206 ;0x0205 subge ret,ret,next 0x010802240207 ;0x0206 subge ret,L00000,next 0x022202220100 ;0x0207 subge tmp,tmp,gauss ;0x0208 LretLabel00: ; 0x022202220209 ; subge tmp,tmp,next 0x02220111020a ;0x0209 subge tmp,sum,next ; 0x020d020d020b ;0x020a subge clearbuf,clearbuf,next 0x020d021b020c ;0x020b subge clearbuf,clearTemplate,next 0x020d021d020d ;0x020c subge clearbuf,clearOffset,next 0x000000000000 ;0x020d clearbuf: subge 0,0,0 ; placeholder 0x021d021f020f ;0x020e subge clearOffset,clearIncr,next ; 0x021202120210 ;0x020f subge xferbuf,xferbuf,next 0x0212021c0211 ;0x0210 subge xferbuf,xferTemplate,next 0x0212021e0212 ;0x0211 subge xferbuf,xferOffset,next 0x000000000000 ;0x0212 xferbuf: subge 0,0,0 ; placeholder 0x021e02200214 ;0x0213 subge xferOffset,xferIncr,next ; 0x022102250215 ;0x0214 subge i,$-1,next 0x022202220216 ;0x0215 subge tmp,tmp,next 0x022200000217 ;0x0216 subge tmp,M,next 0x022302230218 ;0x0217 subge tmp2,tmp2,next 0x022302220219 ;0x0218 subge tmp2,tmp,next 0x022302210201 ;0x0219 subge tmp2,i,loop ; 0x02220222021a ;0x021a endlabel: subge tmp,tmp,endlabel ;end ; 0xFCFFFCFFFDF2 ;0x021b clearTemplate: .word neg(triple(array,array,clearbuf+1)) = -0x03000300020e 0xFCFFFDDDFDED ;0x021c xferTemplate: .word neg(triple(array,tmp,xferbuf+1)) = -0x030002220213 0x000000000000 ;0x021d clearOffset: .word 0 0x000000000000 ;0x021e xferOffset: .word 0 0x000100010000 ;0x021f clearIncr: .word triple(0x0001,0x0001,0x0000) 0x000100000000 ;0x0220 xferIncr: .word triple(0x0001,0x0000,0x0000) 0x000000000000 ;0x0221 i: .word 0 0x000000000000 ;0x0222 tmp: .word 0 0x000000000000 ;0x0223 tmp2: .word 0 0xFDDDFDDDFDF8 ;0x0224 L00000: .word neg(triple(tmp,tmp,LretLabel00)) = -0x022202220208 0xffffffffffff ;0x0225 neg1: .word -1