Rewrite Lua VGA output locking
[jpcrr.git] / docs / manual.lyx
blobdf02e52192b0bc153f6e80ab630fc2135a4b72c7
1 #LyX 1.6.7 created this file. For more info see http://www.lyx.org/
2 \lyxformat 345
3 \begin_document
4 \begin_header
5 \textclass article
6 \use_default_options true
7 \language finnish
8 \inputencoding auto
9 \font_roman default
10 \font_sans default
11 \font_typewriter default
12 \font_default_family default
13 \font_sc false
14 \font_osf false
15 \font_sf_scale 100
16 \font_tt_scale 100
18 \graphics default
19 \paperfontsize default
20 \spacing single
21 \use_hyperref false
22 \papersize default
23 \use_geometry true
24 \use_amsmath 1
25 \use_esint 1
26 \cite_engine basic
27 \use_bibtopic false
28 \paperorientation portrait
29 \leftmargin 2cm
30 \topmargin 2cm
31 \rightmargin 1cm
32 \bottommargin 2cm
33 \headheight 1cm
34 \headsep 1cm
35 \footskip 1cm
36 \secnumdepth 3
37 \tocdepth 3
38 \paragraph_separation indent
39 \defskip medskip
40 \quotes_language english
41 \papercolumns 1
42 \papersides 1
43 \paperpagestyle default
44 \tracking_changes false
45 \output_changes false
46 \author "" 
47 \author "" 
48 \end_header
50 \begin_body
52 \begin_layout Title
53 JPC-RR: User's manual
54 \end_layout
56 \begin_layout Section
57 Licence
58 \end_layout
60 \begin_layout Standard
61 JPC-RR is licenced under GNU GPL v2.
62  See file 
63 \begin_inset Quotes eld
64 \end_inset
66 LICENSE
67 \begin_inset Quotes erd
68 \end_inset
71 \end_layout
73 \begin_layout Section
74 Getting started
75 \end_layout
77 \begin_layout Subsection
78 Prerequisites
79 \end_layout
81 \begin_layout Standard
82 To get started, you need BIOS image, VGABIOS image and DOS boot floppy and
83  JDK for Java 6 standard edition (later versions should they appear should
84  also work).
85  Note: JRE is not enough.
87 \end_layout
89 \begin_layout Standard
90 Note that to play back recorded movies, you need exact same version of BIOS
91  image, VGABIOS image and DOS boot floppy as was used when making the movie
92  (in addition to exact same versions of other needed media).
93 \end_layout
95 \begin_layout Subsection
96 Compiling
97 \end_layout
99 \begin_layout Standard
100 See compile.sh or compile.bat.
101  The streamtools stuff is only needed for dumping videos.
102 \end_layout
104 \begin_layout Subsection
105 Getting started
106 \end_layout
108 \begin_layout Standard
109 First you need to get and make some important images.
110  Obtain BIOS image, VGABIOS image and DOS boot floppy from somewhere.
111  After starting the emulator, use Drives -> Import Image to import the images
112  (ignore the error about no BIOS images being found).
113 \end_layout
115 \begin_layout Subsection
116 Running emulator
117 \end_layout
119 \begin_layout Standard
120 There is premade autoexec script called assemble.jpcrrinit that has fairly
121  reasonable defaults.
122  To use it:
123 \end_layout
125 \begin_layout LyX-Code
126 java JPCApplication -autoexec assemble.jpcrrinit
127 \end_layout
129 \begin_layout Standard
130 The script pops up settings for new emulated PC (if you want to load savestate,
131  click cancel).
132  Select BIOS and VGABIOS for BIOS and VGABIOS image (they should be already
133  selected), DOSfloppy for fda (boot device should be set to fda) and game
134  image as some HD drive 
135 \end_layout
137 \begin_layout Subsection
138 Bootup tips
139 \end_layout
141 \begin_layout Itemize
142 Putting the game as hdd (the fourth hard disk slot) causes boot to be bit
143  faster.
144 \end_layout
146 \begin_layout Itemize
147 Some BIOS versions have 
148 \begin_inset Quotes eld
149 \end_inset
151 press F12 to select boot device
152 \begin_inset Quotes erd
153 \end_inset
156  Hit <enter> from emulated keyboard and that prompt will go away in about
157  half emulated second (it stays several emulated seconds otherwise).
159 \end_layout
161 \begin_layout Itemize
162 If game doesn't need lots of memory, hitting F5 to skip intialization files
163  is fastest.
164  If it does need more memory, run config.sys commands but not autoexec.bat.
166 \end_layout
168 \begin_layout Itemize
169 Some DOS disks have DOSIDLE with them, don't use it as it messes badly with
170  emulator.
171 \end_layout
173 \begin_layout Section
174 Making JPC-RR format images from raw images
175 \end_layout
177 \begin_layout Standard
178 Due to various factors, JPC-RR can't use raw image files directly but requires
179  its own image format.
181 \end_layout
183 \begin_layout Subsection
184 Importing images from GUI:
185 \end_layout
187 \begin_layout Standard
188 Use Drives -> Import Image to import existing directories or image files.
189  Dialog prompting parameters will be displayed.
190  When importing floppy images, check 
191 \begin_inset Quotes eld
192 \end_inset
194 standard geometry
195 \begin_inset Quotes erd
196 \end_inset
198  if possible, that enables geometry autodetection, which is reasonable virtually
199  all of the time it is offered.
200 \end_layout
202 \begin_layout Subsection
203 Notes
204 \end_layout
206 \begin_layout Itemize
207 If making image from directory, the names of the files must conform to FAT
208  naming restrictions (8+3 character names, no spaces, etc).
209  Avoid filenames with non-ASCII characters.
211 \end_layout
213 \begin_layout Itemize
214 The DOS limit of 112 or 224 files for floppies does not apply to images
215  created from directory trees.
216  The minimum limit value used is 512.
217  If even that isn't enough, the limit is automatically increased to fit
218  all the needed directory entries.
219 \end_layout
221 \begin_layout Itemize
222 Making boot disks from tree does NOT work.
223  Even if you got system boot files there, it still won't work.
224 \end_layout
226 \begin_layout Itemize
227 Only floppy disks and hard drives can be made from directory trees.
228  BIOS images and CDROM images require image file.
229 \end_layout
231 \begin_layout Itemize
232 Avoid floppies with custom geometry (floppy geometry does affect disk ID).
233  Disks with over 63 sectors per track don't work with DOS.
234  Wheither disks with over 127 tracks per side work with DOS is unknown.
235  Also avoid 1024-tracks per side HDDs.
236 \end_layout
238 \begin_layout Itemize
239 The geometry limits are: 2-1024 tracks per side for HDD, 1-256 tracks per
240  side for floppy.
241  1-63 sectors per track for HDD, 1-255 sectors per track for floppy.
242  1-16 sides for HDD, 1 or 2 sides for floppy.
243  This gives size limit of 65280KiB for floppy disks (but note the DOS limit!)
244  and 516096KiB for HDDs.
245 \end_layout
247 \begin_layout Itemize
248 There are multiple image file contents that represent the same image.
249  The one with smallest size is picked when creating image.
250 \end_layout
252 \begin_layout Itemize
253 Note: Although the IDs are 128 bits long, they are not MD5 hashes.
255 \end_layout
257 \begin_layout Subsection
258 Importing from command line
259 \end_layout
261 \begin_layout Standard
262 There is tool called ImageMaker that can make JPC-RR images from raw images.
263  Each image has format, ID an name.
264  Format and name are specified when making image.
265  ID is automatically calculated from format and contents.
266  Name does not affect the ID but is purely for convience so one doesn't
267  have to specify long image IDs manually.
268 \end_layout
270 \begin_layout Subsubsection
271 Syntax
272 \end_layout
274 \begin_layout Standard
275 The syntax for ImageMaker when making images is:
276 \end_layout
278 \begin_layout LyX-Code
279 $ java ImageMaker <format> [<options>...] <destination> <source> <name>
280 \end_layout
282 \begin_layout Standard
283 <destination> is file name for JPC-RR format image to write.
284  <source> is either name of regular file (raw image file) or name of directory
285  tree with files (supported for making floppy or hard disk images only).
286  In case of directory tree, the files are layout deterministically to disk,
287  so the ID will always be the same for given geometry and type.
288  <name> is name to give to disk.
289  <format> is one of:
290 \end_layout
292 \begin_layout LyX-Code
293 --BIOS BIOS image (note: VGABIOS is also of this type).
294 \end_layout
296 \begin_layout LyX-Code
297 --CDROM CD-ROM image.
298 \end_layout
300 \begin_layout LyX-Code
301 --HDD=cylinders,sectors,heads Hard disk with specified geometry.
302 \end_layout
304 \begin_layout LyX-Code
305 --floppy=tracks,sectors,sides Floppy disk with specified geometry.
306 \end_layout
308 \begin_layout LyX-Code
309 --floppy160 160KiB floppy (40 tracks, 8 sectors, Single sided).
310 \end_layout
312 \begin_layout LyX-Code
313 --floppy180 180KiB floppy (40 tracks, 9 sectors, Single sided).
314 \end_layout
316 \begin_layout LyX-Code
317 --floppy320 320KiB floppy (40 tracks, 8 sectors, Double sided).
318 \end_layout
320 \begin_layout LyX-Code
321 --floppy360 360KiB floppy (40 tracks, 9 sectors, Double sided).
322 \end_layout
324 \begin_layout LyX-Code
325 --floppy410 410KiB floppy (41 tracks, 10 sectors, Double sided).
326 \end_layout
328 \begin_layout LyX-Code
329 --floppy420 420KiB floppy (42 tracks, 10 sectors, Double sided).
330 \end_layout
332 \begin_layout LyX-Code
333 --floppy720 720KiB floppy (80 tracks, 9 sectors, Double sided).
334 \end_layout
336 \begin_layout LyX-Code
337 --floppy800 800KiB floppy (80 tracks, 10 sectors, Double sided).
338 \end_layout
340 \begin_layout LyX-Code
341 --floppy820 820KiB floppy (82 tracks, 10 sectors, Double sided).
342 \end_layout
344 \begin_layout LyX-Code
345 --floppy830 830KiB floppy (83 tracks, 10 sectors, Double sided).
346 \end_layout
348 \begin_layout LyX-Code
349 --floppy880 880KiB floppy (80 tracks, 11 sectors, Double sided).
350 \end_layout
352 \begin_layout LyX-Code
353 --floppy1040 1040KiB floppy (80 tracks, 13 sectors, Double sided).
354 \end_layout
356 \begin_layout LyX-Code
357 --floppy1120 1120KiB floppy (80 tracks, 14 sectors, Double sided).
358 \end_layout
360 \begin_layout LyX-Code
361 --floppy1200 1200KiB floppy (80 tracks, 15 sectors, Double sided).
362 \end_layout
364 \begin_layout LyX-Code
365 --floppy1440 1440KiB floppy (80 tracks, 18 sectors, Double sided).
366 \end_layout
368 \begin_layout LyX-Code
369 --floppy1476 1476KiB floppy (82 tracks, 18 sectors, Double sided).
370 \end_layout
372 \begin_layout LyX-Code
373 --floppy1494 1494KiB floppy (83 tracks, 18 sectors, Double sided).
374 \end_layout
376 \begin_layout LyX-Code
377 --floppy1600 1600KiB floppy (80 tracks, 20 sectors, Double sided).
378 \end_layout
380 \begin_layout LyX-Code
381 --floppy1680 1680KiB floppy (80 tracks, 21 sectors, Double sided).
382 \end_layout
384 \begin_layout LyX-Code
385 --floppy1722 1722KiB floppy (82 tracks, 21 sectors, Double sided).
386 \end_layout
388 \begin_layout LyX-Code
389 --floppy1743 1743KiB floppy (83 tracks, 21 sectors, Double sided).
390 \end_layout
392 \begin_layout LyX-Code
393 --floppy1760 1760KiB floppy (80 tracks, 22 sectors, Double sided).
394 \end_layout
396 \begin_layout LyX-Code
397 --floppy1840 1840KiB floppy (80 tracks, 23 sectors, Double sided).
398 \end_layout
400 \begin_layout LyX-Code
401 --floppy1920 1920KiB floppy (80 tracks, 24 sectors, Double sided).
402 \end_layout
404 \begin_layout LyX-Code
405 --floppy2880 2880KiB floppy (80 tracks, 36 sectors, Double sided).
406 \end_layout
408 \begin_layout LyX-Code
409 --floppy3120 3120KiB floppy (80 tracks, 39 sectors, Double sided).
410 \end_layout
412 \begin_layout LyX-Code
413 --floppy3200 3200KiB floppy (80 tracks, 40 sectors, Double sided).
414 \end_layout
416 \begin_layout LyX-Code
417 --floppy3520 3520KiB floppy (80 tracks, 44 sectors, Double sided).
418 \end_layout
420 \begin_layout LyX-Code
421 --floppy3840 3840KiB floppy (80 tracks, 48 sectors, Double sided).
422 \end_layout
424 \begin_layout Subsubsection
425 Other options
426 \end_layout
428 \begin_layout LyX-Code
429 --volumelabel=label Give specified volume label (affects ID).
430  Only meaningful when making image out of directory tree.
431  Default is no volume label.
432 \end_layout
434 \begin_layout LyX-Code
435 --timestamp=YYYYMMDDHHMMSS Give specified timestamp for files (affects ID).
436  Only meaningful when making image out of directory tree.
437  The default timestamp is 19900101T000000Z.
438 \end_layout
440 \begin_layout Subsubsection
441 Image information
442 \end_layout
444 \begin_layout Standard
445 When invoked as:
446 \end_layout
448 \begin_layout LyX-Code
449 $ java ImageMaker <imagefile>
450 \end_layout
452 \begin_layout Standard
453 Variety of information about image is displayed (especially for floppies/HDDs).
454  Two important fields are calculated and claimed disk ID.
455  They should be the same.
456  If they are not, then the image file is corrupt (sadly, imagemaker has
457  bugs and bugs that cause it to write corrupt images have been seen).
458 \end_layout
460 \begin_layout Subsection
461 Advanced: The disk ID algorithm
462 \end_layout
464 \begin_layout Standard
465 The disk ID is calculated as:
466 \end_layout
468 \begin_layout LyX-Code
469 Skein-256-128-deprecated(<typecode>|<geometry>|<image>)
470 \end_layout
472 \begin_layout Standard
473 Where Skein-256-128-deprecated is Skein hash function with 256-bit internal
474  state and 128-bit output using the deprecated rotation constants (as specified
475  in Skein hash function reference documentation versions 1.0 and 1.1).
476  The <image> is the whole image, including parts not stored in image file.
477  The reason for keeping using the deprecated constants are:
478 \end_layout
480 \begin_layout Itemize
481 Changing the constants would change the IDs, which would invalidate existing
482  images
483 \end_layout
485 \begin_layout Itemize
486 This is not about cryptographic security
487 \end_layout
489 \begin_layout Itemize
490 The new constants don't improve security that much anyway.
491 \end_layout
493 \begin_layout Subsubsection
494 Floppies and HDDs
495 \end_layout
497 \begin_layout Standard
498 Floppies have <typecode> value 0 (single byte) and HDDs have 1 (single byte).
499  <geometry> is as follows (this is exactly the same form as it appears in
500  image header):
501 \end_layout
503 \begin_layout LyX-Code
504 Byte 0 bits 0-1: Bits 8-9 of track count per side - 1.
505 \end_layout
507 \begin_layout LyX-Code
508 Byte 0 bits 2-5: Head count - 1.
509 \end_layout
511 \begin_layout LyX-Code
512 Byte 0 bits 6-7: Reserved, must be 0.
513 \end_layout
515 \begin_layout LyX-Code
516 Byte 1: Bits 0-7 of track count per side - 1.
517 \end_layout
519 \begin_layout LyX-Code
520 Byte 2: Sector count per track - 1.
521 \end_layout
523 \begin_layout Subsubsection
524 CD-ROM and BIOS images
525 \end_layout
527 \begin_layout Standard
528 CD-ROMs have <typecode> value 2 (single byte) and BIOS images have 3 (single
529  byte).
530  <geometry> is blank.
531 \end_layout
533 \begin_layout Subsection
534 Advanced: Disk Image format
535 \end_layout
537 \begin_layout Standard
538 The disk image consists of following parts, concatenated in this order without
539  padding:
540 \end_layout
542 \begin_layout Itemize
543 Magic
544 \end_layout
546 \begin_layout Itemize
547 Disk ID
548 \end_layout
550 \begin_layout Itemize
551 Type code
552 \end_layout
554 \begin_layout Itemize
555 Disk name length
556 \end_layout
558 \begin_layout Itemize
559 Disk name
560 \end_layout
562 \begin_layout Itemize
563 type-specific geometry/size data
564 \end_layout
566 \begin_layout Itemize
567 Actual image data
568 \end_layout
570 \begin_layout Itemize
571 Comments
572 \end_layout
574 \begin_layout Subsubsection
575 Magic
576 \end_layout
578 \begin_layout Standard
579 Magic in disk image files is following 5 bytes: 
580 \begin_inset Quotes eld
581 \end_inset
583 IMAGE
584 \begin_inset Quotes erd
585 \end_inset
588 \end_layout
590 \begin_layout Subsubsection
591 Disk ID
592 \end_layout
594 \begin_layout Standard
595 Disk ID is given as 16 bytes, encoding the 128-bit disk ID.
596 \end_layout
598 \begin_layout Subsubsection
599 Type code
600 \end_layout
602 \begin_layout Standard
603 Type code is single byte.
604  0 for floppies, 1 for HDDs, 2 for CD-ROMs and 3 for BIOS images.
605  Other values are reserved.
606 \end_layout
608 \begin_layout Subsubsection
609 Disk name length
610 \end_layout
612 \begin_layout Standard
613 Obsolete.
614  Disk name length is given as two-byte big-endian value.
615  New images should have 0 here.
616 \end_layout
618 \begin_layout Subsubsection
619 Disk name
620 \end_layout
622 \begin_layout Standard
623 Ignored.
624  Name field is there for backward compatiblity.
625  Disk name length gives length of this field in bytes.
626 \end_layout
628 \begin_layout Subsubsection
629 Type-specific geometry/size data (floppies and HDDs)
630 \end_layout
632 \begin_layout Standard
633 Floppies and HDDs have 3-byte geometry data:
634 \end_layout
636 \begin_layout LyX-Code
637 Byte 0 bits 0-1: Bits 8-9 of track count per side - 1.
638 \end_layout
640 \begin_layout LyX-Code
641 Byte 0 bits 2-5: Head count - 1.
642 \end_layout
644 \begin_layout LyX-Code
645 Byte 0 bits 6-7: Reserved, must be 0.
646 \end_layout
648 \begin_layout LyX-Code
649 Byte 1: Bits 0-7 of track count per side - 1.
650 \end_layout
652 \begin_layout LyX-Code
653 Byte 2: Sector count per track - 1.
654 \end_layout
656 \begin_layout Subsubsection
657 Type specific-geometry/size data (CD-ROMs)
658 \end_layout
660 \begin_layout Standard
661 CD-ROMs have 4-byte big-endian sector (512 bytes!) count.
662 \end_layout
664 \begin_layout Subsubsection
665 Type specific-geometry/size data (BIOS images)
666 \end_layout
668 \begin_layout Standard
669 BIOS images have 4-byte big-endian byte (not sector or block) count.
670 \end_layout
672 \begin_layout Subsubsection
673 Actual image data (floppy/HDD)
674 \end_layout
676 \begin_layout Standard
677 Floppy or HDD imagedata consists of following subparts:
678 \end_layout
680 \begin_layout Itemize
681 Storage method
682 \end_layout
684 \begin_layout Itemize
685 Sectors present
686 \end_layout
688 \begin_layout Itemize
689 Image data header
690 \end_layout
692 \begin_layout Itemize
693 Image data
694 \end_layout
696 \begin_layout Standard
697 Storage method is single byte.
698  Sectors present gives number of last nonzero sector + 1 (zero if image
699  is all zeroes)
700 \end_layout
702 \begin_layout Subsubsection
703 Floppy/HDD storage method 0: Raw storage
704 \end_layout
706 \begin_layout Standard
707 This storage method has empty header.
708  Image data is raw dump of first sectors present sectors.
709 \end_layout
711 \begin_layout Subsubsection
712 Floppy/HDD storage method 1: Sectormap
713 \end_layout
715 \begin_layout Standard
716 Image data header contains bitfield with just enough bytes to have one bit
717  per present sector.
718  The order of bits is such that number of bit corresponding to each sector
719  in byte is sector number modulo 8 and byte number is floor of sector number
720  divided by 8 when sector numbers are counted from zero.
721  If bit corresponding to sector is set, then the sector is present in image
722  data, otherwise it is absent and assumed to be all-zeroes.
723 \end_layout
725 \begin_layout Standard
726 Image data contains dumps of all present sectors in order of increasing
727  sector number.
728 \end_layout
730 \begin_layout Subsubsection
731 Floppy/HDD storage method 2: Extent first sector zero
732 \end_layout
734 \begin_layout Standard
735 Image data is empty as storage-specific data is mangled with image data.
736  The image data alternates between blocks encoding zero sectors and blocks
737  encoding nonzero sectors.
738  The first block encodes zero sectors.
740 \end_layout
742 \begin_layout Standard
743 Block encoding zero sectors consist of single 1-4 byte little-endian value
744  encoding number of sectors in block - 1.
745  Number of bytes is determined by sectors present value.
746  It is 1 for 1-256 sectors, 2 for 257-65536, 3 for 65537-16777216 and 4
747  for more than 16777216.
748  All sectors in block are filled with zeroes and are not stored.
749 \end_layout
751 \begin_layout Standard
752 Block encoding nonzero sectors has same block count as zero sector block
753  but is followed by the sectors stored raw.
754 \end_layout
756 \begin_layout Subsubsection
757 Floppy/HDD storage method 3: Extent first sector nonzero
758 \end_layout
760 \begin_layout Standard
761 Same as storage method 2 but first block is nonzero sector block.
762 \end_layout
764 \begin_layout Subsubsection
765 Actual image data (CD-ROMs and BIOS images)
766 \end_layout
768 \begin_layout Standard
769 These store image data raw.
770  The amount of data is specified by sector/byte count.
771 \end_layout
773 \begin_layout Subsubsection
774 Comments
775 \end_layout
777 \begin_layout Standard
778 Comments are given as list of strings, with UTF-8 encoded strings following
779  2-octet big-endian length.
780  Comment list is terminated by entry with length 0 (0x00 0x00).
781  Comments are optional and may be absent.
782 \end_layout
784 \begin_layout Section
785 The actual emulator
786 \end_layout
788 \begin_layout Standard
789 The actual emulator is invoked as:
790 \end_layout
792 \begin_layout LyX-Code
793 $ java JPCApplication <options>...
794 \end_layout
796 \begin_layout Standard
797 The valid options are:
798 \end_layout
800 \begin_layout LyX-Code
801 -autoexec <script> Execute contents of specified file as commands when starting
802  up.
803 \end_layout
805 \begin_layout LyX-Code
806 -noautoexec Don't run autoexec files.
807 \end_layout
809 \begin_layout LyX-Code
810 -norenames Copy&Delete files instead of renaming.
811  Mainly meant for debugging copy&delte code.
812 \end_layout
814 \begin_layout LyX-Code
815 -imagemaker <options> Run in image maker mode (run with parameter '-imagemaker'
816  with no further parameters for help)
817 \end_layout
819 \begin_layout Standard
820 If no arguments are given, defaults of autoexec file of 'assemble.jpcrrinit'
821  are used.
822 \end_layout
824 \begin_layout Subsection
825 Command line
826 \end_layout
828 \begin_layout Standard
829 When emulator is started, command line comes up.
830  Following commands are known:
831 \end_layout
833 \begin_layout Itemize
834 'exit': exit immediately.
835  Dumps in progress are gracefully closed.
836 \end_layout
838 \begin_layout Itemize
839 'kill': Save stack traces and kill the emulator (for debugging only).
840  Any dumps in progress are likely corrupted.
841 \end_layout
843 \begin_layout Itemize
844 'library <library>': set library directory to <library>.
845 \end_layout
847 \begin_layout Itemize
848 'load <plugin>': Load plugin (no arguments)
849 \end_layout
851 \begin_layout Itemize
852 'load <plugin>(<arguments>)': load plugin with arguments.
853 \end_layout
855 \begin_layout Itemize
856 'command <command> [<arguments>...]': Invoke command via external command interface.
857 \end_layout
859 \begin_layout Itemize
860 'call<command> [<arguments>...]': Invoke command via external command interface
861  and print return values.
862 \end_layout
864 \begin_layout Itemize
865 'lsdisks [<filename>]' Print listing of all known disks.
866  If <filename> is specified, save output to specified file.
867 \end_layout
869 \begin_layout Itemize
870 'diskinfo [<filename>] <imagename>' Print Information about <imagename>
871  (can be disk name or ID).
872  If <filename> is specified, save output to specified file.
873 \end_layout
875 \begin_layout Standard
876 When one gets command line, its useful to load some plugins.
877  See section about plugins.
878  Note: Load runner plugin (PCControl/PCRunner and so) last, as some runners
879  like to start PC immediately.
880 \end_layout
882 \begin_layout Subsection
883 PC settings dialog notes
884 \end_layout
886 \begin_layout Itemize
887 CPU divider base frequency before division is 1GHz.
888 \end_layout
890 \begin_layout Itemize
891 Images can be specified by name or by ID.
892  Name is relative to library directory.
893  If the image is in subdirectory of image directory, the directory separator
894  is is '/' regardless of what the host OS uses.
895 \end_layout
897 \begin_layout Itemize
898 CD-ROM and hdc are mutually exclusive
899 \end_layout
901 \begin_layout Itemize
902 Modules is comma-seperated list of modules to load.
903  To pass arguments to some modules, enclose the arguments in ().
904  Same module can be specified twice only if parameters differ.
905 \end_layout
907 \begin_layout Itemize
908 Setting boot device doesn't work with some BIOS versions.
909  Those versions prompt the boot device anyway.
910 \end_layout
912 \begin_layout Subsection
913 Audio output channels
914 \end_layout
916 \begin_layout Standard
917 PC can have one or more audio output channels.
918  The name of audio output associated with PC speaker is: 'org.jpc.emulator.peripher
919 al.PCSpeaker-0'.
920  Modules that have audio outputs get channel names of form <classname>-<sequenti
921 al>, where <classname> is name of main module class and sequential is number
922  starting from zero.
923  Note that same module can have multiple output channels.
924  If multiple modules of same class request audio outputs, the <sequential>
925  values of subsequent module start where previous left off.
926 \end_layout
928 \begin_layout Subsection
929 Plugins
930 \end_layout
932 \begin_layout Standard
933 Plugins actually execute the tasks of the emulator.
934  They can be loaded using 
935 \begin_inset Quotes eld
936 \end_inset
938 load <plugin>
939 \begin_inset Quotes erd
940 \end_inset
942  or 'load <plugin>(<arguments>)
943 \begin_inset Quotes erd
944 \end_inset
946  from command line.
947 \end_layout
949 \begin_layout Standard
950 Different Plugins using the same output (like running PCMonitor and RAWVideoDump
951 er) should not conflict because connector output hold locking is desinged
952  to handle multiple readers.
953 \end_layout
955 \begin_layout Standard
956 If no plugin used requires GUI, then the emulator can be run without having
957  GUI available.
958 \end_layout
960 \begin_layout Subsubsection
961 plugin: org.jpc.plugins.PCControl
962 \end_layout
964 \begin_layout Standard
965 Takes optionally 'extramenu=<file>' and 'uncompressedsave=1', requires and
966  uses GUI.
967 \end_layout
969 \begin_layout Standard
970 Runs the PC emulator core.
971  Has capability to start/stop emulation, breakpoint after certain time or
972  start/end of VGA vertical retrace.
973  Also can create, savestate and loadstate PC emulation.
974  Memory dumping is supported.
976 \end_layout
978 \begin_layout Standard
979 'extramenu=<file>' causes Plugin to load extra menu entries from <file>.
980  'uncompressedsave=1' causes savestates to be written uncompressed (useful
981  if they are stored in VCS supporting delta compression).
982 \end_layout
984 \begin_layout Subsubsection
985 plugin: org.jpc.plugins.PCRunner
986 \end_layout
988 \begin_layout Standard
989 Takes 'movie=<file>' as argument and optionally 'stoptime=<time>' Does not
990  require nor use GUI.
991 \end_layout
993 \begin_layout Standard
994 Loads PC from savestate and just runs it.
995  CTRL+C to quit.
996  Also automatically quits once stoptime is reached.
997 \end_layout
999 \begin_layout Subsubsection
1000 plugin: org.jpc.plugins.PCMonitor
1001 \end_layout
1003 \begin_layout Standard
1004 No arguments, requires and uses GUI.
1005 \end_layout
1007 \begin_layout Standard
1008 VGA monitor for emulated PC.
1009 \end_layout
1011 \begin_layout Subsubsection
1012 plugin: org.jpc.plugins.VirtualKeyboard
1013 \end_layout
1015 \begin_layout Standard
1016 No arguments, requires and uses GUI.
1017 \end_layout
1019 \begin_layout Standard
1020 On-screen keyboard for emulated PC.
1021 \end_layout
1023 \begin_layout Subsubsection
1024 plugin: org.jpc.plugins.PCStartStopTest
1025 \end_layout
1027 \begin_layout Standard
1028 No arguments, requires and uses GUI.
1029 \end_layout
1031 \begin_layout Standard
1032 Small plugin testing remote PC start/stop.
1033  Also supports sending some common keypresses.
1034 \end_layout
1036 \begin_layout Subsubsection
1037 plugin: org.jpc.plugins.RAWVideoDumper
1038 \end_layout
1040 \begin_layout Standard
1041 Takes 'rawoutput=<file>' as argument.
1042  Does not require nor use GUI.
1043 \end_layout
1045 \begin_layout Standard
1046 Dumps all generated frames to RAW file <file>.
1047  Rawoutput is required.
1048  The raw file consists of concatenation of zlib streams.
1049  The uncompressed stream is concatenation of time skips (FFh FFh FFh FFh),
1050  each acting as time offset of 2^32-1 nanoseconds and saved frames.
1051  The saved frame has time offset in nanoseconds (big endian) as first four
1052  bytes (must be at most 2^32-2, as 2^32-1 is reserved for time skip).
1053  The next two bytes are big-endian width, next two big-endian height.
1054  Finally frame has 4 * width * height bytes of data that encodes pixels
1055  using 4 bytes per pixel, in left-to-right, up-to-down order.
1056  Byte 0 of each pixel is reserved, byte 1 is the red channel, byte 2 is
1057  green channel and byte 3 is blue channel.
1058 \end_layout
1060 \begin_layout Standard
1061 Dumping to pipe is supported.
1062 \end_layout
1064 \begin_layout Subsubsection
1065 plugin: org.jpc.plugins.RAWAudioDumper
1066 \end_layout
1068 \begin_layout Standard
1069 Takes 'src=<name of audio output channel>', 'file=<output-filename>' and
1070  'offset=<offset>' as arguments, separated by ','.
1071  Does not require nor use GUI.
1072 \end_layout
1074 \begin_layout Standard
1075 Dumps output from specified audio output channel (src, mandatory) to RAW-format
1076  file (file, mandatory).
1077  The resulting file consists of records, 4 or 8 bytes each.
1078  4 byte record consists of 0xFF 0xFF 0xFF 0xFF and means to increase next
1079  time delta by 
1080 \begin_inset Formula $2^{32}-1$
1081 \end_inset
1084  Otherwise record is 8 bytes.
1085  Each 8 byte record has three fields.
1086  First 4 byte unsinged big endian timedelta value (in nanoseconds, must
1087  be smaller than 
1088 \begin_inset Formula $2^{32}-1$
1089 \end_inset
1091 ), then 2 byte signed big endian new left channel volume, then 2 byte signed
1092  big endian new right channel volume.
1093  Optionally 'offset' can be set to positive value (in nanoseconds) to delay
1094  the audio by.
1095 \end_layout
1097 \begin_layout Subsubsection
1098 plugin: org.jpc.plugins.LuaPlugin
1099 \end_layout
1101 \begin_layout Standard
1102 Takes 'kernel=<name of lua kernel file>', other parameters are passed to
1103  kernel, requires and uses GUI.
1104 \end_layout
1106 \begin_layout Standard
1107 Lua VM for executing scripts.
1108 \end_layout
1110 \begin_layout Subsubsection
1111 plugin: org.jpc.plugins.JoystickInput
1112 \end_layout
1114 \begin_layout Standard
1115 No parameters.
1116  Displays window for sending joystick input.
1117 \end_layout
1119 \begin_layout Section
1120 Modules
1121 \end_layout
1123 \begin_layout Subsection
1124 org.jpc.modules.Joystick:
1125 \end_layout
1127 \begin_layout Itemize
1128 Arguments: none.
1129 \end_layout
1131 \begin_layout Itemize
1132 Resources: I/O port 0x201
1133 \end_layout
1135 \begin_layout Standard
1136 Emulates joystick game port.
1137 \end_layout
1139 \begin_layout Subsection
1140 org.jpc.modules.SoundCard
1141 \end_layout
1143 \begin_layout Itemize
1144 Arguments: Optional resources specification
1145 \end_layout
1147 \begin_layout Itemize
1148 Resources (defaults): I/O port 0x220-0x22F, IRQ 5, DMA 1, DMA 5
1149 \end_layout
1151 \begin_layout Standard
1152 Emulates Sound card.
1153 \end_layout
1155 \begin_layout Subsection
1156 org.jpc.modules.GMIDIInterface
1157 \end_layout
1159 \begin_layout Itemize
1160 Arguments: Optional resources specification
1161 \end_layout
1163 \begin_layout Itemize
1164 Resources (defaults): I/O port 0x330-0x331, IRQ 9
1165 \end_layout
1167 \begin_layout Standard
1168 Emulates General MIDI interface.
1169 \end_layout
1171 \begin_layout Subsection
1172 org.jpc.modules.FMCard
1173 \end_layout
1175 \begin_layout Itemize
1176 Arguments: Optional resources specification
1177 \end_layout
1179 \begin_layout Itemize
1180 Resources (defaults): I/O port 0x338-0x33B
1181 \end_layout
1183 \begin_layout Standard
1184 Emulates FM card.
1185 \end_layout
1187 \begin_layout Subsection
1188 org.jpc.modules.BasicFPU:
1189 \end_layout
1191 \begin_layout Itemize
1192 Arguments: none.
1193 \end_layout
1195 \begin_layout Itemize
1196 Resources: None.
1197 \end_layout
1199 \begin_layout Standard
1200 Crude FPU (x87) emulator.
1201 \end_layout
1203 \begin_layout Section
1204 Hacks
1205 \end_layout
1207 \begin_layout Standard
1208 Hacks are saved to savestates but not movies.
1209 \end_layout
1211 \begin_layout Subsection
1212 NO_FPU
1213 \end_layout
1215 \begin_layout Standard
1216 Force bit 1 of physical address 0x0410 to zero, signaling that the system
1217  has no FPU.
1218  BIOS assumes system has FPU but some games use that bit to detect FPU,
1219  trying to use it if it is 
1220 \begin_inset Quotes eld
1221 \end_inset
1223 present
1224 \begin_inset Quotes erd
1225 \end_inset
1228  Try this if game startup hangs with lots of trying to use FPU but not present
1229  errors.
1230  Don't use if there is FPU present.
1231  Needed to get games like Blake Stone / Wolfenstein 3-D to work (FPU emulator
1232  allows it to start but causes graphical glitches).
1233 \end_layout
1235 \begin_layout Subsection
1236 VGA_DRAW
1237 \end_layout
1239 \begin_layout Standard
1240 Update basic VGA parameters before vretrace, not after it.
1241  Some games (e.g.
1242  Commander Keen 4) don't like if this isn't done and some games (e.g.
1243  Mario & Luigi) don't like if it is done.
1244  Wrong value manifests as jerky scrolling (scrolling back and forth and
1245  fixed statusbars move).
1246 \end_layout
1248 \begin_layout Section
1249 Some error messages and explanations
1250 \end_layout
1252 \begin_layout Itemize
1253 <filename> is Not a valid image file
1254 \end_layout
1256 \begin_layout Itemize
1257 <filename> is not image file
1258 \end_layout
1260 \begin_layout Itemize
1261 <filename> claims to be floppy with illegal geometry: <x> tracks, <y> sides
1262  and <z> sectors.
1263 \end_layout
1265 \begin_layout Itemize
1266 <filename> claims to be HDD with illegal geometry: <x> tracks, <y> sides
1267  and <z> sectors.
1268 \end_layout
1270 \begin_layout Itemize
1271 Can't read disk image sector map.
1272 \end_layout
1274 \begin_layout Itemize
1275 Can't read disk image extent.
1276 \end_layout
1278 \begin_layout Standard
1279 Code expects <filename> to be valid JPC-RR format image, but it isn't JPC-RR
1280  image at all or its corrupt.
1281 \end_layout
1283 \begin_layout Itemize
1284 <filename> is image of unknown type.
1285 \end_layout
1287 \begin_layout Itemize
1288 <filename> has unrecognized geometry <x> <y> <z>
1289 \end_layout
1291 \begin_layout Standard
1292 Possibly corrupt image, not JPC-RR image, or JPC-RR image from future version
1293  containing something current version can't comprehend.
1294 \end_layout
1296 \begin_layout Itemize
1297 Invalid format specifier <something>.
1298 \end_layout
1300 \begin_layout Itemize
1301 Invalid syntax of --floppy= or --HDD= option.
1302 \end_layout
1304 \begin_layout Itemize
1305 Invalid format specifier/option <something>.
1306 \end_layout
1308 \begin_layout Standard
1309 Invalid option or format specifier was given.
1310  Check for typos.
1311 \end_layout
1313 \begin_layout Itemize
1314 java ImageMaker [<options>...] <format> <destination> <source> <diskname>
1315 \end_layout
1317 \begin_layout Standard
1318 Check syntax of command.
1319  Especially that diskname is present!
1320 \end_layout
1322 \begin_layout Itemize
1323 The image has <nnn> sectors while it should have <yyy> according to selected
1324  geometry.
1325 \end_layout
1327 \begin_layout Itemize
1328 Raw image file length not divisible by 512.
1329 \end_layout
1331 \begin_layout Itemize
1332 Trying to read sector out of range.
1333 \end_layout
1335 \begin_layout Standard
1336 The selected geometry is wrong or raw image is incomplete.
1337 \end_layout
1339 \begin_layout Itemize
1340 Invalid disk name (Should not happen!).
1341 \end_layout
1343 \begin_layout Itemize
1344 Invalid geometry to be written.
1345 \end_layout
1347 \begin_layout Standard
1348 This is a very likely a bug in program.
1349 \end_layout
1351 \begin_layout Itemize
1352 What the heck <filename> is? It's not regular file nor directory.
1353 \end_layout
1355 \begin_layout Standard
1356 That sort of file can't be used as input for image making, or the file just
1357  doesn't exist.
1358 \end_layout
1360 \begin_layout Itemize
1361 BIOS images can only be made out of regular files.
1362 \end_layout
1364 \begin_layout Itemize
1365 CD images can only be made out of regular files.
1366 \end_layout
1368 \begin_layout Standard
1369 Source image specified is not regular file, but image of that type can't
1370  be made of anything else.
1371 \end_layout
1373 \begin_layout Itemize
1374 Can't read raw bios image file.
1375 \end_layout
1377 \begin_layout Itemize
1378 Can't read sector <nnn> from image.
1379 \end_layout
1381 \begin_layout Standard
1382 Reading the raw image file failed for some reason.
1383 \end_layout
1385 \begin_layout Itemize
1386 Bad library line: "<something>".
1387  Ignored.
1388 \end_layout
1390 \begin_layout Standard
1391 Syntax error in image library.
1392 \end_layout
1394 \begin_layout Itemize
1395 Removing image <something> a.k.a.
1396  "<something>" as it no longer exists.
1397 \end_layout
1399 \begin_layout Standard
1400 The image file no longer exists so it gets removed from library.
1401 \end_layout
1403 \begin_layout Itemize
1404 Removing image <something> a.k.a.
1405  "<something>" due to <some> conflict.
1406 \end_layout
1408 \begin_layout Standard
1409 Image library code killed some image from library due to some kind of conflict
1410  with image being added.
1411 \end_layout
1413 \begin_layout Itemize
1414 Too much data to fit into given space.
1415 \end_layout
1417 \begin_layout Standard
1418 The tree you gave contains takes just too much space to fit into disk of
1419  this size.
1420 \end_layout
1422 \begin_layout Section
1423 Advanced: Savestate/movie format
1424 \end_layout
1426 \begin_layout Subsection
1427 Special character classes
1428 \end_layout
1430 \begin_layout Subsubsection
1431 SPACE
1432 \end_layout
1434 \begin_layout Standard
1435 Following Unicode codepoints (encoded as UTF-8) are interpretted as space
1436  characters:
1437 \end_layout
1439 \begin_layout Itemize
1440 Codepoints 0x20, and 0x09.
1441 \end_layout
1443 \begin_layout Itemize
1444 Codepoints 0x1680, 0x180E, 0x2028, 0x205F and 0x3000
1445 \end_layout
1447 \begin_layout Itemize
1448 Codepoints 0x2000-0x200A.
1449 \end_layout
1451 \begin_layout Subsubsection
1452 LINEFEED
1453 \end_layout
1455 \begin_layout Standard
1456 Following byte sequences are interpretted as linefeeds (line change):
1457 \end_layout
1459 \begin_layout Itemize
1460 Byte 0x0A (UTF-8 encoded codepoint 0x0A)
1461 \end_layout
1463 \begin_layout Itemize
1464 Byte 0x0D (UTF-8 encoded codepoint 0x0D)
1465 \end_layout
1467 \begin_layout Itemize
1468 Byte 0x1C (UTF-8 encoded codepoint 0x1C)
1469 \end_layout
1471 \begin_layout Itemize
1472 Byte 0x1D (UTF-8 encoded codepoint 0x1D)
1473 \end_layout
1475 \begin_layout Itemize
1476 Byte 0x1E (UTF-8 encoded codepoint 0x1E)
1477 \end_layout
1479 \begin_layout Itemize
1480 Bytes 0xC2 0x85 (UTF-8 for unicode control character NL, codepoint 0x85)
1481 \end_layout
1483 \begin_layout Itemize
1484 Bytes 0xE2 0x80 0xA9 (UTF-8 encoded codepoint 0x2029)
1485 \end_layout
1487 \begin_layout Subsection
1488 JRSR archive
1489 \end_layout
1491 \begin_layout Standard
1492 JRSR archive format packs multiple text archive members to text archive.
1493  It does not support binary members.
1494  JRSR archives have first five or six bytes form the magic.
1495  It is 
1496 \begin_inset Quotes eld
1497 \end_inset
1499 JRSR
1500 \begin_inset Quotes erd
1501 \end_inset
1503  followed by LINEFEED character There are four kinds of lines after that
1504  (lines are terminated by LINEFEED byte/bytes):
1505 \end_layout
1507 \begin_layout Itemize
1508 Start member
1509 \end_layout
1511 \begin_layout Itemize
1512 Member line
1513 \end_layout
1515 \begin_layout Itemize
1516 End member
1517 \end_layout
1519 \begin_layout Itemize
1520 Blank line
1521 \end_layout
1523 \begin_layout Standard
1524 Sequencing rules are as follows: Start member is allowed anywhere (after
1525  magic).
1526  Member line is allowed only inside member (member started but not ended).
1527  End member is only allowed inside member.
1528  End of file is only allowed outside member.
1529  Blank line is allowed anywhere after magic.
1530 \end_layout
1532 \begin_layout Subsubsection
1533 Start member
1534 \end_layout
1536 \begin_layout Standard
1537 Start member line is given as 
1538 \begin_inset Quotes eld
1539 \end_inset
1541 !BEGIN
1542 \begin_inset Quotes erd
1543 \end_inset
1545  <SPACE>+ <membername> <LINEFEED>.
1546  <SPACE>+ any number of SPACE characters at least one and <LINEFEED> is
1547  LINEFEED chacter.
1548  The member name is UTF-8 encoded and maximum allowed line length is 2048
1549  bytes (including LINEFEED, which means name is limited to 509-2040 codepoints
1550  depending on characters used).
1551  Starting member inside another implicitly ends the previous member.
1552 \end_layout
1554 \begin_layout Subsubsection
1555 Member line:
1556 \end_layout
1558 \begin_layout Standard
1559 Member line is given as 
1560 \begin_inset Quotes eld
1561 \end_inset
1564 \begin_inset Quotes erd
1565 \end_inset
1567 <content><LINEFEED>.
1568  It gives another line for member contents.
1569  <content> is passed raw to layers above (followed by line termination)
1570 \end_layout
1572 \begin_layout Subsubsection
1573 End member
1574 \end_layout
1576 \begin_layout Standard
1577 End member line is given as 
1578 \begin_inset Quotes eld
1579 \end_inset
1581 !END
1582 \begin_inset Quotes erd
1583 \end_inset
1585 <LINEFEED>.
1586  It ends the current member.
1587  The following line can only be start member line or file may end.
1588 \end_layout
1590 \begin_layout Subsubsection
1591 Blank line
1592 \end_layout
1594 \begin_layout Standard
1595 Blank line is given as <LINEFEED>.
1596  Lines like that are ignored.
1597 \end_layout
1599 \begin_layout Subsection
1600 Four-to-Five encoding
1601 \end_layout
1603 \begin_layout Standard
1604 Binary members are encoded into text by so-called four-to-five encoding.
1605  This encoding can encode single byte to two, two bytes to three, three
1606  bytes to four and four bytes to five.
1607  Four-to-five encoding has five kinds of blocks.
1608  All SPACE and LINEFEED characters are completely ignored, even in middle
1609  of blocks.
1610 \end_layout
1612 \begin_layout Subsubsection
1613 End stream block
1614 \end_layout
1616 \begin_layout Standard
1617 End stream block is encoded as '!'.
1618  It ends the stream instantly.
1619  There is also implicit end of stream at end of input to decoding.
1620 \end_layout
1622 \begin_layout Subsubsection
1623 Other four block types
1624 \end_layout
1626 \begin_layout Standard
1627 Other four block types take the value to be encoded, read it as big-endian
1628  value.
1629  Then they write it as base-93 big-endian value.
1630  Then length specific constants are added to digits of that number to yield
1631  ASCII values for characters (those are stored in order):
1632 \end_layout
1634 \begin_layout Standard
1635 \begin_inset Tabular
1636 <lyxtabular version="3" rows="5" columns="6">
1637 <features>
1638 <column alignment="center" valignment="top" width="0">
1639 <column alignment="center" valignment="top" width="0">
1640 <column alignment="center" valignment="top" width="0">
1641 <column alignment="center" valignment="top" width="0">
1642 <column alignment="center" valignment="top" width="0">
1643 <column alignment="center" valignment="top" width="0">
1644 <row>
1645 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1646 \begin_inset Text
1648 \begin_layout Plain Layout
1649 To encode
1650 \end_layout
1652 \end_inset
1653 </cell>
1654 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1655 \begin_inset Text
1657 \begin_layout Plain Layout
1658 1st char.
1659 \end_layout
1661 \end_inset
1662 </cell>
1663 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1664 \begin_inset Text
1666 \begin_layout Plain Layout
1667 2nd char.
1668 \end_layout
1670 \end_inset
1671 </cell>
1672 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1673 \begin_inset Text
1675 \begin_layout Plain Layout
1676 3rd char.
1677 \end_layout
1679 \end_inset
1680 </cell>
1681 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1682 \begin_inset Text
1684 \begin_layout Plain Layout
1685 4th char.
1686 \end_layout
1688 \end_inset
1689 </cell>
1690 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1691 \begin_inset Text
1693 \begin_layout Plain Layout
1694 5th char.
1695 \end_layout
1697 \end_inset
1698 </cell>
1699 </row>
1700 <row>
1701 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1702 \begin_inset Text
1704 \begin_layout Plain Layout
1705 1 byte
1706 \end_layout
1708 \end_inset
1709 </cell>
1710 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1711 \begin_inset Text
1713 \begin_layout Plain Layout
1715 \end_layout
1717 \end_inset
1718 </cell>
1719 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1720 \begin_inset Text
1722 \begin_layout Plain Layout
1724 \end_layout
1726 \end_inset
1727 </cell>
1728 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1729 \begin_inset Text
1731 \begin_layout Plain Layout
1733 \end_layout
1735 \end_inset
1736 </cell>
1737 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1738 \begin_inset Text
1740 \begin_layout Plain Layout
1742 \end_layout
1744 \end_inset
1745 </cell>
1746 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1747 \begin_inset Text
1749 \begin_layout Plain Layout
1751 \end_layout
1753 \end_inset
1754 </cell>
1755 </row>
1756 <row>
1757 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1758 \begin_inset Text
1760 \begin_layout Plain Layout
1761 2 bytes
1762 \end_layout
1764 \end_inset
1765 </cell>
1766 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1767 \begin_inset Text
1769 \begin_layout Plain Layout
1771 \end_layout
1773 \end_inset
1774 </cell>
1775 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1776 \begin_inset Text
1778 \begin_layout Plain Layout
1780 \end_layout
1782 \end_inset
1783 </cell>
1784 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1785 \begin_inset Text
1787 \begin_layout Plain Layout
1789 \end_layout
1791 \end_inset
1792 </cell>
1793 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1794 \begin_inset Text
1796 \begin_layout Plain Layout
1798 \end_layout
1800 \end_inset
1801 </cell>
1802 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1803 \begin_inset Text
1805 \begin_layout Plain Layout
1807 \end_layout
1809 \end_inset
1810 </cell>
1811 </row>
1812 <row>
1813 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1814 \begin_inset Text
1816 \begin_layout Plain Layout
1817 3 bytes
1818 \end_layout
1820 \end_inset
1821 </cell>
1822 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1823 \begin_inset Text
1825 \begin_layout Plain Layout
1827 \end_layout
1829 \end_inset
1830 </cell>
1831 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1832 \begin_inset Text
1834 \begin_layout Plain Layout
1836 \end_layout
1838 \end_inset
1839 </cell>
1840 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1841 \begin_inset Text
1843 \begin_layout Plain Layout
1845 \end_layout
1847 \end_inset
1848 </cell>
1849 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1850 \begin_inset Text
1852 \begin_layout Plain Layout
1854 \end_layout
1856 \end_inset
1857 </cell>
1858 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1859 \begin_inset Text
1861 \begin_layout Plain Layout
1863 \end_layout
1865 \end_inset
1866 </cell>
1867 </row>
1868 <row>
1869 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1870 \begin_inset Text
1872 \begin_layout Plain Layout
1873 4 bytes
1874 \end_layout
1876 \end_inset
1877 </cell>
1878 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1879 \begin_inset Text
1881 \begin_layout Plain Layout
1883 \end_layout
1885 \end_inset
1886 </cell>
1887 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1888 \begin_inset Text
1890 \begin_layout Plain Layout
1892 \end_layout
1894 \end_inset
1895 </cell>
1896 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1897 \begin_inset Text
1899 \begin_layout Plain Layout
1901 \end_layout
1903 \end_inset
1904 </cell>
1905 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1906 \begin_inset Text
1908 \begin_layout Plain Layout
1910 \end_layout
1912 \end_inset
1913 </cell>
1914 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1915 \begin_inset Text
1917 \begin_layout Plain Layout
1919 \end_layout
1921 \end_inset
1922 </cell>
1923 </row>
1924 </lyxtabular>
1926 \end_inset
1929 \end_layout
1931 \begin_layout Standard
1932 Blocks which encode values greater than what is possible for value of that
1933  length are fatal errors.
1935 \end_layout
1937 \begin_layout Subsection
1938 Line component encoing
1939 \end_layout
1941 \begin_layout Standard
1942 Line component encoding sits on top of UTF-8 encoding.
1943  Line component encoding encodes non-empty 1-D array of non-empty strings
1944  into line, and thus array of those into member.
1945  Empty lines or lines that don't contain any components are ignored.
1946  Line starts with depth value of 0 and must end with depth value of zero.
1947 \end_layout
1949 \begin_layout Standard
1950 Components are seperated by component separators.
1951  Empty components are ignored.
1952  Following codepoints are separators on depth 0 if not escaped:
1953 \end_layout
1955 \begin_layout Itemize
1956 Codepoint of '('.
1957  The depth is read pre-increment.
1958 \end_layout
1960 \begin_layout Itemize
1961 Codepoint of ')'.
1962  The depth is read post-decrement.
1963 \end_layout
1965 \begin_layout Itemize
1966 Any SPACE character
1967 \end_layout
1969 \begin_layout Standard
1970 The following characters are special:
1971 \end_layout
1973 \begin_layout Itemize
1974 '('.
1975  Increments depth by 1 if not escaped (and appears in component).
1976 \end_layout
1978 \begin_layout Itemize
1979 ')'.
1980  Decrements depth by 1 if not escaped (and appears in component).
1981  Depth going negative is an error.
1982 \end_layout
1984 \begin_layout Itemize
1986 \backslash
1988  Next character is interpretted as literal.
1989  Error if at end of line.
1990 \end_layout
1992 \begin_layout Standard
1993 Otherwise, characters are interpretted as literals and appear in components.
1994  Depth must be zero at end of line.
1995 \end_layout
1997 \begin_layout Subsection
1998 Header section:
1999 \end_layout
2001 \begin_layout Standard
2002 Header section is in archive member "header".
2003  It uses line component encoding.
2004  The first component of each line is name of header, and subsequent ones
2005  are arguments.
2006  How many parameters are expected is dependent on what header it is:
2007 \end_layout
2009 \begin_layout Subsubsection
2010 PROJECTID header:
2011 \end_layout
2013 \begin_layout Itemize
2014 Header name: "PROJECTID"
2015 \end_layout
2017 \begin_layout Itemize
2018 Components: 2
2019 \end_layout
2021 \begin_layout Itemize
2022 Argument #1: <project-id-string>
2023 \end_layout
2025 \begin_layout Itemize
2026 Mandatory: Yes
2027 \end_layout
2029 \begin_layout Standard
2030 Gives project ID.
2031  Project ID is generated when PC is assembled and is then preserved in save
2032  states.
2033  It is used for computing rerecord counts.
2034  Emulator treats it as opaque string, the IDs it generates are formed by
2035  48 random hexadecimal digits.
2036 \end_layout
2038 \begin_layout Subsubsection
2039 SAVESTATEID header:
2040 \end_layout
2042 \begin_layout Itemize
2043 Header name: "SAVESTATEID"
2044 \end_layout
2046 \begin_layout Itemize
2047 Components: 2
2048 \end_layout
2050 \begin_layout Itemize
2051 Argument #1: <savestate-id-string>
2052 \end_layout
2054 \begin_layout Itemize
2055 Mandatory: No
2056 \end_layout
2058 \begin_layout Standard
2059 Gives save state ID.
2060  Each save state has its own save state ID.
2061  Treated as opaque string, but generated as 48 random hexadecimal digits.
2062  The presence of this header signals whether there is save state to be loaded.
2063  If this header is present, save state load will be attempted.
2064  If absent, save state is not to be loaded even if present (and correct
2065  savestate load would be technically impossible anyway).
2066 \end_layout
2068 \begin_layout Standard
2069 The value is used to prevent loading incompatible save states in preserve
2070  event stream mode and also to find the point in event stream where one
2071  left off.
2072 \end_layout
2074 \begin_layout Subsubsection
2075 RERECORDS header:
2076 \end_layout
2078 \begin_layout Itemize
2079 Header name: "RERECORDS"
2080 \end_layout
2082 \begin_layout Itemize
2083 Components: 2
2084 \end_layout
2086 \begin_layout Itemize
2087 Argument #1: <rerecords>
2088 \end_layout
2090 \begin_layout Itemize
2091 Mandatory: Yes
2092 \end_layout
2094 \begin_layout Standard
2095 Gives rerecord count.
2096  PC assembly (except when loading save state) initializes current rerecord
2097  count to zero.
2098  Must be non-negative and decimal number using ASCII digit characters.
2099 \end_layout
2101 \begin_layout LyX-Code
2102 On loading save state:
2103 \end_layout
2105 \begin_layout LyX-Code
2106 1) If project ID matches with previous:
2107 \end_layout
2109 \begin_layout LyX-Code
2110 1a) If loaded rerecord count is larger or equal to current rerecord count:
2111 \end_layout
2113 \begin_layout LyX-Code
2114 1a-a) Current rerecord count is loaded rerecord count + 1.
2115 \end_layout
2117 \begin_layout LyX-Code
2118 1b) Otherwise
2119 \end_layout
2121 \begin_layout LyX-Code
2122 1b-a) Current rerecord count increments by 1.
2123 \end_layout
2125 \begin_layout LyX-Code
2126 2) Otherwise
2127 \end_layout
2129 \begin_layout LyX-Code
2130 2a) Current rerecord count is loaded rerecord count + 1.
2131 \end_layout
2133 \begin_layout Standard
2134 The current rerecord count at time of save is saved to save state.
2135 \end_layout
2137 \begin_layout Subsubsection
2138 SYSTEM header:
2139 \end_layout
2141 \begin_layout Itemize
2142 Header name: "SYSTEM"
2143 \end_layout
2145 \begin_layout Itemize
2146 Components: 2
2147 \end_layout
2149 \begin_layout Itemize
2150 Argument #1: <system-id-string>
2151 \end_layout
2153 \begin_layout Itemize
2154 Mandatory: No
2155 \end_layout
2157 \begin_layout Standard
2158 Gives system this movie/save is for.
2159  The only currently recognized values are 
2160 \begin_inset Quotes eld
2161 \end_inset
2163 PC-JPC-RR-r10
2164 \begin_inset Quotes erd
2165 \end_inset
2167  and 
2168 \begin_inset Quotes eld
2169 \end_inset
2171 PC-JPC-RR-r11.3
2172 \begin_inset Quotes erd
2173 \end_inset
2175  (if this header is absent, use default system).
2176  Invalid values trigger error on load time.
2177  The 
2178 \begin_inset Quotes eld
2179 \end_inset
2181 PC-JPC-RR-r11.3
2182 \begin_inset Quotes erd
2183 \end_inset
2185  should be used if INITIALSTATE headers are present to avoid earlier versions
2186  from getting confused by those.
2187 \end_layout
2189 \begin_layout Subsubsection
2190 AUTHORS header:
2191 \end_layout
2193 \begin_layout Itemize
2194 Header name: "AUTHORS"
2195 \end_layout
2197 \begin_layout Itemize
2198 Components: 2 or more
2199 \end_layout
2201 \begin_layout Itemize
2202 Arguments: free form
2203 \end_layout
2205 \begin_layout Itemize
2206 Mandatory: No
2207 \end_layout
2209 \begin_layout Standard
2210 Gives authors of run.
2211  Each argument gives one author (who has full name but no nickname).
2212  May be present multiple times.
2213 \end_layout
2215 \begin_layout Subsubsection
2216 AUTHORNICKS header:
2217 \end_layout
2219 \begin_layout Itemize
2220 Header name: "AUTHORNICKS"
2221 \end_layout
2223 \begin_layout Itemize
2224 Components: 2 or more
2225 \end_layout
2227 \begin_layout Itemize
2228 Arguments: free form
2229 \end_layout
2231 \begin_layout Itemize
2232 Mandatory: No
2233 \end_layout
2235 \begin_layout Standard
2236 Gives authors of run.
2237  Each argument gives one author (who has nickname but no full name).
2238  May be present multiple times.
2239 \end_layout
2241 \begin_layout Subsubsection
2242 AUTHORFULL header:
2243 \end_layout
2245 \begin_layout Itemize
2246 Header name: "AUTHORFULL"
2247 \end_layout
2249 \begin_layout Itemize
2250 Components: 3
2251 \end_layout
2253 \begin_layout Itemize
2254 Arguments: free form
2255 \end_layout
2257 \begin_layout Itemize
2258 Mandatory: No
2259 \end_layout
2261 \begin_layout Standard
2262 Gives author of run.
2263  First argument is full name of author, and second is nickname of author.
2264  May be present multiple times.
2265 \end_layout
2267 \begin_layout Subsubsection
2268 COMMENT header:
2269 \end_layout
2271 \begin_layout Itemize
2272 Header name: "COMMENT"
2273 \end_layout
2275 \begin_layout Itemize
2276 Components: 2 or more
2277 \end_layout
2279 \begin_layout Itemize
2280 Arguments: free form
2281 \end_layout
2283 \begin_layout Itemize
2284 Mandatory: No
2285 \end_layout
2287 \begin_layout Standard
2288 Various kinds of free form data.
2289  Not parsed further by emulator.
2290 \end_layout
2292 \begin_layout Subsubsection
2293 INITIALSTATE header:
2294 \end_layout
2296 \begin_layout Itemize
2297 Header name: "INITIALSTATE"
2298 \end_layout
2300 \begin_layout Itemize
2301 Components: 2 or more
2302 \end_layout
2304 \begin_layout Itemize
2305 Arguments: Name of initial state
2306 \end_layout
2308 \begin_layout Itemize
2309 Mandatory: No
2310 \end_layout
2312 \begin_layout Standard
2313 Denotes that 
2314 \begin_inset Quotes eld
2315 \end_inset
2317 initialization-
2318 \begin_inset Quotes erd
2319 \end_inset
2321 <name> is valid initial state.
2322 \end_layout
2324 \begin_layout Subsection
2325 Initialization segment:
2326 \end_layout
2328 \begin_layout Standard
2329 If SAVESTATEID header isn't present (not a save state), member "initialization"
2330  (or 
2331 \begin_inset Quotes eld
2332 \end_inset
2334 initialization-
2335 \begin_inset Quotes erd
2336 \end_inset
2338 <name>) gives PC initialization parameters for assembling the PC.
2339  It is present anyway even if SAVESTATEID is present (savestate).
2340 \end_layout
2342 \begin_layout Standard
2343 Following parameters are used (space separates components):
2344 \end_layout
2346 \begin_layout LyX-Code
2347 "BIOS" <id>
2348 \end_layout
2350 \begin_layout Standard
2351 Gives Image ID of main system BIOS (mandatory)
2352 \end_layout
2354 \begin_layout LyX-Code
2355 "VGABIOS" <id>
2356 \end_layout
2358 \begin_layout Standard
2359 Gives Image ID of VGA BIOS (mandatory).
2360 \end_layout
2362 \begin_layout LyX-Code
2363 "HDA" <id>
2364 \end_layout
2366 \begin_layout Standard
2367 Gives Image ID of hda.
2368  Present only if system has hard disk hda.
2369 \end_layout
2371 \begin_layout LyX-Code
2372 "HDB" <id>
2373 \end_layout
2375 \begin_layout Standard
2376 Gives Image ID of hdb.
2377  Present only if system has hard disk hdb.
2378 \end_layout
2380 \begin_layout LyX-Code
2381 "HDC" <id>
2382 \end_layout
2384 \begin_layout Standard
2385 Gives Image ID of hdc.
2386  Present only if system has hard disk hdc.
2387 \end_layout
2389 \begin_layout LyX-Code
2390 "HDD" <id>
2391 \end_layout
2393 \begin_layout Standard
2394 Gives Image ID of hdd.
2395  Present only if system has hard disk hdd.
2396 \end_layout
2398 \begin_layout LyX-Code
2399 "DISK" <num> <id>
2400 \end_layout
2402 \begin_layout Standard
2403 Gives Image ID of disk in slot <num>.
2404  Slot number must be non-negative.
2405 \end_layout
2407 \begin_layout LyX-Code
2408 \begin_inset Quotes eld
2409 \end_inset
2411 DISKNAME
2412 \begin_inset Quotes erd
2413 \end_inset
2415  <num> <name>
2416 \end_layout
2418 \begin_layout Standard
2419 kGives image name of disk in slot <num>.
2420  Slot number must be non-negative.
2421  The slot must be previously declared using 
2422 \begin_inset Quotes eld
2423 \end_inset
2425 DISK
2426 \begin_inset Quotes erd
2427 \end_inset
2430 \end_layout
2432 \begin_layout LyX-Code
2433 "FDA" <num>
2434 \end_layout
2436 \begin_layout Standard
2437 Gives Image slot to initially put into floppy drive fda.
2438  Disk must be of floppy type.
2439  If none present, no disk is initially put there.
2440 \end_layout
2442 \begin_layout LyX-Code
2443 "FDB" <num>
2444 \end_layout
2446 \begin_layout Standard
2447 Gives Image slot to initially put into floppy drive fdb.
2448  Disk must be of floppy type.
2449  If none present, no disk is initially put there.
2450 \end_layout
2452 \begin_layout LyX-Code
2453 "CDROM" <num>
2454 \end_layout
2456 \begin_layout Standard
2457 Gives Image slot to initially put into CD-ROM drive hdc.
2458  Not allowed if hard disk hdc is present.
2459  Disk must be of CD-ROM type.
2460  If none present no disk is initially put there.
2461 \end_layout
2463 \begin_layout LyX-Code
2464 "INITIALTIME" <time>
2465 \end_layout
2467 \begin_layout Standard
2468 Number of milliseconds since Unix epoch to system start up time.
2469  Allowed range:
2470 \end_layout
2472 \begin_layout Standard
2473 0-4102444799999.
2474  Mandatory.
2475 \end_layout
2477 \begin_layout LyX-Code
2478 "CPUDIVIDER" <divider>
2479 \end_layout
2481 \begin_layout Standard
2482 Set CPU frequency divider (dividing the 1GHz master clock).
2483  Allowed range is 1-256.
2484  Mandatory.
2485 \end_layout
2487 \begin_layout LyX-Code
2488 "MEMORYSIZE" <pages>
2489 \end_layout
2491 \begin_layout Standard
2492 Number of 4KiB pages of RAM memory.
2493  Allowed range 256-262144.
2494  Mandatory.
2495 \end_layout
2497 \begin_layout LyX-Code
2498 "BOOT" <device>
2499 \end_layout
2501 \begin_layout Standard
2502 Set boot device.
2503  Valid devices are "FLOPPY" (boot from fda), "HDD" (boot from hda) and "CDROM"
2504  (boot from CD).
2505 \end_layout
2507 \begin_layout LyX-Code
2508 "LOADMODULEA" <module> <parameters>
2509 \end_layout
2511 \begin_layout Standard
2512 Load module <module> with parameters <parameters>.
2513 \end_layout
2515 \begin_layout LyX-Code
2516 "LOADMODULE" <module>
2517 \end_layout
2519 \begin_layout Standard
2520 Load module <module> with no parameters
2521 \end_layout
2523 \begin_layout LyX-Code
2524 \begin_inset Quotes eld
2525 \end_inset
2528 \begin_inset Quotes erd
2529 \end_inset
2531  <fpu>
2532 \end_layout
2534 \begin_layout Standard
2535 Use class <fpu> as FPU emulator.
2536 \end_layout
2538 \begin_layout LyX-Code
2539 \begin_inset Quotes eld
2540 \end_inset
2542 IOPORTDELAY
2543 \begin_inset Quotes erd
2544 \end_inset
2547 \end_layout
2549 \begin_layout Standard
2550 Use I/O port delay emulation (each I/O port read/write takes 666ns).
2551 \end_layout
2553 \begin_layout LyX-Code
2554 \begin_inset Quotes eld
2555 \end_inset
2557 VGAHRETRACE
2558 \begin_inset Quotes erd
2559 \end_inset
2562 \end_layout
2564 \begin_layout Standard
2565 Emulate VGA horizontal retrace.
2566 \end_layout
2568 \begin_layout Subsection
2569 Event record format:
2570 \end_layout
2572 \begin_layout Standard
2573 Event record is in archive member "events".
2574  It uses line component encoding.
2575  Each line gives an event.
2576  First component of each line gives time stamp.
2577  These timestamps MUST be in increasing order and all MUST be non-negative.
2578  Time stamp time unit is exactly 1 nanosecond of emulated time.
2579 \end_layout
2581 \begin_layout Standard
2582 The second component of each line is name of class to dispatch to.
2583  Further components are passed as-is to event handlers.
2584  Classes with names consisting only of uppercase A-Z and 0-9 are special
2585  and reserved.
2586  It is error to encounter unknown such special class.
2587 \end_layout
2589 \begin_layout Subsubsection
2590 Savestate event
2591 \end_layout
2593 \begin_layout Itemize
2594 Dispatch to: SAVESTATE
2595 \end_layout
2597 \begin_layout Itemize
2598 Argument #1: Savestate id
2599 \end_layout
2601 \begin_layout Itemize
2602 Argument #2 (optional): Rerecord count at time of saving savestate
2603 \end_layout
2605 \begin_layout Standard
2606 Signals that savestate has occured here.
2607  The save state IDs MUST be unique in entire event stream.
2608  The second argument to savestate (if present) is rerecord count at time
2609  of saving that savestate (useful for calulating rerecord count of movie
2610  starting from savestate).
2611  No time restrictions
2612 \end_layout
2614 \begin_layout Subsubsection
2615 Option event
2616 \end_layout
2618 \begin_layout Itemize
2619 Dispatch to: OPTION
2620 \end_layout
2622 \begin_layout Itemize
2623 Argument #1: 
2624 \begin_inset Quotes eld
2625 \end_inset
2627 ABSOLUTE
2628 \begin_inset Quotes erd
2629 \end_inset
2631  or 
2632 \begin_inset Quotes eld
2633 \end_inset
2635 RELATIVE
2636 \begin_inset Quotes erd
2637 \end_inset
2640 \end_layout
2642 \begin_layout Standard
2643 Controls various options.
2645 \begin_inset Quotes eld
2646 \end_inset
2648 ABSOLUTE
2649 \begin_inset Quotes erd
2650 \end_inset
2652  turns on absolute mode (default) where event timestamps are absolute.
2654 \begin_inset Quotes eld
2655 \end_inset
2657 RELATIVE
2658 \begin_inset Quotes erd
2659 \end_inset
2661  turns on relative mode where event timestamps are relative to last event
2662  in stream.
2663  The OPTION event itself is not affected by timing change.
2664  No time restrictions.
2665  Unknown arguments are errors.
2666 \end_layout
2668 \begin_layout Subsubsection
2669 Keyboard keypress/keyrelease event:
2670 \end_layout
2672 \begin_layout Itemize
2673 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2674 \end_layout
2676 \begin_layout Itemize
2677 Argument #1: Fixed: "KEYEDGE"
2678 \end_layout
2680 \begin_layout Itemize
2681 Argument #2: Key number.
2682  Valid values are 1-83, 85-95, 129-197 and 199-223
2683 \end_layout
2685 \begin_layout Standard
2686 Send key press or key release.
2687  Keys work in toggle button manner.
2688  The event time must be multiple of 66 666, and must not be less than 60
2689  * 66 666 TUs after last PAUSE event, 20 * 66 666 TUs after last KEYEDGE
2690  on key >128 and 10 * 66 666 TUs after last KEYEDGE on key <128.
2691 \end_layout
2693 \begin_layout Subsubsection
2694 Pause event:
2695 \end_layout
2697 \begin_layout Itemize
2698 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2699 \end_layout
2701 \begin_layout Itemize
2702 Argument #1: Fixed: "PAUSE"
2703 \end_layout
2705 \begin_layout Standard
2706 Send pause key event.
2707  The time restrictions are identical to KEYEDGE event.
2708 \end_layout
2710 \begin_layout Subsubsection
2711 Mouse button event:
2712 \end_layout
2714 \begin_layout Itemize
2715 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2716 \end_layout
2718 \begin_layout Itemize
2719 Argument #1: Fixed: "MOUSEBUTTON"
2720 \end_layout
2722 \begin_layout Itemize
2723 Argument #2: Number of button to release or press (0-4)
2724 \end_layout
2726 \begin_layout Standard
2727 Presses or releases the designated mouse button.
2728 \end_layout
2730 \begin_layout Subsubsection
2731 X mouse motion event:
2732 \end_layout
2734 \begin_layout Itemize
2735 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2736 \end_layout
2738 \begin_layout Itemize
2739 Argument #1: Fixed: "XMOUSEMOTION"
2740 \end_layout
2742 \begin_layout Itemize
2743 Argument #2: Number of units to move (-255 - 255)
2744 \end_layout
2746 \begin_layout Standard
2747 Move the mouse in X direction by specified amount.
2748  Positive is right.
2749 \end_layout
2751 \begin_layout Subsubsection
2752 Y mouse motion event:
2753 \end_layout
2755 \begin_layout Itemize
2756 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2757 \end_layout
2759 \begin_layout Itemize
2760 Argument #1: Fixed: "YMOUSEMOTION"
2761 \end_layout
2763 \begin_layout Itemize
2764 Argument #2: Number of units to move (-255 - 255)
2765 \end_layout
2767 \begin_layout Standard
2768 Move the mouse in Y direction by specified amount.
2769  Positive is up.
2770 \end_layout
2772 \begin_layout Subsubsection
2773 Z mouse motion event:
2774 \end_layout
2776 \begin_layout Itemize
2777 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2778 \end_layout
2780 \begin_layout Itemize
2781 Argument #1: Fixed: "ZMOUSEMOTION"
2782 \end_layout
2784 \begin_layout Itemize
2785 Argument #2: Number of units to move (-7 - 7)
2786 \end_layout
2788 \begin_layout Standard
2789 Move the mouse in Z direction (scrollwheel) by specified amount.
2790 \end_layout
2792 \begin_layout Subsubsection
2793 Joystick button event:
2794 \end_layout
2796 \begin_layout Itemize
2797 Dispatch to: org.jpc.modules.Joystick
2798 \end_layout
2800 \begin_layout Itemize
2801 Argument #1: 
2802 \begin_inset Quotes eld
2803 \end_inset
2805 BUTTONA
2806 \begin_inset Quotes erd
2807 \end_inset
2810 \begin_inset Quotes eld
2811 \end_inset
2813 BUTTONB
2814 \begin_inset Quotes erd
2815 \end_inset
2818 \begin_inset Quotes eld
2819 \end_inset
2821 BUTTONC
2822 \begin_inset Quotes erd
2823 \end_inset
2825  or 
2826 \begin_inset Quotes eld
2827 \end_inset
2829 BUTTOND
2830 \begin_inset Quotes erd
2831 \end_inset
2834 \end_layout
2836 \begin_layout Itemize
2837 Argument #2: 
2838 \begin_inset Quotes eld
2839 \end_inset
2842 \begin_inset Quotes erd
2843 \end_inset
2845  if released, 
2846 \begin_inset Quotes eld
2847 \end_inset
2850 \begin_inset Quotes erd
2851 \end_inset
2853  if pressed
2854 \end_layout
2856 \begin_layout Standard
2857 Send button down/up event.
2858  No time restrictions.
2859 \end_layout
2861 \begin_layout Subsubsection
2862 Joystick axis event:
2863 \end_layout
2865 \begin_layout Itemize
2866 Dispatch to: org.jpc.modules.Joystick
2867 \end_layout
2869 \begin_layout Itemize
2870 Argument #1: 
2871 \begin_inset Quotes eld
2872 \end_inset
2874 AXISA
2875 \begin_inset Quotes erd
2876 \end_inset
2879 \begin_inset Quotes eld
2880 \end_inset
2882 AXISB
2883 \begin_inset Quotes erd
2884 \end_inset
2887 \begin_inset Quotes eld
2888 \end_inset
2890 AXISC
2891 \begin_inset Quotes erd
2892 \end_inset
2894  or 
2895 \begin_inset Quotes eld
2896 \end_inset
2898 AXISD
2899 \begin_inset Quotes erd
2900 \end_inset
2903 \end_layout
2905 \begin_layout Itemize
2906 Argument #2: Multivibrator unstable state length in ns.
2907 \end_layout
2909 \begin_layout Standard
2910 Set amount of time multivibrator remains in unstable state.
2911  No time restrictions.
2912 \end_layout
2914 \begin_layout Subsubsection
2915 Reboot:
2916 \end_layout
2918 \begin_layout Itemize
2919 Dispatch to: org.jpc.emulator.PC$ResetButton
2920 \end_layout
2922 \begin_layout Itemize
2923 No arguments
2924 \end_layout
2926 \begin_layout Standard
2927 Reboots the PC.
2928 \end_layout
2930 \begin_layout Subsubsection
2931 Fda disk change:
2932 \end_layout
2934 \begin_layout Itemize
2935 Dispatch to: org.jpc.emulator.PC$DiskChanger
2936 \end_layout
2938 \begin_layout Itemize
2939 Argument #1: Fixed: "FDA"
2940 \end_layout
2942 \begin_layout Itemize
2943 Argument #2: Number of image slot to put there.
2945 \end_layout
2947 \begin_layout Standard
2948 The disk number MUST be -1 or valid disk number.
2949  -1 MUST NOT be used if there is no disk in floppy drive A.
2950  This event causes specified disk to be placed to FDA or FDA disk to be
2951  ejected with no replacement if disk number is -1.
2952  The specified disk if not -1 must be of floppy type.
2953  The specified disk if valid must not be in any other drive.
2954 \end_layout
2956 \begin_layout Subsubsection
2957 Fdb disk change:
2958 \end_layout
2960 \begin_layout Itemize
2961 Dispatch to: org.jpc.emulator.PC$DiskChanger
2962 \end_layout
2964 \begin_layout Itemize
2965 Argument #1: Fixed: "FDB"
2966 \end_layout
2968 \begin_layout Itemize
2969 Argument #2: Number of image slot to put there.
2971 \end_layout
2973 \begin_layout Standard
2974 The disk number MUST be -1 or valid disk number.
2975  -1 MUST NOT be used if there is no disk in floppy drive B.
2976  This event causes specified disk to be placed to FDB or FDB disk to be
2977  ejected with no replacement if disk number is -1.
2978  The specified disk if not -1 must be of floppy type.
2979  The specified disk if valid must not be in any other drive.
2980 \end_layout
2982 \begin_layout Subsubsection
2983 Change CDROM:
2984 \end_layout
2986 \begin_layout Itemize
2987 Dispatch to: org.jpc.emulator.PC$DiskChanger
2988 \end_layout
2990 \begin_layout Itemize
2991 Argument #1: Fixed: "CDROM"
2992 \end_layout
2994 \begin_layout Itemize
2995 Argument #2: Number of image slot to put there.
2997 \end_layout
2999 \begin_layout Standard
3000 The disk number MUST be -1 or valid disk number.
3001  -1 MUST NOT be used if there is no disk in CD-ROM.
3002  This event causes specified disk to be placed to CD-ROM or CD-ROM disk
3003  to be ejected with no replacement if disk number is -1.
3004  The specified disk if not -1 must be of CD-ROM type.
3005 \end_layout
3007 \begin_layout Standard
3008 This event has no effect if CD-ROM is locked.
3009 \end_layout
3011 \begin_layout Subsubsection
3012 Write protect floppy:
3013 \end_layout
3015 \begin_layout Itemize
3016 Dispatch to: org.jpc.emulator.PC$DiskChanger
3017 \end_layout
3019 \begin_layout Itemize
3020 Argument #1: Fixed: "WRITEPROTECT"
3021 \end_layout
3023 \begin_layout Itemize
3024 Argument #2: Number of image slot to manipulate 
3025 \end_layout
3027 \begin_layout Standard
3028 Write protects specified disk.
3029  The disk MUST NOT be in any drive and MUST be valid floppy-type disk.
3030 \end_layout
3032 \begin_layout Subsubsection
3033 Write unprotect floppy:
3034 \end_layout
3036 \begin_layout Itemize
3037 Dispatch to: org.jpc.emulator.PC$DiskChanger
3038 \end_layout
3040 \begin_layout Itemize
3041 Argument #1: Fixed: "WRITEUNPROTECT"
3042 \end_layout
3044 \begin_layout Itemize
3045 Argument #2: Number of image slot to manipulate 
3046 \end_layout
3048 \begin_layout Standard
3049 Disables write protection specified disk.
3050  The disk MUST NOT be in any drive and MUST be valid floppy-type disk.
3051 \end_layout
3053 \begin_layout Subsection
3054 Diskinfo sections
3055 \end_layout
3057 \begin_layout Standard
3058 Diskinfo sections are named 
3059 \begin_inset Quotes eld
3060 \end_inset
3062 diskinfo-
3063 \begin_inset Quotes erd
3064 \end_inset
3066 <id of disk>.
3067  They use line component encoding, fieldtype being first component on each
3068  line (value being the second).
3069  Following fields are defined:
3070 \end_layout
3072 \begin_layout Subsubsection
3073 TYPE
3074 \end_layout
3076 \begin_layout Standard
3077 Gives type of image.
3078  Possible values are
3079 \end_layout
3081 \begin_layout Itemize
3082 \begin_inset Quotes eld
3083 \end_inset
3085 FLOPPY
3086 \begin_inset Quotes erd
3087 \end_inset
3089  (floppy disk)
3090 \end_layout
3092 \begin_layout Itemize
3093 \begin_inset Quotes eld
3094 \end_inset
3097 \begin_inset Quotes erd
3098 \end_inset
3100  (Hard disk)
3101 \end_layout
3103 \begin_layout Itemize
3104 \begin_inset Quotes eld
3105 \end_inset
3107 CDROM
3108 \begin_inset Quotes erd
3109 \end_inset
3111  (CD-ROM)
3112 \end_layout
3114 \begin_layout Itemize
3115 \begin_inset Quotes eld
3116 \end_inset
3118 BIOS
3119 \begin_inset Quotes erd
3120 \end_inset
3122  (BIOS/VGABIOS image)
3123 \end_layout
3125 \begin_layout Itemize
3126 \begin_inset Quotes eld
3127 \end_inset
3129 UNKNOWN
3130 \begin_inset Quotes erd
3131 \end_inset
3133  (what the heck is this???)
3134 \end_layout
3136 \begin_layout Subsubsection
3138 \end_layout
3140 \begin_layout Standard
3141 Gives ID of disk.
3142 \end_layout
3144 \begin_layout Subsubsection
3145 IMAGELENGTH
3146 \end_layout
3148 \begin_layout Standard
3149 (BIOS images only) Gives length of BIOS image
3150 \end_layout
3152 \begin_layout Subsubsection
3153 IMAGEMD5
3154 \end_layout
3156 \begin_layout Standard
3157 MD5 of raw disk/BIOS image without any headers or trailers.
3158 \end_layout
3160 \begin_layout Subsubsection
3161 TOTALSECTORS
3162 \end_layout
3164 \begin_layout Standard
3165 (FLOPPY/HDD/CDROM images only) Number of total sectors on disk.
3166 \end_layout
3168 \begin_layout Subsubsection
3169 TRACKS
3170 \end_layout
3172 \begin_layout Standard
3173 (FLOPPY/HDD images only) Number of tracks on disk per side (1-256 for floppy,
3174  1-1024 for HDD).
3175 \end_layout
3177 \begin_layout Subsubsection
3178 SIDES
3179 \end_layout
3181 \begin_layout Standard
3182 (FLOPPY/HDD images only) Number of sides on disk (1 or 2 for floppy, 1-16
3183  for HDD).
3184 \end_layout
3186 \begin_layout Subsubsection
3187 SECTORS
3188 \end_layout
3190 \begin_layout Standard
3191 (FLOPPY/HDD images only) Number of sectors per track (1-255 for floppy,
3192  1-63 for HDD).
3193 \end_layout
3195 \begin_layout Subsubsection
3196 COMMENT
3197 \end_layout
3199 \begin_layout Standard
3200 Line from image comment block.
3201  Usually give data about files image has.
3202  May or may not be present (multiple times)
3203 \end_layout
3205 \begin_layout Subsection
3206 Output info
3207 \end_layout
3209 \begin_layout Standard
3210 Output info is stored in section 
3211 \begin_inset Quotes eld
3212 \end_inset
3214 output-info
3215 \begin_inset Quotes erd
3216 \end_inset
3219  Its relatively new, so it might not be present (then the contents have
3220  to be guessed based on modules present).
3221  Each line gives information about one output, first field being the type
3222  of output.
3223 \end_layout
3225 \begin_layout Subsubsection
3226 Video output
3227 \end_layout
3229 \begin_layout Standard
3230 For video output, there are no parameters so line is just 
3231 \begin_inset Quotes eld
3232 \end_inset
3234 VIDEO
3235 \begin_inset Quotes erd
3236 \end_inset
3238  (one component).
3239 \end_layout
3241 \begin_layout Subsubsection
3242 Audio output
3243 \end_layout
3245 \begin_layout Standard
3246 For audio output, the only parameter is name of output, so first component
3247  is 
3248 \begin_inset Quotes eld
3249 \end_inset
3251 AUDIO
3252 \begin_inset Quotes erd
3253 \end_inset
3255  and second component is name of audio output.
3256 \end_layout
3258 \begin_layout Subsection
3259 Savestates
3260 \end_layout
3262 \begin_layout Standard
3263 Actual savestate format is not documented here.
3264  It is close to impossible to comprehend without access to emulator source
3265  anyway.
3266 \end_layout
3268 \begin_layout Section
3269 Advanced: Making class dumpable
3270 \end_layout
3272 \begin_layout Standard
3273 Class is made dumpable by implementing interface org.jpc.emulator.SRDumpable
3274  and implementing method dumpSRPartial(org.jpc.emulator.SRDumper) and constructor
3275  <init>(org.jpc.emulator.SRLoader).
3276  Non-static inner classes can not be dumpable (make them static using tricks
3277  similar to what javac uses).
3278 \end_layout
3280 \begin_layout Standard
3281 If dumped class has dumpable superclass, the first thing dumping function
3282  needs to do is to call dumper function of superclass and first thing loading
3283  constructor needs to do is to call loading constructor of superclass.
3284  If class has no dumpable superclass, dumper doesn't need to do anything
3285  special, while loader needs to call objectCreated(this) on SRLoader object
3286  passed as parameter.
3288 \end_layout
3290 \begin_layout Standard
3291 Following these fixed parts, dump all members that are part of mutable state
3292  in emulator core.
3293 \end_layout
3295 \begin_layout Subsection
3296 Member dumping/loading functions
3297 \end_layout
3299 \begin_layout Standard
3300 There is dumping/loading function for following (all functions dumping/loading
3301  reference types can handle null):
3302 \end_layout
3304 \begin_layout Itemize
3305 boolean: SRDumper.dumpBoolean, SRLoader.loadBoolean
3306 \end_layout
3308 \begin_layout Itemize
3309 byte: SRDumper.dumpByte, SRLoader.loadByte
3310 \end_layout
3312 \begin_layout Itemize
3313 short: SRDumper.dumpShort, SRLoader.loadShort
3314 \end_layout
3316 \begin_layout Itemize
3317 int: SRDumper.dumpInt, SRLoader.loadInt
3318 \end_layout
3320 \begin_layout Itemize
3321 long: SRDumper.dumpLong, SRLoader.loadLong
3322 \end_layout
3324 \begin_layout Itemize
3325 String: SRDumper.dumpString, SRLoader.loadString
3326 \end_layout
3328 \begin_layout Itemize
3329 boolean[]: SRDumper.dumpArray, SRLoader.loadArrayBoolean
3330 \end_layout
3332 \begin_layout Itemize
3333 byte[]: SRDumper.dumpArray, SRLoader.loadArrayByte
3334 \end_layout
3336 \begin_layout Itemize
3337 short[]: SRDumper.dumpArray, SRLoader.loadArrayShort
3338 \end_layout
3340 \begin_layout Itemize
3341 int[]: SRDumper.dumpArray, SRLoader.loadArrayInt
3342 \end_layout
3344 \begin_layout Itemize
3345 long[]: SRDumper.dumpArray, SRLoader.loadArrayLong
3346 \end_layout
3348 \begin_layout Itemize
3349 double[]: SRDumper.dumpArray, SRLoader.loadArrayDouble
3350 \end_layout
3352 \begin_layout Itemize
3353 <dumpable type>: SRDumper.dumpObject, SRLoader.loadObject
3354 \end_layout
3356 \begin_layout Itemize
3357 special object: SRDumper.specialObject, SRLoader.specialObject
3358 \end_layout
3360 \begin_layout Subsubsection
3361 Notes:
3362 \end_layout
3364 \begin_layout Itemize
3365 Dumpable objects come out as type of org.jpc.emulator.SRDumpable.
3366 \end_layout
3368 \begin_layout Itemize
3369 Special objects are various static objects that don't need to be stored
3370  because they don't have mutable fields.
3371 \end_layout
3373 \begin_layout Itemize
3374 Don't dump fields related to event state feedback.
3375 \end_layout
3377 \begin_layout Itemize
3378 Don't dump temporary flags that are only used while PC is running.
3379  Savestate when PC is running isn't possible anyway.
3380 \end_layout
3382 \begin_layout Itemize
3383 Some connectors dump fields related to connector output, some don't.
3384 \end_layout
3386 \begin_layout Section
3387 Advanced: Writing event targets
3388 \end_layout
3390 \begin_layout Standard
3391 Whereas output connectors are the way output is dispatched, input is dispatched
3392  via event targets.
3393  Event targets need to implement interface org.jpc.emulator.EventDispatchTarget.
3394 \end_layout
3396 \begin_layout Standard
3397 Event targets also provode methods which then encode events and dispatch
3398  them forward (without doing anything else) to event recorder.
3399  Also, event targets may have methods for obtaining state.
3400 \end_layout
3402 \begin_layout Subsection
3403 Interface org.jpc.emulator.EventDispatchTarget
3404 \end_layout
3406 \begin_layout Standard
3407 Interface that marks class capable of receiving events.
3408 \end_layout
3410 \begin_layout Subsubsection
3411 Method setEventRecorder(EventRecorder)
3412 \end_layout
3414 \begin_layout Standard
3415 Set the event recorder input events are sent to.
3416 \end_layout
3418 \begin_layout Subsubsection
3419 Method startEventCheck()
3420 \end_layout
3422 \begin_layout Standard
3423 Signals target to reset all state related to event checking and state feedback.
3424  This may be called at any time in order to reinitialialize event checking/feedb
3425 ack state.
3426 \end_layout
3428 \begin_layout Subsubsection
3429 Method doEvent(long, String[], int) throws IOException
3430 \end_layout
3432 \begin_layout Standard
3433 Event dispatch handler.
3434  The first argument is event time, second is parameters and third is what
3435  to do with it.
3436  If target doesn't like the event, throw IOException.
3437  Following types (the integer parameter) are used:
3438 \end_layout
3440 \begin_layout LyX-Code
3441 0 (EventRecorder.EVENT_TIMED): Time has been assigned for event.
3442 \end_layout
3444 \begin_layout LyX-Code
3445 1 (EventRecorder.EVENT_STATE_EFFECT_FUTURE): Future event in event replay
3446  for reinitialization
3447 \end_layout
3449 \begin_layout LyX-Code
3450 2 (EventRecorder.EVENT_STATE_EFFECT): Past event in event replay reinitialization
3451 \end_layout
3453 \begin_layout LyX-Code
3454 3 (EventRecorder.EVENT_EXECUTE): This event occurs now.
3455  Execute the effect.
3456 \end_layout
3458 \begin_layout Subsubsection
3459 Method endEventCheock()
3460 \end_layout
3462 \begin_layout Standard
3463 End event reinitialization.
3464  Usually unused.
3465 \end_layout
3467 \begin_layout Subsubsection
3468 Method getEventTimeLowBound(long, String[]) throws IOException
3469 \end_layout
3471 \begin_layout Standard
3472 Return the time value that's the earliest possiblity for this event to occur.
3473  Returning any time in past (including -1) causes event to fire as soon
3474  as possible.
3475  The long parameter gives the current scheduled time for event.
3476 \end_layout
3478 \begin_layout Section
3479 Writing modules
3480 \end_layout
3482 \begin_layout Standard
3483 Modules are various extensions that run inside emulator core.
3484  As such, they affect sync.
3485  Modules must implement interface org.jpc.emulator.HardwareComponent (they
3486  are hardware components) and must be dumpable.
3487  Additionally, they need either constructor <init>() or <init>(String).
3488  The first is if no parameters are passed, the second is for case where
3489  parameters are passed.
3490 \end_layout
3492 \begin_layout Standard
3493 Aside of the constructors, modules need to obey the ordinary conventions
3494  for hardware components.
3495  No code outside modules needs to know that module exists.
3496 \end_layout
3498 \begin_layout Section
3499 Writing plugins
3500 \end_layout
3502 \begin_layout Standard
3503 Plugins handle various UI tasks.
3504  They need to implement interface org.jpc.Plugin.
3505 \end_layout
3507 \begin_layout Subsection
3508 Interface org.jpc.pluginsbase.Plugin
3509 \end_layout
3511 \begin_layout Subsubsection
3512 Method systemShutdown()
3513 \end_layout
3515 \begin_layout Standard
3516 Called when emulator shuts down.
3517  Either called in dedicated thread or in thread that called emulatorShutdown().
3518  These handlers should do the bare minimum to get files on disk to consistent
3519  state.
3520  After these calls from all plugins have finished, emulator exits.
3521  Do not try to manipulate UI from these methods, as doing that easily leads
3522  into deadlock.
3523 \end_layout
3525 \begin_layout Subsubsection
3526 Method reconnect(PC) 
3527 \end_layout
3529 \begin_layout Standard
3530 Gives new PC to connect to.
3531  Null is passed if plugin should disconnect.
3532 \end_layout
3534 \begin_layout Subsubsection
3535 Method main()
3536 \end_layout
3538 \begin_layout Standard
3539 Called in dedicated thread after plugin is initialized.
3540 \end_layout
3542 \begin_layout Subsubsection
3543 Method pcStopping()
3544 \end_layout
3546 \begin_layout Standard
3547 Called after PC has stopped.
3548 \end_layout
3550 \begin_layout Subsubsection
3551 Method pcStarting()
3552 \end_layout
3554 \begin_layout Standard
3555 Called before PC starts.
3556 \end_layout
3558 \begin_layout Subsubsection
3559 Method notifyArguments(String[])
3560 \end_layout
3562 \begin_layout Standard
3563 Pass arguments from command line.
3564 \end_layout
3566 \begin_layout Subsubsection
3567 Constructor <init>(Plugins)
3568 \end_layout
3570 \begin_layout Standard
3571 This constructor is used to initialize plugins that don't take parameters.
3572 \end_layout
3574 \begin_layout Subsubsection
3575 Constructor <init>(Plugins, String)
3576 \end_layout
3578 \begin_layout Standard
3579 This constructor is used to initialize plugins that take parameters.
3580 \end_layout
3582 \begin_layout Subsection
3583 Class org.jpc.pluginsbase.Plugins
3584 \end_layout
3586 \begin_layout Standard
3587 This class provodes various methods for manipulating plugins.
3588 \end_layout
3590 \begin_layout Subsubsection
3591 Method isShuttingDown()
3592 \end_layout
3594 \begin_layout Standard
3595 Returns true if Plugins.shutdownEmulator() has been called somehow, either
3596  via VM exit, CTRL+C or explicitly.
3597  Useful to skip cleanups involving GUI, as these are too deadlock-prone.
3598 \end_layout
3600 \begin_layout Subsubsection
3601 Method shutdownEmulator()
3602 \end_layout
3604 \begin_layout Standard
3605 Shut down and exit the emulator.
3606  All plugin shutdown functions are called in this thread.
3607 \end_layout
3609 \begin_layout Subsubsection
3610 Method reconnectPC(PC)
3611 \end_layout
3613 \begin_layout Standard
3614 Signal reconnectPC event to all plugins.
3615 \end_layout
3617 \begin_layout Subsubsection
3618 Method pcStarted()
3619 \end_layout
3621 \begin_layout Standard
3622 Signal pcStarting() event to all plugins.
3623 \end_layout
3625 \begin_layout Subsubsection
3626 Method pcStopped()
3627 \end_layout
3629 \begin_layout Standard
3630 Signal pcStopping() event to all plugins.
3631 \end_layout
3633 \begin_layout Section
3634 Inter-plugin communication
3635 \end_layout
3637 \begin_layout Subsection
3638 Receiving communications
3639 \end_layout
3641 \begin_layout Standard
3642 To receive invocation/call by name 'foo-bar', declare public method named
3643  'eci_foo_bar'.
3644  Arguments to this method can currently be String, Integer (int) or Long
3645  (long).
3646  Last argument may be array over these types to get variable number of arguments.
3647  On call, each argument gets value from call.
3648  If last argument is array, it gets all overflowing arguments.
3649  If return type is void or method returns boolean false, call is assumed
3650  to have completed.
3651  If return value is boolean true, it is assumed that there is more processing.
3652 \end_layout
3654 \begin_layout Subsection
3655 void org.jpc.pluginsbase.Plugins.invokeExternalCommand(String cmd, Object[]
3656  args) 
3657 \end_layout
3659 \begin_layout Standard
3660 Invoke command asynchronously, broadcasting to all plugins.
3661  Does not wait for slow commands to complete.
3662  cmd is the name to send and args are the arguments to pass.
3663 \end_layout
3665 \begin_layout Subsection
3666 void org.jpc.pluginsbase.Plugins.invokeExternalCommandSynchronous(String cmd,
3667  Object[] args) 
3668 \end_layout
3670 \begin_layout Standard
3671 Same as invokeExternalCommand, but waits for slow commands to complete.
3672 \end_layout
3674 \begin_layout Subsection
3675 Object[] org.jpc.pluginsbase.Plugins.invokeExternalCommandReturn(String cmd,
3676  Object[] args) 
3677 \end_layout
3679 \begin_layout Standard
3680 Similar to invokeExternalCommandSynchornous, but:
3681 \end_layout
3683 \begin_layout Itemize
3684 Quits calling more plugins when it gets successful reply.
3685 \end_layout
3687 \begin_layout Itemize
3688 Returns said reply
3689 \end_layout
3691 \begin_layout Subsection
3692 void org.jpc.pluginsbase.Plugins.returnValue(Object...
3693  ret)
3694 \end_layout
3696 \begin_layout Standard
3697 Gives return value to return from call and signals that command has completed.
3698 \end_layout
3700 \begin_layout Subsection
3701 void org.jpc.pluginsbase.Plugins.signalCommandCompletion()
3702 \end_layout
3704 \begin_layout Standard
3705 Signals that command has completed.
3706  Only needed if there is no return value and eci_ method returned false
3707  (not done yet).
3708 \end_layout
3710 \begin_layout Section
3711 Lua kernel programming
3712 \end_layout
3714 \begin_layout Standard
3715 At startup, kernel gets its arguments in 'args' table and the script name
3716  to run in 'scriptname' string.
3717  It should enter the named script in protected mode.
3718 \end_layout
3720 \begin_layout Standard
3721 The Lua VM exports numerious callbacks to kernel.
3722  The kernel can then choose to omit, wrap or re-export these to Lua scripts.
3723 \end_layout
3725 \begin_layout Itemize
3726 Always grab any functions used into local variables so nobody can mess with
3727  them
3728 \end_layout
3730 \begin_layout Itemize
3731 Don't use global variables in kernel (except for those passed).
3732 \end_layout
3734 \end_body
3735 \end_document