打印十六进制值 [英] print hexadecimal value
问题描述
我要做的就是在bootloader中打印一个数字的十六进制值。
架构:
英特尔x86
模式:真实
汇编程序:GNU AS
语法:AT& ; T
但我不知道......似乎有些不对劲。我使用一个简单的逻辑来实现同样的目标。我知道这个单词最多可以存储65535但是我无法正确打印所有数字。
Hi,
All I am trying to do is print the hexadecimal value of a number in bootloader.
Architecture:
Intel x86
Mode: real
Assembler: GNU AS
Syntax: AT&T
But I dont know...something seems to be wrong. I am using a simple logic to achieve the same. I know that word can store a maximum of 65535 but I am not able to print all numbers properly.
movw $16, %ax
call .printhexa
.printhexa:
cmpw $16, %ax
jl .printhexa2
movw $16, %bx
divw %bx
#####
use %dx to
print the respective hexadecimal digit
#####
jmp .printhexa
.printhexa2:
#####
use %ax to
print the respective hexadecimal digit
#####
ret
你能帮忙吗?在实模式下打印十六进制是否有任何限制???
can you please help. Is there any limitation to print the hexadecimals in real mode ???
推荐答案
16,%ax
call .printhexa
.printhexa:
cmpw
16, %ax call .printhexa .printhexa: cmpw
16,%ax
jl .printhexa2
movw
16, %ax jl .printhexa2 movw
16,%bx
divw%bx
#####
使用%dx到
打印相应的十六进制数字
#####
jmp .printhexa
.printhexa2:
#####
使用%ax到
打印相应的十六进制数字
#####
ret
16, %bx divw %bx ##### use %dx to print the respective hexadecimal digit ##### jmp .printhexa .printhexa2: ##### use %ax to print the respective hexadecimal digit ##### ret
你能不能请救命。在实模式下打印十六进制是否有任何限制???
can you please help. Is there any limitation to print the hexadecimals in real mode ???
这篇关于打印十六进制值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!