This commit is contained in:
julianb0 2019-06-20 18:13:06 +02:00
parent 6ae9169f6d
commit 9487374328
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
11 changed files with 111 additions and 25 deletions

View File

@ -11,7 +11,7 @@ _start:
call main
.1:
stop
hlt
jmp .1
;

6
ka/inc/screen.k Normal file
View File

@ -0,0 +1,6 @@
; The OS/K Team licenses this file to you under the MIT license.
; See the LICENSE file in the project root for more information.
SCR_TEXTMODE_WIDTH := 80
SCR_TEXTMODE_HEIGHT := 25

View File

@ -5,23 +5,5 @@
; Main function
;
main:
mov rdx, 25
.1:
mov rcx, 79
prn.rep '+'
prn '!'
dec rdx
test rdx, rdx
j.nz .1
mov rcx, 80
prn.rep '&'
mov rcx, 80
prn.rep '%'
call showoff
hlt
ret

View File

@ -1,6 +1,25 @@
; The OS/K Team licenses this file to you under the MIT license.
; See the LICENSE file in the project root for more information.
putc_scroll_test:
mov rdx, 25
.1:
mov rcx, 79
prn.rep '+'
prn '!'
dec rdx
test rdx, rdx
j.nz .1
mov rcx, 80
prn.rep '&'
mov rcx, 80
prn.rep '%'
call showoff
ret
cpudev_test:
call RFS.GetLeastAvail
mov rbx, rax

12
vm/dv/DEVICES Normal file
View File

@ -0,0 +1,12 @@
# The OS/K Team licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
The following device numbers are reserved and always correspond
to the same device:
# desc
0 CPU device
1 memory device
2 clock device
3 keyboard device
4 screen device

31
vm/dv/clockdev.c Normal file
View File

@ -0,0 +1,31 @@
// The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#include <pc/dev.h>
//----------------------------------------------------------------------------//
long clockdev_poweron(ctx_t *ctx, dev_t *dev)
{
dev->state = DEVGOOD;
return 0;
}
//----------------------------------------------------------------------------//
dev_t clockdev =
{
.type = "clock",
.name = "clock device",
.modl = "",
.vend = "The OS/K Team",
.major = KARCH_MAJOR,
.minor = KARCH_MINOR,
.revis = KARCH_REVIS,
.fpwon = clockdev_poweron,
};

31
vm/dv/keybdev.c Normal file
View File

@ -0,0 +1,31 @@
// The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#include <pc/dev.h>
//----------------------------------------------------------------------------//
long keybdev_poweron(ctx_t *ctx, dev_t *dev)
{
dev->state = DEVGOOD;
return 0;
}
//----------------------------------------------------------------------------//
dev_t keybdev =
{
.type = "keyboard",
.name = "keyboard device",
.modl = "",
.vend = "The OS/K Team",
.major = KARCH_MAJOR,
.minor = KARCH_MINOR,
.revis = KARCH_REVIS,
.fpwon = keybdev_poweron,
};

View File

@ -32,6 +32,8 @@ void console_init(ctx_t *ctx)
SDL_CreateWindowAndRenderer(SCREEN_WIDTH, SCREEN_HEIGHT, 0,
&scr_win, &scr_rend);
SDL_SetRenderDrawColor(scr_rend, 20, 20, 20, 0);
if (scr_win == NULL || scr_rend == NULL)
{
logerr("Couldn't create SDL screen window/renderer: %s", SDL_GetError());
@ -55,6 +57,9 @@ void console_init(ctx_t *ctx)
memset(scr_lines[y], ' ', CONSOLE_WIDTH);
scr_lines[y][CONSOLE_WIDTH] = 0;
}
SDL_RenderClear(scr_rend);
SDL_RenderPresent(scr_rend);
}
//----------------------------------------------------------------------------//
@ -85,9 +90,6 @@ void console_render(ctx_t *ctx)
{
size_t y;
SDL_SetRenderDrawColor(scr_rend, 20, 20, 20, 0);
//SDL_RenderSetScale(scr_rend, 0.2f, 0.2f);
SDL_RenderClear(scr_rend);
for (y = 0; y < CONSOLE_HEIGHT; y++)
@ -118,7 +120,8 @@ void console_putat(ctx_t *ctx, char ch, int x, int y)
if (!surf)
{
logerr("console_putat: couldn't render TTF font\n");
logerr("console_putat: couldn't render TTF font: "
"(%d,%d) '%c'\nError: '%s'\n", x, y, ch, SDL_GetError());
die(-1);
}

View File

@ -9,12 +9,14 @@
// Add new builtin devices here
//
extern dev_t cpudev, memdev;
extern dev_t cpudev, memdev, clockdev, keybdev, screendev;
static dev_t *arch_d[] =
{
&cpudev,
&memdev,
&clockdev,
&keybdev,
NULL,
};

View File

@ -4,7 +4,7 @@
#include <pc/arch.h>
#define DEVLEN 32
#define DEVSLOTS 256
#define DEVSLOTS 4096
typedef long (*devfn_t)(ctx_t *, dev_t *);