WDe and GPT, booting DOS (Users)
> > ... many many things mentioned ...
It is not immediately clear to me if you have successfully booted FreeDOS
from a GPT partition.
I have unsuccessfully tried to set up bootable FreeDOS on a
FAT32 64 MB GPT partition. Grub 2.02 (via Linux Mint 19) adds FreeDOS
to the boot menu - but it does not boot FreeDOS (yet).
I am assuming Japheth's method for MS-DOS 7.1 on GPT could be reconfigured
for FreeDOS on GPT (I hope that this can be achieved).
Any pointers, etc you can offer would be greatly appreciated. It would
take me a long time to fully understand all you have mentioned on this topic.
Below is what I have so far done.
Using Japheth's code in full, annotated (added some comments and "line numbers",
e.g., o123 to indicate line 123 of Japheth's original code ("o" for original))
fd_bs_00.asm
https://www.dropbox.com/s/n15804fh297nngz/fd_bs_00.asm?dl=1
should produce exactly Japheth's DOS71BSG.bin (i.e., no code changes, just comments etc)
fd_bs_01.asm
https://www.dropbox.com/s/czlh5mw06plsmpq/FD_bs_01.asm?dl=1
is first round of changes to attempt FreeDOS on GPT
FDmrei13.bat
https://www.dropbox.com/s/somc7vcko61qsj8/FDmrei13.bat?dl=1
is the .bat file to generate require i13 supplementary code
FDresI13.asm
https://www.dropbox.com/s/8605mgxpwukul0t/FDresI13.asm?dl=1
is the modified code written by Japheth
FDresI13.sys
https://www.dropbox.com/s/scgvzicj11pnnou/FDRESI13.SYS?dl=1
is the (modified) supplementary .sys file for CONFIG.SYS
RestI13.asm
https://www.dropbox.com/s/owld47spyvfqa1b/RestI13.asm?dl=1
is Japheth's original code
RestI13.sys
https://www.dropbox.com/s/pcqhci50vuvpcz0/RESTI13.SYS?dl=1
is the original (unmodified) .sys file for CONFIG.SYS
Summary of my changes (shown in bold) is below
{ relates to comments by ecm
o123 relates to line 123 in Japheth's o(riginal) code
r123 relates to my annotation for line o123
FD_bs_01.asm
;r001-:
;r001__: 2023aJAN02
;r001_: FD_bs_01.asm --> Fdos_bs.asm
;r001_a:
;r001_b: compiling FD.bat
;r001_c: @echo off
;r001_d: rem make FAT32 FreeDOS boot sector for GPT
;r001_e: jwasm -bin -nologo -F1=FD01_bsg.lst -Fo=FD01_bsg.bin -DMAKEGPTBS FD_bs_01.asm
;r001a:
;r001b: MS-DOS 7.1 kernel is IO.sys
;r001c: {FreeDOS kernel is KERNEL.sys}
;r001d:
;r001e: the boot code of DOS71bsg.bin loads IO.sys at 0070:0000
;r001f: {Fdos_bsg.bin} KERNEL.sys at 0060:0000 (linear 00600h)
;r001g:
;r001h: the boot code loads the first 4 sectors of IO.sys
;r001i:
;r001j:
;r001k: the boot code checks four bytes of loaded IO.sys (at pos 0 and pos 200h)
;r001l:
;r001m:
;r001n: the boot code loads SI:DI with the start cluster of IO.sys
;r001o:
;r001p:
;r001q: the boot code of MS-DOS jumps to 0070:0200 to switch control to the kernel
;r001r: {Entrypoint is at CS:IP = 60h:0}
;r001s:
;r001t: when jumping, there are a few values on the stack that IO.sys might use
;r001u:
;r001v:
;r001w:
;r001x: {BL holds load unit for int 13h}
;r001y: {full file must be loaded,implying that the boot sector loader needs
;r001z: {to locate itself away from linear 07C00h}
;r001zz: {SS:BP points to the boot sector with (E)BPB
;r001_: { (not used by current kernels)
;o001:
;o002: ;*** boot sector(s) FAT32, DOS 7.1
;o003:
;o004: ;--- 1. boot sector is read at 0000:7C00h
;o005: ;--- 2. sector 0 is read at 0000:0700h
;r005: ;--- 2. sector 0 is read at 0000:0600h
;o006: ;--- 3. 2 more sectors (fs info, bs2) are read at 0000:7E00
;o007: ;--- jmp to 8000h ( bs2 )
;o008: ;--- 4. directory sectors are read to 0000:0700h until IO.SYS is found
;r009: ;--- 4. directory sectors are read to 0000:0600h until KERNEL.SYS is found
;o009: ;--- FAT with read to get next cluster at 0000:7E00h
;o010: ;--- 5. first 4 sectors of IO.SYS are read at 0000:0700h
;r010: ;--- 5. first 4 sectors of KERNEL.SYS are read at 0000:0600h
;o011: ;--- jmp to IO.SYS 0070:0200h
;r011: ;--- jmp to KERNEL.SYS 0060:0200h
;r011z: [/b]
;r026:
PTOFS equ 1BEh ;o027: offset partition table in MBR
SIZEPTE equ 16 ;o028: size partition table entry
;o029:
BSADDR equ 7C00h ;o030: address where boot sectors (3) are loaded
MBRADDR equ 0700h ;o031:address where MBR is loaded
ROOTADDR equ 0700h ;o032: address where root directory sectors are loaded
FATADDR equ 7E00h ;o033: address where FAT sectors are loaded
; IOSYSADDR equ 0700h ;o034: address where IO.SYS sectors are loaded
KERNELsysADDR equ 0600h ;r034: address wheren KERNEL.SYS sectors are loaded
;r034: [/b]
;r180:
o180_L7CF6:
o181: jnc o188_error1 ; "ungueltiges system"
;r181: ; "invalid system"
o182: jmp o207_error2 ; "e/a fehler"
;r182: ; "e/a error"
o183_bs_ok:
o184: cmp [bp].BSECT.version, 0 ; [bp+2Ah]
o185: ja o188_error1 ; "ungueltiges system"
;r185: ; "invalid system"
;o186: jmp o316_readiosys ; jmp to 2. boot sector ( to load first 4 sectors of IO.SYS )
r186: jmp r316_readKERNELsys ; jmp to 2. boot sector ( to load first 4 sectors of KERNEL.sys)
o187:
o188_error1:
o189: mov si, offset L7D7E ; "ungueltiges system"
;r189: ; "invalid system"
o190_emsgexit: ; <--- display err msg SI
;r190:[/b]
;r205:
o205: mov si, offset L7D81 ; "Datentraeger wechseln und Taste druecken"
;r205z: ; "Change data medium and press button"
o206: jmp o190_emsgexit ;--->
o207_error2:
o208: mov si, offset L7D7F ; "E/A-Fehler" "E/A-Error"
o209: jmp o190_emsgexit ;--->
o210_L7D26:
;r210:
;r273:
L7D7E db offset msg1 - ($+1) ; offset to "Ungueltiges System" ;o274: "Invalid System"
L7D7F db offset msg2 - ($+1) ; offset to "E/A-Fehler" ;o275: "E/A-Error"
L7D80 db offset msg1 - ($+1) ; offset to "Ungueltiges System" ;o276: "Invalid System"
L7D81 db offset msg3 - ($+1) ; offset to "Datentraeger wechseln..." ;o277: "Change data medium..."
; msg1 db 0Dh, 0Ah, "Ungueltiges System ", -1 ;o278:
msg1 db 0Dh, 0Ah, "Invalid System ", -1 ;r278:
; msg2 db 0Dh, 0Ah, "E/A-Fehler ", -1 ;o279:
msg2 db 0Dh, 0Ah, "E/A-Error ", -1 ;r279:
; msg3 db 0Dh, 0Ah, "Datentraeger wechseln und Taste druecken", 0Dh, 0Ah, 0 ;o280:
msg3 db 0Dh, 0Ah, "Change data medium and press button ", 0Dh, 0Ah, 0 ;r280:
db 0, 0 ;o281: not used
; namekrnl db "IO SYS" ;o282: [b]
namekrnl db "KERNEL SYS" ;r282:
db "MSDOS SYS" ;o283: not used
o284:
dw offset L7D7E - offset o091_start ;o285:
db 0 ;o286: not used
o287:
db "WINBOOT SYS" ;o288: not used
dw 0 ;o289: not used
o290:
o291: org BSADDR+1FEh
dw 0AA55h ;o292:
;r292: [/b]
;r316: ;
; o316_readiosys proc ;
r316_readKERNELsys proc ;
o317: CLI
o318: MOVZX EAX, [bp].BSECT.num_fats ; [BP+10h]
o319: MOV ECX, [bp].BSECT.sectors_fat32 ; [BP+24h]
o320: MUL ECX
o321: ADD EAX, [bp].BSECT.hidden_sectors ; [BP+1Ch]
o322: MOVZX EDX, [bp].BSECT.reserved_sectors; [BP+0Eh]
o323: ADD EAX, EDX
o324: XOR CX, CX
o325: MOV [bp].BSECT.dwStartData, EAX ; start of data region
o326: MOV [bp].BSECT.dwFatSecNo, -1 ; no FAT sector read yet
o327: CLI
o328: MOV EAX, [bp].BSECT.root_startcl ; [BP+2Ch]
o329: CMP EAX, 2
o330: JB o188_error1
o331: CMP EAX, 0FFFFFF8h
o332: JAE o188_error1
o333: SHLD EDX, EAX, 16
o334: STI
o335_nextcluster: ; <--- next cluster
o336: PUSH DX
o337: PUSH AX
o338: CLI
o339: SHL EAX, 16 ; "shl eax,16"+"shrd eax,edx,16" = 9 bytes
o340: SHRD EAX, EDX, 16 ; "mov eax, [bp-20]" = 4 bytes!
o341: SUB EAX, 2
o342: MOVZX EBX, [bp].BSECT.sectors_cluster ; [BP+0Dh]
o343: MOV SI, BX
o344: MUL EBX ; eax=rel. sector# of cluster
o345: ADD EAX, [bp].BSECT.dwStartData ; eax=abs. sector# of cluster
o346: SHLD EDX, EAX, 16 ; dx:ax=abs. sector#
o347: STI
;r348:
o348_nextdirsect: ; <--- read next directory sector
o349: MOV BX, ROOTADDR
o350: MOV DI, BX
o351: MOV CX, 1
o352: CALL o226_read_sectors ; read 1 directory sector ( sets BX = BX+200h! )
o353: JB o207_error2 ; "e/a fehler" "e/a error"
o354_nextdirentry: ; <--- next dir entry
o355: CMP [DI], CH ; end of directory?
o356: JZ o374_done_root
o357: MOV CL, 8+3
o358: PUSH SI
o359: MOV SI, offset namekrnl ; "IO SYS"
;r359: ; "KERNEL SYS"
o360: REPE CMPSB
o361: POP SI
o362: JZ o377_found
;r362:
;r394: ;
o395: STI
;o396: MOV BX, IOSYSADDR ;
r396: MOV BX, KERNELsysADDR ;
o397: PUSH BX
;o398: MOV CX, 4 ;read 4 sectors of IO.SYS at 0070:0000
r398: MOV CX, 4 ;read 4 sectors of KERNEL.SYS at 0060:0000
o399: CALL o226_read_sectors
o400: POP BX
o401: JB o207_error2 ; "e/a fehler" "e/a error"
o402: CMP WORD PTR [BX], 5A4Dh;check "MZ"
o403: JNZ o406_invalid
o404: CMP WORD PTR [BX+0200h], 4A42h ; this is "BJ", actually "inc dx", "dec dx"
;o405: JZ o409_iosys_ok ;
r405: JZ r409_KERNELsys_ok ;
o406_invalid:
o407: MOV SI, offset L7D80 ;"ungueltiges system" "invalid system"
o408: JMP o190_emsgexit ;error
;o409_iosys_ok: ;
r409_KERNELsys_ok: ;
if ?ICINT13 ;o410:
o411: call o488_installi13
endif ;o412:
o413: ; JMP 0070h:0200h
db 0eah ;o414:
; dw 0200h, 0070h ;o415: jump to loaded part of IO.SYS, registers BP, SP, SI, DI must be correct!
dw 0200h, 0060h ;r415: jump to loaded part of KERNEL.SYS, registers BP, SP, SI, DI must be correct!
o416:
; o316_readiosys endp ;o417:
r316_readKERNELsys endp ;
;r417:
;r472: ;
o473: MOV BX, DI
o474: MOV CX, 1
o475: CALL o226_read_sectors
o476: POP DX
o477: JB o207_error2 ; "e/a fehler" "e/a error"
o478_done:
o479: STI
o480: MOV BX, DX ; BX=offset within FAT sector for current entry
o481: RET
o442_readfatsec endp ;o482:
;r482: [/b]
FD.bat
@echo off
rem make FAT32 FreeDOS boot sectors for MBR and GPT
jwasm -bin -nologo -Fl=FD_bsm.lst -Fo=FD_bsm.bin FD_bs_01.asm
jwasm -bin -nologo -Fl=FD_bsg.lst -Fo=FD_bsg.bin -DMAKEGPTBS FD_bs_01.asm
FDresi13.asm (originally Resti13.asm)
.code ;o032:
;o033:
dw 0ffffh ;o034:
dw 0ffffh ;o035:
dw 8000h ;attribute ;o036:
dw offset devstrat ;device strategy ;o037:
dw offset devint ;device interrupt ;o038:
; db 'RESTI13$' ;device name ;o039:
db 'FDresi13$' ;r039:
; invoke printf, CStr("resti13: old=%X:%X, new=%X:%X",10), cx, bx, ax, dx ;o093:
invoke printf, CStr("FDresi13: old=%X:%X, new=%X:%X",10), cx, bx, ax, dx ;r093:
FDmrei13.bat (originally Mresti13.bat)
@echo off
jwasm -bin -nologo -Fl -Fo=FDRESI13.SYS FDresI13.asm
fdconfig.sys (added the following as 1st line)
device=c:\FDresi13.sys
also tried
device = c:\resti13.sys
but both changes here for fdconfig.sys does not make FreeDOS bootable
on GPT (FAT32 64 MB partition) for my changes to date.
Below are relevant WDE screenshots of the GPT FAT32 64 MB FreeDOS partition
Complete thread:
- WDe and GPT, booting DOS - Japheth, 24.10.2022, 10:56
- WDe and GPT, booting DOS - tom, 24.10.2022, 17:31
- WDe and GPT, booting DOS - Japheth, 25.10.2022, 05:24
- WDe and GPT, booting DOS - tom, 25.10.2022, 13:40
- WDe and GPT, booting DOS - Japheth, 25.10.2022, 17:29
- WDe and GPT, booting DOS - Zyzzle, 27.10.2022, 16:08
- WDe and GPT, booting DOS - Japheth, 27.10.2022, 16:41
- WDe and GPT, booting DOS - Japheth, 28.10.2022, 20:13
- WDe and GPT, booting DOS - Zyzzle, 29.10.2022, 02:39
- WDe and GPT, booting DOS - Richard, 02.11.2022, 03:39
- WDe and GPT, booting DOS - Zyzzle, 02.11.2022, 06:43
- WDe and GPT, booting DOS - Japheth, 02.11.2022, 07:55
- WDe and GPT, booting DOS - ecm, 02.11.2022, 09:55
- WDe and GPT, booting DOS - ecm, 02.11.2022, 11:21
- WDe and GPT, booting DOS - Japheth, 04.11.2022, 08:06
- WDe and GPT, booting DOS - ecm, 04.11.2022, 10:14
- WDe and GPT, booting DOS - ecm, 04.11.2022, 11:30
- WDe and GPT, booting DOS - Richard, 03.01.2023, 16:37
- WDe and GPT, booting DOS - ecm, 04.01.2023, 13:42
- Booting FreeDOS from an MS-DOS v7 compatible IO.SYS - ecm, 04.01.2023, 14:11
- WDe and GPT, booting DOS - ecm, 04.01.2023, 13:42
- WDe and GPT, booting DOS - Richard, 03.01.2023, 16:37
- WDe and GPT, booting DOS - ecm, 04.11.2022, 11:30
- WDe and GPT, booting DOS - ecm, 04.11.2022, 10:14
- WDe and GPT, booting DOS - Richard, 10.11.2022, 13:11
- WDe and GPT, booting DOS - Japheth, 10.11.2022, 17:55
- WDe and GPT, booting DOS - Richard, 22.11.2022, 07:10
- WDe and GPT, booting DOS - Rugxulo, 22.11.2022, 09:00
- WDe and GPT, booting DOS - Japheth, 22.11.2022, 09:52
- WDe and GPT, booting DOS - Richard, 22.11.2022, 12:29
- WDe and GPT, booting DOS - Japheth, 22.11.2022, 15:26
- WDe and GPT, booting DOS - Richard, 28.11.2022, 13:18
- WDe and GPT, booting DOS - Japheth, 28.11.2022, 16:57
- WDe and GPT, booting DOS - Richard, 08.12.2022, 17:21
- WDe and GPT, booting DOS - Japheth, 09.12.2022, 05:10
- WDe and GPT, booting DOS - Richard, 11.12.2022, 03:08
- WDe and GPT, booting DOS - Japheth, 11.12.2022, 10:39
- WDe and GPT, booting DOS - Richard, 11.12.2022, 14:53
- WDe and GPT, booting DOS - Japheth, 12.12.2022, 10:34
- WDe and GPT, booting DOS - Richard, 21.12.2022, 17:30
- WDe and GPT, booting DOS - glennmcc, 21.12.2022, 19:07
- WDe and GPT, booting DOS - Japheth, 22.12.2022, 14:52
- WDe and GPT, booting DOS - glennmcc, 22.12.2022, 18:41
- WDe and GPT, booting DOS - Richard, 23.12.2022, 01:49
- WDe and GPT, booting DOS - glennmcc, 23.12.2022, 05:06
- WDe and GPT, booting DOS - Richard, 23.12.2022, 06:46
- WDe and GPT, booting DOS - glennmcc, 23.12.2022, 05:06
- WDe and GPT, booting DOS - Richard, 23.12.2022, 01:49
- WDe and GPT, booting DOS - Richard, 26.12.2022, 12:16
- WDe and GPT, booting DOS - Richard, 28.12.2022, 09:34
- WDe and GPT, booting DOS - Japheth, 28.12.2022, 12:05
- WDe and GPT, booting DOS - Richard, 28.12.2022, 17:27
- WDe and GPT, booting DOS - Japheth, 29.12.2022, 19:32
- WDe and GPT, booting DOS - Richard, 30.12.2022, 07:52
- WDe and GPT, booting DOS - Zyzzle, 31.12.2022, 08:23
- WDe and GPT, booting DOS - Japheth, 02.01.2023, 13:04
- WDe and GPT, booting DOS - Richard, 03.01.2023, 03:51
- WDe and GPT, booting DOS - glennmcc, 03.01.2023, 04:05
- WDe and GPT, booting DOS - Richard, 03.01.2023, 04:37
- WDe and GPT, booting DOS - Richard, 03.01.2023, 05:17
- WDe and GPT, booting DOS - jadoxa, 04.01.2023, 01:02
- WDe and GPT, booting DOS - Richard, 03.01.2023, 05:17
- WDe and GPT, booting DOS - Richard, 03.01.2023, 04:37
- WDe and GPT, booting DOS - Japheth, 03.01.2023, 09:14
- WDe and GPT, booting DOS - Richard, 16.01.2023, 02:50
- WDe and GPT, booting DOS - glennmcc, 03.01.2023, 04:05
- WDe and GPT, booting DOS - Japheth, 29.12.2022, 19:32
- WDe and GPT, booting DOS - Richard, 28.12.2022, 17:27
- WDe and GPT, booting DOS - Japheth, 28.12.2022, 12:05
- WDe and GPT, booting DOS - glennmcc, 22.12.2022, 18:41
- WDe and GPT, booting DOS - Richard, 21.12.2022, 17:30
- WDe and GPT, booting DOS - Japheth, 12.12.2022, 10:34
- WDe and GPT, booting DOS - Richard, 11.12.2022, 14:53
- WDe and GPT, booting DOS - Japheth, 11.12.2022, 10:39
- WDe and GPT, booting DOS - Richard, 11.12.2022, 03:08
- WDe and GPT, booting DOS - Japheth, 09.12.2022, 05:10
- WDe and GPT, booting DOS - Richard, 08.12.2022, 17:22
- WDe and GPT, booting DOS - Richard, 08.12.2022, 17:24
- WDe and GPT, booting DOS - Richard, 08.12.2022, 17:21
- WDe and GPT, booting DOS - Japheth, 28.11.2022, 16:57
- WDe and GPT, booting DOS - Richard, 28.11.2022, 13:18
- WDe and GPT, booting DOS - Japheth, 22.11.2022, 15:26
- WDe and GPT, booting DOS - Richard, 22.11.2022, 12:29
- WDe and GPT, booting DOS - Richard, 22.11.2022, 07:10
- WDe and GPT, booting DOS - Japheth, 10.11.2022, 17:55
- WDe and GPT, booting DOS - ecm, 02.11.2022, 09:55
- WDe and GPT, booting DOS - Japheth, 28.10.2022, 20:13
- WDe and GPT, booting DOS - Japheth, 27.10.2022, 16:41
- WDe and GPT, booting DOS - Zyzzle, 27.10.2022, 16:08
- WDe and GPT, booting DOS - RayeR, 15.12.2022, 19:49
- WDe and GPT, booting DOS - tom, 15.12.2022, 20:14
- WDe and GPT, booting DOS - Japheth, 25.10.2022, 17:29
- WDe and GPT, booting DOS - tom, 25.10.2022, 13:40
- WDe and GPT, booting DOS - Japheth, 25.10.2022, 05:24
- WDe and GPT, booting DOS - tom, 24.10.2022, 18:15
- WDe and GPT, booting DOS - Zyzzle, 25.10.2022, 02:55
- WDe and GPT, booting DOS - tom, 25.10.2022, 13:39
- WDe and GPT, booting DOS - tom, 03.01.2023, 17:14
- WDe and GPT, booting DOS - Richard, 03.01.2023, 17:44
- WDe and GPT, booting DOS - fritz.mueller, 03.01.2023, 18:17
- WDe and GPT, booting DOS - Richard, 03.01.2023, 18:28
- WDe and GPT, booting DOS - glennmcc, 03.01.2023, 22:10
- WDe and GPT, booting DOS - Richard, 03.01.2023, 18:28
- WDe and GPT, booting DOS - fritz.mueller, 03.01.2023, 18:17
- WDe and GPT, booting DOS - Richard, 03.01.2023, 17:44
- WDe and GPT, booting DOS - Zyzzle, 25.10.2022, 02:55
- WDe and GPT, booting DOS - glennmcc, 24.10.2022, 19:09
- WDe and GPT, booting DOS - rr, 24.10.2022, 20:19
- WDe and GPT, booting DOS - Japheth, 25.10.2022, 05:14
- WDe v1.0 - Japheth, 14.11.2022, 10:35
- WDe and GPT, booting DOS - tom, 24.10.2022, 17:31