Jump to content
  • Advertisement
Sign in to follow this  
Thoover

need help in asm

This topic is 4425 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to clear the screen in asmbly and i need a small code in which i can also change the color in 32 bit binary

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Thoover
I need to clear the screen in asmbly and i need a small code in which i can also change the color in 32 bit binary


You need to provide us more information about what you want to do (target system (Win32? DOS? Unix-like?), programming environment (DJGPP? VStudio? ...), and so on). Not all target systems supports screen cleaning in asm (for example, the so-called DOS box in WinXP is in fact a console box; you can't clear it unless you use the corresponding Win32 API functions).

Regards,

Share this post


Link to post
Share on other sites
I am Using FASM to progam my OS and need to find a way to clear the screen to any of the 16 colors all i can do now is changethe color to green trying to clear the screen and the tet still dosen't ot to the top left it stays where the rest of the text left off.

Share this post


Link to post
Share on other sites
Quote:
Original post by Thoover
I am Using FASM to progam my OS and need to find a way to clear the screen to any of the 16 colors all i can do now is changethe color to green trying to clear the screen and the tet still dosen't ot to the top left it stays where the rest of the text left off.


The simplest method is:
1) find the address of the mapped text memory
2) clear it
3) move the caret to 0,0

Although I can't help you much more because I don't know how your OS works. If you are able to write to the screen then you probably know the address of the screen memory and the address of the caret variable. Clearing is simple: just throw enough zeroed double words to the screen memory and it should be ok.

Can you post your printing function (don't forget to enclose it in [source][/source] tags for readability). Thanks :)

Share this post


Link to post
Share on other sites
If you're in text mode the screen can usually be addressed at $B800:0000. Beware that each character takes two bytes, one for the ASCII code and one for the attributes (color, blink etc). In linear graphics modes the screen memory is located at $A000:0000. There's also some BIOS interrupts to make use of (especially int 10h) or you could use direct I/O port programming (ports $3C0-$3DF).

This is for 16-bit VGA programming, if you want to go 32 bit or use VESA modes things might be a little different.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
that last sentence hurts to read. but anyways, if you are in textmode you can :

1. for the count of however many lines of text are printed on the screen, which i think is something like 15 or 17 (or something completely different) if i remember right for DOS, print a blank space. This causes the screen to scroll up each time you print something to the screen, and because you are printing nothing visible it effectively clears the screen. Also, check if however you output in FASM requires things like newlines.
Psuedo-code -> For Count = 1 to NumberScreenLines Do Output(" ");

2. set the foreground and background colour of each text item (each ascii char) on the screen to the same colour. From what you said it sounded a little like perhaps you have tried setting all the colours like this, but have only changed the foreground or the background but not both... but maybe i read your question wrong. If this is what you are doing then you shouldn't have much issue finding an example of how to set the other colour attribute, it's been too long since i've had to do anything like this.

3. perhaps FASM has a procedure that will do a screen clear for you called something like CLS, just a wild stab in the light. have a quick look in the help etc.


N-B

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
awww just beaten...

N-B

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!