Guest_imported
New member
- Jan 1, 1970
- 0
I want to output a # value but instead I get a wierd symbol, I believe the ascii equivalent. I want the output to be "The value is 55" however I get "The value is *". Its more like a diamond than a *. This is what I have:
%title "Adding 1-10"
ideal
model small
stack 256
dataseg
sum dw 0
count dw 3
message db "The value is ", "$"
excode db 0
codeseg
Start:
mov ax, @data
mov ds, ax
mov ax, 1
mov bx, 2
add ax, bx ; ax = 3
add ax, [count] ; ax = 6
inc [count] ; count = 4
add ax, [count] ; ax = 10
inc [count] ; count = 5
add ax, [count] ; ax = 15
inc [count] ; count = 6
add ax, [count] ; ax = 21
inc [count] ; count = 7
add ax, [count] ; ax = 28
inc [count] ; count = 8
add ax, [count] ; ax = 36
inc [count] ; count = 9
add ax, [count] ; ax = 45
inc [count] ; count = 10
add ax, [count] ; ax = 55
mov [sum], ax ; sum = 55
lea dx, [message] ; move message's address into dx
mov ah, 9h ; function 9h is output string from dx
int 21h ; print the message
mov ax, [sum] ; print from ax
mov ah, 02h ; print one character
int 21h ; call!
Exit:
mov ah, 04Ch
mov al, [excode]
int 21h
end Start
%title "Adding 1-10"
ideal
model small
stack 256
dataseg
sum dw 0
count dw 3
message db "The value is ", "$"
excode db 0
codeseg
Start:
mov ax, @data
mov ds, ax
mov ax, 1
mov bx, 2
add ax, bx ; ax = 3
add ax, [count] ; ax = 6
inc [count] ; count = 4
add ax, [count] ; ax = 10
inc [count] ; count = 5
add ax, [count] ; ax = 15
inc [count] ; count = 6
add ax, [count] ; ax = 21
inc [count] ; count = 7
add ax, [count] ; ax = 28
inc [count] ; count = 8
add ax, [count] ; ax = 36
inc [count] ; count = 9
add ax, [count] ; ax = 45
inc [count] ; count = 10
add ax, [count] ; ax = 55
mov [sum], ax ; sum = 55
lea dx, [message] ; move message's address into dx
mov ah, 9h ; function 9h is output string from dx
int 21h ; print the message
mov ax, [sum] ; print from ax
mov ah, 02h ; print one character
int 21h ; call!
Exit:
mov ah, 04Ch
mov al, [excode]
int 21h
end Start