Not Yet Answered # Division in Assembly?

sysop_fb 47 Discussion Starter Rameses sysop_fb 47 Discussion Starter Rameses Discussion Starter Rameses Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...

Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...

0

How can I perform Division in Marie Assembly Language? The functions available in Marie programming are for Addition and Subtraction. Any help will be appreciated.

You can do division using subtraction.

60 / 3 if I subtract 3 from 60 it will take 20 times before 60 < 3

0

You can do division using subtraction.

60 / 3 if I subtract 3 from 60 it will take 20 times before 60 < 3

I was able to do multiplication:Input /Input A value

Store A

Input /Input B value

Store B

Loop, Load A

Skipcond 800 If AC > 0, continue loop

Jump Endloop

Subt One

Store A

Load C

Subt B

Store C

Jump Loop

Endloop, Load C

Output

Halt

C, DEC 0

A, DEC 0

B, DEC 0

One, DEC 1

Division doesn't seems to be working for me. Is there something I could change in multiplication code to make division work? Multiplication is repeated adding, similar to Division, repeated subtraction.

0

Psuedocode

```
a = 60
b = 3
divide a b
divide a b:
c=0
while a isn't less then b
a = a - b
c = c + 1
```

0

Psuedocode

`a = 60 b = 3 divide a b divide a b: c=0 while a isn't less then b a = a - b c = c + 1`

ORG 100

Input

Store X

Input

Store Y

Load Zero / Move 0 into AC

Store Z / Set Z to 0

If, Load Z / Load Z

Skipcond 400 / If AC=0 (Z=0), skip the next instruction

Jump Endif / Jump to Endif if X is not greater than 1

Then, Load X

Subt Y / X - Y

Store X / X= X - Y

Endif, Load Z / Load Z into AC

Add One / Add 1 to Z

Store Z / Z = Z + 1

Output

Halt / Terminate program

X, Dec 0 / X has starting value, not given in problem

Y, Dec 0 / Y has starting value, not given in problem

Z, Dec 0

One, Dec 1 / Use as a constant

Zero, Dec 0 / Use as a constant

END

What am I missing?

0

ORG 100

Input

Store X

Input

Store Y

Load Zero / Move 0 into AC

Store Z / Set Z to 0

If, Load Z / Load Z

Skipcond 400 / If AC=0 (Z=0), skip the next instruction

Jump Endif / Jump to Endif if X is not greater than 1

Then, Load X

Subt Y / X - Y

Store X / X= X - Y

Endif, Load Z / Load Z into AC

Add One / Add 1 to Z

Store Z / Z = Z + 1

Output

Halt / Terminate program

X, Dec 0 / X has starting value, not given in problem

Y, Dec 0 / Y has starting value, not given in problem

Z, Dec 0

One, Dec 1 / Use as a constant

Zero, Dec 0 / Use as a constant

ENDWhat am I missing?

Nevermind, I got it. Thanks a ton! :)

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

Hi. Im using vb 2010. I want to dynamically add textboxes to my form by clicking on a button. I've google searched and so far this code worked:

```
Private Sub btn_addline_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_addline.Click
Dim txtB1 As New TextBox
Dim i
For i = ...
```