rcmx_cpi.asm
bitfixer_bitfixer/dg/z88dk/libsrc/z80_crt0s/z80_emu/rcmx_cpi.asm

; Substitute for z80 cpi instruction
; aralbrec 06.2007

PUBLIC rcmx_cpi

.rcmx_cpi

   jr c, cpiwcarry
   
   cp (hl)
   inc hl
   dec bc
   
   push af
   ex (sp),hl
   res 0,l

.rejoin

   set 2,l

   ld a,b
   or c
   jr nz, exitcpi
   res 2,l

.exitcpi

   ex (sp),hl
   pop af
   ret

.cpiwcarry

   cp (hl)
   inc hl
   dec bc
   
   push af
   ex (sp),hl
   set 0,l
   jr rejoin
