ADIM81
         PLA
         STA   RETADR
         PLA
         STA   RETADR+1
         PLA
         STA   :FILL      
         PLA
         STA   :ESIZE     
         STA   :ESZBAK
         PLA
         STA   :ASIZE     
         STA   :ASZBAK
         PLA
         STA   ADDR1      
         PLA
         STA   ADDR1+1
         LDY   #0
         LDA   #0
         STY   SCRATCH
         BEQ   :ENTLP
:DOADD
         CLC
         ADC   :ASIZE
         TAX
         TYA
         ADC   SCRATCH
         TAY
         TXA
:LP
         ASL   :ASIZE
         ROL   SCRATCH
:ENTLP
         LSR   :ESIZE
         BCS   :DOADD
         BNE   :LP
         CLC
         INX
         INX   
         
         BCC   :NOINY     
         INY
:NOINY
         STX   :MSIZE     
         STY   :MSIZE+1   
         LDA   :FILL      
         LDX   :MSIZE+1
         BEQ   :PART      
         LDY   #0
:FULL
         STA   (ADDR1),Y
         INY   
         BNE   :FULL      
         INC   ADDR1+1    
         DEX
         BNE   :FULL      
:PART
         LDX   :MSIZE     
         BEQ   :MFEXIT    
         LDY   #0
:PARTLP
         STA   (ADDR1),Y  
         INY              
         DEX   
         BNE   :PARTLP    
:MFEXIT
         LDY   #0
         LDA   :ASZBAK
         STA   (ADDR1),Y
         INY
         LDA   :ESZBAK
         STA   (ADDR1),Y
         LDA   RETADR+1
         PHA
         LDA   RETADR
         PHA
         LDY   ADDR1      
         LDX   ADDR1+1    
         LDA   :ASZBAK
         LDA   :MSIZE
         STA   RETURN
         LDA   :MSIZE+1
         STA   RETURN+1
         LDA   #2
         STA   RETLEN     
         RTS
:MSIZE   DS    2
:ASIZE   DS    1
:ESIZE   DS    1
:ASZBAK  DS    1
:ESZBAK  DS    1
:FILL    DS    1
