China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-07 12:46
中国DOS联盟论坛 » DOS启动盘 & LOGO技术 (启动盘室) » Can make your self-written program be started by the bootloader (with source code) View 6,945 Replies 23
Original Poster Posted 2005-08-26 11:49 ·  中国 辽宁 沈阳 联通
高级用户
★★
Credits 739
Posts 111
Joined 2004-11-30 00:00
21-year member
UID 34209
Gender Male
From 辽宁沈阳
Status Offline
cstrt086.asm is my modification of the startup file of Open Watcom C/C++ 1.3, making the startup address of the program cstart become 0000:0000, which makes it easier to relocate the program. In this way, the executable image file can be generated by EXEFLAT.EXE (only for 16-bit DOS real mode);

sys_demo.bat is a batch file that turns demo.exe into KERNEL.SYS that can be booted from the hard disk by FreeDOS boot loader;

Set the starting address in Open Watcom C/C++ 1.3 link switches --> 3. Advanced switches to _cstart_, compile MAIN_boot.c and cstrt086.asm, name the executable file demo.exe, double-click (execute) sys_demo.bat; you can get KERNEL.SYS;

Replace KERNEL.SYS with FreeDOS's KERNEL.SYS (you can rename FreeDOS's KERNEL.SYS) to realize the hard disk boot of FreeDOS boot loader;

Extract the files in rtCell_img.rar and Qemu.rar to the same folder (without any subdirectories), double-click (execute) rtCell.bat to see that KERNEL.SYS is loaded by FreeDOS boot loader and executed on the emulator;

*****************************************************
***This file is best executed with a virtual machine or emulator to avoid damaging hard disk data***
*****************************************************

If any friend has questions, new ideas, or finds errors, please contact: taowentao_twt@163.com

[ Last edited by taowentao on 2005-9-3 at 15:53 ]
Floor 2 Posted 2005-08-28 13:30 ·  中国 辽宁 沈阳 联通
高级用户
★★
Credits 739
Posts 111
Joined 2004-11-30 00:00
21-year member
UID 34209
Gender Male
From 辽宁沈阳
Status Offline
"China DOS Union Forum » DOS Development Programming & Development Exchange (Development Room) ---> Real-time microkernel that can read and write FAT16 format files on the hard disk" There are also files related to reading and writing FAT16 format files on the hard disk that can be downloaded.

Among them, the C code for reading and writing the hard disk is only more than 400 lines;
The C code for reading and writing FAT16 format files is only more than 620 lines.

Very suitable for writing your own boot programs or for embedded systems.
Floor 3 Posted 2005-08-29 01:02 ·  中国 湖北 天门 联通
中级用户
★★
绝不写垃圾帖
Credits 322
Posts 99
Joined 2004-07-03 00:00
22-year member
UID 27774
Gender Male
From 湖北
Status Offline
I still can't understand these programs now, but I admire that you understand the operating system so thoroughly!
从95年开始用DOS3.2,96年在Windows3.1里认识了鼠标,97年开始用Win95,98年装过NetWare,99年迷过Linux,现在用WinXP、WinME和DOS7.1。一回首,从盲到忙,从忙到茫。
Floor 4 Posted 2005-08-29 15:47 ·  中国 湖北 武汉 联通
高级用户
★★★
Credits 587
Posts 302
Joined 2005-07-25 17:31
20-year member
UID 41046
Gender Male
Status Offline
How to obtain the source code of FREEDOS32? The website says that it is necessary to use a certain synchronization download tool, but I have tried several times without success.
欢迎造访DOS的小屋!
http://risky.ik8.com
Floor 5 Posted 2005-08-29 16:06 ·  中国 辽宁 沈阳 联通
高级用户
★★
Credits 739
Posts 111
Joined 2004-11-30 00:00
21-year member
UID 34209
Gender Male
From 辽宁沈阳
Status Offline
I tried, and I can download directly
"http://prdownloads.sourceforge.net/freedos-32/fd32-0.0.5-src.tar.bz2?use_mirror=umn"
Floor 6 Posted 2005-08-29 20:39 ·  中国 湖北 武汉 联通
高级用户
★★★
Credits 587
Posts 302
Joined 2005-07-25 17:31
20-year member
UID 41046
Gender Male
Status Offline
I'm really dizzy. (Sweat...)
I only focused on the "Latest source code from CVS"...
欢迎造访DOS的小屋!
http://risky.ik8.com
Floor 7 Posted 2005-08-31 09:18 ·  中国 辽宁 沈阳 联通
高级用户
★★
Credits 739
Posts 111
Joined 2004-11-30 00:00
21-year member
UID 34209
Gender Male
From 辽宁沈阳
Status Offline
Both rtCell_img.rar and Qemu.rar should be downloaded simultaneously and extracted into the same folder (without any subdirectories) to see the execution result on the emulator. To make your self-compiled program be booted by the bootloader and executed correctly, there should be no DOS calls in this program; it can only call BIOS functions or your self-compiled hardware driver programs. There are many resources available online for reference, please friends query them.
Floor 8 Posted 2005-09-02 09:33 ·  中国 辽宁 沈阳 联通
高级用户
★★
Credits 739
Posts 111
Joined 2004-11-30 00:00
21-year member
UID 34209
Gender Male
From 辽宁沈阳
Status Offline
The rtCell.img in rtCell_img.rar is a hard disk image file. You can use winimage to add or delete files/folders in it (winimage can be downloaded from http://as.onlinedown.net/). So as to demonstrate the program you wrote that is started by the "bootloader" on the emulator.
Floor 9 Posted 2005-09-07 15:21 ·  中国 辽宁 沈阳 联通
高级用户
★★
Credits 739
Posts 111
Joined 2004-11-30 00:00
21-year member
UID 34209
Gender Male
From 辽宁沈阳
Status Offline
Make the following modifications to the file:

public _arg1
public _arg2
.
.
.

_cstart_ proc near
jmp around
_arg1:
DB 'a', 'r', 'g', '1'
_arg2:
DB 'a', 'r', 'g', '2'

around: sti ; enable interrupts
mov dx,DGROUP

mov ds,dx
mov es,dx
call _CMain
_cstart_ endp


Then reference in the C program: extern DWORD arg1, arg2;

Modify the values of arg1 and arg2 in the executable file from the bootloader (dynamically) or using a binary modification tool (static), so that parameters can be passed to your program.
Floor 10 Posted 2005-09-14 11:34 ·  中国 辽宁 沈阳 联通
高级用户
★★
Credits 739
Posts 111
Joined 2004-11-30 00:00
21-year member
UID 34209
Gender Male
From 辽宁沈阳
Status Offline
Off-the-BIOS FAT16 file operations, please go to

"DOS Development Programming & Development Exchange (Development Room) ------>
Read-write hard disk FAT16 format file real-time microkernel (including source code)"

to view the source code.
Floor 11 Posted 2006-02-04 14:40 ·  中国 广东 茂名 高州市 中移铁通
新手上路
Credits 8
Posts 6
Joined 2006-02-04 13:51
20-year member
UID 49830
Status Offline
Floor 12 Posted 2006-02-05 22:41 ·  中国 河南 洛阳 联通
高级用户
★★
Credits 544
Posts 164
Joined 2004-10-17 12:00
21-year member
UID 32648
Gender Male
Status Offline
I will provide a file:
This is a protection module of a hard disk protection card, write hj.bin into the BIOS chip of the mainboard. Plug in the network card to replace the hard disk protection card. Hope you can write a program to load and run it under DOS, or make it into KERNEL.SYS like the program you posted on the DOS forum to start and test its performance!

[ Last edited by hnlyzhd on 2006-2-5 at 22:48 ]
Attachments
bin.rar (50.02 KiB, Credits to download 1 pts, Downloads: 60)
我的留言簿

http://hnlyzhd.ys168.com 我的网络盘
Floor 13 Posted 2006-02-09 12:46 ·  中国 辽宁 沈阳 联通
高级用户
★★
Credits 739
Posts 111
Joined 2004-11-30 00:00
21-year member
UID 34209
Gender Male
From 辽宁沈阳
Status Offline
Please provide the relevant Chinese content about "hj.bin 的调用接口作个详细说明,列出其初始化入口地址" so that I can translate it. Currently, the content you provided is incomplete for translation. Please supply the full relevant Chinese text.
Floor 14 Posted 2006-10-20 15:14 ·  中国 北京 海淀区 联通
新手上路
Credits 14
Posts 7
Joined 2006-10-20 10:21
19-year member
UID 67241
Status Offline
Too profound!! Can't understand
Floor 15 Posted 2006-10-20 21:52 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
The foundation is not enough~~~ Too advanced~~~

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Forum Jump: