Skip to content

Commit

Permalink
OS/1: 5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
StjepanBM1 committed Aug 27, 2023
1 parent e96e9c1 commit 509a599
Show file tree
Hide file tree
Showing 57 changed files with 4,843 additions and 377 deletions.
Empty file removed LICENSE.txt
Empty file.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ override ISO = os1.iso
override BINS := $(shell find ./ -type f -name '*.bin')

.PHONY:all
all: loader kern binary disk run
all: load kern binary disk run

#
# Builds the bootloader
loader:
# Builds the LOAD (bootloader)
load:
make -C boot

#
# Builds the main kernel
# Builds the main kernel (called Copland)
kern:
make -C kernel

#
# Create a system binary by combining boot.bin & kernel.bin
# Create a system binary by combining nload.bin & kernel.bin
binary:
cat bin/boot.bin bin/kernel.bin > bin/os1.bin
#
# Creates a low density 360 KiB
disk: loader kern binary
disk: load kernel binary
dd if=/dev/zero of=img/$(FLP) bs=512 count=720
dd if=bin/os1.bin of=img/$(FLP) conv=notrunc

Expand All @@ -35,8 +35,7 @@ disk: loader kern binary
#
# Creates an ISO image
cdiso: 144img
mkisofs -quiet -V 'os1-500' -input-charset iso8859-1 -o img/$(ISO) -b $(FLP) img/

mkisofs -quiet -V 'os1-ar-510' -input-charset iso8859-1 -o img/$(ISO) -b $(FLP) img/
#
# Runs the os1.img in QEMU
run: disk
Expand All @@ -51,4 +50,5 @@ runcd: cdiso
clean:
make -C boot clean
make -C kernel clean
make -C pinboard clean
rm $(BINS) img/$(FLP) img/$(ISO)
21 changes: 8 additions & 13 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
Operating System/1 5.0.0
================================
Operating System/1 Average Release 5.1.0
================================================

Operating System/1 or OS/1 for short is a simple
16-bit operating system, based on a megalithic kernel
called DUNE. OS/1 5.0.0 runs in real mode and is written
entirely in x86 assembly.

* Changes:
============
- improved Paint
- 3.x UI style
- Disk status program
- and others
Changes:
- usage of Unreal / Big Real / Voodoo mode
- multiple disk drive support (drives A & B)
- switch to a more stable kernel
- switch to a Monitor Program as the default shell
- minor changes to Pinboard
Binary file modified bin/kernel.bin
Binary file not shown.
Binary file modified bin/os1.bin
Binary file not shown.
6 changes: 4 additions & 2 deletions boot/libx86.S
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
mov $0x00, %ch # Track / Cylinder number
mov $0x02, %cl # Sector number
mov $0x00, %dh # Head number
movb (_dev), %dl # Disk drive (0 - drive A; 1 - drive B)
movb (_dev), %dl # Disk drive (0 - drive A; 1 - drive B)

int $0x13 # Disk interrupt (0x13)

jc disk_error # If clear flag is set jump to disk_error

ret # Return

disk_info:

disk_error:
clc
cmpb $3, (trys) # If num of tries is less than 3
cmpb $3, (trys) # If num of tries is less than 3
jl read_disk # jump to read_disk

mov $0x03, %ax # Clear the screen
Expand Down
Binary file modified img/os1.img
Binary file not shown.
7 changes: 7 additions & 0 deletions kernel/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OS/1 AR 5.1.0 Kernel "Copland"
======================================

Simple Unreal mode operating system kernel written
in assembly for GNU GAS. Copland offers support for
multiple disk drives. To compile Copland you need a
i386-elf specific GAS (as) and GNU Linker (ld).
22 changes: 22 additions & 0 deletions kernel/cpu/gdt.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

/*
GDT by OS-Dev wiki :
www.osdev.org
*/

.code16
.global _gdt_inf
.section .text

_gdt_inf:
.word gdt_end - gdt - 1
.long gdt

gdt:
.long 0
.long 0

flatd:
.byte 0xFF, 0xFF, 0, 0, 0, 0b10010010, 0b11001111, 0

gdt_end:
137 changes: 137 additions & 0 deletions kernel/fs/load.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@

.code16
.global _load_A
.global _load_B
.section .text.filesys

#
# _load_B: Load the data from the disk drive A.
# And jump to the 0x7e00 address of the disk.
_load_A:
clc
incb (tries)

mov $0x02, %ah
mov $0x40, %al
mov $0x7e00,%bx
mov $0x00, %ch
mov $0x02, %cl
mov $0x00, %dh
mov $0x00, %dl
int $0x13

jc _err_A

ljmp $0x0000,$0x7e00

#
# _load_B: Load the data from the disk drive B.
# And jump to the 0x7e00 address of the disk.
_load_B:
clc
incb (tries)

mov $0x02, %ah
mov $0x40, %al
mov $0x7e00,%bx
mov $0x00, %ch
mov $0x02, %cl
mov $0x00, %dh
mov $0x01, %dl
int $0x13

jc _err_B

ljmp $0x0000,$0x7e00

#
# _err_A: Disk load error for _load_A function
_err_A:
clc
cmpb $3, (tries)
jl _load_A

mov $0x03, %ax
int $0x10

xor %ax, %ax
int $0x13

mov $0x13, %ah
mov $0x01, %al
mov $0x00, %bh
mov $0x0c, %bl
mov $0x2e, %cx
mov $0x00, %dh
mov $0x00, %dl
mov $_ler_A,%bp
int $0x10

call _disk_status

mov $0x13, %ah
mov $0x01, %al
mov $0x00, %bh
mov $0x0f, %bl
mov $0x24, %cx
mov $0x01, %dh
mov $0x00, %dl
mov $_retmg,%bp
int $0x10

mov $0x00, %ax
int $0x16

call _clear

ret

#
# _err_B: Disk load error for _load_B function
_err_B:
clc
cmpb $3, (tries)
jl _load_B

mov $0x03, %ax
int $0x10

xor %ax, %ax
int $0x13

mov $0x13, %ah
mov $0x01, %al
mov $0x00, %bh
mov $0x0c, %bl
mov $0x2e, %cx
mov $0x00, %dh
mov $0x00, %dl
mov $_ler_B,%bp
int $0x10

call _disk_status

mov $0x13, %ah
mov $0x01, %al
mov $0x00, %bh
mov $0x0f, %bl
mov $0x24, %cx
mov $0x01, %dh
mov $0x00, %dl
mov $_retmg,%bp
int $0x10

mov $0x00, %ax
int $0x16

call _clear

ret

.section .rodata
_ler_A: .asciz "/!\\ Failed to load the data from drive A /!\\\r\n"
_ler_B: .asciz "/!\\ Failed to load the data from drive B /!\\\r\n"
_retmg: .asciz "\r\nPress any key to return to MP-OS/1"

.section .data
tries: .byte 0
4 changes: 2 additions & 2 deletions kernel/libk/disk.S → kernel/fs/status.S
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

.code16
.section .text.libk
.section .text.filesys
.global _disk_status

#
Expand Down Expand Up @@ -276,4 +276,4 @@
_s_BB: .asciz " Fixed disk undefined error\r\n"
_s_CC: .asciz " Fixed disk write fault on selected drive\r\n"
_s_E0: .asciz " Fixed disk status error / Error reg = 0\r\n"
_s_FF: .asciz " Sense operation failed\r\n"
_s_FF: .asciz " Sense operation failed\r\n"
75 changes: 64 additions & 11 deletions kernel/kernel.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,79 @@
.global _kernel

.extern _printk
.extern _panic

.fill 218, 1, 0
jmp _kernel
.extern _load_A
.extern _load_B

_kernel:
.extern _format_A
.extern _format_B

.extern _input

.extern _pinb

_kernel: # Kernel entry point
xor %ax, %ax # Reset the disk system
int $0x13

call _clear

# Stack Setup
xor %ax, %ax
xor %dx, %dx
mov %ax, %es
mov %ss, %ax
mov %ax, %ds
mov %ax, %ss
mov $_kernel,%sp
cld

# Print boot msg. #2
mov $0x13, %ah # Value 0x13 (print str.)
mov $0x01, %al # String type
mov $0x00, %bh # Video page num.
mov $0x0f, %bl # Attribute (White on Black)
mov $0x0B, %cx # String len. = 13 chars.
mov $0x00, %dh # Row 2
mov $0x00, %dl # Column 0
mov $_msg1, %bp # String to print
int $0x10 # Call interrupt

# Setup Stack
xor %ax, %ax
mov %ax, %ds
mov %ax, %ss # Stack start = 0
mov $0x7e00,%sp # Stack pointer = 0x7e00

cli # Clear ints.
push %ds # Save %ds

lgdt _gdt_inf # Load the GDT

mov %cr0, %eax # Switch to Prot. Mode
or $1, %al # By setting the
mov %eax, %cr0 # Prot. Mode bit

mov $0x08, %bx # Select desc. 1
mov %bx, %ds # 0x08 = 1000b

and $0xFE, %al # Back to real mode
mov %eax, %cr0 # by toggling the bit agian

pop %ds # Return the %ds
sti # Store ints.

# Load MP-OS/1
#call _monitor_program

call _clear
call _clear

mov $_msg2, %si
mov $_mp_str_title, %si
call _printk

jmp _pinb
jmp _input

cli
hlt

.section .rodata
_msg2: .asciz "\xDB\xDB\xDB OS/1 5.0.0\r\n"
.section .rodata # Read-only data
_msg1: .asciz "\xDB\xDB\xDB OS/1 WE" # Boot message (2/2).
_mp_str_title: .asciz "\xDB Monitor Program for OS/1 (MP-OS/1) Version 1.0.0\r\n To start the GUI type pinb\r\n"
6 changes: 2 additions & 4 deletions kernel/kernel.ld
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ SECTIONS
.text : SUBALIGN(0)
{
*(.text.kern);
*(.text.filesys);
*(.text.libk);
*(.text.pinb);
*(.text.pinb.app);
*(.text)
}

.rodata : SUBALIGN(0)
{
*(.rodata.pinb);
*(.rodata.pinb.app);
*(.rodata.mp);
*(.rodata);
}

Expand Down
Loading

0 comments on commit 509a599

Please sign in to comment.