• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Dividing in assembly?

JTB

Live for the applause
Premium
Joined
Nov 13, 2006
Messages
6,512
Basically, title.

I'm working on an assignment that converts decimal to hex, and I am severly stuck on how you are suppose to divide in assemly language. This is the first time I've used assembly in a college class, and the teacher isn't too helpful at all.

If anyone knows, please give me an algorithm or something. I need to finish this soon :(
 

AltF4

BRoomer
BRoomer
Joined
Dec 13, 2005
Messages
5,042
Location
2.412 – 2.462 GHz
What assembly language is it? MIPS? If so, just say

div $reqister1, $register2

The quotient in LO and the remainder in HI

Other assembly languages should have the same thing or identical operations. Division is pretty basic.
 

JTB

Live for the applause
Premium
Joined
Nov 13, 2006
Messages
6,512
It's actually something called LC-3, I don't know much about assembly in whole, so it might be known.

Basically, you can only do ADD, AND, and NOT.
 

AltF4

BRoomer
BRoomer
Joined
Dec 13, 2005
Messages
5,042
Location
2.412 – 2.462 GHz
Hmmm. Curious. Looks like LC-3 doesn't have division, you're right.

Well, if all you're supposed to do is define how to do division, just go here. On the bottom of the page, they have the code for division. Do be sure to change some of it though... you know.
 

JTB

Live for the applause
Premium
Joined
Nov 13, 2006
Messages
6,512
Man, thats exactly what I was looking for. Thanks so much :)
 
Top Bottom