An emulator, assembler, and disassembler for the Sega Game Gear
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

56 lines
1.1 KiB

  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 <stdio.h>
  5. #include "state.h"
  6. /* Enums */
  7. typedef enum {
  8. ET_INCLUDE,
  9. ET_PREPROC
  10. } ASMErrorType;
  11. typedef enum {
  12. ED_INC_BAD_ARG,
  13. ED_INC_RECURSION,
  14. ED_INC_FILE_READ,
  15. ED_PP_UNKNOWN,
  16. ED_PP_DUPLICATE,
  17. ED_PP_NO_ARG,
  18. ED_PP_BAD_ARG
  19. } ASMErrorDesc;
  20. /* Strings */
  21. static const char *asm_error_types[] = {
  22. "include directive",
  23. "preprocessor"
  24. };
  25. static const char *asm_error_descs[] = {
  26. "missing or invalid argument",
  27. "infinite recursion detected",
  28. "couldn't read included file",
  29. "unknown directive",
  30. "multiple values for directive",
  31. "missing argument for directive",
  32. "invalid argument for directive"
  33. };
  34. /* Structs */
  35. typedef struct ErrorInfo ErrorInfo;
  36. /* Functions */
  37. ErrorInfo* error_info_create(const ASMLine*, ASMErrorType, ASMErrorDesc);
  38. void error_info_append(ErrorInfo*, const ASMLine*);
  39. void error_info_print(const ErrorInfo*, FILE*);
  40. void error_info_destroy(ErrorInfo*);