News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Double characters

Started by Black_Sol, February 10, 2005, 03:59:26 PM

Previous topic - Next topic

Black_Sol

Hello,

I am generating a encryption system using 32bit assembler for x86 processors but i have a problem. I have a data input section but for some reason it is writing the characters twice. I have looked through my code many a time but i cant see it anywhere and would be very grateful if someone, with alot more experience than i can see it!

heres the code:



Enterd PROC near
mov bx,offset buff ;get buffer base address.
mov cl,0 ;set up character pointer.
.repeat
call readecho ;get a character from KB with echo.
mov byte ptr [bx],al ;place it into the buffer
call dispchar ;send it to the screen.
inc cl ;bump up the line char pointer.
inc bx ;bump up pointer to nxt one
.if     bx==07cfh ;compare with last elemnt
mov al,1bh ;if it is - get ESC char
mdisplay runout ;display buffer overrun mess.
.endif
.if cl==endline ;is it the end of the line?
call  newline ;issue a new line sequence.
.endif
.until al==1bh ;exit if ESC character entered.
ret
Enterd ENDP

newline PROC  NEAR
push ax

;mov al,0dh
;call dispchar
mov al,0ah
call dispchar
pop bx

ret
newline  endp



dispchar PROC NEAR

push bx
mov bx,0 ;video page 0
mov ah,0Eh ;disp character service call
int 10h ;do it!
pop bx

ret
dispchar  endp



Thanks in advance, its starting to drive me insane, i cant see it anywhere

Thanks

BS

MichaelW

The first character is the echo and the second is being displayed by dispchar.
eschew obfuscation

pbrennick

Black_Sol


        call    readecho                ; get a character from KB with echo.  <--- First printing of character
        mov     byte ptr [bx], al       ; place it into the buffer
        call    dispchar                ; send it to the screen.              <--- Second printing of character


Just change one or the other.

Paul