Hi ,I am trying to count all characters in entered text ,putch and putint are macroses for printing int and char
What I am doing wrong
Thanks

.386
.model Flat
include Cs266.inc
.data
count DW 0FFH
.code
main:
mov BX,count
here:
getch
cmp EAX,-1
INC BX
je exit
putch EAX
jmp here
exit:
putint BX
Ret
end

Hi,
'je exit' exits from the loop when bx is equal to zero, je acts like jz. May be you want to write:
inc bx
cmp eax, -1
Because in you code 'cmp eax, -1' has no effect.
Cheers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.