mirror of
https://github.com/gbowne1/ClassicOS.git
synced 2025-10-14 05:35:06 -07:00
Initial Commit of files
This commit is contained in:
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
|
Reference in New Issue
Block a user