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 'Color 0x%02X: ',0 text db 'This is sample text.',10,0 text2 db 27,'[7mAnd this is an example of ' db 27,'[1;36;41mEsc' db 27,'[7m-sequences.',10,0