dev
This commit is contained in:
parent
6ae9169f6d
commit
9487374328
2
ka/dos.k
2
ka/dos.k
|
@ -11,7 +11,7 @@ _start:
|
||||||
call main
|
call main
|
||||||
|
|
||||||
.1:
|
.1:
|
||||||
stop
|
hlt
|
||||||
jmp .1
|
jmp .1
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
|
@ -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
|
||||||
|
|
18
ka/main.k
18
ka/main.k
|
@ -5,23 +5,5 @@
|
||||||
; Main function
|
; Main function
|
||||||
;
|
;
|
||||||
main:
|
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
|
ret
|
||||||
|
|
||||||
|
|
19
ka/tests.k
19
ka/tests.k
|
@ -1,6 +1,25 @@
|
||||||
; The OS/K Team licenses this file to you under the MIT license.
|
; The OS/K Team licenses this file to you under the MIT license.
|
||||||
; See the LICENSE file in the project root for more information.
|
; 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:
|
cpudev_test:
|
||||||
call RFS.GetLeastAvail
|
call RFS.GetLeastAvail
|
||||||
mov rbx, rax
|
mov rbx, rax
|
||||||
|
|
|
@ -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
|
|
@ -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,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ void console_init(ctx_t *ctx)
|
||||||
SDL_CreateWindowAndRenderer(SCREEN_WIDTH, SCREEN_HEIGHT, 0,
|
SDL_CreateWindowAndRenderer(SCREEN_WIDTH, SCREEN_HEIGHT, 0,
|
||||||
&scr_win, &scr_rend);
|
&scr_win, &scr_rend);
|
||||||
|
|
||||||
|
SDL_SetRenderDrawColor(scr_rend, 20, 20, 20, 0);
|
||||||
|
|
||||||
if (scr_win == NULL || scr_rend == NULL)
|
if (scr_win == NULL || scr_rend == NULL)
|
||||||
{
|
{
|
||||||
logerr("Couldn't create SDL screen window/renderer: %s", SDL_GetError());
|
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);
|
memset(scr_lines[y], ' ', CONSOLE_WIDTH);
|
||||||
scr_lines[y][CONSOLE_WIDTH] = 0;
|
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;
|
size_t y;
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(scr_rend, 20, 20, 20, 0);
|
|
||||||
//SDL_RenderSetScale(scr_rend, 0.2f, 0.2f);
|
|
||||||
|
|
||||||
SDL_RenderClear(scr_rend);
|
SDL_RenderClear(scr_rend);
|
||||||
|
|
||||||
for (y = 0; y < CONSOLE_HEIGHT; y++)
|
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)
|
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);
|
die(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,14 @@
|
||||||
// Add new builtin devices here
|
// Add new builtin devices here
|
||||||
//
|
//
|
||||||
|
|
||||||
extern dev_t cpudev, memdev;
|
extern dev_t cpudev, memdev, clockdev, keybdev, screendev;
|
||||||
|
|
||||||
static dev_t *arch_d[] =
|
static dev_t *arch_d[] =
|
||||||
{
|
{
|
||||||
&cpudev,
|
&cpudev,
|
||||||
&memdev,
|
&memdev,
|
||||||
|
&clockdev,
|
||||||
|
&keybdev,
|
||||||
|
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <pc/arch.h>
|
#include <pc/arch.h>
|
||||||
|
|
||||||
#define DEVLEN 32
|
#define DEVLEN 32
|
||||||
#define DEVSLOTS 256
|
#define DEVSLOTS 4096
|
||||||
|
|
||||||
typedef long (*devfn_t)(ctx_t *, dev_t *);
|
typedef long (*devfn_t)(ctx_t *, dev_t *);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue