/* エラー番号とエラーメッセージを設定する */
void setcerr(int num, const char *val)
{
- assert(&cerr != NULL && num > 0);
+ assert(cerr != NULL && num > 0);
cerrno = num;
cerrmsg = malloc(MSGSIZE + 1);
/* エラー番号からメッセージを返す */
char *getcerrmsg(int num)
{
- assert(&cerr != NULL && num > 0);
+ assert(cerr != NULL && num > 0);
int i = 0;
CERRARRAY *ptr;
{ "POP", R_, 0x7100 },
{ "CALL", ADR_X, 0x8000 },
{ "SVC", ADR_X, 0xF000 },
- { "RET", NONE, 0x8100 }
+ { "RET", NONE, 0x8100 },
};
int cmdcodesize = ARRAYSIZE(cmdcodearray);
#include "casl2.h"
#include "assemble.h"
-/*マクロ命令「IN IBUF,LEN」をメモリに書込
- PUSH 0,GR1
- PUSH 0,GR2
- LAD GR1,IBUF
- LAD GR2,LEN
- SVC 1
- POP GR2
- POP GR1
-*/
+/* マクロ命令「IN IBUF,LEN」をメモリに書込 */
+/* PUSH 0,GR1 */
+/* PUSH 0,GR2 */
+/* LAD GR1,IBUF */
+/* LAD GR2,LEN */
+/* SVC 1 */
+/* POP GR2 */
+/* POP GR1 */
bool writeIN(const char *ibuf, const char *len, PASS pass)
{
bool status = false;
return status;
}
-/* マクロ命令「OUT OBUF,LEN」をメモリに書込
- PUSH 0,GR1
- PUSH 0,GR2
- LAD GR1,OBUF
- LD GR2,LEN
- SVC 2
- LAD GR1,=#A
- LAD GR2,1
- SVC 2
- POP GR2
- POP GR1
-*/
+/* マクロ命令「OUT OBUF,LEN」をメモリに書込 */
+/* PUSH 0,GR1 */
+/* PUSH 0,GR2 */
+/* LAD GR1,OBUF */
+/* LAD GR2,LEN */
+/* SVC 2 */
+/* LAD GR1,=#A */
+/* LAD GR2,1 */
+/* SVC 2 */
+/* POP GR2 */
+/* POP GR1 */
bool writeOUT(const char *obuf, const char *len, PASS pass)
{
bool status = false;
/* LAD GR1,OBUF */
writememory(0x1210, ptr++, pass);
writememory(getadr(prog, obuf, pass), ptr++, pass);
- /* LD GR2,OLEN */
- writememory(0x1020, ptr++, pass);
+ /* LAD GR2,OLEN */
+ writememory(0x1220, ptr++, pass);
writememory(getadr(prog, len, pass), ptr++, pass);
/* SVC 2 */
writememory(0xF000, ptr++, pass);
writememory(0x0002, ptr++, pass);
- /* LAD GR1,=#A */
+ /* LAD GR1,=#A */
writememory(0x1210, ptr++, pass);
if(pass == FIRST) {
ptr++;
writememory(lptr, ptr++, pass); /* リテラルのアドレスを書込 */
}
writememory(0xA, lptr++, pass);
- /* LAD GR2,1 */
+ /* LAD GR2,=1 */
writememory(0x1220, ptr++, pass);
- writememory(0x0001, ptr++, pass);
+ if(pass == FIRST) {
+ ptr++;
+ } else {
+ writememory(lptr, ptr++, pass); /* リテラルのアドレスを書込 */
+ }
+ writememory(0x1, lptr++, pass);
/* SVC 2 */
writememory(0xF000, ptr++, pass);
writememory(0x0002, ptr++, pass);
}
/* マクロ命令「RPUSH」をメモリに書き込む
- PUSH 0,GR1
+ PUSH 0,GR1
PUSH 0,GR2
- PUSH 0,GR3
+ PUSH 0,GR3
PUSH 0,GR4
- PUSH 0,GR5
+ PUSH 0,GR5
PUSH 0,GR6
- PUSH 0,GR7
+ PUSH 0,GR7
*/
bool writeRPUSH(PASS pass) {
int i;
}
/* マクロ命令「RPOP」をメモリに書き込む
- POP GR7
- POP GR6
- POP GR5
- POP GR4
- POP GR3
- POP GR3
- POP GR2
- POP GR1
+ POP GR7
+ POP GR6
+ POP GR5
+ POP GR4
+ POP GR3
+ POP GR3
+ POP GR2
+ POP GR1
*/
bool writeRPOP(PASS pass) {
int i;