; ; 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 goto: macro label subge tmp,tmp,label endmacro call: macro subr,retInstAddr clear retInstrAddr subge retInstrAddr,L0,next goto subr LretLabel: .data ; indicate place elsewhere, not ; part of the instruction stream L0: .word neg(triple(tmp,tmp,LretLabel)) ; L label means local label .text endmacro .org 0x0200 zero i loop: move i,N call gauss,ret 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 inc i 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