flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Endre 11 Mar 2005, 07:00
Use curses:
man ncurses and/or man curses There are also info pages (even better). With help of curses library you can write programs like e.g. midnight commander. Read this, learn this, do this and you'll get what you need ![]() |
|||
![]() |
|
0xkorkut 11 Mar 2005, 10:32
hehe
My problem is... I don't want to use any c library . There should be a way to do this with kernel calls. |
|||
![]() |
|
Endre 12 Mar 2005, 15:45
ah so, then just type:
man console_codes and you get the code list, you can drive the console with. To make your life easy here is an example, which prints an underlined blinking message in red (in xterm at least) to the position (x:25, y:12) of the console. Just an idea: these are the codes you can also use for your prompt (PS1, PS2, etc.) or in your scripts (see echo) as well, to make them more colorful. And yes, you have to use ancient control codes, it is not so tragic even when using macros. Linux terminals are compatible with vt100 but additionally have a lot of extra features. Code: format ELF executable entry start SYSCALL_EXIT equ 1 ; syscall to function exit() SYSCALL_WRITE equ 4 ; syscall to function write() STDOUT equ 1 ; file descriptor of standard output ESC equ 0x1b ; escape character start: ; first clear the screen mov eax, SYSCALL_WRITE mov ebx, STDOUT mov ecx, clear_screen mov edx, clear_screen_size int 0x80 ; move cursor to (x:25, y:12) mov eax, SYSCALL_WRITE mov ebx, STDOUT mov ecx, move_cursor mov edx, move_cursor_size int 0x80 ; write the message mov eax, SYSCALL_WRITE mov ebx, STDOUT mov ecx, message mov edx, message_size int 0x80 ; exit from the program mov eax, SYSCALL_EXIT xor ebx, ebx int 0x80 clear_screen: db ESC, "[2J" clear_screen_size = $ - clear_screen move_cursor: db ESC, "[12;25H" move_cursor_size = $ - move_cursor message: db ESC, "[31m", ESC, "[5m", ESC, "[4m" ; red, blink on, underline on db "Programming linux is easy", 0xa db ESC, "[25m", ESC, "[24m" ; blink off, underline off message_size = $ - message |
|||
![]() |
|
Tommy 12 Mar 2005, 15:58
Endre: nice example, thanks!
![]() |
|||
![]() |
|
0xkorkut 12 Mar 2005, 19:11
nah.. blink didn't work on GNOME terminal.
nah2.. underline didn't work on real textmode terminal i think it is something about my own machine thanks anyway _________________ .cC}< Eat your veggies >{Cc. |
|||
![]() |
|
Endre 13 Mar 2005, 11:25
0xkorkut wrote: nah.. blink didn't work on GNOME terminal. No, it's not about your machine. It's about different capabilities of different terminals. For instance if a terminal unable to display underlined characters then it still has the right to do something instead of it. For instance underlining is used to emphasize, to highlight something. You can reach something similar if you highlight the given range of the screen in sharp white color, so linux console in text mode do it for you automatically. Another example is that on Sun machines, formerly at least, you had not too much chance to meet with color xterm by default. The problem is that there are terminals which don't ignore the not interpreted control sequences, but write them out on the screen (quite ugly), so before trying to control a terminal it is necessary to be convinced about its support. And it's not the easiest task without using ncurces and libc, since you have to decide whether the system you run on uses still termcap or already terminfo. Then you have to be able to parse the termcap file or the compiled terminfo files. Here is a 2-lines color prompt: Code: export PS1='\[\033[32m\]\u@\h \[\033[33m\]\w \[\033[0m\] \$ ' |
|||
![]() |
|
scientica 20 Mar 2005, 10:15
iirc xterm emulates the VT100,VT102, VT220 terminals from DEC and Tektronix 4014. And encording to the man pages:
Code: Blinking characters are partially implemented; the emulation is functional but does not have the appear- ance of a real VT102. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.