printf.exe: Arithmetic and Programming

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Aacini
Expert
Posts: 1914
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: printf.exe: Arithmetic and Programming

#31 Post by Aacini » 05 Sep 2024 21:04

I included \e as escaped char for ESC and enabled Virtual Terminal Processing mode in a new printf.exe version. I did a small test via

Code: Select all

printf "\e[104;93mbright yellow on bright blue\e[0m\n"
and works correctly. However, I also tried

Code: Select all

printf "\e#3Double Height (implies Double Width)\n\e#4Double Height (implies Double Width)\n"
and the font don't change. I suppose that the ESC#3 and ESC#4 change font sequences works only in Windows 11 (I have Windows 10).


printf version 2.81.zip
printf.exe 2.80 with \e for ESC and enabled Virtual Terminal Processing
(10.3 KiB) Downloaded 583 times


@Steffen
Thanks a lot for the Compiler Explorer link to the change console mode code. :) However, the assembler code shown there is somewhat convoluted... The way I write assembler code is simpler and more direct, similar to C code. Look it by yourself:

Code: Select all

        invoke  GetStdHandle, STD_OUTPUT_HANDLE         ;EAX = console handle
        mov     hOutput, eax                            ;store it
        ;
        invoke  GetConsoleMode, hOutput, ADDR dwVariable;get console mode in dwVariable, EAX = 0 if fail
        test    eax, eax                                ;fail?
        jz      SHORT @F                                ;yes: jump
        ;
        or      dwVariable, ENABLE_VIRTUAL_TERMINAL_PROCESSING OR DISABLE_NEWLINE_AUTO_RETURN   ;change mode
        invoke  SetConsoleMode, hOutput, dwVariable     ;enable process of VT100 terminal sequences
        ;
@@:
Antonio

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: printf.exe: Arithmetic and Programming

#32 Post by aGerman » 06 Sep 2024 10:31

That's great.
Aacini wrote:
05 Sep 2024 21:04
I suppose that the ESC#3 and ESC#4 change font sequences works only in Windows 11 (I have Windows 10).
Unfortunately that seems to be the case. This is how it looks like in a Win 11 console.
double_height_width.png
double_height_width.png (24.74 KiB) Viewed 9479 times
Aacini wrote:
05 Sep 2024 21:04
The way I write assembler code is simpler and more direct, similar to C code.
Oh wow :o I didn't expect that libraries would define so many things that make writing assembly code as comfortable as in your snippet. (And it proves how little I know about assembler :lol:)

Steffen

Post Reply