*/
WORD getgr(const char *str, bool is_x)
{
- assert(str != NULL);
WORD r;
/* "GR[0-7]" 以外の文字列では、0xFFFFを返して終了 */
r = (WORD)(*(str+2) - '0');
/* GR0は指標レジスタとして用いることができない */
if(is_x == true && r == 0x0) {
- setcerr(120, NULL); /* GR0 in operand x */
+ setcerr(120, ""); /* GR0 in operand x */
return 0x0;
}
return r;
void assemble_start(const CMDLINE *cmdl, PASS pass)
{
if(cmdl->opd->opdc > 1) {
- setcerr(106, NULL); /* operand count mismatch */
+ setcerr(106, ""); /* operand count mismatch */
return;
}
if(cmdl->label == NULL) {
- setcerr(107, NULL); /* no label in START */
+ setcerr(107, ""); /* no label in START */
return;
}
/* プログラム名の設定 */
void assemble_end(const CMDLINE *cmdl, PASS pass)
{
if(cmdl->opd->opdc > 0) {
- setcerr(106, NULL); /* operand count mismatch */
+ setcerr(106, ""); /* operand count mismatch */
return;
}
/* 1回目のアセンブルの場合は、リテラル領域開始アドレスを設定 */
{
int i;
if(cmdl->opd->opdc != 1) {
- setcerr(106, NULL); /* operand count mismatch */
+ setcerr(106, ""); /* operand count mismatch */
return;
}
for(i = 0; i < atoi(cmdl->opd->opdv[0]); i++) {
{
int i;
if(cmdl->opd->opdc == 0 || cmdl->opd->opdc >= OPDSIZE) {
- setcerr(106, NULL); /* operand count mismatch */
+ setcerr(106, ""); /* operand count mismatch */
return;
}
for(i = 0; i < cmdl->opd->opdc; i++) {
{
char *line = malloc_chk(LINESIZE + 1, "assemble_in.line");
if(cmdl->opd->opdc == 0 || cmdl->opd->opdc > 2) {
- setcerr(106, NULL); /* operand count mismatch */
+ setcerr(106, ""); /* operand count mismatch */
return;
}
assembleline(" PUSH 0,GR1", pass);
{
char *line = malloc_chk(LINESIZE + 1, "assemble_out.line");
if(cmdl->opd->opdc == 0 || cmdl->opd->opdc > 2) {
- setcerr(106, NULL); /* operand count mismatch */
+ setcerr(106, ""); /* operand count mismatch */
return;
}
assembleline(" PUSH 0,GR1", pass);
int i;
char *line = malloc_chk(LINESIZE + 1, "assemble_rpush.line");
if(cmdl->opd->opdc > 0) {
- setcerr(106, NULL); /* operand count mismatch */
+ setcerr(106, ""); /* operand count mismatch */
return;
}
for(i = 1; i <= GRSIZE-1; i++) {
int i;
char *line = malloc_chk(LINESIZE + 1, "assemble_rpop.line");
if(cmdl->opd->opdc > 0) {
- setcerr(106, NULL); /* operand count mismatch */
+ setcerr(106, ""); /* operand count mismatch */
return;
}
for(i = GRSIZE-1; i >= 1; i--) {
break;
}
if(sys->cpu->gr[1] + i > execptr->end) {
- setcerr(208, NULL); /* SVC input - memory overflow */
+ setcerr(208, ""); /* SVC input - memory overflow */
break;
}
sys->memory[sys->cpu->gr[1]+i] = *(buffer + i);
for(i = 0; i < sys->memory[sys->cpu->gr[2]]; i++) {
if(sys->cpu->gr[1] + i > execptr->end) {
- setcerr(209, NULL); /* SVC output - memory overflow */
+ setcerr(209, ""); /* SVC output - memory overflow */
return;
}
/* 「文字の組」の符号表に記載された文字と、改行(CR)/タブを表示 */
do {
/* オペランド数が多すぎる場合はエラー */
if(opd->opdc >= OPDSIZE) {
- setcerr(117, NULL); /* operand is too many */
+ setcerr(117, ""); /* operand is too many */
break;
}
/* 先頭が等号(=)の場合 */
sepc = *sepp;
*sepp = '\0';
if(*q == '\0') {
- setcerr(121, NULL); /* cannot get operand token */
+ setcerr(121, ""); /* cannot get operand token */
break;
}
if(strlen(q) - rcnt > OPDSIZE) {
- setcerr(118, NULL); /* operand length is too long */
+ setcerr(118, ""); /* operand length is too long */
break;
}
opd->opdv[(++opd->opdc)-1] = strdup_chk(q, "opd.opdv[]");
/* 命令とオペランドの取得 */
if(*p == '\n' || *p == '\0') { /* 命令がない場合は、終了 */
if(cmdl->label != NULL) { /* ラベルが定義されていて命令がない場合はエラー */
- setcerr(105, NULL); /* no command in the line */
+ setcerr(105, ""); /* no command in the line */
}
FREE(cmdl);
} else {