Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text display

Status
Not open for further replies.

maintain3r

Technical User
Jan 25, 2011
3
HR
Hi everyone!

I'm pretty new to assembler and I need your help to solve the following problem. I would like to create a DOS program which will display "Hello world" message with typewriter effect.
I'm not asking to provide me with solution, merely to direct me in the right way so I can learn how it can be done.

Thanks in advance and have a nice day!
 
Thanks Salem!

So far I've managed to print string character by character but I'm having trouble with the delay part! Here's the code:

code segment

assume cs:code,ds:code

org 100h

Typewriter:
mov si, 0 ; setting the index register

print_next:
mov al,MyString[si] ; obtaining the character to print
cmp al,0 ; is it a 0? If yes that means I've reached
je quit_typing ; the end of my string and should stop

mov ah, 0eh ; writing character in
int 10h ; a teletype mode

mov cx,000fh ; This part is giving me the headache!
mov dx,4240h ; It should cause the delay of half a
mov ah,086h ; second (1000000 msecs), right?
int 15h ; NOT WORKING!! PLEASE HELP!!

inc si ; increment index register to get the next character

jmp next_char ; continue with printing next char


quit_typing:
mov ah, 0 ; wait for user to press some key
int 16h ; and when that happens
ret ; exit and return control to DOS

MyString db 'Hello world!', 0

code ends

end Typewriter

The following link shows exactly what I'm trying to achieve:


You see how that text is being printed? Thanks in advance!
 
Hi everyone!

I've managed to finish this little program ;) I would like you to tell me if there is a way (and need) to optimize the code so that it works faster. Here's the code:


code segment
assume cs:code,ds:code
org 100h

Typewriter_pocetak:
xor si,si
mov dh,10
mov dl,25
mov ah,02h
int 10h
sljedeci_znak:
mov al,J3l3n4[si]
cmp al,0
je kraj_ispisa
mov di,5
cmp al,32
je Ispisi
Nastavi_ispis:
mov ah,0eh
int 10h
xor ah,ah
int 1ah
mov bx,dx
Pauza:
xor ah,ah
int 1ah
sub dx,bx
cmp di,dx
ja Pauza
inc si
jmp sljedeci_znak
kraj_ispisa:
int 20h

J3l3n4 db 'Dear user!',10,13,10
db ' Whish you a good day :)',10,10,13,0

Ispisi:
mov di,1
jmp Nastavi_ispis

code ends
end Typewriter_pocetak

As you can see I'm willing to learn and that's the reason why I'm asking you to help me. I hope that with your help I'll be able to write better and efficient Assembly code. Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top