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