FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

add ability to adjust verboseness of messages during booting · Programuserbash/MS-DOS-kernel@5880d36 · GitHub

Commit 5880d36

Browse files
committed
add ability to adjust verboseness of messages during booting
1 parent e4a62f2 commit 5880d36

9 files changed

Lines changed: 69 additions & 19 deletions

File tree

‎boot/boot.asm‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,12 @@ readDisk: push si
410410
mov word [READADDR_SEG], es
411411
mov word [READADDR_OFF], bx
412412

413+
%ifndef QUIET
413414
call show
414415
db ".",0
416+
%else ; ensure code after this still at same location
417+
times 5 nop
418+
%endif
415419
read_next:
416420

417421
;******************** LBA_READ *******************************

‎boot/boot32lb.asm‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,12 @@ cont: mov ds, ax
135135
sti
136136
mov [drive], dl ; BIOS passes drive number in DL
137137

138+
%ifndef QUIET
138139
mov si, msg_LoadFreeDOS
139140
call print ; modifies AX BX SI
141+
%else ; ensure code after this still at same location
142+
times 6 nop
143+
%endif
140144

141145

142146
; -------------

‎boot/makefile‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88
production: fat12com.bin fat16com.bin fat32chs.bin fat32lba.bin oemfat12.bin oemfat16.bin
99

1010
fat12com.bin: boot.asm
11-
$(NASM) -dISFAT12 boot.asm -l$*.lst -ofat12com.bin
11+
$(NASM) -dISFAT12 $(NASMFLAGS) boot.asm -l$*.lst -ofat12com.bin
1212

1313
fat16com.bin: boot.asm
14-
$(NASM) -dISFAT16 boot.asm -l$*.lst -ofat16com.bin
14+
$(NASM) -dISFAT16 $(NASMFLAGS) boot.asm -l$*.lst -ofat16com.bin
1515

1616
fat32chs.bin: boot32.asm
17-
$(NASM) boot32.asm -l$*.lst -ofat32chs.bin
17+
$(NASM) $(NASMFLAGS) boot32.asm -l$*.lst -ofat32chs.bin
1818

1919
fat32lba.bin: boot32lb.asm
20-
$(NASM) boot32lb.asm -l$*.lst -ofat32lba.bin
20+
$(NASM) $(NASMFLAGS) boot32lb.asm -l$*.lst -ofat32lba.bin
2121

2222
oemfat12.bin: oemboot.asm
23-
$(NASM) -dISFAT12 oemboot.asm -l$*.lst -ooemfat12.bin
23+
$(NASM) -dISFAT12 $(NASMFLAGS) oemboot.asm -l$*.lst -ooemfat12.bin
2424

2525
oemfat16.bin: oemboot.asm
26-
$(NASM) -dISFAT16 oemboot.asm -l$*.lst -ooemfat16.bin
26+
$(NASM) -dISFAT16 $(NASMFLAGS) oemboot.asm -l$*.lst -ooemfat16.bin
2727

2828
clobber: clean
2929
-$(RM) *.bin status.me

‎hdr/kconfig.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,6 @@ typedef struct _KernelConfig {
5050
/* 0 = do not check (assume absent),
5151
1 = do check by running breakpoint,
5252
2 = assume present */
53+
54+
signed char Verbose; /* -1 = quiet, 0 = normal, 1 = verbose */
5355
} KernelConfig;

‎kernel/config.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ STATIC void Config_Buffers(BYTE * pLine)
12251225
STATIC void CfgBuffersHigh(BYTE * pLine)
12261226
{
12271227
Config_Buffers(pLine);
1228-
printf("Note: BUFFERS will be in HMA or low RAM, not in UMB\n");
1228+
if (InitKernelConfig.Verbose >= 0) printf("Note: BUFFERS will be in HMA or low RAM, not in UMB\n");
12291229
}
12301230

12311231
/**
@@ -1276,7 +1276,7 @@ STATIC VOID sysVersion(BYTE * pLine)
12761276
if (GetNumArg(p, &minor) == (BYTE *) 0)
12771277
return;
12781278

1279-
printf("Changing reported version to %d.%d\n", major, minor);
1279+
if (InitKernelConfig.Verbose >= 0) printf("Changing reported version to %d.%d\n", major, minor);
12801280

12811281
LoL->os_setver_major = major; /* not the internal os_major */
12821282
LoL->os_setver_minor = minor; /* not the internal os_minor */
@@ -2223,8 +2223,11 @@ STATIC void config_init_buffers(int wantedbuffers)
22232223
if (FP_SEG(pbuffer) == 0xffff)
22242224
{
22252225
buffers++;
2226-
printf("Kernel: allocated %d Diskbuffers = %u Bytes in HMA\n",
2226+
if (InitKernelConfig.Verbose >= 0)
2227+
{
2228+
printf("Kernel: allocated %d Diskbuffers = %u Bytes in HMA\n",
22272229
buffers, buffers * sizeof(struct buffer));
2230+
}
22282231
}
22292232
}
22302233

‎kernel/initdisk.c‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ void init_LBA_to_CHS(struct CHS *chs, ULONG LBA_address,
356356
void printCHS(char *title, struct CHS *chs)
357357
{
358358
/* has no fixed size for head/sect: is often 1/1 in our context */
359-
printf("%s%4u-%u-%u", title, chs->Cylinder, chs->Head, chs->Sector);
359+
if (InitKernelConfig.Verbose >= 0) printf("%s%4u-%u-%u", title, chs->Cylinder, chs->Head, chs->Sector);
360360
}
361361

362362
/*
@@ -735,7 +735,7 @@ STATIC int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam)
735735
if (driveParam->chs.Sector == 0) {
736736
/* happens e.g. with Bochs 1.x if no harddisk defined */
737737
driveParam->chs.Sector = 63; /* avoid division by zero...! */
738-
printf("BIOS reported 0 sectors/track, assuming 63!\n");
738+
if (InitKernelConfig.Verbose >= 0) printf("BIOS reported 0 sectors/track, assuming 63!\n");
739739
}
740740

741741
if (!(driveParam->descflags & DF_LBA))
@@ -819,10 +819,13 @@ void print_warning_suspect(char *partitionName, UBYTE fs, struct CHS *chs,
819819
{
820820
if (!InitKernelConfig.ForceLBA)
821821
{
822-
printf("WARNING: using suspect partition %s FS %02x:", partitionName, fs);
823-
printCHS(" with calculated values ", chs);
824-
printCHS(" instead of ", pEntry_chs);
825-
printf("\n");
822+
if (InitKernelConfig.Verbose >= 0)
823+
{
824+
printf("WARNING: using suspect partition %s FS %02x:", partitionName, fs);
825+
printCHS(" with calculated values ", chs);
826+
printCHS(" instead of ", pEntry_chs);
827+
printf("\n");
828+
}
826829
}
827830
memcpy(pEntry_chs, chs, sizeof(struct CHS));
828831
}
@@ -1386,7 +1389,7 @@ void ReadAllPartitionTables(void)
13861389
/* disk initialization: returns number of units */
13871390
COUNT dsk_init()
13881391
{
1389-
printf(" - InitDisk");
1392+
if (InitKernelConfig.Verbose >= 0) printf(" - InitDisk");
13901393

13911394
#if defined(DEBUG) && !defined(DOSEMU)
13921395
{

‎kernel/kernel.asm‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ Version_Major db 2
7777
Version_Revision dw 43 ; REVISION_SEQ
7878
Version_Release dw 1 ; 0=release build, >0=svn#
7979

80-
CheckDebugger: db 0 ; 0 = no check, 1 = check, 2 = assume present
80+
CheckDebugger: db 0 ; 0 = no check, 1 = check, 2 = assume present
81+
Verbose db -1 ; -1 = quiet, 0 = normal, 1 = verbose
8182
configend:
8283
kernel_config_size: equ configend - config_signature
8384
; must be below-or-equal the size of struct _KernelConfig
@@ -118,6 +119,7 @@ realentry: ; execution continues here
118119

119120
times 0C0h - ($ - $$) nop ; magic offset (used by exeflat)
120121
entry_common:
122+
%ifndef QUIET
121123
push ax
122124
push bx
123125
pushf
@@ -127,6 +129,7 @@ entry_common:
127129
popf
128130
pop bx
129131
pop ax
132+
%endif
130133

131134
push cs
132135
pop ds
@@ -165,13 +168,15 @@ segment INIT_TEXT
165168
kernel_start:
166169
cld
167170

171+
%ifndef QUIET
168172
push bx
169173
pushf
170174
mov ax, 0e32h ; '2' Tracecode - kernel entered
171175
mov bx, 00f0h
172176
int 010h
173177
popf
174178
pop bx
179+
%endif
175180

176181

177182
extern _kernel_command_line
@@ -275,13 +280,15 @@ cont: ; Now set up call frame
275280
mov ds,[cs:_INIT_DGROUP]
276281
mov bp,sp ; and set up stack frame for c
277282

283+
%ifndef QUIET
278284
push bx
279285
pushf
280286
mov ax, 0e33h ; '3' Tracecode - kernel entered
281287
mov bx, 00f0h
282288
int 010h
283289
popf
284290
pop bx
291+
%endif
285292

286293
mov byte [_BootDrive],bl ; tell where we came from
287294

‎kernel/main.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,17 @@ STATIC VOID FsConfig(VOID)
437437

438438
STATIC VOID signon()
439439
{
440+
if (InitKernelConfig.Verbose < 0)
441+
{
442+
#ifdef CUSTOM_BRANDING
443+
printf("\n\r" CUSTOM_BRANDING "\n\n");
444+
#else
445+
printf("\n\r%S\n\n", MK_FP(FP_SEG(LoL), FP_OFF(LoL->os_release)));
446+
#endif
447+
} else {
448+
#ifdef CUSTOM_BRANDING
449+
printf("\n\r" CUSTOM_BRANDING "\n\n%s", copyright);
450+
#else
440451
printf("\r%S"
441452
"Kernel compatibility %d.%d - "
442453
#if defined(__BORLANDC__)
@@ -465,6 +476,8 @@ STATIC VOID signon()
465476
"\n\n%s",
466477
MK_FP(FP_SEG(LoL), FP_OFF(LoL->os_release)),
467478
MAJOR_RELEASE, MINOR_RELEASE, copyright);
479+
#endif
480+
}
468481
}
469482

470483
STATIC void kernel()

‎sys/fdkrncfg.c‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* merged into SYS by tom ehlert *
1414
***************************************************************************/
1515

16-
char VERSION[] = "v1.03";
16+
char VERSION[] = "v1.04";
1717
char PROGRAM[] = "SYS CONFIG";
1818
char KERNEL[] = "KERNEL.SYS";
1919

@@ -94,7 +94,9 @@ void showUsage(void)
9494
" SKIPCONFIGSECONDS=#, FORCELBA=0|1\n"
9595
" GLOBALENABLELBASUPPORT=0|1\n"
9696
" BootHarddiskSeconds=0|seconds to wait\n"
97-
" CheckDebugger=0|1|2\n");
97+
" CheckDebugger=0|1|2\n"
98+
" Verbose=0|1\n"
99+
);
98100
}
99101

100102
/* simply reads in current configuration values, exiting program
@@ -223,6 +225,13 @@ void displayConfigSettings(KernelConfig * cfg)
223225
cfg->CheckDebugger);
224226
}
225227

228+
if (cfg->ConfigSize >= 14)
229+
{
230+
printf
231+
("Verbose=%d : -1=quiet, *0=normal, 1=verbose\n",
232+
cfg->Verbose);
233+
}
234+
226235
#if 0 /* we assume that SYS is as current as the kernel */
227236

228237
/* Print value any options added that are unknown as hex dump */
@@ -495,6 +504,11 @@ int FDKrnConfigMain(int argc, char **argv)
495504
setByteOption(&(cfg.CheckDebugger),
496505
cptr, 2, &updates, "CheckDebugger");
497506
}
507+
else if (memicmp(argptr, "VERBOSE", 3) == 0)
508+
{
509+
setSByteOption(&(cfg.Verbose),
510+
cptr, -1, 1, &updates, "VERBOSE");
511+
}
498512
else
499513
{
500514
illegal_arg:

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL