Lua: input.controller_info(): Don't crash with out-of-range port
[lsnes.git] / lua.lyx
blob11785c9a1d07ba8da80195d9d36bb7518c776e82
1 #LyX 2.1 created this file. For more info see http://www.lyx.org/
2 \lyxformat 474
3 \begin_document
4 \begin_header
5 \textclass article
6 \use_default_options true
7 \maintain_unincluded_children false
8 \language english
9 \language_package default
10 \inputencoding auto
11 \fontencoding global
12 \font_roman default
13 \font_sans default
14 \font_typewriter default
15 \font_math auto
16 \font_default_family default
17 \use_non_tex_fonts false
18 \font_sc false
19 \font_osf false
20 \font_sf_scale 100
21 \font_tt_scale 100
22 \graphics default
23 \default_output_format default
24 \output_sync 0
25 \bibtex_command default
26 \index_command default
27 \paperfontsize default
28 \spacing single
29 \use_hyperref true
30 \pdf_bookmarks true
31 \pdf_bookmarksnumbered false
32 \pdf_bookmarksopen false
33 \pdf_bookmarksopenlevel 1
34 \pdf_breaklinks false
35 \pdf_pdfborder false
36 \pdf_colorlinks false
37 \pdf_backref false
38 \pdf_pdfusetitle true
39 \papersize a4paper
40 \use_geometry true
41 \use_package amsmath 1
42 \use_package amssymb 1
43 \use_package cancel 1
44 \use_package esint 1
45 \use_package mathdots 1
46 \use_package mathtools 1
47 \use_package mhchem 1
48 \use_package stackrel 1
49 \use_package stmaryrd 1
50 \use_package undertilde 1
51 \cite_engine basic
52 \cite_engine_type default
53 \biblio_style plain
54 \use_bibtopic false
55 \use_indices false
56 \paperorientation portrait
57 \suppress_date false
58 \justification true
59 \use_refstyle 1
60 \index Hakusana
61 \shortcut idx
62 \color #008000
63 \end_index
64 \leftmargin 2cm
65 \topmargin 2cm
66 \rightmargin 1cm
67 \bottommargin 2cm
68 \headheight 1cm
69 \headsep 1cm
70 \footskip 1cm
71 \secnumdepth 3
72 \tocdepth 3
73 \paragraph_separation indent
74 \paragraph_indentation default
75 \quotes_language english
76 \papercolumns 1
77 \papersides 1
78 \paperpagestyle default
79 \tracking_changes false
80 \output_changes false
81 \html_math_output 0
82 \html_css_as_file 0
83 \html_be_strict false
84 \end_header
86 \begin_body
88 \begin_layout Title
89 lsnes Lua functions reference
90 \end_layout
92 \begin_layout Section
93 Table of contents
94 \end_layout
96 \begin_layout Standard
97 \begin_inset CommandInset toc
98 LatexCommand tableofcontents
100 \end_inset
103 \end_layout
105 \begin_layout Standard
106 \begin_inset Newpage pagebreak
107 \end_inset
110 \end_layout
112 \begin_layout Section
113 Conventions
114 \end_layout
116 \begin_layout Subsection
117 Coordinates:
118 \end_layout
120 \begin_layout Itemize
121 Coordinates increase to right and down.
122 \end_layout
124 \begin_layout Itemize
125 The origin is at top left of game area or buffer.
126 \end_layout
128 \begin_layout Subsection
129 Drawing and contexts
130 \end_layout
132 \begin_layout Itemize
133 Methods that draw something (unless stated otherwise) require a valid rendering
134  context.
135  This context can come in three ways:
136 \end_layout
138 \begin_deeper
139 \begin_layout Enumerate
140 The default rendering context of paint callback (the screen).
141 \end_layout
143 \begin_layout Enumerate
144 The default rendering context of video callback (the video).
145 \end_layout
147 \begin_layout Enumerate
148 Explicitly set rendering context (RENDERCTX:set).
149 \end_layout
151 \end_deeper
152 \begin_layout Itemize
153 The rendering context is always reset when callback ends.
154 \end_layout
156 \begin_layout Subsection
157 Colors
158 \end_layout
160 \begin_layout Standard
161 (Direct) colors can be specified either as numbers or strings.
162 \end_layout
164 \begin_layout Itemize
165 -1 is fully transparent.
166 \end_layout
168 \begin_layout Itemize
169 Non-negative numbers less than 
170 \begin_inset Formula $2^{32}$
171 \end_inset
173  are partially opaque colors (
174 \begin_inset Formula $a*2^{24}+r*2^{16}+g*2^{8}+b$
175 \end_inset
178 \end_layout
180 \begin_deeper
181 \begin_layout Itemize
182 \begin_inset Formula $a$
183 \end_inset
185  is transparency 
186 \begin_inset Formula $0-255$
187 \end_inset
190 \begin_inset Formula $0$
191 \end_inset
193  is fully opaque, 
194 \begin_inset Formula $256$
195 \end_inset
197  would be fully transparent.
198 \end_layout
200 \begin_deeper
201 \begin_layout Itemize
202 Thus, numbers in range 
203 \begin_inset Formula $0-16777215$
204 \end_inset
206  stand for fully opaque colors.
207 \end_layout
209 \end_deeper
210 \begin_layout Itemize
211 \begin_inset Formula $r$
212 \end_inset
215 \begin_inset Formula $g$
216 \end_inset
218  and 
219 \begin_inset Formula $b$
220 \end_inset
222  are intensities of base colors on scale 
223 \begin_inset Formula $0-255$
224 \end_inset
227 \end_layout
229 \end_deeper
230 \begin_layout Itemize
231 Color can also be specified by name as string: The following color names
232  are known: aliceblue antiquewhite antiquewhite1 antiquewhite2 antiquewhite3
233  antiquewhite4 aqua aquamarine aquamarine1 aquamarine2 aquamarine3 aquamarine4
234  azure azure1 azure2 azure3 azure4 beige bisque bisque1 bisque2 bisque3
235  bisque4 black blanchedalmond blue blue1 blue2 blue3 blue4 blueviolet brown
236  brown1 brown2 brown3 brown4 burlywood burlywood1 burlywood2 burlywood3
237  burlywood4 cadet cadetblue cadetblue1 cadetblue2 cadetblue3 cadetblue4
238  chartreuse chartreuse1 chartreuse2 chartreuse3 chartreuse4 chocolate chocolate1
239  chocolate2 chocolate3 chocolate4 coral coral1 coral2 coral3 coral4 cornflowerbl
240 ue cornsilk cornsilk1 cornsilk2 cornsilk3 cornsilk4 crimson cyan cyan1 cyan2
241  cyan3 cyan4 darkblue darkcyan darkgoldenrod darkgoldenrod1 darkgoldenrod2
242  darkgoldenrod3 darkgoldenrod4 darkgray darkgreen darkgrey darkkhaki darkmagenta
243  darkolivegreen darkolivegreen1 darkolivegreen2 darkolivegreen3 darkolivegreen4
244  darkorange darkorange1 darkorange2 darkorange3 darkorange4 darkorchid darkorchi
245 d1 darkorchid2 darkorchid3 darkorchid4 darkred darksalmon darkseagreen darkseagr
246 een1 darkseagreen2 darkseagreen3 darkseagreen4 darkslateblue darkslategray
247  darkslategray1 darkslategray2 darkslategray3 darkslategray4 darkslategrey
248  darkturquoise darkviolet deeppink deeppink1 deeppink2 deeppink3 deeppink4
249  deepskyblue deepskyblue1 deepskyblue2 deepskyblue3 deepskyblue4 dimgray
250  dimgrey dodgerblue dodgerblue1 dodgerblue2 dodgerblue3 dodgerblue4 firebrick
251  firebrick1 firebrick2 firebrick3 firebrick4 floralwhite forestgreen fractal
252  fuchsia gainsboro ghostwhite gold gold1 gold2 gold3 gold4 goldenrod goldenrod1
253  goldenrod2 goldenrod3 goldenrod4 gray gray0 gray1 gray10 gray100 gray11
254  gray12 gray13 gray14 gray15 gray16 gray17 gray18 gray19 gray2 gray20 gray21
255  gray22 gray23 gray24 gray25 gray26 gray27 gray28 gray29 gray3 gray30 gray31
256  gray32 gray33 gray34 gray35 gray36 gray37 gray38 gray39 gray4 gray40 gray41
257  gray42 gray43 gray44 gray45 gray46 gray47 gray48 gray49 gray5 gray50 gray51
258  gray52 gray53 gray54 gray55 gray56 gray57 gray58 gray59 gray6 gray60 gray61
259  gray62 gray63 gray64 gray65 gray66 gray67 gray68 gray69 gray7 gray70 gray71
260  gray72 gray73 gray74 gray75 gray76 gray77 gray78 gray79 gray8 gray80 gray81
261  gray82 gray83 gray84 gray85 gray86 gray87 gray88 gray89 gray9 gray90 gray91
262  gray92 gray93 gray94 gray95 gray96 gray97 gray98 gray99 green green1 green2
263  green3 green4 greenyellow grey grey0 grey1 grey10 grey100 grey11 grey12
264  grey13 grey14 grey15 grey16 grey17 grey18 grey19 grey2 grey20 grey21 grey22
265  grey23 grey24 grey25 grey26 grey27 grey28 grey29 grey3 grey30 grey31 grey32
266  grey33 grey34 grey35 grey36 grey37 grey38 grey39 grey4 grey40 grey41 grey42
267  grey43 grey44 grey45 grey46 grey47 grey48 grey49 grey5 grey50 grey51 grey52
268  grey53 grey54 grey55 grey56 grey57 grey58 grey59 grey6 grey60 grey61 grey62
269  grey63 grey64 grey65 grey66 grey67 grey68 grey69 grey7 grey70 grey71 grey72
270  grey73 grey74 grey75 grey76 grey77 grey78 grey79 grey8 grey80 grey81 grey82
271  grey83 grey84 grey85 grey86 grey87 grey88 grey89 grey9 grey90 grey91 grey92
272  grey93 grey94 grey95 grey96 grey97 grey98 grey99 honeydew honeydew1 honeydew2
273  honeydew3 honeydew4 hotpink hotpink1 hotpink2 hotpink3 hotpink4 indianred
274  indianred1 indianred2 indianred3 indianred4 indigo ivory ivory1 ivory2
275  ivory3 ivory4 khaki khaki1 khaki2 khaki3 khaki4 lavender lavenderblush
276  lavenderblush1 lavenderblush2 lavenderblush3 lavenderblush4 lawngreen lemonchif
277 fon lemonchiffon1 lemonchiffon2 lemonchiffon3 lemonchiffon4 lightblue lightblue1
278  lightblue2 lightblue3 lightblue4 lightcoral lightcyan lightcyan1 lightcyan2
279  lightcyan3 lightcyan4 lightgoldenrod lightgoldenrod1 lightgoldenrod2 lightgolde
280 nrod3 lightgoldenrod4 lightgoldenrodyellow lightgray lightgreen lightgrey
281  lightpink lightpink1 lightpink2 lightpink3 lightpink4 lightsalmon lightsalmon1
282  lightsalmon2 lightsalmon3 lightsalmon4 lightseagreen lightskyblue lightskyblue1
283  lightskyblue2 lightskyblue3 lightskyblue4 lightslateblue lightslategray
284  lightslategrey lightsteelblue lightsteelblue1 lightsteelblue2 lightsteelblue3
285  lightsteelblue4 lightyellow lightyellow1 lightyellow2 lightyellow3 lightyellow4
286  lime limegreen linen magenta magenta1 magenta2 magenta3 magenta4 maroon
287  maroon1 maroon2 maroon3 maroon4 mediumaquamarine mediumblue mediumforestgreen
288  mediumgoldenrod mediumorchid mediumorchid1 mediumorchid2 mediumorchid3
289  mediumorchid4 mediumpurple mediumpurple1 mediumpurple2 mediumpurple3 mediumpurp
290 le4 mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumviole
291 tred midnightblue mintcream mistyrose mistyrose1 mistyrose2 mistyrose3 mistyrose
292 4 moccasin navajowhite navajowhite1 navajowhite2 navajowhite3 navajowhite4
293  navy navyblue oldlace olive olivedrab olivedrab1 olivedrab2 olivedrab3
294  olivedrab4 orange orange1 orange2 orange3 orange4 orangered orangered1
295  orangered2 orangered3 orangered4 orchid orchid1 orchid2 orchid3 orchid4
296  palegoldenrod palegreen palegreen1 palegreen2 palegreen3 palegreen4 paleturquoi
297 se paleturquoise1 paleturquoise2 paleturquoise3 paleturquoise4 palevioletred
298  palevioletred1 palevioletred2 palevioletred3 palevioletred4 papayawhip
299  peachpuff peachpuff1 peachpuff2 peachpuff3 peachpuff4 peru pink pink1 pink2
300  pink3 pink4 plum plum1 plum2 plum3 plum4 powderblue purple purple1 purple2
301  purple3 purple4 red red1 red2 red3 red4 rosybrown rosybrown1 rosybrown2
302  rosybrown3 rosybrown4 royalblue royalblue1 royalblue2 royalblue3 royalblue4
303  saddlebrown salmon salmon1 salmon2 salmon3 salmon4 sandybrown seagreen
304  seagreen1 seagreen2 seagreen3 seagreen4 seashell seashell1 seashell2 seashell3
305  seashell4 sienna sienna1 sienna2 sienna3 sienna4 silver skyblue skyblue1
306  skyblue2 skyblue3 skyblue4 slateblue slateblue1 slateblue2 slateblue3 slateblue
307 4 slategray slategray1 slategray2 slategray3 slategray4 slategrey snow snow1
308  snow2 snow3 snow4 springgreen springgreen1 springgreen2 springgreen3 springgree
309 n4 steelblue steelblue1 steelblue2 steelblue3 steelblue4 tan tan1 tan2 tan3
310  tan4 teal thistle thistle1 thistle2 thistle3 thistle4 tomato tomato1 tomato2
311  tomato3 tomato4 transparent turquoise turquoise1 turquoise2 turquoise3
312  turquoise4 violet violetred violetred1 violetred2 violetred3 violetred4
313  wheat wheat1 wheat2 wheat3 wheat4 white whitesmoke yellow yellow1 yellow2
314  yellow3 yellow4 yellowgreen 
315 \end_layout
317 \begin_layout Itemize
318 The HSL base color names: hsl-<hue><saturation><lightness>.
319 \end_layout
321 \begin_deeper
322 \begin_layout Itemize
323 Hue can be one of: r (red), ry (red-yellow), o (orange, same as red-yellow),
324  y (yellow), yg (yellow-green), g (green), gc (green-cyan), c (cyan), cb
325  (cyan-blue), b (blue), bm (blue-magenta), m (magenta), mr (magenta-red).
326 \end_layout
328 \begin_layout Itemize
329 Saturation is 0-8, where 0 is greyscale and 8 is fully saturated.
330 \end_layout
332 \begin_layout Itemize
333 Lightness is 0-8, where 0 is black and 8 is white.
334 \end_layout
336 \end_deeper
337 \begin_layout Itemize
338 The color names can have a modifier after space (multiple modifiers are
339  allowed, separated by spaces): opaque10, opaque20, opaque25, opaque30,
340  opaque40, opaque50, opaque60, opaque70, opaque75, opaque80, opaque90, opaque,
341  hue{+,-}{1-23}, {saturation,lightness}{+,-}{1-16}.
342 \end_layout
344 \begin_deeper
345 \begin_layout Itemize
346 opaqueness is measured as percentage.
347 \end_layout
349 \begin_layout Itemize
350 Hue adjustments are on 24-step scale.
351 \end_layout
353 \begin_layout Itemize
354 Saturation and lightness adjustments are on 16-step scale.
355 \end_layout
357 \end_deeper
358 \begin_layout Section
359 Special tokens
360 \end_layout
362 \begin_layout Standard
363 These tokens are special, and are expanded while the script is being loaded
364 \end_layout
366 \begin_layout Subsection
367 @@LUA_SCRIPT_FILENAME@@
368 \end_layout
370 \begin_layout Standard
371 Expanded to string token containing path and filename of this Lua script.
372  Handy for referencing other lua scripts or resources that are relative
373  to this Lua script.
374 \end_layout
376 \begin_layout Standard
377 In practicular, this is suitable to be passed as base argument of various
378  functions like loadfile, dofile, resolve_filename, gui.bitmap_load, gui.bitmap_lo
379 ad_png and gui.bitmap_load_pal.
380 \end_layout
382 \begin_layout Section
383 Classes
384 \end_layout
386 \begin_layout Subsection
387 MMAP_STRUCT: Quasi-table mapping emulated memory
388 \end_layout
390 \begin_layout Standard
391 Objects of this class act like tables, except that the values are reflected
392  to and from emulated memory.
393 \end_layout
395 \begin_layout Subsubsection
396 static function new: Create new instance
397 \end_layout
399 \begin_layout Itemize
400 Syntax: mmap memory.mmap.new()
401 \end_layout
403 \begin_layout Itemize
404 Syntax: mmap classes.MMAP_STRUCT.new()
405 \end_layout
407 \begin_layout Itemize
408 Deprecated: mmap memory.map_structure()
409 \end_layout
411 \begin_layout Standard
412 Return value:
413 \end_layout
415 \begin_layout Itemize
416 mmap: MMAP_STRUCT: The created mmap structure.
417 \end_layout
419 \begin_layout Standard
420 Create a new MMAP_STRUCT (with no mappings) and return it.
421 \end_layout
423 \begin_layout Subsubsection
424 operator(): Bind key in mmap structure
425 \end_layout
427 \begin_layout Itemize
428 Syntax: obj(key, {marea, address|addrobj}, type)
429 \end_layout
431 \begin_layout Standard
432 Parameters:
433 \end_layout
435 \begin_layout Itemize
436 obj: MMAP_STRUCT: The structure to manipulate.
437 \end_layout
439 \begin_layout Itemize
440 key: String: The name of the key in array to map.
441 \end_layout
443 \begin_layout Itemize
444 marea: String: The memory area the mapped address is in (default: global
445  memory space).
446 \end_layout
448 \begin_layout Itemize
449 address: Number: The offset of memory addreess, relative to specified memory
450  area or global memory space.
451 \end_layout
453 \begin_layout Itemize
454 addrobj: ADDRESS: The memory address.
455 \end_layout
457 \begin_layout Itemize
458 type: String: The type of data to map.
459 \end_layout
461 \begin_deeper
462 \begin_layout Itemize
463 One of: byte, sbyte, word, sword, hword, shword, dword, sdword, qword, sqword,
464  float or double.
465 \end_layout
467 \end_deeper
468 \begin_layout Standard
469 Bind key <key> in mmap structure <obj> to address <address> (relative to
470  <marea>).
471  The memory address is treated as type <type>.
472 \end_layout
474 \begin_layout Itemize
475 Example: foomap(
476 \begin_inset Quotes eld
477 \end_inset
480 \begin_inset Quotes erd
481 \end_inset
484 \begin_inset Quotes eld
485 \end_inset
487 WRAM
488 \begin_inset Quotes erd
489 \end_inset
491 , 0x2A, 
492 \begin_inset Quotes eld
493 \end_inset
495 sword
496 \begin_inset Quotes erd
497 \end_inset
500 \end_layout
502 \begin_layout Standard
503 This binds signed word at address WRAM+0x2A into key 
504 \begin_inset Quotes eld
505 \end_inset
508 \begin_inset Quotes erd
509 \end_inset
512 \end_layout
514 \begin_layout Standard
515 \begin_inset Newpage pagebreak
516 \end_inset
519 \end_layout
521 \begin_layout Subsection
522 ZIPWRITER: Write .zip files
523 \end_layout
525 \begin_layout Standard
526 This class does writing of .zip files.
527 \end_layout
529 \begin_layout Subsubsection
530 Static function new: Create a new zipfile
531 \end_layout
533 \begin_layout Itemize
534 Syntax: zip zip.writer.new(filename, [compression])
535 \end_layout
537 \begin_layout Itemize
538 Deprecated: zip zip.create(filename, [compression])
539 \end_layout
541 \begin_layout Standard
542 Parameters:
543 \end_layout
545 \begin_layout Itemize
546 filename: string: The name of the file to write.
547 \end_layout
549 \begin_layout Itemize
550 compression: number: Compression level (0-9).
551  Default is 9.
552 \end_layout
554 \begin_layout Standard
555 Return value:
556 \end_layout
558 \begin_layout Itemize
559 zip: ZIPWRITER: The newly created ZIP writer.
560 \end_layout
562 \begin_layout Standard
563 Create a new ZIPWRITER object and return it.
564 \end_layout
566 \begin_layout Subsubsection
567 Method commit: Finish creating ZIP file.
568 \end_layout
570 \begin_layout Itemize
571 Syntax: zipfile:commit()
572 \end_layout
574 \begin_layout Standard
575 Parameters:
576 \end_layout
578 \begin_layout Itemize
579 zipfile: ZIPFILE: The ZIP file object.
580 \end_layout
582 \begin_layout Standard
583 Finish writing the ZIP file and actually create it on disk.
584 \end_layout
586 \begin_layout Itemize
587 If a member is currently open, it is implicitly closed.
588 \end_layout
590 \begin_layout Itemize
591 Invoking this on already committed or rolled back zipfile causes an error.
592 \end_layout
594 \begin_layout Subsubsection
595 Method rollback: Cancel writing the ZIP file.
596 \end_layout
598 \begin_layout Itemize
599 Syntax: zipfile:rollback()
600 \end_layout
602 \begin_layout Standard
603 Parameters:
604 \end_layout
606 \begin_layout Itemize
607 zipfile: ZIPFILE: The ZIP file object.
608 \end_layout
610 \begin_layout Standard
611 Cancel writing the whole ZIP file.
612  The file on disk will not be modified.
613 \end_layout
615 \begin_layout Itemize
616 If a member is currently open, it is implicitly closed.
617 \end_layout
619 \begin_layout Itemize
620 Invoking this on already committed or rolled back zipfile causes an error.
621 \end_layout
623 \begin_layout Subsubsection
624 Method create_file: Start writing a new member
625 \end_layout
627 \begin_layout Itemize
628 Syntax: zipfile:create_file(filename)
629 \end_layout
631 \begin_layout Standard
632 Parameters:
633 \end_layout
635 \begin_layout Itemize
636 zipfile: ZIPFILE: The ZIP file object.
637 \end_layout
639 \begin_layout Itemize
640 string filename: Name of the new member to create
641 \end_layout
643 \begin_layout Standard
644 Start writing a new member <filename> in ZIP file.
645 \end_layout
647 \begin_layout Itemize
648 If a member is currently open, it is implicitly closed.
649 \end_layout
651 \begin_layout Itemize
652 Invoking this on already committed or rolled back zipfile causes an error.
653 \end_layout
655 \begin_layout Subsubsection
656 Method close_file: Close member
657 \end_layout
659 \begin_layout Itemize
660 Syntax: zipfile:close_file()
661 \end_layout
663 \begin_layout Standard
664 Parameters:
665 \end_layout
667 \begin_layout Itemize
668 zipfile: ZIPFILE: The ZIP file object.
669 \end_layout
671 \begin_layout Standard
672 Close the currently open member in zipfile.
673 \end_layout
675 \begin_layout Itemize
676 Invoking this on already committed or rolled back zipfile causes an error.
677 \end_layout
679 \begin_layout Itemize
680 Invoking this without an open member causes an error.
681 \end_layout
683 \begin_layout Subsubsection
684 Method write: Write data
685 \end_layout
687 \begin_layout Itemize
688 Syntax: zipfile:write(data)
689 \end_layout
691 \begin_layout Standard
692 Parameters:
693 \end_layout
695 \begin_layout Itemize
696 zipfile: ZIPFILE: The ZIP file object.
697 \end_layout
699 \begin_layout Itemize
700 data: string: The data to write.
701 \end_layout
703 \begin_layout Standard
704 Write <data> in binary mode (as-is) to currently open member.
705 \end_layout
707 \begin_layout Itemize
708 Invoking this without a member being open causes an error.
709 \end_layout
711 \begin_layout Standard
712 \begin_inset Newpage pagebreak
713 \end_inset
716 \end_layout
718 \begin_layout Subsection
719 TILEMAP: Tiled collection of bitmaps.
720 \end_layout
722 \begin_layout Standard
723 A tilemap is tiled table, each cell holding a bitmap (indexed or direct).
724 \end_layout
726 \begin_layout Subsubsection
727 Static function new: Create a tilemap
728 \end_layout
730 \begin_layout Itemize
731 Syntax: tilemap gui.tiled_bitmap.new(w, h, bw, bh);
732 \end_layout
734 \begin_layout Itemize
735 Syntax: tilemap classes.TILEMAP.new(w, h, bw, bh);
736 \end_layout
738 \begin_layout Itemize
739 Deprecated: tilemap gui.tilemap(w, h, bw, bh);
740 \end_layout
742 \begin_layout Standard
743 Parameters:
744 \end_layout
746 \begin_layout Itemize
747 w: number: Width of the tilemap in tiles
748 \end_layout
750 \begin_layout Itemize
751 h: number: Height of the tilemap in tiles
752 \end_layout
754 \begin_layout Itemize
755 bw: number: Width of each tile in pixels.
756 \end_layout
758 \begin_layout Itemize
759 bh: number: Height of each tile in pixels.
760 \end_layout
762 \begin_layout Standard
763 Return value:
764 \end_layout
766 \begin_layout Itemize
767 tilemap: TILEMAP: the newly created tilemap
768 \end_layout
770 \begin_layout Standard
771 Create a new tilemap of <w>*<h> tiles, each of <bw>*<bh> pixels and return
772  it.
773 \end_layout
775 \begin_layout Subsubsection
776 TILEMAP:getsize: Query tilemap size
777 \end_layout
779 \begin_layout Itemize
780 Syntax: width, height tmap:getsize()
781 \end_layout
783 \begin_layout Standard
784 Parameters:
785 \end_layout
787 \begin_layout Itemize
788 tmap: TILEMAP: The tilemap to query.
789 \end_layout
791 \begin_layout Standard
792 Return value:
793 \end_layout
795 \begin_layout Itemize
796 width: number : The width of the tilemap in tiles.
797 \end_layout
799 \begin_layout Itemize
800 height: number: The height of the tilemap in tiles.
801 \end_layout
803 \begin_layout Standard
804 Get size of tilemap in tiles.
805 \end_layout
807 \begin_layout Subsubsection
808 TILEMAP:getcsize: Query tilemap cell size
809 \end_layout
811 \begin_layout Itemize
812 Syntax: width, height tmap:getcsize()
813 \end_layout
815 \begin_layout Standard
816 Parameters:
817 \end_layout
819 \begin_layout Itemize
820 tmap: TILEMAP: The tilemap to query.
821 \end_layout
823 \begin_layout Standard
824 Return value:
825 \end_layout
827 \begin_layout Itemize
828 width: number: The width of tilemap tile in pixels.
829 \end_layout
831 \begin_layout Itemize
832 height: number: The height of tilemap tile in pixels.
833 \end_layout
835 \begin_layout Standard
836 Get size of each tilemap tile in pixels.
837 \end_layout
839 \begin_layout Subsubsection
840 TILEMAP:get: Query tilemap tile
841 \end_layout
843 \begin_layout Itemize
844 Syntax: bitmap, palette tmap:get(x, y)
845 \end_layout
847 \begin_layout Standard
848 Parameters:
849 \end_layout
851 \begin_layout Itemize
852 tmap: TILEMAP: The tilemap to query.
853 \end_layout
855 \begin_layout Itemize
856 x: number: The x-coordinate of tile to query.
857 \end_layout
859 \begin_layout Itemize
860 y: number: The y-coordinate of tile to query.
861 \end_layout
863 \begin_layout Standard
864 Return value:
865 \end_layout
867 \begin_layout Itemize
868 bitmap: The associated bitmap (BITMAP or DBITMAP), or nil if none.
869 \end_layout
871 \begin_layout Itemize
872 palette: The palette (PALETTE) associated with indexed-color bitmap, if
873  any.
874  Otherwise nil.
875 \end_layout
877 \begin_layout Standard
878 Return the contents of tile at <x>,<y>.
879 \end_layout
881 \begin_layout Subsubsection
882 TILEMAP:set: Set tilemap cell
883 \end_layout
885 \begin_layout Itemize
886 Syntax: tmap:set(x, y)
887 \end_layout
889 \begin_layout Itemize
890 Syntax: tmap:set(x, y, bitmap)
891 \end_layout
893 \begin_layout Itemize
894 Syntax: tmap:set(x, y, bitmap, palette)
895 \end_layout
897 \begin_layout Standard
898 Parameters:
899 \end_layout
901 \begin_layout Itemize
902 tmap: TILEMAP: The tilemap to manipulate.
903 \end_layout
905 \begin_layout Itemize
906 number x: The x-coordinate of tile to set.
907 \end_layout
909 \begin_layout Itemize
910 number y: The y-coordinate of tile to set.
911 \end_layout
913 \begin_layout Itemize
914 bitmap: BITMAP/DBITMAP: The bitmap to set to tile.
915 \end_layout
917 \begin_layout Itemize
918 palette: PALETTE: The associated palette for bitmap.
919 \end_layout
921 \begin_layout Standard
922 Set the contents of tile <x>,<y>.
923  If no <bitmap> is given, clears the tile.
924  Otherwise sets the tile to contain bitmap <bitmap> with associated palette
925  <palette>.
926 \end_layout
928 \begin_layout Itemize
929 Specifying index bitmap <bitmap> without palette <palette> causes an error.
930 \end_layout
932 \begin_layout Subsubsection
933 TILEMAP:scroll: Scroll tilemap
934 \end_layout
936 \begin_layout Itemize
937 Syntax: tmap:scroll(ox, oy);
938 \end_layout
940 \begin_layout Itemize
941 Syntax: tmap:scroll(ox, oy, x, y, w, h);
942 \end_layout
944 \begin_layout Itemize
945 Syntax: tmap:scroll(ox, oy, x, y, w, h, circ_x, circ_y);
946 \end_layout
948 \begin_layout Standard
949 Parameters:
950 \end_layout
952 \begin_layout Itemize
953 tmap: TILEMAP: The tilemap to manipulate.
954 \end_layout
956 \begin_layout Itemize
957 ox: number: The number of tiles to scroll horizontally (positive is to right).
958 \end_layout
960 \begin_layout Itemize
961 oy: number: The number of tiles to scroll vertically (positive is to down).
962 \end_layout
964 \begin_layout Itemize
965 x: number: The left edge of scroll window.
966 \end_layout
968 \begin_layout Itemize
969 y: number: The top edge of scroll window.
970 \end_layout
972 \begin_layout Itemize
973 w: number: The width of scroll window.
974 \end_layout
976 \begin_layout Itemize
977 h: number: The height of scroll window.
978 \end_layout
980 \begin_layout Itemize
981 circ_x: boolean: If true, treat the window as circular in horizontal direction.
982 \end_layout
984 \begin_layout Itemize
985 circ_y: boolean: If true, treat the window as circular in vertical direction.
986 \end_layout
988 \begin_layout Standard
989 Scroll the specified tilemap <tmap> by <ox>,<oy>.
990  If a window <x>,<y>,<w>,<h> is specified, only that part is scrolled.
991  <circ_x> and <circ_y> control if scroll is circular or not.
992 \end_layout
994 \begin_layout Itemize
995 Specifying out-of-range window causes an error.
996 \end_layout
998 \begin_layout Subsubsection
999 TILEMAP:draw: Draw tilemap
1000 \end_layout
1002 \begin_layout Itemize
1003 Name: tmap:draw(x, y)
1004 \end_layout
1006 \begin_layout Itemize
1007 Name: tmap:draw(x, y, x0, y0, w, h)
1008 \end_layout
1010 \begin_layout Standard
1011 Parameters:
1012 \end_layout
1014 \begin_layout Itemize
1015 tmap: TILEMAP: The tilemap to draw.
1016 \end_layout
1018 \begin_layout Itemize
1019 x: The x coordinate on screen to draw to.
1020 \end_layout
1022 \begin_layout Itemize
1023 y: The y coordinate on screen to draw to.
1024 \end_layout
1026 \begin_layout Itemize
1027 x0: number: The x coordinate on tilemap (in pixels) to start drawing from.
1028 \end_layout
1030 \begin_layout Itemize
1031 y0: number: The y coordinate on tilemap (in pixels) to start drawing from.
1032 \end_layout
1034 \begin_layout Itemize
1035 w: number: The width to draw (in pixels).
1036 \end_layout
1038 \begin_layout Itemize
1039 h: number: The height to draw (in pixels).
1040 \end_layout
1042 \begin_layout Standard
1043 Draw tilemap <tmap> to screen at <x>,<y>.
1044  If a window <x0>,<y0>,<w>,<h> is specified, only that part is drawn.
1045 \end_layout
1047 \begin_layout Itemize
1048 This method requires a rendering context to work.
1049 \end_layout
1051 \begin_layout Subsubsection
1052 TILEMAP:draw_outside: Draw tilemap outside game area
1053 \end_layout
1055 \begin_layout Itemize
1056 Name: tmap:draw_outside(x, y)
1057 \end_layout
1059 \begin_layout Itemize
1060 Name: tmap:draw_outside(x, y, x0, y0, w, h)
1061 \end_layout
1063 \begin_layout Standard
1064 Like TILEMAP:draw, but draws only outside game area.
1065 \end_layout
1067 \begin_layout Standard
1068 \begin_inset Newpage pagebreak
1069 \end_inset
1072 \end_layout
1074 \begin_layout Subsection
1075 RENDERCTX: Off-screen rendering context
1076 \end_layout
1078 \begin_layout Standard
1079 Object acting as off-screen rendering context.
1080 \end_layout
1082 \begin_layout Subsubsection
1083 Static function new: Create a render queue
1084 \end_layout
1086 \begin_layout Itemize
1087 Syntax: renderctx gui.renderctx.new(width, height);
1088 \end_layout
1090 \begin_layout Itemize
1091 Syntax: renderctx classes.RENDERCTX.new(width, height);
1092 \end_layout
1094 \begin_layout Itemize
1095 Deprecated: renderctx gui.renderq_new(width, height);
1096 \end_layout
1098 \begin_layout Standard
1099 Parameters:
1100 \end_layout
1102 \begin_layout Itemize
1103 width: number: The notional width of the game area.
1104 \end_layout
1106 \begin_layout Itemize
1107 height: number: The notional height of the game area.
1108 \end_layout
1110 \begin_layout Standard
1111 Returns:
1112 \end_layout
1114 \begin_layout Itemize
1115 rendectx: RENDERCTX: The newly created render context.
1116 \end_layout
1118 \begin_layout Standard
1119 Create a render context with reported size <width>*<height> and return it.
1120 \end_layout
1122 \begin_layout Subsubsection
1123 Static function setnull: Reset to default queue
1124 \end_layout
1126 \begin_layout Itemize
1127 Syntax: gui.renderctx.setnull()
1128 \end_layout
1130 \begin_layout Itemize
1131 Syntax: classes.RENDERCTX:setnull()
1132 \end_layout
1134 \begin_layout Itemize
1135 Deprecated: gui.renderq_set()
1136 \end_layout
1138 \begin_layout Standard
1139 Reset the used render context back to default for the executing callback:
1140 \end_layout
1142 \begin_layout Itemize
1143 The default for paint callback is the screen
1144 \end_layout
1146 \begin_layout Itemize
1147 The default for video callback is the video frame
1148 \end_layout
1150 \begin_layout Itemize
1151 The default otherwise is nothing.
1152 \end_layout
1154 \begin_layout Subsubsection
1155 Method clear: Clear a render queue
1156 \end_layout
1158 \begin_layout Itemize
1159 Syntax: renderctx:clear()
1160 \end_layout
1162 \begin_layout Itemize
1163 Deprecated: gui.renderq_clear(renderctx)
1164 \end_layout
1166 \begin_layout Standard
1167 Parameters:
1168 \end_layout
1170 \begin_layout Itemize
1171 renderctx: RENDERCTX: The render queue to clear.
1172 \end_layout
1174 \begin_layout Standard
1175 Clear all drawing from the context.
1176 \end_layout
1178 \begin_layout Subsubsection
1179 Method set: Change active render context
1180 \end_layout
1182 \begin_layout Itemize
1183 Syntax: renderctx:set()
1184 \end_layout
1186 \begin_layout Itemize
1187 Deprecated: gui.renderq_set(renderctx)
1188 \end_layout
1190 \begin_layout Standard
1191 Parameters:
1192 \end_layout
1194 \begin_layout Itemize
1195 renderctx: RENDERCTX: The render queue to use.
1196 \end_layout
1198 \begin_layout Standard
1199 Switch the current rendering context <renderctx>.
1200 \end_layout
1202 \begin_layout Subsubsection
1203 Method run: Draw all objects in context to another
1204 \end_layout
1206 \begin_layout Itemize
1207 Syntax: renderctx:run()
1208 \end_layout
1210 \begin_layout Itemize
1211 Deprecated: gui.renderq_run(renderctx)
1212 \end_layout
1214 \begin_layout Standard
1215 Parameters:
1216 \end_layout
1218 \begin_layout Itemize
1219 renderctx: RENDERCTX: The render context to overlay.
1220 \end_layout
1222 \begin_layout Standard
1223 Overlay the specified render context <context> upon the active rendering
1224  context.
1225 \end_layout
1227 \begin_layout Itemize
1228 Trying to overlay rendering context upon itself is a bad idea.
1229 \end_layout
1231 \begin_layout Subsubsection
1232 Method render: Render a contex to bitmap
1233 \end_layout
1235 \begin_layout Itemize
1236 Syntax: bitmap renderctx:render()
1237 \end_layout
1239 \begin_layout Standard
1240 Parameters:
1241 \end_layout
1243 \begin_layout Itemize
1244 renderctx: RENDERCTX: The context to render.
1245 \end_layout
1247 \begin_layout Standard
1248 Returns:
1249 \end_layout
1251 \begin_layout Itemize
1252 bitmap: DBITMAP: The rendered bitmap.
1253 \end_layout
1255 \begin_layout Standard
1256 Render the specified context <renderctx> to a new bitmap.
1257 \end_layout
1259 \begin_layout Itemize
1260 The size of bitmap will be nominal game area size, plus any set gaps.
1261 \end_layout
1263 \begin_layout Itemize
1264 This method does not require active rendering context.
1265 \end_layout
1267 \begin_layout Subsubsection
1268 Method synchronous_repaint: Paint screen now
1269 \end_layout
1271 \begin_layout Itemize
1272 Syntax: renderctx:synchronous_repaint()
1273 \end_layout
1275 \begin_layout Itemize
1276 Deprecated: gui.synchronous_repaint(renderctx)
1277 \end_layout
1279 \begin_layout Standard
1280 Parameters:
1281 \end_layout
1283 \begin_layout Itemize
1284 renderctx: RENDERCTX: The context to paint.
1285 \end_layout
1287 \begin_layout Standard
1288 Immediately redraw the screen with game overlayed by drawings from context
1289  <renderctx>.
1290 \end_layout
1292 \begin_layout Itemize
1293 This does not require active rendering context.
1294 \end_layout
1296 \begin_layout Itemize
1297 Will not cause paint callback to be invoked.
1298 \end_layout
1300 \begin_layout Standard
1301 \begin_inset Newpage pagebreak
1302 \end_inset
1305 \end_layout
1307 \begin_layout Subsection
1308 PALETTE: Color palette for indexed image
1309 \end_layout
1311 \begin_layout Subsubsection
1312 Static function new: Create a new palette
1313 \end_layout
1315 \begin_layout Itemize
1316 Syntax: palette gui.palette.new()
1317 \end_layout
1319 \begin_layout Itemize
1320 Syntax: palette classes.PALETTE.new()
1321 \end_layout
1323 \begin_layout Itemize
1324 Deprecated: palette gui.palette_new()
1325 \end_layout
1327 \begin_layout Standard
1328 Returns:
1329 \end_layout
1331 \begin_layout Itemize
1332 palette: PALETTE: The created palette.
1333 \end_layout
1335 \begin_layout Standard
1336 Create a new palette (with all colors transparent) and return it.
1337 \end_layout
1339 \begin_layout Subsubsection
1340 Static function load: Load a palette
1341 \end_layout
1343 \begin_layout Itemize
1344 Syntax: palette gui.palette.load(file, [base])
1345 \end_layout
1347 \begin_layout Itemize
1348 Syntax: palette classes.PALETTE.load(file, [base])
1349 \end_layout
1351 \begin_layout Itemize
1352 Deprecated: palette gui.palette_load(file, [base])
1353 \end_layout
1355 \begin_layout Standard
1356 Parameters:
1357 \end_layout
1359 \begin_layout Itemize
1360 string file: The file to load.
1361 \end_layout
1363 \begin_layout Itemize
1364 string base (optional): The base file to resolve file relative to.
1365 \end_layout
1367 \begin_layout Standard
1368 Returns:
1369 \end_layout
1371 \begin_layout Itemize
1372 palette: PALETTE: The loaded palette.
1373 \end_layout
1375 \begin_layout Standard
1376 Load a palette from file <file> (resolved relative to <base>).
1377 \end_layout
1379 \begin_layout Itemize
1380 The file format is a series of lines, each with following format:
1381 \end_layout
1383 \begin_deeper
1384 \begin_layout Itemize
1385 Blank or just whitespace: Ignored
1386 \end_layout
1388 \begin_layout Itemize
1389 First non-whitespace is '#': Ignored
1390 \end_layout
1392 \begin_layout Itemize
1393 <r> <g> <b>: Fully opaque color with specified RGB values (0-255)
1394 \end_layout
1396 \begin_layout Itemize
1397 <r> <g> <b> <a>: Color with specified RGB values (0-255) and specified alpha
1398  (0-256, 0 being fully transparent and 256 fully opaque).
1399 \end_layout
1401 \begin_layout Itemize
1402 transparent: Fully transparent color
1403 \end_layout
1405 \end_deeper
1406 \begin_layout Subsubsection
1407 Static function load_str: Load a palette from string
1408 \end_layout
1410 \begin_layout Itemize
1411 Syntax: palette gui.palette.load(data)
1412 \end_layout
1414 \begin_layout Itemize
1415 Syntax: palette classes.PALETTE.load(data)
1416 \end_layout
1418 \begin_layout Itemize
1419 Deprecated: palette gui.palette_load(data)
1420 \end_layout
1422 \begin_layout Standard
1423 Parameters:
1424 \end_layout
1426 \begin_layout Itemize
1427 string data: The palette data.
1428 \end_layout
1430 \begin_layout Standard
1431 Returns:
1432 \end_layout
1434 \begin_layout Itemize
1435 palette: PALETTE: The loaded palette.
1436 \end_layout
1438 \begin_layout Standard
1439 Like PALETTE:load, but instead of reading palette from file, reads it from
1440  a string.
1441 \end_layout
1443 \begin_layout Subsubsection
1444 Method set: Set palette entry
1445 \end_layout
1447 \begin_layout Itemize
1448 Syntax: palette:set(index, color)
1449 \end_layout
1451 \begin_layout Itemize
1452 Deprecated: gui.palette_set(palette, ...)
1453 \end_layout
1455 \begin_layout Standard
1456 Parameters:
1457 \end_layout
1459 \begin_layout Itemize
1460 palette: PALETTE: The palette to manipulate
1461 \end_layout
1463 \begin_layout Itemize
1464 index: number: The index of color to set (0-65535).
1465 \end_layout
1467 \begin_layout Itemize
1468 color: number/string: The color value to set.
1469 \end_layout
1471 \begin_layout Standard
1472 Set palette <palette> index <index> to color <color>.
1473 \end_layout
1475 \begin_layout Subsubsection
1476 Method hash: Hash a palette
1477 \end_layout
1479 \begin_layout Itemize
1480 Syntax: hash palette:hash()
1481 \end_layout
1483 \begin_layout Itemize
1484 Deprecated: hash gui.palette_hash(palette)
1485 \end_layout
1487 \begin_layout Standard
1488 Parameters:
1489 \end_layout
1491 \begin_layout Itemize
1492 palette: The palette to hash.
1493 \end_layout
1495 \begin_layout Standard
1496 Return value:
1497 \end_layout
1499 \begin_layout Itemize
1500 hash: string: 64-hex digit hash.
1501 \end_layout
1503 \begin_layout Standard
1504 Obtain crypto-grade hash of palette data of <palette>.
1505 \end_layout
1507 \begin_layout Itemize
1508 All colors after the last non-transparent one are ignored.
1509 \end_layout
1511 \begin_layout Subsubsection
1512 Method adjust_transparency: Adjust transparency
1513 \end_layout
1515 \begin_layout Itemize
1516 Syntax: palette:adjust_transparency(newvalue)
1517 \end_layout
1519 \begin_layout Itemize
1520 Deprecated: gui.adjust_transparency(palette, ...)
1521 \end_layout
1523 \begin_layout Standard
1524 Parameters:
1525 \end_layout
1527 \begin_layout Itemize
1528 palette: PALETTE: The palette to adjust.
1529 \end_layout
1531 \begin_layout Itemize
1532 Number adj: The factor to multiply opaqueness with times 256.
1533 \end_layout
1535 \begin_layout Standard
1536 Multiply opaqueness of all colors in palette <palette> by factor of <adj>/256.
1537 \end_layout
1539 \begin_layout Standard
1540 \begin_inset Newpage pagebreak
1541 \end_inset
1544 \end_layout
1546 \begin_layout Subsection
1547 BITMAP: Indexed-color bitmap
1548 \end_layout
1550 \begin_layout Subsubsection
1551 Static function new: Create a new bitmap
1552 \end_layout
1554 \begin_layout Itemize
1555 Syntax: bitmap gui.bitmap.new(w, h, [fillcolor])
1556 \end_layout
1558 \begin_layout Itemize
1559 Syntax: bitmap classes.BITMAP.new(w, h, [fillcolor])
1560 \end_layout
1562 \begin_layout Itemize
1563 Deprecated: bitmap gui.bitmap_new(w, h, false, [fillcolor])
1564 \end_layout
1566 \begin_layout Standard
1567 Parameters:
1568 \end_layout
1570 \begin_layout Itemize
1571 w: number: The width of bitmap to create in pixels.
1572 \end_layout
1574 \begin_layout Itemize
1575 h: number: The height of bitmap to create in pixels.
1576 \end_layout
1578 \begin_layout Itemize
1579 false: boolean: Constant boolean false.
1580 \end_layout
1582 \begin_layout Itemize
1583 fillcolor: number: The initial fill index.
1584  Default 0 if not specified.
1585 \end_layout
1587 \begin_layout Standard
1588 Create a new bitmap of size <w>*<h>.
1589  Fill the bitmap with color index <fillcolor>.
1590 \end_layout
1592 \begin_layout Subsubsection
1593 Method draw: Draw a bitmap
1594 \end_layout
1596 \begin_layout Itemize
1597 Syntax: bitmap:draw(x, y, palette)
1598 \end_layout
1600 \begin_layout Itemize
1601 Deprecated: gui.bitmap_draw(x, y, bitmap, palette)
1602 \end_layout
1604 \begin_layout Standard
1605 Parameters:
1606 \end_layout
1608 \begin_layout Itemize
1609 bitmap: BITMAP: The bitmap to draw
1610 \end_layout
1612 \begin_layout Itemize
1613 x: number: The x-coordinate on screen.
1614 \end_layout
1616 \begin_layout Itemize
1617 y: number: The y-coordinate on screen.
1618 \end_layout
1620 \begin_layout Itemize
1621 palette: The palette to use for drawing.
1622 \end_layout
1624 \begin_layout Standard
1625 Draw bitmap <bitmap> on screen at <x>,<y> with palette <palette>.
1626 \end_layout
1628 \begin_layout Subsubsection
1629 Method draw_outside: Draw a bitmap outside game area
1630 \end_layout
1632 \begin_layout Itemize
1633 Syntax: bitmap:draw_outside(x, y, palette)
1634 \end_layout
1636 \begin_layout Standard
1637 Like bitmap:draw, but does not draw on game area.
1638 \end_layout
1640 \begin_layout Subsubsection
1641 Method draw_clip: Draw a bitmap, with clipping
1642 \end_layout
1644 \begin_layout Itemize
1645 Syntax: bitmap:draw_clip(x, y, palette, x0, y0, width, height)
1646 \end_layout
1648 \begin_layout Standard
1649 Parameters:
1650 \end_layout
1652 \begin_layout Itemize
1653 bitmap: BITMAP: The bitmap to draw
1654 \end_layout
1656 \begin_layout Itemize
1657 x: number: The x-coordinate on screen.
1658 \end_layout
1660 \begin_layout Itemize
1661 y: number: The y-coordinate on screen.
1662 \end_layout
1664 \begin_layout Itemize
1665 palette: The palette to use for drawing.
1666 \end_layout
1668 \begin_layout Itemize
1669 x0: The smallest bitmap x coordinate to draw.
1670 \end_layout
1672 \begin_layout Itemize
1673 y0: The smallest bitmap y coordinate to draw.
1674 \end_layout
1676 \begin_layout Itemize
1677 width: Width of region to draw
1678 \end_layout
1680 \begin_layout Itemize
1681 height: Height of region to draw.
1682 \end_layout
1684 \begin_layout Standard
1685 Like bitmap:draw, but clip the bitmap area drawn.
1686 \end_layout
1688 \begin_layout Subsubsection
1689 Method draw_clip_outside: Draw a bitmap outside game are, with clipping
1690 \end_layout
1692 \begin_layout Itemize
1693 Syntax: bitmap:draw_clip_outside(x, y, palette, x0, y0, width, height)
1694 \end_layout
1696 \begin_layout Standard
1697 Like bitmap:draw_clip, but only draw outside game area.
1698 \end_layout
1700 \begin_layout Subsubsection
1701 Method pset: Set pixel in bitmap
1702 \end_layout
1704 \begin_layout Itemize
1705 Syntax: bitmap:pset(x, y, color)
1706 \end_layout
1708 \begin_layout Itemize
1709 Deprecaed: gui.bitmap_pset(bitmap, ...)
1710 \end_layout
1712 \begin_layout Standard
1713 Parameters:
1714 \end_layout
1716 \begin_layout Itemize
1717 bitmap: BITMAP: The bitmap to manipulate.
1718 \end_layout
1720 \begin_layout Itemize
1721 x: number: x-coordinate of pixel to set.
1722 \end_layout
1724 \begin_layout Itemize
1725 y: number: y-coordinate of pixel to set.
1726 \end_layout
1728 \begin_layout Itemize
1729 color: number: The color index to set.
1730 \end_layout
1732 \begin_layout Standard
1733 Sets specified pixel <x>,<y> in bitmap <bitmap> to color index <color>.
1734 \end_layout
1736 \begin_layout Subsubsection
1737 Method pget: Get pixel in bitmap
1738 \end_layout
1740 \begin_layout Itemize
1741 Syntax: color bitmap:pget(x,y)
1742 \end_layout
1744 \begin_layout Itemize
1745 Deprecated: color gui.bitmap_pget(bitmap, ...)
1746 \end_layout
1748 \begin_layout Standard
1749 Parameters:
1750 \end_layout
1752 \begin_layout Itemize
1753 bitmap: BITMAP: The bitmap to query.
1754 \end_layout
1756 \begin_layout Itemize
1757 x: number: x-coordinate of pixel to get.
1758 \end_layout
1760 \begin_layout Itemize
1761 y: number: y-coordinate of pixel to get.
1762 \end_layout
1764 \begin_layout Standard
1765 Returns:
1766 \end_layout
1768 \begin_layout Itemize
1769 color: number: The color index in specified pixel.
1770 \end_layout
1772 \begin_layout Standard
1773 Gets color index of specified pixel <x>,<y> in bitmap <bitmap>.
1774 \end_layout
1776 \begin_layout Subsubsection
1777 Method size: Get size of bitmap
1778 \end_layout
1780 \begin_layout Itemize
1781 Syntax: width, height bitmap:size()
1782 \end_layout
1784 \begin_layout Itemize
1785 Syntax: width, height gui.bitmap_size(bitmap)
1786 \end_layout
1788 \begin_layout Standard
1789 Parameters:
1790 \end_layout
1792 \begin_layout Itemize
1793 bitmap: BITMAP: The bitmap to query.
1794 \end_layout
1796 \begin_layout Standard
1797 Returns:
1798 \end_layout
1800 \begin_layout Itemize
1801 width: number: The width of the bitmap.
1802 \end_layout
1804 \begin_layout Itemize
1805 height: number: The height of the bitmap.
1806 \end_layout
1808 \begin_layout Standard
1809 Get size of bitmap <bitmap>.
1810 \end_layout
1812 \begin_layout Subsubsection
1813 Method blit: Blit a bitmap into another
1814 \end_layout
1816 \begin_layout Itemize
1817 Syntax: dest:blit(dx, dy, src, sx, sy, w, h, [ck])
1818 \end_layout
1820 \begin_layout Itemize
1821 Deprecated: gui.bitmap_blit(dest, ...)
1822 \end_layout
1824 \begin_layout Standard
1825 Parameters:
1826 \end_layout
1828 \begin_layout Itemize
1829 dest: BITMAP: The target bitmap to blit to.
1830 \end_layout
1832 \begin_layout Itemize
1833 dx: number: The x-coordinate in target.
1834 \end_layout
1836 \begin_layout Itemize
1837 dy: number: The y-coordinate in target.
1838 \end_layout
1840 \begin_layout Itemize
1841 src: BITMAP: The source bitmap.
1842 \end_layout
1844 \begin_layout Itemize
1845 sx: number: The x-coordinate in source.
1846 \end_layout
1848 \begin_layout Itemize
1849 sy: number: The y-coordinate in source.
1850 \end_layout
1852 \begin_layout Itemize
1853 w: number: The width of area to blit.
1854 \end_layout
1856 \begin_layout Itemize
1857 h: number: The height of area to blit.
1858 \end_layout
1860 \begin_layout Itemize
1861 ck: number: The color key.
1862  Pixels with this index are not copied.
1863 \end_layout
1865 \begin_deeper
1866 \begin_layout Itemize
1867 If none is specified, all pixels are copied.
1868 \end_layout
1870 \end_deeper
1871 \begin_layout Standard
1872 Copy region of size <w>*<h> at <sx>,<sy> in bitmap <src> into <dest> at
1873  <dx>,<dy>.
1874  If a color key <ck> is specified, pixels of that color are not copied.
1875 \end_layout
1877 \begin_layout Subsubsection
1878 Method blit_scaled: Blit a bitmap into another with scaling
1879 \end_layout
1881 \begin_layout Itemize
1882 Syntax: dest:blit_scaled(dx, dy, src, sx, sy, w, h, hscl, [vscl], [ck])
1883 \end_layout
1885 \begin_layout Itemize
1886 Deprecated: gui.bitmap_blit_scaled(dest, ...)
1887 \end_layout
1889 \begin_layout Standard
1890 Parameters:
1891 \end_layout
1893 \begin_layout Itemize
1894 dest: BITMAP: The target bitmap to blit to.
1895 \end_layout
1897 \begin_layout Itemize
1898 dx: number: The x-coordinate in target.
1899 \end_layout
1901 \begin_layout Itemize
1902 dy: number: The y-coordinate in target.
1903 \end_layout
1905 \begin_layout Itemize
1906 src: BITMAP: The source bitmap.
1907 \end_layout
1909 \begin_layout Itemize
1910 sx: number: The x-coordinate in source.
1911 \end_layout
1913 \begin_layout Itemize
1914 sy: number: The y-coordinate in source.
1915 \end_layout
1917 \begin_layout Itemize
1918 w: number: The width of area to blit.
1919 \end_layout
1921 \begin_layout Itemize
1922 h: number: The height of area to blit.
1923 \end_layout
1925 \begin_layout Itemize
1926 hscl: number: Horizontal scale factor (integer).
1927 \end_layout
1929 \begin_layout Itemize
1930 vscl: number: Vertical scale factor (integer).
1931  Defaults to the same as <hscl>.
1932 \end_layout
1934 \begin_layout Itemize
1935 ck: number: The color key.
1936  Pixels with this index are not copied.
1937 \end_layout
1939 \begin_deeper
1940 \begin_layout Itemize
1941 If none is specified, all pixels are copied.
1942 \end_layout
1944 \end_deeper
1945 \begin_layout Standard
1946 Like BITMAP:blit, but also scales the copied part of bitmap (using nearest
1947  neighbor) by factor of <hscl>*<vscl>.
1948 \end_layout
1950 \begin_layout Subsubsection
1951 Method blit_porterduff: Blit a bitmap into another with Porter-Duff composition
1952 \end_layout
1954 \begin_layout Itemize
1955 Syntax: dest:blit_porterduff(dx, dy, src, sx, sy, w, h, operator)
1956 \end_layout
1958 \begin_layout Itemize
1959 Deprecated: gui.bitmap_blit_porterduff(dest, ...)
1960 \end_layout
1962 \begin_layout Standard
1963 Parameters:
1964 \end_layout
1966 \begin_layout Itemize
1967 dest: BITMAP: The target bitmap to blit to.
1968 \end_layout
1970 \begin_layout Itemize
1971 dx: number: The x-coordinate in target.
1972 \end_layout
1974 \begin_layout Itemize
1975 dy: number: The y-coordinate in target.
1976 \end_layout
1978 \begin_layout Itemize
1979 src: BITMAP: The source bitmap.
1980 \end_layout
1982 \begin_layout Itemize
1983 sx: number: The x-coordinate in source.
1984 \end_layout
1986 \begin_layout Itemize
1987 sy: number: The y-coordinate in source.
1988 \end_layout
1990 \begin_layout Itemize
1991 w: number: The width of area to blit.
1992 \end_layout
1994 \begin_layout Itemize
1995 h: number: The height of area to blit.
1996 \end_layout
1998 \begin_layout Itemize
1999 operator: string: The operator to use.
2000 \end_layout
2002 \begin_deeper
2003 \begin_layout Itemize
2004 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2005  DestOut, Clear or Xor.
2006 \end_layout
2008 \end_deeper
2009 \begin_layout Standard
2010 Like BITMAP:blit, but instead of just overwriting, applies specified Porter-Duff
2011  operator.
2013 \end_layout
2015 \begin_layout Itemize
2016 Color index 0 in source and target is treated as background.
2017 \end_layout
2019 \begin_layout Subsubsection
2020 Method blit_scaled_porterduff: Blit a bitmap into another with scaling and
2021  Porter-Duff composition
2022 \end_layout
2024 \begin_layout Itemize
2025 Syntax: dest:blit_scaled_porterduff(dx, dy, src, sx, sy, w, h, hscl, [vscl],
2026  operator)
2027 \end_layout
2029 \begin_layout Itemize
2030 Deprecated: gui.bitmap_blit_scaled_porterduff(dest, ...)
2031 \end_layout
2033 \begin_layout Standard
2034 Parameters:
2035 \end_layout
2037 \begin_layout Itemize
2038 dest: BITMAP: The target bitmap to blit to.
2039 \end_layout
2041 \begin_layout Itemize
2042 dx: number: The x-coordinate in target.
2043 \end_layout
2045 \begin_layout Itemize
2046 dy: number: The y-coordinate in target.
2047 \end_layout
2049 \begin_layout Itemize
2050 src: BITMAP: The source bitmap.
2051 \end_layout
2053 \begin_layout Itemize
2054 sx: number: The x-coordinate in source.
2055 \end_layout
2057 \begin_layout Itemize
2058 sy: number: The y-coordinate in source.
2059 \end_layout
2061 \begin_layout Itemize
2062 w: number: The width of area to blit.
2063 \end_layout
2065 \begin_layout Itemize
2066 h: number: The height of area to blit.
2067 \end_layout
2069 \begin_layout Itemize
2070 hscl: number: Horizontal scale factor (integer).
2071 \end_layout
2073 \begin_layout Itemize
2074 vscl: number: Vertical scale factor (integer).
2075  Defaults to the same as <hscl>.
2076 \end_layout
2078 \begin_layout Itemize
2079 operator: string: The operator to use.
2080 \end_layout
2082 \begin_deeper
2083 \begin_layout Itemize
2084 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2085  DestOut, Clear or Xor.
2086 \end_layout
2088 \end_deeper
2089 \begin_layout Standard
2090 Like BITMAP:blit_porterduff, but also scales the source by <hscl>*<vscl>
2091  like BITMAP:blit_scaled.
2092 \end_layout
2094 \begin_layout Subsubsection
2095 Method blit_priority: Blit a bitmap into another with color priority
2096 \end_layout
2098 \begin_layout Itemize
2099 Syntax: dest:blit_priority(dx, dy, src, sx, sy, w, h)
2100 \end_layout
2102 \begin_layout Itemize
2103 Deprecated: gui.bitmap_blit_priority(dest, ...)
2104 \end_layout
2106 \begin_layout Standard
2107 Parameters:
2108 \end_layout
2110 \begin_layout Itemize
2111 dest: BITMAP: The target bitmap to blit to.
2112 \end_layout
2114 \begin_layout Itemize
2115 dx: number: The x-coordinate in target.
2116 \end_layout
2118 \begin_layout Itemize
2119 dy: number: The y-coordinate in target.
2120 \end_layout
2122 \begin_layout Itemize
2123 src: BITMAP: The source bitmap.
2124 \end_layout
2126 \begin_layout Itemize
2127 sx: number: The x-coordinate in source.
2128 \end_layout
2130 \begin_layout Itemize
2131 sy: number: The y-coordinate in source.
2132 \end_layout
2134 \begin_layout Itemize
2135 w: number: The width of area to blit.
2136 \end_layout
2138 \begin_layout Itemize
2139 h: number: The height of area to blit.
2140 \end_layout
2142 \begin_layout Standard
2143 Like BITMAP:blit, but only copy pixels where source color index is greater
2144  than destination color index.
2145 \end_layout
2147 \begin_layout Subsubsection
2148 Method blit_scaled_priority: Blit a bitmap into another with color priority
2149  and scaling
2150 \end_layout
2152 \begin_layout Itemize
2153 Syntax: dest:blit_scaled_priority(dx, dy, src, sx, sy, w, h, hscl, [vscl])
2154 \end_layout
2156 \begin_layout Itemize
2157 Deprecated: gui.bitmap_blit_scaled_priority(dest, ...)
2158 \end_layout
2160 \begin_layout Standard
2161 Parameters:
2162 \end_layout
2164 \begin_layout Itemize
2165 dest: BITMAP: The target bitmap to blit to.
2166 \end_layout
2168 \begin_layout Itemize
2169 dx: number: The x-coordinate in target.
2170 \end_layout
2172 \begin_layout Itemize
2173 dy: number: The y-coordinate in target.
2174 \end_layout
2176 \begin_layout Itemize
2177 src: BITMAP: The source bitmap.
2178 \end_layout
2180 \begin_layout Itemize
2181 sx: number: The x-coordinate in source.
2182 \end_layout
2184 \begin_layout Itemize
2185 sy: number: The y-coordinate in source.
2186 \end_layout
2188 \begin_layout Itemize
2189 w: number: The width of area to blit.
2190 \end_layout
2192 \begin_layout Itemize
2193 h: number: The height of area to blit.
2194 \end_layout
2196 \begin_layout Itemize
2197 hscl: number: Horizontal scale factor (integer).
2198 \end_layout
2200 \begin_layout Itemize
2201 vscl: number: Vertical scale factor (integer).
2202  Defaults to the same as <hscl>.
2203 \end_layout
2205 \begin_layout Standard
2206 Like BITMAP:blit_priority, but apply scaling by <hscl>*<vscl> like BITMAP:blit_s
2207 caled.
2208 \end_layout
2210 \begin_layout Subsubsection
2211 Method save_png: Save a bitmap to PNG
2212 \end_layout
2214 \begin_layout Itemize
2215 Syntax: bitmap:save_png(filename, [base], palette)
2216 \end_layout
2218 \begin_layout Itemize
2219 Syntax: data bitmap:save_png(palette)
2220 \end_layout
2222 \begin_layout Itemize
2223 Deprecated: ...
2224  gui.bitmap_save_png(bitmap, ...)
2225 \end_layout
2227 \begin_layout Standard
2228 Parameters:
2229 \end_layout
2231 \begin_layout Itemize
2232 bitmap: BITMAP: The bitmap to save.
2233 \end_layout
2235 \begin_layout Itemize
2236 filename: string: The filename to save to.
2237 \end_layout
2239 \begin_layout Itemize
2240 base: string: The base filename is resolved relative to.
2241 \end_layout
2243 \begin_layout Itemize
2244 palette: PALETTE: The palette to use.
2245 \end_layout
2247 \begin_layout Standard
2248 Return value:
2249 \end_layout
2251 \begin_layout Itemize
2252 data: string: BASE64 encoded PNG data.
2253 \end_layout
2255 \begin_layout Standard
2256 Save bitmap <bitmap>, with palette <pal> into PNG file <filename> (relative
2257  to <base>) or return BASE64 encoding of it.
2258 \end_layout
2260 \begin_layout Subsubsection
2261 Method hash: Hash a bitmap
2262 \end_layout
2264 \begin_layout Itemize
2265 Syntax: hash bitmap:hash()
2266 \end_layout
2268 \begin_layout Itemize
2269 Deprecated: hash bitmap:hash(bitmap)
2270 \end_layout
2272 \begin_layout Standard
2273 Parameters:
2274 \end_layout
2276 \begin_layout Itemize
2277 bitmap: BITMAP: The bitmap to hash.
2278 \end_layout
2280 \begin_layout Standard
2281 Return value:
2282 \end_layout
2284 \begin_layout Itemize
2285 hash: string: 64-hex digit hash
2286 \end_layout
2288 \begin_layout Standard
2289 Hashes bitmap <bitmap> and returns crypto-strong hash.
2291 \end_layout
2293 \begin_layout Itemize
2294 Color order in bitmap is significant.
2295 \end_layout
2297 \begin_layout Standard
2298 \begin_inset Newpage pagebreak
2299 \end_inset
2302 \end_layout
2304 \begin_layout Subsection
2305 DBITMAP: Direct-color bitmap
2306 \end_layout
2308 \begin_layout Subsubsection
2309 Static function: new: Create a new bitmap
2310 \end_layout
2312 \begin_layout Itemize
2313 Syntax: bitmap gui.dbitmap.new(w, h, [fillcolor])
2314 \end_layout
2316 \begin_layout Itemize
2317 Syntax: bitmap classes.DBITMAP.new(w, h, [fillcolor])
2318 \end_layout
2320 \begin_layout Itemize
2321 Deprecated: bitmap gui.bitmap_new (w, h, true, [fillcolor]).
2322 \end_layout
2324 \begin_layout Standard
2325 Parameters:
2326 \end_layout
2328 \begin_layout Itemize
2329 w: number: The width of new bitmap.
2330 \end_layout
2332 \begin_layout Itemize
2333 h: number: The height of new bitmap.
2334 \end_layout
2336 \begin_layout Itemize
2337 true: boolean: Fixed boolean true
2338 \end_layout
2340 \begin_layout Itemize
2341 fillcolor: The color to fill the bitmap with (default transparent).
2342 \end_layout
2344 \begin_layout Standard
2345 Return value:
2346 \end_layout
2348 \begin_layout Itemize
2349 bitmap: DBITMAP: The new bitmap.
2350 \end_layout
2352 \begin_layout Standard
2353 Create a new direct-color bitmap of size <w>*<h>, initially filled with
2354  <fillcolor>.
2355 \end_layout
2357 \begin_layout Subsubsection
2358 Method draw: Draw a bitmap
2359 \end_layout
2361 \begin_layout Itemize
2362 Syntax: bitmap.draw(x, y)
2363 \end_layout
2365 \begin_layout Itemize
2366 Deprecated: gui.bitmap_draw(x, y, bitmap)
2367 \end_layout
2369 \begin_layout Standard
2370 Parameters:
2371 \end_layout
2373 \begin_layout Itemize
2374 bitmap: DBITMAP: The bitmap to draw.
2375 \end_layout
2377 \begin_layout Itemize
2378 x: number: X-coordinate on screen.
2379 \end_layout
2381 \begin_layout Itemize
2382 y: number: Y-coordinate on screen.
2383 \end_layout
2385 \begin_layout Standard
2386 Draw bitmap <bitmap> on screen at <x>,<y>.
2387 \end_layout
2389 \begin_layout Subsubsection
2390 Method draw_outside: Draw a bitmap outside game area
2391 \end_layout
2393 \begin_layout Itemize
2394 Syntax: dbitmap:draw_outside(x, y, palette)
2395 \end_layout
2397 \begin_layout Standard
2398 Like dbitmap:draw, but does not draw on game area.
2399 \end_layout
2401 \begin_layout Subsubsection
2402 Method draw_clip: Draw a bitmap, with clipping
2403 \end_layout
2405 \begin_layout Itemize
2406 Syntax: dbitmap:draw(x, y, palette, x0, y0, width, height)
2407 \end_layout
2409 \begin_layout Standard
2410 Parameters:
2411 \end_layout
2413 \begin_layout Itemize
2414 bitmap: DBITMAP: The bitmap to draw
2415 \end_layout
2417 \begin_layout Itemize
2418 x: number: The x-coordinate on screen.
2419 \end_layout
2421 \begin_layout Itemize
2422 y: number: The y-coordinate on screen.
2423 \end_layout
2425 \begin_layout Itemize
2426 x0: The smallest bitmap x coordinate to draw.
2427 \end_layout
2429 \begin_layout Itemize
2430 y0: The smallest bitmap y coordinate to draw.
2431 \end_layout
2433 \begin_layout Itemize
2434 width: Width of region to draw
2435 \end_layout
2437 \begin_layout Itemize
2438 height: Height of region to draw.
2439 \end_layout
2441 \begin_layout Standard
2442 Like dbitmap:draw, but clip the bitmap area drawn.
2443 \end_layout
2445 \begin_layout Subsubsection
2446 Method draw_clip_outside: Draw a bitmap outside game are, with clipping
2447 \end_layout
2449 \begin_layout Itemize
2450 Syntax: dbitmap:draw_clip_outside(x, y, palette, x0, y0, width, height)
2451 \end_layout
2453 \begin_layout Standard
2454 Like dbitmap:draw_clip, but only draw outside game area.
2455 \end_layout
2457 \begin_layout Subsubsection
2458 Method pset: Set pixel in bitmap
2459 \end_layout
2461 \begin_layout Itemize
2462 Syntax: bitmap:pset(x, y, color)
2463 \end_layout
2465 \begin_layout Itemize
2466 Deprecaed: gui.bitmap_pset(bitmap, ...)
2467 \end_layout
2469 \begin_layout Standard
2470 Parameters:
2471 \end_layout
2473 \begin_layout Itemize
2474 bitmap: DBITMAP: The bitmap to manipulate.
2475 \end_layout
2477 \begin_layout Itemize
2478 x: number: x-coordinate of pixel to set.
2479 \end_layout
2481 \begin_layout Itemize
2482 y: number: y-coordinate of pixel to set.
2483 \end_layout
2485 \begin_layout Itemize
2486 color: number/string: The color to set.
2487 \end_layout
2489 \begin_layout Standard
2490 Sets specified pixel <x>,<y> in bitmap <bitmap> to color <color>.
2491 \end_layout
2493 \begin_layout Subsubsection
2494 Method pget: Get pixel in bitmap
2495 \end_layout
2497 \begin_layout Itemize
2498 Syntax: color bitmap:pget(x,y)
2499 \end_layout
2501 \begin_layout Itemize
2502 Deprecated: color gui.bitmap_pget(bitmap, ...)
2503 \end_layout
2505 \begin_layout Standard
2506 Parameters:
2507 \end_layout
2509 \begin_layout Itemize
2510 bitmap: DBITMAP: The bitmap to query.
2511 \end_layout
2513 \begin_layout Itemize
2514 x: number: x-coordinate of pixel to get.
2515 \end_layout
2517 \begin_layout Itemize
2518 y: number: y-coordinate of pixel to get.
2519 \end_layout
2521 \begin_layout Standard
2522 Returns:
2523 \end_layout
2525 \begin_layout Itemize
2526 color: number: The color of specified pixel.
2527 \end_layout
2529 \begin_layout Standard
2530 Gets color index of specified pixel <x>,<y> in bitmap <bitmap>.
2531 \end_layout
2533 \begin_layout Subsubsection
2534 Method size: Get size of bitmap
2535 \end_layout
2537 \begin_layout Itemize
2538 Syntax: width, height bitmap:size()
2539 \end_layout
2541 \begin_layout Itemize
2542 Syntax: width, height gui.bitmap_size(bitmap)
2543 \end_layout
2545 \begin_layout Standard
2546 Parameters:
2547 \end_layout
2549 \begin_layout Itemize
2550 bitmap: DBITMAP: The bitmap to query.
2551 \end_layout
2553 \begin_layout Standard
2554 Returns:
2555 \end_layout
2557 \begin_layout Itemize
2558 width: number: The width of the bitmap.
2559 \end_layout
2561 \begin_layout Itemize
2562 height: number: The height of the bitmap.
2563 \end_layout
2565 \begin_layout Standard
2566 Get size of bitmap <bitmap>.
2567 \end_layout
2569 \begin_layout Subsubsection
2570 Method blit: Blit a bitmap into another
2571 \end_layout
2573 \begin_layout Itemize
2574 Syntax: dest:blit(dx, dy, src, sx, sy, w, h, [ck])
2575 \end_layout
2577 \begin_layout Itemize
2578 Syntax: dest:blit(dx, dy, src, srcpal, sx, sy, w, h, [ck])
2579 \end_layout
2581 \begin_layout Itemize
2582 Deprecated: gui.bitmap_blit(dest, ...)
2583 \end_layout
2585 \begin_layout Standard
2586 Parameters:
2587 \end_layout
2589 \begin_layout Itemize
2590 dest: DBITMAP: The target bitmap to blit to.
2591 \end_layout
2593 \begin_layout Itemize
2594 dx: number: The x-coordinate in target.
2595 \end_layout
2597 \begin_layout Itemize
2598 dy: number: The y-coordinate in target.
2599 \end_layout
2601 \begin_layout Itemize
2602 src: BITMAP/DBITMAP: The source bitmap.
2603 \end_layout
2605 \begin_layout Itemize
2606 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2607 \end_layout
2609 \begin_layout Itemize
2610 sx: number: The x-coordinate in source.
2611 \end_layout
2613 \begin_layout Itemize
2614 sy: number: The y-coordinate in source.
2615 \end_layout
2617 \begin_layout Itemize
2618 w: number: The width of area to blit.
2619 \end_layout
2621 \begin_layout Itemize
2622 h: number: The height of area to blit.
2623 \end_layout
2625 \begin_layout Itemize
2626 ck: number: The color key.
2627  Pixels with this index are not copied.
2628 \end_layout
2630 \begin_deeper
2631 \begin_layout Itemize
2632 If none is specified, all pixels are copied.
2633 \end_layout
2635 \begin_layout Itemize
2636 If <src> is paletted, this is color index, otherwise it is a color.
2637 \end_layout
2639 \end_deeper
2640 \begin_layout Standard
2641 Copy region of size <w>*<h> at <sx>,<sy> in bitmap <src> (with palette <pal>
2642  if indexed) into <dest> at <dx>,<dy>.
2643  If a color key <ck> is specified, pixels of that color are not copied.
2644 \end_layout
2646 \begin_layout Subsubsection
2647 Method blit_scaled: Blit a bitmap into another with scaling
2648 \end_layout
2650 \begin_layout Itemize
2651 Syntax: dest:blit_scaled(dx, dy, src, sx, sy, w, h, hscl, [vscl], [ck])
2652 \end_layout
2654 \begin_layout Itemize
2655 Syntax: dest:blit_scaled(dx, dy, src, srcpal, sx, sy, w, h, hscl, [vscl],
2656  [ck])
2657 \end_layout
2659 \begin_layout Itemize
2660 Deprecated: gui.bitmap_blit_scaled(dest, ...)
2661 \end_layout
2663 \begin_layout Standard
2664 Parameters:
2665 \end_layout
2667 \begin_layout Itemize
2668 dest: DBITMAP: The target bitmap to blit to.
2669 \end_layout
2671 \begin_layout Itemize
2672 dx: number: The x-coordinate in target.
2673 \end_layout
2675 \begin_layout Itemize
2676 dy: number: The y-coordinate in target.
2677 \end_layout
2679 \begin_layout Itemize
2680 src: BITMAP/DBITMAP: The source bitmap.
2681 \end_layout
2683 \begin_layout Itemize
2684 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2685 \end_layout
2687 \begin_layout Itemize
2688 sx: number: The x-coordinate in source.
2689 \end_layout
2691 \begin_layout Itemize
2692 sy: number: The y-coordinate in source.
2693 \end_layout
2695 \begin_layout Itemize
2696 w: number: The width of area to blit.
2697 \end_layout
2699 \begin_layout Itemize
2700 h: number: The height of area to blit.
2701 \end_layout
2703 \begin_layout Itemize
2704 hscl: number: Horizontal scale factor (integer).
2705 \end_layout
2707 \begin_layout Itemize
2708 vscl: number: Vertical scale factor (integer).
2709  Defaults to the same as <hscl>.
2710 \end_layout
2712 \begin_layout Itemize
2713 ck: number: The color key.
2714  Pixels with this index are not copied.
2715 \end_layout
2717 \begin_deeper
2718 \begin_layout Itemize
2719 If none is specified, all pixels are copied.
2720 \end_layout
2722 \begin_layout Itemize
2723 If <src> is paletted, this is color index, otherwise it is a color.
2724 \end_layout
2726 \end_deeper
2727 \begin_layout Standard
2728 Like DBITMAP:blit, but also scales the copied part of bitmap (using nearest
2729  neighbor) by factor of <hscl>*<vscl>.
2730 \end_layout
2732 \begin_layout Subsubsection
2733 Method blit_porterduff: Blit a bitmap into another with Porter-Duff composition
2734 \end_layout
2736 \begin_layout Itemize
2737 Syntax: dest:blit_porterduff(dx, dy, src, sx, sy, w, h, operator)
2738 \end_layout
2740 \begin_layout Itemize
2741 Syntax: dest:blit_porterduff(dx, dy, src, srcpal, sx, sy, w, h, operator)
2742 \end_layout
2744 \begin_layout Itemize
2745 Deprecated: gui.bitmap_blit_porterduff(dest, ...)
2746 \end_layout
2748 \begin_layout Standard
2749 Parameters:
2750 \end_layout
2752 \begin_layout Itemize
2753 dest: DBITMAP: The target bitmap to blit to.
2754 \end_layout
2756 \begin_layout Itemize
2757 dx: number: The x-coordinate in target.
2758 \end_layout
2760 \begin_layout Itemize
2761 dy: number: The y-coordinate in target.
2762 \end_layout
2764 \begin_layout Itemize
2765 src: BITMAP/DBITMAP: The source bitmap.
2766 \end_layout
2768 \begin_layout Itemize
2769 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2770 \end_layout
2772 \begin_layout Itemize
2773 sx: number: The x-coordinate in source.
2774 \end_layout
2776 \begin_layout Itemize
2777 sy: number: The y-coordinate in source.
2778 \end_layout
2780 \begin_layout Itemize
2781 w: number: The width of area to blit.
2782 \end_layout
2784 \begin_layout Itemize
2785 h: number: The height of area to blit.
2786 \end_layout
2788 \begin_layout Itemize
2789 operator: string: The operator to use.
2790 \end_layout
2792 \begin_deeper
2793 \begin_layout Itemize
2794 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2795  DestOut, Clear or Xor.
2796 \end_layout
2798 \end_deeper
2799 \begin_layout Standard
2800 Like DBITMAP:blit, but instead of just overwriting, applies specified Porter-Duf
2801 f operator.
2803 \end_layout
2805 \begin_layout Itemize
2806 In target, fully transparent is background.
2807  In source, either fully transparent (if direct) or index 0 (if paletted)
2808  is treated as background.
2809 \end_layout
2811 \begin_layout Subsubsection
2812 Method blit_scaled_porterduff: Blit a bitmap into another with scaling and
2813  Porter-Duff composition
2814 \end_layout
2816 \begin_layout Itemize
2817 Syntax: dest:blit_scaled_porterduff(dx, dy, src, sx, sy, w, h, hscl, [vscl],
2818  operator)
2819 \end_layout
2821 \begin_layout Itemize
2822 Syntax: dest:blit_scaled_porterduff(dx, dy, src, srcpal, sx, sy, w, h, hscl,
2823  [vscl], operator)
2824 \end_layout
2826 \begin_layout Itemize
2827 Deprecated: gui.bitmap_blit_scaled_porterduff(dest, ...)
2828 \end_layout
2830 \begin_layout Standard
2831 Parameters:
2832 \end_layout
2834 \begin_layout Itemize
2835 dest: DBITMAP: The target bitmap to blit to.
2836 \end_layout
2838 \begin_layout Itemize
2839 dx: number: The x-coordinate in target.
2840 \end_layout
2842 \begin_layout Itemize
2843 dy: number: The y-coordinate in target.
2844 \end_layout
2846 \begin_layout Itemize
2847 src: BITMAP/DBITMAP: The source bitmap.
2848 \end_layout
2850 \begin_layout Itemize
2851 srcpal: PALETTE: If <src> is indexed, this is the palette for source.
2852 \end_layout
2854 \begin_layout Itemize
2855 sx: number: The x-coordinate in source.
2856 \end_layout
2858 \begin_layout Itemize
2859 sy: number: The y-coordinate in source.
2860 \end_layout
2862 \begin_layout Itemize
2863 w: number: The width of area to blit.
2864 \end_layout
2866 \begin_layout Itemize
2867 h: number: The height of area to blit.
2868 \end_layout
2870 \begin_layout Itemize
2871 hscl: number: Horizontal scale factor (integer).
2872 \end_layout
2874 \begin_layout Itemize
2875 vscl: number: Vertical scale factor (integer).
2876  Defaults to the same as <hscl>.
2877 \end_layout
2879 \begin_layout Itemize
2880 operator: string: The operator to use.
2881 \end_layout
2883 \begin_deeper
2884 \begin_layout Itemize
2885 Can be one of: Src, Atop, Over, In, Out, Dest, DestAtop, DestOver, DestIn,
2886  DestOut, Clear or Xor.
2887 \end_layout
2889 \end_deeper
2890 \begin_layout Standard
2891 Like DBITMAP:blit_porterduff, but also scales the source by <hscl>*<vscl>
2892  like DBITMAP:blit_scaled.
2893 \end_layout
2895 \begin_layout Subsubsection
2896 Method adjust_transparency: Adjust transparency of bitmap
2897 \end_layout
2899 \begin_layout Itemize
2900 Syntax: bitmap:adjust_transparency(newvalue)
2901 \end_layout
2903 \begin_layout Itemize
2904 Deprecated: gui.adjust_transparency(bitmap, ...)
2905 \end_layout
2907 \begin_layout Standard
2908 Parameters:
2909 \end_layout
2911 \begin_layout Itemize
2912 bitmap: DBITMAP: The bitmap to adjust.
2913 \end_layout
2915 \begin_layout Itemize
2916 Number adj: The factor to multiply opaqueness with times 256.
2917 \end_layout
2919 \begin_layout Standard
2920 Multiply opaqueness of all colors in bitmap <bitmap> by factor of <adj>/256.
2921 \end_layout
2923 \begin_layout Subsubsection
2924 Method save_png: Save a bitmap to PNG
2925 \end_layout
2927 \begin_layout Itemize
2928 Syntax: bitmap:save_png(filename, [base])
2929 \end_layout
2931 \begin_layout Itemize
2932 Syntax: data bitmap:save_png()
2933 \end_layout
2935 \begin_layout Itemize
2936 Deprecated: ...
2937  gui.bitmap_save_png(bitmap, ...)
2938 \end_layout
2940 \begin_layout Standard
2941 Parameters:
2942 \end_layout
2944 \begin_layout Itemize
2945 bitmap: DBITMAP: The bitmap to save.
2946 \end_layout
2948 \begin_layout Itemize
2949 filename: string: The filename to save to.
2950 \end_layout
2952 \begin_layout Itemize
2953 base: string: The base filename is resolved relative to.
2954 \end_layout
2956 \begin_layout Standard
2957 Return value:
2958 \end_layout
2960 \begin_layout Itemize
2961 data: string: BASE64 encoded PNG data.
2962 \end_layout
2964 \begin_layout Standard
2965 Save bitmap <bitmap> into PNG file <filename> (relative to <base>) or return
2966  BASE64 encoding of it.
2967 \end_layout
2969 \begin_layout Subsubsection
2970 Method hash: Hash a bitmap
2971 \end_layout
2973 \begin_layout Itemize
2974 Syntax: hash bitmap:hash()
2975 \end_layout
2977 \begin_layout Itemize
2978 Deprecated: hash bitmap:hash(bitmap)
2979 \end_layout
2981 \begin_layout Standard
2982 Parameters:
2983 \end_layout
2985 \begin_layout Itemize
2986 bitmap: DBITMAP: The bitmap to hash.
2987 \end_layout
2989 \begin_layout Standard
2990 Return value:
2991 \end_layout
2993 \begin_layout Itemize
2994 hash: string: 64-hex digit hash
2995 \end_layout
2997 \begin_layout Standard
2998 Hashes bitmap <bitmap> and returns crypto-strong hash.
3000 \end_layout
3002 \begin_layout Subsection
3003 IMAGELOADER: Load an image
3004 \end_layout
3006 \begin_layout Subsubsection
3007 Static function load: Load a bitmap from file
3008 \end_layout
3010 \begin_layout Itemize
3011 Syntax: bitmap, palette gui.image.load(file, [base])
3012 \end_layout
3014 \begin_layout Itemize
3015 Syntax: bitmap, palette classes.IMAGELOADER.load(file, [base])
3016 \end_layout
3018 \begin_layout Itemize
3019 Deprecated: ...
3020  gui.bitmap_load(...)
3021 \end_layout
3023 \begin_layout Standard
3024 Parameters:
3025 \end_layout
3027 \begin_layout Itemize
3028 file: string: The file to read.
3029 \end_layout
3031 \begin_layout Itemize
3032 base: string: The base to resolve <file> relative to.
3033 \end_layout
3035 \begin_layout Standard
3036 Returns:
3037 \end_layout
3039 \begin_layout Itemize
3040 bitmap: BITMAP/DBITMAP: The new bitmap
3041 \end_layout
3043 \begin_layout Itemize
3044 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3045  nil.
3046 \end_layout
3048 \begin_layout Standard
3049 Load a new bitmap and return it (plus associated palette if any).
3050 \end_layout
3052 \begin_layout Subsubsection
3053 Static function load_str: Load a bitmap from string
3054 \end_layout
3056 \begin_layout Itemize
3057 Syntax: bitmap, palette gui.image.load_str(data)
3058 \end_layout
3060 \begin_layout Itemize
3061 Syntax: bitmap, palette classes.IMAGELOADER.load_str(data)
3062 \end_layout
3064 \begin_layout Itemize
3065 Deprecated: ...
3066  gui.bitmap_load_str(...)
3067 \end_layout
3069 \begin_layout Standard
3070 Parameters:
3071 \end_layout
3073 \begin_layout Itemize
3074 data: string: The image data
3075 \end_layout
3077 \begin_layout Standard
3078 Returns:
3079 \end_layout
3081 \begin_layout Itemize
3082 bitmap: BITMAP/DBITMAP: The new bitmap
3083 \end_layout
3085 \begin_layout Itemize
3086 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3087  nil.
3088 \end_layout
3090 \begin_layout Standard
3091 Like IMAGELOADER:load, but read the bitmap from string <data> instead of
3092  file.
3093 \end_layout
3095 \begin_layout Subsubsection
3096 Static function load_png: Load a bitmap from PNG file
3097 \end_layout
3099 \begin_layout Itemize
3100 Syntax: bitmap, palette gui.image.load_png(file, [base])
3101 \end_layout
3103 \begin_layout Itemize
3104 Syntax: bitmap, palette classes.IMAGELOADER.load_png(file, [base])
3105 \end_layout
3107 \begin_layout Itemize
3108 Deprecated: ...
3109  gui.bitmap_load_png(...)
3110 \end_layout
3112 \begin_layout Standard
3113 Parameters:
3114 \end_layout
3116 \begin_layout Itemize
3117 file: string: The file to read.
3118 \end_layout
3120 \begin_layout Itemize
3121 base: string: The base to resolve <file> relative to.
3122 \end_layout
3124 \begin_layout Standard
3125 Returns:
3126 \end_layout
3128 \begin_layout Itemize
3129 bitmap: BITMAP/DBITMAP: The new bitmap
3130 \end_layout
3132 \begin_layout Itemize
3133 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3134  nil.
3135 \end_layout
3137 \begin_layout Standard
3138 Like IMAGELOADER:load, but load a PNG file instead.
3139 \end_layout
3141 \begin_layout Subsubsection
3142 Static function load_png_str: Load a PNG bitmap from string
3143 \end_layout
3145 \begin_layout Itemize
3146 Syntax: bitmap, palette gui.image.load_png_str(data)
3147 \end_layout
3149 \begin_layout Itemize
3150 Syntax: bitmap, palette classes.IMAGELOADER.load_png_str(data)
3151 \end_layout
3153 \begin_layout Itemize
3154 Deprecated: ...
3155  gui.bitmap_load_png_str(...)
3156 \end_layout
3158 \begin_layout Standard
3159 Parameters:
3160 \end_layout
3162 \begin_layout Itemize
3163 data: string: The image data, base64 encoded.
3164 \end_layout
3166 \begin_layout Standard
3167 Returns:
3168 \end_layout
3170 \begin_layout Itemize
3171 bitmap: BITMAP/DBITMAP: The new bitmap
3172 \end_layout
3174 \begin_layout Itemize
3175 palette: PALETTE: If bitmap is paletted, this is the palette, otherwise
3176  nil.
3177 \end_layout
3179 \begin_layout Standard
3180 Like IMAGELOADER:load_png, but read the bitmap from BASE64 encoded string
3181  <data> instead of file.
3182 \end_layout
3184 \begin_layout Standard
3185 \begin_inset Newpage pagebreak
3186 \end_inset
3189 \end_layout
3191 \begin_layout Subsection
3192 CUSTOMFONT: Arbitrary-sized bitmap font
3193 \end_layout
3195 \begin_layout Subsubsection
3196 Static function new: Return a new empty font
3197 \end_layout
3199 \begin_layout Itemize
3200 Syntax: font gui.font.new()
3201 \end_layout
3203 \begin_layout Itemize
3204 Syntax: font classes.CUSTOMFONT.new()
3205 \end_layout
3207 \begin_layout Itemize
3208 Deprecated: font gui.font_new()
3209 \end_layout
3211 \begin_layout Standard
3212 Return value:
3213 \end_layout
3215 \begin_layout Itemize
3216 font: CUSTOMFONT: New font.
3217 \end_layout
3219 \begin_layout Standard
3220 Create a new font with no characters and return it.
3221 \end_layout
3223 \begin_layout Subsubsection
3224 Static function: load: Load a font file
3225 \end_layout
3227 \begin_layout Itemize
3228 Syntax: font gui.font.load(file, [base])
3229 \end_layout
3231 \begin_layout Itemize
3232 Syntax: font gui.font.load()
3233 \end_layout
3235 \begin_layout Itemize
3236 Syntax: font classes.CUSTOMFONT.load(file, [base])
3237 \end_layout
3239 \begin_layout Itemize
3240 Syntax: font classes.CUSTOMFONT.load()
3241 \end_layout
3243 \begin_layout Itemize
3244 Deprecated: font gui.loadfont(...)
3245 \end_layout
3247 \begin_layout Standard
3248 Parameters:
3249 \end_layout
3251 \begin_layout Itemize
3252 file: string: The file to read the font from
3253 \end_layout
3255 \begin_layout Itemize
3256 base: string: The file to resolve <file> relative to.
3257 \end_layout
3259 \begin_layout Standard
3260 Return value:
3261 \end_layout
3263 \begin_layout Itemize
3264 font: CUSTOMFONT: New font.
3265 \end_layout
3267 \begin_layout Standard
3268 Load font from file <file> (relative to <base>).
3269  If no filename is given, system default font is loaded.
3270 \end_layout
3272 \begin_layout Subsubsection
3273 operator(): Render text to screen
3274 \end_layout
3276 \begin_layout Itemize
3277 Syntax: font(x, y, text, [fgc], [bgc], [hlc])
3278 \end_layout
3280 \begin_layout Standard
3281 Parmeters:
3282 \end_layout
3284 \begin_layout Itemize
3285 font: CUSTOMFONT: The font to use.
3286 \end_layout
3288 \begin_layout Itemize
3289 x: number: The x-position on screen to draw to.
3290 \end_layout
3292 \begin_layout Itemize
3293 y: number: The y-position on screen to draw to.
3294 \end_layout
3296 \begin_layout Itemize
3297 text: string: The text to draw.
3298 \end_layout
3300 \begin_layout Itemize
3301 fgc: number/string: Foreground color (default white).
3302 \end_layout
3304 \begin_layout Itemize
3305 bgc: number/string: Background color (default transparent).
3306 \end_layout
3308 \begin_layout Itemize
3309 hlc: number/string: Outline color (default transparent).
3310 \end_layout
3312 \begin_layout Standard
3313 Draws a string <text> with specified font <font> and colors <fgc>,<bgc>,<hlc>
3314  onto screen.
3315 \end_layout
3317 \begin_layout Itemize
3318 If <hlc> is transparent, no outline is drawn.
3319 \end_layout
3321 \begin_layout Subsubsection
3322 Method edit: Alter glyph in font
3323 \end_layout
3325 \begin_layout Itemize
3326 Syntax: font:edit(character, glyph)
3327 \end_layout
3329 \begin_layout Standard
3330 Parameters:
3331 \end_layout
3333 \begin_layout Itemize
3334 font: CUSTOMFONT: The font to edit.
3335 \end_layout
3337 \begin_layout Itemize
3338 character: string: The character to edit (UTF-8 encoded).
3339 \end_layout
3341 \begin_layout Itemize
3342 glyph: BITMAP: The bitmap to use.
3343 \end_layout
3345 \begin_layout Standard
3346 Replace character <character> in font <font> by <glyph>.
3347 \end_layout
3349 \begin_layout Itemize
3350 Color index 0 is background, everything else is foreground.
3351 \end_layout
3353 \begin_layout Itemize
3354 <character> may be empty string, meaning the replacement character used
3355  for bad characters.
3356 \end_layout
3358 \begin_layout Itemize
3359 <character> may be multi-codepoint string, meaning character used for that
3360  ligature.
3361 \end_layout
3363 \begin_layout Standard
3364 \begin_inset Newpage pagebreak
3365 \end_inset
3368 \end_layout
3370 \begin_layout Subsection
3371 ICONV: Character set conversions
3372 \end_layout
3374 \begin_layout Subsubsection
3375 Static function new: Create new character set converter
3376 \end_layout
3378 \begin_layout Itemize
3379 Syntax: iconv iconv.new(from, to);
3380 \end_layout
3382 \begin_layout Itemize
3383 Syntax: iconv classes.ICONV.new(from, to);
3384 \end_layout
3386 \begin_layout Itemize
3387 Deprecated: iconv iconv_new(...);
3388 \end_layout
3390 \begin_layout Standard
3391 Parameters:
3392 \end_layout
3394 \begin_layout Itemize
3395 from: string: The source character set.
3396 \end_layout
3398 \begin_layout Itemize
3399 to: string: The target character set.
3400 \end_layout
3402 \begin_layout Standard
3403 Returns:
3404 \end_layout
3406 \begin_layout Itemize
3407 iconv: ICONV: The converter.
3408 \end_layout
3410 \begin_layout Standard
3411 Create a character set converter, converting from <from> to <to> and return
3412  it.
3413 \end_layout
3415 \begin_layout Subsubsection
3416 Operator(): Convert string fragment from character set to another
3417 \end_layout
3419 \begin_layout Itemize
3420 Syntax: success, result, unconverted, error iconv(input)
3421 \end_layout
3423 \begin_layout Standard
3424 Parameters:
3425 \end_layout
3427 \begin_layout Itemize
3428 iconv: ICONV: The context to use.
3429 \end_layout
3431 \begin_layout Itemize
3432 input: string: The input to convert.
3433 \end_layout
3435 \begin_layout Standard
3436 Return value:
3437 \end_layout
3439 \begin_layout Itemize
3440 success: boolean: True if conversion was successful, false if not.
3441 \end_layout
3443 \begin_layout Itemize
3444 result: string: The string (partially) converted.
3445 \end_layout
3447 \begin_layout Itemize
3448 unconvered: number: Number of bytes that were not converted (only if <success>
3449  is false).
3450 \end_layout
3452 \begin_layout Itemize
3453 error: string: Error that caused conversion to stop (only if <success> is
3454  false).
3455 \end_layout
3457 \begin_deeper
3458 \begin_layout Itemize
3459 INVALID: The input string is invalid.
3460 \end_layout
3462 \begin_layout Itemize
3463 INCOMPLETE: The input string cuts off in middle of character.
3464 \end_layout
3466 \begin_layout Itemize
3467 INTERNALERR: Internal error.
3468 \end_layout
3470 \end_deeper
3471 \begin_layout Standard
3472 Convert a string <input> using character set converter <iconv> and return
3473  the result.
3474 \end_layout
3476 \begin_layout Standard
3477 \begin_inset Newpage pagebreak
3478 \end_inset
3481 \end_layout
3483 \begin_layout Subsection
3484 FILEREADER: Read a file as a stream
3485 \end_layout
3487 \begin_layout Subsubsection
3488 Static function open: Open a stream
3489 \end_layout
3491 \begin_layout Itemize
3492 Syntax: handle filereader.open(file, [base])
3493 \end_layout
3495 \begin_layout Itemize
3496 Syntax: handle classes.FILEREADER.open(file, [base])
3497 \end_layout
3499 \begin_layout Itemize
3500 Deprecated: handle open_file(file, [base])
3501 \end_layout
3503 \begin_layout Standard
3504 Parameters:
3505 \end_layout
3507 \begin_layout Itemize
3508 file: string: The filename to read.
3509 \end_layout
3511 \begin_layout Itemize
3512 base: string: The base <file> is resolved against.
3513 \end_layout
3515 \begin_layout Standard
3516 Returns:
3517 \end_layout
3519 \begin_layout Itemize
3520 handle: FILEREADER: The new file reader.
3521 \end_layout
3523 \begin_layout Standard
3524 Open file <file> (relative to <base>) and return a handle to it.
3525 \end_layout
3527 \begin_layout Subsubsection
3528 operator(): Read line/bytes from stream
3529 \end_layout
3531 \begin_layout Itemize
3532 Syntax: result handle()
3533 \end_layout
3535 \begin_layout Itemize
3536 Syntax: result handle(bytes)
3537 \end_layout
3539 \begin_layout Standard
3540 Parameters:
3541 \end_layout
3543 \begin_layout Itemize
3544 handle: FILEREADER: The handle to read from.
3545 \end_layout
3547 \begin_layout Itemize
3548 bytes: Number of bytes to read (default is next line).
3549 \end_layout
3551 \begin_layout Standard
3552 Returns:
3553 \end_layout
3555 \begin_layout Itemize
3556 result: string: The read data, or nil on end-of-file.
3557 \end_layout
3559 \begin_layout Standard
3560 Reads next line or <bytes> bytes from specified file handle <handle>.
3561 \end_layout
3563 \begin_layout Itemize
3564 If reading specified number of bytes, the bytes are read in binary mode
3565  (as-is).
3566 \end_layout
3568 \begin_layout Itemize
3569 If reading next line, the line is read in text mode (any line ending is
3570  skpped).
3571 \end_layout
3573 \begin_layout Subsubsection
3574 Method lines: Iterator to read all lines
3575 \end_layout
3577 \begin_layout Itemize
3578 Syntax: for line in handle:lines() do ...
3579  end
3580 \end_layout
3582 \begin_layout Standard
3583 Parameters:
3584 \end_layout
3586 \begin_layout Itemize
3587 handle: FILEREADER: The handle to read.
3588 \end_layout
3590 \begin_layout Standard
3591 Returns:
3592 \end_layout
3594 \begin_layout Itemize
3595 A lua iterator with one variable.
3596 \end_layout
3598 \begin_layout Standard
3599 Return a Lua iterator that iterates all the lines in <handle>.
3600 \end_layout
3602 \begin_layout Standard
3603 \begin_inset Newpage pagebreak
3604 \end_inset
3607 \end_layout
3609 \begin_layout Subsection
3610 COMPARE_OBJ: Watch memory area for changes
3611 \end_layout
3613 \begin_layout Standard
3614 Objects of this class allow fast checking for modifications to given memory
3615  block.
3616 \end_layout
3618 \begin_layout Subsubsection
3619 Static function new: Create a checker
3620 \end_layout
3622 \begin_layout Itemize
3623 Syntax: handle classes.COMPARE_OBJ.new({marea, offset|addrobj}, size, [rows,
3624  stride])
3625 \end_layout
3627 \begin_layout Itemize
3628 Syntax: handle memory.compare_new({marea, offset|addrobj}, size, rows, stride)
3629 \end_layout
3631 \begin_layout Standard
3632 Parameters:
3633 \end_layout
3635 \begin_layout Itemize
3636 marea: string: The memory area to interpret <offset> against.
3637 \end_layout
3639 \begin_layout Itemize
3640 offset: number: The initial offset in memory area.
3641 \end_layout
3643 \begin_layout Itemize
3644 addrobj: ADDRESS: The memory address.
3645 \end_layout
3647 \begin_layout Itemize
3648 size: number: The number of bytes in each row.
3649 \end_layout
3651 \begin_layout Itemize
3652 rows: number: The number of rows.
3653  Default is 1.
3654 \end_layout
3656 \begin_layout Itemize
3657 stride: number: The number of bytes offset increments from one row to next.
3658 \end_layout
3660 \begin_layout Standard
3661 Returns:
3662 \end_layout
3664 \begin_layout Itemize
3665 A handle to object.
3666 \end_layout
3668 \begin_layout Standard
3669 Return an object watching specified memory area.
3670 \end_layout
3672 \begin_layout Itemize
3673 Note: For fastest operation, limit checks to inside one memory area (that
3674  has to be mappable, individual RAM areas often are).
3675 \end_layout
3677 \begin_layout Subsubsection
3678 operator(): Check area for modifications
3679 \end_layout
3681 \begin_layout Itemize
3682 Syntax: boolean handle()
3683 \end_layout
3685 \begin_layout Standard
3686 Returns:
3687 \end_layout
3689 \begin_layout Itemize
3690 True if memory block has been modified since last call (or object creation
3691  if first call), false if not.
3692 \end_layout
3694 \begin_layout Standard
3695 Check if the block has been modified.
3696 \end_layout
3698 \begin_layout Subsection
3699 ADDRESS: Memory address
3700 \end_layout
3702 \begin_layout Standard
3703 Objects of this class contain a memory address.
3704 \end_layout
3706 \begin_layout Subsubsection
3707 Static function new: Create new memory address
3708 \end_layout
3710 \begin_layout Itemize
3711 Syntax: ADDRESS classes.ADDRESS.new(string marea, number offset)
3712 \end_layout
3714 \begin_layout Itemize
3715 Syntax: ADDRESS memory.address.new(string marea, number offset)
3716 \end_layout
3718 \begin_layout Itemize
3719 Syntax: ADDRESS memory.mkaddr(string marea, number offset)
3720 \end_layout
3722 \begin_layout Standard
3723 Parameters:
3724 \end_layout
3726 \begin_layout Itemize
3727 marea: The memory area
3728 \end_layout
3730 \begin_layout Itemize
3731 offset: The offset in memory area.
3732 \end_layout
3734 \begin_layout Standard
3735 Returns:
3736 \end_layout
3738 \begin_layout Itemize
3739 The memory area.
3740 \end_layout
3742 \begin_layout Standard
3743 Construct a new memory address object.
3744 \end_layout
3746 \begin_layout Subsubsection
3747 Method: addr: Get global address
3748 \end_layout
3750 \begin_layout Itemize
3751 Syntax: number addr:addr()
3752 \end_layout
3754 \begin_layout Standard
3755 Parameters:
3756 \end_layout
3758 \begin_layout Itemize
3759 addr: ADRESS: The original address.
3760 \end_layout
3762 \begin_layout Standard
3763 Returns:
3764 \end_layout
3766 \begin_layout Itemize
3767 The global address corresponding to this address.
3768 \end_layout
3770 \begin_layout Subsubsection
3771 Method: vma: Get memory area
3772 \end_layout
3774 \begin_layout Itemize
3775 Syntax: string addr:vma()
3776 \end_layout
3778 \begin_layout Standard
3779 Parameters:
3780 \end_layout
3782 \begin_layout Itemize
3783 addr: ADRESS: The original address.
3784 \end_layout
3786 \begin_layout Standard
3787 Returns:
3788 \end_layout
3790 \begin_layout Itemize
3791 The memory area corresponding to this address.
3792 \end_layout
3794 \begin_layout Subsubsection
3795 Method: offset: Get memory area offset
3796 \end_layout
3798 \begin_layout Itemize
3799 Syntax: string addr:offset()
3800 \end_layout
3802 \begin_layout Standard
3803 Parameters:
3804 \end_layout
3806 \begin_layout Itemize
3807 addr: ADRESS: The original address.
3808 \end_layout
3810 \begin_layout Standard
3811 Returns:
3812 \end_layout
3814 \begin_layout Itemize
3815 The offset in memory area corresponding to this address.
3816 \end_layout
3818 \begin_layout Subsubsection
3819 Method: replace: Replace address part
3820 \end_layout
3822 \begin_layout Itemize
3823 Syntax: ADDRESS addr:replace(offset[, bits])
3824 \end_layout
3826 \begin_layout Standard
3827 Parameters:
3828 \end_layout
3830 \begin_layout Itemize
3831 addr: ADRESS: The original address.
3832 \end_layout
3834 \begin_layout Itemize
3835 offset: number: The new offset
3836 \end_layout
3838 \begin_layout Itemize
3839 bits: number: The number of LSB to replace.
3840 \end_layout
3842 \begin_layout Standard
3843 Returns:
3844 \end_layout
3846 \begin_layout Itemize
3847 The modified address
3848 \end_layout
3850 \begin_layout Standard
3851 Returns a new address, with <bits> (all if missing) least significant bits
3852  of <addr> replaced by LSB of <offset>.
3853 \end_layout
3855 \begin_layout Subsubsection
3856 Method: add: Add to address
3857 \end_layout
3859 \begin_layout Itemize
3860 Syntax: ADDRESS addr:add(offset)
3861 \end_layout
3863 \begin_layout Itemize
3864 Syntax: ADDRESS addr:add(number, stride)
3865 \end_layout
3867 \begin_layout Itemize
3868 Syntax: ADDRESS addr:add(number, stride, offset)
3869 \end_layout
3871 \begin_layout Standard
3872 Parameters:
3873 \end_layout
3875 \begin_layout Itemize
3876 addr: ADRESS: The original address.
3877 \end_layout
3879 \begin_layout Itemize
3880 offset: number: Offset to add.
3881 \end_layout
3883 \begin_layout Itemize
3884 number: number: Number of table strides to add.
3885 \end_layout
3887 \begin_layout Itemize
3888 stride: number: The table stride.
3889 \end_layout
3891 \begin_layout Standard
3892 Returns:
3893 \end_layout
3895 \begin_layout Itemize
3896 The modified address
3897 \end_layout
3899 \begin_layout Standard
3900 Adds <offset>, <number>*<stride> or <number>*<stride>+<offset> into specified
3901  address <addr>.
3902 \end_layout
3904 \begin_layout Subsection
3905 ADDRESS:<op>: Read/Write memory
3906 \end_layout
3908 \begin_layout Itemize
3909 Syntax: none addr:<op>(value)
3910 \end_layout
3912 \begin_layout Itemize
3913 Syntax: number addr:<op>()
3914 \end_layout
3916 \begin_layout Standard
3917 Parameters:
3918 \end_layout
3920 \begin_layout Itemize
3921 addr: ADDRESS: The address to read/write.
3922 \end_layout
3924 \begin_layout Itemize
3925 value: number: The number to write.
3926 \end_layout
3928 \begin_layout Standard
3929 Returns:
3930 \end_layout
3932 \begin_layout Itemize
3933 The value read.
3934 \end_layout
3936 \begin_layout Standard
3937 Read/Write value from/to given address <addr>.
3938  The value written is <value>.
3939  <Op> is of form: [i][s]<type>, where:
3940 \end_layout
3942 \begin_layout Itemize
3943 <type> is one of 'byte', 'word', 'hword', 'dword', 'qword', 'float', 'double'.
3944 \end_layout
3946 \begin_layout Itemize
3947 'i' signifies that the value is treated as opposite-to-normal endianess,
3948 \end_layout
3950 \begin_layout Itemize
3951 's' signifies that value is treated as signed (not available for floating-point).
3952 \end_layout
3954 \begin_layout Standard
3955 \begin_inset Newpage pagebreak
3956 \end_inset
3959 \end_layout
3961 \begin_layout Section
3962 Global
3963 \end_layout
3965 \begin_layout Subsection
3966 print: Print values to console
3967 \end_layout
3969 \begin_layout Itemize
3970 Syntax: none print(value...
3971  values)
3972 \end_layout
3974 \begin_layout Standard
3975 Prints specified values to console.
3976  Can print any Lua type at least enough to identify the type and instance.
3977 \end_layout
3979 \begin_layout Subsection
3980 tostringx: Format a value to string
3981 \end_layout
3983 \begin_layout Itemize
3984 Syntax: string tostringx(value val)
3985 \end_layout
3987 \begin_layout Standard
3988 Formats value <val> like print would, and returns the result as a string.
3989 \end_layout
3991 \begin_layout Subsection
3992 exec: Execute lsnes commands
3993 \end_layout
3995 \begin_layout Itemize
3996 Syntax: none exec(string cmd)
3997 \end_layout
3999 \begin_layout Standard
4000 Execute lsnes command <cmd>.
4001 \end_layout
4003 \begin_layout Subsection
4004 utime: Get current time
4005 \end_layout
4007 \begin_layout Itemize
4008 Syntax: (number,number) utime()
4009 \end_layout
4011 \begin_layout Standard
4012 Returns two numbers.
4013  First is time since some epoch in seconds, the second is microseconds mod
4014  10^6 since that epoch.
4015 \end_layout
4017 \begin_layout Subsection
4018 set_idle_timeout: Run function after timeout when emulator is idle
4019 \end_layout
4021 \begin_layout Itemize
4022 Syntax: none set_idle_timeout(number timeout)
4023 \end_layout
4025 \begin_layout Standard
4026 Set number of microseconds to block idle for.
4027  After this timeout has expired, on_idle() will be called once.
4028 \end_layout
4030 \begin_layout Subsection
4031 set_timer_timeout: Run function after timeout.
4032 \end_layout
4034 \begin_layout Itemize
4035 Syntax: none set_timer_timeout(number timeout)
4036 \end_layout
4038 \begin_layout Standard
4039 Set number of microseconds to block timer for.
4040  After this timeout has expired, on_timer() will be called once.
4041 \end_layout
4043 \begin_layout Subsection
4044 bus_address: Look up address in system bus.
4045 \end_layout
4047 \begin_layout Itemize
4048 Syntax: none bus_address(number bus_addr)
4049 \end_layout
4051 \begin_layout Standard
4052 Returns virtual address corresponding to specified address on system bus.
4053 \end_layout
4055 \begin_layout Subsection
4056 loopwrapper: Convert loop into callable function
4057 \end_layout
4059 \begin_layout Itemize
4060 Syntax: function loopwrapper(function fun, ...)
4061 \end_layout
4063 \begin_layout Standard
4064 Calls function <fun> with function and specified arguments.
4065  The function passed suspends execution until the function returned is called.
4066  Handy for linear flow control among multiple invocations of a hook.
4067  Example code:
4068 \end_layout
4070 \begin_layout LyX-Code
4071 on_paint = loopwrapper(function(wait)
4072 \end_layout
4074 \begin_deeper
4075 \begin_layout LyX-Code
4076 while true do
4077 \end_layout
4079 \begin_deeper
4080 \begin_layout LyX-Code
4081 gui.text(0, 0, 
4082 \begin_inset Quotes eld
4083 \end_inset
4085 Test!
4086 \begin_inset Quotes erd
4087 \end_inset
4090 \end_layout
4092 \begin_layout LyX-Code
4093 wait();
4094 \end_layout
4096 \end_deeper
4097 \begin_layout LyX-Code
4099 \end_layout
4101 \end_deeper
4102 \begin_layout LyX-Code
4103 end);
4104 \end_layout
4106 \begin_layout Subsection
4107 list_bindings: List keybindings
4108 \end_layout
4110 \begin_layout Itemize
4111 Syntax: table list_bindings([string cmd])
4112 \end_layout
4114 \begin_layout Standard
4115 Get table of all keybindings, indexed by keyspec (modifiers|mask/key).
4116  If <cmd> is specified, the table is limited to that command.
4117  Also searches for controller keys.
4118 \end_layout
4120 \begin_layout Subsection
4121 get_alias: Get expansion of alias
4122 \end_layout
4124 \begin_layout Itemize
4125 Syntax: string get_alias(string aname)
4126 \end_layout
4128 \begin_layout Standard
4129 Get expansion of given alias <aname>.
4130 \end_layout
4132 \begin_layout Subsection
4133 set_alias: Set expansion of alias
4134 \end_layout
4136 \begin_layout Itemize
4137 Syntax: none set_alias(string aname, string value)
4138 \end_layout
4140 \begin_layout Standard
4141 Set expansion of given alias.
4142 \end_layout
4144 \begin_layout Subsection
4145 create_ibind: Create invese binding
4146 \end_layout
4148 \begin_layout Itemize
4149 Syntax: INVERSEBIND create_ibind(string name, string cmd)
4150 \end_layout
4152 \begin_layout Standard
4153 Return object representing inverse binding with specified name <name> and
4154  specified command <cmd>.
4155 \end_layout
4157 \begin_layout Itemize
4158 Note: To create press/release commands, use aliases +foo and -foo .
4159 \end_layout
4161 \begin_layout Itemize
4162 Note: Keep the returned object around.
4163 \end_layout
4165 \begin_layout Subsection
4166 create_command: Create a command
4167 \end_layout
4169 \begin_layout Itemize
4170 Syntax: COMMANDBIND create_commmand(string name, function a)
4171 \end_layout
4173 \begin_layout Itemize
4174 Syntax: COMMANDBIND create_commmand(string name, function a, function b)
4175 \end_layout
4177 \begin_layout Standard
4178 Return object representing a command (pair).
4179 \end_layout
4181 \begin_layout Itemize
4182 If only one function is specied, the command is level-sensitive, <a> is
4183  callback.
4184 \end_layout
4186 \begin_layout Itemize
4187 If <b> is function, the function is edge-sensitive, <a> is positive edge
4188  callback and <b> is negative edge callback.
4189 \end_layout
4191 \begin_layout Itemize
4192 All callbacks get single argument: The parameters passed.
4193 \end_layout
4195 \begin_layout Itemize
4196 Keep the returned object around.
4197 \end_layout
4199 \begin_layout Subsection
4200 loadfile: Load Lua script
4201 \end_layout
4203 \begin_layout Itemize
4204 Syntax: function loadfile(string filename[, string base])
4205 \end_layout
4207 \begin_layout Standard
4208 Load lua script from <filename>, resolved relative to <base> (if empty,
4209  current directory).
4210 \end_layout
4212 \begin_layout Subsection
4213 dofile: Execute Lua script
4214 \end_layout
4216 \begin_layout Itemize
4217 Syntax: function dofile(string filename[, string base])
4218 \end_layout
4220 \begin_layout Standard
4221 Execute lua script from <filename>, resolved relative to <base> (if empty,
4222  current directory) and return all return values.
4223 \end_layout
4225 \begin_layout Subsection
4226 resolve_filename: Resolve name of file relative to another
4227 \end_layout
4229 \begin_layout Itemize
4230 Syntax: string resolve_file(string filename, string base)
4231 \end_layout
4233 \begin_layout Standard
4234 Resolve name of file <filename> relative to <base> and return the result.
4235 \end_layout
4237 \begin_layout Subsection
4238 render_queue_function: Return paint function for render queue
4239 \end_layout
4241 \begin_layout Itemize
4242 Syntax: function render_queue_function(RENDERQUEUE rq)
4243 \end_layout
4245 \begin_layout Standard
4246 Return function that renders render queue <rq>.
4247 \end_layout
4249 \begin_layout Itemize
4250 Handy for paint callback if one is using render queues updated in other
4251  callbacks.
4252  As in:
4253 \end_layout
4255 \begin_layout LyX-Code
4256 handle = callback.paint:register(render_queue_function(my_rq));
4257 \end_layout
4259 \begin_layout Subsection
4260 identify_class: Identify class of object
4261 \end_layout
4263 \begin_layout Itemize
4264 Syntax: string identify_class(userdata object)
4265 \end_layout
4267 \begin_layout Standard
4268 Identifies the class of userdata <object>, if possible.
4269  If no identification is possible, returns 
4270 \begin_inset Quotes eld
4271 \end_inset
4273 unknown
4274 \begin_inset Quotes erd
4275 \end_inset
4278 \end_layout
4280 \begin_layout Subsection
4281 lookup_class: Lookup class by name
4282 \end_layout
4284 \begin_layout Itemize
4285 Syntax: classobj lookup_class(string name)
4286 \end_layout
4288 \begin_layout Standard
4289 Looks up class corresponding to <name>, if possible.
4290  If not found, returns nil.
4291  The classobj has following fields:
4292 \end_layout
4294 \begin_layout Itemize
4295 _static_methods: Return static method names
4296 \end_layout
4298 \begin_layout Itemize
4299 _class_methods: Return class method names
4300 \end_layout
4302 \begin_layout Itemize
4303 <static-function-name>: The specified static function.
4304 \end_layout
4306 \begin_layout Subsection
4307 all_classes: Get list of all classes
4308 \end_layout
4310 \begin_layout Itemize
4311 Syntax: string...
4312  all_classes()
4313 \end_layout
4315 \begin_layout Standard
4316 Get names of all classes available.
4317 \end_layout
4319 \begin_layout Subsection
4321 \end_layout
4323 \begin_layout Subsection
4324 icnov: Class ICONV
4325 \end_layout
4327 \begin_layout Standard
4328 See class ICONV.
4329 \end_layout
4331 \begin_layout Subsection
4332 filereader: Class FILEREADER
4333 \end_layout
4335 \begin_layout Standard
4336 See class FILEREADER.
4337 \end_layout
4339 \begin_layout Standard
4340 \begin_inset Newpage pagebreak
4341 \end_inset
4344 \end_layout
4346 \begin_layout Section
4347 Table bit:
4348 \end_layout
4350 \begin_layout Standard
4351 Bitwise logical functions and related.
4352 \end_layout
4354 \begin_layout Subsection
4355 bit.none/bit.bnot: Bitwise none or NOT function
4356 \end_layout
4358 \begin_layout Itemize
4359 Syntax: number bit.none(number...)
4360 \end_layout
4362 \begin_layout Itemize
4363 Syntax: number bit.bnot(number...)
4364 \end_layout
4366 \begin_layout Standard
4367 48-bit bitwise NOT / NONE function (set bits that are set in none of the
4368  arguments).
4369 \end_layout
4371 \begin_layout Subsection
4372 bit.any/bit.bor: Bitwise any or OR function
4373 \end_layout
4375 \begin_layout Itemize
4376 Syntax: number bit.any(number...)
4377 \end_layout
4379 \begin_layout Itemize
4380 Syntax: number bit.bor(number...)
4381 \end_layout
4383 \begin_layout Standard
4384 48-bit bitwise OR / ANY function (set bits that are set in any of the arguments).
4385 \end_layout
4387 \begin_layout Subsection
4388 bit.all/bit.band: Bitwise all or AND function
4389 \end_layout
4391 \begin_layout Itemize
4392 Syntax: number bit.all(number...)
4393 \end_layout
4395 \begin_layout Itemize
4396 Syntax: number bit.band(number...)
4397 \end_layout
4399 \begin_layout Standard
4400 48-bit bitwise AND / ALL function (set bits that are set in all of the arguments
4402 \end_layout
4404 \begin_layout Subsection
4405 bit.parity/bit.bxor: Bitwise parity or XOR function
4406 \end_layout
4408 \begin_layout Itemize
4409 Syntax: number bit.parity(number...)
4410 \end_layout
4412 \begin_layout Itemize
4413 Syntax: number bit.bxor(number...)
4414 \end_layout
4416 \begin_layout Standard
4417 48-bit bitwise XOR / PARITY function (set bits that are set in odd number
4418  of the arguments).
4419 \end_layout
4421 \begin_layout Subsection
4422 bit.lrotate: Rotate a number left
4423 \end_layout
4425 \begin_layout Itemize
4426 Syntax: number bit.lrotate(number base[, number amount[, number bits]])
4427 \end_layout
4429 \begin_layout Standard
4430 Rotate <bits>-bit (max 48, default 48) number <base> left by <amount> (default
4431  1) places.
4432 \end_layout
4434 \begin_layout Subsection
4435 bit.rrotate: Rotate a number right
4436 \end_layout
4438 \begin_layout Itemize
4439 Syntax: number bit.rrotate(number base[, number amount[, number bits]])
4440 \end_layout
4442 \begin_layout Standard
4443 Rotate <bits>-bit (max 48, default 48) number <base> right by <amount> (default
4444  1) places.
4445 \end_layout
4447 \begin_layout Subsection
4448 bit.lshift: Shift a number left
4449 \end_layout
4451 \begin_layout Itemize
4452 Syntax: number bit.lshift(number base[, number amount[, number bits]])
4453 \end_layout
4455 \begin_layout Standard
4456 Shift <bits>-bit (max 48, default 48) number <base> left by <amount> (default
4457  1) places.
4458  The new bits are filled with zeroes.
4459 \end_layout
4461 \begin_layout Subsection
4462 bit.lrshift: Shift a number right (logical)
4463 \end_layout
4465 \begin_layout Itemize
4466 Syntax: number bit.lrshift(number base[, number amount[, number bits]])
4467 \end_layout
4469 \begin_layout Standard
4470 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
4471  (default 1) places.
4472  The new bits are filled with zeroes.
4473 \end_layout
4475 \begin_layout Subsection
4476 bit.arshift: Shift a number right (arithmetic)
4477 \end_layout
4479 \begin_layout Itemize
4480 Syntax: number bit.arshift(number base[, number amount[, number bits]])
4481 \end_layout
4483 \begin_layout Standard
4484 Shift <bits>-bit (max 48, default 48) number <base> logically right by <amount>
4485  (default 1) places.
4486  The new bits are shifted in with copy of the high bit.
4487 \end_layout
4489 \begin_layout Subsection
4490 bit.extract: Extract/shuffle bits from number
4491 \end_layout
4493 \begin_layout Itemize
4494 Syntax: number bit.extract(number base[, number bit0[, number bit1,...]])
4495 \end_layout
4497 \begin_layout Standard
4498 Returns number that has bit0-th bit as bit 0, bit1-th bit as 1 and so on.
4499 \end_layout
4501 \begin_layout Itemize
4502 Note: Bit numbers up to 51 should work reliably (then things start falling
4503  apart due to double precision issues).
4504 \end_layout
4506 \begin_layout Itemize
4507 Note: There are two special bit positions, true and false, standing for
4508  always set bit and always clear bit.
4509 \end_layout
4511 \begin_layout Subsection
4512 bit.value: Construct number with specified bits set
4513 \end_layout
4515 \begin_layout Itemize
4516 Syntax: number bit.value([number bit1[, number bit2,...]])
4517 \end_layout
4519 \begin_layout Standard
4520 Returns bitwise OR of 1 left shifted by <bit1> places, 1 left shifted by
4521  <bit2> places and so on.
4522  As special value, nil argument is no-op.
4523 \end_layout
4525 \begin_layout Subsection
4526 bit.test: Test if bit is set
4527 \end_layout
4529 \begin_layout Itemize
4530 Syntax: boolean bit.test(number a, number bit)
4531 \end_layout
4533 \begin_layout Standard
4534 Tests if bit <bit> is set in <a>.
4535  If it is set, returns true, otherwise false.
4536 \end_layout
4538 \begin_layout Subsection
4539 bit.testn: Test if bit is clear
4540 \end_layout
4542 \begin_layout Itemize
4543 Syntax: boolean bit.testn(number a, number bit)
4544 \end_layout
4546 \begin_layout Standard
4547 Tests if bit <bit> is set in <a>.
4548  If it is clear, returns true, otherwise false.
4549 \end_layout
4551 \begin_layout Subsection
4552 bit.test_any: Test if any bit is set
4553 \end_layout
4555 \begin_layout Itemize
4556 Syntax: boolean bit.test_any(number a, number b)
4557 \end_layout
4559 \begin_layout Standard
4560 Returns true if bitwise and of <a> and <b> is nonzero, otherwise false.
4561 \end_layout
4563 \begin_layout Subsection
4564 bit.test_all: Test if all bits are set
4565 \end_layout
4567 \begin_layout Itemize
4568 Syntax: boolean bit.test_all(number a, number b)
4569 \end_layout
4571 \begin_layout Standard
4572 Returns true if bitwise and of <a> and <b> equals <b>, otherwise false.
4573 \end_layout
4575 \begin_layout Subsection
4576 bit.popcount: Population count
4577 \end_layout
4579 \begin_layout Itemize
4580 Syntax: number bit.popcount(number a)
4581 \end_layout
4583 \begin_layout Standard
4584 Returns number of set bits in <a>.
4585 \end_layout
4587 \begin_layout Subsection
4588 bit.clshift: Chained left shift
4589 \end_layout
4591 \begin_layout Itemize
4592 Syntax: (number, number) bit.clshift(number a, number b, [number amount,[number
4593  bits]])
4594 \end_layout
4596 \begin_layout Standard
4597 Does chained left shift on <a>, <b> by <amount> positions (default 1), assuming
4598  numbers to be of specified number of bits <bits> (default 48).
4599 \end_layout
4601 \begin_layout Subsection
4602 bit.crshift: Chained right shift
4603 \end_layout
4605 \begin_layout Itemize
4606 Syntax: (number, number) bit.crshift(number a, number b, [number amount,[number
4607  bits]])
4608 \end_layout
4610 \begin_layout Standard
4611 Does chained right shift on <a>, <b> by <amount> positions (default 1),
4612  assuming numbers to be of specified number of bits <bits> (default 48).
4613 \end_layout
4615 \begin_layout Subsection
4616 bit.flagdecode: Decode bitfield into flags
4617 \end_layout
4619 \begin_layout Itemize
4620 Syntax: string bit.flagdecode(number a, number bits, [string on, [string
4621  off]])
4622 \end_layout
4624 \begin_layout Standard
4625 Return string of length bits where ith character is ith character of on
4626  if bit i is on, otherwise ith character of off.
4627  Out of range reads give last character.
4628 \end_layout
4630 \begin_layout Itemize
4631 Note: <on> defaults to '*' if empty.
4632 \end_layout
4634 \begin_layout Itemize
4635 Note: <off> defaults to '-' if empty.
4636 \end_layout
4638 \begin_layout Subsection
4639 bit.rflagdecode: Decode bitfield into flags
4640 \end_layout
4642 \begin_layout Itemize
4643 Syntax: string bit.rflagdecode(number a, number bits, [string on, [string
4644  off]])
4645 \end_layout
4647 \begin_layout Standard
4648 Like bit.flagdecode, but outputs the string in the opposite order (most significa
4649 nt bit first).
4650 \end_layout
4652 \begin_layout Subsection
4653 bit.swap{,s}{,h,d,q}word: Swap word endian
4654 \end_layout
4656 \begin_layout Itemize
4657 Syntax: number bit.swapword(number n)
4658 \end_layout
4660 \begin_layout Itemize
4661 Syntax: number bit.swaphword(number n)
4662 \end_layout
4664 \begin_layout Itemize
4665 Syntax: number bit.swapdword(number n)
4666 \end_layout
4668 \begin_layout Itemize
4669 Syntax: number bit.swapqword(number n)
4670 \end_layout
4672 \begin_layout Itemize
4673 Syntax: number bit.swapsword(number n)
4674 \end_layout
4676 \begin_layout Itemize
4677 Syntax: number bit.swapshword(number n)
4678 \end_layout
4680 \begin_layout Itemize
4681 Syntax: number bit.swapsdword(number n)
4682 \end_layout
4684 \begin_layout Itemize
4685 Syntax: number bit.swapsqword(number n)
4686 \end_layout
4688 \begin_layout Standard
4689 Swap endianess of (un)signed integer <n>.
4690 \end_layout
4692 \begin_layout Subsection
4693 bit.compose: Compose multi-byte number
4694 \end_layout
4696 \begin_layout Itemize
4697 Syntax: number bit.compose(number n...)
4698 \end_layout
4700 \begin_layout Standard
4701 Return 
4702 \begin_inset Formula $n_{1}+256n_{2}+256^{2}n_{3}+\ldots$
4703 \end_inset
4706 \end_layout
4708 \begin_layout Subsection
4709 bit.binary_ld_{{u,s}{8,16,24,32,64},float,double}{l,b}e: Load binary integer
4710 \end_layout
4712 \begin_layout Itemize
4713 Syntax: number bit.binary_ld_<type>le(string str, number pos);
4714 \end_layout
4716 \begin_layout Itemize
4717 Syntax: number bit.binary_ld_<type>be(string str, number pos);
4718 \end_layout
4720 \begin_layout Standard
4721 Load little (*le) or big (*be) endian binary number from position <pos>
4722  of string <str>.
4723  Type may be one of: u8, u16, u24, u32, u64, s8, s16, s24, s32, s64, float,
4724  double.
4725 \end_layout
4727 \begin_layout Subsection
4728 bit.binary_st_{{u,s}{8,16,24,32,64},float,double}{l,b}e: Store binary integer
4729 \end_layout
4731 \begin_layout Itemize
4732 Syntax: string bit.binary_st_<type>le(number x);
4733 \end_layout
4735 \begin_layout Itemize
4736 Syntax: string bit.binary_st_<type>be(number x);
4737 \end_layout
4739 \begin_layout Standard
4740 Store specified number <x> as binary in string and return the result.
4741  Type may be one of: u8, u16, u24, u32, u64, s8, s16, s24, s32, s64, float,
4742  double.
4743 \end_layout
4745 \begin_layout Subsection
4746 bit.quotent: Integer quotent
4747 \end_layout
4749 \begin_layout Itemize
4750 Syntax: number bit.quotent(number a, number b)
4751 \end_layout
4753 \begin_layout Standard
4754 Calculate quotent a/b.
4755 \end_layout
4757 \begin_layout Subsection
4758 bit.multidiv: Divide and split among multiple divisiors
4759 \end_layout
4761 \begin_layout Itemize
4762 Syntax: number...
4763  bit.multidiv(number v, number q...)
4764 \end_layout
4766 \begin_layout Standard
4767 Does the following steps:
4768 \end_layout
4770 \begin_layout Enumerate
4771 Set v' to <v>.
4772 \end_layout
4774 \begin_layout Enumerate
4775 For each <q> q:
4776 \end_layout
4778 \begin_deeper
4779 \begin_layout Enumerate
4780 Calculate quotent(v'/q) and add that to numbers returned.
4781 \end_layout
4783 \begin_layout Enumerate
4784 v' <- remainder(v'/q)
4785 \end_layout
4787 \end_deeper
4788 \begin_layout Enumerate
4789 Add v' to numbers returned.
4790 \end_layout
4792 \begin_layout Standard
4793 That is, it successively divides <v> by <q>s, and reduces <v> modulo <q>
4794  at each step.
4795  <v> may be floating point, <q>s are integers.
4796 \end_layout
4798 \begin_layout Itemize
4799 E.g.
4800  bit.multidiv(time, 3600, 60) splits time into hours, minutes and seconds.
4801 \end_layout
4803 \begin_layout Itemize
4804 E.g.
4805  bit.multidiv(a, b) calculates quotent and remainder of a/b.
4806 \end_layout
4808 \begin_layout Subsection
4809 bit.mul32: 32-bit multiply
4810 \end_layout
4812 \begin_layout Itemize
4813 Syntax: number, number bit.mul32(number a, number b)
4814 \end_layout
4816 \begin_layout Standard
4817 Multiply 32-bit numbers <a> and <b>.
4818  The first return value is low 32 bits of result, the second is high 32
4819  bits.
4820 \end_layout
4822 \begin_layout Standard
4823 \begin_inset Newpage pagebreak
4824 \end_inset
4827 \end_layout
4829 \begin_layout Section
4830 Table classes:
4831 \end_layout
4833 \begin_layout Subsection
4834 classes.<foo>: The classobj for class <foo>
4835 \end_layout
4837 \begin_layout Itemize
4838 Syntax: classes.<foo>
4839 \end_layout
4841 \begin_layout Standard
4842 The classobj for class <foo>.
4843 \end_layout
4845 \begin_layout Subsection
4846 classes.<foo>._static_methods: Enumerate static methods
4847 \end_layout
4849 \begin_layout Itemize
4850 Syntax: string...
4851  classes.<foo>._static_methods()
4852 \end_layout
4854 \begin_layout Standard
4855 Returns all static methods of <foo> as strings.
4856 \end_layout
4858 \begin_layout Subsection
4859 classes.<foo>._class_methods: Enumerate static methods
4860 \end_layout
4862 \begin_layout Itemize
4863 Syntax: string...
4864  classes.<foo>._class_methods()
4865 \end_layout
4867 \begin_layout Standard
4868 Returns all class methods of <foo> as strings.
4869 \end_layout
4871 \begin_layout Subsection
4872 classes.<foo>.<bar>: Static method
4873 \end_layout
4875 \begin_layout Itemize
4876 Syntax: variable classes.<foo>.<bar>(variable...)
4877 \end_layout
4879 \begin_layout Standard
4880 Invokes static method <bar> of class <foo>.
4881 \end_layout
4883 \begin_layout Section
4884 Table gui:
4885 \end_layout
4887 \begin_layout Subsection
4888 gui.resolution: Get current resolution
4889 \end_layout
4891 \begin_layout Itemize
4892 Syntax: (number, number) gui.resolution()
4893 \end_layout
4895 \begin_layout Standard
4896 Returns 2-tuple (hresolution, vresolution).
4897 \end_layout
4899 \begin_layout Subsection
4900 gui.left_gap/gui.right_gap/gui.top_gap/gui.bottom_gap: Set edge gaps
4901 \end_layout
4903 \begin_layout Itemize
4904 Syntax: number gui.left_gap(number gap)
4905 \end_layout
4907 \begin_layout Itemize
4908 Syntax: number gui.right_gap(number gap)
4909 \end_layout
4911 \begin_layout Itemize
4912 Syntax: number gui.top_gap(number gap)
4913 \end_layout
4915 \begin_layout Itemize
4916 Syntax: number gui.bottom_gap(number gap)
4917 \end_layout
4919 \begin_layout Standard
4920 Set the specified edge gap to specified value <gap> (max gap is 8191).
4921  If successful, old gap is returned.
4922 \end_layout
4924 \begin_layout Subsection
4925 gui.delta_left_gap/gui.delta_right_gap/gui.delta_top_gap/gui.delta_bottom_gap:
4926  Adjust edge gaps
4927 \end_layout
4929 \begin_layout Itemize
4930 Syntax: number gui.delta_left_gap(number dgap)
4931 \end_layout
4933 \begin_layout Itemize
4934 Syntax: number gui.delta_right_gap(number dgap)
4935 \end_layout
4937 \begin_layout Itemize
4938 Syntax: number gui.delta_top_gap(number dgap)
4939 \end_layout
4941 \begin_layout Itemize
4942 Syntax: number gui.delta_bottom_gap(number dgap)
4943 \end_layout
4945 \begin_layout Standard
4946 Increase the specified edge gap by specified value <dgap> (max gap is 8191)
4947  and return the old gap (returns nothing on error).
4948 \end_layout
4950 \begin_layout Subsection
4951 gui.text/gui.textH/gui.textV,gui.textHV: Draw text
4952 \end_layout
4954 \begin_layout Itemize
4955 Syntax: none gui.text(number x, number y, string text[, number fgc[, number
4956  bgc]])
4957 \end_layout
4959 \begin_layout Itemize
4960 Syntax: none gui.textH(number x, number y, string text[, number fgc[, number
4961  bgc]])
4962 \end_layout
4964 \begin_layout Itemize
4965 Syntax: none gui.textV(number x, number y, string text[, number fgc[, number
4966  bgc]])
4967 \end_layout
4969 \begin_layout Itemize
4970 Syntax: none gui.textHV(number x, number y, string text[, number fgc[, number
4971  bgc]])
4972 \end_layout
4974 \begin_layout Standard
4975 Draw specified text on the GUI (each character cell is 8 or 16 wide and
4976  16 high).
4977  Parameters:
4978 \end_layout
4980 \begin_layout Itemize
4981 x: X-coordinate to start the drawing from (and x-coordinate at begining
4982  of the lines).
4983 \end_layout
4985 \begin_layout Itemize
4986 y: Y-coordinate to start the drawing from.
4987 \end_layout
4989 \begin_layout Itemize
4990 text: The text to draw.
4991 \end_layout
4993 \begin_layout Itemize
4994 fgc: Text color (default is 0xFFFFFF (white))
4995 \end_layout
4997 \begin_layout Itemize
4998 bgc: Background color (default is -1 (transparent))
4999 \end_layout
5001 \begin_layout Standard
5002 Note: The H variants draw at double width and V variants draw at double
5003  height.
5004 \end_layout
5006 \begin_layout Subsection
5007 gui.rectangle: Draw a rectangle
5008 \end_layout
5010 \begin_layout Itemize
5011 Syntax: none gui.rectangle(number x, number y, number width, number height[,
5012  number thickness[, number outline[, number fill]]])
5013 \end_layout
5015 \begin_layout Standard
5016 Draw rectangle on the GUI.
5017  Parameters:
5018 \end_layout
5020 \begin_layout Itemize
5021 x: X-coordinate of left edge.
5022 \end_layout
5024 \begin_layout Itemize
5025 y: Y-coordinate of upper edge.
5026 \end_layout
5028 \begin_layout Itemize
5029 width: Width of rectangle.
5030 \end_layout
5032 \begin_layout Itemize
5033 height: Height of rectangle.
5034 \end_layout
5036 \begin_layout Itemize
5037 thickness: Thickness of outline (default is 1).
5038 \end_layout
5040 \begin_layout Itemize
5041 outline: Color of outline (default is 0xFFFFFF (white))
5042 \end_layout
5044 \begin_layout Itemize
5045 fill: Color of fill (default is -1 (transparent))
5046 \end_layout
5048 \begin_layout Subsection
5049 gui.solidrectangle: Draw a solid rectangle
5050 \end_layout
5052 \begin_layout Itemize
5053 Syntax: none gui.rectangle(number x, number y, number width, number height[,
5054  number color])
5055 \end_layout
5057 \begin_layout Standard
5058 Draw solid rectangle on the GUI.
5059  Parameters:
5060 \end_layout
5062 \begin_layout Itemize
5063 x: X-coordinate of left edge.
5064 \end_layout
5066 \begin_layout Itemize
5067 y: Y-coordinate of upper edge.
5068 \end_layout
5070 \begin_layout Itemize
5071 width: Width of rectangle.
5072 \end_layout
5074 \begin_layout Itemize
5075 height: Height of rectangle.
5076 \end_layout
5078 \begin_layout Itemize
5079 color: Color of rectangle (default is 0xFFFFFF (white))
5080 \end_layout
5082 \begin_layout Subsection
5083 gui.box: Draw a 3D-effect box
5084 \end_layout
5086 \begin_layout Itemize
5087 Syntax: none gui.box(number x, number y, number width, number height[, number
5088  thickness[, number outline1[,number outline2[, number fill]]]])
5089 \end_layout
5091 \begin_layout Standard
5092 Draw rectangle with 3D effect on the GUI.
5093  Parameters:
5094 \end_layout
5096 \begin_layout Itemize
5097 x: X-coordinate of left edge.
5098 \end_layout
5100 \begin_layout Itemize
5101 y: Y-coordinate of upper edge.
5102 \end_layout
5104 \begin_layout Itemize
5105 width: Width of rectangle.
5106 \end_layout
5108 \begin_layout Itemize
5109 height: Height of rectangle.
5110 \end_layout
5112 \begin_layout Itemize
5113 thickness: Thickness of outline (default is 1).
5114 \end_layout
5116 \begin_layout Itemize
5117 outline1: First color of outline (default is 0xFFFFFF (white))
5118 \end_layout
5120 \begin_layout Itemize
5121 outline2: First color of outline (default is 0x808080 (dark gray))
5122 \end_layout
5124 \begin_layout Itemize
5125 fill: Color of fill (default is 0xC0C0C0 (light grayy))
5126 \end_layout
5128 \begin_layout Subsection
5129 gui.pixel: Draw a single pixel
5130 \end_layout
5132 \begin_layout Itemize
5133 Syntax: none gui.pixel(number x, number y[, number color])
5134 \end_layout
5136 \begin_layout Standard
5137 Draw one pixel on the GUI.
5138  Parameters:
5139 \end_layout
5141 \begin_layout Itemize
5142 x: X-coordinate of the pixel
5143 \end_layout
5145 \begin_layout Itemize
5146 y: Y-coordinate of the pixel
5147 \end_layout
5149 \begin_layout Itemize
5150 color: Color of the pixel (default is 0xFFFFFF (white))
5151 \end_layout
5153 \begin_layout Subsection
5154 gui.crosshair: Draw a crosshair
5155 \end_layout
5157 \begin_layout Itemize
5158 Syntax: none gui.crosshair(number x, number y[, number length[, number color]])
5159 \end_layout
5161 \begin_layout Standard
5162 Draw a crosshair.
5163  Parameters:
5164 \end_layout
5166 \begin_layout Itemize
5167 x: X-coordinate of the crosshair
5168 \end_layout
5170 \begin_layout Itemize
5171 y: Y-coordinate of the crosshair
5172 \end_layout
5174 \begin_layout Itemize
5175 length: Length of the crosshair lines (default 10).
5176 \end_layout
5178 \begin_layout Itemize
5179 color: Color of the crosshair (default is 0xFFFFFF (white))
5180 \end_layout
5182 \begin_layout Subsection
5183 gui.line: Draw a line
5184 \end_layout
5186 \begin_layout Itemize
5187 Syntax: none gui.line(number x1, number y1, number x2, number y2[, number
5188  color])
5189 \end_layout
5191 \begin_layout Standard
5192 Draw a thin line.
5193  Parameters:
5194 \end_layout
5196 \begin_layout Itemize
5197 x1: X-coordinate of one end.
5198 \end_layout
5200 \begin_layout Itemize
5201 y1: Y-coordinate of one end.
5202 \end_layout
5204 \begin_layout Itemize
5205 x2: X-coordinate of the other end.
5206 \end_layout
5208 \begin_layout Itemize
5209 y2: Y-coordinate of the other end.
5210 \end_layout
5212 \begin_layout Itemize
5213 color: Color of the line (default is 0xFFFFFF (white)).
5214 \end_layout
5216 \begin_layout Subsection
5217 gui.circle: Draw a (filled) circle
5218 \end_layout
5220 \begin_layout Itemize
5221 Syntax: none gui.circle(number x, number y, number r[, number thick[, number
5222  border[, number fil]]])
5223 \end_layout
5225 \begin_layout Standard
5226 Draw a circle.
5227  Parameters.
5228 \end_layout
5230 \begin_layout Itemize
5231 x: X-coordinate of the center
5232 \end_layout
5234 \begin_layout Itemize
5235 y: Y-coordinate of the center
5236 \end_layout
5238 \begin_layout Itemize
5239 r: The radius of the circle
5240 \end_layout
5242 \begin_layout Itemize
5243 thick: Border thickness
5244 \end_layout
5246 \begin_layout Itemize
5247 border: Border color (default is 0xFFFFFF (white))
5248 \end_layout
5250 \begin_layout Itemize
5251 fill: Fill color (default is -1 (transparent)).
5252 \end_layout
5254 \begin_layout Subsection
5255 gui.repaint: Arrange a repaint
5256 \end_layout
5258 \begin_layout Itemize
5259 Syntax: none gui.repaint()
5260 \end_layout
5262 \begin_layout Standard
5263 Request on_repaint() to happen as soon as possible.
5264 \end_layout
5266 \begin_layout Subsection
5267 gui.subframe_update: Enable/Disable subframe updates
5268 \end_layout
5270 \begin_layout Itemize
5271 Syntax: none gui.subframe_update(boolean on)
5272 \end_layout
5274 \begin_layout Standard
5275 Request subframe updates (calling on_paint() on subframes) to happen (<on>=true)
5276  or not happen (<on>=false).
5277 \end_layout
5279 \begin_layout Subsection
5280 gui.screenshot: Write a screenshot
5281 \end_layout
5283 \begin_layout Itemize
5284 Syntax: none gui.screenshot(string filename)
5285 \end_layout
5287 \begin_layout Standard
5288 Write PNG screenshot of the current frame (no drawings) to specified file
5289  <filename>.
5290 \end_layout
5292 \begin_layout Subsection
5293 gui.screenshot_bitmap: Write a screenshot to bitmap
5294 \end_layout
5296 \begin_layout Itemize
5297 Syntax: DBITMAP gui.screenshot_bitmap()
5298 \end_layout
5300 \begin_layout Standard
5301 Write PNG screenshot of the current frame (no drawings) to dbitmap and return
5302  the result.
5303 \end_layout
5305 \begin_layout Subsection
5306 gui.color: Compose a color.
5307 \end_layout
5309 \begin_layout Itemize
5310 Syntax: number gui.color(number r, number g, number b[, number a])
5311 \end_layout
5313 \begin_layout Itemize
5314 Syntax: number gui.color(string c)
5315 \end_layout
5317 \begin_layout Standard
5318 Returns color (in notation Lua scripts use) corresponding to color (<r>,<g>,<b>)
5319 , each component in scale 0-255.
5320  If <a> is specified, that is alpha (0 is fully transparent, 256(sic) is
5321  fully opaque).
5322  The default alpha is 256.
5323 \end_layout
5325 \begin_layout Standard
5326 The form taking a string returns color corresponding color name.
5327 \end_layout
5329 \begin_layout Subsection
5330 gui.status: Set status variable
5331 \end_layout
5333 \begin_layout Itemize
5334 Syntax: none gui.status(string name, string value)
5335 \end_layout
5337 \begin_layout Standard
5338 Set status field 
5339 \begin_inset Quotes eld
5340 \end_inset
5342 L[<name>]
5343 \begin_inset Quotes erd
5344 \end_inset
5346  to <value> in status area.
5347 \end_layout
5349 \begin_layout Subsection
5350 gui.rainbow: Rainbow color calculation
5351 \end_layout
5353 \begin_layout Itemize
5354 Syntax: number gui.rainbow(number step, number steps[, number color])
5355 \end_layout
5357 \begin_layout Standard
5358 Perform hue rotation of color <color> (default bright red), by <step> steps.
5359  The number of steps per full rotation is given by absolute value of <steps>.
5360 \end_layout
5362 \begin_layout Standard
5363 If <step> is negative, the rotation will be counterclockwise.
5364 \end_layout
5366 \begin_layout Subsection
5367 gui.kill_frame: Kill video frame and associated sound
5368 \end_layout
5370 \begin_layout Itemize
5371 Syntax: none gui.kill_frame()
5372 \end_layout
5374 \begin_layout Standard
5375 Kills the currently dumped video frame + the associated sound.
5376  Only valid in on_video callback.
5377 \end_layout
5379 \begin_layout Subsection
5380 gui.set_video_scale: Set video frame scale
5381 \end_layout
5383 \begin_layout Itemize
5384 Syntax: none gui.set_video_scale(number h, number v)
5385 \end_layout
5387 \begin_layout Standard
5388 Sets the scale factors of current frame to <h>x<v>.
5389  Only valid in on_video callback.
5390 \end_layout
5392 \begin_layout Subsection
5393 gui.arrow: Draw an arrow
5394 \end_layout
5396 \begin_layout Itemize
5397 Syntax: none gui.arrow(number x, number y, number length, number hwidth,
5398  number direction[, bool fill[, number color[, number twidth[, number hthick]]]]
5400 \end_layout
5402 \begin_layout Standard
5403 Draws an arrow using color <color>.
5404  The tip of arrow is at (<x>, <y>).
5405  Other parameters:
5406 \end_layout
5408 \begin_layout Enumerate
5409 <length>: The length of arrow tail.
5410 \end_layout
5412 \begin_layout Enumerate
5413 <hwidth>: The width of arrow head.
5414  Should be odd.
5415 \end_layout
5417 \begin_layout Enumerate
5418 <direction>: Direction of arrow.
5419  0 is to right, +1 rotates 45 degrees counterclockwise.
5420 \end_layout
5422 \begin_layout Enumerate
5423 <fill>: If true, fill the arrow head.
5424  Default false.
5425 \end_layout
5427 \begin_layout Enumerate
5428 <twidth>: Tail width.
5429  Should be odd.
5430  Default 1.
5431 \end_layout
5433 \begin_layout Enumerate
5434 <hthick>: Head thickness (only used if <fill> is false).
5435  Default is <twidth>.
5436 \end_layout
5438 \begin_layout Subsection
5439 gui.tiled_bitmap: Class TILEMAP
5440 \end_layout
5442 \begin_layout Standard
5443 See class TILEMAP.
5444 \end_layout
5446 \begin_layout Subsection
5447 gui.palette: Class PALETTE
5448 \end_layout
5450 \begin_layout Standard
5451 See class PALETTE.
5452 \end_layout
5454 \begin_layout Subsection
5455 gui.bitmap: Class BITMAP
5456 \end_layout
5458 \begin_layout Standard
5459 See class BITMAP.
5460 \end_layout
5462 \begin_layout Subsection
5463 gui.dbitmap: Class DBITMAP
5464 \end_layout
5466 \begin_layout Standard
5467 See class DBITMAP.
5468 \end_layout
5470 \begin_layout Subsection
5471 gui.font: Class CUSTOMFONT
5472 \end_layout
5474 \begin_layout Standard
5475 See class CUSTOMFONT.
5476 \end_layout
5478 \begin_layout Subsection
5479 gui.renderctx: Class RENDERCTX
5480 \end_layout
5482 \begin_layout Standard
5483 See class RENDERCTX.
5484 \end_layout
5486 \begin_layout Subsection
5487 gui.image: Class IMAGELOADER
5488 \end_layout
5490 \begin_layout Standard
5491 See class IMAGELOADER.
5492 \end_layout
5494 \begin_layout Subsection
5495 gui.get_runmode: Get current emulator mode
5496 \end_layout
5498 \begin_layout Itemize
5499 Syntax: string gui.get_runmode()
5500 \end_layout
5502 \begin_layout Standard
5503 Gets the current emulator runmode.
5504  The possible ones are:
5505 \end_layout
5507 \begin_layout Itemize
5508 quit: Emulator is quitting.
5509 \end_layout
5511 \begin_layout Itemize
5512 normal: Emulator is running emulation
5513 \end_layout
5515 \begin_layout Itemize
5516 load: Emulator is loading a movie/savestate
5517 \end_layout
5519 \begin_layout Itemize
5520 advance_frame: Emulator is doing frame advance
5521 \end_layout
5523 \begin_layout Itemize
5524 advance_subframe: Emulator is doing subframe advance
5525 \end_layout
5527 \begin_layout Itemize
5528 skiplag: Emulator is skipping lag frames
5529 \end_layout
5531 \begin_layout Itemize
5532 skiplag_pending: Emulator will start skipping lag frames next frame
5533 \end_layout
5535 \begin_layout Itemize
5536 pause: Emulator is paused
5537 \end_layout
5539 \begin_layout Itemize
5540 pause_break: Emulator is paused at breakpoint
5541 \end_layout
5543 \begin_layout Itemize
5544 corrupt: Emulator can't run because corrupt emulation state
5545 \end_layout
5547 \begin_layout Itemize
5548 unknown: Unknown state (should not happen).
5549 \end_layout
5551 \begin_layout Standard
5552 \begin_inset Newpage pagebreak
5553 \end_inset
5556 \end_layout
5558 \begin_layout Section
5559 table input
5560 \end_layout
5562 \begin_layout Standard
5563 Input handling.
5564  Functions manipulating input are only available in on_input callback.
5565 \end_layout
5567 \begin_layout Subsection
5568 input.get: Read controller button/axis (deprecated)
5569 \end_layout
5571 \begin_layout Itemize
5572 Syntax: number input.get(number controller, number index)
5573 \end_layout
5575 \begin_layout Standard
5576 Read the specified index <index> (zero-based) from specified controller
5577  <controller> (zero-based).
5579 \end_layout
5581 \begin_layout Subsection
5582 input.set: Write controller button/axis (deprecated)
5583 \end_layout
5585 \begin_layout Itemize
5586 Syntax: none input.set(number controller, number index, number value)
5587 \end_layout
5589 \begin_layout Standard
5590 Write the specified index <index> (zero-based) from specified controller
5591  <controller> (zero-based), storing value <value>.
5592 \end_layout
5594 \begin_layout Subsection
5595 input.get2: Read controller button/axis
5596 \end_layout
5598 \begin_layout Itemize
5599 Syntax: number input.get2(number port, number controller, number index)
5600 \end_layout
5602 \begin_layout Standard
5603 Read the specified input tuple.
5604  Port 0 is system port.
5605 \end_layout
5607 \begin_layout Subsection
5608 input.set2: Write controller button/axis
5609 \end_layout
5611 \begin_layout Itemize
5612 Syntax: input.set2(number port, number controller, number index, number value)
5613 \end_layout
5615 \begin_layout Standard
5616 Write the specified input tuple.
5617  Port 0 is system port.
5618 \end_layout
5620 \begin_layout Subsection
5621 input.lcid_to_pcid2: Look up logical controller
5622 \end_layout
5624 \begin_layout Itemize
5625 Syntax: (number, number) input.lcid_to_pcid2(number lcid)
5626 \end_layout
5628 \begin_layout Standard
5629 Look up physical pcid pair (port, controller) corresponding to specified
5630  logical controller (1-based).
5631  Returns nothing if controller does not exist.
5632 \end_layout
5634 \begin_layout Subsection
5635 input.port_type: Look up port type
5636 \end_layout
5638 \begin_layout Itemize
5639 Syntax: string input.port_type(number port)
5640 \end_layout
5642 \begin_layout Standard
5643 Return type of specified port.
5644 \end_layout
5646 \begin_layout Subsection
5647 input.controller_info: Get information about controller
5648 \end_layout
5650 \begin_layout Itemize
5651 Syntax: table input.controller_info(number port, number controller)
5652 \end_layout
5654 \begin_layout Standard
5655 Get controller info for specified controller.
5656  If controller does not exist, returns nil.
5657  Otherwise returns a table with following fields:
5658 \end_layout
5660 \begin_layout Itemize
5661 type (string): Type of the controller.
5662 \end_layout
5664 \begin_layout Itemize
5665 class (string): Class of the controller.
5666 \end_layout
5668 \begin_layout Itemize
5669 classnum (number): Number of the controller within its class (1-based)
5670 \end_layout
5672 \begin_layout Itemize
5673 lcid (number): Logical controller number of the controller.
5674 \end_layout
5676 \begin_layout Itemize
5677 button_count (number): Number of buttons on controller
5678 \end_layout
5680 \begin_layout Itemize
5681 buttons (array): Array of following info about each button:
5682 \end_layout
5684 \begin_deeper
5685 \begin_layout Itemize
5686 type (string): Type of button.
5687  Currently one of 
5688 \begin_inset Quotes eld
5689 \end_inset
5691 null
5692 \begin_inset Quotes erd
5693 \end_inset
5696 \begin_inset Quotes eld
5697 \end_inset
5699 button
5700 \begin_inset Quotes erd
5701 \end_inset
5704 \begin_inset Quotes eld
5705 \end_inset
5707 axis
5708 \begin_inset Quotes erd
5709 \end_inset
5712 \begin_inset Quotes eld
5713 \end_inset
5715 raxis
5716 \begin_inset Quotes erd
5717 \end_inset
5720 \end_layout
5722 \begin_layout Itemize
5723 name (string): Name of button.
5724 \end_layout
5726 \begin_layout Itemize
5727 symbol (string): Symbol of button.
5728  Only present for type 
5729 \begin_inset Quotes eld
5730 \end_inset
5732 button
5733 \begin_inset Quotes erd
5734 \end_inset
5737 \end_layout
5739 \begin_layout Itemize
5740 hidden (boolean): True if hidden button.
5742 \end_layout
5744 \end_deeper
5745 \begin_layout Subsection
5746 input.veto_button: Veto a button press
5747 \end_layout
5749 \begin_layout Itemize
5750 Syntax: none input.veto_button()
5751 \end_layout
5753 \begin_layout Standard
5754 Signals that the button event should be vetoed.
5755  Only valid in on_button callback.
5756 \end_layout
5758 \begin_layout Subsection
5759 input.geta: Get all buttons for controller (deprecated)
5760 \end_layout
5762 \begin_layout Itemize
5763 Syntax: (number, number...) input.geta(number controller)
5764 \end_layout
5766 \begin_layout Standard
5767 Get input state for entiere controller.
5768  Returns n return values.
5769 \end_layout
5771 \begin_layout Itemize
5772 1st return value: Bitmask: bit i is set if i:th index is nonzero
5773 \end_layout
5775 \begin_layout Itemize
5776 2nd- return value: value of i:th index.
5777 \end_layout
5779 \begin_layout Subsection
5780 input.seta: Set all buttons for controller (deprecated)
5781 \end_layout
5783 \begin_layout Itemize
5784 Syntax: none input.seta(number controller, number bitmask, number args...)
5785 \end_layout
5787 \begin_layout Standard
5788 Set state for entiere controller.
5789  args is up to N values for indices (overriding values in bitmask if specified).
5790 \end_layout
5792 \begin_layout Subsection
5793 input.controllertype: Get controller type (deprecated)
5794 \end_layout
5796 \begin_layout Itemize
5797 syntax: string input.controllertype(number controller)
5798 \end_layout
5800 \begin_layout Standard
5801 Get the type of controller as string.
5802 \end_layout
5804 \begin_layout Subsection
5805 input.reset: Execute (delayed) reset
5806 \end_layout
5808 \begin_layout Itemize
5809 Syntax: none input.reset([number cycles])
5810 \end_layout
5812 \begin_layout Standard
5813 Execute reset.
5814  If <cycles> is greater than zero, do delayed reset.
5815  0 (or no value) causes immediate reset.
5816 \end_layout
5818 \begin_layout Itemize
5819 Note: Only available with subframe flag false.
5820 \end_layout
5822 \begin_layout Subsection
5823 input.raw: Return raw input data
5824 \end_layout
5826 \begin_layout Itemize
5827 Syntax: table input.raw()
5828 \end_layout
5830 \begin_layout Standard
5831 Returns table of tables of all available keys and axes.
5832  The first table is indexed by key name (platform-dependent!), and the inner
5833  table has the following fields:
5834 \end_layout
5836 \begin_layout Itemize
5837 value: Last reported value for control
5838 \end_layout
5840 \begin_deeper
5841 \begin_layout Itemize
5842 For keys: 1 for pressed, 0 for released.
5843 \end_layout
5845 \begin_layout Itemize
5846 For axes: -32767...32767.
5847 \end_layout
5849 \begin_layout Itemize
5850 For presure-sensitive buttons: 0...32767.
5851 \end_layout
5853 \begin_layout Itemize
5854 For hats: Bitmask: 1=>Up, 2=>Right, 4=>Down, 8=>Left.
5855 \end_layout
5857 \begin_layout Itemize
5858 For mouse: Coordinates relative to game area.
5859 \end_layout
5861 \end_deeper
5862 \begin_layout Itemize
5863 ktype: Type of key (disabled, key, mouse, axis, hat, pressure).
5864 \end_layout
5866 \begin_layout Subsection
5867 input.keyhook: Hook a key
5868 \end_layout
5870 \begin_layout Itemize
5871 Syntax: none input.keyhook(string key, boolean state)
5872 \end_layout
5874 \begin_layout Standard
5875 Requests that keyhook events to be sent for key <key> (<state>=true) or
5876  not sent (<state>=false).
5877 \end_layout
5879 \begin_layout Subsection
5880 input.joyget: Get controls for controller
5881 \end_layout
5883 \begin_layout Itemize
5884 Syntax: table input.joyget(number logical)
5885 \end_layout
5887 \begin_layout Standard
5888 Returns table for current controls for specified logical controller <logical>.
5889  The names of fields vary by controller type.
5890 \end_layout
5892 \begin_layout Itemize
5893 The buttons have the same name as those are referred to in other contexts
5894  in the emulator
5895 \end_layout
5897 \begin_layout Itemize
5898 The analog axes are usually 
5899 \begin_inset Quotes eld
5900 \end_inset
5902 xaxis
5903 \begin_inset Quotes erd
5904 \end_inset
5906  and 
5907 \begin_inset Quotes eld
5908 \end_inset
5910 yaxis
5911 \begin_inset Quotes erd
5912 \end_inset
5915 \end_layout
5917 \begin_layout Itemize
5918 Each field is numeric or boolean depending on axis/button.
5919 \end_layout
5921 \begin_layout Subsection
5922 input.joyset: Set controls for controller
5923 \end_layout
5925 \begin_layout Itemize
5926 Syntax: none input.joyset(number controller, table controls)
5927 \end_layout
5929 \begin_layout Standard
5930 Set the the state of specified controller to values specified in specified
5931  table.
5932 \end_layout
5934 \begin_layout Itemize
5935 Each field can be boolean or number.
5936 \end_layout
5938 \begin_layout Itemize
5939 Also, buttons allow strings, which cause value to be inverted.
5940 \end_layout
5942 \begin_layout Subsection
5943 input.lcid_to_pcid: Look up logical controller (deprecated)
5944 \end_layout
5946 \begin_layout Itemize
5947 Syntax: (number, number, number) input.lcid_to_pcid(number lcid)
5948 \end_layout
5950 \begin_layout Standard
5951 Returns the legacy pcid for controller (or false if there isn't one), followed
5952  by pcid pair.
5953  Returns nothing if controller does not exist.
5954 \end_layout
5956 \begin_layout Standard
5957 \begin_inset Newpage pagebreak
5958 \end_inset
5961 \end_layout
5963 \begin_layout Section
5964 Table keyboard
5965 \end_layout
5967 \begin_layout Standard
5968 Various keybinding-related functions
5969 \end_layout
5971 \begin_layout Subsection
5972 keyboard.bind: Bind a key
5973 \end_layout
5975 \begin_layout Itemize
5976 Syntax: none keyboard.bind(string mod, string mask, string key, string cmd)
5977 \end_layout
5979 \begin_layout Standard
5980 Bind specified key with specified modifers to specified command.
5981 \end_layout
5983 \begin_layout Subsection
5984 keyboard.unbind: Unbind a key
5985 \end_layout
5987 \begin_layout Itemize
5988 Syntax: none keyboard.unbind(string mod, string mask, string key)
5989 \end_layout
5991 \begin_layout Standard
5992 Unbind specified key with specified modifers.
5993 \end_layout
5995 \begin_layout Subsection
5996 keyboard.alias: Set alias expansion
5997 \end_layout
5999 \begin_layout Itemize
6000 Syntax: none keyboard.alias(string alias, string expansion)
6001 \end_layout
6003 \begin_layout Standard
6004 Set expansion of given command.
6005 \end_layout
6007 \begin_layout Standard
6008 \begin_inset Newpage pagebreak
6009 \end_inset
6012 \end_layout
6014 \begin_layout Section
6015 Table subtitle
6016 \end_layout
6018 \begin_layout Standard
6019 Subtitle handling
6020 \end_layout
6022 \begin_layout Subsection
6023 subtitle.byindex: Look up start and length of subtitle by index
6024 \end_layout
6026 \begin_layout Itemize
6027 Syntax: (number, number) subtitle.byindex(number i)
6028 \end_layout
6030 \begin_layout Standard
6031 Read the frame and length of ith subtitle.
6032  Returns nothing if not present.
6033 \end_layout
6035 \begin_layout Subsection
6036 subtitle.set: Write a subtitle
6037 \end_layout
6039 \begin_layout Itemize
6040 Syntax: none subtitle.set(number f, number l, string txt)
6041 \end_layout
6043 \begin_layout Standard
6044 Set the text of subtitle.
6045 \end_layout
6047 \begin_layout Subsection
6048 subtitle.get: Read a subtitle
6049 \end_layout
6051 \begin_layout Itemize
6052 Syntax: string subtitle.get(number f, number l)
6053 \end_layout
6055 \begin_layout Standard
6056 Get the text of subtitle.
6057 \end_layout
6059 \begin_layout Subsection
6060 subtitle.delete: Delete a subtitle
6061 \end_layout
6063 \begin_layout Itemize
6064 Syntax: none subtitle.delete(number f, number l)
6065 \end_layout
6067 \begin_layout Standard
6068 Delete specified subtitle.
6069 \end_layout
6071 \begin_layout Standard
6072 \begin_inset Newpage pagebreak
6073 \end_inset
6076 \end_layout
6078 \begin_layout Section
6079 Table hostmemory
6080 \end_layout
6082 \begin_layout Standard
6083 Host memory handling (extra memory saved to savestates).
6084  Host memory starts empty.
6085 \end_layout
6087 \begin_layout Itemize
6088 Reads out of range return false.
6089 \end_layout
6091 \begin_layout Itemize
6092 Writes out of range extend the memory.
6093 \end_layout
6095 \begin_layout Subsection
6096 hostmemory.read: Read byte from host memory
6097 \end_layout
6099 \begin_layout Itemize
6100 Syntax: number hostmemory.read(number address)
6101 \end_layout
6103 \begin_layout Standard
6104 Reads byte from hostmemory slot address <address>.
6105 \end_layout
6107 \begin_layout Subsection
6108 hostmemory.write: Write byte to host memory
6109 \end_layout
6111 \begin_layout Itemize
6112 Syntax: none hostmemory.write(number address, number value)
6113 \end_layout
6115 \begin_layout Standard
6116 Writes hostmemory slot with value <value> 0-255.
6117 \end_layout
6119 \begin_layout Subsection
6120 hostmemory.read{,s}{byte,{,h,d,q}word}: Read from host memory
6121 \end_layout
6123 \begin_layout Itemize
6124 Syntax: number hostmemory.readbyte(number address)
6125 \end_layout
6127 \begin_layout Itemize
6128 Syntax: number hostmemory.readsbyte(number address)
6129 \end_layout
6131 \begin_layout Itemize
6132 Syntax: number hostmemory.readword(number address)
6133 \end_layout
6135 \begin_layout Itemize
6136 Syntax: number hostmemory.readsword(number address)
6137 \end_layout
6139 \begin_layout Itemize
6140 Syntax: number hostmemory.readhword(number address)
6141 \end_layout
6143 \begin_layout Itemize
6144 Syntax: number hostmemory.readshword(number address)
6145 \end_layout
6147 \begin_layout Itemize
6148 Syntax: number hostmemory.readdword(number address)
6149 \end_layout
6151 \begin_layout Itemize
6152 Syntax: number hostmemory.readsdword(number address)
6153 \end_layout
6155 \begin_layout Itemize
6156 Syntax: number hostmemory.readqword(number address)
6157 \end_layout
6159 \begin_layout Itemize
6160 Syntax: number hostmemory.readsqword(number address)
6161 \end_layout
6163 \begin_layout Standard
6164 Read elements (big-endian) from given address <address>.
6165 \end_layout
6167 \begin_layout Itemize
6168 byte is 1 element
6169 \end_layout
6171 \begin_layout Itemize
6172 word is 2 elements
6173 \end_layout
6175 \begin_layout Itemize
6176 hword is 3 elements
6177 \end_layout
6179 \begin_layout Itemize
6180 dword is 4 elements
6181 \end_layout
6183 \begin_layout Itemize
6184 qword is 8 elements.
6185 \end_layout
6187 \begin_layout Itemize
6188 The 's' variants do signed read.
6189 \end_layout
6191 \begin_layout Subsection
6192 hostmemory.read{float,double}: Read from host memory
6193 \end_layout
6195 \begin_layout Itemize
6196 syntax: number hostmemory.readfloat(number address)
6197 \end_layout
6199 \begin_layout Itemize
6200 Syntax: number hostmemory.readdouble(number address)
6201 \end_layout
6203 \begin_layout Standard
6204 Read elements (big-endian) floating-pont from given address <address>.
6205 \end_layout
6207 \begin_layout Subsection
6208 hostmemory.write{,s}{byte,{,h,d,q}word}: Write to host memory
6209 \end_layout
6211 \begin_layout Itemize
6212 Syntax: number hostmemory.writebyte(number address, number value)
6213 \end_layout
6215 \begin_layout Itemize
6216 Syntax: number hostmemory.writesbyte(number address, number value)
6217 \end_layout
6219 \begin_layout Itemize
6220 Syntax: number hostmemory.writeword(number address, number value)
6221 \end_layout
6223 \begin_layout Itemize
6224 Syntax: number hostmemory.writesword(number address, number value)
6225 \end_layout
6227 \begin_layout Itemize
6228 Syntax: number hostmemory.writehword(number address, number value)
6229 \end_layout
6231 \begin_layout Itemize
6232 Syntax: number hostmemory.writeshword(number address, number value)
6233 \end_layout
6235 \begin_layout Itemize
6236 Syntax: number hostmemory.writedword(number address, number value)
6237 \end_layout
6239 \begin_layout Itemize
6240 Syntax: number hostmemory.writesdword(number address, number value)
6241 \end_layout
6243 \begin_layout Itemize
6244 Syntax: number hostmemory.writeqword(number address, number value)
6245 \end_layout
6247 \begin_layout Itemize
6248 Syntax: number hostmemory.writesqword(number address, number value)
6249 \end_layout
6251 \begin_layout Standard
6252 Write value <value> to elements (little-endian) starting from given address
6253  <address>.
6254 \end_layout
6256 \begin_layout Itemize
6257 byte is 1 element
6258 \end_layout
6260 \begin_layout Itemize
6261 word is 2 elements
6262 \end_layout
6264 \begin_layout Itemize
6265 hword is 3 elements
6266 \end_layout
6268 \begin_layout Itemize
6269 dword is 4 elements
6270 \end_layout
6272 \begin_layout Itemize
6273 qword is 8 elements.
6274 \end_layout
6276 \begin_layout Itemize
6277 The 's' variants do signed write.
6278 \end_layout
6280 \begin_layout Subsection
6281 hostmemory.write{float,double}: Write to host memory
6282 \end_layout
6284 \begin_layout Itemize
6285 syntax: none hostmemory.readfloat(number address, number value)
6286 \end_layout
6288 \begin_layout Itemize
6289 Syntax: none hostmemory.readdouble(number address, number value)
6290 \end_layout
6292 \begin_layout Standard
6293 Write elements (big-endian) floating-pont to given address <address>, storing
6294  <value>.
6295 \end_layout
6297 \begin_layout Standard
6298 \begin_inset Newpage pagebreak
6299 \end_inset
6302 \end_layout
6304 \begin_layout Section
6305 Table movie
6306 \end_layout
6308 \begin_layout Standard
6309 Movie handling
6310 \end_layout
6312 \begin_layout Subsection
6313 movie.currentframe: Get current frame number
6314 \end_layout
6316 \begin_layout Itemize
6317 Syntax: number movie.currentframe()
6318 \end_layout
6320 \begin_layout Standard
6321 Return number of current frame.
6322 \end_layout
6324 \begin_layout Subsection
6325 movie.framecount: Get move frame count
6326 \end_layout
6328 \begin_layout Itemize
6329 Syntax: number movie.framecount()
6330 \end_layout
6332 \begin_layout Standard
6333 Return number of frames in movie.
6334 \end_layout
6336 \begin_layout Subsection
6337 movie.lagcount: Get current lag count
6338 \end_layout
6340 \begin_layout Itemize
6341 Syntax: number movie.lagcount()
6342 \end_layout
6344 \begin_layout Standard
6345 Return number of lag frames recorded so far.
6346 \end_layout
6348 \begin_layout Subsection
6349 movie.readonly: Is in playback mode?
6350 \end_layout
6352 \begin_layout Itemize
6353 Syntax: boolean movie.readonly()
6354 \end_layout
6356 \begin_layout Standard
6357 Return true if in playback mode, false if in recording.
6358 \end_layout
6360 \begin_layout Subsection
6361 movie.rerecords: Movie rerecord count
6362 \end_layout
6364 \begin_layout Itemize
6365 Syntax: number movie.rerecords()
6366 \end_layout
6368 \begin_layout Standard
6369 Returns the current value of rerecord count.
6370 \end_layout
6372 \begin_layout Subsection
6373 movie.set_readwrite: Set recording mode.
6374 \end_layout
6376 \begin_layout Itemize
6377 Syntax: none movie.set_readwrite()
6378 \end_layout
6380 \begin_layout Standard
6381 Set recording mode (does not cause on_readwrite callback).
6382 \end_layout
6384 \begin_layout Subsection
6385 movie.frame_subframes: Count subframes in frame
6386 \end_layout
6388 \begin_layout Itemize
6389 Syntax: number movie.frame_subframes(number frame)
6390 \end_layout
6392 \begin_layout Standard
6393 Count number of subframes in specified frame <frame> (frame numbers are
6394  1-based) and return that.
6395 \end_layout
6397 \begin_layout Subsection
6398 movie.read_subframes: Read subframe data (deprecated)
6399 \end_layout
6401 \begin_layout Itemize
6402 Syntax: table movie.read_subframes(number frame, number subframe)
6403 \end_layout
6405 \begin_layout Standard
6406 Read specifed subframe in specified frame and return data as array.
6407 \end_layout
6409 \begin_layout Subsection
6410 movie.read_rtc: Read current RTC time
6411 \end_layout
6413 \begin_layout Itemize
6414 Syntax: (number, number) movie.read_rtc()
6415 \end_layout
6417 \begin_layout Standard
6418 Returns the current value of the RTC as a pair (second, subsecond).
6419 \end_layout
6421 \begin_layout Subsection
6422 movie.unsafe_rewind: Fast movie rewind to saved state
6423 \end_layout
6425 \begin_layout Itemize
6426 Syntax: none movie.unsafe_rewind([UNSAFEREWIND state])
6427 \end_layout
6429 \begin_layout Standard
6430 Start setting point for unsafe rewind or jump to point of unsafe rewind.
6431 \end_layout
6433 \begin_layout Itemize
6434 If called without argument, causes emulator to start process of setting
6435  unsafe rewind point.
6436  When this has finished, callback on_set_rewind occurs, passing the rewind
6437  state to lua script.
6438 \end_layout
6440 \begin_layout Itemize
6441 If called with argument, causes emulator rewind to passed rewind point as
6442  soon as possible.
6443  recording mode is implicitly activated.
6444 \end_layout
6446 \begin_layout Standard
6447 The following warnings apply to unsafe rewinding:
6448 \end_layout
6450 \begin_layout Itemize
6451 There are no safety checks against misuse (that's what 
6452 \begin_inset Quotes eld
6453 \end_inset
6455 unsafe
6456 \begin_inset Quotes erd
6457 \end_inset
6459  comes from)!
6460 \end_layout
6462 \begin_layout Itemize
6463 Only call rewind from timeline rewind point was set from.
6464 \end_layout
6466 \begin_layout Itemize
6467 Only call rewind from after the rewind point was set.
6468 \end_layout
6470 \begin_layout Subsection
6471 movie.to_rewind: Load savestate as rewind point
6472 \end_layout
6474 \begin_layout Itemize
6475 Syntax: UNSAFEREWIND movie.to_rewind(string filename)
6476 \end_layout
6478 \begin_layout Standard
6479 Load specified savestate file <filename> as rewind point and return UNSAFEREWIND
6480  corresponding to it.
6481 \end_layout
6483 \begin_layout Itemize
6484 Note: This operation does not take emulated time.
6485 \end_layout
6487 \begin_layout Subsection
6488 movie.copy_movie/INPUTMOVIE::copy_movie: Copy movie to movie object
6489 \end_layout
6491 \begin_layout Itemize
6492 Syntax: INPUTMOVIE movie.copy_movie([INPUTMOVIE/string movie])
6493 \end_layout
6495 \begin_layout Itemize
6496 Syntax: INPUTMOVIE INPUTMOVIE::copy_movie()
6497 \end_layout
6499 \begin_layout Standard
6500 Copies specified movie or branch <movie>/current object (if none or nil,
6501  the active movie) as new movie object.
6502 \end_layout
6504 \begin_layout Subsection
6505 movie.get_frame/INPUTMOVIE::get_frame: Read specified frame in movie.
6506 \end_layout
6508 \begin_layout Itemize
6509 Syntax: INPUTFRAME movie.get_frame([INPUTMOVIE/string movie,] number frame)
6510 \end_layout
6512 \begin_layout Itemize
6513 Syntax: INPUTFRAME INPUTMOVIE::get_frame(number frame);
6514 \end_layout
6516 \begin_layout Standard
6517 Get INPUTFRAME object corresponding to specified frame in specified movie
6518  or branch.
6519 \end_layout
6521 \begin_layout Subsection
6522 movie.set_frame/INPUTMOVIE::set_frame: Write speicifed frame in movie.
6523 \end_layout
6525 \begin_layout Itemize
6526 Syntax: none movie.set_frame([INPUTMOVIE/string movie,] number frame, INPUTFRAME
6527  data)
6528 \end_layout
6530 \begin_layout Itemize
6531 Syntax: none INPUTMOVIE::set_frame(number frame, INPUTFRAME data)
6532 \end_layout
6534 \begin_layout Standard
6535 Set data in specified frame.
6536 \end_layout
6538 \begin_layout Itemize
6539 Note: Past can't be edited in active movie.
6540 \end_layout
6542 \begin_layout Subsection
6543 movie.get_size/INPUTMOVIE::get_size: Get size of movie
6544 \end_layout
6546 \begin_layout Itemize
6547 Syntax: integer movie.get_size([INPUTMOVIE/string movie])
6548 \end_layout
6550 \begin_layout Itemize
6551 Syntax: integer INPUTMOVIE::get_size()
6552 \end_layout
6554 \begin_layout Standard
6555 Return number of subframes in specified movie or branch.
6556 \end_layout
6558 \begin_layout Subsection
6559 movie.count_frames/INPUTMOVIE::count_frames: Count frames in movie
6560 \end_layout
6562 \begin_layout Itemize
6563 Syntax: number movie.count_frames([INPUTMOVIE/string movie])
6564 \end_layout
6566 \begin_layout Itemize
6567 Syntax: number INPUTMOVIE::count_frames()
6568 \end_layout
6570 \begin_layout Standard
6571 Return number of frames in movie.
6572 \end_layout
6574 \begin_layout Subsection
6575 movie.find_frame/INPUTMOVIE::find_frame: Find subframe corresponding to frame
6576 \end_layout
6578 \begin_layout Itemize
6579 Syntax: number movie.find_frame([INPUTMOVIE/string movie], number frame)
6580 \end_layout
6582 \begin_layout Itemize
6583 Syntax: number INPUTMOVIE::find_frame(number frame)
6584 \end_layout
6586 \begin_layout Standard
6587 Returns starting subframe of given frame (frame numbers are 1-based).
6588  Returns -1 if frame number is bad.
6589 \end_layout
6591 \begin_layout Subsection
6592 movie.blank_frame/INPUTMOVIE::blank_frame: Return a blank frame
6593 \end_layout
6595 \begin_layout Itemize
6596 Syntax: INPUTFRAME movie.blank_frame([INPUTMOVIE/string movie])
6597 \end_layout
6599 \begin_layout Itemize
6600 Syntax: INPUTFRAME INPUTMOVIE::blank_frame()
6601 \end_layout
6603 \begin_layout Standard
6604 Return blank INPUTFRAME with frame type from specified movie.
6605 \end_layout
6607 \begin_layout Subsection
6608 movie.append_frames/INPUTMOVIE::append_frames: Append blank frames
6609 \end_layout
6611 \begin_layout Itemize
6612 Syntax: none movie.append_frames([INPUTMOVIE/string movie,] number frames)
6613 \end_layout
6615 \begin_layout Itemize
6616 Syntax: none INPUTMOVIE::append_frames(number frames)
6617 \end_layout
6619 \begin_layout Standard
6620 Append specified number <frames> of frames.
6621 \end_layout
6623 \begin_layout Subsection
6624 movie.append_frame/INPUTMOVIE::append_frame: Append a frame
6625 \end_layout
6627 \begin_layout Itemize
6628 Syntax: none movie.append_frame([INPUTMOVIE/string movie,] INPUTFRAME frame)
6629 \end_layout
6631 \begin_layout Itemize
6632 Syntax: none INPUTMOVIE::append_frame(INPUTFRAME frame)
6633 \end_layout
6635 \begin_layout Standard
6636 Append specified frame <frame>.
6637  Past of current movie can't be edited.
6638 \end_layout
6640 \begin_layout Subsection
6641 movie.truncate/INPUTMOVIE::truncate: Truncate a movie.
6642 \end_layout
6644 \begin_layout Itemize
6645 Syntax: none movie.truncate([INPUTMOVIE/string movie,] number frames)
6646 \end_layout
6648 \begin_layout Itemize
6649 Syntax: none INPUTMOVIE::truncate(number frames)
6650 \end_layout
6652 \begin_layout Standard
6653 Truncate the specified movie to specified number of frames.
6654 \end_layout
6656 \begin_layout Subsection
6657 movie.edit/INPUTMOVIE::edit: Edit a movie
6658 \end_layout
6660 \begin_layout Itemize
6661 Syntax: none movie.edit([INPUTMOVIE movie,] number frame, number port, number
6662  controller, number control, number/bool value)
6663 \end_layout
6665 \begin_layout Itemize
6666 Syntax: none movie.edit(string branch, number frame, number port, number
6667  controller, number control, number/bool value)
6668 \end_layout
6670 \begin_layout Itemize
6671 Syntax: none INPUTMOVIE::edit(number frame, number port, number controller,
6672  number control, number/bool value)
6673 \end_layout
6675 \begin_layout Standard
6676 Change specified control in specified frame in specified movie.
6677  Past can't be edited in active movie.
6678 \end_layout
6680 \begin_layout Subsection
6681 movie.copy_frames2: Copy frames between movies
6682 \end_layout
6684 \begin_layout Itemize
6685 Syntax: none movie.copy_frames2([INPUTMOVIE/string dstmov,] number dst, [INPUTMOV
6686 IE/string srcmov,] number src, number count)
6687 \end_layout
6689 \begin_layout Standard
6690 Copy specified number of frames between two movies.
6691  The copy proceeeds in forward direction.
6692 \end_layout
6694 \begin_layout Subsection
6695 movie.copy_frames/INPUTMOVIE::copy_frames: Copy frames in movie
6696 \end_layout
6698 \begin_layout Itemize
6699 Syntax: none movie.copy_frames([INPUTMOVIE/string mov,] number dst, number
6700  src, number count, bool backwards)
6701 \end_layout
6703 \begin_layout Itemize
6704 Syntax: none INPUTMOVIE::copy_frames(number dst, number src, number count,
6705  bool backwards)
6706 \end_layout
6708 \begin_layout Standard
6709 Copy specified number of frames from one point in movie to another.
6710  If backwards is true, the copy will be done backwards.
6711 \end_layout
6713 \begin_layout Subsection
6714 movie.serialize/INPUTMOVIE::serialize: Serialize movie
6715 \end_layout
6717 \begin_layout Itemize
6718 Syntax: none movie.serialize([INPUTMOVIE movie/string,] string filename,
6719  bool binary)
6720 \end_layout
6722 \begin_layout Itemize
6723 Syntax: none INPUTMOIVE::serialize(string filename, bool binary)
6724 \end_layout
6726 \begin_layout Standard
6727 Serialize given movie into file.
6728  If binary is true, binary format (more compact and much faster) is used.
6729 \end_layout
6731 \begin_layout Subsection
6732 movie.unserialize: Unserialize movie
6733 \end_layout
6735 \begin_layout Itemize
6736 Syntax: INPUTMOVIE movie.unserialize(INPUTFRAME template, string filename,
6737  bool binary)
6738 \end_layout
6740 \begin_layout Standard
6741 Unserialize movie from file.
6742  The given frame is used as template to decide the frame type.
6743  If binary is true, binary format is decoded (much faster).
6744 \end_layout
6746 \begin_layout Subsection
6747 movie.current_first_subframe: Return first subframe in current frame
6748 \end_layout
6750 \begin_layout Itemize
6751 Syntax: number movie.current_first_subframe()
6752 \end_layout
6754 \begin_layout Standard
6755 Returns first subframe in current frame.
6756 \end_layout
6758 \begin_layout Subsection
6759 movie.pollcounter: Return poll counter for speified control
6760 \end_layout
6762 \begin_layout Itemize
6763 Syntax: number movie.pollcounter(number port, number controller, number control)
6764 \end_layout
6766 \begin_layout Standard
6767 Returns number of times the specified control has been polled this frame.
6768 \end_layout
6770 \begin_layout Subsection
6771 movie.current_branch: Return current branch
6772 \end_layout
6774 \begin_layout Itemize
6775 Syntax: string movie.current_branch()
6776 \end_layout
6778 \begin_layout Standard
6779 Returns the name of the current branch.
6780 \end_layout
6782 \begin_layout Subsection
6783 movie.get_branches: Return names of all branches
6784 \end_layout
6786 \begin_layout Itemize
6787 Syntax: string...
6788  movie.get_branches()
6789 \end_layout
6791 \begin_layout Standard
6792 Returns the name of all branches.
6793 \end_layout
6795 \begin_layout Subsection
6796 INPUTFRAME::get_button: Get button
6797 \end_layout
6799 \begin_layout Itemize
6800 Syntax: boolean INPUTFRAME::get_button(number port, number controller, number
6801  control)
6802 \end_layout
6804 \begin_layout Standard
6805 Returns state of given button as boolean.
6806 \end_layout
6808 \begin_layout Subsection
6809 INPUTFRAME::get_axis: Get axis
6810 \end_layout
6812 \begin_layout Itemize
6813 Syntax: number INPUTFRAME::get_axis(number port, number controller, number
6814  control)
6815 \end_layout
6817 \begin_layout Standard
6818 Returns state of given axis as number.
6819 \end_layout
6821 \begin_layout Subsection
6822 INPUTFRAME::set_button/INPUTFRAME::set_axis: Set button or axis
6823 \end_layout
6825 \begin_layout Itemize
6826 Syntax: none INPUTFRAME::set_button(number port, number controller, number
6827  control, number/bool value)
6828 \end_layout
6830 \begin_layout Itemize
6831 Syntax: none INPUTFRAME::set_axis(number port, number controller, number
6832  control)
6833 \end_layout
6835 \begin_layout Standard
6836 Set the given button/axis to given value.
6837 \end_layout
6839 \begin_layout Subsection
6840 INPUTFRAME::serialize: Serialize a frame
6841 \end_layout
6843 \begin_layout Itemize
6844 Syntax: string INPUTFRAME::serialize()
6845 \end_layout
6847 \begin_layout Standard
6848 Return string representation of frame.
6849 \end_layout
6851 \begin_layout Subsection
6852 INPUTFRAME::unserialize: Unserialize a frame
6853 \end_layout
6855 \begin_layout Itemize
6856 Syntax: none INPUTFRAME::unserialize(string data)
6857 \end_layout
6859 \begin_layout Standard
6860 Set current frame from given data.
6861 \end_layout
6863 \begin_layout Subsection
6864 INPUTFRAME::get_stride: Get movie stride
6865 \end_layout
6867 \begin_layout Itemize
6868 Syntax: number INPUTFRAME::get_stride()
6869 \end_layout
6871 \begin_layout Standard
6872 Return number of bytes needed to store the input frame.
6873  Mainly useful for some debugging.
6874 \end_layout
6876 \begin_layout Standard
6877 \begin_inset Newpage pagebreak
6878 \end_inset
6881 \end_layout
6883 \begin_layout Section
6884 Table settings
6885 \end_layout
6887 \begin_layout Standard
6888 Routines for settings manipulation
6889 \end_layout
6891 \begin_layout Subsection
6892 settings.get: Get value of setting
6893 \end_layout
6895 \begin_layout Itemize
6896 Syntax: string settings.get(string name)
6897 \end_layout
6899 \begin_layout Standard
6900 Get value of setting <name>.
6901  If setting value can't be obtained, returns (nil, error message).
6902 \end_layout
6904 \begin_layout Subsection
6905 settings.set: Set value of setting
6906 \end_layout
6908 \begin_layout Itemize
6909 Syntax: none settings.set(string name, string value)
6910 \end_layout
6912 \begin_layout Standard
6913 Set value <value> of setting <name>.
6914  If setting can't be set, returns (nil, error message).
6915 \end_layout
6917 \begin_layout Subsection
6918 settings.get_all: Get values of all settings
6919 \end_layout
6921 \begin_layout Itemize
6922 Syntax: table settings.get_all()
6923 \end_layout
6925 \begin_layout Standard
6926 Return a table with all setting names as keys and all current values as
6927  values.
6928 \end_layout
6930 \begin_layout Subsection
6931 settings.get_speed: Get current speed
6932 \end_layout
6934 \begin_layout Itemize
6935 Syntax: number/string settings.get_speed()
6936 \end_layout
6938 \begin_layout Standard
6939 Return the current speed multiplier (1 is normal), or 
6940 \begin_inset Quotes eld
6941 \end_inset
6943 turbo
6944 \begin_inset Quotes erd
6945 \end_inset
6947  if speed is set to turbo (this does not react to turbo toggle).
6948 \end_layout
6950 \begin_layout Subsection
6951 settings.set_speed: Set current speed
6952 \end_layout
6954 \begin_layout Itemize
6955 Syntax: settings.get_speed(number spd)
6956 \end_layout
6958 \begin_layout Itemize
6959 Syntax: settings.get_speed(string special)
6960 \end_layout
6962 \begin_layout Standard
6963 Set the current speed multiplier (1 is normal).
6964  The speed may be positive multiplier or 
6965 \begin_inset Quotes eld
6966 \end_inset
6968 turbo
6969 \begin_inset Quotes erd
6970 \end_inset
6972  for turbo speed.
6973 \end_layout
6975 \begin_layout Standard
6976 \begin_inset Newpage pagebreak
6977 \end_inset
6980 \end_layout
6982 \begin_layout Section
6983 Table memory
6984 \end_layout
6986 \begin_layout Standard
6987 Contains various functions for managing memory
6988 \end_layout
6990 \begin_layout Subsection
6991 memory.vma_count: Count number of memory areas.
6992 \end_layout
6994 \begin_layout Itemize
6995 Syntax: number memory.vma_count()
6996 \end_layout
6998 \begin_layout Standard
6999 Returns the number of memory areas
7000 \end_layout
7002 \begin_layout Subsection
7003 memory.read_vma: Lookup memory area info by index
7004 \end_layout
7006 \begin_layout Itemize
7007 Syntax: table memory.read_vma(number index)
7008 \end_layout
7010 \begin_layout Standard
7011 Reads the specified memory area (indices start from zero).
7012  Trying to read invalid memory area gives nil.
7013  The return value is table with the following fields:
7014 \end_layout
7016 \begin_layout Itemize
7017 region_name (string): The readable name of the memory area
7018 \end_layout
7020 \begin_layout Itemize
7021 baseaddr (number): Base address of the memory area
7022 \end_layout
7024 \begin_layout Itemize
7025 lastaddr (number): Last address in the memory area.
7026 \end_layout
7028 \begin_layout Itemize
7029 size (number): The size of memory area in bytes.
7030 \end_layout
7032 \begin_layout Itemize
7033 readonly (boolean): True of the memory area corresponds to ROM.
7034 \end_layout
7036 \begin_layout Itemize
7037 iospace (boolean): True if the memory area is I/O space.
7038 \end_layout
7040 \begin_layout Itemize
7041 native_endian (boolean): True if the memory area has native endian as opposed
7042  to little endian.
7043 \end_layout
7045 \begin_layout Subsection
7046 memory.find_vma: Find memory area info by address
7047 \end_layout
7049 \begin_layout Itemize
7050 Syntax: table memory.find_vma(number address)
7051 \end_layout
7053 \begin_layout Standard
7054 Finds the memory area containing specified address.
7055  Returns table in the same format as read_vma or nil if not found.
7056 \end_layout
7058 \begin_layout Subsection
7059 memory.read{,s}{byte,{,h,d,q}word}: Read memory
7060 \end_layout
7062 \begin_layout Itemize
7063 Syntax: none memory.readbyte({string marea, number address|ADDRESS addrobj})
7064 \end_layout
7066 \begin_layout Itemize
7067 Syntax: none memory.readword({string marea, number address|ADDRESS addrobj})
7068 \end_layout
7070 \begin_layout Itemize
7071 Syntax: none memory.readhword({string marea, number address|ADDRESS addrobj})
7072 \end_layout
7074 \begin_layout Itemize
7075 Syntax: none memory.readdword({string marea, number address|ADDRESS addrobj})
7076 \end_layout
7078 \begin_layout Itemize
7079 Syntax: none memory.readqword({string marea, number address|ADDRESS addrobj})
7080 \end_layout
7082 \begin_layout Itemize
7083 Syntax: none memory.readsbyte({string marea, number address|ADDRESS addrobj})
7084 \end_layout
7086 \begin_layout Itemize
7087 Syntax: none memory.readsword({string marea, number address|ADDRESS addrobj})
7088 \end_layout
7090 \begin_layout Itemize
7091 Syntax: none memory.readshword({string marea, number address|ADDRESS addrobj})
7092 \end_layout
7094 \begin_layout Itemize
7095 Syntax: none memory.readsdword({string marea, number address|ADDRESS addrobj})
7096 \end_layout
7098 \begin_layout Itemize
7099 Syntax: none memory.readsqword({string marea, number address|ADDRESS addrobj})
7100 \end_layout
7102 \begin_layout Standard
7103 Reads the specified address <address> (if 's' variant is used, do undergo
7104  2's complement).
7105 \end_layout
7107 \begin_layout Subsection
7108 memory.{,s}read_sg: Scatter/Gather read memory
7109 \end_layout
7111 \begin_layout Itemize
7112 Syntax: none memory.read_sg(string/boolean/number...)
7113 \end_layout
7115 \begin_layout Itemize
7116 Syntax: none memory.sread_sg(string/boolean/number...)
7117 \end_layout
7119 \begin_layout Standard
7120 Perform (2s complement signed if using memory.sread_sg) scatter/gather read
7121  of memory.
7122  Each argument can be string, boolean or number:
7123 \end_layout
7125 \begin_layout Itemize
7126 String: Set memory area addresses are relative to (e.g.
7127  'WRAM').
7128 \end_layout
7130 \begin_layout Itemize
7131 boolean: If true, increment relative address by 1, if false, decrement by
7132  1.
7133  The new address is read as next higher byte.
7134 \end_layout
7136 \begin_layout Itemize
7137 integer: Set the relative address to specified value and read the address
7138  as next higher byte.
7139 \end_layout
7141 \begin_layout Subsection
7142 memory.write_sg: Scatter/Gather write memory
7143 \end_layout
7145 \begin_layout Itemize
7146 Syntax: none memory.write_sg(number value, string/boolean/number...)
7147 \end_layout
7149 \begin_layout Standard
7150 Perform scatter/gather write of value <value> on memory.
7151  Each argument can be string, boolean or number:
7152 \end_layout
7154 \begin_layout Itemize
7155 String: Set memory area addresses are relative to (e.g.
7156  'WRAM').
7157 \end_layout
7159 \begin_layout Itemize
7160 boolean: If true, increment relative address by 1, if false, decrement by
7161  1.
7162  The new address is read as next higher byte.
7163 \end_layout
7165 \begin_layout Itemize
7166 integer: Set the relative address to specified value and read the address
7167  as next higher byte.
7168 \end_layout
7170 \begin_layout Subsection
7171 memory.read{float,double}: Read memory
7172 \end_layout
7174 \begin_layout Itemize
7175 Syntax: none memory.readfloat({string marea, number address|ADDRESS addrobj})
7176 \end_layout
7178 \begin_layout Itemize
7179 Syntax: none memory.readdouble({string marea, number address|ADDRESS addrobj})
7180 \end_layout
7182 \begin_layout Standard
7183 Reads the specified address <address>
7184 \end_layout
7186 \begin_layout Subsection
7187 memory.write{byte,{,h,d,q}word,float,double}: Write memory
7188 \end_layout
7190 \begin_layout Itemize
7191 Syntax: none memory.writebyte({string marea, number address|ADDRESS addrobj},
7192  number value)
7193 \end_layout
7195 \begin_layout Itemize
7196 Syntax: none memory.writeword({string marea, number address|ADDRESS addrobj},
7197  number value)
7198 \end_layout
7200 \begin_layout Itemize
7201 Syntax: none memory.writehword({string marea, number address|ADDRESS addrobj},
7202  number value)
7203 \end_layout
7205 \begin_layout Itemize
7206 Syntax: none memory.writedword({string marea, number address|ADDRESS addrobj},
7207  number value)
7208 \end_layout
7210 \begin_layout Itemize
7211 Syntax: none memory.writeqword({string marea, number address|ADDRESS addrobj},
7212  number value)
7213 \end_layout
7215 \begin_layout Itemize
7216 Syntax: none memory.writefloat({string marea, number address|ADDRESS addrobj},
7217  number value)
7218 \end_layout
7220 \begin_layout Itemize
7221 Syntax: none memory.writedouble({string marea, number address|ADDRESS addrobj},
7222  number value)
7223 \end_layout
7225 \begin_layout Standard
7226 Writes the specified value <value> (negative integer values undergo 2's
7227  complement) to specified address <address>.
7228 \end_layout
7230 \begin_layout Subsection
7231 memory.map{{,s}{byte,{,h,d,q}word},float,double}: Map an array
7232 \end_layout
7234 \begin_layout Itemize
7235 Syntax: userdata memory.map<type>({string marea, number base|ADDRESS addrobj},
7236  number size)
7237 \end_layout
7239 \begin_layout Standard
7240 Returns a table mapping specified memory aperture for read/write.
7241 \end_layout
7243 \begin_layout Itemize
7244 Type may be one of: byte, sbyte, word, sword, hword, shword, dword, sdword,
7245  qword, sqword, float or double.
7246 \end_layout
7248 \begin_layout Subsection
7249 memory.hash_region: Hash region of memory
7250 \end_layout
7252 \begin_layout Itemize
7253 Syntax: string memory.hash_region({string marea, number base|ADDRESS addrobj},
7254  number size)
7255 \end_layout
7257 \begin_layout Standard
7258 Hash <size> bytes starting from address <base> (relative to <marea>) and
7259  return the SHA-256.
7260 \end_layout
7262 \begin_layout Subsection
7263 memory.hash_region2: Hash region of memory
7264 \end_layout
7266 \begin_layout Itemize
7267 Syntax: string memory.hash_region2({string marea, number base|ADDRESS addrobj},
7268  number size[, number rows, number stride])
7269 \end_layout
7271 \begin_layout Standard
7272 Hash <rows> blocks of <size> bytes starting from address <base> (relative
7273  to <marea>).
7274  The blocks are offset by <stride> from one another and return the SHA-256.
7275 \end_layout
7277 \begin_layout Subsection
7278 memory.hash_region_skein: Hash region of memory
7279 \end_layout
7281 \begin_layout Itemize
7282 Syntax: string memory.hash_region_skein({string marea, number base|ADDRESS
7283  addrobj}, number size[, number rows, number stride])
7284 \end_layout
7286 \begin_layout Standard
7287 Same as memory.hash_region2, but uses Skein-512-256 (v1.3; one of the SHA-3
7288  finalists) as hash function.
7289 \end_layout
7291 \begin_layout Subsection
7292 memory.store: Store region of memory
7293 \end_layout
7295 \begin_layout Itemize
7296 Syntax: none memory.store({string marea, number addr|ADDRESS addrobj}, number
7297  daddr[, number rows, number stride]
7298 \end_layout
7300 \begin_layout Standard
7301 Copy memory starting from <addr> in memory area <marea> (each row being
7302  of size <size>, there being <rows> rows, and rows being separated by <stride>
7303  in memory) into savestate-saved memory area, starting from <daadr> (all
7304  rows are written back to back).
7305 \end_layout
7307 \begin_layout Subsection
7308 memory.storecmp: Compare and store region of memory
7309 \end_layout
7311 \begin_layout Itemize
7312 Syntax: bool memory.storecmp({string marea, number addr|ADDRESS addrobj},
7313  number daddr[, number rows, number stride]
7314 \end_layout
7316 \begin_layout Standard
7317 Like memory.store, but returns true if target of copy already held the value
7318  that would be copied before the copy happened.
7319  Otherwise returns false (if target and source differ before copy).
7320 \end_layout
7322 \begin_layout Subsection
7323 memory.hash_state: Hash system state
7324 \end_layout
7326 \begin_layout Itemize
7327 Syntax: string memory.hash_state()
7328 \end_layout
7330 \begin_layout Standard
7331 Hash the current system state.
7332  Mainly useful for debugging savestates.
7333 \end_layout
7335 \begin_layout Subsection
7336 memory.readregion: Read region of memory
7337 \end_layout
7339 \begin_layout Itemize
7340 Syntax: table memory.readregion({string marea, number base|ADDRESS addrobj},
7341  number size)
7342 \end_layout
7344 \begin_layout Standard
7345 Read a region of memory.
7346 \end_layout
7348 \begin_layout Itemize
7349 Warning: If the region crosses memory area boundary, the results are undefined.
7350 \end_layout
7352 \begin_layout Subsection
7353 memory.writeregion: Write region of memory
7354 \end_layout
7356 \begin_layout Itemize
7357 Syntax: none memory.writeregion({string marea, number base|ADDRESS addrobj},
7358  number size, table data)
7359 \end_layout
7361 \begin_layout Standard
7362 Write a region of memory.
7363 \end_layout
7365 \begin_layout Itemize
7366 Warning: If the region crosses memory area boundary, the results are undefined.
7367 \end_layout
7369 \begin_layout Subsection
7370 memory.action: Run core action
7371 \end_layout
7373 \begin_layout Itemize
7374 memory.action(string action, [<params>])
7375 \end_layout
7377 \begin_layout Standard
7378 Run core action.
7379  The different models expect parameters as:
7380 \end_layout
7382 \begin_layout Itemize
7383 string: String
7384 \end_layout
7386 \begin_layout Itemize
7387 numeric: numeric
7388 \end_layout
7390 \begin_layout Itemize
7391 enumeration: String
7392 \end_layout
7394 \begin_layout Itemize
7395 boolean: String
7396 \end_layout
7398 \begin_layout Itemize
7399 toggle: None.
7400 \end_layout
7402 \begin_layout Subsection
7403 memory.action_flags: Get core action flags
7404 \end_layout
7406 \begin_layout Itemize
7407 memory.action_flags(string action)
7408 \end_layout
7410 \begin_layout Standard
7411 Get value of action flags for core action <action>.
7412 \end_layout
7414 \begin_layout Itemize
7415 Bit 0: Enabled?
7416 \end_layout
7418 \begin_layout Itemize
7419 Bit 1: Selected (not all actions can be selected)?
7420 \end_layout
7422 \begin_layout Subsection
7423 memory.get_lag_flag: Get lag flag
7424 \end_layout
7426 \begin_layout Itemize
7427 Syntax: boolean memory.get_lag_flag()
7428 \end_layout
7430 \begin_layout Standard
7431 Get the value of core lag flag.
7432  True if this frame has been lag so far, false if poll has been detected.
7433 \end_layout
7435 \begin_layout Subsection
7436 memory.set_lag_flag: Set lag flag
7437 \end_layout
7439 \begin_layout Itemize
7440 Syntax: none memory.set_lag_flag(boolean flag)
7441 \end_layout
7443 \begin_layout Standard
7444 Set the value of core lag flag.
7445  This flag automatically gets cleared if poll is detected, but can be forcibly
7446  set or cleared if game so requires.
7447 \end_layout
7449 \begin_layout Itemize
7450 Should only be used in on_frame_emulated callback.
7451 \end_layout
7453 \begin_layout Itemize
7454 Setting or clearing this affects the emulator lag counter.
7455 \end_layout
7457 \begin_layout Subsection
7458 memory.{,un}register{read,write,exec}: (Un)Register read / write / execute
7459  callback
7460 \end_layout
7462 \begin_layout Itemize
7463 Syntax: function memory.registerread({string marea, number addr|ADDRESS addrobj},
7464  function fn);
7465 \end_layout
7467 \begin_layout Itemize
7468 Syntax: function memory.registerwrite({string marea, number addr|ADDRESS
7469  addrobj}, function fn);
7470 \end_layout
7472 \begin_layout Itemize
7473 Syntax: function memory.registerexec({string marea, number addr|ADDRESS addrobj},
7474  function fn);
7475 \end_layout
7477 \begin_layout Itemize
7478 Syntax: none memory.unregisterread({string marea, number addr|ADDRESS addrobj},
7479  function fn);
7480 \end_layout
7482 \begin_layout Itemize
7483 Syntax: none memory.unregisterwrite({string marea, number addr|ADDRESS addrobj},
7484  function fn);
7485 \end_layout
7487 \begin_layout Itemize
7488 Syntax: none memory.unregisterexec({string marea, number addr|ADDRESS addrobj},
7489  function fn);
7490 \end_layout
7492 \begin_layout Standard
7493 Add or remove callback on memory read, write or execute (depending on the
7494  function).
7495  <addr> is relative to <marea>.
7496  <fn> is the callback.
7497  The register* functions return <fn> (which can then be passed to unregister*
7498  functions.
7499 \end_layout
7501 \begin_layout Itemize
7502 Not all cores support this, and it may be unsupported for some memory areas.
7503 \end_layout
7505 \begin_layout Itemize
7506 The functions are passed two parameters: Address and value.
7507 \end_layout
7509 \begin_layout Subsection
7510 memory.{,un}registertrace: Set/Clear trace hook
7511 \end_layout
7513 \begin_layout Itemize
7514 Syntax: function memory.registertrace(number processor, function fn);
7515 \end_layout
7517 \begin_layout Itemize
7518 Syntax: none memory.unregistertrace(number processor, function fn);
7519 \end_layout
7521 \begin_layout Standard
7522 Add or remove trace callback.
7523  <processor> is system-dependent processor number (0 is usually main CPU).
7524  The function arguments work like in other (un)register* functions.
7525 \end_layout
7527 \begin_layout Itemize
7528 The functions are passed two parameters: Trace CPU and Trace event string.
7529 \end_layout
7531 \begin_layout Subsection
7532 memory.cheat: Set cheat
7533 \end_layout
7535 \begin_layout Itemize
7536 Syntax: none memory.cheat({string marea, number addr|ADDRESS addrobj}, number
7537  value);
7538 \end_layout
7540 \begin_layout Itemize
7541 Syntax: none memory.cheat({string marea, number addr|ADDRESS addrobj});
7542 \end_layout
7544 \begin_layout Standard
7545 Set or clear cheat (value <value>) on address <addr> (relative to <marea>).
7546  If <value> is not speicified, clear a cheat.
7547 \end_layout
7549 \begin_layout Itemize
7550 Not all cores support this, and it may be unsupported for some memory areas.
7551 \end_layout
7553 \begin_layout Subsection
7554 memory.setxmask: Set global execute hook mask
7555 \end_layout
7557 \begin_layout Itemize
7558 Syntax: none memory.setxmask(number mask)
7559 \end_layout
7561 \begin_layout Standard
7562 Set the global execute hook mask to <mask>.
7563  The meaning of each bit is system-dependent, but bit 0 should be the main
7564  CPU.
7565 \end_layout
7567 \begin_layout Subsection
7568 memory.getregister: Get register value
7569 \end_layout
7571 \begin_layout Itemize
7572 Syntax: number/boolean memory.getregister(string register)
7573 \end_layout
7575 \begin_layout Standard
7576 Get the value of named register.
7577 \end_layout
7579 \begin_layout Subsection
7580 memory.getregisters: Get register values
7581 \end_layout
7583 \begin_layout Itemize
7584 Syntax: table memory.getregisters()
7585 \end_layout
7587 \begin_layout Standard
7588 Get the value of all known registers as table.
7589 \end_layout
7591 \begin_layout Subsection
7592 memory.setregister: Set register value
7593 \end_layout
7595 \begin_layout Itemize
7596 Syntax: none memory.setregister(string register, number/boolean value)
7597 \end_layout
7599 \begin_layout Standard
7600 Set the value of named register.
7601 \end_layout
7603 \begin_layout Subsection
7604 memory.mmap: Class MMAP_STRUCT
7605 \end_layout
7607 \begin_layout Standard
7608 See class MMAP_STRUCT
7609 \end_layout
7611 \begin_layout Standard
7612 \begin_inset Newpage pagebreak
7613 \end_inset
7616 \end_layout
7618 \begin_layout Section
7619 Table memory2
7620 \end_layout
7622 \begin_layout Standard
7623 Contains newer memory functions.
7624 \end_layout
7626 \begin_layout Subsection
7627 memory2(): Get all memory area names.
7628 \end_layout
7630 \begin_layout Itemize
7631 Syntax: table memory2()
7632 \end_layout
7634 \begin_layout Standard
7635 Returns array of all valid memory area names.
7636 \end_layout
7638 \begin_layout Subsection
7639 memory2.<marea>:info: Get memory area info
7640 \end_layout
7642 \begin_layout Itemize
7643 Syntax: table memory2.<marea>:info()
7644 \end_layout
7646 \begin_layout Standard
7647 Return table describing given memory area.
7648  Includes fields address, size, last, readonly, special and endian.
7649 \end_layout
7651 \begin_layout Subsection
7652 memory2.<marea>:<op>: Read/Write memory
7653 \end_layout
7655 \begin_layout Itemize
7656 Syntax: none memory2.<marea>:<op>(number offset, number value)
7657 \end_layout
7659 \begin_layout Itemize
7660 Syntax: number memory2.<marea>:<op>(number offset)
7661 \end_layout
7663 \begin_layout Standard
7664 Read/Write value from/to given memory area <marea> at given offset <offset>
7665  (must be in-range).
7666  The value written is <value>.
7667  <Op> is of form: [i][s]<type>, where:
7668 \end_layout
7670 \begin_layout Itemize
7671 <type> is one of 'byte', 'word', 'hword', 'dword', 'qword', 'float', 'double'.
7672 \end_layout
7674 \begin_layout Itemize
7675 'i' signifies that the value is treated as opposite-to-normal endianess,
7676 \end_layout
7678 \begin_layout Itemize
7679 's' signifies that value is treated as signed (not available for floating-point).
7680 \end_layout
7682 \begin_layout Subsection
7683 memory2.<marea>:read: Scatter-gather value read
7684 \end_layout
7686 \begin_layout Itemize
7687 Syntax: number memory2.<marea>:read(number addr...)
7688 \end_layout
7690 \begin_layout Standard
7691 Read value from given memory area <marea> at byte offsets <addr>..., given
7692  in order of increasing significance.
7693  Value of true and false are special.
7694  True increments address by 1, and false decrements address by 1.
7695 \end_layout
7697 \begin_layout Subsection
7698 memory2.<marea>:sread: Signed scatter-gather value read
7699 \end_layout
7701 \begin_layout Itemize
7702 Syntax: number memory2.<marea>:sread(number addr...)
7703 \end_layout
7705 \begin_layout Standard
7706 Like memory2.<marea>:read, but reads signed values.
7707 \end_layout
7709 \begin_layout Subsection
7710 memory2.<marea>:write: Scatter-gather value write
7711 \end_layout
7713 \begin_layout Itemize
7714 Syntax: number memory2.<marea>:write(number val, number addr...)
7715 \end_layout
7717 \begin_layout Standard
7718 Write value <val> to given memory area <marea> at byte offsets <addr>..., given
7719  in order of increasing significance.
7720  Value of true and false are special.
7721  True increments address by 1, and false decrements address by 1.
7722 \end_layout
7724 \begin_layout Subsection
7725 memory2.<marea>:cheat: Set/Clear cheat
7726 \end_layout
7728 \begin_layout Itemize
7729 Syntax: none memory2.<marea>:cheat(number addr, [number value])
7730 \end_layout
7732 \begin_layout Standard
7733 Set/Clear cheat at offset <addr> of memory area <marea>.
7734  If <value> is given, cheat with specified value is set.
7735  Otherwise cheat on address is removed.
7736 \end_layout
7738 \begin_layout Subsection
7739 memory2.<marea>:sha256: SHA-256
7740 \end_layout
7742 \begin_layout Itemize
7743 Syntax: string memory2.<marea>:sha256(number addr, number size[, number rows,
7744  number stride])
7745 \end_layout
7747 \begin_layout Standard
7748 Compute SHA-256 of <rows> (default 1) chunks of <size> bytes each, starting
7749  from offset <addr> of area <marea>.
7750  The chunks are separated by <stride>.
7751 \end_layout
7753 \begin_layout Subsection
7754 memory2.<marea>:skein: Skein-512-256
7755 \end_layout
7757 \begin_layout Itemize
7758 Syntax: string memory2.<marea>:skein(number addr, number size[, number rows,
7759  number stride])
7760 \end_layout
7762 \begin_layout Standard
7763 Same as memory2.<marea>:sha256, except with Skein-512-256 as hash function.
7764 \end_layout
7766 \begin_layout Subsection
7767 memory2.<marea>:store{,cmp}: Copy region to Lua memory with compare
7768 \end_layout
7770 \begin_layout Itemize
7771 Syntax: none memory2.<marea>:store(number addr, number daddr, number size[,
7772  number rows, number stride])
7773 \end_layout
7775 \begin_layout Itemize
7776 Syntax: boolean memory2.<marea>:storecmp(number addr, number daddr, number
7777  size[, number rows, number stride])
7778 \end_layout
7780 \begin_layout Standard
7781 Copy <rows> (default 1) chunks of <size> bytes each, starting from offset
7782  <addr> of area <marea>.
7783  The chunks are separated by <stride>.
7784  The target is Lua host memory, starting from offset <daddr>.
7785 \end_layout
7787 \begin_layout Standard
7788 Additionally, the storecmp method returns false if target was modified (otherwis
7789 e true).
7790 \end_layout
7792 \begin_layout Subsection
7793 memory2.<marea>:readregion: Read region
7794 \end_layout
7796 \begin_layout Itemize
7797 Syntax table memory2.<marea>:readregion(number addr, number size)
7798 \end_layout
7800 \begin_layout Standard
7801 Read <size> bytes starting from <addr> in <marea> and return as array.
7802 \end_layout
7804 \begin_layout Subsection
7805 memory2.<marea>:writeregion: Write region
7806 \end_layout
7808 \begin_layout Itemize
7809 Syntax none memory2.<marea>:writeregion(number addr, table data)
7810 \end_layout
7812 \begin_layout Standard
7813 Write array <data> to bytes starting from <addr> in <marea>.
7814 \end_layout
7816 \begin_layout Subsection
7817 memory2.<marea>:register{read,write,exec}: Register hook
7818 \end_layout
7820 \begin_layout Itemize
7821 Syntax: function memory2.<marea>:registerread(number addr, function fn);
7822 \end_layout
7824 \begin_layout Itemize
7825 Syntax: function memory2.<marea>:registerwrite(number addr, function fn);
7826 \end_layout
7828 \begin_layout Itemize
7829 Syntax: function memory2.<marea>:registerexec(number addr, function fn);
7830 \end_layout
7832 \begin_layout Standard
7833 Register debug callback <fn> of specified type at offset <addr> of memory
7834  area <marea>.
7835  Returns <fn>.
7836 \end_layout
7838 \begin_layout Subsection
7839 memory2.<marea>:unregister{read,write,exec}: Unregister hook
7840 \end_layout
7842 \begin_layout Itemize
7843 Syntax: none memory2.<marea>:unregisterread(number addr, function fn);
7844 \end_layout
7846 \begin_layout Itemize
7847 Syntax: none memory2.<marea>:unregisterwrite(number addr, function fn);
7848 \end_layout
7850 \begin_layout Itemize
7851 Syntax: none memory2.<marea>:unregisterexec(number addr, function fn);
7852 \end_layout
7854 \begin_layout Standard
7855 Unregister debug callback <fn> of specified type at offset <addr> of memory
7856  area <marea>.
7857 \end_layout
7859 \begin_layout Standard
7860 \begin_inset Newpage pagebreak
7861 \end_inset
7864 \end_layout
7866 \begin_layout Section
7867 Table random
7868 \end_layout
7870 \begin_layout Standard
7871 Contains random number generation methods.
7872  These functions do not return reproducable results.
7873 \end_layout
7875 \begin_layout Subsection
7876 random.boolean: Random boolean
7877 \end_layout
7879 \begin_layout Itemize
7880 Syntax: boolean random.boolean()
7881 \end_layout
7883 \begin_layout Standard
7884 Returns true or false at random (50-50 chance).
7885 \end_layout
7887 \begin_layout Subsection
7888 random.integer: Random integer
7889 \end_layout
7891 \begin_layout Itemize
7892 Syntax: number random.integer(number highplusone)
7893 \end_layout
7895 \begin_layout Itemize
7896 Syntax: number random.integer(number low, number high)
7897 \end_layout
7899 \begin_layout Standard
7900 With one argument, return random integer [0,<highplusone>) (upper end exclusive).
7901  With two arguments, return random integer [<low>,<high>] (both ends inclusive).
7902 \end_layout
7904 \begin_layout Standard
7905 The returned numbers are from uniform distribution.
7906 \end_layout
7908 \begin_layout Subsection
7909 random.float: Random float
7910 \end_layout
7912 \begin_layout Itemize
7913 Syntax: number random.float()
7914 \end_layout
7916 \begin_layout Standard
7917 Returns random decimal number [0,1).
7918 \end_layout
7920 \begin_layout Subsection
7921 random.among: Random parameter
7922 \end_layout
7924 \begin_layout Itemize
7925 Syntax: value random.among(value values...)
7926 \end_layout
7928 \begin_layout Standard
7929 Returns random parameter value, picked at uniform.
7930  Multiple equivalent values are returned with higher chance.
7931 \end_layout
7933 \begin_layout Subsection
7934 random.amongtable: Random from table
7935 \end_layout
7937 \begin_layout Itemize
7938 Syntax: value random.amongtable(table tab)
7939 \end_layout
7941 \begin_layout Standard
7942 Returns random value from table <tab>.
7943  As in random.among, no equality testing is done.
7944 \end_layout
7946 \begin_layout Standard
7947 \begin_inset Newpage pagebreak
7948 \end_inset
7951 \end_layout
7953 \begin_layout Section
7954 Table zip
7955 \end_layout
7957 \begin_layout Subsection
7958 zip.enumerate: Enumerate members in zipfile
7959 \end_layout
7961 \begin_layout Itemize
7962 Syntax: Table zip.enumerate(string filename[, boolean invert])
7963 \end_layout
7965 \begin_layout Standard
7966 Returns table of files in zip archive <filename>.
7967  If <invert> is true, instead of returning array of names, returns table
7968  with keys being member names and values being true.
7969 \end_layout
7971 \begin_layout Subsection
7972 zip.writer: Class ZIPWRITER
7973 \end_layout
7975 \begin_layout Standard
7976 See class ZIPWRITER.
7977 \end_layout
7979 \begin_layout Standard
7980 \begin_inset Newpage pagebreak
7981 \end_inset
7984 \end_layout
7986 \begin_layout Section
7987 Table callback
7988 \end_layout
7990 \begin_layout Standard
7991 Various callback-related functions.
7992 \end_layout
7994 \begin_layout Subsection
7995 \begin_inset CommandInset label
7996 LatexCommand label
7997 name "sub:callback.register:-Register-a"
7999 \end_inset
8001 callback.register: Register a callback
8002 \end_layout
8004 \begin_layout Itemize
8005 Syntax: function callback.register(string cbname, function cbfun);
8006 \end_layout
8008 \begin_layout Standard
8009 Instruct function <cbfun> to be added to list of callbacks to call on event
8010  <cbname> (See section 
8011 \begin_inset CommandInset ref
8012 LatexCommand ref
8013 reference "sec:Callbacks"
8015 \end_inset
8018  The callback name does not have the 'on_' prefix (e.g.
8020 \begin_inset Quotes eld
8021 \end_inset
8023 paint
8024 \begin_inset Quotes erd
8025 \end_inset
8028  Returns <cbfun>.
8029 \end_layout
8031 \begin_layout Subsection
8032 \begin_inset CommandInset label
8033 LatexCommand label
8034 name "sub:callback.unregister:-Unregister-"
8036 \end_inset
8038 callback.unregister: Unregister a callback
8039 \end_layout
8041 \begin_layout Itemize
8042 Syntax: function callback.unregister(string cbname, function cbfun);
8043 \end_layout
8045 \begin_layout Standard
8046 Instruct function <cbfun> to be removed from list of callbacks to call on
8047  event <cbname>.
8048 \end_layout
8050 \begin_layout Subsection
8051 callback.<cbname>:register: Register callback
8052 \end_layout
8054 \begin_layout Itemize
8055 Syntax: function callback.<cbname>:register(function cbfun)
8056 \end_layout
8058 \begin_layout Standard
8059 Synonym for callback.register (section 
8060 \begin_inset CommandInset ref
8061 LatexCommand ref
8062 reference "sub:callback.register:-Register-a"
8064 \end_inset
8066 ), albeit with callback name specified differently.
8067 \end_layout
8069 \begin_layout Subsection
8070 callback.<cbname>:unregister: Register callback
8071 \end_layout
8073 \begin_layout Itemize
8074 Syntax: function callback.<cbname>:unregister(function cbfun)
8075 \end_layout
8077 \begin_layout Standard
8078 Synonym for callback.unregister (section 
8079 \begin_inset CommandInset ref
8080 LatexCommand ref
8081 reference "sub:callback.unregister:-Unregister-"
8083 \end_inset
8085 ), albeit with callback name specified differently.
8086 \end_layout
8088 \begin_layout Section
8089 table bsnes
8090 \end_layout
8092 \begin_layout Standard
8093 Various bsnes-specific functions.
8094 \end_layout
8096 \begin_layout Subsection
8097 bsnes.dump_sprite: Dump a sprite
8098 \end_layout
8100 \begin_layout Itemize
8101 Syntax: BITMAP bsnes.dump_sprite(string marea, number addr, number width,
8102  number height[, number stride])
8103 \end_layout
8105 \begin_layout Standard
8106 Dumps given sprite (in native format) from memory.
8107  memory area is usually 
8108 \begin_inset Quotes eld
8109 \end_inset
8111 VRAM
8112 \begin_inset Quotes erd
8113 \end_inset
8116  <Width> and <height> are given in 8x8 blocks.
8117  <Stride> overrides row stride (default 512).
8118 \end_layout
8120 \begin_layout Subsection
8121 bsnes.dump_palette: Dump a palette
8122 \end_layout
8124 \begin_layout Itemize
8125 Syntax: PALETTE bsnes.dump_palette(string marea, number addr, bool full256,
8126  bool first_trans)
8127 \end_layout
8129 \begin_layout Standard
8130 Dumps a palette from memory.
8131  memory area is usually 
8132 \begin_inset Quotes eld
8133 \end_inset
8135 CGRAM
8136 \begin_inset Quotes erd
8137 \end_inset
8140  If <full256> is true, 256 colors are dumped (otherwise 16).
8141  If <first_trans> is true, first color is forced transparent.
8142 \end_layout
8144 \begin_layout Subsection
8145 bsnes.enablelayer: Set layer visibility
8146 \end_layout
8148 \begin_layout Itemize
8149 Syntax: none bsnes.enablelayer(number layer, number priority, boolean enabled)
8150 \end_layout
8152 \begin_layout Standard
8153 Enable or disable specified layer at specified priority.
8154 \end_layout
8156 \begin_layout Subsection
8157 bsnes.redump_sprite: Redump a sprite
8158 \end_layout
8160 \begin_layout Itemize
8161 Syntax: none bsnes.redump_sprite(BITMAP bitmap, string marea, number addr[,
8162  number stride])
8163 \end_layout
8165 \begin_layout Standard
8166 Like bsnes.dump_sprite, but instead dumps to specified bitmap <bitmap>.
8167  The specified bitmap must have size multiple of 8x8.
8168 \end_layout
8170 \begin_layout Subsection
8171 bsnes.redump_palette: Redump a palette
8172 \end_layout
8174 \begin_layout Itemize
8175 Syntax: none bsnes.dump_palette(PALETTE pal, string marea, number addr, bool
8176  first_trans)
8177 \end_layout
8179 \begin_layout Standard
8180 Like bsnes.dump_palette, but instead dumps to specified palette <pal>.
8181  The specified palette must have either 16 or 256 colors.
8182 \end_layout
8184 \begin_layout Section
8185 extensions to table string
8186 \end_layout
8188 \begin_layout Subsection
8189 string.charU: string.char, UTF-8 version.
8190 \end_layout
8192 \begin_layout Itemize
8193 Syntax: string string.charU(number n...)
8194 \end_layout
8196 \begin_layout Standard
8197 Like Lua string.char(), but works in terms of Unicode codepoints.
8198  The returned string is UTF-8.
8199 \end_layout
8201 \begin_layout Subsection
8202 string.byteU: string.byte, UTF-8 version.
8203 \end_layout
8205 \begin_layout Itemize
8206 Syntax: number...
8207  string.byteU(string str[, number i[, number j]])
8208 \end_layout
8210 \begin_layout Standard
8211 Like string.byte(), but works in terms of Unicode codepoints.
8212  The input string <str> is assumed UTF-8.
8213 \end_layout
8215 \begin_layout Subsection
8216 string.regex: Match string against regular expression
8217 \end_layout
8219 \begin_layout Itemize
8220 Syntax: boolean/string...
8221  string.regex(string regexp, string against)
8222 \end_layout
8224 \begin_layout Standard
8225 Match POSIX-extended regular expression <regexp> against string <against>.
8226  If no match, false is returned.
8227  Otherwise if string has no subcaptures, true is returned.
8228  Otherwise each subcapture is returned as a string (in order of starting
8229  position).
8230 \end_layout
8232 \begin_layout Subsection
8233 string.hex: Transform integer into hex string
8234 \end_layout
8236 \begin_layout Itemize
8237 Syntax: string string.hex(number n, [number digits])
8238 \end_layout
8240 \begin_layout Standard
8241 Returns hexadecimal string representation of <n>, optionally padded with
8242  zeroes to <digits> digits (default is not to pad).
8243 \end_layout
8245 \begin_layout Subsection
8246 string.lpad: Pad string with spaces from left
8247 \end_layout
8249 \begin_layout Itemize
8250 Syntax: string string.lpad(string x, number n)
8251 \end_layout
8253 \begin_layout Standard
8254 Pad string <x> to <n> bytes by inserting spaces at start and return the
8255  result.
8256 \end_layout
8258 \begin_layout Subsection
8259 string.rpad: Pad string with spaces from right
8260 \end_layout
8262 \begin_layout Itemize
8263 Syntax: string string.rpad(string x, number n)
8264 \end_layout
8266 \begin_layout Standard
8267 Pad string <x> to <n> bytes by inserting spaces at end and return the result.
8268 \end_layout
8270 \begin_layout Section
8271 Table _SYSTEM
8272 \end_layout
8274 \begin_layout Standard
8275 Contains copy of global variables from time of Lua initialization.
8276  Non-writeable.
8277 \end_layout
8279 \begin_layout Standard
8280 \begin_inset Newpage pagebreak
8281 \end_inset
8284 \end_layout
8286 \begin_layout Section
8287 \begin_inset CommandInset label
8288 LatexCommand label
8289 name "sec:Callbacks"
8291 \end_inset
8293 Callbacks
8294 \end_layout
8296 \begin_layout Standard
8297 Various callbacks to Lua that can occur.
8298 \end_layout
8300 \begin_layout Subsection
8301 on_paint: Screen is being painted
8302 \end_layout
8304 \begin_layout Itemize
8305 Callback: on_paint(bool not_synth)
8306 \end_layout
8308 \begin_layout Standard
8309 Called when screen is being painted.
8310  Any gui.* calls requiring graphic context draw on the screen.
8311 \end_layout
8313 \begin_layout Itemize
8314 not_synth is true if this hook is being called in response to received frame,
8315  false otherwise.
8316 \end_layout
8318 \begin_layout Subsection
8319 on_video: Dumped video frame is being painted
8320 \end_layout
8322 \begin_layout Itemize
8323 Callback: on_video()
8324 \end_layout
8326 \begin_layout Standard
8327 Called when video dump frame is being painted.
8328  Any gui.* calls requiring graphic context draw on the video.
8329 \end_layout
8331 \begin_layout Subsection
8332 on_frame_emulated: Frame emulation complete
8333 \end_layout
8335 \begin_layout Itemize
8336 Callback: on_frame_emulated()
8337 \end_layout
8339 \begin_layout Standard
8340 Called when emulating frame has completed and on_paint()/on_video() calls
8341  are about to be issued.
8342 \end_layout
8344 \begin_layout Subsection
8345 on_frame: Frame emulation starting.
8346 \end_layout
8348 \begin_layout Itemize
8349 Callback: on_frame()
8350 \end_layout
8352 \begin_layout Standard
8353 Called on each starting whole frame.
8354 \end_layout
8356 \begin_layout Subsection
8357 on_rewind: Movie rewound to beginning
8358 \end_layout
8360 \begin_layout Itemize
8361 Callback: on_rewind()
8362 \end_layout
8364 \begin_layout Standard
8365 Called when rewind movie to beginning has completed.
8366 \end_layout
8368 \begin_layout Subsection
8369 on_pre_load: Load operation is about to start
8370 \end_layout
8372 \begin_layout Itemize
8373 Callback: on_pre_load(string name)
8374 \end_layout
8376 \begin_layout Standard
8377 Called just before savestate/movie load occurs (note: loads are always delayed,
8378  so this occurs even when load was initiated by lua).
8379 \end_layout
8381 \begin_layout Subsection
8382 on_err_Load: Load failed
8383 \end_layout
8385 \begin_layout Itemize
8386 Callback: on_err_load(string name)
8387 \end_layout
8389 \begin_layout Standard
8390 Called if loadstate goes wrong.
8391 \end_layout
8393 \begin_layout Subsection
8394 on_post_load: Load completed
8395 \end_layout
8397 \begin_layout Itemize
8398 Callback: on_post_load(string name, boolean was_savestate)
8399 \end_layout
8401 \begin_layout Standard
8402 Called on successful loadstate.
8403  was_savestate gives if this was a savestate or a movie.
8404 \end_layout
8406 \begin_layout Subsection
8407 on_pre_save: Save operation is about to start
8408 \end_layout
8410 \begin_layout Itemize
8411 Callback: on_pre_save(string name, boolean is_savestate)
8412 \end_layout
8414 \begin_layout Standard
8415 Called just before savestate save occurs (note: movie saves are synchronous
8416  and won't trigger these callbacks if called from Lua).
8417 \end_layout
8419 \begin_layout Subsection
8420 on_err_save: Save failed
8421 \end_layout
8423 \begin_layout Itemize
8424 Callback: on_err_save(string name)
8425 \end_layout
8427 \begin_layout Standard
8428 Called if savestate goes wrong.
8429 \end_layout
8431 \begin_layout Subsection
8432 on_post_save: Save completed
8433 \end_layout
8435 \begin_layout Itemize
8436 Callback: on_post_save(string name, boolean is_savestate)
8437 \end_layout
8439 \begin_layout Standard
8440 Called on successful savaestate.
8441  is_savestate gives if this was a savestate or a movie.
8442 \end_layout
8444 \begin_layout Subsection
8445 on_quit: Emulator is shutting down
8446 \end_layout
8448 \begin_layout Itemize
8449 Callback: on_quit()
8450 \end_layout
8452 \begin_layout Standard
8453 Called when emulator is shutting down.
8454 \end_layout
8456 \begin_layout Subsection
8457 on_input: Polling for input
8458 \end_layout
8460 \begin_layout Standard
8461 Called when emulator is just sending input to bsnes core.
8462  Warning: This is called even in readonly mode, but the results are ignored.
8463 \end_layout
8465 \begin_layout Subsection
8466 on_reset: System has been reset
8467 \end_layout
8469 \begin_layout Itemize
8470 Callback: on_reset()
8471 \end_layout
8473 \begin_layout Standard
8474 Called when system is reset.
8475 \end_layout
8477 \begin_layout Subsection
8478 on_readwrite: Entered recording mode
8479 \end_layout
8481 \begin_layout Itemize
8482 Callback: on_readwrite()
8483 \end_layout
8485 \begin_layout Standard
8486 Called when moving into recording mode as result of 
8487 \begin_inset Quotes eld
8488 \end_inset
8490 set-rwmode
8491 \begin_inset Quotes erd
8492 \end_inset
8494  command (note: moving to rwmode by Lua won't trigger this, as per recursive
8495  entry protection).
8496 \end_layout
8498 \begin_layout Subsection
8499 on_snoop/on_snoop2: Snoop core controller reads
8500 \end_layout
8502 \begin_layout Itemize
8503 Callback: on_snoop(number port, number controller, number index, number
8504  value)
8505 \end_layout
8507 \begin_layout Itemize
8508 Callback: on_snoop2(number port, number controller, number index, number
8509  value)
8510 \end_layout
8512 \begin_layout Standard
8513 Called each time bsnes asks for input.
8514  The value is the final value to be sent to bsnes core (readonly mode, autohold
8515  and autofire have been taken into account).
8516  Might be useful when translating movies to format suitable for console
8517  verification.
8518  Note: There is no way to modify the value to be sent.
8519 \end_layout
8521 \begin_layout Itemize
8522 On_snoop2 is called instead of on_snoop if defined.
8523  Reserves port 0 for system, having first user port be port 1.
8524 \end_layout
8526 \begin_layout Subsection
8527 on_keyhook: Hooked key/axis has been moved
8528 \end_layout
8530 \begin_layout Itemize
8531 Callback: on_keyhook(string keyname, table state)
8532 \end_layout
8534 \begin_layout Standard
8535 Sent when key that has keyhook events requested changes state.
8536  Keyname is name of the key (group) and state is the state (same kind as
8537  table values in input.raw).
8538 \end_layout
8540 \begin_layout Subsection
8541 on_idle: Idle event
8542 \end_layout
8544 \begin_layout Itemize
8545 Callback: on_idle()
8546 \end_layout
8548 \begin_layout Standard
8549 Called when requested by set_idle_timeout(), the timeout has expired and
8550  emulator is waiting.
8551 \end_layout
8553 \begin_layout Subsection
8554 on_timer: Timer event
8555 \end_layout
8557 \begin_layout Itemize
8558 Callback: on_timer()
8559 \end_layout
8561 \begin_layout Standard
8562 Called when requested by set_idle_timeout() and the timeout has expired
8563  (regardless if emulator is waiting).
8564 \end_layout
8566 \begin_layout Subsection
8567 on_set_rewind: Rewind point has been set
8568 \end_layout
8570 \begin_layout Itemize
8571 Callback: on_set_rewind(UNSAFEREWIND r)
8572 \end_layout
8574 \begin_layout Standard
8575 Called when unsafe rewind object has been constructed.
8576 \end_layout
8578 \begin_layout Subsection
8579 on_pre_rewind: Rewind is about to occur
8580 \end_layout
8582 \begin_layout Itemize
8583 Callback: on_pre_rewind() 
8584 \end_layout
8586 \begin_layout Standard
8587 Called just before unsafe rewind is about to occur.
8588 \end_layout
8590 \begin_layout Subsection
8591 on_post_rewind: Rewind has occured
8592 \end_layout
8594 \begin_layout Itemize
8595 Callback: on_post_rewind() 
8596 \end_layout
8598 \begin_layout Standard
8599 Called just after unsafe rewind has occured.
8600 \end_layout
8602 \begin_layout Subsection
8603 on_button: Button has been pressed
8604 \end_layout
8606 \begin_layout Itemize
8607 Callback: on_button(number port, number controller, number index, string
8608  type)
8609 \end_layout
8611 \begin_layout Standard
8612 Called on controller button press, with following parameters:
8613 \end_layout
8615 \begin_layout Itemize
8616 port: Port number (0 is system)
8617 \end_layout
8619 \begin_layout Itemize
8620 controller: Controller within port
8621 \end_layout
8623 \begin_layout Itemize
8624 index: Index of button.
8625 \end_layout
8627 \begin_layout Itemize
8628 type: Type of event, one of:
8629 \end_layout
8631 \begin_deeper
8632 \begin_layout Itemize
8633 \begin_inset Quotes eld
8634 \end_inset
8636 pressed
8637 \begin_inset Quotes erd
8638 \end_inset
8640 : Button was pressed.
8641 \end_layout
8643 \begin_layout Itemize
8644 \begin_inset Quotes eld
8645 \end_inset
8647 released
8648 \begin_inset Quotes erd
8649 \end_inset
8651 : Button was released.
8652 \end_layout
8654 \begin_layout Itemize
8655 \begin_inset Quotes eld
8656 \end_inset
8658 hold
8659 \begin_inset Quotes erd
8660 \end_inset
8662 : Held.
8663 \end_layout
8665 \begin_layout Itemize
8666 \begin_inset Quotes eld
8667 \end_inset
8669 unhold
8670 \begin_inset Quotes erd
8671 \end_inset
8673 : Released from hold.
8674 \end_layout
8676 \begin_layout Itemize
8677 \begin_inset Quotes eld
8678 \end_inset
8680 type
8681 \begin_inset Quotes erd
8682 \end_inset
8684 : Typing input on button.
8685 \end_layout
8687 \begin_layout Itemize
8688 \begin_inset Quotes eld
8689 \end_inset
8691 untype
8692 \begin_inset Quotes erd
8693 \end_inset
8695 : Typing input undone.
8696 \end_layout
8698 \begin_layout Itemize
8699 \begin_inset Quotes eld
8700 \end_inset
8702 autofire <duty> <cycle>
8703 \begin_inset Quotes erd
8704 \end_inset
8706 : Autofire with specifie duty and cycle.
8707 \end_layout
8709 \begin_layout Itemize
8710 \begin_inset Quotes eld
8711 \end_inset
8713 autofire
8714 \begin_inset Quotes erd
8715 \end_inset
8717 : Stop autofire.
8718 \end_layout
8720 \begin_layout Itemize
8721 \begin_inset Quotes eld
8722 \end_inset
8724 analog
8725 \begin_inset Quotes erd
8726 \end_inset
8728 : Analog action on axis.
8729 \end_layout
8731 \end_deeper
8732 \begin_layout Subsection
8733 on_movie_lost: Movie data is about to be lost
8734 \end_layout
8736 \begin_layout Itemize
8737 Callback: on_movie_lost(STRING kind)
8738 \end_layout
8740 \begin_layout Standard
8741 Called just before something would happen that could lose movie data.
8742  Kind can be:
8743 \end_layout
8745 \begin_layout Itemize
8746 readwrite: Switching to recording mode.
8747 \end_layout
8749 \begin_layout Itemize
8750 reload: ROM is being reloaded in recording mode.
8751 \end_layout
8753 \begin_layout Itemize
8754 load: New movie is being loaded.
8755 \end_layout
8757 \begin_layout Itemize
8758 unsaferewind: Unsafe rewind is happening.
8759 \end_layout
8761 \begin_layout Subsection
8762 on_latch: Latch line is rising
8763 \end_layout
8765 \begin_layout Itemize
8766 Callback: on_latch(<core-dependent-parameters>)
8767 \end_layout
8769 \begin_layout Standard
8770 Called when latch line for controller is rising.
8771  Some cores may not support this.
8772 \end_layout
8774 \begin_layout Section
8775 System-dependent behaviour
8776 \end_layout
8778 \begin_layout Subsection
8779 bsnes core
8780 \end_layout
8782 \begin_layout Itemize
8783 Registers are: pbpc, pb, pc, r0, r1, r2, r3, r4, r5, a, x, y, z, s, d, db,
8784  p, e, irq, wai, mdr, vector, aa, rd, sp, dp, p_n, p_v, p_m, p_x, p_d, p_i,
8785  p_z, p_c, ppu_display_disabled, ppu_oam_priority, ppu_bg_tilesize[0], ppu_bg_ti
8786 lesize[1], ppu_bg_tilesize[2], ppu_bg_tilesize[3], ppu_bg3_priority, ppu_mosaic_
8787 enabled[0], ppu_mosaic_enabled[1], ppu_mosaic_enabled[2], ppu_mosaic_enabled[3],
8788  ppu_vram_incmode, ppu_mode7_vflip, ppu_mode7_hflip, ppu_window1_enabled[0],
8789  ppu_window1_enabled[1], ppu_window1_enabled[2], ppu_window1_enabled[3],
8790  ppu_window1_enabled[4], ppu_window1_enabled[5], ppu_window1_invert[0],
8791  ppu_window1_invert[1], ppu_window1_invert[2], ppu_window1_invert[3], ppu_window
8792 1_invert[4], ppu_window1_invert[5], ppu_window2_enabled[0], ppu_window2_enabled[
8793 1], ppu_window2_enabled[2], ppu_window2_enabled[3], ppu_window2_enabled[4],
8794  ppu_window2_enabled[5], ppu_window2_invert[0], ppu_window2_invert[1], ppu_windo
8795 w2_invert[2], ppu_window2_invert[3], ppu_window2_invert[4], ppu_window2_invert[5
8796 ], ppu_bg_enabled[0], ppu_bg_enabled[1], ppu_bg_enabled[2], ppu_bg_enabled[3],
8797  ppu_bg_enabled[4], ppu_bgsub_enabled[0], ppu_bgsub_enabled[1], ppu_bgsub_enable
8798 d[2], ppu_bgsub_enabled[3], ppu_bgsub_enabled[4], ppu_window_enabled[0],
8799  ppu_window_enabled[1], ppu_window_enabled[2], ppu_window_enabled[3], ppu_window
8800 _enabled[4], ppu_sub_window_enabled[0], ppu_sub_window_enabled[1], ppu_sub_windo
8801 w_enabled[2], ppu_sub_window_enabled[3], ppu_sub_window_enabled[4], ppu_addsub_m
8802 ode, ppu_direct_color, ppu_color_mode, ppu_color_halve, ppu_color_enabled[0],
8803  ppu_color_enabled[1], ppu_color_enabled[2], ppu_color_enabled[3], ppu_color_ena
8804 bled[4], ppu_color_enabled[5], ppu_mode7_extbg, ppu_pseudo_hires, ppu_overscan,
8805  ppu_oam_interlace, ppu_interlace, ppu_latch_hcounter, ppu_latch_vcounter,
8806  ppu_counters_latched, ppu_time_over, ppu_range_over, ppu_ppu1_mdr, ppu_ppu2_mdr
8807 , ppu_bg_y[0], ppu_bg_y[1], ppu_bg_y[2], ppu_bg_y[3], ppu_ioamaddr, ppu_icgramad
8808 dr, ppu_display_brightness, ppu_oam_basesize, ppu_oam_nameselect, ppu_oam_tdaddr
8809 , ppu_oam_baseaddr, ppu_oam_addr, ppu_oam_firstsprite, ppu_oam_latchdata,
8810  ppu_bg_mode, ppu_mosaic_size, ppu_mosaic_countdown, ppu_bg_scaddr[0], ppu_bg_sc
8811 addr[1], ppu_bg_scaddr[2], ppu_bg_scaddr[3], ppu_bg_scsize[0], ppu_bg_scsize[1],
8812  ppu_bg_scsize[2], ppu_bg_scsize[3], ppu_bg_tdaddr[0], ppu_bg_tdaddr[1],
8813  ppu_bg_tdaddr[2], ppu_bg_tdaddr[3], ppu_bg_ofslatch, ppu_m7_hofs, ppu_m7_vofs,
8814  ppu_bg_hofs[0], ppu_bg_hofs[1], ppu_bg_hofs[2], ppu_bg_hofs[3], ppu_bg_vofs[0],
8815  ppu_bg_vofs[1], ppu_bg_vofs[2], ppu_bg_vofs[3], ppu_vram_mapping, ppu_vram_incs
8816 ize, ppu_vram_addr, ppu_mode7_repeat, ppu_m7_latch, ppu_m7a, ppu_m7b, ppu_m7c,
8817  ppu_m7d, ppu_m7x, ppu_m7y, ppu_cgram_addr, ppu_cgram_latchdata, ppu_window1_lef
8818 t, ppu_window1_right, ppu_window2_left, ppu_window2_right, ppu_window_mask[0],
8819  ppu_window_mask[1], ppu_window_mask[2], ppu_window_mask[3], ppu_window_mask[4],
8820  ppu_window_mask[5], ppu_color_mask, ppu_colorsub_mask, ppu_color_r, ppu_color_g
8821 , ppu_color_b, ppu_color_rgb, ppu_scanlines, ppu_hcounter, ppu_vcounter,
8822  ppu_vram_readbuffer, ppu_oam_itemcount, ppu_oam_tilecount, 
8823 \end_layout
8825 \begin_layout Itemize
8826 on_latch has no parameters
8827 \end_layout
8829 \begin_layout Itemize
8830 CPU 0 is S-CPU, 1 is S-SMP.
8831 \end_layout
8833 \begin_layout Itemize
8834 Cheats are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_{RAM,ROM}.
8835 \end_layout
8837 \begin_layout Itemize
8838 Read/Write/Execute hooks are supported for ROM, SRAM, WRAM, BSXFLASH, SLOT{A,B}_
8839 {RAM,ROM}.
8840 \end_layout
8842 \begin_layout Itemize
8843 Memory areas are: WRAM, APURAM, VRAM, OAM, CGRAM, RTC, DSPRAM, DSPPROM,
8844  DSPDROM, SRAM, ROM, BUS, PTRTABLE, CPU_STATE, PPU_STATE, SMP_STATE, DSP_STATE,
8845  BSXFLASH, BSX_RAM, BSX_PRAM, SLOTA_ROM, SLOTB_ROM, SLOTA_RAM, SLOTB_RAM,
8846  GBCPU_STATE, GBROM, GBRAM, GBWRAM, GBHRAM.
8847 \end_layout
8849 \begin_layout Subsection
8850 gambatte core
8851 \end_layout
8853 \begin_layout Itemize
8854 Registers are: wrambank, cyclecounter, pc, sp, hf1, hf2, zf, cf, a, b, c,
8855  d, e, f, h, l
8856 \end_layout
8858 \begin_layout Itemize
8859 on_latch is not supported
8860 \end_layout
8862 \begin_layout Itemize
8863 CPU 0 is main CPU.
8864 \end_layout
8866 \begin_layout Itemize
8867 Cheats are supported for ROM, SRAM and WRAM.
8868 \end_layout
8870 \begin_layout Itemize
8871 Read/Write/Execute hooks are supported for ROM (read/execute only), SRAM
8872  and WRAM.
8873 \end_layout
8875 \begin_layout Itemize
8876 Memory areas are: SRAM, WRAM, VRAM, IOAMHRAM, ROM, BUS.
8877 \end_layout
8879 \end_body
8880 \end_document