【发布时间】:2025-12-20 02:05:17
【问题描述】:
我对如何实现这一点有疑问。我正在尝试将整数转换为 ASCII 格式的 senary 值。
; Macro to convert integer to senary value in ASCII format.
; Call: int2senary <integer>, <string-addr>
; Arguments:
; %1 -> <integer>, value
; %2 -> <string>, string address
; Reads <string>, place count including NULL into <count>
; Note, should preserve any registers that the macro alters.
mov eax, %1
mov r9d, 6
convLoop:
div r9d
add edx, 48
push edx
cmp eax, r9d
jge convLoop
【问题讨论】:
-
使用How do I print an integer in Assembly Level Programming without printf from the c library? 和
6而不是10。 Base 6 只需要数字,而不是字母,因此您不需要引入表查找或其他特殊的东西,例如 base 16。
标签: assembly ascii x86-64 nasm