78 lines
2.0 KiB
NASM
Executable File
78 lines
2.0 KiB
NASM
Executable File
BITS 16
|
|
CPU 386 ; pusha offsets depends on a 386 or better
|
|
; FS and GS require a 386 or better
|
|
|
|
%DEFINE CRAWOS_VER '0.0.2' ; OS version number
|
|
%DEFINE CRAWOS_API_VER 1 ; API version for programs to check
|
|
|
|
|
|
; This is the location in RAM for kernel disk operations, 24K
|
|
; after the point where the kernel has loaded; it's 8K in size,
|
|
; because external programs load after it at the 32K point:
|
|
|
|
disk_buffer equ 24576
|
|
|
|
|
|
|
|
; ------------------------------------------------------------------
|
|
; START OF MAIN KERNEL CODE
|
|
|
|
os_main:
|
|
cli ; Clear interrupts
|
|
mov ax, 0
|
|
mov ss, ax ; Set stack segment and pointer
|
|
mov sp, 0FFFFh
|
|
sti ; Restore interrupts
|
|
|
|
cld ; The default direction for string operations
|
|
; will be 'up' - incrementing address in RAM
|
|
|
|
mov ax, 2000h ; Set all segments to match where kernel is loaded
|
|
mov ds, ax ; After this, we don't need to bother with
|
|
mov es, ax ; segments ever again, as MikeOS and its programs
|
|
mov fs, ax ; live entirely in 64K
|
|
mov gs, ax
|
|
|
|
cmp dl, 0
|
|
je no_change
|
|
|
|
no_change:
|
|
mov si, help_text
|
|
call os_print_string_nl
|
|
call os_start_cli
|
|
|
|
bootdev db 0
|
|
SecsPerTrack dw 18
|
|
Sides dw 2
|
|
|
|
; ------------------------------------------------------------------
|
|
; SYSTEM VARIABLES -- Settings for programs and system calls
|
|
|
|
|
|
; Time and date formatting
|
|
|
|
fmt_12_24 db 0 ; Non-zero = 24-hr format
|
|
|
|
fmt_date db 0, '/' ; 0, 1, 2 = M/D/Y, D/M/Y or Y/M/D
|
|
; Bit 7 = use name for months
|
|
; If bit 7 = 0, second byte = separator character
|
|
|
|
|
|
; ------------------------------------------------------------------
|
|
; FEATURES -- Code to pull into the kernel
|
|
|
|
%INCLUDE "features/screen.asm"
|
|
%INCLUDE "features/cli.asm"
|
|
%INCLUDE "features/power.asm"
|
|
%INCLUDE "features/strings.asm"
|
|
%INCLUDE "features/graphics.asm"
|
|
%INCLUDE "features/sound.asm"
|
|
|
|
; GAMES
|
|
%INCLUDE "games/pong.asm"
|
|
|
|
; ==================================================================
|
|
; END OF KERNEL
|
|
; ==================================================================
|
|
|