.modelsmall.stack100.datacurrentdb0hcountdb0hsumdb0,0strtmsgdb"How many numbers to add (02-99)?",13,10,"$"msg1db13,10,"Enter the number (","$"msg2db") $",13,10ansisdb"The sum of the numbers is $".codemainprocfarmovax,@datamovds,axmovdx,offsetstrtmsgmovah,09hint21hcallget2dignumincalmovcount,almovcurrent,aldeccurrentcmpal,02hjaelopjmpextlop:movdx,offsetmsg1;Prompt to enter the number
movah,09hint21hmoval,countsubal,currentdasmovdl,almovch,dlanddl,0f0hmovcl,04hroldl,clordl,30hmovah,02hint21hmovdl,chanddl,0fhordl,30hmovah,02hint21hmovdx,offsetmsg2movah,09hint21hmoval,currentsubal,01hdasmovcurrent,alcallget2dignum;Add the number
addal,sum+1daamovsum+1,aljncnocarryincsumnocarry:cmpcurrent,00hjnelopmovdl,13movah,02hint21hmovdl,10movah,02hint21hmovdx,offsetansismovah,09hint21hmovdl,summovch,dlanddl,0f0hmovcl,04hroldl,clordl,30hmovah,02hint21hmovdl,chanddl,0fhordl,30hmovah,02hint21hmovdl,sum+1movch,dlanddl,0f0hmovcl,04hroldl,clordl,30hmovah,02hint21hmovdl,chanddl,0fhordl,30hmovah,02hint21hext:movdl,13movah,02hint21hmovdl,10movah,02hint21hmovah,04chint21hmainendpget2dignumprocnearpushdxmovah,01hint21hmovbl,alandbl,0fhmovah,01hint21hmovcl,04hrolbl,clandal,0fhaddbl,almoval,blmovah,00hpopdxretget2dignumendpendmain