; Listing2-3.asm ; ; A "Hello, World!" program using the utf16 macro and ; wide string C Standard Library functions. option casemap:none include aoaulib.inc ;AoA library + constants includelib aoaulib.lib ;Link in aoalib library .const ; Program title (In Unicode): align word ttlStr word utf16("Listing 2-3"), 0 ; Some hand-coded Unicode strings: greekHello word 0397h, 03adh, 03bbh, 03bbh, 03bfh word 00h lucidaCons word 25cbh, 25d8h, 25d9h, 263ah, 263bh word 263ch, 25a0h, 0 .data ; Input buffer to hold text read from the ; user: inputBuf word 256 dup (?) .code ; Here is the main assembly language function. public asmMain asmMain proc sub rsp, 56 ; A quick call to readLine to read a string of ; Unicode characters from the standard input device. call wprint word utf16("Enter a line of text:"), 0 lea rcx, inputBuf mov edx, 240 call readLine cmp eax, -1 jne goodInput call wprintf word utf16("Error reading Unicode ") word utf16("text\n"), 0 jmp printUTF16 ; Display the text input by the user: goodInput: lea rdx, inputBuf call wprint word utf16("Text entered:%s"), nl, nl, 0 ; Here's a call to the wprint (Wide string/Unicode ; print) function that passes a bunch of UTF strings ; to print on the console. printUTF16: lea rdx, greekHello lea r8, lucidaCons call wprint word utf16("Sample Unicode Output:") word nl, nl word utf16("\1\{Hello, World\|\}\n") word utf16("Ηέλλο, Ψορλδ"), nl word utf16("\ \r\t\b\\\}\{\]\[\|\n") word utf16("greek=%s"), nl word utf16('lucidaCons=%s'), nl word 0 add rsp, 56 ret ;Returns to caller asmMain endp end