Compare commits

..

No commits in common. "f4fdca7feee3ad55241248dcd051ca991caff103" and "50cc073af36575f977a1c2a6b5726f162f8d56a4" have entirely different histories.

31 changed files with 121 additions and 397 deletions

4
.gitignore vendored Executable file → Normal file
View File

@ -1,3 +1 @@
.vscode
build
src/tools
.vscode

41
docs/KernelRoutineList.txt → KernelRoutineList.txt Executable file → Normal file
View File

@ -33,16 +33,15 @@ Hardware.s
+- vram_write_color
+- vram_read
+- vram_dump
+- beep
+- set_activity_led
+- set_activity_led_duration
+- set_user_led
+- set_user_led_duration
+- expansion_set
+- expansion_get
beep
set_activity_led
set_user_led
scan_keyboard
expansion_set
expansion_get
Int.s
|
+- int16_add_byte
@ -59,22 +58,20 @@ Keyboard.s
+- keyboard_format
Memory_Manager.s
|
+- kernel_push_a
+- kernel_push_x
+- kernel_push_y
+- kernel_pull_a
+- kernel_pull_x
+- kernel_pull_y
--- Still planing ---
Software Stack:
(for A, X and Y)
push
pop
reserve
dispose
grow
shrink
External Fragmantation
Maybe also: External Fragmantation
or: Variable houskeeping in a List of pointers
--- Still planing ---
@ -127,14 +124,4 @@ video.s
+- video_set_mode
+- video_get_mode
+- video_set_accent
+- video_get_accent
filesystem.s
serial.s
sound.s
+- video_get_accent

13
Makefile Executable file → Normal file
View File

@ -1,8 +1,13 @@
# Please Ignore for now, I will make a better makefile in the future
# I promisse
# ToDo:
# Ignore Upload when no programmer found
all: compile upload
compile:
@echo "Compiling for 65c02"
@vasm6502_oldstyle -Fbin -dotdir -wdc02 main.s | grep :
upload:
@echo "Uploading"
@minipro -p SST39SF040 -w a.out -Sy
all:
@sh build.sh

14
README.md Executable file → Normal file
View File

@ -1,13 +1,15 @@
# LS7-Kernel
Kernel for the LS/7 Computer
**Not yet stable**
!! Still in Development !!
# Building & Compiling
Build and Upload scripts are contained in the main directory,
or use the binder Makefile
Although, there already is a pre-compiled Binary "a.out",
if you want to make and apply changes you have to compile the program
yourself.
The Compile and Upload scripts are contained in the Makefile
# Dependencies:
* Compiler: vasm6502_oldstyle (may switch to cc65)
* Uploader: minipro
* Compiler: vasm6502 (may switch to cc65)
* Uploader: minipro

BIN
a.out Normal file

Binary file not shown.

BIN
assets/UTF-8.bin Normal file

Binary file not shown.

0
assets/bold.bmf → assets/UTF-8.bmf Executable file → Normal file
View File

Binary file not shown.

Binary file not shown.

View File

@ -1,36 +0,0 @@
#!/bin/sh
echo "Compiling for 65c02"
# Removing previous build
rm -rf build
mkdir build
bold=$(tput bold)
normal=$(tput sgr0)
build(){
output=$(vasm6502_oldstyle -Fbin -dotdir -wdc02 src/main.s -o build/a.out | grep :)
if `find build/a.out* > /dev/null`;
then
echo -e "\n\e[0;32m${bold}Compiled Succsessfully${normal}"
sh upload.sh
else
echo -e "\n\e[0;31m${bold}Error while Compiling${normal}"
fi
echo ""
echo $output | sed 's/bytes /bytes\n/g'
}
# Checking dependencies
if command -v vasm6502_oldstyle > /dev/null 2<&1;
then
build
else
echo -e "\n\e[0;31m${bold}vasm6502_oldstyle not found${normal}"
echo "Aborting build..."
fi

Binary file not shown.

19
src/main.s → main.s Executable file → Normal file
View File

@ -1,5 +1,5 @@
; Important To-Do!
;
;
; Get launch & tasks json working
; fix Keyboard scanning
; work on KernelRoutinesList.txt
@ -8,15 +8,15 @@
; Does not support the Graphics module !
.include "src/variables.s"
.include "src/variables.s"
.org $c000 ; $c000 for 16k ROM
.include "src/kernel.s"
.org $f700
charset: .incbin "assets/font.bin"
charset: .incbin "assets/UTF-8.bin"
.org $ff00
reset: sei
@ -29,7 +29,7 @@ reset: sei
lda #$E0
sta vidm
lda #$60
sta cursor_delay
lda #$06
@ -54,8 +54,6 @@ reset: sei
stz system_register
stz soft_system_register
jsr kernel_init
;jsr video_writeline_static
;.string "Hello World"
@ -86,8 +84,7 @@ lp:
cpy #$10
bne lp
loop:
loop:
jmp loop
irq_jump: jmp (irq_vector)
@ -98,4 +95,4 @@ irq_jump: jmp (irq_vector)
.addr reset
.addr irq_jump
.end
.end

View File

25
src/kernel.s Executable file → Normal file
View File

@ -3,28 +3,9 @@
.include "src/kernel/video.s"
.include "src/kernel/console.s"
.include "src/kernel/graphics.s"
.include "src/kernel/string.s"
.include "src/kernel/int.s"
.include "src/kernel/event_handler.s"
.include "src/kernel/memory_manager.s"
.include "src/kernel/hardware.s"
.include "src/kernel/string.s"
.include "src/kernel/int.s"
.include "src/kernel/byte.s"
.include "src/kernel/char.s"
kernel_init:
; Kernel Init
; Initialises some Kernel parameters
; Input : (none)
; Output : (none)
stz kernel_stack_counter
lda #<kernel_stack
sta kernel_stack_pointer
lda #>kernel_stack
sta kernel_stack_pointer + 1
rts

0
src/kernel/byte.s Executable file → Normal file
View File

0
src/kernel/char.s Executable file → Normal file
View File

16
src/kernel/console.s Executable file → Normal file
View File

@ -14,16 +14,9 @@ console_write:
; ToDo:
; Support for ASCII (0-32) Chars, Line feed etc.
; Support for Color codes => Maybe #$ff Indicator
; Return propper work addresses in X & Y (for static support)
; Return propper work addresses in X & Y
;
; 00 = END of string
; 0a = New Line
; 08 = Backspace
; 09 | 0b = Tab
; 0d = x cursor origin
;
stx z0
sty z1
@ -56,7 +49,7 @@ console_write_loop:
lda #$1f
sta cursor_y
console_write_skip_overflow:
console_write_skip_overflow:
ldx cursor_x
ldy cursor_y
jsr vram_write
@ -292,11 +285,6 @@ console_reset:
; Input: (none)
; Output: (none)
jsr console_clear
ldx #$00
ldy #$00
jsr console_set_cursor
rts

0
src/kernel/event_handler.s Executable file → Normal file
View File

0
src/kernel/graphics.s Executable file → Normal file
View File

86
src/kernel/hardware.s Executable file → Normal file
View File

@ -98,89 +98,3 @@ vram_dump:
rts
beep:
; Beep
; Beeps the main speaker
; Input:
; A => Beep Duration
; Output: (none)
sta beep_counter
rts
set_activity_led:
; Set Activity LED
; Sets the Activity LED Constant
; Input:
; A => State
; Output: (none)
rts
set_user_led:
; Set User LED
; Sets the User LED Constant
; Input:
; A => State
; Output: (none)
rts
set_activity_led_duration:
; Set Activity LED Duration
; Sets the Time (in Ticks),
; where the Activity LED is HIGH
; Input:
; A => Duration
; Output: (none)
rts
set_user_led_duration:
; Set User LED Duration
; Sets the Time (in Ticks),
; where the User LED is HIGH
; Input:
; A => Duration
; Output: (none)
rts
expansion_get:
; Expansion Get
; Gets Data from the Selected Expansion port,
; at the given Port-Address
; Input:
; X => Port Number
; Y => Port Address
; Output:
; A <= Read Data
rts
expansion_set:
; Expansion Set
; Sets Data from the Selected Expansion port,
; at the given Port-Address
; Input:
; A => Data
; X => Port Number
; Y => Port Address
; Output: (none)
rts

0
src/kernel/int.s Executable file → Normal file
View File

0
src/kernel/irq.s Executable file → Normal file
View File

43
src/kernel/keyboard.s Executable file → Normal file
View File

@ -28,6 +28,49 @@ keyboard_scan:
sta soft_system_register
sta system_register
ldy #$00 ; Result Index
ldx #$00 ; Row Counter
keyboard_scan_load:
lda #$fe ; Bit shifter
keyboard_scan_loop:
cmp keyboard_port
beq keyboard_scan_return
iny
rol
cmp #$fe
bne keyboard_scan_loop
inx
cpx #$08 ; Checking if Counted to 7
beq keyboard_scan_return
inc soft_system_register
lda soft_system_register
sta system_register
jmp keyboard_scan_load
keyboard_scan_return:
sty k0
lda soft_system_register
ora #$05
sta system_register
lda keyboard_port
tax
and #$0f
tay ; => Arrow Keys
txa
rol
rol
rol
rol
and #$07
tax ; => Modifier Keys
lda k0 ; => Scancode
rts
keyboard_translate:
; Keyboard Translate

120
src/kernel/memory_manager.s Executable file → Normal file
View File

@ -1,120 +0,0 @@
kernel_push_a:
; Kernel Push A
; Pushes the A Register to Kernel Stack
; Input:
; A => Data to Push
; Output: (none)
sty kernel_stack_offload_1
ldy kernel_stack_counter
sta (kernel_stack_pointer), y
inc kernel_stack_counter
ldy kernel_stack_offload_1
rts
kernel_push_x:
; Kernel Push X
; Pushes the X Register to Kernel Stack
; Input:
; X => Data to Push
; Output: (none)
sty kernel_stack_offload_1
sta kernel_stack_offload_2
txa
ldy kernel_stack_counter
sta (kernel_stack_pointer), y
tax
inc kernel_stack_counter
ldy kernel_stack_offload_1
lda kernel_stack_offload_2
rts
kernel_push_y:
; Kernel Push Y
; Pushes the Y Register to Kernel Stack
; Input:
; Y => Data to Push
; Output: (none)
stx kernel_stack_offload_1
sta kernel_stack_offload_2
tya
ldy kernel_stack_counter
sta (kernel_stack_pointer), y
tay
inc kernel_stack_counter
ldx kernel_stack_offload_1
lda kernel_stack_offload_2
rts
kernel_pull_a:
; Kernel Pull A
; Pulls the Current Index Data
; of the Kernel Stack to A
; Input: (none)
; Output:
; A <= Pulled Data
sty kernel_stack_offload_1
ldy kernel_stack_counter
lda (kernel_stack_pointer), y
dec kernel_stack_pointer
ldy kernel_stack_offload_1
rts
kernel_pull_x:
; Kernel Pull X
; Pulls the Current Index Data
; of the Kernel Stack to X
; Input: (none)
; Output:
; X <= Pulled Data
sty kernel_stack_offload_1
sta kernel_stack_offload_2
ldy kernel_stack_counter
lda (kernel_stack_pointer), y
tax
dec kernel_stack_pointer
ldy kernel_stack_offload_1
lda kernel_stack_offload_2
rts
kernel_pull_y:
; Kernel Pull Y
; Pulls the Current Index Data
; of the Kernel Stack to Y
; Input: (none)
; Output:
; Y <= Pulled Data
sta kernel_stack_offload_1
ldy kernel_stack_counter
lda (kernel_stack_pointer), y
tay
dec kernel_stack_pointer
lda kernel_stack_offload_1
rts

View File

0
src/kernel/string.s Executable file → Normal file
View File

View File

0
src/kernel/video.s Executable file → Normal file
View File

0
src/monitor.s Executable file → Normal file
View File

81
src/variables.s Executable file → Normal file
View File

@ -7,65 +7,50 @@
z0 = $0 ; 8 bit All Purpose 16 bit Zero Page Variable
z1 = $1 ; 8 bit
kernel_stack_pointer = $fe ; 16 bit Pointer to the Kernel Stack
kernel_stack = $200 ; 256 bytes 256 byte, Kernel Stack, used for offloading Registers
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 (internal) IRQ 16 bit Jump Vector
typebuffer = $300 ; 256 bytes 256 byte, All Purpose Char Buffer
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
k5 = $20a ; 8 bit
k6 = $20b ; 8 bit
k7 = $20c ; 8 bit
irq_a = $400 ; 8 bit (internal) IRQ Variable Save
irq_x = $401 ; 8 bit (internal)
irq_y = $402 ; 8 bit (internal)
irq_vector = $403 ; 16 bit (internal) IRQ 16 bit Jump Vector
k0 = $405 ; 8 bit General Purpose Kernel Registers,
k1 = $406 ; 8 bit usually used as Carry for Sub-Routines
k2 = $407 ; 8 bit
k3 = $408 ; 8 bit
k4 = $409 ; 8 bit
k5 = $40a ; 8 bit
k6 = $40b ; 8 bit
k7 = $40c ; 8 bit
keyboard_current = $40d ; 8 bit Held Keyboard Key, without Formatting (shift, etc.) "Scan Key"
keyboard_previous = $40e ; 8 bit Previous held "Scan Key"
keyboard_ascii = $40f ; 8 bit Formatted Char, from keyboard_current as ASCII
keyboard_arrow = $410 ; 8 bit Held Arrow Keys
keyboard_modifier = $411 ; 8 bit Held Modifier Keys, such as "shift, alt, control"
cursor_x = $412 ; 8 bit Current Cursor X Position
cursor_y = $413 ; 8 bit Current Cursor Y Position
cursor_x_previous = $414 ; 8 bit (internal) Previous Cursor X Position
cursor_y_previous = $415 ; 8 bit (internal) Previous Cursor Y Position
cursor_value = $416 ; 8 bit
cursor_speed = $417 ; 8 bit Cursor Blink Speed (in IRQ Ticks)
cursor_speed_count = $418 ; 8 bit (internal) Cursor Blink Speed Counter
cursor_delay_interval = $419 ; 8 bit
cursor_delay = $41a ; 8 bit
cursor_delay_count = $41b ; 8 bit (internal)
cursor_delay_switch = $41c ; 8 bit (internal)
soft_system_register = $41d ; 8 bit (internal)
color = $41e ; 8 bit Fore & Background Color
typelength = $41f ; 8 bit Length of typebuffer
kernel_stack_counter = $420 ; 8 bit (internal) Length of Kernel Stack
kernel_stack_offload_1 = $421 ; 8 bit (internal) General Kernel Stack Offload Variable
kernel_stack_offload_2 = $422 ; 8 bit (internal) ..
beep_counter = $423 ; 8 bit (public) Beeper counter in IRQ Ticks
activity_led_counter = $424 ; 8 bit (public) Activity LED Counter in IRQ Ticks
user_led_counter = $425 ; 8 bit (public) User LED Counter in IRQ Ticks
keyboard_current = $20d ; 8 bit Held Keyboard Key, without Formatting (shift, etc.) "Scan Key"
keyboard_previous = $20e ; 8 bit Previous held "Scan Key"
keyboard_ascii = $20f ; 8 bit Formatted Char, from keyboard_current as ASCII
keyboard_arrow = $210 ; 8 bit Held Arrow Keys
keyboard_modifier = $211 ; 8 bit Held Modifier Keys, such as "shift, alt, control"
cursor_x = $212 ; 8 bit Current Cursor X Position
cursor_y = $213 ; 8 bit Current Cursor Y Position
cursor_x_previous = $214 ; 8 bit (internal) Previous Cursor X Position
cursor_y_previous = $215 ; 8 bit (internal) Previous Cursor Y Position
cursor_value = $216 ; 8 bit
cursor_speed = $217 ; 8 bit Cursor Blink Speed (in IRQ Ticks)
cursor_speed_count = $218 ; 8 bit (internal) Cursor Blink Speed Counter
cursor_delay_interval = $219 ; 8 bit
cursor_delay = $21a ; 8 bit
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
kernel_stack = $300 ; 256 bytes 256 byte, Kernel Stack, used for offloading Registers
typebuffer = $400 ; 256 bytes 256 byte, All Purpose Char Buffer
; END => $500
; Hardware Registers
vidx = $be00 ; 8 bit Video X Register

View File

@ -1,20 +0,0 @@
#!/bin/sh
echo -e "\nUploading..."
bold=$(tput bold)
normal=$(tput sgr0)
upload(){
output=`minipro -p SST39SF040 -w build/a.out -Sy`
}
# Checking dependencies
if command -v minipro > /dev/null 2<&1;
then
upload
else
echo -e "\n\e[0;31m${bold}minipro not found${normal}"
echo "Aborting upload..."
fi