Path: utzoo!attcan!uunet!mcsun!unido!altger!snoopy From: snoopy@altger.UUCP (Mathias Niemz) Newsgroups: comp.os.cpm Subject: Division by Z80 Keywords: z80, division Message-ID: <1946@altger.UUCP> Date: 21 Oct 89 11:53:26 GMT Organization: Altos Computer Systems Munich Lines: 32 Someone was looking for multiplikation/division with a Z80. Here is a routine for a 16-bit-division: .z80 ; ; in: bc=divisor de=divident ; out: bc unveraendert, de=rest, hl=quotient ; divi: ld bc,111h ld de,7000h ; 7000/111= ???? xor a ld h,a ld l,a ld a,16 dloop: rl e rl d adc hl,hl sbc hl,bc jr nc,diffok add hl,bc diffok: ccf dec a jr nz,dloop rst 38h end -- uucp: ...!pyramid!netmbx!altger!snoopy or ...!uunet!altnet!altger!snoopy Snailmail: Mathias Niemz, Preussenallee 23, D-1000 Berlin 19 Phone (Voice !) D-030 305 50 60 Fax (on vacancy only !): 49 5121 15405 Datex-P: (0262)44 3000 90345 (no uucp yet) GEO1:M.Niemz bix:m.niemz