NASM远跳在实模式和ASM code约定/远调用 [英] NASM far jump / far call in real mode and ASM code conventions

查看:314
本文介绍了NASM远跳在实模式和ASM code约定/远调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一个引导程序的最后几天,您可以通过点击下面的链接查看结果。

I tried to make a bootloader the last few days and you can see the result by clicking the link below.

现在我有两个问题:


  1. 在第43行我必须使用具有绝对ADRESS跳,但我想用 ES 的价值观和 BX 。所以我尝试了两种选择,你可以在评论中看到,但他们并没有为我工作。我究竟做错了什么?

  1. In line 43 I have to use a jump with an absolute adress, but I want to use the values of ES and BX. So I tried the two alternatives you can see in the comments but they did not work for me. What am I doing wrong?

我很新的低层次的编程。有没有在我的code一些或大或小的错误呢?是否有code样式约定我没有考虑?

I am quite new to low-level programming. Are there some major or minor mistakes in my code? Are there code style conventions I did not consider?

我不想格式化code,所以这里是链接到ASM文件,你可以用你喜欢的编辑器阅读:
https://www.dropbox.com/s/i3jpprf66nlmzz2/mybootloader.asm?m

I do not want to format the code, so here is the link to the asm file and you can read it with your favourite editor: https://www.dropbox.com/s/i3jpprf66nlmzz2/mybootloader.asm?m

非常感谢。

推荐答案

我发现的bug。一个很愚蠢的错误:将BX寄存器由_printstring功能覆盖bevor而在触发中断。
我固定它,现在跳不正是像阿列克谢伏龙描述工作 - 谢谢你:

I found the bug. A very silly mistake: The BX register was overwritten by the _printstring function bevor the interrupt was triggered. I fixed it and now the jump does exactly work like described by Alexey Frunze - thank you:

推ES

推BX

RETF

而且从来就取得了段adressing一个错误(也感谢阿列克谢伏龙芝):我想在512字节长的第一阶段之后加载第二阶段。因此,参照段/偏移adressing(物理地址= 16 *段+偏移量)我要补充一十六分之五百十二= 32 = 20H至07C0。所以值必须是:ES = 07E0H和BX = 0000H

Moreover I´ve made a mistake in segment adressing (also thanks to Alexey Frunze): I wanted to load the second stage right after the 512 byte long first stage. So referring to segment/offset adressing (physical adress = 16*segment + offset) I have to add 512/16 = 32 = 20H to 07C0. So the values have to be: ES = 07E0H and BX = 0000H

这篇关于NASM远跳在实模式和ASM code约定/远调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆