burn 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. data/LICENSE +621 -0
  2. data/README.md +467 -0
  3. data/Rakefile +1 -0
  4. data/bin/burn +14 -0
  5. data/lib/burn/builder.rb +65 -0
  6. data/lib/burn/cli.rb +187 -0
  7. data/lib/burn/debug.rb +25 -0
  8. data/lib/burn/dsl/channel_stream.rb +105 -0
  9. data/lib/burn/dsl/declare.rb +42 -0
  10. data/lib/burn/dsl/dsl_base.rb +31 -0
  11. data/lib/burn/dsl/music.rb +36 -0
  12. data/lib/burn/dsl/note.rb +125 -0
  13. data/lib/burn/dsl/scene.rb +278 -0
  14. data/lib/burn/dsl/sound.rb +30 -0
  15. data/lib/burn/dsl/sound_effect.rb +91 -0
  16. data/lib/burn/dsl.rb +8 -0
  17. data/lib/burn/generator/assembly_music.rb +47 -0
  18. data/lib/burn/generator/assembly_sound_effect.rb +33 -0
  19. data/lib/burn/generator/c_source.rb +54 -0
  20. data/lib/burn/generator/template/mus_template.s +49 -0
  21. data/lib/burn/generator/template/template.c +88 -0
  22. data/lib/burn/generator.rb +3 -0
  23. data/lib/burn/tools/mac/cc65/asminc/_file.inc +27 -0
  24. data/lib/burn/tools/mac/cc65/asminc/_heap.inc +35 -0
  25. data/lib/burn/tools/mac/cc65/asminc/apple2.inc +64 -0
  26. data/lib/burn/tools/mac/cc65/asminc/atari.inc +1175 -0
  27. data/lib/burn/tools/mac/cc65/asminc/atari.mac +59 -0
  28. data/lib/burn/tools/mac/cc65/asminc/atmos.inc +110 -0
  29. data/lib/burn/tools/mac/cc65/asminc/c128.inc +214 -0
  30. data/lib/burn/tools/mac/cc65/asminc/c16.inc +9 -0
  31. data/lib/burn/tools/mac/cc65/asminc/c64.inc +212 -0
  32. data/lib/burn/tools/mac/cc65/asminc/cbm.mac +50 -0
  33. data/lib/burn/tools/mac/cc65/asminc/cbm510.inc +182 -0
  34. data/lib/burn/tools/mac/cc65/asminc/cbm610.inc +110 -0
  35. data/lib/burn/tools/mac/cc65/asminc/cbm_filetype.inc +34 -0
  36. data/lib/burn/tools/mac/cc65/asminc/cpu.mac +24 -0
  37. data/lib/burn/tools/mac/cc65/asminc/ctype.inc +29 -0
  38. data/lib/burn/tools/mac/cc65/asminc/em-error.inc +49 -0
  39. data/lib/burn/tools/mac/cc65/asminc/em-kernel.inc +106 -0
  40. data/lib/burn/tools/mac/cc65/asminc/errno.inc +36 -0
  41. data/lib/burn/tools/mac/cc65/asminc/fcntl.inc +21 -0
  42. data/lib/burn/tools/mac/cc65/asminc/generic.mac +55 -0
  43. data/lib/burn/tools/mac/cc65/asminc/get_tv.inc +22 -0
  44. data/lib/burn/tools/mac/cc65/asminc/joy-error.inc +44 -0
  45. data/lib/burn/tools/mac/cc65/asminc/joy-kernel.inc +85 -0
  46. data/lib/burn/tools/mac/cc65/asminc/longbranch.mac +88 -0
  47. data/lib/burn/tools/mac/cc65/asminc/lynx.inc +279 -0
  48. data/lib/burn/tools/mac/cc65/asminc/modload.inc +78 -0
  49. data/lib/burn/tools/mac/cc65/asminc/mouse-kernel.inc +180 -0
  50. data/lib/burn/tools/mac/cc65/asminc/nes.inc +93 -0
  51. data/lib/burn/tools/mac/cc65/asminc/o65.inc +150 -0
  52. data/lib/burn/tools/mac/cc65/asminc/opcodes.inc +509 -0
  53. data/lib/burn/tools/mac/cc65/asminc/pet.inc +54 -0
  54. data/lib/burn/tools/mac/cc65/asminc/plus4.inc +86 -0
  55. data/lib/burn/tools/mac/cc65/asminc/ser-error.inc +54 -0
  56. data/lib/burn/tools/mac/cc65/asminc/ser-kernel.inc +162 -0
  57. data/lib/burn/tools/mac/cc65/asminc/signal.inc +57 -0
  58. data/lib/burn/tools/mac/cc65/asminc/smc.inc +245 -0
  59. data/lib/burn/tools/mac/cc65/asminc/stdio.inc +70 -0
  60. data/lib/burn/tools/mac/cc65/asminc/supervision.inc +76 -0
  61. data/lib/burn/tools/mac/cc65/asminc/tgi-error.inc +52 -0
  62. data/lib/burn/tools/mac/cc65/asminc/tgi-kernel.inc +234 -0
  63. data/lib/burn/tools/mac/cc65/asminc/tgi-vectorfont.inc +70 -0
  64. data/lib/burn/tools/mac/cc65/asminc/time.inc +59 -0
  65. data/lib/burn/tools/mac/cc65/asminc/utsname.inc +46 -0
  66. data/lib/burn/tools/mac/cc65/asminc/vic20.inc +75 -0
  67. data/lib/burn/tools/mac/cc65/asminc/zeropage.inc +26 -0
  68. data/lib/burn/tools/mac/cc65/bin/ca65 +0 -0
  69. data/lib/burn/tools/mac/cc65/bin/cc65 +0 -0
  70. data/lib/burn/tools/mac/cc65/bin/ld65 +0 -0
  71. data/lib/burn/tools/other/cc65/asminc/_file.inc +27 -0
  72. data/lib/burn/tools/other/cc65/asminc/_heap.inc +35 -0
  73. data/lib/burn/tools/other/cc65/asminc/apple2.inc +64 -0
  74. data/lib/burn/tools/other/cc65/asminc/atari.inc +1175 -0
  75. data/lib/burn/tools/other/cc65/asminc/atari.mac +59 -0
  76. data/lib/burn/tools/other/cc65/asminc/atmos.inc +110 -0
  77. data/lib/burn/tools/other/cc65/asminc/c128.inc +214 -0
  78. data/lib/burn/tools/other/cc65/asminc/c16.inc +9 -0
  79. data/lib/burn/tools/other/cc65/asminc/c64.inc +212 -0
  80. data/lib/burn/tools/other/cc65/asminc/cbm.mac +50 -0
  81. data/lib/burn/tools/other/cc65/asminc/cbm510.inc +182 -0
  82. data/lib/burn/tools/other/cc65/asminc/cbm610.inc +110 -0
  83. data/lib/burn/tools/other/cc65/asminc/cbm_filetype.inc +34 -0
  84. data/lib/burn/tools/other/cc65/asminc/cpu.mac +24 -0
  85. data/lib/burn/tools/other/cc65/asminc/ctype.inc +29 -0
  86. data/lib/burn/tools/other/cc65/asminc/em-error.inc +49 -0
  87. data/lib/burn/tools/other/cc65/asminc/em-kernel.inc +106 -0
  88. data/lib/burn/tools/other/cc65/asminc/errno.inc +36 -0
  89. data/lib/burn/tools/other/cc65/asminc/fcntl.inc +21 -0
  90. data/lib/burn/tools/other/cc65/asminc/generic.mac +55 -0
  91. data/lib/burn/tools/other/cc65/asminc/get_tv.inc +22 -0
  92. data/lib/burn/tools/other/cc65/asminc/joy-error.inc +44 -0
  93. data/lib/burn/tools/other/cc65/asminc/joy-kernel.inc +85 -0
  94. data/lib/burn/tools/other/cc65/asminc/longbranch.mac +88 -0
  95. data/lib/burn/tools/other/cc65/asminc/lynx.inc +279 -0
  96. data/lib/burn/tools/other/cc65/asminc/modload.inc +78 -0
  97. data/lib/burn/tools/other/cc65/asminc/mouse-kernel.inc +180 -0
  98. data/lib/burn/tools/other/cc65/asminc/nes.inc +93 -0
  99. data/lib/burn/tools/other/cc65/asminc/o65.inc +150 -0
  100. data/lib/burn/tools/other/cc65/asminc/opcodes.inc +509 -0
  101. data/lib/burn/tools/other/cc65/asminc/pet.inc +54 -0
  102. data/lib/burn/tools/other/cc65/asminc/plus4.inc +86 -0
  103. data/lib/burn/tools/other/cc65/asminc/ser-error.inc +54 -0
  104. data/lib/burn/tools/other/cc65/asminc/ser-kernel.inc +162 -0
  105. data/lib/burn/tools/other/cc65/asminc/signal.inc +57 -0
  106. data/lib/burn/tools/other/cc65/asminc/smc.inc +245 -0
  107. data/lib/burn/tools/other/cc65/asminc/stdio.inc +70 -0
  108. data/lib/burn/tools/other/cc65/asminc/supervision.inc +76 -0
  109. data/lib/burn/tools/other/cc65/asminc/tgi-error.inc +52 -0
  110. data/lib/burn/tools/other/cc65/asminc/tgi-kernel.inc +234 -0
  111. data/lib/burn/tools/other/cc65/asminc/tgi-vectorfont.inc +70 -0
  112. data/lib/burn/tools/other/cc65/asminc/time.inc +59 -0
  113. data/lib/burn/tools/other/cc65/asminc/utsname.inc +46 -0
  114. data/lib/burn/tools/other/cc65/asminc/vic20.inc +75 -0
  115. data/lib/burn/tools/other/cc65/asminc/zeropage.inc +26 -0
  116. data/lib/burn/tools/other/cc65/bin/ca65 +0 -0
  117. data/lib/burn/tools/other/cc65/bin/cc65 +0 -0
  118. data/lib/burn/tools/other/cc65/bin/ld65 +0 -0
  119. data/lib/burn/tools/win/cc65/asminc/_file.inc +27 -0
  120. data/lib/burn/tools/win/cc65/asminc/_heap.inc +35 -0
  121. data/lib/burn/tools/win/cc65/asminc/apple2.inc +64 -0
  122. data/lib/burn/tools/win/cc65/asminc/atari.inc +1101 -0
  123. data/lib/burn/tools/win/cc65/asminc/atmos.inc +31 -0
  124. data/lib/burn/tools/win/cc65/asminc/c128.inc +213 -0
  125. data/lib/burn/tools/win/cc65/asminc/c16.inc +9 -0
  126. data/lib/burn/tools/win/cc65/asminc/c64.inc +212 -0
  127. data/lib/burn/tools/win/cc65/asminc/cbm510.inc +182 -0
  128. data/lib/burn/tools/win/cc65/asminc/cbm610.inc +110 -0
  129. data/lib/burn/tools/win/cc65/asminc/ctype.inc +29 -0
  130. data/lib/burn/tools/win/cc65/asminc/em-error.inc +44 -0
  131. data/lib/burn/tools/win/cc65/asminc/em-kernel.inc +100 -0
  132. data/lib/burn/tools/win/cc65/asminc/errno.inc +36 -0
  133. data/lib/burn/tools/win/cc65/asminc/fcntl.inc +21 -0
  134. data/lib/burn/tools/win/cc65/asminc/get_tv.inc +22 -0
  135. data/lib/burn/tools/win/cc65/asminc/joy-error.inc +44 -0
  136. data/lib/burn/tools/win/cc65/asminc/joy-kernel.inc +85 -0
  137. data/lib/burn/tools/win/cc65/asminc/lynx.inc +273 -0
  138. data/lib/burn/tools/win/cc65/asminc/modload.inc +78 -0
  139. data/lib/burn/tools/win/cc65/asminc/mouse-kernel.inc +179 -0
  140. data/lib/burn/tools/win/cc65/asminc/nes.inc +93 -0
  141. data/lib/burn/tools/win/cc65/asminc/o65.inc +135 -0
  142. data/lib/burn/tools/win/cc65/asminc/pet.inc +45 -0
  143. data/lib/burn/tools/win/cc65/asminc/plus4.inc +87 -0
  144. data/lib/burn/tools/win/cc65/asminc/rs232.inc +19 -0
  145. data/lib/burn/tools/win/cc65/asminc/ser-error.inc +50 -0
  146. data/lib/burn/tools/win/cc65/asminc/ser-kernel.inc +161 -0
  147. data/lib/burn/tools/win/cc65/asminc/signal.inc +57 -0
  148. data/lib/burn/tools/win/cc65/asminc/stdio.inc +70 -0
  149. data/lib/burn/tools/win/cc65/asminc/supervision.inc +76 -0
  150. data/lib/burn/tools/win/cc65/asminc/tgi-error.inc +48 -0
  151. data/lib/burn/tools/win/cc65/asminc/tgi-kernel.inc +183 -0
  152. data/lib/burn/tools/win/cc65/asminc/tgi-mode.inc +48 -0
  153. data/lib/burn/tools/win/cc65/asminc/time.inc +59 -0
  154. data/lib/burn/tools/win/cc65/asminc/utsname.inc +46 -0
  155. data/lib/burn/tools/win/cc65/asminc/vic20.inc +77 -0
  156. data/lib/burn/tools/win/cc65/asminc/zeropage.inc +22 -0
  157. data/lib/burn/tools/win/cc65/bin/ca65.exe +0 -0
  158. data/lib/burn/tools/win/cc65/bin/cc65.exe +0 -0
  159. data/lib/burn/tools/win/cc65/bin/ld65.exe +0 -0
  160. data/lib/burn/util/os.rb +38 -0
  161. data/lib/burn/util/patternizer.rb +62 -0
  162. data/lib/burn/util/pxes.rb +180 -0
  163. data/lib/burn/util/server.rb +21 -0
  164. data/lib/burn/util.rb +4 -0
  165. data/lib/burn/version.rb +3 -0
  166. data/lib/burn/workspace_default/asset/crt0.s +260 -0
  167. data/lib/burn/workspace_default/asset/famitone.s +1031 -0
  168. data/lib/burn/workspace_default/asset/mus_instruments.s +50 -0
  169. data/lib/burn/workspace_default/asset/music.s +3 -0
  170. data/lib/burn/workspace_default/asset/nes.cfg +83 -0
  171. data/lib/burn/workspace_default/asset/neslib.h +213 -0
  172. data/lib/burn/workspace_default/asset/neslib.s +923 -0
  173. data/lib/burn/workspace_default/asset/runtime.lib +0 -0
  174. data/lib/burn/workspace_default/asset/sounds.s +143 -0
  175. data/lib/burn/workspace_default/asset/test.h +22 -0
  176. data/lib/burn/workspace_default/asset/tileset.chr +0 -0
  177. data/lib/burn/workspace_default/release/js/emulator.html +42 -0
  178. data/lib/burn/workspace_default/release/js/js/dynamicaudio-89ba58da476270a9b630.min.js +1 -0
  179. data/lib/burn/workspace_default/release/js/js/jquery-1.4.2.min.js +154 -0
  180. data/lib/burn/workspace_default/release/js/js/jsnes-4e7a7260aa.js +7149 -0
  181. data/lib/burn/workspace_default/release/js/swf/dynamicaudio.swf +0 -0
  182. data/lib/burn/workspace_default/scripts/compile.bat +30 -0
  183. data/lib/burn/workspace_default/scripts/compile.sh +30 -0
  184. data/lib/burn.rb +11 -0
  185. data/test/helper.rb +8 -0
  186. data/test/runner.rb +2 -0
  187. data/test/test_burn.rb +14 -0
  188. data/test/test_dsl.rb +22 -0
  189. data/test/test_pxes.rb +48 -0
  190. metadata +270 -0
@@ -0,0 +1,50 @@
1
+ music_instruments:
2
+ @ins:
3
+ .word @env_default,@env_default,@env_default
4
+ .byte $30,$00
5
+ .word @env_vol0,@env_default,@env_default
6
+ .byte $30,$00
7
+ .word @env_vol1,@env_default,@env_default
8
+ .byte $30,$00
9
+ .word @env_vol2,@env_default,@env_default
10
+ .byte $70,$00
11
+ .word @env_vol3,@env_arp0,@env_default
12
+ .byte $70,$00
13
+ .word @env_vol3,@env_default,@env_default
14
+ .byte $30,$00
15
+ .word @env_vol4,@env_default,@env_default
16
+ .byte $30,$00
17
+ .word @env_vol2,@env_default,@env_pitch1
18
+ .byte $30,$00
19
+ .word @env_vol5,@env_default,@env_default
20
+ .byte $30,$00
21
+ .word @env_vol2,@env_default,@env_pitch0
22
+ .byte $30,$00
23
+ @env_default:
24
+ .byte $c0,$7f,$00
25
+ @env_vol0:
26
+ .byte $cf,$7f,$00
27
+ @env_vol1:
28
+ .byte $cf,$c5,$c4,$c3,$c3,$c2,$05,$c1,$09,$c0,$7f,$09
29
+ @env_vol2:
30
+ .byte $c6,$c6,$c5,$c4,$c3,$08,$c2,$07,$c1,$0e,$c0,$7f,$0a
31
+ @env_vol3:
32
+ .byte $d7,$01,$d0,$01,$c2,$01,$b7,$01,$b1,$01,$af,$01,$a2,$01,$98,$94,$7f,$00
33
+ @env_vol4:
34
+ .byte $c8,$c3,$c2,$c1,$04,$c0,$7f,$05
35
+ @env_vol5:
36
+ .byte $c5,$c5,$c4,$c4,$c3,$c0,$7f,$05
37
+ @env_arp0:
38
+ .byte $b4
39
+ @env_arp1:
40
+ .byte $c0,$c0,$c3,$c3,$7f,$00
41
+ @env_arp2:
42
+ .byte $c6,$c3,$c0,$7f,$02
43
+ @env_arp3:
44
+ .byte $c0,$01,$c4,$01,$c7,$01,$7f,$00
45
+ @env_arp4:
46
+ .byte $c6,$c6,$c0,$7f,$02
47
+ @env_pitch0:
48
+ .byte $c4,$c0,$c3,$c0,$c2,$c0,$c1,$bb,$b6,$b0,$7f,$00
49
+ @env_pitch1:
50
+ .byte $c0,$0a,$c1,$c2,$c3,$c4,$c3,$c2,$c1,$c0,$7f,$02
@@ -0,0 +1,3 @@
1
+ __@__EXPORT__@__
2
+ .include "mus_instruments.s"
3
+ __@__INCLUDE__@__
@@ -0,0 +1,83 @@
1
+ MEMORY {
2
+ # First 28 bytes of the zero page are used by NES library
3
+
4
+ ZP: start = $28, size = $d8, type = rw, define = yes;
5
+
6
+ # INES Cartridge Header
7
+
8
+ HEADER: start = $0, size = $10, file = %O ,fill = yes;
9
+
10
+ # 2 16K ROM Banks
11
+ # - startup
12
+ # - code
13
+ # - rodata
14
+ # - data (load)
15
+
16
+ PRG: start = $8000, size = $3f00, file = %O ,fill = yes, define = yes;
17
+
18
+ # NROM256
19
+ # PRG: start = $8000, size = $7f00, file = %O ,fill = yes, define = yes;
20
+
21
+ # DPCM Samples at end of the ROM
22
+
23
+ DMC: start = $7f00, size = $fa, file = %O, fill = yes;
24
+
25
+ # NROM256
26
+ # DMC: start = $ff00, size = $fa, file = %O, fill = yes;
27
+
28
+ # Hardware Vectors at end of the ROM
29
+
30
+ VECTORS: start = $7ffa, size = $6, file = %O, fill = yes;
31
+
32
+ # NROM256
33
+ # VECTORS: start = $fffa, size = $6, file = %O, fill = yes;
34
+
35
+ # 1 8K CHR Bank
36
+
37
+ CHR: start = $0000, size = $2000, file = %O, fill = yes;
38
+
39
+ # standard 2K SRAM (-zeropage)
40
+ # $0100 famitone, palette, cpu stack
41
+ # $0200 oam buffer
42
+ # $0300..$800 ca65 stack
43
+
44
+ RAM: start = $0300, size = $0500, define = yes;
45
+
46
+ # Use this definition instead if you going to use extra 8K RAM
47
+ # RAM: start = $6000, size = $2000, define = yes;
48
+ }
49
+
50
+ SEGMENTS {
51
+ HEADER: load = HEADER, type = ro;
52
+ STARTUP: load = PRG, type = ro, define = yes;
53
+ LOWCODE: load = PRG, type = ro, optional = yes;
54
+ INIT: load = PRG, type = ro, define = yes, optional = yes;
55
+ CODE: load = PRG, type = ro, define = yes;
56
+ RODATA: load = PRG, type = ro, define = yes;
57
+ DATA: load = PRG, run = RAM, type = rw, define = yes;
58
+ VECTORS: load = VECTORS, type = rw;
59
+ SAMPLES: load = DMC, type = rw;
60
+ CHARS: load = CHR, type = rw;
61
+ BSS: load = RAM, type = bss, define = yes;
62
+ HEAP: load = RAM, type = bss, optional = yes;
63
+ ZEROPAGE: load = ZP, type = zp;
64
+ }
65
+
66
+ FEATURES {
67
+ CONDES: segment = INIT,
68
+ type = constructor,
69
+ label = __CONSTRUCTOR_TABLE__,
70
+ count = __CONSTRUCTOR_COUNT__;
71
+ CONDES: segment = RODATA,
72
+ type = destructor,
73
+ label = __DESTRUCTOR_TABLE__,
74
+ count = __DESTRUCTOR_COUNT__;
75
+ CONDES: type = interruptor,
76
+ segment = RODATA,
77
+ label = __INTERRUPTOR_TABLE__,
78
+ count = __INTERRUPTOR_COUNT__;
79
+ }
80
+
81
+ SYMBOLS {
82
+ __STACKSIZE__ = $0500; # 5 pages stack
83
+ }
@@ -0,0 +1,213 @@
1
+ //set bg and spr palettes, data is 32 bytes array
2
+
3
+ void __fastcall__ pal_all(const char *data);
4
+
5
+ //set bg palette only, data is 16 bytes array
6
+
7
+ void __fastcall__ pal_bg(const char *data);
8
+
9
+ //set spr palette only, data is 16 bytes array
10
+
11
+ void __fastcall__ pal_spr(const char *data);
12
+
13
+ //set a palette entry, index is 0..31
14
+
15
+ void __fastcall__ pal_col(unsigned char index,unsigned char color);
16
+
17
+ //reset palette to $0f
18
+
19
+ void __fastcall__ pal_clear(void);
20
+
21
+ //set virtual bright, 0 is black, 4 is normal, 8 is white
22
+
23
+ void __fastcall__ pal_bright(unsigned char bright);
24
+
25
+
26
+ //turn off rendering and nmi
27
+
28
+ void __fastcall__ ppu_off(void);
29
+
30
+ //turn on bg, spr, and nmi
31
+
32
+ void __fastcall__ ppu_on_all(void);
33
+
34
+ //turn on bg only and nmi
35
+
36
+ void __fastcall__ ppu_on_bg(void);
37
+
38
+ //turn on spr only and nmi
39
+
40
+ void __fastcall__ ppu_on_spr(void);
41
+
42
+ //set PPU_MASK directly
43
+
44
+ ;void __fastcall__ ppu_mask(unsigned char mask);
45
+
46
+
47
+
48
+ //clear OAM buffer, all the sprites are hidden
49
+
50
+ void __fastcall__ oam_clear(void);
51
+
52
+ //set sprite in OAM buffer, chrnum is tile, attr is attribute, sprid is offset in OAM in bytes
53
+ //returns sprid+4, which is offset for a next sprite
54
+
55
+ unsigned char __fastcall__ oam_spr(unsigned char x,unsigned char y,unsigned char chrnum,unsigned char attr,unsigned char sprid);
56
+
57
+ //set metasprite in OAM buffer
58
+ //meta sprite is a const unsigned char array, it contains four bytes per sprite
59
+ //in order x offset, y offset, tile, attribute
60
+ //x=128 is end of a meta sprite
61
+ //returns sprid+4, which is offset for a next sprite
62
+
63
+ unsigned char __fastcall__ oam_meta_spr(unsigned char x,unsigned char y,unsigned char sprid,const unsigned char *data);
64
+
65
+ //hide all the sprites starting from given offset
66
+
67
+ void __fastcall__ oam_hide_rest(unsigned char sprid);
68
+
69
+
70
+
71
+ //wait NMI and sync to 50hz (with frameskip for NTSC)
72
+
73
+ void __fastcall__ ppu_waitnmi(void);
74
+
75
+
76
+
77
+ //play a music in FamiTone format
78
+
79
+ void __fastcall__ music_play(const unsigned char *data);
80
+
81
+ //stop music
82
+
83
+ void __fastcall__ music_stop(void);
84
+
85
+ //pause and unpause music
86
+
87
+ void __fastcall__ music_pause(unsigned char pause);
88
+
89
+ //play FamiTone sound effect on channel 0..3
90
+
91
+ void __fastcall__ sfx_play(unsigned char sound,unsigned char channel);
92
+
93
+
94
+
95
+ //poll controller and return flags like PAD_LEFT etc, input is pad number (0 or 1)
96
+
97
+ unsigned char __fastcall__ pad_poll(unsigned char pad);
98
+
99
+ //poll controller in trigger mode, a flag is set only on button down, not hold
100
+ //if you need to poll the pad in both normal and trigger mode, poll it in the
101
+ //trigger mode for first, then use pad_state
102
+
103
+ unsigned char __fastcall__ pad_trigger(unsigned char pad);
104
+
105
+ //get previous pad state without polling ports
106
+
107
+ unsigned char __fastcall__ pad_state(unsigned char pad);
108
+
109
+
110
+ //set scroll, including top bits
111
+
112
+ void __fastcall__ scroll(unsigned int x,unsigned int y);
113
+
114
+
115
+
116
+ //select current chr bank for sprites, 0..1
117
+
118
+ void __fastcall__ bank_spr(unsigned char n);
119
+
120
+ //select current chr bank for background, 0..1
121
+
122
+ void __fastcall__ bank_bg(unsigned char n);
123
+
124
+
125
+
126
+ //returns random number 0..255 or 0..65535
127
+
128
+ unsigned char __fastcall__ rand8(void);
129
+ unsigned int __fastcall__ rand16(void);
130
+
131
+ //set random seed
132
+
133
+ void __fastcall__ set_rand(unsigned int seed);
134
+
135
+
136
+
137
+ //set a pointer to update buffer, contents of the buffer is transferred to vram every frame
138
+ //buffer structure is MSB, LSB, byte to write, len is number of entries (not bytes)
139
+ //could be set during rendering, but only takes effect on a new frame
140
+ //number of transferred bytes is limited by vblank time
141
+
142
+ void __fastcall__ set_vram_update(unsigned char len,unsigned char *buf);
143
+
144
+ //set vram pointer to write operations if you need to write some data to vram
145
+ //works only when rendering is turned off
146
+
147
+ void __fastcall__ vram_adr(unsigned int adr);
148
+
149
+ //put a byte at current vram address, works only when rendering is turned off
150
+
151
+ void __fastcall__ vram_put(unsigned char n);
152
+
153
+ //fill a block with a byte at current vram address, works only when rendering is turned off
154
+
155
+ void __fastcall__ vram_fill(unsigned char n,unsigned int len);
156
+
157
+ //set vram autoincrement, 0 for +1 and not 0 for +32
158
+
159
+ void __fastcall__ vram_inc(unsigned char n);
160
+
161
+ //read a block from vram, works only when rendering is turned off
162
+
163
+ void __fastcall__ vram_read(unsigned char *dst,unsigned int adr,unsigned int size);
164
+
165
+ //write a block to vram, works only when rendering is turned off
166
+
167
+ void __fastcall__ vram_write(unsigned char *src,unsigned int adr,unsigned int size);
168
+
169
+
170
+ //unpack a nametable into vram
171
+
172
+ void __fastcall__ unrle_vram(const unsigned char *data,unsigned int vram);
173
+
174
+
175
+
176
+ //like a normal memcpy, but does not return anything
177
+
178
+ void __fastcall__ memcpy(void *dst,void *src,unsigned int len);
179
+
180
+ //like memset, but does not return anything
181
+
182
+ void __fastcall__ memfill(void *dst,unsigned char value,unsigned int len);
183
+
184
+ //delay for N frames
185
+
186
+ void __fastcall__ delay(unsigned char frames);
187
+
188
+
189
+
190
+ #define PAD_A 0x01
191
+ #define PAD_B 0x02
192
+ #define PAD_SELECT 0x04
193
+ #define PAD_START 0x08
194
+ #define PAD_UP 0x10
195
+ #define PAD_DOWN 0x20
196
+ #define PAD_LEFT 0x40
197
+ #define PAD_RIGHT 0x80
198
+
199
+ #define OAM_FLIP_V 0x80
200
+ #define OAM_FLIP_H 0x40
201
+ #define OAM_BEHIND 0x20
202
+
203
+ #define MAX(x1,x2) (x1<x2?x2:x1)
204
+ #define MIN(x1,x2) (x1<x2?x1:x2)
205
+
206
+ #define MASK_SPR 0x10
207
+ #define MASK_BG 0x08
208
+ #define MASK_EDGE_SPR 0x04
209
+ #define MASK_EDGE_BG 0x02
210
+
211
+ #define NULL 0
212
+ #define TRUE 1
213
+ #define FALSE 0