My Project
|
Implement two functions in this file. NOTE: One of the data structures is missing several entries. Add the required entries to that data structure. More...
Macros | |
#define | nCond 4 |
#define | zCond 2 |
#define | pCond 1 |
Functions | |
name_val_t * | util_bin_search (name_val_t map[], int numNames, const char *name) |
int | util_get_opcode (const char *name) |
int | util_is_valid_label (const char *s) |
int | util_get_reg (const char *regStr) |
int | util_parse_cond (const char *ccStr) |
Implement two function in this file
name_val_t* util_bin_search | ( | name_val_t | map[], |
int | numNames, | ||
const char * | name | ||
) |
int util_get_opcode | ( | const char * | name | ) |
Get the opcode associated with an LC3 op (e.g. "ADD")
name | - name of operand |
int util_get_reg | ( | const char * | regStr | ) |
Determine if the string represents a valid register specification A register is specified by the letter 'R' (case insesitive) followed by a digit 0 to 7.
regStr | - the string to check |
int util_is_valid_label | ( | const char * | s | ) |
int util_parse_cond | ( | const char * | condCodeStr | ) |
Determine the condition code associated with the string. The string consists of of 0 to 3 three characters, with no more that one each character from the set 'nzp' (case insensitive). The values must follow that order. That is, if 'n' is present it MUST proceed 'z' and/or 'p'. If 'z' is present, in must preceed 'p'.
condCodeStr | - the string to parse (e.g. "zp") |