Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Off-Topic > Assembly.... masm... divide overflow.... HELP!!!!!
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
20.Sep: FOURTH CHAPTER IN `HISTORY OF...` PUBLISHED
13.Sep: NEWS ON THE FLY
06.Sep: APOLYTON DONATES TO HURRICANE RELIEF

bottom of page
   - CIVILIZATION 3 $9.99 - CIVILIZATION 2 from $6.95 - CIVILIZATION 2 from $4.25 - ALPHA CENTAURI + ALIEN CROSSFIRE (laptop collection) from $19.99 - ALPHA CENTAURI PC $9.99 -->
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
Vesayen is offline Vesayen
Chieftain

Mar 2002
time: 00:29
  Old Post 28-03-2005 00:33
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Assembly.... masm... divide overflow.... HELP!!!!! Support Apolyton, buy Galactic Civilizations

I don't know what causes this... I can not imagine. I get divide by 0 errors all the damn time, I can not for the life of me figure out why. I almost never use the division instruction(which is problematic as you might imagine!) because every time I do I get a divide by zero error.....

Now I don't get it ALL the time. For example if the first instruction in my program is:

mov ax, 1439
mov bx, 16
div bx

it will work

SOMETIMES I can even do:

mov ax, 1439
mov bx, 16
div bx
div bx
dix bx


and the error won't come till the third div bx. If I put this code in a procedure far down in my program, a divide by zero error is often caused by the first division.... for the love of all that is good and holy I can NOT figure this out, any ideas? Is this my computer not having enough memory? That makes no sense... WHAT THE HELL IS CAUSING THIS?

Kuciwalker is offline Kuciwalker
Emperor
of Schmooism
Feb 2001
time: 00:29
  Old Post 28-03-2005 00:34
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Lose 30 kilos (of popups)

Divide underflow?

Vesayen is offline Vesayen
Chieftain

Mar 2002
time: 00:29
  Old Post 28-03-2005 00:37
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Help yourself to an AD-FREE life

Divide OVERFLOW.

For the life of me I can not figure this out.

Kuciwalker is offline Kuciwalker
Emperor
of Schmooism
Feb 2001
time: 00:29
  Old Post 28-03-2005 00:38
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Increase the size of your Attachments

I thought you got underflow errors when you divided by a really small number...

Vesayen is offline Vesayen
Chieftain

Mar 2002
time: 00:29
  Old Post 28-03-2005 00:40
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Help yourself to an AD-FREE life

I am getting a divide overflow error, trying to divide 1439 by 16, repetadly.

When I do that I get AX to be 59h and when I try to divide 59h by 16, I get a divide overflow... this makes no sense.

Last edited by Vesayen on 28-03-2005 at 00:47

Kuciwalker is offline Kuciwalker
Emperor
of Schmooism
Feb 2001
time: 00:29
  Old Post 28-03-2005 00:41
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton

Try just dividing 59h by 16.

Vesayen is offline Vesayen
Chieftain

Mar 2002
time: 00:29
  Old Post 28-03-2005 00:48
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

Works fine.

Vesayen is offline Vesayen
Chieftain

Mar 2002
time: 00:29
  Old Post 28-03-2005 01:02
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

Any ideas why succesive divisions will not work? My laptop I am running this on is not great but pretty good,, it runs never winter nights....

Atahualpa is offline Atahualpa
Emperor
Hawthrone
Mar 1999
time: 06:29
  Old Post 28-03-2005 01:51 Visit Atahualpa's homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

what registers does div modify?

Ari Rahikkala is offline Ari Rahikkala
King
Unreported loss of streaming in atomic read operation
Oct 1999
time: 07:29
  Old Post 28-03-2005 02:06 Visit Ari Rahikkala's homepage!
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Full PM-box? Change here!

"div bx" takes the unsigned int in the register pair dx:ax, divides it by the unsigned int in bx, puts the quotient in ax, and puts the remainder in dx. It raises #de in case the divisor is 0 or the quotient is too big to fit in the target register.

That's the way I understood it, anyway. I've never actually written asm in my life...

Whoha is offline Whoha
King
The TOC is supposed to be classified guys...
Dec 2001
time: 23:29
  Old Post 28-03-2005 02:12
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

so whats in dx during all this?

Atahualpa is offline Atahualpa
Emperor
Hawthrone
Mar 1999
time: 06:29
  Old Post 28-03-2005 02:22 Visit Atahualpa's homepage!
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

Whoha raises the question!

Whoha is offline Whoha
King
The TOC is supposed to be classified guys...
Dec 2001
time: 23:29
  Old Post 28-03-2005 02:27
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Support Apolyton, buy Civilization 2

if dx starts at zero the first 3 divisions should "work" but thats probably not the case. a high enough dx should put greater then 65535 in ax and thats like your problem. any dx greater then 16 will generate this.

Ari Rahikkala is offline Ari Rahikkala
King
Unreported loss of streaming in atomic read operation
Oct 1999
time: 07:29
  Old Post 28-03-2005 02:58 Visit Ari Rahikkala's homepage!
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Enter the AD-FREE zone

I can't see a way dx should become greater than div's source operand, though. If something else uses dx, sure, but as far as I know, the remainder should always be smaller than the divisor in a division

Urban Ranger is offline Urban Ranger
Apolyton Duke of Off-Topic

Donate to the Red Cross
The City State of Noosphere, CPA special envoy
May 1999
time: 13:29
  Old Post 28-03-2005 11:50
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Enter the AD-FREE zone

Run the program through a debugger. Put a breakpoint before the third DIV, and check the various register values.

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:29.
Apolyton Time is 00:29.
    top of page
Rate This Thread:
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0420 seconds (87.97% PHP - 12.03% MySQL) with 29 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net