The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: Black_Sol on February 10, 2005, 03:59:26 PM

Title: Double characters
Post by: Black_Sol on February 10, 2005, 03:59:26 PM
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
Title: Re: Double characters
Post by: MichaelW on February 11, 2005, 02:49:37 AM
The first character is the echo and the second is being displayed by dispchar.
Title: Re: Double characters
Post by: pbrennick on February 25, 2005, 09:22:28 PM
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