Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Did some code cleaning

Packed video and floppy mem against top-end
Started on floppy filesystem code and floppy drivers
  • Loading branch information...
commit 1d21e6ed762bb866fbbe53f90ef9d025553f81d4 1 parent 5e2776b
@chessmaster42 chessmaster42 authored
View
61 API.txt
@@ -714,6 +714,67 @@ Return:
Side effects:
none
+virtual_filesystem_getfile [0x1029]
+-------------
+
+Description:
+ Returns the start of the matched filesystem entry
+
+Parameters:
+
+
+Return:
+ C - Pointer to start of FAT entry if found, 0 otherwise
+
+Side effects:
+ none
+
+virtual_filesystem_getfile_table [0x102A]
+-------------
+
+Description:
+ Returns the start of the filesystem file table. May be deprecated later
+
+Parameters:
+
+
+Return:
+
+
+Side effects:
+ none
+
+virtual_filesystem_getfile_bystart [0x102B]
+-------------
+
+Description:
+ Returns the start of the matched filesystem entry
+
+Parameters:
+
+
+Return:
+ C - Pointer to start of FAT entry if found, 0 otherwise
+
+Side effects:
+ none
+
+char_get [0x102C]
+-------------
+
+Description:
+ Returns the value at the A, B location on the screen
+
+Parameters:
+ A - This is the X coordinate
+ B - This is the Y coordinate
+
+Return:
+ A - Value of the screen character
+
+Side effects:
+ none
+
// Ignore me!
[0x10]
-------------
View
28 include/kernel.inc
@@ -1,6 +1,17 @@
:data
SET PC, data_end
+; RAM Page Allocation
+; 4 - Kernel (0x0000 - 0x1000) (we have about 750 words left)
+; 1 - API (0x1000 - 0x1400)
+; 3 - OS content (0x1400 - 0x2000)
+;
+; 50 - Applications and other drivers (0x2000 - 0xEB00)
+;
+; 4 - Disk paging space (0xEB00 - 0xF800)
+; 1 - Video memory (0xF800 - 0xFB00)
+; 1 - OS stack space (0xFB00 - 0xFFFF)
+
; OS Variables
:os_version_main dat 0x0000
:os_version_sub dat 0x0006
@@ -8,15 +19,6 @@ SET PC, data_end
:preemptive_enabled dat 0x0000
-:video_mem dat 0x8000
-:video_font dat 0x8180
-:video_palette dat 0x8280
-:video_col dat 0x7000
-:video_cur dat 0x8000
-:video_clear dat 0x7020
-:video_width dat 0x0020
-:video_height dat 0x000C
-
:text_start dat "AtlasOS v0.6.2 starting... ", 0x00
:text_start_ok dat "OK", 0xA0, 0x00
:text_logo
@@ -214,9 +216,11 @@ dat 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
dat keyboard_unregister ; 0x1027 Unregisters a specific memory location
dat keyboard_is_exclusive_active ; 0x1028 Unregisters a specific memory location
- dat filesystem_getfile ; 0x1029 Returns the start of the matched filesystem entry in C, 0 otherwise
- dat filesystem_getfile_table ; 0x102A Returns the start of the filesystem file table. May be deprecated later
- dat filesystem_getfile_bystart ; 0x102B Returns the start of the matched filesystem entry in C, 0 otherwise
+ dat virtual_filesystem_getfile ; 0x1029 Returns the start of the matched filesystem entry in C, 0 otherwise
+ dat virtual_filesystem_getfile_table ; 0x102A Returns the start of the filesystem file table. May be deprecated later
+ dat virtual_filesystem_getfile_bystart ; 0x102B Returns the start of the matched filesystem entry in C, 0 otherwise
+
+ dat char_get ; 0x102C Returns the value at the A, B location on the screen
:api_end
View
12 kernel/core.dasm16
@@ -53,10 +53,6 @@ ADD X, 1024
SET PC, os_content_mem
:os_content_mem_end
-; Reserve video-memory
-SET A, [video_mem]
-JSR page_reserve
-
; Reserve stack-memory
SET A, 0xFFFF
JSR page_reserve
@@ -65,14 +61,6 @@ JSR page_reserve
SET A, 0x1000
JSR page_reserve
-; Reserve disk paging space 8 sectors at 512 words
-SET X, 0x7000
-:disk_page_reserve
-JSR page_reserve
-ADD X, 512
-IFN X, 0x8000
- SET PC, disk_page_reserve
-
SET X, 0
; Copy the API.
View
60 kernel/drivers.dasm16
@@ -33,6 +33,11 @@
:bios_display_init
SET [display_address], Z
+
+ SET [video_font], [video_mem]
+ ADD [video_font], 0x0180
+ SET [video_palette], [video_font]
+ ADD [video_palette], 0x0100
; map screen
SET A, 0
@@ -58,6 +63,13 @@
SET A, 5
SET B, [video_palette]
HWI Z
+
+ ; Reserve video-memory
+ SET A, [video_mem]
+ JSR page_reserve
+
+ ; Init the video cursor
+ SET [video_cur], [video_mem]
SET PC, POP
@@ -111,15 +123,44 @@
SET A, 0xFFFF
HWI [floppy_address]
SET [floppy_quality], B
+
+ ; Reserve disk paging space
+ SET X, [floppy_paging_address]
+ SET Y, X
+ ADD Y, [floppy_paging_size]
+:bios_floppy_page_reserve
+ JSR page_reserve
+ ADD X, 512
+ IFN X, Y
+ SET PC, bios_floppy_page_reserve
:bios_floppy_end
SET PC, POP
:display_address
dat 0x0000
+:video_mem
+dat 0xF800
+:video_font
+dat 0x0000
+:video_palette
+dat 0x0000
+:video_col
+dat 0x7000
+:video_cur
+dat 0x0000
+:video_clear
+dat 0x7020
+:video_width
+dat 0x0020
+:video_height
+dat 0x000C
+
:keyboard_address
dat 0x0000
+
:clock_address
dat 0x0000
+
:floppy_address
dat 0x0000
:floppy_words_per_sector
@@ -130,6 +171,13 @@ dat 0x0000
dat 0x0000
:floppy_quality
dat 0x0000
+:floppy_paging_address
+dat 0xEB00
+:floppy_paging_size
+dat 0x1000 ; 8 sectors @ 512 words/sector
+:floppy_page_inuseflags
+dat 0x0000 ; Bit map of RAM pages in use along with flags (4 flag bits per sector)
+dat 0x0000 ; Bit 1 - Is active, Bit 2 - ??, Bit 3 - ??, Bit 4 - ??
; ################END BIOS#################
@@ -182,6 +230,16 @@ dat 0x0000
; END OF THE KEYBOARD DRIVER
+; START OF THE FLOPPY DRIVER
+
+:driver_floppy
+ SET PC, POP
+
+:driver_floppy_handle_interrupt
+ SET PC, POP
+
+; END OF THE FLOPPY DRIVER
+
; Registers a new keyboard buffer
; Takes:
; A: Address of the buffer
@@ -247,8 +305,6 @@ dat 0x0000
SET [keyboard_buffers_exclusive], 0
SET PC, POP
-
-
; Returns whether there is an exclusive keyboard buffer active
:keyboard_is_exclusive_active
SET A, 0
View
60 kernel/filesystem.dasm16
@@ -1,40 +1,40 @@
-; FILESYSTEM FUNCTIONS
+; ########VIRTUAL FILESYSTEM FUNCTIONS########
; Return start of the filesystem
-:filesystem_getfile_table
+:virtual_filesystem_getfile_table
SET A, files_table
SET PC, POP
; Returns pointer to start of file entry in file table in C, returns 0 if file not found
; A: buffer containing file name
-:filesystem_getfile
+:virtual_filesystem_getfile
SET PUSH, X
SET PUSH, B
SET PUSH, A
SET B, A
- JSR filesystem_getfile_table
+ JSR virtual_filesystem_getfile_table
SET X, [A] ; Get the number of files in the table
ADD A, 1 ; Jump down to the start of the table
-:filesystem_getfile_loop
+:virtual_filesystem_getfile_loop
SET C, 0 ; Reset our return
IFE X, 0 ; Check if we've gone through all of the files
- SET PC, filesystem_getfile_end
+ SET PC, virtual_filesystem_getfile_end
SUB X, 1
ADD A, 2 ; Skip over the directory ID and flags
JSR strcmp ; Check if the current filename (A) matches the original filename (B)
IFE C, 0
- SET PC, filesystem_getfile_found
+ SET PC, virtual_filesystem_getfile_found
ADD A, 18 ; Skip over the filename, start, and end
- SET PC, filesystem_getfile_loop
-:filesystem_getfile_found
+ SET PC, virtual_filesystem_getfile_loop
+:virtual_filesystem_getfile_found
SUB A, 2 ; Backs up the pointer to the start of the file entry
SET C, A ; Sets C to the start of the entry
-:filesystem_getfile_end
+:virtual_filesystem_getfile_end
SET A, POP
SET B, POP
SET X, POP
@@ -42,36 +42,58 @@
; Returns pointer to start of file entry in file table in C, returns 0 if file not found
; A: Program start or directory ID
-:filesystem_getfile_bystart
+:virtual_filesystem_getfile_bystart
SET PUSH, X
SET PUSH, B
SET PUSH, A
SET B, A
- JSR filesystem_getfile_table
+ JSR virtual_filesystem_getfile_table
SET X, [A] ; Get the number of files in the table
ADD A, 1 ; Jump down to the start of the table
-:filesystem_getfile_bystart_loop
+:virtual_filesystem_getfile_bystart_loop
SET C, 0 ; Reset our return
IFE X, 0 ; Check if we've gone through all of the files
- SET PC, filesystem_getfile_bystart_end
+ SET PC, virtual_filesystem_getfile_bystart_end
SUB X, 1
ADD A, 18 ; Skip over the directory ID, flags, and filename
IFE B, [A]
- SET PC, filesystem_getfile_bystart_found
+ SET PC, virtual_filesystem_getfile_bystart_found
ADD A, 2 ; Skip over end and jump to next entry
- SET PC, filesystem_getfile_bystart_loop
-:filesystem_getfile_bystart_found
+ SET PC, virtual_filesystem_getfile_bystart_loop
+:virtual_filesystem_getfile_bystart_found
SUB A, 18 ; Backs up the pointer to the start of the file entry
SET C, A ; Sets C to the start of the entry
-:filesystem_getfile_bystart_end
+:virtual_filesystem_getfile_bystart_end
SET A, POP
SET B, POP
SET X, POP
SET PC, POP
-
+
+; ######END VIRTUAL FILESYSTEM FUNCTIONS######
+
+; ############PHYSICAL FILESYSTEM#############
+
+; *** Hardware Functions ***
+; Returns the sector size in words
+:filesystem_getsectorsize
+
+; Returns the total number of sectors
+:filesystem_getsectorcount
+
+; Returns the total disk size in words
+:filesystem_getdisksize
+
+; *** Software Functions ***
+; Returns the total FAT size in sectors
+:filesystem_getFATsize
+
+; Returns the total number of free sectors on the disk
+:filesystem_getfreespace
+
+; ##########END PHYSICAL FILESYSTEM###########
View
2  kernel/interrupts.dasm16
@@ -53,6 +53,6 @@
SET PC, POP
:kernel_interrupt_handler_floppy
- ; TODO
+ JSR driver_floppy_handle_interrupt
SET PC, POP
Please sign in to comment.
Something went wrong with that request. Please try again.