![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-15 05:30 |
47,812 topics / 349,917 posts / today 0 new / 48,268 members |
| DOS开发编程 & 发展交流 (开发室) » Source code for reading the hard disk master boot sector |
| Printable Version 1,042 / 4 |
| Floor1 qb45 | Posted 2003-09-20 00:00 |
| 高级用户 Posts 194 Credits 677 | |
|
'$INCLUDE: 'qb.bi'
DIM SHARED ax, bx, cx, dx, es buff$ = SPACE$(512) 'set the disk buffer bx = SADD(buff$) 'get the buffer offset address es = VARSEG(buff$) 'get the segment address of the buffer OPEN "savehd.dat" FOR BINARY AS #1 ax = &H201 cx = 1 dx = &H80 int13 ' call interrupt 13 PUT #1, , buff$ CLOSE #1 PRINT "The hard disk master boot sector has been successfully saved to the file SAVEHD.DAT!" END SUB int13 InRegs.ax = ax InRegs.bx = bx InRegs.cx = cx InRegs.dx = dx InRegs.es = es INTERRUPTX &H13, InRegs, OutRegs ax = OutRegs.ax bx = OutRegs.bx cx = OutRegs.cx dx = OutRegs.dx es = OutRegs.es END SUB This program was written in qb4.5 and tested OK! Hope everyone will give it lots of support! |
|
| Floor2 qb45 | Posted 2003-09-30 00:00 |
| 高级用户 Posts 194 Credits 677 | |
|
Explanation: INT 13 interrupt AH=2 read AL = number of sectors to read BX=buffer address CL=starting sector number
DL=the drive to operate on. Using DEBUG is very simple A MOV AX,201 MOV BX,200 MOV CX,1 MOV DX,80 INT 13 INT 3 G ‘at this time the contents of the hard disk master boot sector have already been read out N HDBOOT。DAT ’the filename to save RCX 200 ‘the file size W 200 ’start writing from address 200 I'm new here, please reply with a few posts everybody! I'd be happy even if you criticize me! Don't make me feel this place is so empty! |
|
| Floor3 iceboy | Posted 2003-10-03 00:00 |
| 银牌会员 Posts 512 Credits 1,681 | |
|
I found a small problem: RegType does not include es, RegTypeX should be used instead (I'm using QBX 7.1), and it should also be stated that /l should be added when compiling.
This program is really good, and the prompt under Win2000 is really cool: this program is trying to directly access the hard disk... |
|
| Floor4 cn_archer | Posted 2003-10-03 00:00 |
| 元老会员 Posts 991 Credits 2,903 From 福建省 | |
|
IceBoy, well done!
|
|
| Floor5 lemonhall | Posted 2003-10-04 00:00 |
| 高级用户 Posts 183 Credits 639 | |
|
Hehe, actually under FREEDOS it can also easily damage the boot record, luckily it only reads.
QB45 may always use BATCH to launch QB4.5, so he forgot to write the /L parameter, ??? |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |