Ok,
now i've added 0 and $ character.
org 100h
mov al,num1
add al,num2
add al,30h
add al,'$'
mov dx,ax
mov ah,09h
int 21h
mov ah,4Ch ; ah = 4Ch
int 21h
num1 db 5
num2 db 3
When i execute this code it show also some bad character and no sum result.
Nasm problem
Re: Nasm problem
Please do the following:
1) Read my previous post paying attention to the bit which hints about learning the usage of [] for loading memory values.
2) Learn what a string is. When you take a character and add the value of '$', that does not make the character a '$' terminated string.
3) See the part about ensuring DS:DX points to the correct location. This does not mean that DX should contain the value you are wanting to print - it is a pointer
4) Before attempting this, you need to start by reading some assembly tutorials and familiarising yourself with some basic programming concepts (pointers, strings variables etc...).
Cheers,
Adam
1) Read my previous post paying attention to the bit which hints about learning the usage of [] for loading memory values.
2) Learn what a string is. When you take a character and add the value of '$', that does not make the character a '$' terminated string.
3) See the part about ensuring DS:DX points to the correct location. This does not mean that DX should contain the value you are wanting to print - it is a pointer
4) Before attempting this, you need to start by reading some assembly tutorials and familiarising yourself with some basic programming concepts (pointers, strings variables etc...).
Cheers,
Adam
Re: Nasm problem
Ok i'll study them.
In my honest opinion exist too assembly version (nasm, tasm, masm for win/linux) and different syntax.
Thank you and excuse me!
In my honest opinion exist too assembly version (nasm, tasm, masm for win/linux) and different syntax.
Thank you and excuse me!
Re: Nasm problem
I've result it!
org 100h
main:
mov al,num1
add al,num2
add al,'0'
mov ah,0EH
int 10h
num1 equ 3
num2 equ 6
I used int 10h (with value in al) and is ok.
org 100h
main:
mov al,num1
add al,num2
add al,'0'
mov ah,0EH
int 10h
num1 equ 3
num2 equ 6
I used int 10h (with value in al) and is ok.
Re: Nasm problem
sbeng77 wrote:I solved my sum question:
org 100h
main:
mov al,num1
add al,num2
add al,'0'
mov ah,0EH
int 10h
num1 equ 3
num2 equ 6
I used int 10h (with value in al) and is ok.
Re: Nasm problem
Is the problem of how to print integer from register to screen
if so,...,take look @ this code, may be useful for you,it's print the contents of AX register to screen
good luck
if so,...,take look @ this code, may be useful for you,it's print the contents of AX register to screen
Code: Select all
print_ax proc
cmp ax, 0
jne print_ax_r
push ax
mov al, '0'
mov ah, 0eh
int 10h
pop ax
ret
print_ax_r:
pusha
mov dx, 0
cmp ax, 0
je pn_done
mov bx, 10
div bx
call print_ax_r
mov ax, dx
add al, 30h
mov ah, 0eh
int 10h
jmp pn_done
pn_done:
popa
ret
endp
Distance doesn't make you any smaller,
but it does make you part of a larger picture.
but it does make you part of a larger picture.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Nasm problem
In his case I'd add as homework to explain how that code works in detail. Just posting code won't really help in his case...
Re: Nasm problem
Exactly.