Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

206 Zeilen
6.1KB

  1. /* vml.c - GENERATED by build-ml.ps1 from vml.s and vmlwrap.c. Do not edit.
  2. *
  3. * The machine code helpers as a byte array. mlinit() copies them to $C000.
  4. */
  5. #define MLBMOVE 0xc161
  6. #define MLKPOP 0xc237
  7. #define MLLADJ 0xc1e3
  8. #define MLROW 0xc102
  9. #define MLSCRN 0xc000
  10. #define MLSIZE 660
  11. char mlcode[660] = {
  12. 32, 86, 194, 162, 15, 189, 0, 196, 149, 75, 202, 16,
  13. 248, 24, 165, 81, 101, 89, 133, 91, 165, 82, 105, 0,
  14. 133, 92, 165, 91, 10, 133, 93, 165, 92, 42, 133, 94,
  15. 24, 165, 93, 101, 77, 133, 93, 165, 94, 101, 78, 133,
  16. 94, 169, 0, 133, 37, 169, 4, 133, 38, 166, 89, 240,
  17. 14, 24, 165, 37, 105, 40, 133, 37, 144, 2, 230, 38,
  18. 202, 208, 242, 165, 89, 133, 95, 169, 0, 133, 40, 133,
  19. 36, 169, 255, 133, 39, 165, 91, 197, 79, 165, 92, 229,
  20. 80, 176, 114, 160, 0, 177, 93, 133, 251, 200, 177, 93,
  21. 133, 252, 24, 165, 91, 105, 1, 170, 165, 92, 105, 0,
  22. 228, 79, 208, 15, 197, 80, 208, 11, 165, 83, 133, 41,
  23. 165, 84, 133, 42, 76, 155, 192, 160, 2, 177, 93, 56,
  24. 233, 1, 133, 41, 200, 177, 93, 233, 0, 133, 42, 24,
  25. 165, 251, 101, 85, 133, 251, 165, 252, 101, 86, 133, 252,
  26. 56, 165, 41, 229, 251, 170, 165, 42, 229, 252, 144, 10,
  27. 208, 4, 224, 41, 144, 2, 162, 40, 134, 36, 24, 165,
  28. 75, 101, 251, 133, 34, 165, 76, 101, 252, 133, 35, 165,
  29. 95, 197, 87, 208, 4, 165, 88, 133, 39, 32, 21, 193,
  30. 165, 95, 197, 90, 176, 33, 230, 95, 230, 91, 208, 2,
  31. 230, 92, 24, 165, 93, 105, 2, 133, 93, 144, 2, 230,
  32. 94, 24, 165, 37, 105, 40, 133, 37, 144, 2, 230, 38,
  33. 76, 79, 192, 76, 117, 194, 32, 86, 194, 162, 6, 189,
  34. 0, 196, 149, 34, 202, 16, 248, 32, 21, 193, 76, 117,
  35. 194, 165, 40, 9, 32, 160, 39, 145, 37, 136, 16, 251,
  36. 160, 0, 196, 36, 240, 45, 177, 34, 201, 32, 176, 2,
  37. 169, 32, 201, 192, 144, 4, 233, 128, 176, 22, 201, 160,
  38. 144, 4, 233, 64, 176, 14, 201, 96, 144, 4, 233, 32,
  39. 176, 6, 201, 64, 144, 2, 233, 64, 5, 40, 145, 37,
  40. 200, 208, 207, 165, 39, 201, 40, 176, 7, 168, 177, 37,
  41. 73, 128, 145, 37, 96, 32, 86, 194, 173, 0, 196, 133,
  42. 34, 173, 1, 196, 133, 35, 173, 2, 196, 133, 37, 173,
  43. 3, 196, 133, 38, 173, 4, 196, 133, 75, 173, 5, 196,
  44. 133, 76, 165, 37, 197, 34, 165, 38, 229, 35, 144, 52,
  45. 24, 165, 35, 101, 76, 133, 35, 24, 165, 38, 101, 76,
  46. 133, 38, 164, 75, 240, 9, 136, 177, 34, 145, 37, 192,
  47. 0, 208, 247, 166, 76, 240, 18, 198, 35, 198, 38, 160,
  48. 0, 136, 177, 34, 145, 37, 192, 0, 208, 247, 202, 208,
  49. 238, 76, 117, 194, 160, 0, 166, 76, 240, 14, 177, 34,
  50. 145, 37, 200, 208, 249, 230, 35, 230, 38, 202, 208, 242,
  51. 166, 75, 240, 229, 177, 34, 145, 37, 200, 202, 208, 248,
  52. 76, 117, 194, 32, 86, 194, 162, 5, 189, 0, 196, 149,
  53. 75, 202, 16, 248, 165, 75, 133, 34, 165, 76, 133, 35,
  54. 165, 77, 133, 75, 165, 78, 133, 76, 165, 79, 133, 77,
  55. 165, 80, 133, 78, 165, 75, 5, 76, 240, 38, 160, 0,
  56. 24, 177, 34, 101, 77, 145, 34, 200, 177, 34, 101, 78,
  57. 145, 34, 24, 165, 34, 105, 2, 133, 34, 144, 2, 230,
  58. 35, 165, 75, 208, 2, 198, 76, 198, 75, 76, 8, 194,
  59. 76, 117, 194, 120, 165, 198, 240, 22, 162, 0, 173, 119,
  60. 2, 72, 189, 120, 2, 157, 119, 2, 232, 224, 9, 208,
  61. 245, 198, 198, 104, 88, 96, 88, 169, 0, 96, 162, 8,
  62. 181, 34, 157, 16, 196, 202, 16, 248, 162, 21, 181, 75,
  63. 157, 25, 196, 202, 16, 248, 165, 251, 141, 47, 196, 165,
  64. 252, 141, 48, 196, 96, 162, 8, 189, 16, 196, 149, 34,
  65. 202, 16, 248, 162, 21, 189, 25, 196, 149, 75, 202, 16,
  66. 248, 173, 47, 196, 133, 251, 173, 48, 196, 133, 252, 96
  67. };
  68. /* vmlwrap.c - the C side of the machine code helpers. build-ml.ps1 appends
  69. * this to the generated byte array to make vml.c; edit it here.
  70. *
  71. * Parameters go through a block at $c400 (not $cf00: the C stack lives just below $d000), then sys() jumps to the entry.
  72. * On the c64 sys() takes no bank argument: sys(addr, &a, &x, &y).
  73. */
  74. extern char *bfr;
  75. extern unsigned blen;
  76. extern unsigned lptr[];
  77. extern int nlines, top, leftcol;
  78. /* move the code to $c000 and keep power c's heap and stack below it.
  79. must run before malloc() */
  80. mlinit()
  81. {
  82. char *d;
  83. int i;
  84. highmem(0xc000);
  85. d = (char *) 0xc000;
  86. for (i = 0; i < MLSIZE; i++) d[i] = mlcode[i];
  87. return 0;
  88. }
  89. /* call an entry, return what it left in A */
  90. mlgo(addr)
  91. unsigned addr;
  92. {
  93. char a, x, y;
  94. a = 0;
  95. x = 0;
  96. y = 0;
  97. sys(addr, &a, &x, &y);
  98. return a & 255;
  99. }
  100. /* The wrappers fill the parameter block through one pointer instead of
  101. calling a helper per field: every power c function call costs a lot, and
  102. mlscr runs on every key. Words are stored low byte first. */
  103. /* paint one row at screen address dst: len bytes from src, cursor at column
  104. cur (255 = none), rev = 128 for an all reverse row */
  105. mlrow(src, len, dst, cur, rev)
  106. unsigned src, dst;
  107. int len, cur, rev;
  108. {
  109. char *p;
  110. p = (char *) 0xc400;
  111. p[0] = src;
  112. p[1] = src >> 8;
  113. p[2] = len;
  114. p[3] = dst;
  115. p[4] = dst >> 8;
  116. p[5] = cur;
  117. p[6] = rev;
  118. mlgo(MLROW);
  119. return 0;
  120. }
  121. /* paint screen rows r0..r1 from the buffer; the cursor sits at screen row
  122. crow (255 = none), column ccol */
  123. mlscr(r0, r1, crow, ccol)
  124. int r0, r1, crow, ccol;
  125. {
  126. char *p;
  127. unsigned v;
  128. p = (char *) 0xc400;
  129. v = (unsigned) bfr;
  130. p[0] = v;
  131. p[1] = v >> 8;
  132. v = (unsigned) lptr;
  133. p[2] = v;
  134. p[3] = v >> 8;
  135. p[4] = nlines;
  136. p[5] = nlines >> 8;
  137. p[6] = top;
  138. p[7] = top >> 8;
  139. p[8] = blen;
  140. p[9] = blen >> 8;
  141. p[10] = leftcol;
  142. p[11] = leftcol >> 8;
  143. p[12] = crow;
  144. p[13] = ccol;
  145. p[14] = r0;
  146. p[15] = r1;
  147. mlgo(MLSCRN);
  148. return 0;
  149. }
  150. /* memmove: n bytes from 'from' to 'to', overlap safe */
  151. mlmove(from, to, n)
  152. unsigned from, to, n;
  153. {
  154. char *p;
  155. if (n == 0) return 0;
  156. p = (char *) 0xc400;
  157. p[0] = from;
  158. p[1] = from >> 8;
  159. p[2] = to;
  160. p[3] = to >> 8;
  161. p[4] = n;
  162. p[5] = n >> 8;
  163. mlgo(MLBMOVE);
  164. return 0;
  165. }
  166. /* add d to n words starting at address a (line index fix-ups) */
  167. mladj(a, n, d)
  168. unsigned a, n, d;
  169. {
  170. char *p;
  171. if (n == 0) return 0;
  172. p = (char *) 0xc400;
  173. p[0] = a;
  174. p[1] = a >> 8;
  175. p[2] = n;
  176. p[3] = n >> 8;
  177. p[4] = d;
  178. p[5] = d >> 8;
  179. mlgo(MLLADJ);
  180. return 0;
  181. }
  182. /* next key from the kernal buffer, or 0 */
  183. mlkey()
  184. {
  185. return mlgo(MLKPOP);
  186. }

Powered by TurnKey Linux.