|
主题 : : ??扩展helloworld程序?? [待解决] |
回复[ 3次 ]
点击[ 236次 ] | |
|
|
|
|
[帖 主]
[ 发表时间:2009-10-27 22:40 ]
[引用]
[回复]
[ top ] | |
荣誉值:0
信誉值:0
注册日期:2009-10-19 22:16 |
根据helloworld这个程序的结构,在dos下,怎样把它扩展写出一个读MBR数据并显示 的汇编程序呢?(主要用INT 21 、INT 13)
;hello.asm
;NASM "Hello World!", run in CMD or DOS.
;编译链接命令:
;nasm hello.asm -o hello.com
section .text
global main
org 100h
main:
mov ax, cs
mov ds, ax
mov ah, 9 ;9号调用
mov dx, msge ;字符串的首地址送入dx
int 21h ;输出字符串
mov ah, 4ch ;4ch号调用
int 21h ;结束
msge:
db 'Hello World!',0dh,0ah,'$' | | |
|
|
|
|
[第1楼]
[ 回复时间:2009-10-28 09:16 ]
[引用]
[回复]
[ top ] | |
荣誉值:337
信誉值:0
注册日期:2008-01-01 17:48 |
MBR(Main Boot Record),中文意为主引导记录。
硬盘上的数据由五大部分组成,它们分别是:MBR区、 DBR区,FAT区,DIR区和#区。MBR(Main Boot Record)区,即主引导记录区,位于整个硬盘的0磁道0柱面1扇区。
MBR的组成一个扇区的硬盘主引导记录MBR由4个部分组成。
·主引导程序(偏移地址0000H--0088H),它负责从活动分区中装载,并运行系统引导程序。
·出错信息数据区,偏移地址0089H--00E1H为出错信息,00E2H--01BDH全为0字节。
·分区表(DPT,Disk Partition Table)含4个分区项,偏移地址01BEH--01FDH,每个分区表项长16个字节,共64字节为分区项1、分区项2、分区项3、分区项4。
·结束标志字,偏移地址01FE--01FF的2个字节值为结束标志55AA,如果该标志错误系统就不能启动。
在汇编语言最后一章讲了如何使用读写磁盘,再加上上面的内容,这个实验就比较容易了。 | | |
|
|
|
|
[第2楼]
[ 回复时间:2009-10-28 22:51 ]
[引用]
[回复]
[ top ] | |
荣誉值:0
信誉值:0
注册日期:2009-10-19 22:16 |
在dos下,写出一个读MBR数据并显示 的汇编程序,谁可以帮我完善它
;hello.asm
;NASM "Hello World!", run in CMD or DOS.
;编译链接命令:
;nasm hello.asm -o hello.com
section .text
global main
org 100h
main:
mov ax, cs
mov ds, ax
mov ah, 9 ;9号调用
mov dx, msge ;字符串的首地址送入dx
int 21h ;输出字符串
mov ah, 4ch ;4ch号调用
int 21h ;结束
mov ax,0201h ;(用功能号2读1个扇区)
mov bx,msge1
mov cx,0001h ;(读0柱面,1扇区)
mov dx,0080h ;(指定第一物理盘的0磁头)
int 13h
mov ax, cx
mov ds, ax
mov ah, 9 ;9号调用
mov dx,msge1
int 21h ;输出字符串
mov ah, 4ch ;4ch号调用
int 21h ;结束
msge:
db 'This is MBR message!',0dh,0ah,'$'
msge1: () | | |
|
|
|
|
[第3楼]
[ 回复时间:2009-10-28 22:52 ]
[引用]
[回复]
[ top ] | |
荣誉值:0
信誉值:0
注册日期:2009-10-19 22:16 |
|
|