ack/modules/src/read_em/m_C_mnem

74 lines
1.2 KiB
Text
Raw Normal View History

1987-01-06 11:05:35 +00:00
EM_TABLE=../../../etc/em_table
1987-06-30 12:55:30 +00:00
echo "switch(p->em_opcode) {"
echo ' default: EM_error = "Illegal mnemonic"; break;'
1987-01-06 11:05:35 +00:00
for i in - cdflnorswz p b
do
list=`./argtype $i $EM_TABLE`
case $i in
-) args='()'
1987-06-30 12:55:30 +00:00
echo " /* no arguments */"
1987-01-06 11:05:35 +00:00
;;
cdflnorswz)
1987-06-30 12:55:30 +00:00
args='(p->em_cst)'
echo " /* one integer constant argument */"
1987-01-06 11:05:35 +00:00
;;
p)
1987-06-30 12:55:30 +00:00
args='(p->em_pnam)'
echo " /* a procedure name argument */"
1987-01-06 11:05:35 +00:00
;;
b)
: Grumbl, an instruction label as argument is encoded in a sp_cst2
1987-06-30 12:55:30 +00:00
args='((label) (p->em_cst))'
echo " /* An instruction label argument */"
1987-01-06 11:05:35 +00:00
;;
esac
for i in $list
do
1987-06-30 12:55:30 +00:00
echo " case op_$i:"
1987-01-06 11:05:35 +00:00
done
1987-06-30 12:55:30 +00:00
echo " (*C_funcs[p->em_opcode])$args; break;"
1987-01-06 11:05:35 +00:00
done
list=`./argtype g $EM_TABLE`
for i in $list
do
1987-06-30 12:55:30 +00:00
echo " case op_$i:"
1987-01-06 11:05:35 +00:00
done
cat << 'EOF'
1987-06-30 12:55:30 +00:00
/* a "g" argument */
if (p->em_argtype == nof_ptyp) {
switch(p->em_opcode) {
1987-01-06 11:05:35 +00:00
EOF
for i in $list
do
cat << EOF
case op_$i:
1987-06-30 12:55:30 +00:00
C_${i}_dlb(p->em_dlb, p->em_off);
1987-01-06 11:05:35 +00:00
break;
EOF
done
cat << 'EOF'
}
}
1987-06-30 12:55:30 +00:00
else if (p->em_argtype == sof_ptyp) {
switch(p->em_opcode) {
1987-01-06 11:05:35 +00:00
EOF
for i in $list
do
cat << EOF
case op_$i:
1987-06-30 12:55:30 +00:00
C_${i}_dnam(p->em_dnam, p->em_off);
1987-01-06 11:05:35 +00:00
break;
EOF
done
cat << 'EOF'
}
}
1987-06-30 12:55:30 +00:00
else /*argtype == cst_ptyp */ {
(*C_funcs[p->em_opcode])(p->em_cst);
break;
}
1987-01-06 11:05:35 +00:00
}
EOF