assembly - 为什么我不能使用寄存器访问 as86 中的内存
问题描述
这些天我正在阅读 Linux 0.11 的源代码。当我尝试修改它并在屏幕上打印一些硬件属性时,出现以下错误as86
:
make BootImage
as86 -0 -a -o boot/setup.o boot/setup.s
00056 0050 A1 0000 mov ax, [bx]
***** register used as identifier................................^
00056 0050 A1 0000 mov ax, [bx]
**** register used as identifier................................^
00001 errors
00000 warnings
make: *** [Makefile:97:boot/setup]
这是我的代码:
INITSEG=0x9000
!print those information
mov cx,#5
mov bx,#msgs
mov ax,#INITSEG
mov ds,ax
print_words:
mov si,[bx]
call print_msg
add bx,2
loop print_words
print_msg:
push ax
push bx
push cx
push dx
mov ah,#0x03
xor bh,bh
int 0x10
mov cx,[si]
add si,2
mov bx,#0x0007
mov ax,#0x1301
int 0x10
pop dx
pop cx
pop bx
pop ax
ret
msgs:
.word cursor,memory,cyls,heads,sectors
cursor:
.word 0x0012
.byte 13,10
.ascii "Cursor Position:"
memory:
.word 0x0009
.byte 13,10
.ascii "Memory:"
cyls:
.word 0x0007
.byte 13,10
.ascii "Cyls:"
heads:
.word 0x0008
.byte 13,10
.ascii "Heads:"
sectors:
.word 0x000A
.byte 13,10
.ascii "Sectors:"
网上查了一下,找不到原因不能使用bx寄存器访问内存,发现在as86中,我们可以通过[bx]或者[bx + k *的方式访问内存西]。所以我有点困惑。谢谢您的帮助。
解决方案
推荐阅读
- json - 不能为 3 个变量分配多个值
- java - Maven karaf 项目:为什么我有编译错误注入:org.apache.karaf.tooling.features.GenerateDescriptorMojo?
- mongodb - MongoDB - 如何解开嵌套的 json
- python - Selenium - 找不到选择元素
- c# - 空剃须刀页面检查 id 是否存在
- azure - 如何在 Synapse (Azure SQL DW) 上检索视图定义?
- java - 休眠缓存级别 1 和 2
- azure-devops - 如何在 yaml 中处理 Azure DevOps 管道中的错误?
- node.js - 由于 ng 文件中的无效字符错误,尝试 angular 时任何 ng 命令都会失败
- javascript - 如何在基于 react-map-gl 或 mapbox-gl-js 的 Isochrone 层中隐藏位于相交轮廓线上的轮廓标签?