mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
-
This commit is contained in:
parent
9487374328
commit
18e97904e3
14
Makefile
14
Makefile
@ -1,6 +1,8 @@
|
||||
# The OS/K Team licenses this file to you under the MIT license.
|
||||
# See the LICENSE file in the project root for more information.
|
||||
|
||||
KODIR=ka/obj
|
||||
|
||||
all: kas
|
||||
|
||||
kpc:
|
||||
@ -11,17 +13,17 @@ kas: kpc as/regs.lst as/k-as.py
|
||||
|
||||
DOSK = $(shell find ka -name '*.k')
|
||||
|
||||
vm/a.out: $(DOSK) kas
|
||||
@cd ka && ../as/k-as.py dos.k 0x100000 ../vm/a.out ../vm/a.sym
|
||||
$(KODIR)/a.out: $(DOSK) kas
|
||||
@as/k-as.py ka/dos.k 0x100000 $(KODIR)/a.out $(KODIR)/a.sym
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@cd vm && make clean --no-print-directory
|
||||
@rm -f vm/a.out vm/a.out.sym vm/k.exe vm/stdout.txt as/instrs.lst
|
||||
@rm -f $(KODIR)/a.out $(KODIR)/a.out.sym $(KODIR)/k.exe $(KODIR)/stdout.txt as/instrs.lst
|
||||
|
||||
test: vm/a.out
|
||||
@vm/k.exe vm/a.out vm/a.sym > vm/stdout.txt
|
||||
@rm -f vm/a.out vm/a.sym
|
||||
test: $(KODIR)/a.out
|
||||
@vm/k.exe $(KODIR)/a.out $(KODIR)/a.sym
|
||||
@rm -f $(KODIR)/a.out $(KODIR)/a.sym
|
||||
wc: clean
|
||||
@cat $(shell find -name *.[kch]) $(shell find -name *.py) | wc -l
|
||||
|
||||
|
17
as/k-as.py
17
as/k-as.py
@ -3,6 +3,7 @@
|
||||
# The OS/K Team licenses this file to you under the MIT license.
|
||||
# See the LICENSE file in the project root for more information.
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
@ -31,6 +32,8 @@ b_sym = open(sys.argv[4], "w")
|
||||
|
||||
start_addr = int(sys.argv[2], base=0)
|
||||
|
||||
os.chdir(os.path.dirname(sys.argv[1]))
|
||||
|
||||
def leave():
|
||||
source.close()
|
||||
instrs.close()
|
||||
@ -84,6 +87,14 @@ def is_number(s):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
arith_expr = re.compile(r'((0x[0-9A-Fa-f]+|[0-9]+)\s*([|&^+\-*]|<<|>>))+\s*(0x[0-9A-Fa-f]+|[0-9]+)')
|
||||
|
||||
def arith_eval(s):
|
||||
if arith_expr.match(s):
|
||||
return str(eval(s))
|
||||
return s
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
def parse_lst_regs():
|
||||
@ -450,6 +461,12 @@ def parse_instr(line):
|
||||
word = pdefs[word]
|
||||
# Fall through
|
||||
|
||||
if len(word) == 0:
|
||||
continue
|
||||
|
||||
# arithmetic expressions
|
||||
word = arith_eval(word)
|
||||
|
||||
# memory length prefixes
|
||||
if len(word) > 2 and '[' in word:
|
||||
if word[0] in 'bwlq':
|
||||
|
10
ka/crt/crt.k
Normal file
10
ka/crt/crt.k
Normal file
@ -0,0 +1,10 @@
|
||||
; 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 CRT librairies
|
||||
;
|
||||
include "crt/err/errno.k"
|
||||
include "crt/fmt/format.k"
|
||||
include "crt/str/string.k"
|
||||
|
@ -69,7 +69,7 @@ doprnt:
|
||||
|
||||
.modf_s:
|
||||
; get string address
|
||||
mov rdi, q[rsi + nx2 * 8]
|
||||
mov rdi, q[rsi+nx2*8]
|
||||
inc nx2
|
||||
|
||||
test rdi, rdi
|
||||
@ -85,7 +85,7 @@ doprnt:
|
||||
jmp .print_string
|
||||
|
||||
.modf_c:
|
||||
mov ax0, q[rsi + nx2 * 8]
|
||||
mov ax0, q[rsi+nx2*8]
|
||||
inc nx2
|
||||
call .doput
|
||||
jmp .main_loop
|
||||
@ -120,7 +120,7 @@ doprnt:
|
||||
|
||||
; assume modifier already set up ax2
|
||||
mov ax0, rsp
|
||||
mov ax1, q[rsi + nx2 * 8]
|
||||
mov ax1, q[rsi+nx2*8]
|
||||
call itoa
|
||||
inc nx2
|
||||
|
||||
|
23
ka/dos.k
23
ka/dos.k
@ -14,27 +14,14 @@ _start:
|
||||
hlt
|
||||
jmp .1
|
||||
|
||||
;
|
||||
; Preprocessor misc.
|
||||
;
|
||||
include "inc/limits.k"
|
||||
|
||||
;
|
||||
; Include librairies
|
||||
;
|
||||
include "crt/err/errno.k"
|
||||
include "crt/fmt/format.k"
|
||||
include "crt/str/string.k"
|
||||
|
||||
;
|
||||
; Include drivers
|
||||
;
|
||||
include "sys/cpudev.k"
|
||||
include "sys/memdev.k"
|
||||
include "crt/crt.k"
|
||||
|
||||
;
|
||||
; Disk Operating System
|
||||
;
|
||||
include "tests.k"
|
||||
include "main.k"
|
||||
include "sys/cpudev.k"
|
||||
include "sys/memdev.k"
|
||||
include "sys/tests.k"
|
||||
include "sys/main.k"
|
||||
|
||||
|
0
ka/obj/.placeholder
Normal file
0
ka/obj/.placeholder
Normal file
@ -43,7 +43,7 @@ void console_init(ctx_t *ctx)
|
||||
TTF_Init();
|
||||
|
||||
scr_font = TTF_OpenFont
|
||||
("console_font.ttf", 16);
|
||||
("fn/console_font.ttf", 16);
|
||||
|
||||
if (scr_font == NULL)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user