Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

zskater (Programmer) (OP)
15 Apr 01 9:58
I am studying computing science at university and i am having problems with the following homework
I'm hoping someone will be able to help me out.


HOMEWORK
Develop an emmbedded intel 8086 assembler program in stages to solve the following problem

Convert a string containing an unsigned integer as a sequence of hexidecimal character digits to another string containing the corresponding decimal character digits within the assembler, without using any logical operations (AND,OR,XOR,shift), without using multiplication or division operations and without using a straight sequence of simple 4 repeated ADD operations to achieve multiplication.
The Pascal section will only input the original string and print the result.
(assume that the maximum hex. input number is 7FFF. use only 8-bit and 16-bit registers, except for the 32-bit string address register.)

You may find it helpful to use internal procedure calls in the assembler, which jump to a section of code with a label and which returns to the assembler statment after the call

    CALL  @POINT  {call procedure POINT}
     ....
    @POINT NOP    {start of procedure}
    ....
    RET           {return from procedure}

I have 3 days left before I have to hand it in.
Cheers Steve
Yahel (Programmer)
16 Apr 01 11:07
Ok. I don't have time to think of a better solution (Any solution is better than this one), but it is better than nothing, so here it is:

START:
MOV     CX,0FFFFh        ;the number to turn to Decimal
MOV     AX,0
MOV     BX,0
MOV     DL,0
INC_LOOP:
INC     AL               ;AL is the first digit
CMP     AL,0Ah           ;Has it reached 10 yet?
JNE     CONTINUE         ;No, continue.
MOV     AL,0             ;Yes, empty it
INC     AH               ;AH is the second digit
CMP     AH,0Ah           ;Has it reached 10 yet?
JNE     CONTINUE         ;No, continue ...
MOV     AH,0
INC     BL               ;BL is the third digit
CMP     BL,0Ah
JNE     CONTINUE
MOV     BL,0
INC     BH               ;BH is the forth digit
CMP     BH,0Ah
MOV     BH,0
INC     DL               ;DL is the fifth digit
        
CONTINUE:
LOOP    INC_LOOP

Now you will have every Decimal digit in a different 8-bit register. Making the string from here shouldn't be a problem.

Hope you find a better solution, and if you do, or if your teacher shows you one, please tell me about it.
aphrodita (Programmer)
16 Apr 01 19:19
I would suggest to use this algorithm:
- Check how many 10 thousands your number has

XOR CX,CX
@loop_TT :
CMP Number, 3e8h
jb @TT_DONE
INC CX
JMP @loop_TT
@TT_DONE :

; {Now you have to display value of CX, if it is more than Ah, then display '1', then SUB CX,0Ah , display the rest}

and this algo should do the same for thousands,hundreds, tens and the last display as it appears.

Best Regards,

aphrodita@mail.krovatka.ru     {uiuc rules}
http://www.hellforge.org

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close