i gonna crazy about the looping in ascii....
anyone can suggest a good tutorial place, or simple sample code to me . i just need to delay the loop.
display the output string in a very slow movement
.I current using the book is "IBM PC  Assembly Language and Programming"  ,but still canno get it....


i not so sure what's problem in my code...just newbie in learning and want to make the "T"
keep move from left to right.....pls help me ...

.model small
.stack 64
.data

T1 BYTE " =============      ","$"
T2 BYTE " ============= ","$"
T3 BYTE "      |||      ","$"
T4 BYTE "      |||      ","$"
T5 BYTE "      |||    ","$"
T6 BYTE "      |||    ","$"
T7 BYTE "      |||    ","$"

T11 BYTE "  =============      ","$"
T12 BYTE "  ============= ","$"
T13 BYTE "        |||      ","$"
T14 BYTE "        |||      ","$"
T15 BYTE "        |||    ","$"
T16 BYTE "        |||    ","$"
T17 BYTE "        |||    ","$"

T21 BYTE "    =============      ","$"
T22 BYTE "    ============= ","$"
T23 BYTE "          |||      ","$"
T24 BYTE "          |||      ","$"
T25 BYTE "          |||    ","$"
T26 BYTE "          |||    ","$"
T27 BYTE "          |||    ","$"


T31 BYTE "      =============      ","$"
T32 BYTE "      ============= ","$"
T33 BYTE "            |||      ","$"
T34 BYTE "            |||      ","$"
T35 BYTE "            |||    ","$"
T36 BYTE "            |||    ","$"
T37 BYTE "            |||    ","$"


T41 BYTE "        =============      ","$"
T42 BYTE "        ============= ","$"
T43 BYTE "              |||      ","$"
T44 BYTE "              |||      ","$"
T45 BYTE "              |||    ","$"
T46 BYTE "              |||    ","$"
T47 BYTE "              |||    ","$"



.code
PUTS1:
MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T1
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T2
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T3
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T4
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T5
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T6
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T7
INT 21H



PUTS2:
MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T11
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T12
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T13
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T14
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T15
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T16
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T17
INT 21H

RET

PUTS3:
MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T21
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T22
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T23
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T24
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T25
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T26
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T27
INT 21H

RET

PUTS4:
MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T31
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T32
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T33
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T34
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T35
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T36
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T37
INT 21H

RET

PUTS5:
MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T41
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T42
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T43
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T44
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T45
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T46
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV AH,09H
LEA DX,T47
INT 21H

RET



main proc
mov ax,@data
mov ds,ax

MOV CX,10





DISPLAY1:

CALL PUTS1
CALL clearScreen
CALL RESETCURSOR
CALL PUTS2
CALL clearScreen
CALL RESETCURSOR
CALL PUTS3
CALL clearScreen
CALL RESETCURSOR
CALL PUTS4
CALL clearScreen
CALL RESETCURSOR
CALL PUTS5
CALL clearScreen
CALL RESETCURSOR

LOOP DISPLAY1

mov ax,4c00h
int 21h

main endp

clearScreen proc
MOV AX, 0600H ;AH = 06 (scroll)
;AL = 00 (full screen)
MOV BH, 0fH ;White background (0)
;Blue foreground (1)

MOV CX, 0000H ;Upper left row:column
MOV DX, 184FH ;Lower right row:column

INT 10H ;Call interrupt service

retn
clearScreen endp

resetCursor proc
MOV AH, 02H ;Request set cursor
MOV BH, 00 ;Page number 0

MOV DX, 0000H ;Row 0, column 0

INT 10H ;Call interrupt service
retn
resetCursor endp
   
end main

Posted on 2011-12-01 10:18:59 by jove2493
It would be really cool if you'd use "code" tags instead of "quote". As it is, your strings "wrap", making it hard to see the intended effect. Do you want (to simplify)...
0123456789
123456789
23456789
3456789
etc. or...
0123456789
1234567890
2345678901
etc. ? Or what?

For a delay, there are a couple of ways to do it. There's a word down in the Bios Data Area that updates 18.2 times per second. You can fetch that word, add an appropriate amount to it, and wait for the BDA to get up to that value. There's also a BIOS interrupt that gives a delay. I think it's int 15h/83h or int 15h/86h, but I don't remember for sure. If you're going to mess with dos code, you should get Ralf Brown's Interrupt List, if you haven't. You can look up that kind of thing.

Best,
Frank

Posted on 2011-12-01 13:47:41 by fbkotler
my means is to make a code that move the "T"  from left to right....by using loop method, and add delay in the loop...
Posted on 2011-12-01 18:03:05 by jove2493
most new users have no idea what a code tag is.
write your posts like this minus the spaces:

Hey guys, I have some questions about the following broken unworkable sourcecode:
[ c o d e ]
put some stuff in here
[ / c o d e ]

k? :)
Posted on 2011-12-02 02:29:27 by Homer
Thanks, Homer! Okay, now I see the 'T'! Sorry to be obtuse.

What I think I would do, is to start with just one "set" of strings - the one with the most spaces on the left. I think I'd include the CR/LF in each string, rather than do it as a separate operation each time. If you put a couple of extra spaces on the right end, you could probably skip the clearscreen, too. Then do something like...


...
display:
    mov bx, 10 ; or whatever
top:
    mov ah, 9
    lea dx,
    int 21h
; maybe need to reload ah? maybe not?
    lea dx,
    int 21h
; etc. ...

    call delay
    call reset_cursor
    dec bx

    jnz top ; maybe jns?
; keep going?
    jmp display
...


For a delay, something like...


delay:
    push cx
    push dx
    mov cx, 1000000 >> 16
    mov dx, 1000000 && 0FFFFh
    mov ah, 86h
    int 15h
    pop dx
    pop cx
    ret


I've probably screwed up the syntax (and maybe the logic, too), but is "something like that" what you're looking for?

Best,
Frank

Posted on 2011-12-02 11:09:10 by fbkotler
...
display:
    mov bx, 10 ; or whatever
top:
    mov ah, 9
    lea dx,
    int 21h
; maybe need to reload ah? maybe not?
    lea dx,
    int 21h
; etc. ...

    call delay
    call reset_cursor
    dec bx

    jnz top ; maybe jns?
; keep going?
    jmp display
...


thank you.....but if i wan display the string from T1- T7..... what should my coding....
sorry that i maybe asking too much ....but i really couldn't understand .....


delay:
    push cx
    push dx
    mov cx, 1000000 >> 16
    mov dx, 1000000 && 0FFFFh
    mov ah, 86h
    int 15h
    pop dx
    pop cx
    ret


mov cx, 1000000 >> 16
mov dx, 1000000 && 0FFFFh

can u explain about this line for me ......i a bit blur...


Posted on 2011-12-02 11:39:09 by jove2493
Well... something like...


...
display:
    mov bx, 10 ; or whatever
top:
    mov ah, 9
    lea dx,
    int 21h
; maybe need to reload ah? maybe not?
    lea dx,
    int 21h
; maybe need to reload ah? maybe not?
    lea dx,
    int 21h
; maybe need to reload ah? maybe not?
    lea dx,
    int 21h
; maybe need to reload ah? maybe not?
    lea dx,
    int 21h
; maybe need to reload ah? maybe not?
    lea dx,
    int 21h
; maybe need to reload ah? maybe not?
    lea dx,
    int 21h

    call delay
    call reset_cursor

    dec bx
    jnz top ; maybe jns?
; keep going?
    jmp display
...


Where your strings look something like...


T1 BYTE "        =============      ", 13, 10,"$"
T2 BYTE "        ============= ", 13, 10,"$"
T3 BYTE "              |||      ", 13, 10,"$"
T4 BYTE "              |||      ", 13, 10,"$"
T5 BYTE "              |||    ", 13, 10,"$"
T6 BYTE "              |||    ", 13, 10,"$"
T7 BYTE "              |||    ", 13, 10,"$"


You understand that the "lea dx, " causes the "write" to start bx bytes beyond the beginning of the string, right? Then we increment (or decrement) bx to get the "move" effect.

I'm not in a position to test dos code at the moment, so you'll have to "experiment" yourself to get the effect you want.

RBIL describes int 15h/86h:
http://www.ctyme.com/intr/rb-1525.htm
as taking the delay time, in microseconds, in "cx:dx". If you're not familiar with the notation, that just means cx * 64k + dx - just a way of representing a 32-bit number in two 16-bit registers. I was thinking that 1000000000 microseconds would be a one second delay - probably too long for you(?). In order to easily adjust the delay, you might want to do something like:


DELAYCOUNT equ 1000000000
DELAYHI equ DELAYCOUNT >> 16
DELAYLOW equ DELAYCOUNT && 0FFFFh


... and just use DELAYHI (in cx) and DELAYLOW (in dx) in your delay function. You could write a delay function that takes the time as a parameter, too, if you want to be able to vary it "on the fly".

I may have the Masm syntax wrong (I'm Nasmist). Maybe "=" instead of "equ". Maybe "shr" instead of ">>". Maybe "and" instead of "&&". Fool with it until Masm quits complaining (if ever :) ).

Reading documentation is good, but I personally learn more from "experimenting". Both "RTFM" and "experiment" is probably best!

Best,
Frank

Posted on 2011-12-02 12:38:15 by fbkotler
can explain to me what is the meaning of the  ", 13, 10,"$"  that u put at the end of the String

T1		 BYTE	 "         =============      ", 13, 10,"$"
Posted on 2011-12-05 21:30:24 by jove2493
ASCII codes for carrige return and linefeed.  Same as pressing return.  $ is a string terminator
Posted on 2011-12-05 22:03:44 by Gunner
13 = carriage return, 10 = linefeed, together, a "newline". Same as you were doing with:


MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H


(I see that Gunner just told you the same thing)
Best,
Frank

Posted on 2011-12-05 22:09:55 by fbkotler
ok,i get this.thanks

but about the delay code. i test it already , still don have any effect .......put or not put the result is same.....

.model small
.stack 64
.data


  DELAYCOUNT equ 10000000000
  DELAYHI equ 180
  DELAYLOW equ 0FFFFh


T1 BYTE "  =========== ||    ||    ", 13, 10,"$"
T2 BYTE "  =========== ||    ||    ", 13, 10,"$"
T3 BYTE "      |||    ||    ||    ", 13, 10,"$"
T4 BYTE "      |||    |||||||||    ", 13, 10,"$"
T5 BYTE "      |||    ||    ||    ", 13, 10,"$"
T6 BYTE "      |||    ||    ||    ", 13, 10,"$"
T7 BYTE "      |||    ||    ||    ", 13, 10,"$"

T8 BYTE " +=+= +=+= +=+= +=+= +=+= +=+= +=+= +=+=", 13, 10,"$"

.code
delay:
    push cx
    push dx
    mov cx,DELAYHI
    mov dx,DELAYLOW
    mov ah, 86h
    int 15h
    pop dx
    pop cx
    ret

Main proc
mov ax,@data
mov ds,ax

; MOV CX,10


display:
    mov bx,2; or whatever
top:
    mov ah, 09H
    lea dx,
    int 21h
 
mov ah, 09H
    lea dx,
    int 21h
 
mov ah, 09H
    lea dx,
    int 21h
 
mov ah, 09H
    lea dx,
    int 21h
   
mov ah, 09H
    lea dx,
    int 21h
   
mov ah, 09H
    lea dx,
    int 21h
   
mov ah, 09H
    lea dx,
    int 21h
     
mov ah, 09H
    lea dx,
    int 21h
   
    call delay
    call resetCursor

    dec bx

    jnz top
    JMP display

mov ax,4c00h
int 21h

main endp

clearScreen proc
MOV AX, 0600H ;AH = 06 (scroll)
;AL = 00 (full screen)
;MOV BH, 0fH ;White background (0)
;Blue foreground (1)

MOV CX, 0000H ;Upper left row:column
MOV DX, 184FH ;Lower right row:column

INT 10H ;Call interrupt service
retn

clearScreen endp

resetCursor proc
MOV AH, 02H ;Request set cursor
MOV BH, 00 ;Page number 0
MOV DX, 0000H ;Row 0, column 0
INT 10H ;Call interrupt service
retn
resetCursor endp
   
end main



here is my code....==,i want the STRING "T" and "H"  move togather with whole word....
but when i excute it ....it is move separate........
Posted on 2011-12-05 22:21:17 by jove2493
I don't know why your delay isn't working. I must have told you wrong. I'll have to reboot into dos to try it - not right now. I don't understand your other problem. Are you saying that the 'T' and 'H' move separately? I don't see how that could happen. Have to try it - or maybe someone more familiar with Masm can give you a hand...

Best,
Frank

Posted on 2011-12-05 23:26:07 by fbkotler
sry i keep make touble to u ......the "T" ang "H"  is no move separately.but it separately by the line....can it possible 7 line of the combination to "T" and "H"  move in a same time??
my code of delay is not work also ......any pro in Masm can give me a help .......T.T
Posted on 2011-12-06 04:38:28 by jove2493