flat assembler
Message board for the users of flat assembler.

Index > DOS > The Clear Screen function

Author
Thread Post new topic Reply to topic
StrenoJr



Joined: 13 Mar 2014
Posts: 22
Location: Slovakia
StrenoJr 25 Jul 2014, 18:28
Hello.
I need to create a clear screen function. When I moved 0x0700 (grey color, no character) to 0xB800 it worked.

Then I tried the same function using only BIOS instruction.
Code:
mov bh, 0
mov dx, 0
int 0x10    

When I moved it to the upper left corner of the screen, the next character written was not in the top left corner but one place to the right.
Like if it was at the [1,0] coords and not at [0,0].

Thanks for reading.
Post 25 Jul 2014, 18:28
View user's profile Send private message Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 26 Jul 2014, 03:11
Homework?

Video mode 3 assumed?

00h isn't "no character", it's the null character.
Probably better to use 20h, the space character.

Note: Mode 3 VRAM segment = B800h, linear RAM = B8000h

BIOS Int 10h - what function? AH=0Eh TTY output?
This function automatically advances the cursor, which might explain your symptoms.

Cursor can be controlled with Int 10h, function AH=02

Use Int 10h, function AH=09 if you want to control the cursor yourself.

_________________
FAMOS - the first memory operating system
Post 26 Jul 2014, 03:11
View user's profile Send private message Visit poster's website Reply with quote
StrenoJr



Joined: 13 Mar 2014
Posts: 22
Location: Slovakia
StrenoJr 26 Jul 2014, 15:29
It is not a homework.
I know that with the space and null, but null did work too. It is just easier to xor the al register.
I forgot that I used ah=09.
With the function above I just mvoed the cursor to the upper left corner to [0,0]. The problem is that it ended at [1,0].

*Sorry, sometimes I just don't know express myself correctly.
*The link for your OS doesn't work.
Post 26 Jul 2014, 15:29
View user's profile Send private message Reply with quote
Fixit



Joined: 22 Nov 2012
Posts: 161
Fixit 26 Jul 2014, 20:23
Here a two ways of clearing the screen.

start:
push ax
push es
mov ax,0b800h ; Start at memory 0b800
mov es,ax
xor di,di
mov cx,2000 ;
mov ax,0720h ; Black bg, white fg, 20h = space char
rep stosw
pop ax
pop es

--------------------------------

mov ax,@data
mov ds,ax
mov ah,0fh
int 10h
mov ah,0
int 10h
mov ax,1112
mov bx,0
int 10h
Post 26 Jul 2014, 20:23
View user's profile Send private message Reply with quote
StrenoJr



Joined: 13 Mar 2014
Posts: 22
Location: Slovakia
StrenoJr 27 Jul 2014, 16:31
That's a core component!
Thanks, solved.
Post 27 Jul 2014, 16:31
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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.