projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SVC 2の動作を、領域の最後まで文字を出力するよう修正
[YACASL2.git]
/
src
/
exec.c
diff --git
a/src/exec.c
b/src/exec.c
index
00cee8d
..
c102d32
100644
(file)
--- a/
src/exec.c
+++ b/
src/exec.c
@@
-1,6
+1,9
@@
#include "casl2.h"
#include "exec.h"
#include "casl2.h"
#include "exec.h"
+/* 実行モード: trace, logical, dump */
+EXECMODE execmode = {false, false, false};
+
/* 標準入力から文字データを読込(SVC 1) */
void svcin()
{
/* 標準入力から文字データを読込(SVC 1) */
void svcin()
{
@@
-8,11
+11,10
@@
void svcin()
char *buffer = malloc(INSIZE + 1);
if(fgets(buffer, INSIZE, stdin) == NULL) {
char *buffer = malloc(INSIZE + 1);
if(fgets(buffer, INSIZE, stdin) == NULL) {
- memory[GR[1]] = 0x0;
- memory[GR[2]] = 0x0;
+ memory[GR[1]] = memory[GR[2]] = 0x0;
return;
}
return;
}
- for(i = 0; i <
GR[1] && i <
INSIZE; i++) {
+ for(i = 0; i < INSIZE; i++) {
if(*(buffer + i) == '\0' || *(buffer + i) == '\n') {
--i;
break;
if(*(buffer + i) == '\0' || *(buffer + i) == '\n') {
--i;
break;
@@
-37,12
+39,9
@@
void svcout()
setcerr(203, NULL); /* SVC output - out of Comet II memory */
return;
}
setcerr(203, NULL); /* SVC output - out of Comet II memory */
return;
}
- if((w = memory[GR[1]+i]) == '\0') {
- break;
- }
/* 「文字の組」の符号表に記載された文字と、改行(CR)/タブを表示 */
/* それ以外の文字は、「.」で表す */
/* 「文字の組」の符号表に記載された文字と、改行(CR)/タブを表示 */
/* それ以外の文字は、「.」で表す */
- if((
w
>= 0x20 && w <= 0x7E) || w == 0xA || w == '\t') {
+ if((
(w = memory[GR[1]+i])
>= 0x20 && w <= 0x7E) || w == 0xA || w == '\t') {
putchar((char)w);
} else {
putchar('.');
putchar((char)w);
} else {
putchar('.');
@@
-149,7
+148,7
@@
WORD sla(WORD val0, WORD val1)
last = res & 0x4000;
res <<= 1;
}
last = res & 0x4000;
res <<= 1;
}
- res = sign |
res
;
+ res = sign |
(res & 0x7FFF)
;
/* OFに、レジスタから最後に送り出されたビットの値を設定 */
if(last > 0x0) {
FR += OF;
/* OFに、レジスタから最後に送り出されたビットの値を設定 */
if(last > 0x0) {
FR += OF;