Skip to content

Commit

Permalink
formatting... trim trailing whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Voirin committed Aug 23, 2021
1 parent f2fa37a commit ad9ca0a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion K6.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extern cpuidProcessorType k6_getCPUProcessorType(void);
extern void k6_setMTRR(unsigned short index, unsigned long value);

extern unsigned short k6_getVBEInfoBlock(vbeInfo _far *vbeInfoBlockPtr);
extern unsigned short k6_getVBEModeInfo(unsigned short videoMode,
extern unsigned short k6_getVBEModeInfo(unsigned short videoMode,
vbeModeInfo _far *vbeModeInfoPtr);

// k6init functionality
Expand Down
8 changes: 4 additions & 4 deletions K6CPU.ASM
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ k6_getCPUIdentifier PROC C USES eax ebx ecx edx esi,cpuidString:FAR PTR CHAR
mov [si+04h], edx
mov [si+08h], ecx

ret
ret

k6_getCPUIdentifier ENDP

Expand Down Expand Up @@ -69,7 +69,7 @@ k6_getCPUProcessorType ENDP
; its bitfields must be calculated properly by the caller.
;
; Parameters: MTRR index (0 or 1)
; MTRR value
; MTRR value

k6_setMTRR PROC C USES eax ebx ecx edx, mtrrIndex:WORD, mtrrValue:DWORD

Expand Down Expand Up @@ -122,7 +122,7 @@ k6_getVBEInfoBlock PROC C USES bx cx dx es di,vbeInfoBlockPtr:FAR PTR BYTE
int 10h

; AX = Return value of the call
ret
ret

k6_getVBEInfoBlock ENDP

Expand All @@ -131,7 +131,7 @@ k6_getVBEInfoBlock ENDP
;
; reads the mode info for a given VESA mode from the VESA BIOS.
;
; Parameters: mode index
; Parameters: mode index
; pointer to a memory location to copy the VBE Mode Info to.
; Returns: Return value of the call

Expand Down
27 changes: 14 additions & 13 deletions K6INIT.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

int checkAuthenticAMD(void)
{
char cpuidString[12+1]; // 3 DWORDs + 1 null term byte
char cpuidString[12+1]; // 3 DWORDs + 1 null term byte

cpuidString[12] = 0x00; // null terminator

Expand All @@ -23,9 +23,9 @@ int checkSupportedCPU(void)

cpu = k6_getCPUProcessorType();

printf("CPU Family %02lx model %02lx stepping %02lx\n",
cpu.family,
cpu.model,
printf("CPU Family %02lx model %02lx stepping %02lx\n",
cpu.family,
cpu.model,
cpu.stepping);

// Supported CPUs
Expand Down Expand Up @@ -84,7 +84,7 @@ static int findLFBs(mtrrConfigInfo* mtrrConfig) {
}

printf("Attempting to find Linear Frame Buffer (LFB) region(s)...\n");
printf("Probing VGA BIOS for VBEs...\n");
printf("Probing VGA BIOS for VBE support...\n\n");

// Allocate memory for VBE (Mode) Info structures

Expand All @@ -103,7 +103,7 @@ static int findLFBs(mtrrConfigInfo* mtrrConfig) {
memset(oemVersionString, 0, sizeof(oemVersionString));
memset(mtrrConfig, 0, sizeof(mtrrConfigInfo));

// A VBE Info Block request must happen with the target block's
// A VBE Info Block request must happen with the target block's
// Signature field set to "VBE2"

memcpy(vbeInfoPtr->vbeSignature, "VBE2", 4);
Expand Down Expand Up @@ -134,25 +134,25 @@ static int findLFBs(mtrrConfigInfo* mtrrConfig) {
printf("VESA BIOS OEM Version String: %s\n", oemVersionString);

// If we have VESA version before 2.xx, we have to stop because
// VESA only introduced LFBs starting at 2.xx.
// VESA only introduced LFBs starting at 2.xx.

if (vbeVersionMajor < 2) {
printf("VBE Version before 2.00. No LFB detection possible.\n");
goto error;
}

// Query all video modes to find those with LFBs.
// Query all video modes to find those with LFBs.

printf("Querying VESA modes to find LFB address...\n");
printf("Querying VESA modes to find LFB address...\n\n");

for (i = 0; vbeInfoPtr->videoModeListPtr[i] != 0xFFFF; i++) {
if (i > vbeMaximumModeEntries) {
break;
}

currentMode = vbeInfoPtr->videoModeListPtr[i];
currentMode = vbeInfoPtr->videoModeListPtr[i];

ret = k6_getVBEModeInfo(currentMode,
ret = k6_getVBEModeInfo(currentMode,
(vbeModeInfo _far*) vbeModeInfoPtr);

// ret = return code from query call
Expand Down Expand Up @@ -207,8 +207,8 @@ static int findLFBs(mtrrConfigInfo* mtrrConfig) {

// TODO: Make this more elegant :/
error:
free(vbeModeInfoPtr);
free(vbeInfoPtr);
free(vbeModeInfoPtr);
free(vbeInfoPtr);
return -1;
}

Expand Down Expand Up @@ -301,5 +301,6 @@ int enableWriteCombiningForLFBs(void) {
result = setupMTRRs(&mtrrConfig);

return result;

}

6 changes: 3 additions & 3 deletions MAIN.C
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ int main (int argc, char **argv)
{
printf("%s Version %d.%02d\n", k_program_name, k_version_major, k_version_minor);
printf("%s\n", k_copyright_text);
printf("%s\n", k_contact_info);
printf("%s\n", k_contact_info);
printf("===============================================================================\n");

if (!checkAuthenticAMD()) {
printf("You don't have an AMD CPU. Aborting.\n");
printf("You don't have an AMD CPU. Aborting.\n");
goto cleanup;
}

if (!checkSupportedCPU()) {
printf("Aborting\n");
goto cleanup;
goto cleanup;
}

if (!enableWriteCombiningForLFBs()) {
Expand Down
20 changes: 10 additions & 10 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ This is a driver for MS-DOS to replace `k6dos.sys` which is a bit useless and un

On the newer K6-2/2+/3+ models there are features that benefit system performance in select applications greatly, such as games.

This driver sets Write allocation and Write Combining for the LFB memory on these models.
This driver sets Write allocation and Write Combining for the LFB memory on these models.

In the future it will also let you set the multiplier on K6-3 models.
In the future it will also let you set the multiplier on K6-3 models.

I'm doing this because I want my K6 machine to be fast.
I'm doing this because I want my K6 machine to be fast.

## Why in C?

Because I hate / suck at x86 assembly and I want flexibility, such as more complex(ish) command line parsing which is hard to do in ASM...

Normally you should really do this in assembly. But YOLO.
Normally you should really do this in assembly. But YOLO.

# Project Status

## Does this work yet?

NO! I'm still learning.
NO! I'm still learning.

## What does it (not) do so-far?

Expand Down Expand Up @@ -50,8 +50,8 @@ NO! I'm still learning.

* MS-DOS 6.xx or 7.xx or Windows 9x
* Microsoft C / C++ Compiler Version 7.00
* Also works with Microsoft Visual C++ 1.52, but not recommended because that's not really meant for development under pure DOS.
* In this case you need a 32-Bit DOS Extender such as HX-DOS. The DOSXNT that is included doesn't play nice with my machine sadly.
* Also works with Microsoft Visual C++ 1.52, but not recommended because that's not really meant for development under pure DOS.
* In this case you need a 32-Bit DOS Extender such as HX-DOS. The DOSXNT that is included doesn't play nice with my machine sadly.
* Microsoft Macro Assembler Version 6.11
* DPMI host (not necessary on Windows)
* I use HXDPMI32 ([part of HXDOS by Japheth](https://www.japheth.de/HX.html)).
Expand All @@ -73,7 +73,7 @@ cd <somewhere>\k6init
nmake
```

That's all.
That's all.

## Build environment issues

Expand All @@ -83,7 +83,7 @@ I developed this on an AMD K6-II CXT 500MHz. DOS is not the most stable and easy

**USE HIMEM.SYS THAT COMES WITH MICROSOFT C/C++ 7.00!**

You'll get weird errors otherwise. It's something to do with XMS size. I can get this to compile with JemmEx when limiting its reported size to 32MiB.
You'll get weird errors otherwise. It's something to do with XMS size. I can get this to compile with JemmEx when limiting its reported size to 32MiB.

### Linker doesn't run when DPMI host is running

Expand All @@ -105,4 +105,4 @@ Because when I load it, it reboots my computer. %-)

# License

[CC-BY-NC 3.0, click here for info](https://creativecommons.org/licenses/by-nc/3.0)
[CC-BY-NC 3.0, click here for info](https://creativecommons.org/licenses/by-nc/3.0)
2 changes: 1 addition & 1 deletion VESA_VBE.H
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ typedef struct
typedef struct
{
unsigned short supportedInHardware : 1;
unsigned short reserved : 1;
unsigned short reserved : 1;
unsigned short ttyBIOSSupport : 1;
unsigned short isColorMode : 1;
unsigned short isGraphicsMode : 1;
Expand Down

0 comments on commit ad9ca0a

Please sign in to comment.