The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: HATEM on July 04, 2007, 09:28:33 PM

Title: scrolling text?
Post by: HATEM on July 04, 2007, 09:28:33 PM
hello
how can i appear a scrolling text  on the screen :( i want a simple program please
Title: Re: scrolling text?
Post by: Tedd on July 05, 2007, 01:31:21 PM
Part 1: draw text on screen.
Part 2: Draw text on screen at previous offset - 1
Part 3: loop at part 2
Title: Re: scrolling text?
Post by: MichaelW on July 05, 2007, 03:45:07 PM
Or use Interrupt 10h functions 6 or 7 to scroll the text, and then update the top or bottom line.

http://www.ctyme.com/intr/rb-0096.htm

http://www.ctyme.com/intr/rb-0097.htm
Title: Re: scrolling text?
Post by: HATEM on July 05, 2007, 07:51:14 PM
thank you for your help bat i'm a newbie in ASM  :red please explain to me step by step
Title: Re: scrolling text?
Post by: eek on July 06, 2007, 02:08:49 AM
...homework
:lol
Title: Re: scrolling text?
Post by: HATEM on July 07, 2007, 11:57:49 AM
Quote from: eek on July 06, 2007, 02:08:49 AM
...homework
:lol
it's not a home work eek i'm just want learning to programming game and if you have a good site where can i find games in assembly 16 bit give it to me
don't forget my first question thank you  :wink
Title: Re: scrolling text?
Post by: Tedd on July 07, 2007, 02:27:10 PM
1. Learn how to display text on the screen
2. Learn how to place text at any position on the screen
3. Put the two together :wink
Title: Re: scrolling text?
Post by: HATEM on July 07, 2007, 11:23:00 PM
hello tedd i do my homework  :bg
i did what do you want me to do  :wink
and now how can i scroll it  :toothy

declaration       segment
assume       cs:declaration
CALL  start

start         proc         
        mov        ah,06h         
        mov        al,00h
   mov        bh,07h   
   mov        ch,00h     
   mov        cl,00h       
   mov        dh,24       
   mov        dl,79       
   int        10h
   mov        bh,0         
   mov        dh,12       
   mov        dl,35       
   mov        ah,02h
   int        10h
   mov        dl,'A'
        mov        ah,02h
   int        21h
   mov        ah,4ch
   int        21h
start       endp
   declaration       ends
           end             start
Title: Re: scrolling text?
Post by: MichaelW on July 08, 2007, 06:01:52 AM
If by scrolling you mean that the screen should simply scroll up after the CRLF on the last line, any BIOS function that updates the cursor position and processes CR (character code 13) and LF (character code 10), or any DOS function that calls one of these BIOS functions, will do this.

.model small
.stack
.data
    string db "xxx",13,10,"$"
.code
.startup
 
    ; Loop through 40 lines.
    mov cx, 40
  @@:
    ; Display the string. The terminating CRLF will cause
    ; the function to move the cursor to the start of the
    ; next line, and when the cursor reaches the bottom
    ; of the screen, scroll the screen up by one line.
    mov dx, OFFSET string
    mov ah, 9
    int 21h
   
    ; Wait for a key press before continuing.
    xor ah, ah
    int 16h
   
    dec cx
    jnz @B
.exit
end

Title: Re: scrolling text?
Post by: HATEM on July 08, 2007, 12:01:11 PM
thank you for your help
i think there are some mistakes in your code it doesn't work  :(
Title: Re: scrolling text?
Post by: MichaelW on July 08, 2007, 07:21:09 PM
The code assembles, links, and runs correctly on my system. I have now added some comments that explain what the code is doing. What problem are you having?
Title: Re: scrolling text?
Post by: HATEM on July 08, 2007, 10:27:30 PM
hello MichaelW
look there are two fault in line 6'.startup'
and in line 25 '.exit'

[attachment deleted by admin]
Title: Re: scrolling text?
Post by: MichaelW on July 09, 2007, 07:48:05 AM
I had no idea you were using MASM 5.1. Here is a version that should work with 5.1:

.model small
.stack
.data
    string db "xxx",13,10,"$"
.code

  start:

    ; Set DS to our data segment.
    ;
    mov ax, @data
    mov ds, ax

    ; Loop through 40 lines.
    ;
    mov cx, 40

  @@:
    ; Display the string. The terminating CRLF will cause
    ; the function to move the cursor to the start of the
    ; next line, and when the cursor reaches the bottom
    ; of the screen, scroll the screen up by one line.
    ;
    mov dx, OFFSET string
    mov ah, 9
    int 21h

    ; Wait for key press before continuing.
    ;
    xor ah, ah
    int 16h

    dec cx
    jnz @B

    mov ah,4ch
    int 21h

end start

Title: Re: scrolling text?
Post by: HATEM on July 09, 2007, 01:02:25 PM
thank you MichaelW
sorry you worked hard with me I think that you don't understand what i want to do
look i want to do like this
hello