flat assembler
Message board for the users of flat assembler.
Index
> Linux > Really fast way to clear virtual console /dev/vcsa1 |
Author |
|
f0dder 21 Oct 2009, 07:36
Why not look into the curses library?
It's not the fastest way to do stuff, but it has the advantage that it's plenty fast on local consoles (even on old hardware), yet still allows you to do TUIs on remote shells as well. |
|||
21 Oct 2009, 07:36 |
|
kohlrak 21 Oct 2009, 11:48
there's 2 options for you (unless you want to learn extra annoying apis that you'll probably never use because you'll be too annoyed with it), escape keys and doing it all yourself... Can't see why you'd mind sending to stdout, but if you must, you could always memory map or use seek.
|
|||
21 Oct 2009, 11:48 |
|
f0dder 21 Oct 2009, 14:17
stdout means using ANSI escape sequences - having a proper library is nicer.
Can vcs* be mmap'ed these days? |
|||
21 Oct 2009, 14:17 |
|
kohlrak 21 Oct 2009, 18:40
A proper library doesn't exist. ncurses has its name for a reason.
Anyway, just about anything can be memory mapped, i haven't personally checked, but i can't see why it couldn't be. |
|||
21 Oct 2009, 18:40 |
|
f0dder 21 Oct 2009, 22:09
kohlrak wrote: A proper library doesn't exist. ncurses has its name for a reason. kohlrak wrote: Anyway, just about anything can be memory mapped, i haven't personally checked, but i can't see why it couldn't be. _________________ - carpe noctem |
|||
21 Oct 2009, 22:09 |
|
kohlrak 22 Oct 2009, 00:16
Quote: And you base that on what? It's portable across a wide range of systems, it offers acceptable speed on a local console even on old hardware; I haven't tried doing realtime textmode graphics (as in spinning 3D cubes or aalib video) with it, but it works quite fine for regular textmode interfaces. For anything other than it's unstable text mode GUI, it's really quite pointless. Most of other things like clearing the screen and such minor things can easily be made on your own with less effort than that it would take just to bother learning what ncurses has and how to use it. If you're worried about aalib and making textmode guis, sure, go ahead and learn it, but personally i think ncurses is a bit much for most console programs. Especially when he seems very adamant about using a specific file instead of stdout (i'm quite curious why ). Quote: Last time I tried (several years back), it didn't want to be mmap()'ed - probably wouldn't grant you anything but convenience anyway, and might even be slightly slower than write() calls. You're obviously not going to get direct 0xB8000 access by mmap()'ing a /dev/vcs* device Naturally. Personally, something as simple as clearing the screen i'd probably sys_write 200 spaces on the screen and go back to 0. Or, depending if you expect it to be run in an emulated terminal or not, 25 newlines. It's cheap and get the job done. |
|||
22 Oct 2009, 00:16 |
|
f0dder 22 Oct 2009, 09:45
Quote: Naturally. Personally, something as simple as clearing the screen i'd probably sys_write 200 spaces on the screen and go back to 0. Or, depending if you expect it to be run in an emulated terminal or not, 25 newlines. It's cheap and get the job done. _________________ - carpe noctem |
|||
22 Oct 2009, 09:45 |
|
kohlrak 22 Oct 2009, 11:40
That's typically what the ncurses lib does anyway (ida pro uses ncurses afaik, and i can scroll up when i control+c in a virtual console), unless it tells the video hardware to hold on while it clears it (i can't see how ncurses would get that kind of access though). It'll work faster if you first initialize a large section of memory with the character you're using to clear (rather than flickering as you say which'd come with multiple writes).
|
|||
22 Oct 2009, 11:40 |
|
Endre 25 Oct 2009, 18:07
I've not been able to mmap /dev/vcsa yet. If I remember correctly then you get a "No such device" error code. By the way I think that use of /dev/vcsa is perhaps the fastest and the most comfortable method (if you're root, of course). If not then there are those cursed escape sequences, but converting integers to string is not a big fun, additionally the terminal your program will be running on may not support all of the sequences you've thought it will. For instance blinking does not work on gnome terminals (that's why LocoDelAssembly didn't find your/my example funny ). Escape sequences are however more portable than use of /dev/vcsa, but I guess the most other unix systems have something similar.
|
|||
25 Oct 2009, 18:07 |
|
f0dder 25 Oct 2009, 19:50
Endre wrote: If not then there are those cursed escape sequences, but converting integers to string is not a big fun, additionally the terminal your program will be running on may not support all of the sequences you've thought it will. _________________ - carpe noctem |
|||
25 Oct 2009, 19:50 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.