Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
triazo
/
kernel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
3
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0ac748eb
authored
Nov 09, 2015
by
malcolm
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
updated io to use comp
parent
6a3463c7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
10 deletions
src/io.c
src/io.c
View file @
0ac748eb
...
...
@@ -4,14 +4,20 @@
#include "idt.h"
#include "string.h"
#include "term.h"
#include "comp.h"
char
scan_map
[
256
]
=
{
' '
,
'E'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'-'
,
'='
,
'\b'
,
'\t'
,
'q'
,
'w'
,
'e'
,
'r'
,
't'
,
'y'
,
'u'
,
'i'
,
'o'
,
'p'
,
'['
,
']'
,
'\n'
,
'^'
,
'a'
,
's'
,
'd'
,
'f'
,
'g'
,
'h'
,
'j'
,
'k'
,
'l'
,
';'
,
'\''
,
'`'
,
'S'
,
'\\'
,
'z'
,
'x'
,
'c'
,
'v'
,
'b'
,
'n'
,
'm'
,
','
,
'.'
,
'/'
,
'S'
,
'O'
,
'A'
,
' '
,
'C'
,
'F'
,
'F'
,
'F'
,
'F'
,
'F'
,
'F'
,
'F'
,
'F'
,
'F'
,
'F'
,
'L'
,
'L'
,};
char
kb_buf
[
256
];
int
kb_buf_size
;
int
cstack
[
128
];
int
cstack_size
;
void
terminal_writeint
(
int
n
)
{
char
f
[
20
];
itoa
(
n
,
f
);
terminal_writestring
(
f
);
}
void
io_process
(
char
*
s
)
{
...
...
@@ -35,22 +41,42 @@ void io_process(char* s)
else
if
(
strncmp
(
s
,
"push "
,
5
)
==
0
)
{
int
n
=
stoi
(
s
+
5
);
cstack
[
cstack_size
]
=
n
;
cstack_size
++
;
//terminal_writestring("pushed\n");
cpush
(
n
);
}
else
if
(
strncmp
(
s
,
"peek"
,
4
)
==
0
)
{
terminal_writeint
(
cpeek
());
terminal_putchar
(
'\n'
);
}
else
if
(
strncmp
(
s
,
"pop"
,
3
)
==
0
)
{
if
(
cstack_size
==
0
)
terminal_writeint
(
cpeek
());
cpop
();
terminal_putchar
(
'\n'
);
}
else
if
(
strncmp
(
s
,
"add"
,
3
)
==
0
)
{
terminal_writestring
(
"stack empty
\n
"
);
cadd
();
terminal_writeint
(
cpeek
());
terminal_putchar
(
'\n'
);
}
else
else
if
(
strncmp
(
s
,
"mult"
,
3
)
==
0
)
{
terminal_putchar
(
cstack
[
cstack_size
-
1
]
+
48
);
cstack_size
--
;
cmult
(
);
terminal_writeint
(
cpeek
())
;
terminal_putchar
(
'\n'
);
}
else
if
(
strncmp
(
s
,
"sub"
,
3
)
==
0
)
{
csub
();
terminal_writeint
(
cpeek
());
terminal_putchar
(
'\n'
);
}
else
if
(
strncmp
(
s
,
"div"
,
3
)
==
0
)
{
cdiv
();
terminal_writeint
(
cpeek
());
terminal_putchar
(
'\n'
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment