More newbie assembly help

Before I say anything, can someone maybe direct me to a good assembly help forum? I feel kind of 'rule-breaky' just posting my questions in the lounge of the C++ forum, I know it's for off-topic stuff, but still.

But anyways, I'm having a problem with adding two single digit numbers (Since they are ASCII I do the add 48 thing, I know that doesn't work past 9, giving some guidance on this would really be appreciated). Anyways, heres the code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
variables:
Value1 db ?
Value2 db ?

inputting:
mov ah, 01
int 21h
mov Value1, al

mov ah, 01
int 21h
mov Value2, al

adding:
mov al, Value1
add al, Value2
add al, 48

outputting:
mov ah, 02
mov dl, al
int 21h

exit:
mov ah, 4Ch
mov AL, 00
int 21h


Excuse any newbish mistakes, this is my, er... Second day I think.
I know Daniweb has an Assembly sub-section... here's the link:
http://www.daniweb.com/software-development/assembly/125

For individual flavors of assembly, I know of two forums.

For FASM:
http://board.flatassembler.net/

For NASM:
http://forum.nasm.us/

Have fun! :) ...and I should remove Assembly from my skills list. It's gotten too rusty. :(

-Albatross
Thanks for the response, I'll post all of my assembly questions there now. :D
Why are you storing a number in a byte? You should be using at least a word length. Also remember you can use the atod (ASCII to decimal) and itoa (convert back to ASCII) macros from io.h. Should be something simple like:

1
2
3
4
5
value1 DWORD 10
value2 DWORD 20

mov eax, value1 ; (Copy value1 into eax register, remember first byte is in al.)
add eax, value2  ; (Two memory operands cannot be used with the add instruction.)
Last edited on
Okay, the word fixes fixed it. Can you explain exactly what you mean for converting ASCII to decimal? I'm making this in the A86 Assembler, not a C++ or C compiler with _asm.
Topic archived. No new replies allowed.