mirror of
https://github.com/gbowne1/ClassicOS.git
synced 2024-11-22 06:06:52 -08:00
Initial Commit of files
This commit is contained in:
parent
c726a44299
commit
0821823a68
11
,vscode/ClassicOS.code-workspace
Normal file
11
,vscode/ClassicOS.code-workspace
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {},
|
||||||
|
"extensions": {
|
||||||
|
"recommendations": []
|
||||||
|
}
|
||||||
|
}
|
67
,vscode/c_cpp_properties.json
Normal file
67
,vscode/c_cpp_properties.json
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"myDefaultIncludePath": ["${workspaceFolder}", "${workspaceFolder}/include"],
|
||||||
|
"myCompilerPath": "/usr/local/bin/"
|
||||||
|
},
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Linux",
|
||||||
|
"intelliSenseMode": "clang-x64",
|
||||||
|
"includePath": ["${myDefaultIncludePath}", "/another/path"],
|
||||||
|
"macFrameworkPath": ["/System/Library/Frameworks"],
|
||||||
|
"defines": ["FOO", "BAR=100"],
|
||||||
|
"forcedInclude": ["${workspaceFolder}/include/config.h"],
|
||||||
|
"compilerPath": "/usr/bin/clang",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "c++20",
|
||||||
|
"compileCommands": "/path/to/compile_commands.json",
|
||||||
|
"browse": {
|
||||||
|
"path": ["${workspaceFolder}"],
|
||||||
|
"limitSymbolsToIncludedHeaders": true,
|
||||||
|
"databaseFilename": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "linux-gcc-x64",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**"
|
||||||
|
],
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"cStandard": "${default}",
|
||||||
|
"cppStandard": "${default}",
|
||||||
|
"intelliSenseMode": "linux-gcc-x64",
|
||||||
|
"compilerArgs": [
|
||||||
|
"-Wall",
|
||||||
|
"-Wextra",
|
||||||
|
"-Wpedantic"
|
||||||
|
],
|
||||||
|
"configurationProvider": "ms-vscode.makefile-tools"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Linux",
|
||||||
|
"includePath": [
|
||||||
|
"/usr/include/x86_64-linux-gnu/c++/5",
|
||||||
|
"/usr/include/c++/5",
|
||||||
|
"/usr/local/include",
|
||||||
|
"/usr/include/x86_64-linux-gnu",
|
||||||
|
"/usr/include",
|
||||||
|
"${workspaceRoot}"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"intelliSenseMode": "clang-x64",
|
||||||
|
"browse": {
|
||||||
|
"path": [
|
||||||
|
"/usr/include/x86_64-linux-gnu/c++/5",
|
||||||
|
"/usr/include/c++/5",
|
||||||
|
"/usr/local/include",
|
||||||
|
"/usr/include/x86_64-linux-gnu",
|
||||||
|
"/usr/include",
|
||||||
|
"${workspaceRoot}"
|
||||||
|
],
|
||||||
|
"limitSymbolsToIncludedHeaders": true,
|
||||||
|
"databaseFilename": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
12
,vscode/compile_commands.json
Normal file
12
,vscode/compile_commands.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"directory": "/path/to/project",
|
||||||
|
"command": "gcc -c -o file1.o file1.c",
|
||||||
|
"file": "/path/to/project/file1.c"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"directory": "/path/to/project",
|
||||||
|
"command": "g++ -c -o file2.o file2.cpp",
|
||||||
|
"file": "/path/to/project/file2.cpp"
|
||||||
|
}
|
||||||
|
]
|
11
,vscode/extensions.json
Normal file
11
,vscode/extensions.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=827846
|
||||||
|
// for the documentation about the extensions.json format
|
||||||
|
"recommendations": [
|
||||||
|
"13xforever.language-x86-64-assembly",
|
||||||
|
"franneck94.c-cpp-runne",
|
||||||
|
"formulahendry.code-runner",
|
||||||
|
"ms-vscode.cpptools",
|
||||||
|
"ms-vscode.cpptools-extension-pack"
|
||||||
|
]
|
||||||
|
}
|
32
,vscode/launch.json
Normal file
32
,vscode/launch.json
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "gcc-8 - Build and debug active file Level 1",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${fileDirname}/${fileBasenameNoExtension}",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": false,
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"preLaunchTask": "Debug Build Level 1",
|
||||||
|
"miDebuggerPath": "/usr/bin/gdb",
|
||||||
|
"logging": {
|
||||||
|
"engineLogging": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
107
,vscode/settings.json
Normal file
107
,vscode/settings.json
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"*.c": "c",
|
||||||
|
"*.h": "c",
|
||||||
|
"*.cpp": "cpp",
|
||||||
|
"*.hpp": "hpp",
|
||||||
|
"*.asm": "asm",
|
||||||
|
"*.bin": "bin"
|
||||||
|
},
|
||||||
|
"files.fileAssociations": {
|
||||||
|
".c": "c",
|
||||||
|
".h": "c",
|
||||||
|
".cpp": "cpp",
|
||||||
|
".hpp": "cpp",
|
||||||
|
".asm": "asm",
|
||||||
|
".bin": "bin"
|
||||||
|
},
|
||||||
|
"emmet.includeLanguages": {
|
||||||
|
"c": "c",
|
||||||
|
"cpp": "cpp",
|
||||||
|
"assembly": "asm"
|
||||||
|
},
|
||||||
|
"C_Cpp_Runner.cCompilerPath": "/usr/bin",
|
||||||
|
"C_Cpp_Runner.cppCompilerPath": "/usr/bin",
|
||||||
|
"C_Cpp_Runner.debuggerPath": "/usr/bin",
|
||||||
|
"C_Cpp_Runner.cStandard": "c17",
|
||||||
|
"C_Cpp_Runner.cppStandard": "c++20",
|
||||||
|
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat",
|
||||||
|
"C_Cpp_Runner.useMsvc": false,
|
||||||
|
"C_Cpp_Runner.warnings": [
|
||||||
|
"-Wall",
|
||||||
|
"-Wextra",
|
||||||
|
"-Wpedantic"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.enableWarnings": true,
|
||||||
|
"C_Cpp_Runner.warningsAsError": false,
|
||||||
|
"C_Cpp_Runner.compilerArgs": [],
|
||||||
|
"C_Cpp_Runner.linkerArgs": [
|
||||||
|
"-dynamic-linker {/lib64/ld-linux-x86-64.so.2}"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.includePaths": [],
|
||||||
|
"C_Cpp_Runner.includeSearch": [
|
||||||
|
"*",
|
||||||
|
"**/*"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.excludeSearch": [
|
||||||
|
"**/build",
|
||||||
|
"**/build/**",
|
||||||
|
"**/.*",
|
||||||
|
"**/.*/**",
|
||||||
|
"**/.vscode",
|
||||||
|
"**/.vscode/**"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.useAddressSanitizer": false,
|
||||||
|
"C_Cpp_Runner.showCompilationTime": false,
|
||||||
|
"c-cpp-flylint.enable": true,
|
||||||
|
"c-cpp-flylint.debug": true,
|
||||||
|
"c-cpp-flylint.flexelint.enable": false,
|
||||||
|
"c-cpp-flylint.cppcheck.enable": true,
|
||||||
|
"c-cpp-flylint.clang.enable": false,
|
||||||
|
"C_Cpp_Config.cCompilerPath": "gcc",
|
||||||
|
"C_Cpp_Config.cppCompilerPath": "g++",
|
||||||
|
"C_Cpp_Config.debuggerPath": "gdb",
|
||||||
|
"C_Cpp_Config.makePath": "make",
|
||||||
|
"C_Cpp.clang_format_sortIncludes": true,
|
||||||
|
"C_Cpp.vcFormat.indent.preserveComments": true,
|
||||||
|
"C_Cpp.vcFormat.indent.namespaceContents": false,
|
||||||
|
"C_Cpp.vcFormat.indent.caseContentsWhenBlock": true,
|
||||||
|
"C_Cpp.vcFormat.space.pointerReferenceAlignment": "right",
|
||||||
|
"C_Cpp.default.browse.limitSymbolsToIncludedHeaders": false,
|
||||||
|
"C_Cpp.default.cppStandard": "c++20",
|
||||||
|
"C_Cpp.default.cStandard": "c17",
|
||||||
|
"C_Cpp.formatting": "clangFormat",
|
||||||
|
"[c]": {
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.defaultFormatter": "ms-vscode.cpptools"
|
||||||
|
},
|
||||||
|
"[cpp]": {
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.defaultFormatter": "ms-vscode.cpptools"
|
||||||
|
},
|
||||||
|
"C_Cpp.codeAnalysis.clangTidy.enabled": true,
|
||||||
|
"C_Cpp.configurationWarnings": "disabled",
|
||||||
|
"cmake.configureOnOpen": false,
|
||||||
|
"cmake.autoSelectActiveFolder": false,
|
||||||
|
"cmake.configureOnEdit": false,
|
||||||
|
"c-cpp-flylint.flexelint.configFile": "",
|
||||||
|
"c-cpp-flylint.flexelint.executable": "",
|
||||||
|
"c-cpp-flylint.language": "c",
|
||||||
|
"C_Cpp.autocompleteAddParentheses": true,
|
||||||
|
"C_Cpp.errorSquiggles": "Enabled",
|
||||||
|
"C_Cpp_Runner.makePath": "",
|
||||||
|
"cmake.sourceDirectory": "${workspaceFolder}",
|
||||||
|
"C_Cpp.default.compilerPath": "/usr/bin",
|
||||||
|
"C_Cpp.loggingLevel": "",
|
||||||
|
"C_Cpp.default.enableConfigurationSquiggles": "",
|
||||||
|
"C_Cpp.default.includePath": "/usr/bin",
|
||||||
|
"workbench.editorAssociations": {
|
||||||
|
"*.bin": "bin",
|
||||||
|
"*.c": "c",
|
||||||
|
"*.h": "c",
|
||||||
|
"*.cpp": "cpp",
|
||||||
|
"*.hpp": "hpp",
|
||||||
|
"*.asm": "asm"
|
||||||
|
},
|
||||||
|
"C_Cpp.default.intelliSenseMode": "linux-clang-x86"
|
||||||
|
}
|
15
,vscode/tasks.json
Normal file
15
,vscode/tasks.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "",
|
||||||
|
"type": "cmake",
|
||||||
|
"command": "test",
|
||||||
|
"problemMatcher": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
13
.vs/appsettings.json
Normal file
13
.vs/appsettings.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Error",
|
||||||
|
"Microsoft": "Warning"
|
||||||
|
},
|
||||||
|
"Console": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Microsoft": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
CMakeLists.txt
Normal file
1
CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
cmake -DCMAKE_LINKER=/usr/bin/ld -DCMAKE_CXX_LINK_EXECUTABLE="<CMAKE_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
|
21
README.md
21
README.md
@ -1,2 +1,21 @@
|
|||||||
# ClassicOS
|
# ClassicOS
|
||||||
An x86 Operating System for 386, 486, Pentium class (P-75, 100, Pentium II, P3, P4, etc
|
|
||||||
|
An x86 Operating System for 386, 486, Pentium class (P-75, 100, Pentium II, P3, P4, etc) CPU's
|
||||||
|
|
||||||
|
## Tooling
|
||||||
|
|
||||||
|
These are the versions I use, but please use the latest possible versions.
|
||||||
|
|
||||||
|
NASM version 2.14
|
||||||
|
QEMU x86_64
|
||||||
|
GNU ld (GNU Binutils for Debian) 2.31.1 or newer
|
||||||
|
dd (coreutils) 8.30
|
||||||
|
|
||||||
|
The C and C++ standards we are using for this are C17 and C++20
|
||||||
|
|
||||||
|
For C/C++:
|
||||||
|
clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final)
|
||||||
|
gcc version 8.3.0 (Debian 8.3.0-6)
|
||||||
|
g++ version 8.3.0 (Debian 8.3.0-6)
|
||||||
|
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
|
||||||
|
lldb version 7.0.1
|
||||||
|
BIN
build/boot.bin
Executable file
BIN
build/boot.bin
Executable file
Binary file not shown.
61
src/boot/boot.asm
Normal file
61
src/boot/boot.asm
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
; Set up the segment registers
|
||||||
|
xor ax, ax
|
||||||
|
mov ds, ax
|
||||||
|
mov es, ax
|
||||||
|
|
||||||
|
; Set up stack and jump to main
|
||||||
|
mov ss, ax
|
||||||
|
mov sp, 0x7c00
|
||||||
|
jmp main
|
||||||
|
|
||||||
|
; Print 'Booting ClassicOS!' to the screen
|
||||||
|
print:
|
||||||
|
mov si, message
|
||||||
|
mov ah, 0x0e
|
||||||
|
.loop:
|
||||||
|
lodsb
|
||||||
|
test al, al
|
||||||
|
jz .done
|
||||||
|
int 0x10
|
||||||
|
jmp .loop
|
||||||
|
.done:
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Set the video mode to a 40 column text mode
|
||||||
|
set_video_mode:
|
||||||
|
mov ax, 0x0003 ; Set up a 80x25 text mode
|
||||||
|
int 0x10
|
||||||
|
|
||||||
|
; Set the number of columns to 40
|
||||||
|
mov ax, 0x1112
|
||||||
|
mov bx, 0x0007
|
||||||
|
int 0x10
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Bootloader entry point
|
||||||
|
main:
|
||||||
|
; Call the set_video_mode function
|
||||||
|
call set_video_mode
|
||||||
|
|
||||||
|
; Clear the screen
|
||||||
|
mov ah, 0x06
|
||||||
|
mov al, 0
|
||||||
|
xor bx, bx
|
||||||
|
xor cx, cx
|
||||||
|
mov dh, 24
|
||||||
|
mov dl, 39
|
||||||
|
int 0x10
|
||||||
|
|
||||||
|
; Call the print function
|
||||||
|
call print
|
||||||
|
|
||||||
|
; Infinite loop
|
||||||
|
.loop:
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
|
; Message to print
|
||||||
|
message db 'Booting ClassicOS!', 0
|
||||||
|
|
||||||
|
times 510-($-$$) db 0
|
||||||
|
dw 0xaa55
|
8
src/boot/linker.ld
Normal file
8
src/boot/linker.ld
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
ENTRY(boot)
|
||||||
|
SECTIONS {
|
||||||
|
. = 0x7c00;
|
||||||
|
.text : {
|
||||||
|
*(.text)
|
||||||
|
}
|
||||||
|
/* Add other sections as needed */
|
||||||
|
}
|
27
src/drivers/screen/screen.c
Normal file
27
src/drivers/screen/screen.c
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "screen.h"
|
||||||
|
#include <dos.h>
|
||||||
|
|
||||||
|
void screen_init() {
|
||||||
|
// Initialize the screen driver
|
||||||
|
// Add any necessary initialization code here
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_40_column_mode() {
|
||||||
|
// Set the screen mode to 40 columns
|
||||||
|
union REGS regs;
|
||||||
|
regs.h.ah = 0x00;
|
||||||
|
regs.h.al = 0x03;
|
||||||
|
int86(0x10, ®s, ®s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_80_column_mode() {
|
||||||
|
// Set the screen mode to 80 columns
|
||||||
|
union REGS regs;
|
||||||
|
regs.h.ah = 0x00;
|
||||||
|
regs.h.al = 0x03;
|
||||||
|
int86(0x10, ®s, ®s);
|
||||||
|
|
||||||
|
regs.h.ah = 0x00;
|
||||||
|
regs.h.al = 0x07;
|
||||||
|
int86(0x10, ®s, ®s);
|
||||||
|
}
|
13
src/drivers/screen/screen.h
Normal file
13
src/drivers/screen/screen.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef SCREEN_H
|
||||||
|
#define SCREEN_H
|
||||||
|
|
||||||
|
// Function to initialize the screen driver
|
||||||
|
void screen_init();
|
||||||
|
|
||||||
|
// Function to set the screen mode to 40 columns
|
||||||
|
void set_40_column_mode();
|
||||||
|
|
||||||
|
// Function to set the screen mode to 80 columns
|
||||||
|
void set_80_column_mode();
|
||||||
|
|
||||||
|
#endif
|
12
src/kernel/kernel.c
Normal file
12
src/kernel/kernel.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include "kernel.h"
|
||||||
|
|
||||||
|
void kernel_main() {
|
||||||
|
// Your kernel code here
|
||||||
|
// Example: Print a message to the screen
|
||||||
|
print_string("Welcome to ClassicOS!");
|
||||||
|
|
||||||
|
// Infinite loop to keep the kernel running
|
||||||
|
while (1) {
|
||||||
|
// Your kernel code here
|
||||||
|
}
|
||||||
|
}
|
7
src/kernel/kernel.h
Normal file
7
src/kernel/kernel.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#ifndef KERNEL_H
|
||||||
|
#define KERNEL_H
|
||||||
|
|
||||||
|
// Function to print a null-terminated string to the screen
|
||||||
|
void print_string(const char* str);
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user