forked from KolibriOS/kolibrios
a5bb6e3fd4
git-svn-id: svn://kolibrios.org@6699 a494cfbc-eb01-0410-851d-a64ba20cac60
58 lines
1.5 KiB
NASM
58 lines
1.5 KiB
NASM
format PE console 0.8
|
|
include 'proc32.inc'
|
|
include '../../../../import.inc'
|
|
|
|
start:
|
|
invoke con_set_title, caption
|
|
; C-equivalent of the following code:
|
|
; for (ebx=0;ebx<0x100;ebx++)
|
|
; {
|
|
; con_printf(t1,ebx);
|
|
; eax = con_set_flags(ebx);
|
|
; con_write_asciiz(text);
|
|
; con_set_flags(eax);
|
|
; }
|
|
; N.B. For efficiency result of first con_set_flags is not saved
|
|
; in register, but is pushed beforehand to the stack
|
|
; for second con_set_flags.
|
|
; Note that such code cannot be generated by stdcall macros.
|
|
xor ebx, ebx
|
|
@@:
|
|
push ebx
|
|
push t1
|
|
call [con_printf]
|
|
add esp, 8
|
|
push ebx
|
|
call [con_set_flags]
|
|
push eax
|
|
push text
|
|
call [con_write_asciiz]
|
|
call [con_set_flags]
|
|
inc bl
|
|
jnz @b
|
|
push text2
|
|
call [con_write_asciiz]
|
|
push 0
|
|
call [con_exit]
|
|
exit:
|
|
xor eax, eax
|
|
ret
|
|
|
|
align 4
|
|
data import
|
|
library console, 'console.dll'
|
|
import console, \
|
|
con_set_title, 'con_set_title', \
|
|
con_write_asciiz, 'con_write_asciiz', \
|
|
con_printf, 'con_printf', \
|
|
con_set_flags, 'con_set_flags', \
|
|
con_exit, 'con_exit'
|
|
end data
|
|
|
|
caption db 'Console test - colors',0
|
|
t1 db '–¢¥â 0x%02X: ',0
|
|
text db '‚®â ¯à¨¬¥à ⥪áâ .',10,0
|
|
text2 db 27,'[7m€ íâ® ¯à¨¬¥à ¨á¯®«ì§®¢ ¨ï '
|
|
db 27,'[1;36;41mEsc'
|
|
db 27,'[7m-¯®á«¥¤®¢ ⥫ì®á⥩.',10,0
|