Emulator core geared towards emulating ZZT and Super ZZT.
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.

zzt.h 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /**
  2. * Copyright (c) 2018 Adrian Siekierka
  3. *
  4. * This file is part of Zeta.
  5. *
  6. * Zeta is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Zeta is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Zeta. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef __ZZT_H__
  20. #define __ZZT_H__
  21. #ifdef EMSCRIPTEN
  22. #define USER_FUNCTION EMSCRIPTEN_KEEPALIVE
  23. #define IMPLEMENT_FUNCTION
  24. #include <emscripten.h>
  25. #else
  26. #define USER_FUNCTION
  27. #define IMPLEMENT_FUNCTION
  28. #endif
  29. #include "cpu.h"
  30. #define MAX_FILES 16
  31. #define TEXT_ADDR(x,y) (0xB8000 + ((y)*160) + ((x)*2))
  32. USER_FUNCTION
  33. int zzt_video_mode(void);
  34. USER_FUNCTION
  35. void zzt_key(int ch, int key);
  36. USER_FUNCTION
  37. void zzt_keyup(int key);
  38. USER_FUNCTION
  39. void zzt_kmod_set(int mod);
  40. USER_FUNCTION
  41. void zzt_kmod_clear(int mod);
  42. USER_FUNCTION
  43. void zzt_joy_set(int button);
  44. USER_FUNCTION
  45. void zzt_joy_axis(int axis, int value /* -127..127 */);
  46. USER_FUNCTION
  47. void zzt_joy_clear(int button);
  48. USER_FUNCTION
  49. void zzt_mouse_set(int button);
  50. USER_FUNCTION
  51. void zzt_mouse_axis(int axis, int value /* 0..639, 0..349 */);
  52. USER_FUNCTION
  53. void zzt_mouse_clear(int button);
  54. USER_FUNCTION
  55. u32 zzt_init(void);
  56. USER_FUNCTION
  57. int zzt_execute(int opcodes);
  58. USER_FUNCTION
  59. u8* zzt_get_ram(void);
  60. USER_FUNCTION
  61. void zzt_mark_frame(void);
  62. USER_FUNCTION
  63. void zzt_mark_timer(void);
  64. IMPLEMENT_FUNCTION
  65. long zeta_time_ms(void);
  66. #define VFS_SEEK_SET 0
  67. #define VFS_SEEK_CUR 1
  68. #define VFS_SEEK_END 2
  69. #define VFS_OPEN_READ 0
  70. #define VFS_OPEN_WRITE 1
  71. #define VFS_OPEN_RW 2
  72. #define VFS_OPEN_TRUNCATE 0x10000
  73. IMPLEMENT_FUNCTION
  74. int vfs_open(const char* filename, int mode);
  75. IMPLEMENT_FUNCTION
  76. int vfs_seek(int handle, int pos, int type);
  77. IMPLEMENT_FUNCTION
  78. int vfs_read(int handle, u8* ptr, int amount);
  79. IMPLEMENT_FUNCTION
  80. int vfs_write(int handle, u8* ptr, int amount);
  81. IMPLEMENT_FUNCTION
  82. int vfs_close(int handle);
  83. IMPLEMENT_FUNCTION
  84. int vfs_findfirst(u8* ptr, u16 mask, char* spec);
  85. IMPLEMENT_FUNCTION
  86. int vfs_findnext(u8* ptr);
  87. #define FEATURE_JOY_CONNECTED 1
  88. #define FEATURE_MOUSE_CONNECTED 2
  89. IMPLEMENT_FUNCTION
  90. int zeta_has_feature(int feature);
  91. IMPLEMENT_FUNCTION
  92. void speaker_on(double freq);
  93. IMPLEMENT_FUNCTION
  94. void speaker_off(void);
  95. #endif /* __ZZT_H__ */