0 Members and 2 Guests are viewing this topic.

Hmmm, it seems the - character is not supported correctly in Strings? It becomes a q on my 84SE

Does anyone know a fast routine for dividing two unsigned 16-bit registers?

div_hl_de: ; BC = HL/DE, HL = remainder ld a,h ld b,l ld hl,0 scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a ld c,a ld a,b scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a scf \ rla \ adc hl,hl \ sbc hl,de \ jr nc,$+4 \ add hl,de \ dec a ld b,a ret