flashhdr.c 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. * GTools C compiler
  3. * =================
  4. * source file :
  5. * (on-calc) flashapp header
  6. *
  7. * Copyright 2001-2004 Paul Froissart.
  8. * Credits to Christoph van Wuellen and Matthew Brandt.
  9. * All commercial rights reserved.
  10. *
  11. * This compiler may be redistributed as long there is no
  12. * commercial interest. The compiler must not be redistributed
  13. * without its full sources. This notice must stay intact.
  14. */
  15. //#define TEXT_SEG_SUPPORTED
  16. #ifdef GTDEV
  17. extern const SecureTab SecTab;
  18. const SecureTab *SecTabPtr=&SecTab;
  19. #endif
  20. #ifdef TEXT_SEG_SUPPORTED
  21. /* note that this is only useful to generate the ASM code below */ #ifdef VERYBASIC_OO
  22. /* note that this is only useful to generate the ASM code below */ static void AP_app(pFrame self, EVENT *ev);
  23. /* note that this is only useful to generate the ASM code below */ FRAME(appObj, OO_SYSTEM_FRAME, 0, OO_APP_FLAGS, 3)
  24. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_FLAGS, APP_INTERACTIVE)
  25. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_NAME, "GTC")
  26. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_PROCESS_EVENT, &AP_app)
  27. /* note that this is only useful to generate the ASM code below */ // ATTR(OO_APP_DEFAULT_MENU, &AppMenu )
  28. /* note that this is only useful to generate the ASM code below */ ENDFRAME
  29. /* note that this is only useful to generate the ASM code below */ #else
  30. /* note that this is only useful to generate the ASM code below */ #define H_Compile 0
  31. /* note that this is only useful to generate the ASM code below */ #define H_HELP 100
  32. /* note that this is only useful to generate the ASM code below */ APP_EXTENSION const extensions[] = {
  33. /* note that this is only useful to generate the ASM code below */ /* function name #, help string #, function index */
  34. /* note that this is only useful to generate the ASM code below */ #ifdef HAS_CMDLINE_EXTENSION
  35. /* note that this is only useful to generate the ASM code below */ {OO_APPSTRING+H_Compile, OO_APPSTRING+H_HELP+H_Compile, H_Compile },
  36. /* note that this is only useful to generate the ASM code below */ #endif
  37. /* note that this is only useful to generate the ASM code below */ };
  38. /* note that this is only useful to generate the ASM code below */ void _scr_main();
  39. /* note that this is only useful to generate the ASM code below */ APP_EXT_ENTRY const extEntries[] = {
  40. /* note that this is only useful to generate the ASM code below */ {_scr_main, APP_EXT_PROGRAM},
  41. /* note that this is only useful to generate the ASM code below */ };
  42. /* note that this is only useful to generate the ASM code below */ void AP_app(pFrame self, EVENT *ev);
  43. /* note that this is only useful to generate the ASM code below */ const char *AP_about(AppID self);
  44. /* note that this is only useful to generate the ASM code below */ FRAME(appObj, OO_SYSTEM_FRAME, 0, OO_APP_FLAGS, 10)
  45. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_FLAGS, APP_INTERACTIVE)
  46. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_NAME, "GTC")
  47. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_TOK_NAME, "gtc")
  48. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_PROCESS_EVENT, &AP_app)
  49. /* note that this is only useful to generate the ASM code below */ #ifdef HAS_CMDLINE_EXTENSION
  50. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_EXT_COUNT, 1)
  51. /* note that this is only useful to generate the ASM code below */ #else
  52. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_EXT_COUNT, 0)
  53. /* note that this is only useful to generate the ASM code below */ #endif
  54. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_EXTENSIONS, extensions)
  55. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_EXT_ENTRIES, extEntries)
  56. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APP_ABOUT, &AP_about)
  57. /* note that this is only useful to generate the ASM code below */ #ifdef HAS_CMDLINE_EXTENSION
  58. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APPSTRING+H_Compile, "compile")
  59. /* note that this is only useful to generate the ASM code below */ ATTR(OO_APPSTRING+H_HELP+H_Compile, "COMPILE A C PROGRAM")
  60. /* note that this is only useful to generate the ASM code below */ #endif
  61. /* note that this is only useful to generate the ASM code below */ ENDFRAME
  62. /* note that this is only useful to generate the ASM code below */ #endif
  63. /* note that this is only useful to generate the ASM code below */
  64. /* note that this is only useful to generate the ASM code below */ pFrame pAppObj = (pFrame)&appObj; /* Must be 1st! */
  65. #else
  66. #define CODESEG ".text"
  67. #define DATASEG ".fdat"
  68. #ifdef VERYBASIC_OO
  69. asm(
  70. " .globl appObj\n"
  71. " " CODESEG "\n"
  72. " .align 4\n"
  73. "appObj:\n"
  74. " .long -16777216\n"
  75. " .long 0\n"
  76. " .word 3\n"
  77. " .long 1\n"
  78. " .long 3\n"
  79. "appObjAttr:\n"
  80. " .long 1\n"
  81. " .long 1\n"
  82. " .long 2\n"
  83. " .long __GTC_str\n"
  84. " .long 4\n"
  85. " .long AP_app\n"
  86. "__GTC_str:\n"
  87. " .ascii \"GTC\\0\"\n"
  88. " .align 4\n"
  89. " .globl pAppObj\n"
  90. " " DATASEG "\n"
  91. " .even\n"
  92. "pAppObj:\n"
  93. " .long appObj\n"
  94. " " CODESEG "\n");
  95. #else
  96. asm(
  97. " " CODESEG "\n"
  98. " .even\n"
  99. #ifdef HAS_CMDLINE_EXTENSION
  100. " .globl extensions\n"
  101. "extensions:"
  102. " .long 4096\n"
  103. " .long 4196\n"
  104. " .word 0\n"
  105. " .globl extEntries\n"
  106. " .even\n"
  107. "extEntries:"
  108. " .long _scr_main\n"
  109. " .word 0\n"
  110. #endif
  111. " .globl appObj\n"
  112. " .even\n"
  113. "appObj:"
  114. " .long -16777216\n"
  115. " .long 0\n"
  116. " .word 3\n"
  117. " .long 1\n"
  118. " .long 10\n"
  119. " .even\n"
  120. "appObjAttr:"
  121. " .long 1\n"
  122. " .long 1\n"
  123. " .long 2\n"
  124. " .long MC0\n"
  125. " .long 3\n"
  126. " .long MC1\n"
  127. " .long 4\n"
  128. " .long AP_app\n"
  129. " .long 7\n"
  130. #ifdef HAS_CMDLINE_EXTENSION
  131. " .long 1\n"
  132. " .long 8\n"
  133. " .long extensions\n"
  134. " .long 9\n"
  135. " .long extEntries\n"
  136. #else
  137. " .long 0\n"
  138. #endif
  139. " .long 18\n"
  140. " .long AP_about\n"
  141. #ifdef HAS_CMDLINE_EXTENSION
  142. " .long 4096\n"
  143. " .long MC2\n"
  144. " .long 4196\n"
  145. " .long MC3\n"
  146. #endif
  147. "MC0:"
  148. " .ascii \"GTC\\0\"\n"
  149. "MC1:"
  150. " .ascii \"gtc\\0\"\n"
  151. #ifdef HAS_CMDLINE_EXTENSION
  152. "MC2:"
  153. " .ascii \"compile\\0\"\n"
  154. "MC3:"
  155. " .ascii \"COMPILE A C PROGRAM\\0\"\n"
  156. #endif
  157. " .globl pAppObj\n"
  158. " " DATASEG "\n"
  159. " .even\n"
  160. "pAppObj:"
  161. " .long appObj\n"
  162. " " CODESEG "\n");
  163. #endif
  164. #endif
  165. void _main();
  166. void _scr_main();
  167. #define EV_quit() asm(".word $F800+1166")
  168. void AP_app(pFrame self, EVENT *ev) {
  169. switch (ev->Type) {
  170. case CM_STARTTASK:
  171. _scr_main();
  172. EV_quit();
  173. break;
  174. }
  175. }
  176. const char *AP_about(AppID self) {
  177. return "GTC compiler\n\n(c) 2001-2003 by Paul Froissart\n\nInternal beta i1";
  178. }
  179. void _scr_main() {
  180. _main();
  181. // now redraw the screen... (thanks to PpHd for this code)
  182. // 1) the current application
  183. { WINDOW w;
  184. WinOpen(&w,&(WIN_RECT){0,0,239,127},WF_NOBOLD|WF_NOBORDER);
  185. WinActivate(&w);
  186. WinClose(&w); }
  187. // 2) the status bar
  188. ST_showHelp("");
  189. ST_eraseHelp();
  190. // 3) the black line
  191. #if !defined(_92) && !defined(_V200)
  192. memset(LCD_MEM+30*(100-7),-1,30);
  193. #else
  194. memset(LCD_MEM+30*(128-7),-1,30);
  195. #endif
  196. }
  197. #ifdef GTDEV
  198. #include "gtdevcomm.c"
  199. const SecureTab SecTab = {
  200. 0,
  201. Compile
  202. };
  203. #endif
  204. // vim:ts=4:sw=4