Fix packaging again
[jpcrr.git] / manual.lyx
blob9af14ae49a9d10f1d86b7f935f5db2281f76fe38
1 #LyX 1.6.5 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.bat that has fairly reasonable
121  defaults.
122  To use it:
123 \end_layout
125 \begin_layout LyX-Code
126 java JPCApplication -library library -autoexec assemble.bat
127 \end_layout
129 \begin_layout Standard
130 The 
131 \begin_inset Quotes eld
132 \end_inset
134 -library library
135 \begin_inset Quotes erd
136 \end_inset
138  specifies that contents of directory 'library' are to be used as library.
139  The script pops up settings for new emulated PC (if you want to load savestate,
140  click cancel).
141  Select BIOS and VGABIOS for BIOS and VGABIOS image (they should be already
142  selected), DOSfloppy for fda (boot device should be set to fda) and game
143  image as some HD drive 
144 \end_layout
146 \begin_layout Subsection
147 Bootup tips
148 \end_layout
150 \begin_layout Itemize
151 Putting the game as hdd (the fourth hard disk slot) causes boot to be bit
152  faster.
153 \end_layout
155 \begin_layout Itemize
156 Some BIOS versions have 
157 \begin_inset Quotes eld
158 \end_inset
160 press F12 to select boot device
161 \begin_inset Quotes erd
162 \end_inset
165  Hit <enter> from emulated keyboard and that prompt will go away in about
166  half emulated second (it stays several emulated seconds otherwise).
168 \end_layout
170 \begin_layout Itemize
171 If game doesn't need lots of memory, hitting F5 to skip intialization files
172  is fastest.
173  If it does need more memory, run config.sys commands but not autoexec.bat.
175 \end_layout
177 \begin_layout Itemize
178 Some DOS disks have DOSIDLE with them, don't use it as it messes badly with
179  emulator.
180 \end_layout
182 \begin_layout Section
183 Making JPC-RR format images from raw images
184 \end_layout
186 \begin_layout Standard
187 Due to various factors, JPC-RR can't use raw image files directly but requires
188  its own image format.
190 \end_layout
192 \begin_layout Subsection
193 Importing images from GUI:
194 \end_layout
196 \begin_layout Standard
197 Use Drives -> Import Image to import existing directories or image files.
198  Dialog prompting parameters will be displayed.
199  When importing floppy images, check 
200 \begin_inset Quotes eld
201 \end_inset
203 standard geometry
204 \begin_inset Quotes erd
205 \end_inset
207  if possible, that enables geometry autodetection, which is reasonable virtually
208  all of the time it is offered.
209 \end_layout
211 \begin_layout Subsection
212 Notes
213 \end_layout
215 \begin_layout Itemize
216 If making image from directory, the names of the files must conform to FAT
217  naming restrictions (8+3 character names, no spaces, etc).
218  Avoid filenames with non-ASCII characters.
220 \end_layout
222 \begin_layout Itemize
223 The DOS limit of 112 or 224 files for floppies does not apply to images
224  created from directory trees.
225  The minimum limit value used is 512.
226  If even that isn't enough, the limit is automatically increased to fit
227  all the needed directory entries.
228 \end_layout
230 \begin_layout Itemize
231 Making boot disks from tree does NOT work.
232  Even if you got system boot files there, it still won't work.
233 \end_layout
235 \begin_layout Itemize
236 Only floppy disks and hard drives can be made from directory trees.
237  BIOS images and CDROM images require image file.
238 \end_layout
240 \begin_layout Itemize
241 Avoid floppies with custom geometry (floppy geometry does affect disk ID).
242  Disks with over 63 sectors per track don't work with DOS.
243  Wheither disks with over 127 tracks per side work with DOS is unknown.
244  Also avoid 1024-tracks per side HDDs.
245 \end_layout
247 \begin_layout Itemize
248 The geometry limits are: 2-1024 tracks per side for HDD, 1-256 tracks per
249  side for floppy.
250  1-63 sectors per track for HDD, 1-255 sectors per track for floppy.
251  1-16 sides for HDD, 1 or 2 sides for floppy.
252  This gives size limit of 65280KiB for floppy disks (but note the DOS limit!)
253  and 516096KiB for HDDs.
254 \end_layout
256 \begin_layout Itemize
257 There are multiple image file contents that represent the same image.
258  The one with smallest size is picked when creating image.
259 \end_layout
261 \begin_layout Itemize
262 Note: Although the IDs are 128 bits long, they are not MD5 hashes.
264 \end_layout
266 \begin_layout Subsection
267 Importing from command line
268 \end_layout
270 \begin_layout Standard
271 There is tool called ImageMaker that can make JPC-RR images from raw images.
272  Each image has format, ID an name.
273  Format and name are specified when making image.
274  ID is automatically calculated from format and contents.
275  Name does not affect the ID but is purely for convience so one doesn't
276  have to specify long image IDs manually.
277 \end_layout
279 \begin_layout Subsubsection
280 Syntax
281 \end_layout
283 \begin_layout Standard
284 The syntax for ImageMaker when making images is:
285 \end_layout
287 \begin_layout LyX-Code
288 $ java ImageMaker <format> [<options>...] <destination> <source> <name>
289 \end_layout
291 \begin_layout Standard
292 <destination> is file name for JPC-RR format image to write.
293  <source> is either name of regular file (raw image file) or name of directory
294  tree with files (supported for making floppy or hard disk images only).
295  In case of directory tree, the files are layout deterministically to disk,
296  so the ID will always be the same for given geometry and type.
297  <name> is name to give to disk.
298  <format> is one of:
299 \end_layout
301 \begin_layout LyX-Code
302 --BIOS BIOS image (note: VGABIOS is also of this type).
303 \end_layout
305 \begin_layout LyX-Code
306 --CDROM CD-ROM image.
307 \end_layout
309 \begin_layout LyX-Code
310 --HDD=cylinders,sectors,heads Hard disk with specified geometry.
311 \end_layout
313 \begin_layout LyX-Code
314 --floppy=tracks,sectors,sides Floppy disk with specified geometry.
315 \end_layout
317 \begin_layout LyX-Code
318 --floppy160 160KiB floppy (40 tracks, 8 sectors, Single sided).
319 \end_layout
321 \begin_layout LyX-Code
322 --floppy180 180KiB floppy (40 tracks, 9 sectors, Single sided).
323 \end_layout
325 \begin_layout LyX-Code
326 --floppy320 320KiB floppy (40 tracks, 8 sectors, Double sided).
327 \end_layout
329 \begin_layout LyX-Code
330 --floppy360 360KiB floppy (40 tracks, 9 sectors, Double sided).
331 \end_layout
333 \begin_layout LyX-Code
334 --floppy410 410KiB floppy (41 tracks, 10 sectors, Double sided).
335 \end_layout
337 \begin_layout LyX-Code
338 --floppy420 420KiB floppy (42 tracks, 10 sectors, Double sided).
339 \end_layout
341 \begin_layout LyX-Code
342 --floppy720 720KiB floppy (80 tracks, 9 sectors, Double sided).
343 \end_layout
345 \begin_layout LyX-Code
346 --floppy800 800KiB floppy (80 tracks, 10 sectors, Double sided).
347 \end_layout
349 \begin_layout LyX-Code
350 --floppy820 820KiB floppy (82 tracks, 10 sectors, Double sided).
351 \end_layout
353 \begin_layout LyX-Code
354 --floppy830 830KiB floppy (83 tracks, 10 sectors, Double sided).
355 \end_layout
357 \begin_layout LyX-Code
358 --floppy880 880KiB floppy (80 tracks, 11 sectors, Double sided).
359 \end_layout
361 \begin_layout LyX-Code
362 --floppy1040 1040KiB floppy (80 tracks, 13 sectors, Double sided).
363 \end_layout
365 \begin_layout LyX-Code
366 --floppy1120 1120KiB floppy (80 tracks, 14 sectors, Double sided).
367 \end_layout
369 \begin_layout LyX-Code
370 --floppy1200 1200KiB floppy (80 tracks, 15 sectors, Double sided).
371 \end_layout
373 \begin_layout LyX-Code
374 --floppy1440 1440KiB floppy (80 tracks, 18 sectors, Double sided).
375 \end_layout
377 \begin_layout LyX-Code
378 --floppy1476 1476KiB floppy (82 tracks, 18 sectors, Double sided).
379 \end_layout
381 \begin_layout LyX-Code
382 --floppy1494 1494KiB floppy (83 tracks, 18 sectors, Double sided).
383 \end_layout
385 \begin_layout LyX-Code
386 --floppy1600 1600KiB floppy (80 tracks, 20 sectors, Double sided).
387 \end_layout
389 \begin_layout LyX-Code
390 --floppy1680 1680KiB floppy (80 tracks, 21 sectors, Double sided).
391 \end_layout
393 \begin_layout LyX-Code
394 --floppy1722 1722KiB floppy (82 tracks, 21 sectors, Double sided).
395 \end_layout
397 \begin_layout LyX-Code
398 --floppy1743 1743KiB floppy (83 tracks, 21 sectors, Double sided).
399 \end_layout
401 \begin_layout LyX-Code
402 --floppy1760 1760KiB floppy (80 tracks, 22 sectors, Double sided).
403 \end_layout
405 \begin_layout LyX-Code
406 --floppy1840 1840KiB floppy (80 tracks, 23 sectors, Double sided).
407 \end_layout
409 \begin_layout LyX-Code
410 --floppy1920 1920KiB floppy (80 tracks, 24 sectors, Double sided).
411 \end_layout
413 \begin_layout LyX-Code
414 --floppy2880 2880KiB floppy (80 tracks, 36 sectors, Double sided).
415 \end_layout
417 \begin_layout LyX-Code
418 --floppy3120 3120KiB floppy (80 tracks, 39 sectors, Double sided).
419 \end_layout
421 \begin_layout LyX-Code
422 --floppy3200 3200KiB floppy (80 tracks, 40 sectors, Double sided).
423 \end_layout
425 \begin_layout LyX-Code
426 --floppy3520 3520KiB floppy (80 tracks, 44 sectors, Double sided).
427 \end_layout
429 \begin_layout LyX-Code
430 --floppy3840 3840KiB floppy (80 tracks, 48 sectors, Double sided).
431 \end_layout
433 \begin_layout Subsubsection
434 Other options
435 \end_layout
437 \begin_layout LyX-Code
438 --volumelabel=label Give specified volume label (affects ID).
439  Only meaningful when making image out of directory tree.
440  Default is no volume label.
441 \end_layout
443 \begin_layout LyX-Code
444 --timestamp=YYYYMMDDHHMMSS Give specified timestamp for files (affects ID).
445  Only meaningful when making image out of directory tree.
446  The default timestamp is 19900101T000000Z.
447 \end_layout
449 \begin_layout Subsubsection
450 Image information
451 \end_layout
453 \begin_layout Standard
454 When invoked as:
455 \end_layout
457 \begin_layout LyX-Code
458 $ java ImageMaker <imagefile>
459 \end_layout
461 \begin_layout Standard
462 Variety of information about image is displayed (especially for floppies/HDDs).
463  Two important fields are calculated and claimed disk ID.
464  They should be the same.
465  If they are not, then the image file is corrupt (sadly, imagemaker has
466  bugs and bugs that cause it to write corrupt images have been seen).
467 \end_layout
469 \begin_layout Subsection
470 Advanced: The disk ID algorithm
471 \end_layout
473 \begin_layout Standard
474 The disk ID is calculated as:
475 \end_layout
477 \begin_layout LyX-Code
478 Skein-256-128-deprecated(<typecode>|<geometry>|<image>)
479 \end_layout
481 \begin_layout Standard
482 Where Skein-256-128-deprecated is Skein hash function with 256-bit internal
483  state and 128-bit output using the deprecated rotation constants (as specified
484  in Skein hash function reference documentation versions 1.0 and 1.1).
485  The <image> is the whole image, including parts not stored in image file.
486  The reason for keeping using the deprecated constants are:
487 \end_layout
489 \begin_layout Itemize
490 Changing the constants would change the IDs, which would invalidate existing
491  images
492 \end_layout
494 \begin_layout Itemize
495 This is not about cryptographic security
496 \end_layout
498 \begin_layout Itemize
499 The new constants don't improve security that much anyway.
500 \end_layout
502 \begin_layout Subsubsection
503 Floppies and HDDs
504 \end_layout
506 \begin_layout Standard
507 Floppies have <typecode> value 0 (single byte) and HDDs have 1 (single byte).
508  <geometry> is as follows (this is exactly the same form as it appears in
509  image header):
510 \end_layout
512 \begin_layout LyX-Code
513 Byte 0 bits 0-1: Bits 8-9 of track count per side - 1.
514 \end_layout
516 \begin_layout LyX-Code
517 Byte 0 bits 2-5: Head count - 1.
518 \end_layout
520 \begin_layout LyX-Code
521 Byte 0 bits 6-7: Reserved, must be 0.
522 \end_layout
524 \begin_layout LyX-Code
525 Byte 1: Bits 0-7 of track count per side - 1.
526 \end_layout
528 \begin_layout LyX-Code
529 Byte 2: Sector count per track - 1.
530 \end_layout
532 \begin_layout Subsubsection
533 CD-ROM and BIOS images
534 \end_layout
536 \begin_layout Standard
537 CD-ROMs have <typecode> value 2 (single byte) and BIOS images have 3 (single
538  byte).
539  <geometry> is blank.
540 \end_layout
542 \begin_layout Subsection
543 Advanced: Disk Image format
544 \end_layout
546 \begin_layout Standard
547 The disk image consists of following parts, concatenated in this order without
548  padding:
549 \end_layout
551 \begin_layout Itemize
552 Magic
553 \end_layout
555 \begin_layout Itemize
556 Disk ID
557 \end_layout
559 \begin_layout Itemize
560 Type code
561 \end_layout
563 \begin_layout Itemize
564 Disk name length
565 \end_layout
567 \begin_layout Itemize
568 Disk name
569 \end_layout
571 \begin_layout Itemize
572 type-specific geometry/size data
573 \end_layout
575 \begin_layout Itemize
576 Actual image data
577 \end_layout
579 \begin_layout Itemize
580 Comments
581 \end_layout
583 \begin_layout Subsubsection
584 Magic
585 \end_layout
587 \begin_layout Standard
588 Magic in disk image files is following 5 bytes: 
589 \begin_inset Quotes eld
590 \end_inset
592 IMAGE
593 \begin_inset Quotes erd
594 \end_inset
597 \end_layout
599 \begin_layout Subsubsection
600 Disk ID
601 \end_layout
603 \begin_layout Standard
604 Disk ID is given as 16 bytes, encoding the 128-bit disk ID.
605 \end_layout
607 \begin_layout Subsubsection
608 Type code
609 \end_layout
611 \begin_layout Standard
612 Type code is single byte.
613  0 for floppies, 1 for HDDs, 2 for CD-ROMs and 3 for BIOS images.
614  Other values are reserved.
615 \end_layout
617 \begin_layout Subsubsection
618 Disk name length
619 \end_layout
621 \begin_layout Standard
622 Obsolete.
623  Disk name length is given as two-byte big-endian value.
624  New images should have 0 here.
625 \end_layout
627 \begin_layout Subsubsection
628 Disk name
629 \end_layout
631 \begin_layout Standard
632 Ignored.
633  Name field is there for backward compatiblity.
634  Disk name length gives length of this field in bytes.
635 \end_layout
637 \begin_layout Subsubsection
638 Type-specific geometry/size data (floppies and HDDs)
639 \end_layout
641 \begin_layout Standard
642 Floppies and HDDs have 3-byte geometry data:
643 \end_layout
645 \begin_layout LyX-Code
646 Byte 0 bits 0-1: Bits 8-9 of track count per side - 1.
647 \end_layout
649 \begin_layout LyX-Code
650 Byte 0 bits 2-5: Head count - 1.
651 \end_layout
653 \begin_layout LyX-Code
654 Byte 0 bits 6-7: Reserved, must be 0.
655 \end_layout
657 \begin_layout LyX-Code
658 Byte 1: Bits 0-7 of track count per side - 1.
659 \end_layout
661 \begin_layout LyX-Code
662 Byte 2: Sector count per track - 1.
663 \end_layout
665 \begin_layout Subsubsection
666 Type specific-geometry/size data (CD-ROMs)
667 \end_layout
669 \begin_layout Standard
670 CD-ROMs have 4-byte big-endian sector (512 bytes!) count.
671 \end_layout
673 \begin_layout Subsubsection
674 Type specific-geometry/size data (BIOS images)
675 \end_layout
677 \begin_layout Standard
678 BIOS images have 4-byte big-endian byte (not sector or block) count.
679 \end_layout
681 \begin_layout Subsubsection
682 Actual image data (floppy/HDD)
683 \end_layout
685 \begin_layout Standard
686 Floppy or HDD imagedata consists of following subparts:
687 \end_layout
689 \begin_layout Itemize
690 Storage method
691 \end_layout
693 \begin_layout Itemize
694 Sectors present
695 \end_layout
697 \begin_layout Itemize
698 Image data header
699 \end_layout
701 \begin_layout Itemize
702 Image data
703 \end_layout
705 \begin_layout Standard
706 Storage method is single byte.
707  Sectors present gives number of last nonzero sector + 1 (zero if image
708  is all zeroes)
709 \end_layout
711 \begin_layout Subsubsection
712 Floppy/HDD storage method 0: Raw storage
713 \end_layout
715 \begin_layout Standard
716 This storage method has empty header.
717  Image data is raw dump of first sectors present sectors.
718 \end_layout
720 \begin_layout Subsubsection
721 Floppy/HDD storage method 1: Sectormap
722 \end_layout
724 \begin_layout Standard
725 Image data header contains bitfield with just enough bytes to have one bit
726  per present sector.
727  The order of bits is such that number of bit corresponding to each sector
728  in byte is sector number modulo 8 and byte number is floor of sector number
729  divided by 8 when sector numbers are counted from zero.
730  If bit corresponding to sector is set, then the sector is present in image
731  data, otherwise it is absent and assumed to be all-zeroes.
732 \end_layout
734 \begin_layout Standard
735 Image data contains dumps of all present sectors in order of increasing
736  sector number.
737 \end_layout
739 \begin_layout Subsubsection
740 Floppy/HDD storage method 2: Extent first sector zero
741 \end_layout
743 \begin_layout Standard
744 Image data is empty as storage-specific data is mangled with image data.
745  The image data alternates between blocks encoding zero sectors and blocks
746  encoding nonzero sectors.
747  The first block encodes zero sectors.
749 \end_layout
751 \begin_layout Standard
752 Block encoding zero sectors consist of single 1-4 byte little-endian value
753  encoding number of sectors in block - 1.
754  Number of bytes is determined by sectors present value.
755  It is 1 for 1-256 sectors, 2 for 257-65536, 3 for 65537-16777216 and 4
756  for more than 16777216.
757  All sectors in block are filled with zeroes and are not stored.
758 \end_layout
760 \begin_layout Standard
761 Block encoding nonzero sectors has same block count as zero sector block
762  but is followed by the sectors stored raw.
763 \end_layout
765 \begin_layout Subsubsection
766 Floppy/HDD storage method 3: Extent first sector nonzero
767 \end_layout
769 \begin_layout Standard
770 Same as storage method 2 but first block is nonzero sector block.
771 \end_layout
773 \begin_layout Subsubsection
774 Actual image data (CD-ROMs and BIOS images)
775 \end_layout
777 \begin_layout Standard
778 These store image data raw.
779  The amount of data is specified by sector/byte count.
780 \end_layout
782 \begin_layout Subsubsection
783 Comments
784 \end_layout
786 \begin_layout Standard
787 Comments are given as list of strings, with UTF-8 encoded strings following
788  2-octet big-endian length.
789  Comment list is terminated by entry with length 0 (0x00 0x00).
790  Comments are optional and may be absent.
791 \end_layout
793 \begin_layout Section
794 The actual emulator
795 \end_layout
797 \begin_layout Standard
798 The actual emulator is invoked as:
799 \end_layout
801 \begin_layout LyX-Code
802 $ java JPCApplication <options>...
803 \end_layout
805 \begin_layout Standard
806 The valid options are:
807 \end_layout
809 \begin_layout LyX-Code
810 -library <library> Use the specified directory when searching for images
811  (can only be specified once).
812 \end_layout
814 \begin_layout LyX-Code
815 -autoexec <script> Execute contents of specified file as commands when starting
816  up.
817 \end_layout
819 \begin_layout Subsection
820 Command line
821 \end_layout
823 \begin_layout Standard
824 When emulator is started, command line comes up.
825  Following commands are known:
826 \end_layout
828 \begin_layout Itemize
829 'exit': exit immediately
830 \end_layout
832 \begin_layout Itemize
833 'load <plugin>': Load plugin (no arguments)
834 \end_layout
836 \begin_layout Itemize
837 'load <plugin>(<arguments>)': load plugin with arguments.
838 \end_layout
840 \begin_layout Itemize
841 'command <command> [<arguments>...]': Invoke command via external command interface.
842 \end_layout
844 \begin_layout Itemize
845 'call<command> [<arguments>...]': Invoke command via external command interface
846  and print return values.
847 \end_layout
849 \begin_layout Standard
850 When one gets command line, its useful to load some plugins.
851  See section about plugins.
852  Note: Load runner plugin (PCControl/PCRunner and so) last, as some runners
853  like to start PC immediately.
854 \end_layout
856 \begin_layout Subsection
857 PC settings dialog notes
858 \end_layout
860 \begin_layout Itemize
861 CPU divider base frequency before division is 1GHz.
862 \end_layout
864 \begin_layout Itemize
865 Images can be specified by name or by ID.
866  Name is relative to library directory.
867  If the image is in subdirectory of image directory, the directory separator
868  is is '/' regardless of what the host OS uses.
869 \end_layout
871 \begin_layout Itemize
872 CD-ROM and hdc are mutually exclusive
873 \end_layout
875 \begin_layout Itemize
876 Modules is comma-seperated list of modules to load.
877  To pass arguments to some modules, enclose the arguments in ().
878  Same module can be specified twice only if parameters differ.
879 \end_layout
881 \begin_layout Itemize
882 Setting boot device doesn't work with some BIOS versions.
883  Those versions prompt the boot device anyway.
884 \end_layout
886 \begin_layout Subsection
887 Audio output channels
888 \end_layout
890 \begin_layout Standard
891 PC can have one or more audio output channels.
892  The name of audio output associated with PC speaker is: 'org.jpc.emulator.peripher
893 al.PCSpeaker-0'.
894  Modules that have audio outputs get channel names of form <classname>-<sequenti
895 al>, where <classname> is name of main module class and sequential is number
896  starting from zero.
897  Note that same module can have multiple output channels.
898  If multiple modules of same class request audio outputs, the <sequential>
899  values of subsequent module start where previous left off.
900 \end_layout
902 \begin_layout Subsection
903 Plugins
904 \end_layout
906 \begin_layout Standard
907 Plugins actually execute the tasks of the emulator.
908  They can be loaded using 
909 \begin_inset Quotes eld
910 \end_inset
912 load <plugin>
913 \begin_inset Quotes erd
914 \end_inset
916  or 'load <plugin>(<arguments>)
917 \begin_inset Quotes erd
918 \end_inset
920  from command line.
921 \end_layout
923 \begin_layout Standard
924 Different Plugins using the same output (like running PCMonitor and RAWVideoDump
925 er) should not conflict because connector output hold locking is desinged
926  to handle multiple readers.
927 \end_layout
929 \begin_layout Standard
930 If no plugin used requires GUI, then the emulator can be run without having
931  GUI available.
932 \end_layout
934 \begin_layout Subsubsection
935 plugin: org.jpc.plugins.PCControl
936 \end_layout
938 \begin_layout Standard
939 No arguments, requires and uses GUI.
940 \end_layout
942 \begin_layout Standard
943 Runs the PC emulator core.
944  Has capability to start/stop emulation, breakpoint after certain time or
945  start/end of VGA vertical retrace.
946  Also can create, savestate and loadstate PC emulation.
947  Memory dumping is supported.
949 \end_layout
951 \begin_layout Subsubsection
952 plugin: org.jpc.plugins.PCRunner
953 \end_layout
955 \begin_layout Standard
956 Takes 'movie=<file>' as argument and optionally 'stoptime=<time>' Does not
957  require nor use GUI.
958 \end_layout
960 \begin_layout Standard
961 Loads PC from savestate and just runs it.
962  CTRL+C to quit.
963  Also automatically quits once stoptime is reached.
964 \end_layout
966 \begin_layout Subsubsection
967 plugin: org.jpc.plugins.PCMonitor
968 \end_layout
970 \begin_layout Standard
971 No arguments, requires and uses GUI.
972 \end_layout
974 \begin_layout Standard
975 VGA monitor for emulated PC.
976 \end_layout
978 \begin_layout Subsubsection
979 plugin: org.jpc.plugins.VirtualKeyboard
980 \end_layout
982 \begin_layout Standard
983 No arguments, requires and uses GUI.
984 \end_layout
986 \begin_layout Standard
987 On-screen keyboard for emulated PC.
988 \end_layout
990 \begin_layout Subsubsection
991 plugin: org.jpc.plugins.PCStartStopTest
992 \end_layout
994 \begin_layout Standard
995 No arguments, requires and uses GUI.
996 \end_layout
998 \begin_layout Standard
999 Small plugin testing remote PC start/stop.
1000  Also supports sending some common keypresses.
1001 \end_layout
1003 \begin_layout Subsubsection
1004 plugin: org.jpc.plugins.RAWVideoDumper
1005 \end_layout
1007 \begin_layout Standard
1008 Takes 'rawoutput=<file>' as argument.
1009  Does not require nor use GUI.
1010 \end_layout
1012 \begin_layout Standard
1013 Dumps all generated frames to RAW file <file>.
1014  Rawoutput is required.
1015  The raw file consists of concatenation of zlib streams.
1016  The uncompressed stream is concatenation of time skips (FFh FFh FFh FFh),
1017  each acting as time offset of 2^32-1 nanoseconds and saved frames.
1018  The saved frame has time offset in nanoseconds (big endian) as first four
1019  bytes (must be at most 2^32-2, as 2^32-1 is reserved for time skip).
1020  The next two bytes are big-endian width, next two big-endian height.
1021  Finally frame has 4 * width * height bytes of data that encodes pixels
1022  using 4 bytes per pixel, in left-to-right, up-to-down order.
1023  Byte 0 of each pixel is reserved, byte 1 is the red channel, byte 2 is
1024  green channel and byte 3 is blue channel.
1025 \end_layout
1027 \begin_layout Standard
1028 Dumping to pipe is supported.
1029 \end_layout
1031 \begin_layout Subsubsection
1032 plugin: org.jpc.plugins.RAWAudioDumper
1033 \end_layout
1035 \begin_layout Standard
1036 Takes 'src=<name of audio output channel>', 'file=<output-filename>' and
1037  'offset=<offset>' as arguments, separated by ','.
1038  Does not require nor use GUI.
1039 \end_layout
1041 \begin_layout Standard
1042 Dumps output from specified audio output channel (src, mandatory) to RAW-format
1043  file (file, mandatory).
1044  The resulting file consists of records, 4 or 8 bytes each.
1045  4 byte record consists of 0xFF 0xFF 0xFF 0xFF and means to increase next
1046  time delta by 
1047 \begin_inset Formula $2^{32}-1$
1048 \end_inset
1051  Otherwise record is 8 bytes.
1052  Each 8 byte record has three fields.
1053  First 4 byte unsinged big endian timedelta value (in nanoseconds, must
1054  be smaller than 
1055 \begin_inset Formula $2^{32}-1$
1056 \end_inset
1058 ), then 2 byte signed big endian new left channel volume, then 2 byte signed
1059  big endian new right channel volume.
1060  Optionally 'offset' can be set to positive value (in nanoseconds) to delay
1061  the audio by.
1062 \end_layout
1064 \begin_layout Subsubsection
1065 plugin: org.jpc.plugins.LuaPlugin
1066 \end_layout
1068 \begin_layout Standard
1069 Takes 'kernel=<name of lua kernel file>', other parameters are passed to
1070  kernel, requires and uses GUI.
1071 \end_layout
1073 \begin_layout Standard
1074 Lua VM for executing scripts.
1075 \end_layout
1077 \begin_layout Subsubsection
1078 plugin: org.jpc.plugins.JoystickInput
1079 \end_layout
1081 \begin_layout Standard
1082 No parameters.
1083  Displays window for sending joystick input.
1084 \end_layout
1086 \begin_layout Section
1087 Modules
1088 \end_layout
1090 \begin_layout Subsection
1091 org.jpc.modules.Joystick:
1092 \end_layout
1094 \begin_layout Itemize
1095 Arguments: none.
1096 \end_layout
1098 \begin_layout Itemize
1099 Resources: I/O port 0x201
1100 \end_layout
1102 \begin_layout Standard
1103 Emulates joystick game port.
1104 \end_layout
1106 \begin_layout Subsection
1107 org.jpc.modules.SoundCard
1108 \end_layout
1110 \begin_layout Itemize
1111 Arguments: Optional resources specification
1112 \end_layout
1114 \begin_layout Itemize
1115 Resources (defaults): I/O port 0x220-0x22F, IRQ 5, DMA 1, DMA 5
1116 \end_layout
1118 \begin_layout Standard
1119 Emulates Sound card.
1120 \end_layout
1122 \begin_layout Subsection
1123 org.jpc.modules.FMCard
1124 \end_layout
1126 \begin_layout Itemize
1127 Arguments: Optional resources specification
1128 \end_layout
1130 \begin_layout Itemize
1131 Resources (defaults): I/O port 0x338-0x33B
1132 \end_layout
1134 \begin_layout Standard
1135 Emulates FM card.
1136 \end_layout
1138 \begin_layout Subsection
1139 org.jpc.modules.BasicFPU:
1140 \end_layout
1142 \begin_layout Itemize
1143 Arguments: none.
1144 \end_layout
1146 \begin_layout Itemize
1147 Resources: None.
1148 \end_layout
1150 \begin_layout Standard
1151 Crude FPU (x87) emulator.
1152 \end_layout
1154 \begin_layout Section
1155 Hacks
1156 \end_layout
1158 \begin_layout Standard
1159 Hacks are saved to savestates but not movies.
1160 \end_layout
1162 \begin_layout Subsection
1163 NO_FPU
1164 \end_layout
1166 \begin_layout Standard
1167 Force bit 1 of physical address 0x0410 to zero, signaling that the system
1168  has no FPU.
1169  BIOS assumes system has FPU but some games use that bit to detect FPU,
1170  trying to use it if it is 
1171 \begin_inset Quotes eld
1172 \end_inset
1174 present
1175 \begin_inset Quotes erd
1176 \end_inset
1179  Try this if game startup hangs with lots of trying to use FPU but not present
1180  errors.
1181  Don't use if there is FPU present.
1182  Needed to get games like Blake Stone / Wolfenstein 3-D to work (FPU emulator
1183  allows it to start but causes graphical glitches).
1184 \end_layout
1186 \begin_layout Subsection
1187 VGA_DRAW
1188 \end_layout
1190 \begin_layout Standard
1191 Update basic VGA parameters before vretrace, not after it.
1192  Some games (e.g.
1193  Commander Keen 4) don't like if this isn't done and some games (e.g.
1194  Mario & Luigi) don't like if it is done.
1195  Wrong value manifests as jerky scrolling (scrolling back and forth and
1196  fixed statusbars move).
1197 \end_layout
1199 \begin_layout Section
1200 Some error messages and explanations
1201 \end_layout
1203 \begin_layout Itemize
1204 <filename> is Not a valid image file
1205 \end_layout
1207 \begin_layout Itemize
1208 <filename> is not image file
1209 \end_layout
1211 \begin_layout Itemize
1212 <filename> claims to be floppy with illegal geometry: <x> tracks, <y> sides
1213  and <z> sectors.
1214 \end_layout
1216 \begin_layout Itemize
1217 <filename> claims to be HDD with illegal geometry: <x> tracks, <y> sides
1218  and <z> sectors.
1219 \end_layout
1221 \begin_layout Itemize
1222 Can't read disk image sector map.
1223 \end_layout
1225 \begin_layout Itemize
1226 Can't read disk image extent.
1227 \end_layout
1229 \begin_layout Standard
1230 Code expects <filename> to be valid JPC-RR format image, but it isn't JPC-RR
1231  image at all or its corrupt.
1232 \end_layout
1234 \begin_layout Itemize
1235 <filename> is image of unknown type.
1236 \end_layout
1238 \begin_layout Itemize
1239 <filename> has unrecognized geometry <x> <y> <z>
1240 \end_layout
1242 \begin_layout Standard
1243 Possibly corrupt image, not JPC-RR image, or JPC-RR image from future version
1244  containing something current version can't comprehend.
1245 \end_layout
1247 \begin_layout Itemize
1248 Invalid format specifier <something>.
1249 \end_layout
1251 \begin_layout Itemize
1252 Invalid syntax of --floppy= or --HDD= option.
1253 \end_layout
1255 \begin_layout Itemize
1256 Invalid format specifier/option <something>.
1257 \end_layout
1259 \begin_layout Standard
1260 Invalid option or format specifier was given.
1261  Check for typos.
1262 \end_layout
1264 \begin_layout Itemize
1265 java ImageMaker [<options>...] <format> <destination> <source> <diskname>
1266 \end_layout
1268 \begin_layout Standard
1269 Check syntax of command.
1270  Especially that diskname is present!
1271 \end_layout
1273 \begin_layout Itemize
1274 The image has <nnn> sectors while it should have <yyy> according to selected
1275  geometry.
1276 \end_layout
1278 \begin_layout Itemize
1279 Raw image file length not divisible by 512.
1280 \end_layout
1282 \begin_layout Itemize
1283 Trying to read sector out of range.
1284 \end_layout
1286 \begin_layout Standard
1287 The selected geometry is wrong or raw image is incomplete.
1288 \end_layout
1290 \begin_layout Itemize
1291 Invalid disk name (Should not happen!).
1292 \end_layout
1294 \begin_layout Itemize
1295 Invalid geometry to be written.
1296 \end_layout
1298 \begin_layout Standard
1299 This is a very likely a bug in program.
1300 \end_layout
1302 \begin_layout Itemize
1303 What the heck <filename> is? It's not regular file nor directory.
1304 \end_layout
1306 \begin_layout Standard
1307 That sort of file can't be used as input for image making, or the file just
1308  doesn't exist.
1309 \end_layout
1311 \begin_layout Itemize
1312 BIOS images can only be made out of regular files.
1313 \end_layout
1315 \begin_layout Itemize
1316 CD images can only be made out of regular files.
1317 \end_layout
1319 \begin_layout Standard
1320 Source image specified is not regular file, but image of that type can't
1321  be made of anything else.
1322 \end_layout
1324 \begin_layout Itemize
1325 Can't read raw bios image file.
1326 \end_layout
1328 \begin_layout Itemize
1329 Can't read sector <nnn> from image.
1330 \end_layout
1332 \begin_layout Standard
1333 Reading the raw image file failed for some reason.
1334 \end_layout
1336 \begin_layout Itemize
1337 Bad library line: "<something>".
1338  Ignored.
1339 \end_layout
1341 \begin_layout Standard
1342 Syntax error in image library.
1343 \end_layout
1345 \begin_layout Itemize
1346 Removing image <something> a.k.a.
1347  "<something>" as it no longer exists.
1348 \end_layout
1350 \begin_layout Standard
1351 The image file no longer exists so it gets removed from library.
1352 \end_layout
1354 \begin_layout Itemize
1355 Removing image <something> a.k.a.
1356  "<something>" due to <some> conflict.
1357 \end_layout
1359 \begin_layout Standard
1360 Image library code killed some image from library due to some kind of conflict
1361  with image being added.
1362 \end_layout
1364 \begin_layout Itemize
1365 Too much data to fit into given space.
1366 \end_layout
1368 \begin_layout Standard
1369 The tree you gave contains takes just too much space to fit into disk of
1370  this size.
1371 \end_layout
1373 \begin_layout Section
1374 Advanced: Savestate/movie format
1375 \end_layout
1377 \begin_layout Subsection
1378 Special character classes
1379 \end_layout
1381 \begin_layout Subsubsection
1382 SPACE
1383 \end_layout
1385 \begin_layout Standard
1386 Following Unicode codepoints (encoded as UTF-8) are interpretted as space
1387  characters:
1388 \end_layout
1390 \begin_layout Itemize
1391 Codepoints 0x20, and 0x09.
1392 \end_layout
1394 \begin_layout Itemize
1395 Codepoints 0x1680, 0x180E, 0x2028, 0x205F and 0x3000
1396 \end_layout
1398 \begin_layout Itemize
1399 Codepoints 0x2000-0x200A.
1400 \end_layout
1402 \begin_layout Subsubsection
1403 LINEFEED
1404 \end_layout
1406 \begin_layout Standard
1407 Following byte sequences are interpretted as linefeeds (line change):
1408 \end_layout
1410 \begin_layout Itemize
1411 Byte 0x0A (UTF-8 encoded codepoint 0x0A)
1412 \end_layout
1414 \begin_layout Itemize
1415 Byte 0x0D (UTF-8 encoded codepoint 0x0D)
1416 \end_layout
1418 \begin_layout Itemize
1419 Byte 0x1C (UTF-8 encoded codepoint 0x1C)
1420 \end_layout
1422 \begin_layout Itemize
1423 Byte 0x1D (UTF-8 encoded codepoint 0x1D)
1424 \end_layout
1426 \begin_layout Itemize
1427 Byte 0x1E (UTF-8 encoded codepoint 0x1E)
1428 \end_layout
1430 \begin_layout Itemize
1431 Bytes 0xC2 0x85 (UTF-8 for unicode control character NL, codepoint 0x85)
1432 \end_layout
1434 \begin_layout Itemize
1435 Bytes 0xE2 0x80 0xA9 (UTF-8 encoded codepoint 0x2029)
1436 \end_layout
1438 \begin_layout Subsection
1439 JRSR archive
1440 \end_layout
1442 \begin_layout Standard
1443 JRSR archive format packs multiple text archive members to text archive.
1444  It does not support binary members.
1445  JRSR archives have first five or six bytes form the magic.
1446  It is 
1447 \begin_inset Quotes eld
1448 \end_inset
1450 JRSR
1451 \begin_inset Quotes erd
1452 \end_inset
1454  followed by LINEFEED character There are four kinds of lines after that
1455  (lines are terminated by LINEFEED byte/bytes):
1456 \end_layout
1458 \begin_layout Itemize
1459 Start member
1460 \end_layout
1462 \begin_layout Itemize
1463 Member line
1464 \end_layout
1466 \begin_layout Itemize
1467 End member
1468 \end_layout
1470 \begin_layout Itemize
1471 Blank line
1472 \end_layout
1474 \begin_layout Standard
1475 Sequencing rules are as follows: Start member is allowed anywhere (after
1476  magic).
1477  Member line is allowed only inside member (member started but not ended).
1478  End member is only allowed inside member.
1479  End of file is only allowed outside member.
1480  Blank line is allowed anywhere after magic.
1481 \end_layout
1483 \begin_layout Subsubsection
1484 Start member
1485 \end_layout
1487 \begin_layout Standard
1488 Start member line is given as 
1489 \begin_inset Quotes eld
1490 \end_inset
1492 !BEGIN
1493 \begin_inset Quotes erd
1494 \end_inset
1496  <SPACE>+ <membername> <LINEFEED>.
1497  <SPACE>+ any number of SPACE characters at least one and <LINEFEED> is
1498  LINEFEED chacter.
1499  The member name is UTF-8 encoded and maximum allowed line length is 2048
1500  bytes (including LINEFEED, which means name is limited to 509-2040 codepoints
1501  depending on characters used).
1502  Starting member inside another implicitly ends the previous member.
1503 \end_layout
1505 \begin_layout Subsubsection
1506 Member line:
1507 \end_layout
1509 \begin_layout Standard
1510 Member line is given as 
1511 \begin_inset Quotes eld
1512 \end_inset
1515 \begin_inset Quotes erd
1516 \end_inset
1518 <content><LINEFEED>.
1519  It gives another line for member contents.
1520  <content> is passed raw to layers above (followed by line termination)
1521 \end_layout
1523 \begin_layout Subsubsection
1524 End member
1525 \end_layout
1527 \begin_layout Standard
1528 End member line is given as 
1529 \begin_inset Quotes eld
1530 \end_inset
1532 !END
1533 \begin_inset Quotes erd
1534 \end_inset
1536 <LINEFEED>.
1537  It ends the current member.
1538  The following line can only be start member line or file may end.
1539 \end_layout
1541 \begin_layout Subsubsection
1542 Blank line
1543 \end_layout
1545 \begin_layout Standard
1546 Blank line is given as <LINEFEED>.
1547  Lines like that are ignored.
1548 \end_layout
1550 \begin_layout Subsection
1551 Four-to-Five encoding
1552 \end_layout
1554 \begin_layout Standard
1555 Binary members are encoded into text by so-called four-to-five encoding.
1556  This encoding can encode single byte to two, two bytes to three, three
1557  bytes to four and four bytes to five.
1558  Four-to-five encoding has five kinds of blocks.
1559  All SPACE and LINEFEED characters are completely ignored, even in middle
1560  of blocks.
1561 \end_layout
1563 \begin_layout Subsubsection
1564 End stream block
1565 \end_layout
1567 \begin_layout Standard
1568 End stream block is encoded as '!'.
1569  It ends the stream instantly.
1570  There is also implicit end of stream at end of input to decoding.
1571 \end_layout
1573 \begin_layout Subsubsection
1574 Other four block types
1575 \end_layout
1577 \begin_layout Standard
1578 Other four block types take the value to be encoded, read it as big-endian
1579  value.
1580  Then they write it as base-93 big-endian value.
1581  Then length specific constants are added to digits of that number to yield
1582  ASCII values for characters (those are stored in order):
1583 \end_layout
1585 \begin_layout Standard
1586 \begin_inset Tabular
1587 <lyxtabular version="3" rows="5" columns="6">
1588 <features>
1589 <column alignment="center" valignment="top" width="0">
1590 <column alignment="center" valignment="top" width="0">
1591 <column alignment="center" valignment="top" width="0">
1592 <column alignment="center" valignment="top" width="0">
1593 <column alignment="center" valignment="top" width="0">
1594 <column alignment="center" valignment="top" width="0">
1595 <row>
1596 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1597 \begin_inset Text
1599 \begin_layout Plain Layout
1600 To encode
1601 \end_layout
1603 \end_inset
1604 </cell>
1605 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1606 \begin_inset Text
1608 \begin_layout Plain Layout
1609 1st char.
1610 \end_layout
1612 \end_inset
1613 </cell>
1614 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1615 \begin_inset Text
1617 \begin_layout Plain Layout
1618 2nd char.
1619 \end_layout
1621 \end_inset
1622 </cell>
1623 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1624 \begin_inset Text
1626 \begin_layout Plain Layout
1627 3rd char.
1628 \end_layout
1630 \end_inset
1631 </cell>
1632 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1633 \begin_inset Text
1635 \begin_layout Plain Layout
1636 4th char.
1637 \end_layout
1639 \end_inset
1640 </cell>
1641 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1642 \begin_inset Text
1644 \begin_layout Plain Layout
1645 5th char.
1646 \end_layout
1648 \end_inset
1649 </cell>
1650 </row>
1651 <row>
1652 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1653 \begin_inset Text
1655 \begin_layout Plain Layout
1656 1 byte
1657 \end_layout
1659 \end_inset
1660 </cell>
1661 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1662 \begin_inset Text
1664 \begin_layout Plain Layout
1666 \end_layout
1668 \end_inset
1669 </cell>
1670 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1671 \begin_inset Text
1673 \begin_layout Plain Layout
1675 \end_layout
1677 \end_inset
1678 </cell>
1679 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1680 \begin_inset Text
1682 \begin_layout Plain Layout
1684 \end_layout
1686 \end_inset
1687 </cell>
1688 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1689 \begin_inset Text
1691 \begin_layout Plain Layout
1693 \end_layout
1695 \end_inset
1696 </cell>
1697 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1698 \begin_inset Text
1700 \begin_layout Plain Layout
1702 \end_layout
1704 \end_inset
1705 </cell>
1706 </row>
1707 <row>
1708 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1709 \begin_inset Text
1711 \begin_layout Plain Layout
1712 2 bytes
1713 \end_layout
1715 \end_inset
1716 </cell>
1717 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1718 \begin_inset Text
1720 \begin_layout Plain Layout
1722 \end_layout
1724 \end_inset
1725 </cell>
1726 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1727 \begin_inset Text
1729 \begin_layout Plain Layout
1731 \end_layout
1733 \end_inset
1734 </cell>
1735 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1736 \begin_inset Text
1738 \begin_layout Plain Layout
1740 \end_layout
1742 \end_inset
1743 </cell>
1744 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1745 \begin_inset Text
1747 \begin_layout Plain Layout
1749 \end_layout
1751 \end_inset
1752 </cell>
1753 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1754 \begin_inset Text
1756 \begin_layout Plain Layout
1758 \end_layout
1760 \end_inset
1761 </cell>
1762 </row>
1763 <row>
1764 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1765 \begin_inset Text
1767 \begin_layout Plain Layout
1768 3 bytes
1769 \end_layout
1771 \end_inset
1772 </cell>
1773 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1774 \begin_inset Text
1776 \begin_layout Plain Layout
1778 \end_layout
1780 \end_inset
1781 </cell>
1782 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1783 \begin_inset Text
1785 \begin_layout Plain Layout
1787 \end_layout
1789 \end_inset
1790 </cell>
1791 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1792 \begin_inset Text
1794 \begin_layout Plain Layout
1796 \end_layout
1798 \end_inset
1799 </cell>
1800 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1801 \begin_inset Text
1803 \begin_layout Plain Layout
1805 \end_layout
1807 \end_inset
1808 </cell>
1809 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1810 \begin_inset Text
1812 \begin_layout Plain Layout
1814 \end_layout
1816 \end_inset
1817 </cell>
1818 </row>
1819 <row>
1820 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1821 \begin_inset Text
1823 \begin_layout Plain Layout
1824 4 bytes
1825 \end_layout
1827 \end_inset
1828 </cell>
1829 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1830 \begin_inset Text
1832 \begin_layout Plain Layout
1834 \end_layout
1836 \end_inset
1837 </cell>
1838 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1839 \begin_inset Text
1841 \begin_layout Plain Layout
1843 \end_layout
1845 \end_inset
1846 </cell>
1847 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1848 \begin_inset Text
1850 \begin_layout Plain Layout
1852 \end_layout
1854 \end_inset
1855 </cell>
1856 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1857 \begin_inset Text
1859 \begin_layout Plain Layout
1861 \end_layout
1863 \end_inset
1864 </cell>
1865 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1866 \begin_inset Text
1868 \begin_layout Plain Layout
1870 \end_layout
1872 \end_inset
1873 </cell>
1874 </row>
1875 </lyxtabular>
1877 \end_inset
1880 \end_layout
1882 \begin_layout Standard
1883 Blocks which encode values greater than what is possible for value of that
1884  length are fatal errors.
1886 \end_layout
1888 \begin_layout Subsection
1889 Line component encoing
1890 \end_layout
1892 \begin_layout Standard
1893 Line component encoding sits on top of UTF-8 encoding.
1894  Line component encoding encodes non-empty 1-D array of non-empty strings
1895  into line, and thus array of those into member.
1896  Empty lines or lines that don't contain any components are ignored.
1897  Line starts with depth value of 0 and must end with depth value of zero.
1898 \end_layout
1900 \begin_layout Standard
1901 Components are seperated by component separators.
1902  Empty components are ignored.
1903  Following codepoints are separators on depth 0 if not escaped:
1904 \end_layout
1906 \begin_layout Itemize
1907 Codepoint of '('.
1908  The depth is read pre-increment.
1909 \end_layout
1911 \begin_layout Itemize
1912 Codepoint of ')'.
1913  The depth is read post-decrement.
1914 \end_layout
1916 \begin_layout Itemize
1917 Any SPACE character
1918 \end_layout
1920 \begin_layout Standard
1921 The following characters are special:
1922 \end_layout
1924 \begin_layout Itemize
1925 '('.
1926  Increments depth by 1 if not escaped (and appears in component).
1927 \end_layout
1929 \begin_layout Itemize
1930 ')'.
1931  Decrements depth by 1 if not escaped (and appears in component).
1932  Depth going negative is an error.
1933 \end_layout
1935 \begin_layout Itemize
1937 \backslash
1939  Next character is interpretted as literal.
1940  Error if at end of line.
1941 \end_layout
1943 \begin_layout Standard
1944 Otherwise, characters are interpretted as literals and appear in components.
1945  Depth must be zero at end of line.
1946 \end_layout
1948 \begin_layout Subsection
1949 Header section:
1950 \end_layout
1952 \begin_layout Standard
1953 Header section is in archive member "header".
1954  It uses line component encoding.
1955  The first component of each line is name of header, and subsequent ones
1956  are arguments.
1957  How many parameters are expected is dependent on what header it is:
1958 \end_layout
1960 \begin_layout Subsubsection
1961 PROJECTID header:
1962 \end_layout
1964 \begin_layout Itemize
1965 Header name: "PROJECTID"
1966 \end_layout
1968 \begin_layout Itemize
1969 Components: 2
1970 \end_layout
1972 \begin_layout Itemize
1973 Argument #1: <project-id-string>
1974 \end_layout
1976 \begin_layout Itemize
1977 Mandatory: Yes
1978 \end_layout
1980 \begin_layout Standard
1981 Gives project ID.
1982  Project ID is generated when PC is assembled and is then preserved in save
1983  states.
1984  It is used for computing rerecord counts.
1985  Emulator treats it as opaque string, the IDs it generates are formed by
1986  48 random hexadecimal digits.
1987 \end_layout
1989 \begin_layout Subsubsection
1990 SAVESTATEID header:
1991 \end_layout
1993 \begin_layout Itemize
1994 Header name: "SAVESTATEID"
1995 \end_layout
1997 \begin_layout Itemize
1998 Components: 2
1999 \end_layout
2001 \begin_layout Itemize
2002 Argument #1: <savestate-id-string>
2003 \end_layout
2005 \begin_layout Itemize
2006 Mandatory: No
2007 \end_layout
2009 \begin_layout Standard
2010 Gives save state ID.
2011  Each save state has its own save state ID.
2012  Treated as opaque string, but generated as 48 random hexadecimal digits.
2013  The presence of this header signals whether there is save state to be loaded.
2014  If this header is present, save state load will be attempted.
2015  If absent, save state is not to be loaded even if present (and correct
2016  savestate load would be technically impossible anyway).
2017 \end_layout
2019 \begin_layout Standard
2020 The value is used to prevent loading incompatible save states in preserve
2021  event stream mode and also to find the point in event stream where one
2022  left off.
2023 \end_layout
2025 \begin_layout Subsubsection
2026 RERECORDS header:
2027 \end_layout
2029 \begin_layout Itemize
2030 Header name: "RERECORDS"
2031 \end_layout
2033 \begin_layout Itemize
2034 Components: 2
2035 \end_layout
2037 \begin_layout Itemize
2038 Argument #1: <rerecords>
2039 \end_layout
2041 \begin_layout Itemize
2042 Mandatory: Yes
2043 \end_layout
2045 \begin_layout Standard
2046 Gives rerecord count.
2047  PC assembly (except when loading save state) initializes current rerecord
2048  count to zero.
2049  Must be non-negative and decimal number using ASCII digit characters.
2050 \end_layout
2052 \begin_layout LyX-Code
2053 On loading save state:
2054 \end_layout
2056 \begin_layout LyX-Code
2057 1) If project ID matches with previous:
2058 \end_layout
2060 \begin_layout LyX-Code
2061 1a) If loaded rerecord count is larger or equal to current rerecord count:
2062 \end_layout
2064 \begin_layout LyX-Code
2065 1a-a) Current rerecord count is loaded rerecord count + 1.
2066 \end_layout
2068 \begin_layout LyX-Code
2069 1b) Otherwise
2070 \end_layout
2072 \begin_layout LyX-Code
2073 1b-a) Current rerecord count increments by 1.
2074 \end_layout
2076 \begin_layout LyX-Code
2077 2) Otherwise
2078 \end_layout
2080 \begin_layout LyX-Code
2081 2a) Current rerecord count is loaded rerecord count + 1.
2082 \end_layout
2084 \begin_layout Standard
2085 The current rerecord count at time of save is saved to save state.
2086 \end_layout
2088 \begin_layout Subsubsection
2089 AUTHORS header:
2090 \end_layout
2092 \begin_layout Itemize
2093 Header name: "AUTHORS"
2094 \end_layout
2096 \begin_layout Itemize
2097 Components: 2 or more
2098 \end_layout
2100 \begin_layout Itemize
2101 Arguments: free form
2102 \end_layout
2104 \begin_layout Itemize
2105 Mandatory: No
2106 \end_layout
2108 \begin_layout Standard
2109 Gives authors of run.
2110  Each argument gives one author.
2111  May be present multiple times.
2112 \end_layout
2114 \begin_layout Subsubsection
2115 COMMENT header:
2116 \end_layout
2118 \begin_layout Itemize
2119 Header name: "COMMENT"
2120 \end_layout
2122 \begin_layout Itemize
2123 Components: 2 or more
2124 \end_layout
2126 \begin_layout Itemize
2127 Arguments: free form
2128 \end_layout
2130 \begin_layout Itemize
2131 Mandatory: No
2132 \end_layout
2134 \begin_layout Standard
2135 Various kinds of free form data.
2136  Not parsed further by emulator.
2137 \end_layout
2139 \begin_layout Subsection
2140 Initialization segment:
2141 \end_layout
2143 \begin_layout Standard
2144 If SAVESTATEID header isn't present (not a save state), member "initialization"
2145  gives PC initialization parameters for assembling the PC.
2146  It is present anyway even if SAVESTATEID is present (savestate).
2147 \end_layout
2149 \begin_layout Standard
2150 Following parameters are used (space separates components):
2151 \end_layout
2153 \begin_layout LyX-Code
2154 "BIOS" <id>
2155 \end_layout
2157 \begin_layout Standard
2158 Gives Image ID of main system BIOS (mandatory)
2159 \end_layout
2161 \begin_layout LyX-Code
2162 "VGABIOS" <id>
2163 \end_layout
2165 \begin_layout Standard
2166 Gives Image ID of VGA BIOS (mandatory).
2167 \end_layout
2169 \begin_layout LyX-Code
2170 "HDA" <id>
2171 \end_layout
2173 \begin_layout Standard
2174 Gives Image ID of hda.
2175  Present only if system has hard disk hda.
2176 \end_layout
2178 \begin_layout LyX-Code
2179 "HDB" <id>
2180 \end_layout
2182 \begin_layout Standard
2183 Gives Image ID of hdb.
2184  Present only if system has hard disk hdb.
2185 \end_layout
2187 \begin_layout LyX-Code
2188 "HDC" <id>
2189 \end_layout
2191 \begin_layout Standard
2192 Gives Image ID of hdc.
2193  Present only if system has hard disk hdc.
2194 \end_layout
2196 \begin_layout LyX-Code
2197 "HDD" <id>
2198 \end_layout
2200 \begin_layout Standard
2201 Gives Image ID of hdd.
2202  Present only if system has hard disk hdd.
2203 \end_layout
2205 \begin_layout LyX-Code
2206 "DISK" <num> <id>
2207 \end_layout
2209 \begin_layout Standard
2210 Gives Image ID of disk in slot <num>.
2211  Slot number must be non-negative.
2212 \end_layout
2214 \begin_layout LyX-Code
2215 \begin_inset Quotes eld
2216 \end_inset
2218 DISKNAME
2219 \begin_inset Quotes erd
2220 \end_inset
2222  <num> <name>
2223 \end_layout
2225 \begin_layout Standard
2226 kGives image name of disk in slot <num>.
2227  Slot number must be non-negative.
2228  The slot must be previously declared using 
2229 \begin_inset Quotes eld
2230 \end_inset
2232 DISK
2233 \begin_inset Quotes erd
2234 \end_inset
2237 \end_layout
2239 \begin_layout LyX-Code
2240 "FDA" <num>
2241 \end_layout
2243 \begin_layout Standard
2244 Gives Image slot to initially put into floppy drive fda.
2245  Disk must be of floppy type.
2246  If none present, no disk is initially put there.
2247 \end_layout
2249 \begin_layout LyX-Code
2250 "FDB" <num>
2251 \end_layout
2253 \begin_layout Standard
2254 Gives Image slot to initially put into floppy drive fdb.
2255  Disk must be of floppy type.
2256  If none present, no disk is initially put there.
2257 \end_layout
2259 \begin_layout LyX-Code
2260 "CDROM" <num>
2261 \end_layout
2263 \begin_layout Standard
2264 Gives Image slot to initially put into CD-ROM drive hdc.
2265  Not allowed if hard disk hdc is present.
2266  Disk must be of CD-ROM type.
2267  If none present no disk is initially put there.
2268 \end_layout
2270 \begin_layout LyX-Code
2271 "INITIALTIME" <time>
2272 \end_layout
2274 \begin_layout Standard
2275 Number of milliseconds since Unix epoch to system start up time.
2276  Allowed range:
2277 \end_layout
2279 \begin_layout Standard
2280 0-4102444799999.
2281  Mandatory.
2282 \end_layout
2284 \begin_layout LyX-Code
2285 "CPUDIVIDER" <divider>
2286 \end_layout
2288 \begin_layout Standard
2289 Set CPU frequency divider (dividing the 1GHz master clock).
2290  Allowed range is 1-256.
2291  Mandatory.
2292 \end_layout
2294 \begin_layout LyX-Code
2295 "MEMORYSIZE" <pages>
2296 \end_layout
2298 \begin_layout Standard
2299 Number of 4KiB pages of RAM memory.
2300  Allowed range 256-262144.
2301  Mandatory.
2302 \end_layout
2304 \begin_layout LyX-Code
2305 "BOOT" <device>
2306 \end_layout
2308 \begin_layout Standard
2309 Set boot device.
2310  Valid devices are "FLOPPY" (boot from fda), "HDD" (boot from hda) and "CDROM"
2311  (boot from CD).
2312 \end_layout
2314 \begin_layout LyX-Code
2315 "LOADMODULEA" <module> <parameters>
2316 \end_layout
2318 \begin_layout Standard
2319 Load module <module> with parameters <parameters>.
2320 \end_layout
2322 \begin_layout LyX-Code
2323 "LOADMODULE" <module>
2324 \end_layout
2326 \begin_layout Standard
2327 Load module <module> with no parameters
2328 \end_layout
2330 \begin_layout LyX-Code
2331 \begin_inset Quotes eld
2332 \end_inset
2335 \begin_inset Quotes erd
2336 \end_inset
2338  <fpu>
2339 \end_layout
2341 \begin_layout Standard
2342 Use class <fpu> as FPU emulator.
2343 \end_layout
2345 \begin_layout LyX-Code
2346 \begin_inset Quotes eld
2347 \end_inset
2349 IOPORTDELAY
2350 \begin_inset Quotes erd
2351 \end_inset
2354 \end_layout
2356 \begin_layout Standard
2357 Use I/O port delay emulation (each I/O port read/write takes 666ns).
2358 \end_layout
2360 \begin_layout LyX-Code
2361 \begin_inset Quotes eld
2362 \end_inset
2364 VGAHRETRACE
2365 \begin_inset Quotes erd
2366 \end_inset
2369 \end_layout
2371 \begin_layout Standard
2372 Emulate VGA horizontal retrace.
2373 \end_layout
2375 \begin_layout Subsection
2376 Event record format:
2377 \end_layout
2379 \begin_layout Standard
2380 Event record is in archive member "events".
2381  It uses line component encoding.
2382  Each line gives an event.
2383  First component of each line gives time stamp.
2384  These timestamps MUST be in increasing order and all MUST be non-negative.
2385  Time stamp time unit is exactly 1 nanosecond of emulated time.
2386 \end_layout
2388 \begin_layout Standard
2389 The second component of each line is name of class to dispatch to.
2390  Further components are passed as-is to event handlers.
2391  Classes with names consisting only of uppercase A-Z and 0-9 are special
2392  and reserved.
2393  It is error to encounter unknown such special class.
2394 \end_layout
2396 \begin_layout Subsubsection
2397 Savestate event
2398 \end_layout
2400 \begin_layout Itemize
2401 Dispatch to: SAVESTATE
2402 \end_layout
2404 \begin_layout Itemize
2405 Argument #1: Savestate id
2406 \end_layout
2408 \begin_layout Itemize
2409 Argument #2 (optional): Rerecord count at time of saving savestate
2410 \end_layout
2412 \begin_layout Standard
2413 Signals that savestate has occured here.
2414  The save state IDs MUST be unique in entire event stream.
2415  The second argument to savestate (if present) is rerecord count at time
2416  of saving that savestate (useful for calulating rerecord count of movie
2417  starting from savestate).
2418  No time restrictions
2419 \end_layout
2421 \begin_layout Subsubsection
2422 Option event
2423 \end_layout
2425 \begin_layout Itemize
2426 Dispatch to: OPTION
2427 \end_layout
2429 \begin_layout Itemize
2430 Argument #1: 
2431 \begin_inset Quotes eld
2432 \end_inset
2434 ABSOLUTE
2435 \begin_inset Quotes erd
2436 \end_inset
2438  or 
2439 \begin_inset Quotes eld
2440 \end_inset
2442 RELATIVE
2443 \begin_inset Quotes erd
2444 \end_inset
2447 \end_layout
2449 \begin_layout Standard
2450 Controls various options.
2452 \begin_inset Quotes eld
2453 \end_inset
2455 ABSOLUTE
2456 \begin_inset Quotes erd
2457 \end_inset
2459  turns on absolute mode (default) where event timestamps are absolute.
2461 \begin_inset Quotes eld
2462 \end_inset
2464 RELATIVE
2465 \begin_inset Quotes erd
2466 \end_inset
2468  turns on relative mode where event timestamps are relative to last event
2469  in stream.
2470  The OPTION event itself is not affected by timing change.
2471  No time restrictions.
2472  Unknown arguments are errors.
2473 \end_layout
2475 \begin_layout Subsubsection
2476 Keyboard keypress/keyrelease event:
2477 \end_layout
2479 \begin_layout Itemize
2480 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2481 \end_layout
2483 \begin_layout Itemize
2484 Argument #1: Fixed: "KEYEDGE"
2485 \end_layout
2487 \begin_layout Itemize
2488 Argument #2: Key number.
2489  Valid values are 1-83, 85-95, 129-197 and 199-223
2490 \end_layout
2492 \begin_layout Standard
2493 Send key press or key release.
2494  Keys work in toggle button manner.
2495  The event time must be multiple of 66 666, and must not be less than 60
2496  * 66 666 TUs after last PAUSE event, 20 * 66 666 TUs after last KEYEDGE
2497  on key >128 and 10 * 66 666 TUs after last KEYEDGE on key <128.
2498 \end_layout
2500 \begin_layout Subsubsection
2501 Pause event:
2502 \end_layout
2504 \begin_layout Itemize
2505 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2506 \end_layout
2508 \begin_layout Itemize
2509 Argument #1: Fixed: "PAUSE"
2510 \end_layout
2512 \begin_layout Standard
2513 Send pause key event.
2514  The time restrictions are identical to KEYEDGE event.
2515 \end_layout
2517 \begin_layout Subsubsection
2518 Mouse button event:
2519 \end_layout
2521 \begin_layout Itemize
2522 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2523 \end_layout
2525 \begin_layout Itemize
2526 Argument #1: Fixed: "MOUSEBUTTON"
2527 \end_layout
2529 \begin_layout Itemize
2530 Argument #2: Number of button to release or press (0-4)
2531 \end_layout
2533 \begin_layout Standard
2534 Presses or releases the designated mouse button.
2535 \end_layout
2537 \begin_layout Subsubsection
2538 X mouse motion event:
2539 \end_layout
2541 \begin_layout Itemize
2542 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2543 \end_layout
2545 \begin_layout Itemize
2546 Argument #1: Fixed: "XMOUSEMOTION"
2547 \end_layout
2549 \begin_layout Itemize
2550 Argument #2: Number of units to move (-255 - 255)
2551 \end_layout
2553 \begin_layout Standard
2554 Move the mouse in X direction by specified amount.
2555  Positive is right.
2556 \end_layout
2558 \begin_layout Subsubsection
2559 Y mouse motion event:
2560 \end_layout
2562 \begin_layout Itemize
2563 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2564 \end_layout
2566 \begin_layout Itemize
2567 Argument #1: Fixed: "YMOUSEMOTION"
2568 \end_layout
2570 \begin_layout Itemize
2571 Argument #2: Number of units to move (-255 - 255)
2572 \end_layout
2574 \begin_layout Standard
2575 Move the mouse in Y direction by specified amount.
2576  Positive is up.
2577 \end_layout
2579 \begin_layout Subsubsection
2580 Z mouse motion event:
2581 \end_layout
2583 \begin_layout Itemize
2584 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2585 \end_layout
2587 \begin_layout Itemize
2588 Argument #1: Fixed: "ZMOUSEMOTION"
2589 \end_layout
2591 \begin_layout Itemize
2592 Argument #2: Number of units to move (-7 - 7)
2593 \end_layout
2595 \begin_layout Standard
2596 Move the mouse in Z direction (scrollwheel) by specified amount.
2597 \end_layout
2599 \begin_layout Subsubsection
2600 Joystick button event:
2601 \end_layout
2603 \begin_layout Itemize
2604 Dispatch to: org.jpc.modules.Joystick
2605 \end_layout
2607 \begin_layout Itemize
2608 Argument #1: 
2609 \begin_inset Quotes eld
2610 \end_inset
2612 BUTTONA
2613 \begin_inset Quotes erd
2614 \end_inset
2617 \begin_inset Quotes eld
2618 \end_inset
2620 BUTTONB
2621 \begin_inset Quotes erd
2622 \end_inset
2625 \begin_inset Quotes eld
2626 \end_inset
2628 BUTTONC
2629 \begin_inset Quotes erd
2630 \end_inset
2632  or 
2633 \begin_inset Quotes eld
2634 \end_inset
2636 BUTTOND
2637 \begin_inset Quotes erd
2638 \end_inset
2641 \end_layout
2643 \begin_layout Itemize
2644 Argument #2: 
2645 \begin_inset Quotes eld
2646 \end_inset
2649 \begin_inset Quotes erd
2650 \end_inset
2652  if released, 
2653 \begin_inset Quotes eld
2654 \end_inset
2657 \begin_inset Quotes erd
2658 \end_inset
2660  if pressed
2661 \end_layout
2663 \begin_layout Standard
2664 Send button down/up event.
2665  No time restrictions.
2666 \end_layout
2668 \begin_layout Subsubsection
2669 Joystick axis event:
2670 \end_layout
2672 \begin_layout Itemize
2673 Dispatch to: org.jpc.modules.Joystick
2674 \end_layout
2676 \begin_layout Itemize
2677 Argument #1: 
2678 \begin_inset Quotes eld
2679 \end_inset
2681 AXISA
2682 \begin_inset Quotes erd
2683 \end_inset
2686 \begin_inset Quotes eld
2687 \end_inset
2689 AXISB
2690 \begin_inset Quotes erd
2691 \end_inset
2694 \begin_inset Quotes eld
2695 \end_inset
2697 AXISC
2698 \begin_inset Quotes erd
2699 \end_inset
2701  or 
2702 \begin_inset Quotes eld
2703 \end_inset
2705 AXISD
2706 \begin_inset Quotes erd
2707 \end_inset
2710 \end_layout
2712 \begin_layout Itemize
2713 Argument #2: Multivibrator unstable state length in ns.
2714 \end_layout
2716 \begin_layout Standard
2717 Set amount of time multivibrator remains in unstable state.
2718  No time restrictions.
2719 \end_layout
2721 \begin_layout Subsubsection
2722 Reboot:
2723 \end_layout
2725 \begin_layout Itemize
2726 Dispatch to: org.jpc.emulator.PC$ResetButton
2727 \end_layout
2729 \begin_layout Itemize
2730 No arguments
2731 \end_layout
2733 \begin_layout Standard
2734 Reboots the PC.
2735 \end_layout
2737 \begin_layout Subsubsection
2738 Fda disk change:
2739 \end_layout
2741 \begin_layout Itemize
2742 Dispatch to: org.jpc.emulator.PC$DiskChanger
2743 \end_layout
2745 \begin_layout Itemize
2746 Argument #1: Fixed: "FDA"
2747 \end_layout
2749 \begin_layout Itemize
2750 Argument #2: Number of image slot to put there.
2752 \end_layout
2754 \begin_layout Standard
2755 The disk number MUST be -1 or valid disk number.
2756  -1 MUST NOT be used if there is no disk in floppy drive A.
2757  This event causes specified disk to be placed to FDA or FDA disk to be
2758  ejected with no replacement if disk number is -1.
2759  The specified disk if not -1 must be of floppy type.
2760  The specified disk if valid must not be in any other drive.
2761 \end_layout
2763 \begin_layout Subsubsection
2764 Fdb disk change:
2765 \end_layout
2767 \begin_layout Itemize
2768 Dispatch to: org.jpc.emulator.PC$DiskChanger
2769 \end_layout
2771 \begin_layout Itemize
2772 Argument #1: Fixed: "FDB"
2773 \end_layout
2775 \begin_layout Itemize
2776 Argument #2: Number of image slot to put there.
2778 \end_layout
2780 \begin_layout Standard
2781 The disk number MUST be -1 or valid disk number.
2782  -1 MUST NOT be used if there is no disk in floppy drive B.
2783  This event causes specified disk to be placed to FDB or FDB disk to be
2784  ejected with no replacement if disk number is -1.
2785  The specified disk if not -1 must be of floppy type.
2786  The specified disk if valid must not be in any other drive.
2787 \end_layout
2789 \begin_layout Subsubsection
2790 Change CDROM:
2791 \end_layout
2793 \begin_layout Itemize
2794 Dispatch to: org.jpc.emulator.PC$DiskChanger
2795 \end_layout
2797 \begin_layout Itemize
2798 Argument #1: Fixed: "CDROM"
2799 \end_layout
2801 \begin_layout Itemize
2802 Argument #2: Number of image slot to put there.
2804 \end_layout
2806 \begin_layout Standard
2807 The disk number MUST be -1 or valid disk number.
2808  -1 MUST NOT be used if there is no disk in CD-ROM.
2809  This event causes specified disk to be placed to CD-ROM or CD-ROM disk
2810  to be ejected with no replacement if disk number is -1.
2811  The specified disk if not -1 must be of CD-ROM type.
2812 \end_layout
2814 \begin_layout Standard
2815 This event has no effect if CD-ROM is locked.
2816 \end_layout
2818 \begin_layout Subsubsection
2819 Write protect floppy:
2820 \end_layout
2822 \begin_layout Itemize
2823 Dispatch to: org.jpc.emulator.PC$DiskChanger
2824 \end_layout
2826 \begin_layout Itemize
2827 Argument #1: Fixed: "WRITEPROTECT"
2828 \end_layout
2830 \begin_layout Itemize
2831 Argument #2: Number of image slot to manipulate 
2832 \end_layout
2834 \begin_layout Standard
2835 Write protects specified disk.
2836  The disk MUST NOT be in any drive and MUST be valid floppy-type disk.
2837 \end_layout
2839 \begin_layout Subsubsection
2840 Write unprotect floppy:
2841 \end_layout
2843 \begin_layout Itemize
2844 Dispatch to: org.jpc.emulator.PC$DiskChanger
2845 \end_layout
2847 \begin_layout Itemize
2848 Argument #1: Fixed: "WRITEUNPROTECT"
2849 \end_layout
2851 \begin_layout Itemize
2852 Argument #2: Number of image slot to manipulate 
2853 \end_layout
2855 \begin_layout Standard
2856 Disables write protection specified disk.
2857  The disk MUST NOT be in any drive and MUST be valid floppy-type disk.
2858 \end_layout
2860 \begin_layout Subsection
2861 Diskinfo sections
2862 \end_layout
2864 \begin_layout Standard
2865 Diskinfo sections are named 
2866 \begin_inset Quotes eld
2867 \end_inset
2869 diskinfo-
2870 \begin_inset Quotes erd
2871 \end_inset
2873 <id of disk>.
2874  They use line component encoding, fieldtype being first component on each
2875  line (value being the second).
2876  Following fields are defined:
2877 \end_layout
2879 \begin_layout Subsubsection
2880 TYPE
2881 \end_layout
2883 \begin_layout Standard
2884 Gives type of image.
2885  Possible values are
2886 \end_layout
2888 \begin_layout Itemize
2889 \begin_inset Quotes eld
2890 \end_inset
2892 FLOPPY
2893 \begin_inset Quotes erd
2894 \end_inset
2896  (floppy disk)
2897 \end_layout
2899 \begin_layout Itemize
2900 \begin_inset Quotes eld
2901 \end_inset
2904 \begin_inset Quotes erd
2905 \end_inset
2907  (Hard disk)
2908 \end_layout
2910 \begin_layout Itemize
2911 \begin_inset Quotes eld
2912 \end_inset
2914 CDROM
2915 \begin_inset Quotes erd
2916 \end_inset
2918  (CD-ROM)
2919 \end_layout
2921 \begin_layout Itemize
2922 \begin_inset Quotes eld
2923 \end_inset
2925 BIOS
2926 \begin_inset Quotes erd
2927 \end_inset
2929  (BIOS/VGABIOS image)
2930 \end_layout
2932 \begin_layout Itemize
2933 \begin_inset Quotes eld
2934 \end_inset
2936 UNKNOWN
2937 \begin_inset Quotes erd
2938 \end_inset
2940  (what the heck is this???)
2941 \end_layout
2943 \begin_layout Subsubsection
2945 \end_layout
2947 \begin_layout Standard
2948 Gives ID of disk.
2949 \end_layout
2951 \begin_layout Subsubsection
2952 IMAGELENGTH
2953 \end_layout
2955 \begin_layout Standard
2956 (BIOS images only) Gives length of BIOS image
2957 \end_layout
2959 \begin_layout Subsubsection
2960 IMAGEMD5
2961 \end_layout
2963 \begin_layout Standard
2964 MD5 of raw disk/BIOS image without any headers or trailers.
2965 \end_layout
2967 \begin_layout Subsubsection
2968 TOTALSECTORS
2969 \end_layout
2971 \begin_layout Standard
2972 (FLOPPY/HDD/CDROM images only) Number of total sectors on disk.
2973 \end_layout
2975 \begin_layout Subsubsection
2976 TRACKS
2977 \end_layout
2979 \begin_layout Standard
2980 (FLOPPY/HDD images only) Number of tracks on disk per side (1-256 for floppy,
2981  1-1024 for HDD).
2982 \end_layout
2984 \begin_layout Subsubsection
2985 SIDES
2986 \end_layout
2988 \begin_layout Standard
2989 (FLOPPY/HDD images only) Number of sides on disk (1 or 2 for floppy, 1-16
2990  for HDD).
2991 \end_layout
2993 \begin_layout Subsubsection
2994 SECTORS
2995 \end_layout
2997 \begin_layout Standard
2998 (FLOPPY/HDD images only) Number of sectors per track (1-255 for floppy,
2999  1-63 for HDD).
3000 \end_layout
3002 \begin_layout Subsubsection
3003 COMMENT
3004 \end_layout
3006 \begin_layout Standard
3007 Line from image comment block.
3008  Usually give data about files image has.
3009  May or may not be present (multiple times)
3010 \end_layout
3012 \begin_layout Subsection
3013 Output info
3014 \end_layout
3016 \begin_layout Standard
3017 Output info is stored in section 
3018 \begin_inset Quotes eld
3019 \end_inset
3021 output-info
3022 \begin_inset Quotes erd
3023 \end_inset
3026  Its relatively new, so it might not be present (then the contents have
3027  to be guessed based on modules present).
3028  Each line gives information about one output, first field being the type
3029  of output.
3030 \end_layout
3032 \begin_layout Subsubsection
3033 Video output
3034 \end_layout
3036 \begin_layout Standard
3037 For video output, there are no parameters so line is just 
3038 \begin_inset Quotes eld
3039 \end_inset
3041 VIDEO
3042 \begin_inset Quotes erd
3043 \end_inset
3045  (one component).
3046 \end_layout
3048 \begin_layout Subsubsection
3049 Audio output
3050 \end_layout
3052 \begin_layout Standard
3053 For audio output, the only parameter is name of output, so first component
3054  is 
3055 \begin_inset Quotes eld
3056 \end_inset
3058 AUDIO
3059 \begin_inset Quotes erd
3060 \end_inset
3062  and second component is name of audio output.
3063 \end_layout
3065 \begin_layout Subsection
3066 Savestates
3067 \end_layout
3069 \begin_layout Standard
3070 Actual savestate format is not documented here.
3071  It is close to impossible to comprehend without access to emulator source
3072  anyway.
3073 \end_layout
3075 \begin_layout Section
3076 Advanced: Making class dumpable
3077 \end_layout
3079 \begin_layout Standard
3080 Class is made dumpable by implementing interface org.jpc.emulator.SRDumpable
3081  and implementing method dumpSRPartial(org.jpc.emulator.SRDumper) and constructor
3082  <init>(org.jpc.emulator.SRLoader).
3083  Non-static inner classes can not be dumpable (make them static using tricks
3084  similar to what javac uses).
3085 \end_layout
3087 \begin_layout Standard
3088 If dumped class has dumpable superclass, the first thing dumping function
3089  needs to do is to call dumper function of superclass and first thing loading
3090  constructor needs to do is to call loading constructor of superclass.
3091  If class has no dumpable superclass, dumper doesn't need to do anything
3092  special, while loader needs to call objectCreated(this) on SRLoader object
3093  passed as parameter.
3095 \end_layout
3097 \begin_layout Standard
3098 Following these fixed parts, dump all members that are part of mutable state
3099  in emulator core.
3100 \end_layout
3102 \begin_layout Subsection
3103 Member dumping/loading functions
3104 \end_layout
3106 \begin_layout Standard
3107 There is dumping/loading function for following (all functions dumping/loading
3108  reference types can handle null):
3109 \end_layout
3111 \begin_layout Itemize
3112 boolean: SRDumper.dumpBoolean, SRLoader.loadBoolean
3113 \end_layout
3115 \begin_layout Itemize
3116 byte: SRDumper.dumpByte, SRLoader.loadByte
3117 \end_layout
3119 \begin_layout Itemize
3120 short: SRDumper.dumpShort, SRLoader.loadShort
3121 \end_layout
3123 \begin_layout Itemize
3124 int: SRDumper.dumpInt, SRLoader.loadInt
3125 \end_layout
3127 \begin_layout Itemize
3128 long: SRDumper.dumpLong, SRLoader.loadLong
3129 \end_layout
3131 \begin_layout Itemize
3132 String: SRDumper.dumpString, SRLoader.loadString
3133 \end_layout
3135 \begin_layout Itemize
3136 boolean[]: SRDumper.dumpArray, SRLoader.loadArrayBoolean
3137 \end_layout
3139 \begin_layout Itemize
3140 byte[]: SRDumper.dumpArray, SRLoader.loadArrayByte
3141 \end_layout
3143 \begin_layout Itemize
3144 short[]: SRDumper.dumpArray, SRLoader.loadArrayShort
3145 \end_layout
3147 \begin_layout Itemize
3148 int[]: SRDumper.dumpArray, SRLoader.loadArrayInt
3149 \end_layout
3151 \begin_layout Itemize
3152 long[]: SRDumper.dumpArray, SRLoader.loadArrayLong
3153 \end_layout
3155 \begin_layout Itemize
3156 double[]: SRDumper.dumpArray, SRLoader.loadArrayDouble
3157 \end_layout
3159 \begin_layout Itemize
3160 <dumpable type>: SRDumper.dumpObject, SRLoader.loadObject
3161 \end_layout
3163 \begin_layout Itemize
3164 special object: SRDumper.specialObject, SRLoader.specialObject
3165 \end_layout
3167 \begin_layout Subsubsection
3168 Notes:
3169 \end_layout
3171 \begin_layout Itemize
3172 Dumpable objects come out as type of org.jpc.emulator.SRDumpable.
3173 \end_layout
3175 \begin_layout Itemize
3176 Special objects are various static objects that don't need to be stored
3177  because they don't have mutable fields.
3178 \end_layout
3180 \begin_layout Itemize
3181 Don't dump fields related to event state feedback.
3182 \end_layout
3184 \begin_layout Itemize
3185 Don't dump temporary flags that are only used while PC is running.
3186  Savestate when PC is running isn't possible anyway.
3187 \end_layout
3189 \begin_layout Itemize
3190 Some connectors dump fields related to connector output, some don't.
3191 \end_layout
3193 \begin_layout Section
3194 Advanced: Making output connectors
3195 \end_layout
3197 \begin_layout Standard
3198 Implementing interface org.jpc.emulator.DisplayController signals that this
3199  is display controller, inhibiting loading of the standard VGA display controlle
3200 r if loaded as module.
3202 \end_layout
3204 \begin_layout Subsection
3205 Interface org.jpc.emulator.OutputConnector
3206 \end_layout
3208 \begin_layout Standard
3209 Class is made to be output connector by implementing this interface.
3210  This interface specifies the methods used for output hold locking.
3211  Class org.jpc.emulator.OutputConnectorLocking has implementations of these
3212  that are suitable for calling.
3214 \end_layout
3216 \begin_layout Subsubsection
3217 Method subscribeOutput(Object)
3218 \end_layout
3220 \begin_layout Standard
3221 Subscribes the output, with specified object as handle.
3222 \end_layout
3224 \begin_layout Subsubsection
3225 Method unsubscribeOutput(Object)
3226 \end_layout
3228 \begin_layout Standard
3229 Unsubscribe the specified handle object from output.
3230 \end_layout
3232 \begin_layout Subsubsection
3233 Method waitOutput(Object)
3234 \end_layout
3236 \begin_layout Standard
3237 Wait for output on specified connector using specified handle object.
3238  Returns true on success, false if wait was interrupted by thread interrupt.
3239  Blocking.
3240 \end_layout
3242 \begin_layout Subsubsection
3243 Method releaseOutput(Object)
3244 \end_layout
3246 \begin_layout Standard
3247 Release connector from p.o.v.
3248  of given handle.
3249  Does not block.
3250 \end_layout
3252 \begin_layout Subsubsection
3253 Method holdOutput()
3254 \end_layout
3256 \begin_layout Standard
3257 Release threads waiting on waitOutput() and block until all subscribers
3258  have returned from waitOutput() and enteired releaseOutput().
3259 \end_layout
3261 \begin_layout Subsubsection
3262 Method releaseOutputWaitAll(object)
3263 \end_layout
3265 \begin_layout Standard
3266 Like releaseOutput(), but waits until all handles have released their output.
3267 \end_layout
3269 \begin_layout Subsection
3270 Class org.jpc.emulator.VGADigtalOut
3271 \end_layout
3273 \begin_layout Standard
3274 Class org.jpc.emulator.VGADigtalOut (already implements OutputConnector) implements
3275  VGA output connector.
3276  If module provodes output connector, it needs to implement org.jpc.emulator.Displa
3277 yController.
3278 \end_layout
3280 \begin_layout Subsubsection
3281 Method getWidth()
3282 \end_layout
3284 \begin_layout Standard
3285 Get width of display (watch out, can return 0).
3286 \end_layout
3288 \begin_layout Subsubsection
3289 Method getHeight()
3290 \end_layout
3292 \begin_layout Standard
3293 Get height of display (watch out, can return 0).
3294 \end_layout
3296 \begin_layout Subsubsection
3297 Methods getDirtyXMin(), getDirtyXMax(), getDirtyYMin(), getDirtyYMax()
3298 \end_layout
3300 \begin_layout Standard
3301 Returns the dirty region (region modified since last output).
3302 \end_layout
3304 \begin_layout Subsubsection
3305 Method getBuffer()
3306 \end_layout
3308 \begin_layout Standard
3309 Get buffer of ints, at least width * height elements (left-to-right, top-down,
3310  one value per pixel) giving pixel data.
3311  Value for each pixel is 65536 * <red-component> + 256 * <green-component>
3312  + <blue-component>.
3313 \end_layout
3315 \begin_layout Subsubsection
3316 Method resizeDisplay(int _width, int _height)
3317 \end_layout
3319 \begin_layout Standard
3320 Resize the display to be of specified size.
3321 \end_layout
3323 \begin_layout Subsubsection
3324 Method dirtyDisplayRegion(int x, int y, int w, int h)
3325 \end_layout
3327 \begin_layout Standard
3328 Mark the specified region as dirty.
3329 \end_layout
3331 \begin_layout Subsubsection
3332 Method resetDirtyRegion()
3333 \end_layout
3335 \begin_layout Standard
3336 Resets the dirty region to be empty.
3337 \end_layout
3339 \begin_layout Subsection
3340 Class org.jpc.emulator.PC method getVideoOutput()
3341 \end_layout
3343 \begin_layout Standard
3344 Get VGA output connector for PC.
3345 \end_layout
3347 \begin_layout Subsection
3348 Interface org.jpc.emulator.DisplayController.
3349 \end_layout
3351 \begin_layout Standard
3352 Implementing this class signals that module is VGA controller.
3353  There can be only one such module active at time and presence of such module
3354  prevents loading builtin VGA controller emulation code.
3355 \end_layout
3357 \begin_layout Subsubsection
3358 Method getOutputDevice()
3359 \end_layout
3361 \begin_layout Standard
3362 Get VGA output connector for this VGA device.
3363 \end_layout
3365 \begin_layout Subsection
3366 Class org.jpc.emulator.SoundDigitalOut
3367 \end_layout
3369 \begin_layout Standard
3370 Class org.jpc.emulator.SoundDigitalOut provodes output connector for sound.
3371  Each connector can transfer stereo signal at arbitiary sampling rate.
3372  Modules that have audio connectors need to implement interface org.jpc.emulator.So
3373 undOutputDevice, as this signals that output connectors should be created.
3374 \end_layout
3376 \begin_layout Subsubsection
3377 Method addSample(long, short, short)
3378 \end_layout
3380 \begin_layout Standard
3381 Add stereo sample at time given by first argument.
3382  The second and third arguments give volume on left and right channels.
3383 \end_layout
3385 \begin_layout Subsubsection
3386 Method addSample(long, short)
3387 \end_layout
3389 \begin_layout Standard
3390 Add mono sample at time given by first argument.
3391  The second argument give volume on both channels.
3392 \end_layout
3394 \begin_layout Subsubsection
3395 Method readBlock(Block)
3396 \end_layout
3398 \begin_layout Standard
3399 Reads block of output (atomic versus addSample).
3400  Block structure has following fields which are filled:
3401 \end_layout
3403 \begin_layout Itemize
3404 timeBase: Time base for block.
3405 \end_layout
3407 \begin_layout Itemize
3408 baseLeft: Left volume at time base.
3409 \end_layout
3411 \begin_layout Itemize
3412 baseRight: Right volume at time base
3413 \end_layout
3415 \begin_layout Itemize
3416 blockNo: Sequence number of block filled.
3417 \end_layout
3419 \begin_layout Itemize
3420 samples: Number of samples in block
3421 \end_layout
3423 \begin_layout Itemize
3424 sampleTiming: Number of nanoseconds since last sample
3425 \end_layout
3427 \begin_layout Itemize
3428 sampleLeft: Left channel samples
3429 \end_layout
3431 \begin_layout Itemize
3432 sampleRight: Right channel samples
3433 \end_layout
3435 \begin_layout Subsection
3436 Interface org.jpc.emulator.SoundOutputDevice
3437 \end_layout
3439 \begin_layout Standard
3440 Implementing this interface signals that module has audio output channels.
3441 \end_layout
3443 \begin_layout Subsubsection
3444 Method org.jpc.emulator.SoundOutputDevice.requestedSoundChannels()
3445 \end_layout
3447 \begin_layout Standard
3448 Return the number of sound channels module has.
3449 \end_layout
3451 \begin_layout Subsubsection
3452 Method org.jpc.emulator.SoundOutputDevice.soundChannelCallback(SoundDigitalOut)
3453 \end_layout
3455 \begin_layout Standard
3456 This is called once per sound channel requested giving precreated sound
3457  channel.
3458 \end_layout
3460 \begin_layout Subsection
3461 Class org.jpc.emulator.PC method getSoundOut(String)
3462 \end_layout
3464 \begin_layout Standard
3465 Get sound output with specified name.
3466 \end_layout
3468 \begin_layout Section
3469 Advanced: Writing event targets
3470 \end_layout
3472 \begin_layout Standard
3473 Whereas output connectors are the way output is dispatched, input is dispatched
3474  via event targets.
3475  Event targets need to implement interface org.jpc.emulator.EventDispatchTarget.
3476 \end_layout
3478 \begin_layout Standard
3479 Event targets also provode methods which then encode events and dispatch
3480  them forward (without doing anything else) to event recorder.
3481  Also, event targets may have methods for obtaining state.
3482 \end_layout
3484 \begin_layout Subsection
3485 Interface org.jpc.emulator.EventDispatchTarget
3486 \end_layout
3488 \begin_layout Standard
3489 Interface that marks class capable of receiving events.
3490 \end_layout
3492 \begin_layout Subsubsection
3493 Method setEventRecorder(EventRecorder)
3494 \end_layout
3496 \begin_layout Standard
3497 Set the event recorder input events are sent to.
3498 \end_layout
3500 \begin_layout Subsubsection
3501 Method startEventCheck()
3502 \end_layout
3504 \begin_layout Standard
3505 Signals target to reset all state related to event checking and state feedback.
3506  This may be called at any time in order to reinitialialize event checking/feedb
3507 ack state.
3508 \end_layout
3510 \begin_layout Subsubsection
3511 Method doEvent(long, String[], int) throws IOException
3512 \end_layout
3514 \begin_layout Standard
3515 Event dispatch handler.
3516  The first argument is event time, second is parameters and third is what
3517  to do with it.
3518  If target doesn't like the event, throw IOException.
3519  Following types (the integer parameter) are used:
3520 \end_layout
3522 \begin_layout LyX-Code
3523 0 (EventRecorder.EVENT_TIMED): Time has been assigned for event.
3524 \end_layout
3526 \begin_layout LyX-Code
3527 1 (EventRecorder.EVENT_STATE_EFFECT_FUTURE): Future event in event replay
3528  for reinitialization
3529 \end_layout
3531 \begin_layout LyX-Code
3532 2 (EventRecorder.EVENT_STATE_EFFECT): Past event in event replay reinitialization
3533 \end_layout
3535 \begin_layout LyX-Code
3536 3 (EventRecorder.EVENT_EXECUTE): This event occurs now.
3537  Execute the effect.
3538 \end_layout
3540 \begin_layout Subsubsection
3541 Method endEventCheock()
3542 \end_layout
3544 \begin_layout Standard
3545 End event reinitialization.
3546  Usually unused.
3547 \end_layout
3549 \begin_layout Subsubsection
3550 Method getEventTimeLowBound(long, String[]) throws IOException
3551 \end_layout
3553 \begin_layout Standard
3554 Return the time value that's the earliest possiblity for this event to occur.
3555  Returning any time in past (including -1) causes event to fire as soon
3556  as possible.
3557  The long parameter gives the current scheduled time for event.
3558 \end_layout
3560 \begin_layout Section
3561 Writing modules
3562 \end_layout
3564 \begin_layout Standard
3565 Modules are various extensions that run inside emulator core.
3566  As such, they affect sync.
3567  Modules must implement interface org.jpc.emulator.HardwareComponent (they
3568  are hardware components) and must be dumpable.
3569  Additionally, they need either constructor <init>() or <init>(String).
3570  The first is if no parameters are passed, the second is for case where
3571  parameters are passed.
3572 \end_layout
3574 \begin_layout Standard
3575 Aside of the constructors, modules need to obey the ordinary conventions
3576  for hardware components.
3577  No code outside modules needs to know that module exists.
3578 \end_layout
3580 \begin_layout Section
3581 Writing plugins
3582 \end_layout
3584 \begin_layout Standard
3585 Plugins handle various UI tasks.
3586  They need to implement interface org.jpc.Plugin.
3587 \end_layout
3589 \begin_layout Subsection
3590 Interface org.jpc.pluginsbase.Plugin
3591 \end_layout
3593 \begin_layout Subsubsection
3594 Method systemShutdown()
3595 \end_layout
3597 \begin_layout Standard
3598 Called when emulator shuts down.
3599  Either called in dedicated thread or in thread that called emulatorShutdown().
3600  These handlers should do the bare minimum to get files on disk to consistent
3601  state.
3602  After these calls from all plugins have finished, emulator exits.
3603  Do not try to manipulate UI from these methods, as doing that easily leads
3604  into deadlock.
3605 \end_layout
3607 \begin_layout Subsubsection
3608 Method reconnect(PC) 
3609 \end_layout
3611 \begin_layout Standard
3612 Gives new PC to connect to.
3613  Null is passed if plugin should disconnect.
3614 \end_layout
3616 \begin_layout Subsubsection
3617 Method main()
3618 \end_layout
3620 \begin_layout Standard
3621 Called in dedicated thread after plugin is initialized.
3622 \end_layout
3624 \begin_layout Subsubsection
3625 Method pcStopping()
3626 \end_layout
3628 \begin_layout Standard
3629 Called after PC has stopped.
3630 \end_layout
3632 \begin_layout Subsubsection
3633 Method pcStarting()
3634 \end_layout
3636 \begin_layout Standard
3637 Called before PC starts.
3638 \end_layout
3640 \begin_layout Subsubsection
3641 Method notifyArguments(String[])
3642 \end_layout
3644 \begin_layout Standard
3645 Pass arguments from command line.
3646 \end_layout
3648 \begin_layout Subsubsection
3649 Constructor <init>(Plugins)
3650 \end_layout
3652 \begin_layout Standard
3653 This constructor is used to initialize plugins that don't take parameters.
3654 \end_layout
3656 \begin_layout Subsubsection
3657 Constructor <init>(Plugins, String)
3658 \end_layout
3660 \begin_layout Standard
3661 This constructor is used to initialize plugins that take parameters.
3662 \end_layout
3664 \begin_layout Subsection
3665 Class org.jpc.pluginsbase.Plugins
3666 \end_layout
3668 \begin_layout Standard
3669 This class provodes various methods for manipulating plugins.
3670 \end_layout
3672 \begin_layout Subsubsection
3673 Method isShuttingDown()
3674 \end_layout
3676 \begin_layout Standard
3677 Returns true if Plugins.shutdownEmulator() has been called somehow, either
3678  via VM exit, CTRL+C or explicitly.
3679  Useful to skip cleanups involving GUI, as these are too deadlock-prone.
3680 \end_layout
3682 \begin_layout Subsubsection
3683 Method shutdownEmulator()
3684 \end_layout
3686 \begin_layout Standard
3687 Shut down and exit the emulator.
3688  All plugin shutdown functions are called in this thread.
3689 \end_layout
3691 \begin_layout Subsubsection
3692 Method reconnectPC(PC)
3693 \end_layout
3695 \begin_layout Standard
3696 Signal reconnectPC event to all plugins.
3697 \end_layout
3699 \begin_layout Subsubsection
3700 Method pcStarted()
3701 \end_layout
3703 \begin_layout Standard
3704 Signal pcStarting() event to all plugins.
3705 \end_layout
3707 \begin_layout Subsubsection
3708 Method pcStopped()
3709 \end_layout
3711 \begin_layout Standard
3712 Signal pcStopping() event to all plugins.
3713 \end_layout
3715 \begin_layout Section
3716 Inter-plugin communication
3717 \end_layout
3719 \begin_layout Subsection
3720 Receiving communications
3721 \end_layout
3723 \begin_layout Standard
3724 To receive invocation/call by name 'foo-bar', declare public method named
3725  'eci_foo_bar'.
3726  Arguments to this method can currently be String, Integer (int) or Long
3727  (long).
3728  Last argument may be array over these types to get variable number of arguments.
3729  On call, each argument gets value from call.
3730  If last argument is array, it gets all overflowing arguments.
3731  If return type is void or method returns boolean false, call is assumed
3732  to have completed.
3733  If return value is boolean true, it is assumed that there is more processing.
3734 \end_layout
3736 \begin_layout Subsection
3737 void org.jpc.pluginsbase.Plugins.invokeExternalCommand(String cmd, Object[]
3738  args) 
3739 \end_layout
3741 \begin_layout Standard
3742 Invoke command asynchronously, broadcasting to all plugins.
3743  Does not wait for slow commands to complete.
3744  cmd is the name to send and args are the arguments to pass.
3745 \end_layout
3747 \begin_layout Subsection
3748 void org.jpc.pluginsbase.Plugins.invokeExternalCommandSynchronous(String cmd,
3749  Object[] args) 
3750 \end_layout
3752 \begin_layout Standard
3753 Same as invokeExternalCommand, but waits for slow commands to complete.
3754 \end_layout
3756 \begin_layout Subsection
3757 Object[] org.jpc.pluginsbase.Plugins.invokeExternalCommandReturn(String cmd,
3758  Object[] args) 
3759 \end_layout
3761 \begin_layout Standard
3762 Similar to invokeExternalCommandSynchornous, but:
3763 \end_layout
3765 \begin_layout Itemize
3766 Quits calling more plugins when it gets successful reply.
3767 \end_layout
3769 \begin_layout Itemize
3770 Returns said reply
3771 \end_layout
3773 \begin_layout Subsection
3774 void org.jpc.pluginsbase.Plugins.returnValue(Object...
3775  ret)
3776 \end_layout
3778 \begin_layout Standard
3779 Gives return value to return from call and signals that command has completed.
3780 \end_layout
3782 \begin_layout Subsection
3783 void org.jpc.pluginsbase.Plugins.signalCommandCompletion()
3784 \end_layout
3786 \begin_layout Standard
3787 Signals that command has completed.
3788  Only needed if there is no return value and eci_ method returned false
3789  (not done yet).
3790 \end_layout
3792 \begin_layout Section
3793 Lua kernel programming
3794 \end_layout
3796 \begin_layout Standard
3797 At startup, kernel gets its arguments in 'args' table and the script name
3798  to run in 'scriptname' string.
3799  It should enter the named script in protected mode.
3800 \end_layout
3802 \begin_layout Standard
3803 The Lua VM exports numerious callbacks to kernel.
3804  The kernel can then choose to omit, wrap or re-export these to Lua scripts.
3805 \end_layout
3807 \begin_layout Itemize
3808 Always grab any functions used into local variables so nobody can mess with
3809  them
3810 \end_layout
3812 \begin_layout Itemize
3813 Don't use global variables in kernel (except for those passed).
3814 \end_layout
3816 \end_body
3817 \end_document