Worked on Function planning
This commit is contained in:
parent
49d9e0a38e
commit
9cee94df92
@ -1,13 +1,18 @@
|
||||
Kernel Routines Grouped
|
||||
(everything NOT starting with "+-", are "wants")
|
||||
|
||||
Kernel Routines Grouped by File
|
||||
|
||||
|
||||
Char.s
|
||||
|
||||
|
|
||||
+- char_to_lower
|
||||
+- char_to_upper
|
||||
+- is_char
|
||||
|
||||
Event_Handler.s
|
||||
|
||||
|
|
||||
+- event_invoke
|
||||
+- event_append
|
||||
+- event_remove
|
||||
+- event_count
|
||||
|
||||
Hardware.s
|
||||
|
|
||||
@ -18,34 +23,44 @@ Hardware.s
|
||||
|
||||
Int.s
|
||||
|
||||
|
||||
Irq.s
|
||||
|
|
||||
+- irq
|
||||
+- irq_init
|
||||
|
||||
Keyboard.s
|
||||
|
||||
|
|
||||
+- keyboard_scan
|
||||
+- keyboard_translate
|
||||
+- keyboard_format
|
||||
|
||||
Memory_Manager.s
|
||||
--- Still planing ---
|
||||
|
||||
Software Stack:
|
||||
(for A, X and Y)
|
||||
push
|
||||
pop
|
||||
|
||||
reserve
|
||||
dispose
|
||||
grow
|
||||
shrink
|
||||
|
||||
|
||||
Maybe also: External Fragmantation
|
||||
or: Variable houskeeping in a List of pointers
|
||||
--- Still planing ---
|
||||
|
||||
String.s
|
||||
|
||||
to lower
|
||||
to upper
|
||||
count
|
||||
flip
|
||||
contains
|
||||
equals
|
||||
trim
|
||||
|
|
||||
+- string_to_lower
|
||||
+- string_to_upper
|
||||
+- string_count
|
||||
+- string_flip
|
||||
+- string_contains
|
||||
+- string_equals
|
||||
+- is_string
|
||||
|
||||
Video.s
|
||||
|
|
||||
|
8
main.s
8
main.s
@ -6,10 +6,10 @@
|
||||
|
||||
|
||||
.org $f700
|
||||
charset .incbin "assets/UTF-8.bin"
|
||||
charset: .incbin "assets/UTF-8.bin"
|
||||
|
||||
.org $ff00
|
||||
reset sei
|
||||
reset: sei
|
||||
cld
|
||||
|
||||
lda #<irq
|
||||
@ -48,9 +48,9 @@ reset sei
|
||||
jsr kernel_init
|
||||
|
||||
|
||||
loop jmp loop
|
||||
loop: jmp loop
|
||||
|
||||
irq_jump jmp (irq_vector)
|
||||
irq_jump: jmp (irq_vector)
|
||||
|
||||
|
||||
.org $fffa
|
||||
|
@ -7,7 +7,7 @@
|
||||
.include "src/kernel/memory_manager.s"
|
||||
.include "src/kernel/hardware.s"
|
||||
|
||||
kernel_init
|
||||
kernel_init:
|
||||
rts
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
char_to_lower:
|
||||
; Char To Lower
|
||||
; Char is converted to Lowercase
|
||||
|
||||
; Input:
|
||||
; A => Char
|
||||
|
||||
; Output:
|
||||
; A <= Char
|
||||
|
||||
|
||||
rts
|
||||
|
||||
char_to_upper:
|
||||
; Char To Upper
|
||||
; Char is converted to Uppercase
|
||||
|
||||
; Input:
|
||||
; A => Char
|
||||
|
||||
; Output:
|
||||
; A <= Char
|
||||
|
||||
|
||||
rts
|
||||
|
||||
is_char:
|
||||
; Is Char
|
||||
; Checks if the Byte given, is a valid char
|
||||
|
||||
; Input:
|
||||
; A => Char
|
||||
|
||||
; Output:
|
||||
; A <= 0 if False, 1 if True
|
||||
|
||||
|
||||
rts
|
@ -0,0 +1,62 @@
|
||||
event_invoke:
|
||||
; Event Invoke
|
||||
; Invokes the Event, as a list of Sub-Routines,
|
||||
; Starting at the pointer
|
||||
|
||||
; Input:
|
||||
; K0 => LOW Event-List Pointer
|
||||
; K1 => HIGH Event-List Pointer
|
||||
; A => A Event Carry
|
||||
; X => X Event Carry
|
||||
; Y => Y Evet Carry
|
||||
|
||||
; Output: (none)
|
||||
|
||||
|
||||
rts
|
||||
|
||||
event_append:
|
||||
; Event Append
|
||||
; Appens the given Adress to the given Event-List
|
||||
|
||||
; Input:
|
||||
; K0 => LOW Event-List Pointer
|
||||
; K1 => HIGH Event-List Pointer
|
||||
; X => LOW Event Adress Pointer
|
||||
; Y => HIGH Event Adress Pointer
|
||||
|
||||
; Output:
|
||||
; A <= 0 if added successfully, 1 if not
|
||||
|
||||
|
||||
rts
|
||||
|
||||
event_remove:
|
||||
; Event Remove
|
||||
; Removes the given Adress from the Event-List
|
||||
|
||||
; Input:
|
||||
; K0 => LOW Event-List Pointer
|
||||
; K1 => HIGH Event-List Pointer
|
||||
; X => LOW Event Adress Pointer
|
||||
; Y => HIGH Event Adress Pointer
|
||||
|
||||
; Output: (none)
|
||||
|
||||
|
||||
rts
|
||||
|
||||
event_count:
|
||||
; Event Count
|
||||
; Counts how many Events are in a Event-List
|
||||
|
||||
; Input:
|
||||
; X => LOW Event-List Pointer
|
||||
; Y => HIGH Event-List Pointer
|
||||
|
||||
; Output:
|
||||
; A <= Count
|
||||
|
||||
|
||||
rts
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
vram_write
|
||||
vram_write:
|
||||
; VRAM Write
|
||||
; Writes A to the given Coordinate
|
||||
|
||||
@ -14,7 +14,7 @@ vram_write
|
||||
rts
|
||||
|
||||
|
||||
vram_write_color
|
||||
vram_write_color:
|
||||
; VRAM Write Color
|
||||
; Writes A to the given Coordinate, but adds 0x40 to X
|
||||
|
||||
@ -28,7 +28,7 @@ vram_write_color
|
||||
|
||||
rts
|
||||
|
||||
vram_read
|
||||
vram_read:
|
||||
; VRAM Read
|
||||
; Reads Data from the given Coordinate
|
||||
|
||||
@ -42,7 +42,7 @@ vram_read
|
||||
|
||||
rts
|
||||
|
||||
vram_dump
|
||||
vram_dump:
|
||||
; VRAM Dump
|
||||
; Dumps all bytes from VRAM in the given Range
|
||||
; to a specified Memory Adress
|
||||
|
@ -1,2 +1,5 @@
|
||||
irq
|
||||
irq_init:
|
||||
rts
|
||||
|
||||
irq:
|
||||
rti
|
@ -0,0 +1,42 @@
|
||||
keyboard_scan:
|
||||
; Keyboard Scan
|
||||
; Scans the Keyboard matrix, and returns a Scan Code,
|
||||
; the held Modifier Keys and Arrow Keys
|
||||
|
||||
; Input: (none)
|
||||
|
||||
; Output:
|
||||
; A <= Scan Code
|
||||
; X <= Modifier Keys
|
||||
; Y <= Arrow Keys
|
||||
|
||||
|
||||
rts
|
||||
|
||||
keyboard_translate:
|
||||
; Keyboard Translate
|
||||
; Converts the Scan Code into lowercase ASCII
|
||||
|
||||
; Input:
|
||||
; A => Scan Code
|
||||
|
||||
; Output:
|
||||
; A <= ASCII Char
|
||||
|
||||
|
||||
rts
|
||||
|
||||
keyboard_format:
|
||||
; Keyboard Format
|
||||
; Formats the given ASCII Character to
|
||||
; Uppercase / Special Characters, for final use
|
||||
|
||||
; Input:
|
||||
; A => ASCII Char
|
||||
; X => Modifier Keys
|
||||
|
||||
; Output:
|
||||
; A <= ASCII Char
|
||||
|
||||
|
||||
rts
|
@ -0,0 +1,100 @@
|
||||
string_to_lower:
|
||||
; String To Lower
|
||||
; Converts the given string to Lowercase
|
||||
|
||||
; Input:
|
||||
; X => LOW Memory Pointer
|
||||
; Y => HIGH Memory Pointer
|
||||
|
||||
; Output: (none)
|
||||
|
||||
|
||||
rts
|
||||
|
||||
string_to_upper:
|
||||
; String To Upper
|
||||
; Converts the given string to Uppercase
|
||||
|
||||
; Input:
|
||||
; X => LOW Memory Pointer
|
||||
; Y => HIGH Memory Pointer
|
||||
|
||||
; Output: (none)
|
||||
|
||||
|
||||
rts
|
||||
|
||||
string_count:
|
||||
; String Count
|
||||
; Counts the Characters in the given String
|
||||
|
||||
; Input:
|
||||
; X => LOW Memory Pointer
|
||||
; Y => HIGH Memory Pointer
|
||||
|
||||
; Output:
|
||||
; A <= Count
|
||||
|
||||
|
||||
rts
|
||||
|
||||
string_flip:
|
||||
; String Flip
|
||||
; Reverses the given String
|
||||
|
||||
; Input:
|
||||
; X => LOW Memory Pointer
|
||||
; Y => HIGH Memory Pointer
|
||||
|
||||
; Output: (none)
|
||||
|
||||
|
||||
rts
|
||||
|
||||
string_contains:
|
||||
; String Contains
|
||||
; Checks if a String is contained in the given String
|
||||
|
||||
; Input:
|
||||
; K0 => LOW Memory Pointer Shorter String
|
||||
; K1 => HIGH Memory Pointer Shorter String
|
||||
; X => LOW Memory Pointer Longer String
|
||||
; Y => HIGH Memory Pointer Longer String
|
||||
|
||||
; Output:
|
||||
; A <= 0 if False, 1 if True
|
||||
|
||||
|
||||
rts
|
||||
|
||||
string_equals:
|
||||
; String Equals
|
||||
; Checks if a String is equal to the given String
|
||||
|
||||
; Input:
|
||||
; K0 => LOW Memory Pointer String A
|
||||
; K1 => HIGH Memory Pointer String A
|
||||
; X => LOW Memory Pointer String B
|
||||
; Y => HIGH Memory Pointer String B
|
||||
|
||||
; Output:
|
||||
; A <= 0 if False, 1 if True
|
||||
|
||||
|
||||
rts
|
||||
|
||||
is_string:
|
||||
; Is String
|
||||
; Checks if the given String contains valid Chars
|
||||
|
||||
; Input:
|
||||
; X => LOW Memory Pointer
|
||||
; Y => HIGH Memory Pointer
|
||||
; A => Max. String Length
|
||||
|
||||
; Output:
|
||||
; A <= 0 if False, 1 if True
|
||||
|
||||
|
||||
rts
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
video_write
|
||||
video_write:
|
||||
; Video Write (string)
|
||||
; String will be written from a Pointer,
|
||||
; without a new line at the end
|
||||
@ -13,7 +13,7 @@ video_write
|
||||
|
||||
rts
|
||||
|
||||
video_write_static
|
||||
video_write_static:
|
||||
; Video Write Static (string)
|
||||
; String will be written wich follows after
|
||||
; the JSR call without a new line at the end
|
||||
@ -24,7 +24,7 @@ video_write_static
|
||||
|
||||
rts
|
||||
|
||||
video_writeline
|
||||
video_writeline:
|
||||
; Video Writeline (string)
|
||||
; Same as "video_write", except at
|
||||
; the end, a new line begins
|
||||
@ -38,7 +38,7 @@ video_writeline
|
||||
|
||||
rts
|
||||
|
||||
video_writeline_static
|
||||
video_writeline_static:
|
||||
; Video Writeline Static (string)
|
||||
; Same as "video_write_static", except at
|
||||
; the end, a new line begins
|
||||
@ -49,7 +49,7 @@ video_writeline_static
|
||||
|
||||
rts
|
||||
|
||||
video_set_color
|
||||
video_set_color:
|
||||
; Video Set Color
|
||||
; Sets the color, of the content
|
||||
; that will be written, following
|
||||
@ -62,7 +62,7 @@ video_set_color
|
||||
|
||||
rts
|
||||
|
||||
video_set_foreground
|
||||
video_set_foreground:
|
||||
; Video Set Foreground
|
||||
; Sets the Foreground color
|
||||
|
||||
@ -74,7 +74,7 @@ video_set_foreground
|
||||
|
||||
rts
|
||||
|
||||
video_set_background
|
||||
video_set_background:
|
||||
; Video Set Background
|
||||
; Sets the Background color
|
||||
|
||||
@ -86,7 +86,7 @@ video_set_background
|
||||
|
||||
rts
|
||||
|
||||
video_read_line
|
||||
video_read_line:
|
||||
; Video Read Line
|
||||
; Loops, till the Return key is pressed
|
||||
; Output is stored in $300 => "Typebuffer"
|
||||
@ -97,7 +97,7 @@ video_read_line
|
||||
|
||||
rts
|
||||
|
||||
video_read_char
|
||||
video_read_char:
|
||||
; Video Read Char
|
||||
; Loops, till a Key is pressed
|
||||
|
||||
@ -109,7 +109,7 @@ video_read_char
|
||||
|
||||
rts
|
||||
|
||||
video_set_cursor
|
||||
video_set_cursor:
|
||||
; Video Set Cursor
|
||||
; Sets the Cursor Location
|
||||
|
||||
@ -122,7 +122,7 @@ video_set_cursor
|
||||
|
||||
rts
|
||||
|
||||
video_get_cursor
|
||||
video_get_cursor:
|
||||
; Video Get Cursor
|
||||
; Gets the Cursor Location
|
||||
|
||||
@ -135,7 +135,7 @@ video_get_cursor
|
||||
|
||||
rts
|
||||
|
||||
video_return
|
||||
video_return:
|
||||
; Video Return
|
||||
; Sets the Cursor to it's line starting Position
|
||||
; and if nessesary, scrolls it up and prints the Start Text
|
||||
@ -146,7 +146,7 @@ video_return
|
||||
|
||||
rts
|
||||
|
||||
video_scroll
|
||||
video_scroll:
|
||||
; Video Scroll
|
||||
; Scrolls the screen in the given direction
|
||||
|
||||
@ -174,14 +174,14 @@ video_scroll
|
||||
|
||||
rts
|
||||
|
||||
video_clear
|
||||
video_clear:
|
||||
; Video Clear
|
||||
; Clears the Screen blank, with the normal Color
|
||||
|
||||
|
||||
rts
|
||||
|
||||
video_reset_color
|
||||
video_reset_color:
|
||||
; Video Reset Color
|
||||
; Resets the Color to it's initial state
|
||||
|
||||
@ -191,7 +191,7 @@ video_reset_color
|
||||
|
||||
rts
|
||||
|
||||
video_reset
|
||||
video_reset:
|
||||
; Video Reset
|
||||
; Resets the Video Display
|
||||
; to it's initial state, i.e
|
||||
@ -203,7 +203,7 @@ video_reset
|
||||
|
||||
rts
|
||||
|
||||
video_load_font
|
||||
video_load_font:
|
||||
; Video Load Font
|
||||
; Loads a 2k BitMap font from a Pointer to VRAM
|
||||
|
||||
|
@ -8,10 +8,10 @@ z1 = $1 ; 8 bit
|
||||
irq_a = $200 ; 8 bit (internal) IRQ Variable Save
|
||||
irq_x = $201 ; 8 bit (internal)
|
||||
irq_y = $202 ; 8 bit (internal)
|
||||
irq_vector = $203 ; 16 bit IRQ 16 bit Jump Vector
|
||||
irq_vector = $203 ; 16 bit (internal) IRQ 16 bit Jump Vector
|
||||
|
||||
k0 = $205 ; 8 bit General Purpose Registers
|
||||
k1 = $206 ; 8 bit ...
|
||||
k0 = $205 ; 8 bit General Purpose Kernel Registers,
|
||||
k1 = $206 ; 8 bit usually used as Carry for Sub-Routines
|
||||
k2 = $207 ; 8 bit
|
||||
k3 = $208 ; 8 bit
|
||||
k4 = $209 ; 8 bit
|
||||
@ -38,12 +38,14 @@ cursor_delay_count = $21b ; 8 bit (internal)
|
||||
cursor_delay_switch = $21c ; 8 bit (internal)
|
||||
|
||||
soft_system_register = $21d ; 8 bit (internal)
|
||||
color = $21e ; 8 bit Fore & Background Color
|
||||
typelength = $21f ; 8 bit Length of typebuffer
|
||||
|
||||
color = $2fe ; 8 bit Fore & Background Color
|
||||
kernel_stack = $280 ; 256 bytes 256 byte, Kernel Stack, used for offloading Registers
|
||||
|
||||
typelength = $2ff ; 8 bit Length of typebuffer
|
||||
typebuffer = $300 ; 256 byte 256 bit, All Purpose Char Buffer
|
||||
typebuffer = $380 ; 256 bytes 256 byte, All Purpose Char Buffer
|
||||
|
||||
; END => $480
|
||||
|
||||
|
||||
; Hardware Registers
|
||||
@ -65,3 +67,26 @@ ier = $bf8e ; 8 bit
|
||||
|
||||
keyboard_port = $bd00 ; 8 bit Keyboard Scan-Row Input
|
||||
system_register = $bc00 ; 8 bit System Register
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;-----------------------------------------------------------------------------------------------
|
||||
; Memory Map
|
||||
;-----------------------------------------------------------------------------------------------
|
||||
; $00-$ff: Mostly free Zero page, except for $00 and $01
|
||||
;-----------------------------------------------------------------------------------------------
|
||||
; $100-$1ff: Stack
|
||||
;-----------------------------------------------------------------------------------------------
|
||||
; $200-$27f: Kernel Variables
|
||||
;-----------------------------------------------------------------------------------------------
|
||||
; $280-$37f: Kernel Stack
|
||||
;-----------------------------------------------------------------------------------------------
|
||||
; $380-$47f: Typebuffer
|
||||
;-----------------------------------------------------------------------------------------------
|
||||
;
|
||||
;-----------------------------------------------------------------------------------------------
|
||||
;
|
||||
;-----------------------------------------------------------------------------------------------
|
Loading…
Reference in New Issue
Block a user