From: leger_v AT bluewin DOT ch Newsgroups: comp.os.msdos.djgpp Subject: error idiv :divide by zero Date: Fri, 26 Dec 1997 23:34:09 +0100 Organization: Unisource Business Networks Lines: 20 Message-ID: <34A430E1.2495@bluewin.ch> NNTP-Posting-Host: bel7pub74.bluewin.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk look at this program : static unsigned char quotient; static unsigned char remainder; main() { asm("pusha movb $8,%al ;2 samples numbers movb $3,%cl ; idiv %cl mov %al, _quotient mov %ah, _remainder popa"); printf("8 : 3 = %d and remainder : %d" quotient, remainder); } this program works fine. But if I use word register like %ax (movw $998, %ax)and %cx(movw $98, %cx)(naturally quotient and remainder are unsigned int)the program doesn't function : it writes: "error divide by zero). How could I use bigger registers (word or dword) without having "divide by zero"? Thanks Patrick