; ; adv ptr hl^ by 128 modulo bc, de := unadvanced ptr, hl:= hl+1 ; Wrap around signalled by no carry on exit with nz flag, when ; c returns the bytes to be wrapped. ; a,f,c,d,e,h,l .advance:: mov a,m ! mov e,a; get read (from buffer) pointer adi 128 ! mov m,a ! inx h mov a,m ! mov d,a aci 0 ! mov m,a; and advance for next time dcx h ! mov a,m ! sub c mov c,a inx h ! mov a,m ! sbb b rc; advanced < size mov m,a ! dcx h ! mov m,c; else reset to start inx h ! inr c ! dcr c; check for wrap around ret