mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-03-06 11:23:39 +00:00
pdp10-opcodes: add pdp10_instruction_from_name() for the assembler
This commit is contained in:
@@ -132,4 +132,6 @@ extern const unsigned int pdp10_num_extended_instructions;
|
||||
|
||||
const struct pdp10_instruction *pdp10_instruction_from_high13(unsigned int high13);
|
||||
|
||||
const struct pdp10_instruction *pdp10_instruction_from_name(const char *name);
|
||||
|
||||
#endif /* PDP10_OPCODES_H */
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <string.h>
|
||||
#include "pdp10-opcodes.h"
|
||||
|
||||
/*
|
||||
@@ -983,3 +984,20 @@ const struct pdp10_instruction *pdp10_instruction_from_high13(unsigned int high1
|
||||
|
||||
return (void*)0;
|
||||
}
|
||||
|
||||
const struct pdp10_instruction *pdp10_instruction_from_name(const char *name)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < pdp10_num_aliases; ++i)
|
||||
if (strcmp(name, pdp10_alias[i].name) == 0)
|
||||
return &pdp10_alias[i];
|
||||
|
||||
for (i = 0; i < pdp10_num_instructions; ++i)
|
||||
if (strcmp(name, pdp10_instruction[i].name) == 0)
|
||||
return &pdp10_instruction[i];
|
||||
|
||||
/* XXX: extended opcodes? */
|
||||
|
||||
return (void*)0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user