1
0
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:
julianb0 2019-05-15 22:01:58 +02:00
parent 2ac01c5ae3
commit 8158f4244b
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
4 changed files with 6 additions and 37 deletions

26
INSTRS
View File

@ -1,26 +0,0 @@
# The OS/K Team licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
ADD r ri
%0 = %0 + %1
SUB r ri
%0 = %0 + %1
MUL ri
RDX = hi(%0 * %1)
RAX = lo(%0 * %1)
DIV ri
RDX = RAX % %0
RAX = RAX / %0
INC r
%0 = %0 + 1
DEC r
%0 = %0 - 1
MOV ri ri
%0 = %1

View File

@ -3,10 +3,10 @@
all: k.exe all: k.exe
src = instr/instrs.c karch/arch.c karch/main.c karch/regs.c src = instr/instrs.c karch/decd.c karch/main.c karch/regs.c
obj = $(patsubst %.c,%.o,$(src)) obj = $(patsubst %.c,%.o,$(src))
%.o: %.c instrs/i_arch.h %.o: %.c instrs/i_arch.h */*.h
@gcc -O2 -Wall -I./karch -c $< -o $@ @gcc -O2 -Wall -I./karch -c $< -o $@
instrs/i_arch.h: instr/INSTRS instr/instrs.py instrs/i_arch.h: instr/INSTRS instr/instrs.py

View File

@ -7,7 +7,6 @@ add r m
add m r add m r
add m i add m i
add m m add m m
%0 = %0 + %1
sub r r sub r r
sub r i sub r i
@ -15,25 +14,22 @@ sub r m
sub m r sub m r
sub m i sub m i
sub m m sub m m
%0 = %0 + %1
# rdx = hi(rax * %0)
# rax = lo(rax * %0)
mul r mul r
mul i mul i
rdx = hi(rax * %0)
rax = lo(rax * %0)
# rdx = rax % %0
# rax = rax / %0
div r div r
div i div i
rdx = rax % %0
rax = rax / %0
inc r inc r
inc m inc m
%0 = %0 + 1
dec r dec r
dec m dec m
%0 = %0 - 1
mov r r mov r r
mov r i mov r i
@ -41,5 +37,4 @@ mov r m
mov m r mov m r
mov m i mov m i
mov m m mov m m
%0 = %1