我正在尝试做一个概念validation程序,看看GNU是否有一种类似于.asciz的方式来定义UTF-16string,而不需要使用外部C来定义UTF-16string。
GNU汇编器有一个UTF-16版本的.asciz使下面的代码更清洁? (用gcc test.S -o test
编译)
.global _WinMain@16 .section .text // windows application entry takes 16 bytes on stack // that it is responsible of getting rid of // along with return address, before returning. _WinMain@16: // ascii version push $_ascii_msg call _puts add $4, %esp // brute force unicode version push $_brute_unicode_msg call __putws add $4, %esp mov $0, %eax ret $16 _ascii_msg: .asciz "Hello, World!" // ascii conveniently occupies first 256 bytes of the unicode table. _brute_unicode_msg: .word 'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!', 0