Help please!

I am a beginner in assembly programming using

A86. I've been trying to do simple things...

like adding together two numbers and displaying the

result on the screen. The problem is that I get the

ASCII representation coming up rather than the sum

of the two numbers.


Can anybody help?


TIA


Pete


Comments



  • Transfor PROC NEAR ;Pass in AX as the integer number

    PUSH CS

    PUSH CS

    POP ES ;Get the segment.

    POP DS

    MOV DI, OFFSET MEnd

    MOV BX, 10 ;Divide by 10

    MOV CX, 5 ;Number of digits.

    Moop: XOR DX, DX ;Prevent DIV errors.

    DIV BX

    ADD DL, 48 ;Add a base of 48 for ASCII adjust.

    DEC DI

    MOV ES:[DI], DL

    LOOP Moop

    MOV AH, 9

    MOV DX, DI ;DS:DX needed for call

    INT 21h ;Print string.

    RET ;End procedure

    Buff DB 0,0,0,0,0

    MEnd DB 24h ;Terminating $ for string

    ENDP

    END


    A little messy, but I wrote it myself when I ran into this

    problem.


    Matthew Gross

    Acheron@Hotmail.com


    URL:http://165.91.29.0/home/

  • I can look at my table of hex values when I return home but if you can answer now, What is 24h?




    :



    : Transfor PROC NEAR ;Pass in AX as the integer number

    : PUSH CS

    : PUSH CS

    : POP ES ;Get the segment.

    : POP DS

    : MOV DI, OFFSET MEnd

    : MOV BX, 10 ;Divide by 10

    : MOV CX, 5 ;Number of digits.

    : Moop: XOR DX, DX ;Prevent DIV errors.

    : DIV BX

    : ADD DL, 48 ;Add a base of 48 for ASCII adjust.

    : DEC DI

    : MOV ES:[DI], DL

    : LOOP Moop

    : MOV AH, 9

    : MOV DX, DI ;DS:DX needed for call

    : INT 21h ;Print string.

    : RET ;End procedure

    : Buff DB 0,0,0,0,0

    : MEnd DB 24h ;Terminating $ for string

    : ENDP

    : END

    :


    : A little messy, but I wrote it myself when I ran into this

    : problem.


    : Matthew Gross

    : Acheron@Hotmail.com





Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories