I am new to asm and know the basics, I am stuck on this question, I found a book with no solutions, go figure. The question I am having trouble with and cant figure out where to start is this: Ax+b<0; the question asks to solve for x; so x<or>the output of -B/A; A and B are input by the user, they can be any integer number. Thanks for any help
Posted on 2001-11-15 22:37:34 by jpre
Well the input side is target dependant (under win32:console app, dialog, etc.), so thats really up to you.

As for working out (-B)/A, that is quite simple, may I suggest you use one of the two divides (only one is suitable in this case, but I'll leave that up to you to decide), and secondly you will need to use the neg opcode.

Considering this really sounds like homework (and quite a simple one at that), I think I've already helped too much!

Posted on 2001-11-16 04:28:13 by Mirno
How do I get the input and what register is it stored into, next what is a neg oppcode, I am using Tasm.
thanx jpps
Posted on 2001-11-16 08:23:00 by jpre
How you get the input depends on your target OS, and personal preference.

The easiest thing to do is hardwire it into the code, that way you can worry about input later.

What register it is stored to depends on how you get it. By default windows APIs return values in eax.

The neg opcode:

Subtracts the destination from 0 and saves the 2s
complement of "dest" back into "dest".

It can be used with an 8, 16, or 32bit register, or memory.

TASM is dead, Inprise (formerly Borland) no longer support it, or plan to as far as I am aware. Although it is a "better" assembler in terms of speed, it doesn't support the more modern instructions except through added macro packs.
I'd advise you to drop TASM, and get the MASM32 pack.

The pack comes with tutorials, examples, and the support of this board. It is also designed for use with Windows 9x / NT / 2K, and in theory XP.

Even so, both neg and the two integer divides div & idiv are fully supported in TASM, so you should have no problems.

Posted on 2001-11-16 09:20:52 by Mirno