An emulator, assembler, and disassembler for the Sega Game Gear
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

parse_util.h 1.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. Released under the terms of the MIT License. See LICENSE for details. */
  3. #pragma once
  4. #include <stdbool.h>
  5. #include <stdint.h>
  6. #include "inst_args.h"
  7. #include "state.h"
  8. #define dparse__Bool dparse_bool
  9. /* Structs */
  10. typedef struct {
  11. const char *arg;
  12. ssize_t size;
  13. ASMDefineTable *deftable;
  14. } ASMArgParseInfo;
  15. /* Functions */
  16. /* General parsers */
  17. bool parse_bool(bool*, const char*, ssize_t);
  18. bool parse_uint32_t(uint32_t*, const char*, ssize_t);
  19. bool parse_string(char**, size_t*, const char*, ssize_t);
  20. bool parse_bytes(uint8_t**, size_t*, const char*, ssize_t);
  21. /* Instruction argument parsers */
  22. bool argparse_register(ASMArgRegister*, ASMArgParseInfo);
  23. bool argparse_condition(ASMArgCondition*, ASMArgParseInfo);
  24. bool argparse_immediate(ASMArgImmediate*, ASMArgParseInfo);
  25. bool argparse_indirect(ASMArgIndirect*, ASMArgParseInfo);
  26. bool argparse_indexed(ASMArgIndexed*, ASMArgParseInfo);
  27. bool argparse_port(ASMArgPort*, ASMArgParseInfo);
  28. /* Preprocessor directive parsers */
  29. bool dparse_bool(bool*, const ASMLine*, const char*);
  30. bool dparse_uint32_t(uint32_t*, const ASMLine*, const char*);
  31. bool dparse_uint16_t(uint16_t*, const ASMLine*, const char*);
  32. bool dparse_uint8_t(uint8_t*, const ASMLine*, const char*);
  33. bool dparse_rom_size(uint32_t*, const ASMLine*, const char*);
  34. bool dparse_region_string(uint8_t*, const ASMLine*, const char*);
  35. bool dparse_size_code(uint8_t*, const ASMLine*, const char*);