在大会的几行说明

在大会的几行说明

本文介绍了在大会的几行说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

bits 16

org 0x7c00

start: jmp loader

;******; ; OEM Parameter block ;********;

TIMES 0Bh-$+start DB 0; THIS LINE

bpbBytesPerSector: DW 512

bpbSectorsPerCluster: DB 1

bpbReservedSectors: DW 1

bpbNumberOfFATs: DB 2

bpbRootEntries: DW 224

bpbTotalSectors: DW 2880

bpbMedia: DB 0xF0

bpbSectorsPerFAT: DW 9

bpbSectorsPerTrack: DW 18

bpbHeadsPerCylinder: DW 2

bpbHiddenSectors: DD 0

bpbTotalSectorsBig: DD 0

bsDriveNumber: DB 0

bsUnused: DB 0

bsExtBootSignature: DB 0x29

bsSerialNumber: DD 0xa0a1a2a3

bsVolumeLabel: DB "MOS FLOPPY "

bsFileSystem: DB "FAT12   "

;******** ; Bootloader Entry Point ;**********;

loader:

cli

hlt

times 510 - ($-$$) db 0

dw 0xAA55

现在的问题是,我不明白是什么时代0BH - $ +起始计算为在这种情况下。
例如:$ - $$ =大小的程序。
它也将是很有益的,如果有人可以给我LODSB语法讲解。也就是为什么有一个:其中每个BPB和BS陈述后标志?未在:标志意味着一个新的部分的开始,就像在装载部分的情况下,或者在这个方案开始部分。
请详细解释下如何评估答案。

Now the problem is I don't quite understand what TIMES 0bh-$+start evaluates to in this case.For Example $-$$ = size of the program.Also it will be really heĺpful if someone can explain to me the LODSB Syntax. Also why is there a : sign after each of those bpb and bs statements? Doesn't the : sign mean the beginning of a new section, just as in case of loader section or start section in this program.Please explain in detail how the following evaluates to the answer.

感谢。

推荐答案

啊! 此行只是保留空间OEMNAME。把你的OS的名称出现,如果你喜欢 - 填补到11个字节。 ($$是一样的开始 - 一节的开头 - 0x7C00 - 在这种情况下)。

Ah! "THIS LINE" just reserves space for "OEMNAME". Put the name of your OS there, if you like - padded to 11 bytes. ($$ is the same as "start" - beginning of section - 0x7C00 - in this case).

没有太多的语法来 LODSB ,它只是一个指令......

(为什么我迷惑你使用lodbs作为typoed指令的例子吗?对不起。)

Not much "syntax" to lodsb, it's just an instruction...http://home.myfairpoint.net/fbkotler/nasmdocc.html#section-A.4.141(did I confuse you using "lodbs" as an example of a typoed instruction? Sorry.)

在:做绝对没问题。在单独线路上的标签的情况下,它会通知NASM它旨在是一个标签,并且不是typoed指令。看手册orphan_label的。 。NASM会(可选 - 默认开启)发出警告,如果没有:,但做正确的事反正

The ":" does absolutely nothing. In the case of a label alone on a line, it informs Nasm that it is intended to be a label, and isn't a typoed instruction. Look in the Manual for "orphan_label". Nasm will (optionally - default ON) warn if there's no ":", but does the right thing anyway.

您真的应该有一个 NOP JMP启动,因为NASM将发出一个短 JMP (旧版本的NASM默认为近 JMP )。由于THIS LINE的全部目的是为了把剩下的BPB变量在正确的地方,还不如去做!

You really ought to have a nop after jmp start, since Nasm will emit a "short" jmp (older versions of Nasm defaulted to a near jmp). Since the entire purpose of "THIS LINE" is to put the remaining BPB variables in the right place, might as well do it!

这篇关于在大会的几行说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 18:31