Automatically resize monitor to correct size
[jpcrr.git] / manual.lyx
blob54ff00772703f4594dc32331573b9c4c16ba0e68
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.jpcrrinit that has fairly
121  reasonable defaults.
122  To use it:
123 \end_layout
125 \begin_layout LyX-Code
126 java JPCApplication -library library -autoexec assemble.jpcrrinit
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 LyX-Code
820 -norenames Copy&Delete files instead of renaming.
821  Mainly meant for debugging copy&delte code.
822 \end_layout
824 \begin_layout Subsection
825 Command line
826 \end_layout
828 \begin_layout Standard
829 When emulator is started, command line comes up.
830  Following commands are known:
831 \end_layout
833 \begin_layout Itemize
834 'exit': exit immediately
835 \end_layout
837 \begin_layout Itemize
838 'load <plugin>': Load plugin (no arguments)
839 \end_layout
841 \begin_layout Itemize
842 'load <plugin>(<arguments>)': load plugin with arguments.
843 \end_layout
845 \begin_layout Itemize
846 'command <command> [<arguments>...]': Invoke command via external command interface.
847 \end_layout
849 \begin_layout Itemize
850 'call<command> [<arguments>...]': Invoke command via external command interface
851  and print return values.
852 \end_layout
854 \begin_layout Standard
855 When one gets command line, its useful to load some plugins.
856  See section about plugins.
857  Note: Load runner plugin (PCControl/PCRunner and so) last, as some runners
858  like to start PC immediately.
859 \end_layout
861 \begin_layout Subsection
862 PC settings dialog notes
863 \end_layout
865 \begin_layout Itemize
866 CPU divider base frequency before division is 1GHz.
867 \end_layout
869 \begin_layout Itemize
870 Images can be specified by name or by ID.
871  Name is relative to library directory.
872  If the image is in subdirectory of image directory, the directory separator
873  is is '/' regardless of what the host OS uses.
874 \end_layout
876 \begin_layout Itemize
877 CD-ROM and hdc are mutually exclusive
878 \end_layout
880 \begin_layout Itemize
881 Modules is comma-seperated list of modules to load.
882  To pass arguments to some modules, enclose the arguments in ().
883  Same module can be specified twice only if parameters differ.
884 \end_layout
886 \begin_layout Itemize
887 Setting boot device doesn't work with some BIOS versions.
888  Those versions prompt the boot device anyway.
889 \end_layout
891 \begin_layout Subsection
892 Audio output channels
893 \end_layout
895 \begin_layout Standard
896 PC can have one or more audio output channels.
897  The name of audio output associated with PC speaker is: 'org.jpc.emulator.peripher
898 al.PCSpeaker-0'.
899  Modules that have audio outputs get channel names of form <classname>-<sequenti
900 al>, where <classname> is name of main module class and sequential is number
901  starting from zero.
902  Note that same module can have multiple output channels.
903  If multiple modules of same class request audio outputs, the <sequential>
904  values of subsequent module start where previous left off.
905 \end_layout
907 \begin_layout Subsection
908 Plugins
909 \end_layout
911 \begin_layout Standard
912 Plugins actually execute the tasks of the emulator.
913  They can be loaded using 
914 \begin_inset Quotes eld
915 \end_inset
917 load <plugin>
918 \begin_inset Quotes erd
919 \end_inset
921  or 'load <plugin>(<arguments>)
922 \begin_inset Quotes erd
923 \end_inset
925  from command line.
926 \end_layout
928 \begin_layout Standard
929 Different Plugins using the same output (like running PCMonitor and RAWVideoDump
930 er) should not conflict because connector output hold locking is desinged
931  to handle multiple readers.
932 \end_layout
934 \begin_layout Standard
935 If no plugin used requires GUI, then the emulator can be run without having
936  GUI available.
937 \end_layout
939 \begin_layout Subsubsection
940 plugin: org.jpc.plugins.PCControl
941 \end_layout
943 \begin_layout Standard
944 Takes optionally 'extramenu=<file>' and 'uncompressedsave=1', requires and
945  uses GUI.
946 \end_layout
948 \begin_layout Standard
949 Runs the PC emulator core.
950  Has capability to start/stop emulation, breakpoint after certain time or
951  start/end of VGA vertical retrace.
952  Also can create, savestate and loadstate PC emulation.
953  Memory dumping is supported.
955 \end_layout
957 \begin_layout Standard
958 'extramenu=<file>' causes Plugin to load extra menu entries from <file>.
959  'uncompressedsave=1' causes savestates to be written uncompressed (useful
960  if they are stored in VCS supporting delta compression).
961 \end_layout
963 \begin_layout Subsubsection
964 plugin: org.jpc.plugins.PCRunner
965 \end_layout
967 \begin_layout Standard
968 Takes 'movie=<file>' as argument and optionally 'stoptime=<time>' Does not
969  require nor use GUI.
970 \end_layout
972 \begin_layout Standard
973 Loads PC from savestate and just runs it.
974  CTRL+C to quit.
975  Also automatically quits once stoptime is reached.
976 \end_layout
978 \begin_layout Subsubsection
979 plugin: org.jpc.plugins.PCMonitor
980 \end_layout
982 \begin_layout Standard
983 No arguments, requires and uses GUI.
984 \end_layout
986 \begin_layout Standard
987 VGA monitor for emulated PC.
988 \end_layout
990 \begin_layout Subsubsection
991 plugin: org.jpc.plugins.VirtualKeyboard
992 \end_layout
994 \begin_layout Standard
995 No arguments, requires and uses GUI.
996 \end_layout
998 \begin_layout Standard
999 On-screen keyboard for emulated PC.
1000 \end_layout
1002 \begin_layout Subsubsection
1003 plugin: org.jpc.plugins.PCStartStopTest
1004 \end_layout
1006 \begin_layout Standard
1007 No arguments, requires and uses GUI.
1008 \end_layout
1010 \begin_layout Standard
1011 Small plugin testing remote PC start/stop.
1012  Also supports sending some common keypresses.
1013 \end_layout
1015 \begin_layout Subsubsection
1016 plugin: org.jpc.plugins.RAWVideoDumper
1017 \end_layout
1019 \begin_layout Standard
1020 Takes 'rawoutput=<file>' as argument.
1021  Does not require nor use GUI.
1022 \end_layout
1024 \begin_layout Standard
1025 Dumps all generated frames to RAW file <file>.
1026  Rawoutput is required.
1027  The raw file consists of concatenation of zlib streams.
1028  The uncompressed stream is concatenation of time skips (FFh FFh FFh FFh),
1029  each acting as time offset of 2^32-1 nanoseconds and saved frames.
1030  The saved frame has time offset in nanoseconds (big endian) as first four
1031  bytes (must be at most 2^32-2, as 2^32-1 is reserved for time skip).
1032  The next two bytes are big-endian width, next two big-endian height.
1033  Finally frame has 4 * width * height bytes of data that encodes pixels
1034  using 4 bytes per pixel, in left-to-right, up-to-down order.
1035  Byte 0 of each pixel is reserved, byte 1 is the red channel, byte 2 is
1036  green channel and byte 3 is blue channel.
1037 \end_layout
1039 \begin_layout Standard
1040 Dumping to pipe is supported.
1041 \end_layout
1043 \begin_layout Subsubsection
1044 plugin: org.jpc.plugins.RAWAudioDumper
1045 \end_layout
1047 \begin_layout Standard
1048 Takes 'src=<name of audio output channel>', 'file=<output-filename>' and
1049  'offset=<offset>' as arguments, separated by ','.
1050  Does not require nor use GUI.
1051 \end_layout
1053 \begin_layout Standard
1054 Dumps output from specified audio output channel (src, mandatory) to RAW-format
1055  file (file, mandatory).
1056  The resulting file consists of records, 4 or 8 bytes each.
1057  4 byte record consists of 0xFF 0xFF 0xFF 0xFF and means to increase next
1058  time delta by 
1059 \begin_inset Formula $2^{32}-1$
1060 \end_inset
1063  Otherwise record is 8 bytes.
1064  Each 8 byte record has three fields.
1065  First 4 byte unsinged big endian timedelta value (in nanoseconds, must
1066  be smaller than 
1067 \begin_inset Formula $2^{32}-1$
1068 \end_inset
1070 ), then 2 byte signed big endian new left channel volume, then 2 byte signed
1071  big endian new right channel volume.
1072  Optionally 'offset' can be set to positive value (in nanoseconds) to delay
1073  the audio by.
1074 \end_layout
1076 \begin_layout Subsubsection
1077 plugin: org.jpc.plugins.LuaPlugin
1078 \end_layout
1080 \begin_layout Standard
1081 Takes 'kernel=<name of lua kernel file>', other parameters are passed to
1082  kernel, requires and uses GUI.
1083 \end_layout
1085 \begin_layout Standard
1086 Lua VM for executing scripts.
1087 \end_layout
1089 \begin_layout Subsubsection
1090 plugin: org.jpc.plugins.JoystickInput
1091 \end_layout
1093 \begin_layout Standard
1094 No parameters.
1095  Displays window for sending joystick input.
1096 \end_layout
1098 \begin_layout Section
1099 Modules
1100 \end_layout
1102 \begin_layout Subsection
1103 org.jpc.modules.Joystick:
1104 \end_layout
1106 \begin_layout Itemize
1107 Arguments: none.
1108 \end_layout
1110 \begin_layout Itemize
1111 Resources: I/O port 0x201
1112 \end_layout
1114 \begin_layout Standard
1115 Emulates joystick game port.
1116 \end_layout
1118 \begin_layout Subsection
1119 org.jpc.modules.SoundCard
1120 \end_layout
1122 \begin_layout Itemize
1123 Arguments: Optional resources specification
1124 \end_layout
1126 \begin_layout Itemize
1127 Resources (defaults): I/O port 0x220-0x22F, IRQ 5, DMA 1, DMA 5
1128 \end_layout
1130 \begin_layout Standard
1131 Emulates Sound card.
1132 \end_layout
1134 \begin_layout Subsection
1135 org.jpc.modules.FMCard
1136 \end_layout
1138 \begin_layout Itemize
1139 Arguments: Optional resources specification
1140 \end_layout
1142 \begin_layout Itemize
1143 Resources (defaults): I/O port 0x338-0x33B
1144 \end_layout
1146 \begin_layout Standard
1147 Emulates FM card.
1148 \end_layout
1150 \begin_layout Subsection
1151 org.jpc.modules.BasicFPU:
1152 \end_layout
1154 \begin_layout Itemize
1155 Arguments: none.
1156 \end_layout
1158 \begin_layout Itemize
1159 Resources: None.
1160 \end_layout
1162 \begin_layout Standard
1163 Crude FPU (x87) emulator.
1164 \end_layout
1166 \begin_layout Section
1167 Hacks
1168 \end_layout
1170 \begin_layout Standard
1171 Hacks are saved to savestates but not movies.
1172 \end_layout
1174 \begin_layout Subsection
1175 NO_FPU
1176 \end_layout
1178 \begin_layout Standard
1179 Force bit 1 of physical address 0x0410 to zero, signaling that the system
1180  has no FPU.
1181  BIOS assumes system has FPU but some games use that bit to detect FPU,
1182  trying to use it if it is 
1183 \begin_inset Quotes eld
1184 \end_inset
1186 present
1187 \begin_inset Quotes erd
1188 \end_inset
1191  Try this if game startup hangs with lots of trying to use FPU but not present
1192  errors.
1193  Don't use if there is FPU present.
1194  Needed to get games like Blake Stone / Wolfenstein 3-D to work (FPU emulator
1195  allows it to start but causes graphical glitches).
1196 \end_layout
1198 \begin_layout Subsection
1199 VGA_DRAW
1200 \end_layout
1202 \begin_layout Standard
1203 Update basic VGA parameters before vretrace, not after it.
1204  Some games (e.g.
1205  Commander Keen 4) don't like if this isn't done and some games (e.g.
1206  Mario & Luigi) don't like if it is done.
1207  Wrong value manifests as jerky scrolling (scrolling back and forth and
1208  fixed statusbars move).
1209 \end_layout
1211 \begin_layout Section
1212 Some error messages and explanations
1213 \end_layout
1215 \begin_layout Itemize
1216 <filename> is Not a valid image file
1217 \end_layout
1219 \begin_layout Itemize
1220 <filename> is not image file
1221 \end_layout
1223 \begin_layout Itemize
1224 <filename> claims to be floppy with illegal geometry: <x> tracks, <y> sides
1225  and <z> sectors.
1226 \end_layout
1228 \begin_layout Itemize
1229 <filename> claims to be HDD with illegal geometry: <x> tracks, <y> sides
1230  and <z> sectors.
1231 \end_layout
1233 \begin_layout Itemize
1234 Can't read disk image sector map.
1235 \end_layout
1237 \begin_layout Itemize
1238 Can't read disk image extent.
1239 \end_layout
1241 \begin_layout Standard
1242 Code expects <filename> to be valid JPC-RR format image, but it isn't JPC-RR
1243  image at all or its corrupt.
1244 \end_layout
1246 \begin_layout Itemize
1247 <filename> is image of unknown type.
1248 \end_layout
1250 \begin_layout Itemize
1251 <filename> has unrecognized geometry <x> <y> <z>
1252 \end_layout
1254 \begin_layout Standard
1255 Possibly corrupt image, not JPC-RR image, or JPC-RR image from future version
1256  containing something current version can't comprehend.
1257 \end_layout
1259 \begin_layout Itemize
1260 Invalid format specifier <something>.
1261 \end_layout
1263 \begin_layout Itemize
1264 Invalid syntax of --floppy= or --HDD= option.
1265 \end_layout
1267 \begin_layout Itemize
1268 Invalid format specifier/option <something>.
1269 \end_layout
1271 \begin_layout Standard
1272 Invalid option or format specifier was given.
1273  Check for typos.
1274 \end_layout
1276 \begin_layout Itemize
1277 java ImageMaker [<options>...] <format> <destination> <source> <diskname>
1278 \end_layout
1280 \begin_layout Standard
1281 Check syntax of command.
1282  Especially that diskname is present!
1283 \end_layout
1285 \begin_layout Itemize
1286 The image has <nnn> sectors while it should have <yyy> according to selected
1287  geometry.
1288 \end_layout
1290 \begin_layout Itemize
1291 Raw image file length not divisible by 512.
1292 \end_layout
1294 \begin_layout Itemize
1295 Trying to read sector out of range.
1296 \end_layout
1298 \begin_layout Standard
1299 The selected geometry is wrong or raw image is incomplete.
1300 \end_layout
1302 \begin_layout Itemize
1303 Invalid disk name (Should not happen!).
1304 \end_layout
1306 \begin_layout Itemize
1307 Invalid geometry to be written.
1308 \end_layout
1310 \begin_layout Standard
1311 This is a very likely a bug in program.
1312 \end_layout
1314 \begin_layout Itemize
1315 What the heck <filename> is? It's not regular file nor directory.
1316 \end_layout
1318 \begin_layout Standard
1319 That sort of file can't be used as input for image making, or the file just
1320  doesn't exist.
1321 \end_layout
1323 \begin_layout Itemize
1324 BIOS images can only be made out of regular files.
1325 \end_layout
1327 \begin_layout Itemize
1328 CD images can only be made out of regular files.
1329 \end_layout
1331 \begin_layout Standard
1332 Source image specified is not regular file, but image of that type can't
1333  be made of anything else.
1334 \end_layout
1336 \begin_layout Itemize
1337 Can't read raw bios image file.
1338 \end_layout
1340 \begin_layout Itemize
1341 Can't read sector <nnn> from image.
1342 \end_layout
1344 \begin_layout Standard
1345 Reading the raw image file failed for some reason.
1346 \end_layout
1348 \begin_layout Itemize
1349 Bad library line: "<something>".
1350  Ignored.
1351 \end_layout
1353 \begin_layout Standard
1354 Syntax error in image library.
1355 \end_layout
1357 \begin_layout Itemize
1358 Removing image <something> a.k.a.
1359  "<something>" as it no longer exists.
1360 \end_layout
1362 \begin_layout Standard
1363 The image file no longer exists so it gets removed from library.
1364 \end_layout
1366 \begin_layout Itemize
1367 Removing image <something> a.k.a.
1368  "<something>" due to <some> conflict.
1369 \end_layout
1371 \begin_layout Standard
1372 Image library code killed some image from library due to some kind of conflict
1373  with image being added.
1374 \end_layout
1376 \begin_layout Itemize
1377 Too much data to fit into given space.
1378 \end_layout
1380 \begin_layout Standard
1381 The tree you gave contains takes just too much space to fit into disk of
1382  this size.
1383 \end_layout
1385 \begin_layout Section
1386 Advanced: Savestate/movie format
1387 \end_layout
1389 \begin_layout Subsection
1390 Special character classes
1391 \end_layout
1393 \begin_layout Subsubsection
1394 SPACE
1395 \end_layout
1397 \begin_layout Standard
1398 Following Unicode codepoints (encoded as UTF-8) are interpretted as space
1399  characters:
1400 \end_layout
1402 \begin_layout Itemize
1403 Codepoints 0x20, and 0x09.
1404 \end_layout
1406 \begin_layout Itemize
1407 Codepoints 0x1680, 0x180E, 0x2028, 0x205F and 0x3000
1408 \end_layout
1410 \begin_layout Itemize
1411 Codepoints 0x2000-0x200A.
1412 \end_layout
1414 \begin_layout Subsubsection
1415 LINEFEED
1416 \end_layout
1418 \begin_layout Standard
1419 Following byte sequences are interpretted as linefeeds (line change):
1420 \end_layout
1422 \begin_layout Itemize
1423 Byte 0x0A (UTF-8 encoded codepoint 0x0A)
1424 \end_layout
1426 \begin_layout Itemize
1427 Byte 0x0D (UTF-8 encoded codepoint 0x0D)
1428 \end_layout
1430 \begin_layout Itemize
1431 Byte 0x1C (UTF-8 encoded codepoint 0x1C)
1432 \end_layout
1434 \begin_layout Itemize
1435 Byte 0x1D (UTF-8 encoded codepoint 0x1D)
1436 \end_layout
1438 \begin_layout Itemize
1439 Byte 0x1E (UTF-8 encoded codepoint 0x1E)
1440 \end_layout
1442 \begin_layout Itemize
1443 Bytes 0xC2 0x85 (UTF-8 for unicode control character NL, codepoint 0x85)
1444 \end_layout
1446 \begin_layout Itemize
1447 Bytes 0xE2 0x80 0xA9 (UTF-8 encoded codepoint 0x2029)
1448 \end_layout
1450 \begin_layout Subsection
1451 JRSR archive
1452 \end_layout
1454 \begin_layout Standard
1455 JRSR archive format packs multiple text archive members to text archive.
1456  It does not support binary members.
1457  JRSR archives have first five or six bytes form the magic.
1458  It is 
1459 \begin_inset Quotes eld
1460 \end_inset
1462 JRSR
1463 \begin_inset Quotes erd
1464 \end_inset
1466  followed by LINEFEED character There are four kinds of lines after that
1467  (lines are terminated by LINEFEED byte/bytes):
1468 \end_layout
1470 \begin_layout Itemize
1471 Start member
1472 \end_layout
1474 \begin_layout Itemize
1475 Member line
1476 \end_layout
1478 \begin_layout Itemize
1479 End member
1480 \end_layout
1482 \begin_layout Itemize
1483 Blank line
1484 \end_layout
1486 \begin_layout Standard
1487 Sequencing rules are as follows: Start member is allowed anywhere (after
1488  magic).
1489  Member line is allowed only inside member (member started but not ended).
1490  End member is only allowed inside member.
1491  End of file is only allowed outside member.
1492  Blank line is allowed anywhere after magic.
1493 \end_layout
1495 \begin_layout Subsubsection
1496 Start member
1497 \end_layout
1499 \begin_layout Standard
1500 Start member line is given as 
1501 \begin_inset Quotes eld
1502 \end_inset
1504 !BEGIN
1505 \begin_inset Quotes erd
1506 \end_inset
1508  <SPACE>+ <membername> <LINEFEED>.
1509  <SPACE>+ any number of SPACE characters at least one and <LINEFEED> is
1510  LINEFEED chacter.
1511  The member name is UTF-8 encoded and maximum allowed line length is 2048
1512  bytes (including LINEFEED, which means name is limited to 509-2040 codepoints
1513  depending on characters used).
1514  Starting member inside another implicitly ends the previous member.
1515 \end_layout
1517 \begin_layout Subsubsection
1518 Member line:
1519 \end_layout
1521 \begin_layout Standard
1522 Member line is given as 
1523 \begin_inset Quotes eld
1524 \end_inset
1527 \begin_inset Quotes erd
1528 \end_inset
1530 <content><LINEFEED>.
1531  It gives another line for member contents.
1532  <content> is passed raw to layers above (followed by line termination)
1533 \end_layout
1535 \begin_layout Subsubsection
1536 End member
1537 \end_layout
1539 \begin_layout Standard
1540 End member line is given as 
1541 \begin_inset Quotes eld
1542 \end_inset
1544 !END
1545 \begin_inset Quotes erd
1546 \end_inset
1548 <LINEFEED>.
1549  It ends the current member.
1550  The following line can only be start member line or file may end.
1551 \end_layout
1553 \begin_layout Subsubsection
1554 Blank line
1555 \end_layout
1557 \begin_layout Standard
1558 Blank line is given as <LINEFEED>.
1559  Lines like that are ignored.
1560 \end_layout
1562 \begin_layout Subsection
1563 Four-to-Five encoding
1564 \end_layout
1566 \begin_layout Standard
1567 Binary members are encoded into text by so-called four-to-five encoding.
1568  This encoding can encode single byte to two, two bytes to three, three
1569  bytes to four and four bytes to five.
1570  Four-to-five encoding has five kinds of blocks.
1571  All SPACE and LINEFEED characters are completely ignored, even in middle
1572  of blocks.
1573 \end_layout
1575 \begin_layout Subsubsection
1576 End stream block
1577 \end_layout
1579 \begin_layout Standard
1580 End stream block is encoded as '!'.
1581  It ends the stream instantly.
1582  There is also implicit end of stream at end of input to decoding.
1583 \end_layout
1585 \begin_layout Subsubsection
1586 Other four block types
1587 \end_layout
1589 \begin_layout Standard
1590 Other four block types take the value to be encoded, read it as big-endian
1591  value.
1592  Then they write it as base-93 big-endian value.
1593  Then length specific constants are added to digits of that number to yield
1594  ASCII values for characters (those are stored in order):
1595 \end_layout
1597 \begin_layout Standard
1598 \begin_inset Tabular
1599 <lyxtabular version="3" rows="5" columns="6">
1600 <features>
1601 <column alignment="center" valignment="top" width="0">
1602 <column alignment="center" valignment="top" width="0">
1603 <column alignment="center" valignment="top" width="0">
1604 <column alignment="center" valignment="top" width="0">
1605 <column alignment="center" valignment="top" width="0">
1606 <column alignment="center" valignment="top" width="0">
1607 <row>
1608 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1609 \begin_inset Text
1611 \begin_layout Plain Layout
1612 To encode
1613 \end_layout
1615 \end_inset
1616 </cell>
1617 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1618 \begin_inset Text
1620 \begin_layout Plain Layout
1621 1st char.
1622 \end_layout
1624 \end_inset
1625 </cell>
1626 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1627 \begin_inset Text
1629 \begin_layout Plain Layout
1630 2nd char.
1631 \end_layout
1633 \end_inset
1634 </cell>
1635 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1636 \begin_inset Text
1638 \begin_layout Plain Layout
1639 3rd char.
1640 \end_layout
1642 \end_inset
1643 </cell>
1644 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1645 \begin_inset Text
1647 \begin_layout Plain Layout
1648 4th char.
1649 \end_layout
1651 \end_inset
1652 </cell>
1653 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1654 \begin_inset Text
1656 \begin_layout Plain Layout
1657 5th char.
1658 \end_layout
1660 \end_inset
1661 </cell>
1662 </row>
1663 <row>
1664 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1665 \begin_inset Text
1667 \begin_layout Plain Layout
1668 1 byte
1669 \end_layout
1671 \end_inset
1672 </cell>
1673 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1674 \begin_inset Text
1676 \begin_layout Plain Layout
1678 \end_layout
1680 \end_inset
1681 </cell>
1682 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1683 \begin_inset Text
1685 \begin_layout Plain Layout
1687 \end_layout
1689 \end_inset
1690 </cell>
1691 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1692 \begin_inset Text
1694 \begin_layout Plain Layout
1696 \end_layout
1698 \end_inset
1699 </cell>
1700 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1701 \begin_inset Text
1703 \begin_layout Plain Layout
1705 \end_layout
1707 \end_inset
1708 </cell>
1709 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1710 \begin_inset Text
1712 \begin_layout Plain Layout
1714 \end_layout
1716 \end_inset
1717 </cell>
1718 </row>
1719 <row>
1720 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1721 \begin_inset Text
1723 \begin_layout Plain Layout
1724 2 bytes
1725 \end_layout
1727 \end_inset
1728 </cell>
1729 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1730 \begin_inset Text
1732 \begin_layout Plain Layout
1734 \end_layout
1736 \end_inset
1737 </cell>
1738 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1739 \begin_inset Text
1741 \begin_layout Plain Layout
1743 \end_layout
1745 \end_inset
1746 </cell>
1747 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1748 \begin_inset Text
1750 \begin_layout Plain Layout
1752 \end_layout
1754 \end_inset
1755 </cell>
1756 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1757 \begin_inset Text
1759 \begin_layout Plain Layout
1761 \end_layout
1763 \end_inset
1764 </cell>
1765 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1766 \begin_inset Text
1768 \begin_layout Plain Layout
1770 \end_layout
1772 \end_inset
1773 </cell>
1774 </row>
1775 <row>
1776 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1777 \begin_inset Text
1779 \begin_layout Plain Layout
1780 3 bytes
1781 \end_layout
1783 \end_inset
1784 </cell>
1785 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1786 \begin_inset Text
1788 \begin_layout Plain Layout
1790 \end_layout
1792 \end_inset
1793 </cell>
1794 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1795 \begin_inset Text
1797 \begin_layout Plain Layout
1799 \end_layout
1801 \end_inset
1802 </cell>
1803 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1804 \begin_inset Text
1806 \begin_layout Plain Layout
1808 \end_layout
1810 \end_inset
1811 </cell>
1812 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1813 \begin_inset Text
1815 \begin_layout Plain Layout
1817 \end_layout
1819 \end_inset
1820 </cell>
1821 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1822 \begin_inset Text
1824 \begin_layout Plain Layout
1826 \end_layout
1828 \end_inset
1829 </cell>
1830 </row>
1831 <row>
1832 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1833 \begin_inset Text
1835 \begin_layout Plain Layout
1836 4 bytes
1837 \end_layout
1839 \end_inset
1840 </cell>
1841 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1842 \begin_inset Text
1844 \begin_layout Plain Layout
1846 \end_layout
1848 \end_inset
1849 </cell>
1850 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1851 \begin_inset Text
1853 \begin_layout Plain Layout
1855 \end_layout
1857 \end_inset
1858 </cell>
1859 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1860 \begin_inset Text
1862 \begin_layout Plain Layout
1864 \end_layout
1866 \end_inset
1867 </cell>
1868 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1869 \begin_inset Text
1871 \begin_layout Plain Layout
1873 \end_layout
1875 \end_inset
1876 </cell>
1877 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1878 \begin_inset Text
1880 \begin_layout Plain Layout
1882 \end_layout
1884 \end_inset
1885 </cell>
1886 </row>
1887 </lyxtabular>
1889 \end_inset
1892 \end_layout
1894 \begin_layout Standard
1895 Blocks which encode values greater than what is possible for value of that
1896  length are fatal errors.
1898 \end_layout
1900 \begin_layout Subsection
1901 Line component encoing
1902 \end_layout
1904 \begin_layout Standard
1905 Line component encoding sits on top of UTF-8 encoding.
1906  Line component encoding encodes non-empty 1-D array of non-empty strings
1907  into line, and thus array of those into member.
1908  Empty lines or lines that don't contain any components are ignored.
1909  Line starts with depth value of 0 and must end with depth value of zero.
1910 \end_layout
1912 \begin_layout Standard
1913 Components are seperated by component separators.
1914  Empty components are ignored.
1915  Following codepoints are separators on depth 0 if not escaped:
1916 \end_layout
1918 \begin_layout Itemize
1919 Codepoint of '('.
1920  The depth is read pre-increment.
1921 \end_layout
1923 \begin_layout Itemize
1924 Codepoint of ')'.
1925  The depth is read post-decrement.
1926 \end_layout
1928 \begin_layout Itemize
1929 Any SPACE character
1930 \end_layout
1932 \begin_layout Standard
1933 The following characters are special:
1934 \end_layout
1936 \begin_layout Itemize
1937 '('.
1938  Increments depth by 1 if not escaped (and appears in component).
1939 \end_layout
1941 \begin_layout Itemize
1942 ')'.
1943  Decrements depth by 1 if not escaped (and appears in component).
1944  Depth going negative is an error.
1945 \end_layout
1947 \begin_layout Itemize
1949 \backslash
1951  Next character is interpretted as literal.
1952  Error if at end of line.
1953 \end_layout
1955 \begin_layout Standard
1956 Otherwise, characters are interpretted as literals and appear in components.
1957  Depth must be zero at end of line.
1958 \end_layout
1960 \begin_layout Subsection
1961 Header section:
1962 \end_layout
1964 \begin_layout Standard
1965 Header section is in archive member "header".
1966  It uses line component encoding.
1967  The first component of each line is name of header, and subsequent ones
1968  are arguments.
1969  How many parameters are expected is dependent on what header it is:
1970 \end_layout
1972 \begin_layout Subsubsection
1973 PROJECTID header:
1974 \end_layout
1976 \begin_layout Itemize
1977 Header name: "PROJECTID"
1978 \end_layout
1980 \begin_layout Itemize
1981 Components: 2
1982 \end_layout
1984 \begin_layout Itemize
1985 Argument #1: <project-id-string>
1986 \end_layout
1988 \begin_layout Itemize
1989 Mandatory: Yes
1990 \end_layout
1992 \begin_layout Standard
1993 Gives project ID.
1994  Project ID is generated when PC is assembled and is then preserved in save
1995  states.
1996  It is used for computing rerecord counts.
1997  Emulator treats it as opaque string, the IDs it generates are formed by
1998  48 random hexadecimal digits.
1999 \end_layout
2001 \begin_layout Subsubsection
2002 SAVESTATEID header:
2003 \end_layout
2005 \begin_layout Itemize
2006 Header name: "SAVESTATEID"
2007 \end_layout
2009 \begin_layout Itemize
2010 Components: 2
2011 \end_layout
2013 \begin_layout Itemize
2014 Argument #1: <savestate-id-string>
2015 \end_layout
2017 \begin_layout Itemize
2018 Mandatory: No
2019 \end_layout
2021 \begin_layout Standard
2022 Gives save state ID.
2023  Each save state has its own save state ID.
2024  Treated as opaque string, but generated as 48 random hexadecimal digits.
2025  The presence of this header signals whether there is save state to be loaded.
2026  If this header is present, save state load will be attempted.
2027  If absent, save state is not to be loaded even if present (and correct
2028  savestate load would be technically impossible anyway).
2029 \end_layout
2031 \begin_layout Standard
2032 The value is used to prevent loading incompatible save states in preserve
2033  event stream mode and also to find the point in event stream where one
2034  left off.
2035 \end_layout
2037 \begin_layout Subsubsection
2038 RERECORDS header:
2039 \end_layout
2041 \begin_layout Itemize
2042 Header name: "RERECORDS"
2043 \end_layout
2045 \begin_layout Itemize
2046 Components: 2
2047 \end_layout
2049 \begin_layout Itemize
2050 Argument #1: <rerecords>
2051 \end_layout
2053 \begin_layout Itemize
2054 Mandatory: Yes
2055 \end_layout
2057 \begin_layout Standard
2058 Gives rerecord count.
2059  PC assembly (except when loading save state) initializes current rerecord
2060  count to zero.
2061  Must be non-negative and decimal number using ASCII digit characters.
2062 \end_layout
2064 \begin_layout LyX-Code
2065 On loading save state:
2066 \end_layout
2068 \begin_layout LyX-Code
2069 1) If project ID matches with previous:
2070 \end_layout
2072 \begin_layout LyX-Code
2073 1a) If loaded rerecord count is larger or equal to current rerecord count:
2074 \end_layout
2076 \begin_layout LyX-Code
2077 1a-a) Current rerecord count is loaded rerecord count + 1.
2078 \end_layout
2080 \begin_layout LyX-Code
2081 1b) Otherwise
2082 \end_layout
2084 \begin_layout LyX-Code
2085 1b-a) Current rerecord count increments by 1.
2086 \end_layout
2088 \begin_layout LyX-Code
2089 2) Otherwise
2090 \end_layout
2092 \begin_layout LyX-Code
2093 2a) Current rerecord count is loaded rerecord count + 1.
2094 \end_layout
2096 \begin_layout Standard
2097 The current rerecord count at time of save is saved to save state.
2098 \end_layout
2100 \begin_layout Subsubsection
2101 AUTHORS header:
2102 \end_layout
2104 \begin_layout Itemize
2105 Header name: "AUTHORS"
2106 \end_layout
2108 \begin_layout Itemize
2109 Components: 2 or more
2110 \end_layout
2112 \begin_layout Itemize
2113 Arguments: free form
2114 \end_layout
2116 \begin_layout Itemize
2117 Mandatory: No
2118 \end_layout
2120 \begin_layout Standard
2121 Gives authors of run.
2122  Each argument gives one author.
2123  May be present multiple times.
2124 \end_layout
2126 \begin_layout Subsubsection
2127 COMMENT header:
2128 \end_layout
2130 \begin_layout Itemize
2131 Header name: "COMMENT"
2132 \end_layout
2134 \begin_layout Itemize
2135 Components: 2 or more
2136 \end_layout
2138 \begin_layout Itemize
2139 Arguments: free form
2140 \end_layout
2142 \begin_layout Itemize
2143 Mandatory: No
2144 \end_layout
2146 \begin_layout Standard
2147 Various kinds of free form data.
2148  Not parsed further by emulator.
2149 \end_layout
2151 \begin_layout Subsection
2152 Initialization segment:
2153 \end_layout
2155 \begin_layout Standard
2156 If SAVESTATEID header isn't present (not a save state), member "initialization"
2157  gives PC initialization parameters for assembling the PC.
2158  It is present anyway even if SAVESTATEID is present (savestate).
2159 \end_layout
2161 \begin_layout Standard
2162 Following parameters are used (space separates components):
2163 \end_layout
2165 \begin_layout LyX-Code
2166 "BIOS" <id>
2167 \end_layout
2169 \begin_layout Standard
2170 Gives Image ID of main system BIOS (mandatory)
2171 \end_layout
2173 \begin_layout LyX-Code
2174 "VGABIOS" <id>
2175 \end_layout
2177 \begin_layout Standard
2178 Gives Image ID of VGA BIOS (mandatory).
2179 \end_layout
2181 \begin_layout LyX-Code
2182 "HDA" <id>
2183 \end_layout
2185 \begin_layout Standard
2186 Gives Image ID of hda.
2187  Present only if system has hard disk hda.
2188 \end_layout
2190 \begin_layout LyX-Code
2191 "HDB" <id>
2192 \end_layout
2194 \begin_layout Standard
2195 Gives Image ID of hdb.
2196  Present only if system has hard disk hdb.
2197 \end_layout
2199 \begin_layout LyX-Code
2200 "HDC" <id>
2201 \end_layout
2203 \begin_layout Standard
2204 Gives Image ID of hdc.
2205  Present only if system has hard disk hdc.
2206 \end_layout
2208 \begin_layout LyX-Code
2209 "HDD" <id>
2210 \end_layout
2212 \begin_layout Standard
2213 Gives Image ID of hdd.
2214  Present only if system has hard disk hdd.
2215 \end_layout
2217 \begin_layout LyX-Code
2218 "DISK" <num> <id>
2219 \end_layout
2221 \begin_layout Standard
2222 Gives Image ID of disk in slot <num>.
2223  Slot number must be non-negative.
2224 \end_layout
2226 \begin_layout LyX-Code
2227 \begin_inset Quotes eld
2228 \end_inset
2230 DISKNAME
2231 \begin_inset Quotes erd
2232 \end_inset
2234  <num> <name>
2235 \end_layout
2237 \begin_layout Standard
2238 kGives image name of disk in slot <num>.
2239  Slot number must be non-negative.
2240  The slot must be previously declared using 
2241 \begin_inset Quotes eld
2242 \end_inset
2244 DISK
2245 \begin_inset Quotes erd
2246 \end_inset
2249 \end_layout
2251 \begin_layout LyX-Code
2252 "FDA" <num>
2253 \end_layout
2255 \begin_layout Standard
2256 Gives Image slot to initially put into floppy drive fda.
2257  Disk must be of floppy type.
2258  If none present, no disk is initially put there.
2259 \end_layout
2261 \begin_layout LyX-Code
2262 "FDB" <num>
2263 \end_layout
2265 \begin_layout Standard
2266 Gives Image slot to initially put into floppy drive fdb.
2267  Disk must be of floppy type.
2268  If none present, no disk is initially put there.
2269 \end_layout
2271 \begin_layout LyX-Code
2272 "CDROM" <num>
2273 \end_layout
2275 \begin_layout Standard
2276 Gives Image slot to initially put into CD-ROM drive hdc.
2277  Not allowed if hard disk hdc is present.
2278  Disk must be of CD-ROM type.
2279  If none present no disk is initially put there.
2280 \end_layout
2282 \begin_layout LyX-Code
2283 "INITIALTIME" <time>
2284 \end_layout
2286 \begin_layout Standard
2287 Number of milliseconds since Unix epoch to system start up time.
2288  Allowed range:
2289 \end_layout
2291 \begin_layout Standard
2292 0-4102444799999.
2293  Mandatory.
2294 \end_layout
2296 \begin_layout LyX-Code
2297 "CPUDIVIDER" <divider>
2298 \end_layout
2300 \begin_layout Standard
2301 Set CPU frequency divider (dividing the 1GHz master clock).
2302  Allowed range is 1-256.
2303  Mandatory.
2304 \end_layout
2306 \begin_layout LyX-Code
2307 "MEMORYSIZE" <pages>
2308 \end_layout
2310 \begin_layout Standard
2311 Number of 4KiB pages of RAM memory.
2312  Allowed range 256-262144.
2313  Mandatory.
2314 \end_layout
2316 \begin_layout LyX-Code
2317 "BOOT" <device>
2318 \end_layout
2320 \begin_layout Standard
2321 Set boot device.
2322  Valid devices are "FLOPPY" (boot from fda), "HDD" (boot from hda) and "CDROM"
2323  (boot from CD).
2324 \end_layout
2326 \begin_layout LyX-Code
2327 "LOADMODULEA" <module> <parameters>
2328 \end_layout
2330 \begin_layout Standard
2331 Load module <module> with parameters <parameters>.
2332 \end_layout
2334 \begin_layout LyX-Code
2335 "LOADMODULE" <module>
2336 \end_layout
2338 \begin_layout Standard
2339 Load module <module> with no parameters
2340 \end_layout
2342 \begin_layout LyX-Code
2343 \begin_inset Quotes eld
2344 \end_inset
2347 \begin_inset Quotes erd
2348 \end_inset
2350  <fpu>
2351 \end_layout
2353 \begin_layout Standard
2354 Use class <fpu> as FPU emulator.
2355 \end_layout
2357 \begin_layout LyX-Code
2358 \begin_inset Quotes eld
2359 \end_inset
2361 IOPORTDELAY
2362 \begin_inset Quotes erd
2363 \end_inset
2366 \end_layout
2368 \begin_layout Standard
2369 Use I/O port delay emulation (each I/O port read/write takes 666ns).
2370 \end_layout
2372 \begin_layout LyX-Code
2373 \begin_inset Quotes eld
2374 \end_inset
2376 VGAHRETRACE
2377 \begin_inset Quotes erd
2378 \end_inset
2381 \end_layout
2383 \begin_layout Standard
2384 Emulate VGA horizontal retrace.
2385 \end_layout
2387 \begin_layout Subsection
2388 Event record format:
2389 \end_layout
2391 \begin_layout Standard
2392 Event record is in archive member "events".
2393  It uses line component encoding.
2394  Each line gives an event.
2395  First component of each line gives time stamp.
2396  These timestamps MUST be in increasing order and all MUST be non-negative.
2397  Time stamp time unit is exactly 1 nanosecond of emulated time.
2398 \end_layout
2400 \begin_layout Standard
2401 The second component of each line is name of class to dispatch to.
2402  Further components are passed as-is to event handlers.
2403  Classes with names consisting only of uppercase A-Z and 0-9 are special
2404  and reserved.
2405  It is error to encounter unknown such special class.
2406 \end_layout
2408 \begin_layout Subsubsection
2409 Savestate event
2410 \end_layout
2412 \begin_layout Itemize
2413 Dispatch to: SAVESTATE
2414 \end_layout
2416 \begin_layout Itemize
2417 Argument #1: Savestate id
2418 \end_layout
2420 \begin_layout Itemize
2421 Argument #2 (optional): Rerecord count at time of saving savestate
2422 \end_layout
2424 \begin_layout Standard
2425 Signals that savestate has occured here.
2426  The save state IDs MUST be unique in entire event stream.
2427  The second argument to savestate (if present) is rerecord count at time
2428  of saving that savestate (useful for calulating rerecord count of movie
2429  starting from savestate).
2430  No time restrictions
2431 \end_layout
2433 \begin_layout Subsubsection
2434 Option event
2435 \end_layout
2437 \begin_layout Itemize
2438 Dispatch to: OPTION
2439 \end_layout
2441 \begin_layout Itemize
2442 Argument #1: 
2443 \begin_inset Quotes eld
2444 \end_inset
2446 ABSOLUTE
2447 \begin_inset Quotes erd
2448 \end_inset
2450  or 
2451 \begin_inset Quotes eld
2452 \end_inset
2454 RELATIVE
2455 \begin_inset Quotes erd
2456 \end_inset
2459 \end_layout
2461 \begin_layout Standard
2462 Controls various options.
2464 \begin_inset Quotes eld
2465 \end_inset
2467 ABSOLUTE
2468 \begin_inset Quotes erd
2469 \end_inset
2471  turns on absolute mode (default) where event timestamps are absolute.
2473 \begin_inset Quotes eld
2474 \end_inset
2476 RELATIVE
2477 \begin_inset Quotes erd
2478 \end_inset
2480  turns on relative mode where event timestamps are relative to last event
2481  in stream.
2482  The OPTION event itself is not affected by timing change.
2483  No time restrictions.
2484  Unknown arguments are errors.
2485 \end_layout
2487 \begin_layout Subsubsection
2488 Keyboard keypress/keyrelease event:
2489 \end_layout
2491 \begin_layout Itemize
2492 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2493 \end_layout
2495 \begin_layout Itemize
2496 Argument #1: Fixed: "KEYEDGE"
2497 \end_layout
2499 \begin_layout Itemize
2500 Argument #2: Key number.
2501  Valid values are 1-83, 85-95, 129-197 and 199-223
2502 \end_layout
2504 \begin_layout Standard
2505 Send key press or key release.
2506  Keys work in toggle button manner.
2507  The event time must be multiple of 66 666, and must not be less than 60
2508  * 66 666 TUs after last PAUSE event, 20 * 66 666 TUs after last KEYEDGE
2509  on key >128 and 10 * 66 666 TUs after last KEYEDGE on key <128.
2510 \end_layout
2512 \begin_layout Subsubsection
2513 Pause event:
2514 \end_layout
2516 \begin_layout Itemize
2517 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2518 \end_layout
2520 \begin_layout Itemize
2521 Argument #1: Fixed: "PAUSE"
2522 \end_layout
2524 \begin_layout Standard
2525 Send pause key event.
2526  The time restrictions are identical to KEYEDGE event.
2527 \end_layout
2529 \begin_layout Subsubsection
2530 Mouse button event:
2531 \end_layout
2533 \begin_layout Itemize
2534 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2535 \end_layout
2537 \begin_layout Itemize
2538 Argument #1: Fixed: "MOUSEBUTTON"
2539 \end_layout
2541 \begin_layout Itemize
2542 Argument #2: Number of button to release or press (0-4)
2543 \end_layout
2545 \begin_layout Standard
2546 Presses or releases the designated mouse button.
2547 \end_layout
2549 \begin_layout Subsubsection
2550 X mouse motion event:
2551 \end_layout
2553 \begin_layout Itemize
2554 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2555 \end_layout
2557 \begin_layout Itemize
2558 Argument #1: Fixed: "XMOUSEMOTION"
2559 \end_layout
2561 \begin_layout Itemize
2562 Argument #2: Number of units to move (-255 - 255)
2563 \end_layout
2565 \begin_layout Standard
2566 Move the mouse in X direction by specified amount.
2567  Positive is right.
2568 \end_layout
2570 \begin_layout Subsubsection
2571 Y mouse motion event:
2572 \end_layout
2574 \begin_layout Itemize
2575 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2576 \end_layout
2578 \begin_layout Itemize
2579 Argument #1: Fixed: "YMOUSEMOTION"
2580 \end_layout
2582 \begin_layout Itemize
2583 Argument #2: Number of units to move (-255 - 255)
2584 \end_layout
2586 \begin_layout Standard
2587 Move the mouse in Y direction by specified amount.
2588  Positive is up.
2589 \end_layout
2591 \begin_layout Subsubsection
2592 Z mouse motion event:
2593 \end_layout
2595 \begin_layout Itemize
2596 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2597 \end_layout
2599 \begin_layout Itemize
2600 Argument #1: Fixed: "ZMOUSEMOTION"
2601 \end_layout
2603 \begin_layout Itemize
2604 Argument #2: Number of units to move (-7 - 7)
2605 \end_layout
2607 \begin_layout Standard
2608 Move the mouse in Z direction (scrollwheel) by specified amount.
2609 \end_layout
2611 \begin_layout Subsubsection
2612 Joystick button event:
2613 \end_layout
2615 \begin_layout Itemize
2616 Dispatch to: org.jpc.modules.Joystick
2617 \end_layout
2619 \begin_layout Itemize
2620 Argument #1: 
2621 \begin_inset Quotes eld
2622 \end_inset
2624 BUTTONA
2625 \begin_inset Quotes erd
2626 \end_inset
2629 \begin_inset Quotes eld
2630 \end_inset
2632 BUTTONB
2633 \begin_inset Quotes erd
2634 \end_inset
2637 \begin_inset Quotes eld
2638 \end_inset
2640 BUTTONC
2641 \begin_inset Quotes erd
2642 \end_inset
2644  or 
2645 \begin_inset Quotes eld
2646 \end_inset
2648 BUTTOND
2649 \begin_inset Quotes erd
2650 \end_inset
2653 \end_layout
2655 \begin_layout Itemize
2656 Argument #2: 
2657 \begin_inset Quotes eld
2658 \end_inset
2661 \begin_inset Quotes erd
2662 \end_inset
2664  if released, 
2665 \begin_inset Quotes eld
2666 \end_inset
2669 \begin_inset Quotes erd
2670 \end_inset
2672  if pressed
2673 \end_layout
2675 \begin_layout Standard
2676 Send button down/up event.
2677  No time restrictions.
2678 \end_layout
2680 \begin_layout Subsubsection
2681 Joystick axis event:
2682 \end_layout
2684 \begin_layout Itemize
2685 Dispatch to: org.jpc.modules.Joystick
2686 \end_layout
2688 \begin_layout Itemize
2689 Argument #1: 
2690 \begin_inset Quotes eld
2691 \end_inset
2693 AXISA
2694 \begin_inset Quotes erd
2695 \end_inset
2698 \begin_inset Quotes eld
2699 \end_inset
2701 AXISB
2702 \begin_inset Quotes erd
2703 \end_inset
2706 \begin_inset Quotes eld
2707 \end_inset
2709 AXISC
2710 \begin_inset Quotes erd
2711 \end_inset
2713  or 
2714 \begin_inset Quotes eld
2715 \end_inset
2717 AXISD
2718 \begin_inset Quotes erd
2719 \end_inset
2722 \end_layout
2724 \begin_layout Itemize
2725 Argument #2: Multivibrator unstable state length in ns.
2726 \end_layout
2728 \begin_layout Standard
2729 Set amount of time multivibrator remains in unstable state.
2730  No time restrictions.
2731 \end_layout
2733 \begin_layout Subsubsection
2734 Reboot:
2735 \end_layout
2737 \begin_layout Itemize
2738 Dispatch to: org.jpc.emulator.PC$ResetButton
2739 \end_layout
2741 \begin_layout Itemize
2742 No arguments
2743 \end_layout
2745 \begin_layout Standard
2746 Reboots the PC.
2747 \end_layout
2749 \begin_layout Subsubsection
2750 Fda disk change:
2751 \end_layout
2753 \begin_layout Itemize
2754 Dispatch to: org.jpc.emulator.PC$DiskChanger
2755 \end_layout
2757 \begin_layout Itemize
2758 Argument #1: Fixed: "FDA"
2759 \end_layout
2761 \begin_layout Itemize
2762 Argument #2: Number of image slot to put there.
2764 \end_layout
2766 \begin_layout Standard
2767 The disk number MUST be -1 or valid disk number.
2768  -1 MUST NOT be used if there is no disk in floppy drive A.
2769  This event causes specified disk to be placed to FDA or FDA disk to be
2770  ejected with no replacement if disk number is -1.
2771  The specified disk if not -1 must be of floppy type.
2772  The specified disk if valid must not be in any other drive.
2773 \end_layout
2775 \begin_layout Subsubsection
2776 Fdb disk change:
2777 \end_layout
2779 \begin_layout Itemize
2780 Dispatch to: org.jpc.emulator.PC$DiskChanger
2781 \end_layout
2783 \begin_layout Itemize
2784 Argument #1: Fixed: "FDB"
2785 \end_layout
2787 \begin_layout Itemize
2788 Argument #2: Number of image slot to put there.
2790 \end_layout
2792 \begin_layout Standard
2793 The disk number MUST be -1 or valid disk number.
2794  -1 MUST NOT be used if there is no disk in floppy drive B.
2795  This event causes specified disk to be placed to FDB or FDB disk to be
2796  ejected with no replacement if disk number is -1.
2797  The specified disk if not -1 must be of floppy type.
2798  The specified disk if valid must not be in any other drive.
2799 \end_layout
2801 \begin_layout Subsubsection
2802 Change CDROM:
2803 \end_layout
2805 \begin_layout Itemize
2806 Dispatch to: org.jpc.emulator.PC$DiskChanger
2807 \end_layout
2809 \begin_layout Itemize
2810 Argument #1: Fixed: "CDROM"
2811 \end_layout
2813 \begin_layout Itemize
2814 Argument #2: Number of image slot to put there.
2816 \end_layout
2818 \begin_layout Standard
2819 The disk number MUST be -1 or valid disk number.
2820  -1 MUST NOT be used if there is no disk in CD-ROM.
2821  This event causes specified disk to be placed to CD-ROM or CD-ROM disk
2822  to be ejected with no replacement if disk number is -1.
2823  The specified disk if not -1 must be of CD-ROM type.
2824 \end_layout
2826 \begin_layout Standard
2827 This event has no effect if CD-ROM is locked.
2828 \end_layout
2830 \begin_layout Subsubsection
2831 Write protect floppy:
2832 \end_layout
2834 \begin_layout Itemize
2835 Dispatch to: org.jpc.emulator.PC$DiskChanger
2836 \end_layout
2838 \begin_layout Itemize
2839 Argument #1: Fixed: "WRITEPROTECT"
2840 \end_layout
2842 \begin_layout Itemize
2843 Argument #2: Number of image slot to manipulate 
2844 \end_layout
2846 \begin_layout Standard
2847 Write protects specified disk.
2848  The disk MUST NOT be in any drive and MUST be valid floppy-type disk.
2849 \end_layout
2851 \begin_layout Subsubsection
2852 Write unprotect floppy:
2853 \end_layout
2855 \begin_layout Itemize
2856 Dispatch to: org.jpc.emulator.PC$DiskChanger
2857 \end_layout
2859 \begin_layout Itemize
2860 Argument #1: Fixed: "WRITEUNPROTECT"
2861 \end_layout
2863 \begin_layout Itemize
2864 Argument #2: Number of image slot to manipulate 
2865 \end_layout
2867 \begin_layout Standard
2868 Disables write protection specified disk.
2869  The disk MUST NOT be in any drive and MUST be valid floppy-type disk.
2870 \end_layout
2872 \begin_layout Subsection
2873 Diskinfo sections
2874 \end_layout
2876 \begin_layout Standard
2877 Diskinfo sections are named 
2878 \begin_inset Quotes eld
2879 \end_inset
2881 diskinfo-
2882 \begin_inset Quotes erd
2883 \end_inset
2885 <id of disk>.
2886  They use line component encoding, fieldtype being first component on each
2887  line (value being the second).
2888  Following fields are defined:
2889 \end_layout
2891 \begin_layout Subsubsection
2892 TYPE
2893 \end_layout
2895 \begin_layout Standard
2896 Gives type of image.
2897  Possible values are
2898 \end_layout
2900 \begin_layout Itemize
2901 \begin_inset Quotes eld
2902 \end_inset
2904 FLOPPY
2905 \begin_inset Quotes erd
2906 \end_inset
2908  (floppy disk)
2909 \end_layout
2911 \begin_layout Itemize
2912 \begin_inset Quotes eld
2913 \end_inset
2916 \begin_inset Quotes erd
2917 \end_inset
2919  (Hard disk)
2920 \end_layout
2922 \begin_layout Itemize
2923 \begin_inset Quotes eld
2924 \end_inset
2926 CDROM
2927 \begin_inset Quotes erd
2928 \end_inset
2930  (CD-ROM)
2931 \end_layout
2933 \begin_layout Itemize
2934 \begin_inset Quotes eld
2935 \end_inset
2937 BIOS
2938 \begin_inset Quotes erd
2939 \end_inset
2941  (BIOS/VGABIOS image)
2942 \end_layout
2944 \begin_layout Itemize
2945 \begin_inset Quotes eld
2946 \end_inset
2948 UNKNOWN
2949 \begin_inset Quotes erd
2950 \end_inset
2952  (what the heck is this???)
2953 \end_layout
2955 \begin_layout Subsubsection
2957 \end_layout
2959 \begin_layout Standard
2960 Gives ID of disk.
2961 \end_layout
2963 \begin_layout Subsubsection
2964 IMAGELENGTH
2965 \end_layout
2967 \begin_layout Standard
2968 (BIOS images only) Gives length of BIOS image
2969 \end_layout
2971 \begin_layout Subsubsection
2972 IMAGEMD5
2973 \end_layout
2975 \begin_layout Standard
2976 MD5 of raw disk/BIOS image without any headers or trailers.
2977 \end_layout
2979 \begin_layout Subsubsection
2980 TOTALSECTORS
2981 \end_layout
2983 \begin_layout Standard
2984 (FLOPPY/HDD/CDROM images only) Number of total sectors on disk.
2985 \end_layout
2987 \begin_layout Subsubsection
2988 TRACKS
2989 \end_layout
2991 \begin_layout Standard
2992 (FLOPPY/HDD images only) Number of tracks on disk per side (1-256 for floppy,
2993  1-1024 for HDD).
2994 \end_layout
2996 \begin_layout Subsubsection
2997 SIDES
2998 \end_layout
3000 \begin_layout Standard
3001 (FLOPPY/HDD images only) Number of sides on disk (1 or 2 for floppy, 1-16
3002  for HDD).
3003 \end_layout
3005 \begin_layout Subsubsection
3006 SECTORS
3007 \end_layout
3009 \begin_layout Standard
3010 (FLOPPY/HDD images only) Number of sectors per track (1-255 for floppy,
3011  1-63 for HDD).
3012 \end_layout
3014 \begin_layout Subsubsection
3015 COMMENT
3016 \end_layout
3018 \begin_layout Standard
3019 Line from image comment block.
3020  Usually give data about files image has.
3021  May or may not be present (multiple times)
3022 \end_layout
3024 \begin_layout Subsection
3025 Output info
3026 \end_layout
3028 \begin_layout Standard
3029 Output info is stored in section 
3030 \begin_inset Quotes eld
3031 \end_inset
3033 output-info
3034 \begin_inset Quotes erd
3035 \end_inset
3038  Its relatively new, so it might not be present (then the contents have
3039  to be guessed based on modules present).
3040  Each line gives information about one output, first field being the type
3041  of output.
3042 \end_layout
3044 \begin_layout Subsubsection
3045 Video output
3046 \end_layout
3048 \begin_layout Standard
3049 For video output, there are no parameters so line is just 
3050 \begin_inset Quotes eld
3051 \end_inset
3053 VIDEO
3054 \begin_inset Quotes erd
3055 \end_inset
3057  (one component).
3058 \end_layout
3060 \begin_layout Subsubsection
3061 Audio output
3062 \end_layout
3064 \begin_layout Standard
3065 For audio output, the only parameter is name of output, so first component
3066  is 
3067 \begin_inset Quotes eld
3068 \end_inset
3070 AUDIO
3071 \begin_inset Quotes erd
3072 \end_inset
3074  and second component is name of audio output.
3075 \end_layout
3077 \begin_layout Subsection
3078 Savestates
3079 \end_layout
3081 \begin_layout Standard
3082 Actual savestate format is not documented here.
3083  It is close to impossible to comprehend without access to emulator source
3084  anyway.
3085 \end_layout
3087 \begin_layout Section
3088 Advanced: Making class dumpable
3089 \end_layout
3091 \begin_layout Standard
3092 Class is made dumpable by implementing interface org.jpc.emulator.SRDumpable
3093  and implementing method dumpSRPartial(org.jpc.emulator.SRDumper) and constructor
3094  <init>(org.jpc.emulator.SRLoader).
3095  Non-static inner classes can not be dumpable (make them static using tricks
3096  similar to what javac uses).
3097 \end_layout
3099 \begin_layout Standard
3100 If dumped class has dumpable superclass, the first thing dumping function
3101  needs to do is to call dumper function of superclass and first thing loading
3102  constructor needs to do is to call loading constructor of superclass.
3103  If class has no dumpable superclass, dumper doesn't need to do anything
3104  special, while loader needs to call objectCreated(this) on SRLoader object
3105  passed as parameter.
3107 \end_layout
3109 \begin_layout Standard
3110 Following these fixed parts, dump all members that are part of mutable state
3111  in emulator core.
3112 \end_layout
3114 \begin_layout Subsection
3115 Member dumping/loading functions
3116 \end_layout
3118 \begin_layout Standard
3119 There is dumping/loading function for following (all functions dumping/loading
3120  reference types can handle null):
3121 \end_layout
3123 \begin_layout Itemize
3124 boolean: SRDumper.dumpBoolean, SRLoader.loadBoolean
3125 \end_layout
3127 \begin_layout Itemize
3128 byte: SRDumper.dumpByte, SRLoader.loadByte
3129 \end_layout
3131 \begin_layout Itemize
3132 short: SRDumper.dumpShort, SRLoader.loadShort
3133 \end_layout
3135 \begin_layout Itemize
3136 int: SRDumper.dumpInt, SRLoader.loadInt
3137 \end_layout
3139 \begin_layout Itemize
3140 long: SRDumper.dumpLong, SRLoader.loadLong
3141 \end_layout
3143 \begin_layout Itemize
3144 String: SRDumper.dumpString, SRLoader.loadString
3145 \end_layout
3147 \begin_layout Itemize
3148 boolean[]: SRDumper.dumpArray, SRLoader.loadArrayBoolean
3149 \end_layout
3151 \begin_layout Itemize
3152 byte[]: SRDumper.dumpArray, SRLoader.loadArrayByte
3153 \end_layout
3155 \begin_layout Itemize
3156 short[]: SRDumper.dumpArray, SRLoader.loadArrayShort
3157 \end_layout
3159 \begin_layout Itemize
3160 int[]: SRDumper.dumpArray, SRLoader.loadArrayInt
3161 \end_layout
3163 \begin_layout Itemize
3164 long[]: SRDumper.dumpArray, SRLoader.loadArrayLong
3165 \end_layout
3167 \begin_layout Itemize
3168 double[]: SRDumper.dumpArray, SRLoader.loadArrayDouble
3169 \end_layout
3171 \begin_layout Itemize
3172 <dumpable type>: SRDumper.dumpObject, SRLoader.loadObject
3173 \end_layout
3175 \begin_layout Itemize
3176 special object: SRDumper.specialObject, SRLoader.specialObject
3177 \end_layout
3179 \begin_layout Subsubsection
3180 Notes:
3181 \end_layout
3183 \begin_layout Itemize
3184 Dumpable objects come out as type of org.jpc.emulator.SRDumpable.
3185 \end_layout
3187 \begin_layout Itemize
3188 Special objects are various static objects that don't need to be stored
3189  because they don't have mutable fields.
3190 \end_layout
3192 \begin_layout Itemize
3193 Don't dump fields related to event state feedback.
3194 \end_layout
3196 \begin_layout Itemize
3197 Don't dump temporary flags that are only used while PC is running.
3198  Savestate when PC is running isn't possible anyway.
3199 \end_layout
3201 \begin_layout Itemize
3202 Some connectors dump fields related to connector output, some don't.
3203 \end_layout
3205 \begin_layout Section
3206 Advanced: Making output connectors
3207 \end_layout
3209 \begin_layout Standard
3210 Implementing interface org.jpc.emulator.DisplayController signals that this
3211  is display controller, inhibiting loading of the standard VGA display controlle
3212 r if loaded as module.
3214 \end_layout
3216 \begin_layout Subsection
3217 Interface org.jpc.emulator.OutputConnector
3218 \end_layout
3220 \begin_layout Standard
3221 Class is made to be output connector by implementing this interface.
3222  This interface specifies the methods used for output hold locking.
3223  Class org.jpc.emulator.OutputConnectorLocking has implementations of these
3224  that are suitable for calling.
3226 \end_layout
3228 \begin_layout Subsubsection
3229 Method subscribeOutput(Object)
3230 \end_layout
3232 \begin_layout Standard
3233 Subscribes the output, with specified object as handle.
3234 \end_layout
3236 \begin_layout Subsubsection
3237 Method unsubscribeOutput(Object)
3238 \end_layout
3240 \begin_layout Standard
3241 Unsubscribe the specified handle object from output.
3242 \end_layout
3244 \begin_layout Subsubsection
3245 Method waitOutput(Object)
3246 \end_layout
3248 \begin_layout Standard
3249 Wait for output on specified connector using specified handle object.
3250  Returns true on success, false if wait was interrupted by thread interrupt.
3251  Blocking.
3252 \end_layout
3254 \begin_layout Subsubsection
3255 Method releaseOutput(Object)
3256 \end_layout
3258 \begin_layout Standard
3259 Release connector from p.o.v.
3260  of given handle.
3261  Does not block.
3262 \end_layout
3264 \begin_layout Subsubsection
3265 Method holdOutput()
3266 \end_layout
3268 \begin_layout Standard
3269 Release threads waiting on waitOutput() and block until all subscribers
3270  have returned from waitOutput() and enteired releaseOutput().
3271 \end_layout
3273 \begin_layout Subsubsection
3274 Method releaseOutputWaitAll(object)
3275 \end_layout
3277 \begin_layout Standard
3278 Like releaseOutput(), but waits until all handles have released their output.
3279 \end_layout
3281 \begin_layout Subsection
3282 Class org.jpc.emulator.VGADigtalOut
3283 \end_layout
3285 \begin_layout Standard
3286 Class org.jpc.emulator.VGADigtalOut (already implements OutputConnector) implements
3287  VGA output connector.
3288  If module provodes output connector, it needs to implement org.jpc.emulator.Displa
3289 yController.
3290 \end_layout
3292 \begin_layout Subsubsection
3293 Method getWidth()
3294 \end_layout
3296 \begin_layout Standard
3297 Get width of display (watch out, can return 0).
3298 \end_layout
3300 \begin_layout Subsubsection
3301 Method getHeight()
3302 \end_layout
3304 \begin_layout Standard
3305 Get height of display (watch out, can return 0).
3306 \end_layout
3308 \begin_layout Subsubsection
3309 Methods getDirtyXMin(), getDirtyXMax(), getDirtyYMin(), getDirtyYMax()
3310 \end_layout
3312 \begin_layout Standard
3313 Returns the dirty region (region modified since last output).
3314 \end_layout
3316 \begin_layout Subsubsection
3317 Method getBuffer()
3318 \end_layout
3320 \begin_layout Standard
3321 Get buffer of ints, at least width * height elements (left-to-right, top-down,
3322  one value per pixel) giving pixel data.
3323  Value for each pixel is 65536 * <red-component> + 256 * <green-component>
3324  + <blue-component>.
3325 \end_layout
3327 \begin_layout Subsubsection
3328 Method resizeDisplay(int _width, int _height)
3329 \end_layout
3331 \begin_layout Standard
3332 Resize the display to be of specified size.
3333 \end_layout
3335 \begin_layout Subsubsection
3336 Method dirtyDisplayRegion(int x, int y, int w, int h)
3337 \end_layout
3339 \begin_layout Standard
3340 Mark the specified region as dirty.
3341 \end_layout
3343 \begin_layout Subsubsection
3344 Method resetDirtyRegion()
3345 \end_layout
3347 \begin_layout Standard
3348 Resets the dirty region to be empty.
3349 \end_layout
3351 \begin_layout Subsection
3352 Class org.jpc.emulator.PC method getVideoOutput()
3353 \end_layout
3355 \begin_layout Standard
3356 Get VGA output connector for PC.
3357 \end_layout
3359 \begin_layout Subsection
3360 Interface org.jpc.emulator.DisplayController.
3361 \end_layout
3363 \begin_layout Standard
3364 Implementing this class signals that module is VGA controller.
3365  There can be only one such module active at time and presence of such module
3366  prevents loading builtin VGA controller emulation code.
3367 \end_layout
3369 \begin_layout Subsubsection
3370 Method getOutputDevice()
3371 \end_layout
3373 \begin_layout Standard
3374 Get VGA output connector for this VGA device.
3375 \end_layout
3377 \begin_layout Subsection
3378 Class org.jpc.emulator.SoundDigitalOut
3379 \end_layout
3381 \begin_layout Standard
3382 Class org.jpc.emulator.SoundDigitalOut provodes output connector for sound.
3383  Each connector can transfer stereo signal at arbitiary sampling rate.
3384  Modules that have audio connectors need to implement interface org.jpc.emulator.So
3385 undOutputDevice, as this signals that output connectors should be created.
3386 \end_layout
3388 \begin_layout Subsubsection
3389 Method addSample(long, short, short)
3390 \end_layout
3392 \begin_layout Standard
3393 Add stereo sample at time given by first argument.
3394  The second and third arguments give volume on left and right channels.
3395 \end_layout
3397 \begin_layout Subsubsection
3398 Method addSample(long, short)
3399 \end_layout
3401 \begin_layout Standard
3402 Add mono sample at time given by first argument.
3403  The second argument give volume on both channels.
3404 \end_layout
3406 \begin_layout Subsubsection
3407 Method readBlock(Block)
3408 \end_layout
3410 \begin_layout Standard
3411 Reads block of output (atomic versus addSample).
3412  Block structure has following fields which are filled:
3413 \end_layout
3415 \begin_layout Itemize
3416 timeBase: Time base for block.
3417 \end_layout
3419 \begin_layout Itemize
3420 baseLeft: Left volume at time base.
3421 \end_layout
3423 \begin_layout Itemize
3424 baseRight: Right volume at time base
3425 \end_layout
3427 \begin_layout Itemize
3428 blockNo: Sequence number of block filled.
3429 \end_layout
3431 \begin_layout Itemize
3432 samples: Number of samples in block
3433 \end_layout
3435 \begin_layout Itemize
3436 sampleTiming: Number of nanoseconds since last sample
3437 \end_layout
3439 \begin_layout Itemize
3440 sampleLeft: Left channel samples
3441 \end_layout
3443 \begin_layout Itemize
3444 sampleRight: Right channel samples
3445 \end_layout
3447 \begin_layout Subsection
3448 Interface org.jpc.emulator.SoundOutputDevice
3449 \end_layout
3451 \begin_layout Standard
3452 Implementing this interface signals that module has audio output channels.
3453 \end_layout
3455 \begin_layout Subsubsection
3456 Method org.jpc.emulator.SoundOutputDevice.requestedSoundChannels()
3457 \end_layout
3459 \begin_layout Standard
3460 Return the number of sound channels module has.
3461 \end_layout
3463 \begin_layout Subsubsection
3464 Method org.jpc.emulator.SoundOutputDevice.soundChannelCallback(SoundDigitalOut)
3465 \end_layout
3467 \begin_layout Standard
3468 This is called once per sound channel requested giving precreated sound
3469  channel.
3470 \end_layout
3472 \begin_layout Subsection
3473 Class org.jpc.emulator.PC method getSoundOut(String)
3474 \end_layout
3476 \begin_layout Standard
3477 Get sound output with specified name.
3478 \end_layout
3480 \begin_layout Section
3481 Advanced: Writing event targets
3482 \end_layout
3484 \begin_layout Standard
3485 Whereas output connectors are the way output is dispatched, input is dispatched
3486  via event targets.
3487  Event targets need to implement interface org.jpc.emulator.EventDispatchTarget.
3488 \end_layout
3490 \begin_layout Standard
3491 Event targets also provode methods which then encode events and dispatch
3492  them forward (without doing anything else) to event recorder.
3493  Also, event targets may have methods for obtaining state.
3494 \end_layout
3496 \begin_layout Subsection
3497 Interface org.jpc.emulator.EventDispatchTarget
3498 \end_layout
3500 \begin_layout Standard
3501 Interface that marks class capable of receiving events.
3502 \end_layout
3504 \begin_layout Subsubsection
3505 Method setEventRecorder(EventRecorder)
3506 \end_layout
3508 \begin_layout Standard
3509 Set the event recorder input events are sent to.
3510 \end_layout
3512 \begin_layout Subsubsection
3513 Method startEventCheck()
3514 \end_layout
3516 \begin_layout Standard
3517 Signals target to reset all state related to event checking and state feedback.
3518  This may be called at any time in order to reinitialialize event checking/feedb
3519 ack state.
3520 \end_layout
3522 \begin_layout Subsubsection
3523 Method doEvent(long, String[], int) throws IOException
3524 \end_layout
3526 \begin_layout Standard
3527 Event dispatch handler.
3528  The first argument is event time, second is parameters and third is what
3529  to do with it.
3530  If target doesn't like the event, throw IOException.
3531  Following types (the integer parameter) are used:
3532 \end_layout
3534 \begin_layout LyX-Code
3535 0 (EventRecorder.EVENT_TIMED): Time has been assigned for event.
3536 \end_layout
3538 \begin_layout LyX-Code
3539 1 (EventRecorder.EVENT_STATE_EFFECT_FUTURE): Future event in event replay
3540  for reinitialization
3541 \end_layout
3543 \begin_layout LyX-Code
3544 2 (EventRecorder.EVENT_STATE_EFFECT): Past event in event replay reinitialization
3545 \end_layout
3547 \begin_layout LyX-Code
3548 3 (EventRecorder.EVENT_EXECUTE): This event occurs now.
3549  Execute the effect.
3550 \end_layout
3552 \begin_layout Subsubsection
3553 Method endEventCheock()
3554 \end_layout
3556 \begin_layout Standard
3557 End event reinitialization.
3558  Usually unused.
3559 \end_layout
3561 \begin_layout Subsubsection
3562 Method getEventTimeLowBound(long, String[]) throws IOException
3563 \end_layout
3565 \begin_layout Standard
3566 Return the time value that's the earliest possiblity for this event to occur.
3567  Returning any time in past (including -1) causes event to fire as soon
3568  as possible.
3569  The long parameter gives the current scheduled time for event.
3570 \end_layout
3572 \begin_layout Section
3573 Writing modules
3574 \end_layout
3576 \begin_layout Standard
3577 Modules are various extensions that run inside emulator core.
3578  As such, they affect sync.
3579  Modules must implement interface org.jpc.emulator.HardwareComponent (they
3580  are hardware components) and must be dumpable.
3581  Additionally, they need either constructor <init>() or <init>(String).
3582  The first is if no parameters are passed, the second is for case where
3583  parameters are passed.
3584 \end_layout
3586 \begin_layout Standard
3587 Aside of the constructors, modules need to obey the ordinary conventions
3588  for hardware components.
3589  No code outside modules needs to know that module exists.
3590 \end_layout
3592 \begin_layout Section
3593 Writing plugins
3594 \end_layout
3596 \begin_layout Standard
3597 Plugins handle various UI tasks.
3598  They need to implement interface org.jpc.Plugin.
3599 \end_layout
3601 \begin_layout Subsection
3602 Interface org.jpc.pluginsbase.Plugin
3603 \end_layout
3605 \begin_layout Subsubsection
3606 Method systemShutdown()
3607 \end_layout
3609 \begin_layout Standard
3610 Called when emulator shuts down.
3611  Either called in dedicated thread or in thread that called emulatorShutdown().
3612  These handlers should do the bare minimum to get files on disk to consistent
3613  state.
3614  After these calls from all plugins have finished, emulator exits.
3615  Do not try to manipulate UI from these methods, as doing that easily leads
3616  into deadlock.
3617 \end_layout
3619 \begin_layout Subsubsection
3620 Method reconnect(PC) 
3621 \end_layout
3623 \begin_layout Standard
3624 Gives new PC to connect to.
3625  Null is passed if plugin should disconnect.
3626 \end_layout
3628 \begin_layout Subsubsection
3629 Method main()
3630 \end_layout
3632 \begin_layout Standard
3633 Called in dedicated thread after plugin is initialized.
3634 \end_layout
3636 \begin_layout Subsubsection
3637 Method pcStopping()
3638 \end_layout
3640 \begin_layout Standard
3641 Called after PC has stopped.
3642 \end_layout
3644 \begin_layout Subsubsection
3645 Method pcStarting()
3646 \end_layout
3648 \begin_layout Standard
3649 Called before PC starts.
3650 \end_layout
3652 \begin_layout Subsubsection
3653 Method notifyArguments(String[])
3654 \end_layout
3656 \begin_layout Standard
3657 Pass arguments from command line.
3658 \end_layout
3660 \begin_layout Subsubsection
3661 Constructor <init>(Plugins)
3662 \end_layout
3664 \begin_layout Standard
3665 This constructor is used to initialize plugins that don't take parameters.
3666 \end_layout
3668 \begin_layout Subsubsection
3669 Constructor <init>(Plugins, String)
3670 \end_layout
3672 \begin_layout Standard
3673 This constructor is used to initialize plugins that take parameters.
3674 \end_layout
3676 \begin_layout Subsection
3677 Class org.jpc.pluginsbase.Plugins
3678 \end_layout
3680 \begin_layout Standard
3681 This class provodes various methods for manipulating plugins.
3682 \end_layout
3684 \begin_layout Subsubsection
3685 Method isShuttingDown()
3686 \end_layout
3688 \begin_layout Standard
3689 Returns true if Plugins.shutdownEmulator() has been called somehow, either
3690  via VM exit, CTRL+C or explicitly.
3691  Useful to skip cleanups involving GUI, as these are too deadlock-prone.
3692 \end_layout
3694 \begin_layout Subsubsection
3695 Method shutdownEmulator()
3696 \end_layout
3698 \begin_layout Standard
3699 Shut down and exit the emulator.
3700  All plugin shutdown functions are called in this thread.
3701 \end_layout
3703 \begin_layout Subsubsection
3704 Method reconnectPC(PC)
3705 \end_layout
3707 \begin_layout Standard
3708 Signal reconnectPC event to all plugins.
3709 \end_layout
3711 \begin_layout Subsubsection
3712 Method pcStarted()
3713 \end_layout
3715 \begin_layout Standard
3716 Signal pcStarting() event to all plugins.
3717 \end_layout
3719 \begin_layout Subsubsection
3720 Method pcStopped()
3721 \end_layout
3723 \begin_layout Standard
3724 Signal pcStopping() event to all plugins.
3725 \end_layout
3727 \begin_layout Section
3728 Inter-plugin communication
3729 \end_layout
3731 \begin_layout Subsection
3732 Receiving communications
3733 \end_layout
3735 \begin_layout Standard
3736 To receive invocation/call by name 'foo-bar', declare public method named
3737  'eci_foo_bar'.
3738  Arguments to this method can currently be String, Integer (int) or Long
3739  (long).
3740  Last argument may be array over these types to get variable number of arguments.
3741  On call, each argument gets value from call.
3742  If last argument is array, it gets all overflowing arguments.
3743  If return type is void or method returns boolean false, call is assumed
3744  to have completed.
3745  If return value is boolean true, it is assumed that there is more processing.
3746 \end_layout
3748 \begin_layout Subsection
3749 void org.jpc.pluginsbase.Plugins.invokeExternalCommand(String cmd, Object[]
3750  args) 
3751 \end_layout
3753 \begin_layout Standard
3754 Invoke command asynchronously, broadcasting to all plugins.
3755  Does not wait for slow commands to complete.
3756  cmd is the name to send and args are the arguments to pass.
3757 \end_layout
3759 \begin_layout Subsection
3760 void org.jpc.pluginsbase.Plugins.invokeExternalCommandSynchronous(String cmd,
3761  Object[] args) 
3762 \end_layout
3764 \begin_layout Standard
3765 Same as invokeExternalCommand, but waits for slow commands to complete.
3766 \end_layout
3768 \begin_layout Subsection
3769 Object[] org.jpc.pluginsbase.Plugins.invokeExternalCommandReturn(String cmd,
3770  Object[] args) 
3771 \end_layout
3773 \begin_layout Standard
3774 Similar to invokeExternalCommandSynchornous, but:
3775 \end_layout
3777 \begin_layout Itemize
3778 Quits calling more plugins when it gets successful reply.
3779 \end_layout
3781 \begin_layout Itemize
3782 Returns said reply
3783 \end_layout
3785 \begin_layout Subsection
3786 void org.jpc.pluginsbase.Plugins.returnValue(Object...
3787  ret)
3788 \end_layout
3790 \begin_layout Standard
3791 Gives return value to return from call and signals that command has completed.
3792 \end_layout
3794 \begin_layout Subsection
3795 void org.jpc.pluginsbase.Plugins.signalCommandCompletion()
3796 \end_layout
3798 \begin_layout Standard
3799 Signals that command has completed.
3800  Only needed if there is no return value and eci_ method returned false
3801  (not done yet).
3802 \end_layout
3804 \begin_layout Section
3805 Lua kernel programming
3806 \end_layout
3808 \begin_layout Standard
3809 At startup, kernel gets its arguments in 'args' table and the script name
3810  to run in 'scriptname' string.
3811  It should enter the named script in protected mode.
3812 \end_layout
3814 \begin_layout Standard
3815 The Lua VM exports numerious callbacks to kernel.
3816  The kernel can then choose to omit, wrap or re-export these to Lua scripts.
3817 \end_layout
3819 \begin_layout Itemize
3820 Always grab any functions used into local variables so nobody can mess with
3821  them
3822 \end_layout
3824 \begin_layout Itemize
3825 Don't use global variables in kernel (except for those passed).
3826 \end_layout
3828 \end_body
3829 \end_document