Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Forum and Wrox.com Feedback Post your suggestions for improving the Forums or Wrox.com or questions for the staff here. "Where can I find the code for my book?"
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Forum and Wrox.com Feedback section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 4th, 2004, 12:34 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help Please

Hello Everybody

This is my first time writing on here so I will do my best to describe my two problems.

A) I have to make up a program that would change a hexadecimal number of length 4 (e.g. A10F) and change it into decimal form (e.g. 41231)

B) Using the addigits.asm file i have to change to read the string even if other characters are put in by the user (e.g. r6lk72É? would be equal to 15)

I have included the addigits.asm file below. If you could help or give me any clue on how to solve these i would really appreciate it.

TITLE Add individual digits of a number ADDIGITS.ASM
COMMENT |
        Objective: To find the sum of individual digits of
                   a given number. Shows character to binary
                   conversion of digits.
            Input: Requests a number from keyboard.
| Output: Prints the sum of the individual digits.
.MODEL SMALL
.STACK 100H
.DATA
number_prompt DB 'Please type a number (<11 digits): ',0
out_msg DB 'The sum of individual digits is: ',0
number DB 11 DUP (?)

.CODE
INCLUDE io.mac
main PROC
        .STARTUP
        PutStr number_prompt ; request an input number
        GetStr number,11 ; read input number as a string
        nwln
        mov BX,OFFSET number ; BX := address of number
        sub DX,DX ; DX := 0 -- DL keeps the sum
repeat_add:
        mov AL,[BX] ; move the digit to AL
        cmp AL,0 ; if it is the NULL character
        je done ; sum is done
        and AL,0FH ; mask off the upper 4 bits
        add DL,AL ; add the digit to sum
        inc BX ; increment BX to point to next digit
        jmp repeat_add ; and jump back
done:
        PutStr out_msg
        PutInt DX ; write sum
        nwln
        .EXIT
main ENDP
        END main
  #2 (permalink)  
Old February 4th, 2004, 12:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: London, , United Kingdom.
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ask this in a forum where they deal with assembly language, and then tell them what version you're using, too :)

There are two secrets to success in this world:
1. Never tell everything you know
  #3 (permalink)  
Old February 4th, 2004, 01:08 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Where are the assembly language forums then??
  #4 (permalink)  
Old February 4th, 2004, 01:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: London, , United Kingdom.
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Default

All I can tell you is that Wrox doesn't have any. Try using google with some assembler code (and the chip you're coding against) as the search term; that should get you moving in the right direction.

There are two secrets to success in this world:
1. Never tell everything you know
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




All times are GMT -4. The time now is 02:01 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.