flat assembler
Message board for the users of flat assembler.

Index > DOS > How do I Screen delay and Cls

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
adroit



Joined: 21 Feb 2010
Posts: 252
adroit 05 Mar 2010, 14:08
Can someone show me how to do a screen delay and claer the screen in DOS.

_________________
meshnix
Post 05 Mar 2010, 14:08
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 05 Mar 2010, 14:18
can you reapeat the question please?
what do you mean by screen delay and claer the screen?
Post 05 Mar 2010, 14:18
View user's profile Send private message Visit poster's website Reply with quote
cthug



Joined: 03 Apr 2009
Posts: 36
Location: /home/Australia
cthug 05 Mar 2010, 14:43
By screen delay do mean this?

Code:
org     100h

mov dx, _msg
mov ah, 9
int    21h

.wait:
       mov     ah, 0Bh
     int     21h

     cmp     al, 0FFh
    jne     .wait

_msg db 'Press Any Key ...', 0Ah, 0Dh, '$'

    


[edit]
If you want to clear the screen in text mode, and you only have to do it once, you can cheat and reset the video mode.

Code:
org       100h

; set textmode
mov       ax, 0003h
int        10h

mov  dx, _msg
mov ah, 9
int    21h

.wait:
       mov     ah, 0Bh
     int     21h

     cmp     al, 0FFh
    jne     .wait

_msg db 'Press Any Key ...', 0Ah, 0Dh, '$'

    


[/edit]
Post 05 Mar 2010, 14:43
View user's profile Send private message Visit poster's website Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 05 Mar 2010, 16:36
writing directly to video memory may be the fastest method of clr.

i always use the following:
Code:
clr:
    xor di, di
    mov ax, 0x0720
    mov cx, 80*25
  @@:
    mov [gs:di], ax    ;gs = 0xb800 (i always use it as video mem base)
    add di, 2
    dec cx
    jnz short @b
    ret    
Post 05 Mar 2010, 16:36
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 05 Mar 2010, 16:46
faster in 32 bits:
Code:

mov ecx,40*25
mov eax,07200720h
@@:
mov [gs:ecx*2-2],eax
loop @b
ret
    
Post 05 Mar 2010, 16:46
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 05 Mar 2010, 17:54
I wonder if we could do the same this way (code not tested):
Code:
push es

mov   ax, 0720h 
mov       cx, 25*80
xor        di, di

push      gs
pop       es

rep   stosw

pop        es    
Question[EDIT]Registers changed to 16-bit. Wink[/EDIT]


Last edited by MHajduk on 05 Mar 2010, 18:29; edited 1 time in total
Post 05 Mar 2010, 17:54
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 05 Mar 2010, 18:14
MHajduk,

It works, but why eax/ecx/edi?

I'm waiting for SSE version, with snow suppression. ;-)

__________
MeshNix,

You may use int 10/fn 06 (or fn 07) for compatibility reasons – it should work in any video mode supported by VideoBIOS.
Post 05 Mar 2010, 18:14
View user's profile Send private message Reply with quote
adroit



Joined: 21 Feb 2010
Posts: 252
adroit 05 Mar 2010, 21:09
Yea, something similar

Cthug, the code doesn't work.

Oh ok. So how does the label @@ work. I understand the code, but not '@@'.
Post 05 Mar 2010, 21:09
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 05 Mar 2010, 21:45
read the fasm manual before to ask several questions.
Post 05 Mar 2010, 21:45
View user's profile Send private message Visit poster's website Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 05 Mar 2010, 21:48
it's just unnamed label. jmp @b jumps to the nearest @@ label above and jmp @f jumps to the nearest @@ below the jump instruction. i think those labels are described in fasm tutorial.
Post 05 Mar 2010, 21:48
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 05 Mar 2010, 21:56
@b for before
@f for forward
Post 05 Mar 2010, 21:56
View user's profile Send private message Visit poster's website Reply with quote
cthug



Joined: 03 Apr 2009
Posts: 36
Location: /home/Australia
cthug 05 Mar 2010, 22:34
mm, all kinds of error, that's what you get when at 4am Smile
Post 05 Mar 2010, 22:34
View user's profile Send private message Visit poster's website Reply with quote
adroit



Joined: 21 Feb 2010
Posts: 252
adroit 05 Mar 2010, 22:49
Oh, so they just stand for back and forward to the nearest @@, which I think there can be multiple of @@ labels, right?

Cthug lol
Post 05 Mar 2010, 22:49
View user's profile Send private message Reply with quote
cthug



Joined: 03 Apr 2009
Posts: 36
Location: /home/Australia
cthug 05 Mar 2010, 22:50
I fixed it, but try writing directly to video memory, this might not even work on all hardware Embarassed

Code:
org     100h

mov ax, 0003h
int        10h

mov  dx, _msg
mov ah, 9
int    21h

.wait:
       mov     ah, 0Bh
     int     21h

     cmp     al, 0FFh
    jne     .wait

; exit
mov      ax, 4C00h
int        21h

_msg db 'Press Any Key ...', 0Ah, 0Dh, '$'

    

_________________
"There are only two industries that refer to their customers as 'users'." Edward Tufte
Post 05 Mar 2010, 22:50
View user's profile Send private message Visit poster's website Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41 06 Mar 2010, 00:02
whoah... what are this? I noticed you all are using
Code:
    mov ax, 0x0720     

Is this another method of writing to VGA? I always have used 0xB8000 Confused
Or is this completely different.

_________________
Want hosting for free for your asm project? You can PM me. (*.fasm4u.net)
Post 06 Mar 2010, 00:02
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 06 Mar 2010, 00:57
Coddy41,

0x0720 is ASCII SPACE with attribute lightgray-on-black. Wink
Post 06 Mar 2010, 00:57
View user's profile Send private message Reply with quote
adroit



Joined: 21 Feb 2010
Posts: 252
adroit 06 Mar 2010, 03:02
how is that possible (well anything is possible but, still...)? Does it block the space in gray?
Post 06 Mar 2010, 03:02
View user's profile Send private message Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 06 Mar 2010, 09:12
MeshNix wrote:
Does it block the space in gray?

Didn't get it, but back to the basics... video mode 3 (default, text, 80x25, 16 colors). video memory starts at segment 0xb800. 80*25 = 2000 characters on the screen. each character is displayed by placing WORD at the address that corresponds to its relative position from the beginning of segment
because each character in video memory is represented by a character itself (low byte) and color attribute (high byte)

so, if you want to put a red '!' on blue background at row 2 column 3, you
Code:
TXTCOLOR_RED = 0x04
BKGCOLOR_BLUE = 0x10
mov ah, BKGCOLOR_BLUE+TXTCOLOR_RED
mov al, '!'
mov di, (02*80+03)*2
mov [es:di], ax    ;es = 0xb800    

puting space character (0x20) clears the screen because it's blank character, you don't see it

something like that. maybe guys would provide you with some links on video programming, i don't have any right now
Post 06 Mar 2010, 09:12
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 06 Mar 2010, 09:20
http://wiki.osdev.org/VGA_Hardware

read it, then, when you have understand the basics of VGA, you will be able to code without asking anything to us, and maybe we will ask to you Smile

good luck
Post 06 Mar 2010, 09:20
View user's profile Send private message Visit poster's website Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41 06 Mar 2010, 12:53
baldr wrote:
Coddy41,

0x0720 is ASCII SPACE with attribute lightgray-on-black. Wink

Image I knew that... That is the last time I come to the fasm board when tired Rolling Eyes

_________________
Want hosting for free for your asm project? You can PM me. (*.fasm4u.net)
Post 06 Mar 2010, 12:53
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.