1 #LyX 1.6.5 created this file. For more info see http://www.lyx.org/
6 \use_default_options true
11 \font_typewriter default
12 \font_default_family default
19 \paperfontsize default
28 \paperorientation portrait
38 \paragraph_separation indent
40 \quotes_language english
43 \paperpagestyle default
44 \tracking_changes false
60 \begin_layout Standard
61 JPC-RR is licenced under GNU GPL v2.
63 \begin_inset Quotes eld
67 \begin_inset Quotes erd
77 \begin_layout Subsection
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
85 Note: JRE is not enough.
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).
95 \begin_layout Subsection
99 \begin_layout Standard
100 See compile.sh or compile.bat.
101 The streamtools stuff is only needed for dumping videos.
104 \begin_layout Subsection
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).
115 \begin_layout Subsection
119 \begin_layout Standard
120 There is premade autoexec script called assemble.jpcrrinit that has fairly
125 \begin_layout LyX-Code
126 java JPCApplication -library library -autoexec assemble.jpcrrinit
129 \begin_layout Standard
131 \begin_inset Quotes eld
135 \begin_inset Quotes erd
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,
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
146 \begin_layout Subsection
150 \begin_layout Itemize
151 Putting the game as hdd (the fourth hard disk slot) causes boot to be bit
155 \begin_layout Itemize
156 Some BIOS versions have
157 \begin_inset Quotes eld
160 press F12 to select boot device
161 \begin_inset Quotes erd
165 Hit <enter> from emulated keyboard and that prompt will go away in about
166 half emulated second (it stays several emulated seconds otherwise).
170 \begin_layout Itemize
171 If game doesn't need lots of memory, hitting F5 to skip intialization files
173 If it does need more memory, run config.sys commands but not autoexec.bat.
177 \begin_layout Itemize
178 Some DOS disks have DOSIDLE with them, don't use it as it messes badly with
182 \begin_layout Section
183 Making JPC-RR format images from raw images
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.
192 \begin_layout Subsection
193 Importing images from GUI:
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
204 \begin_inset Quotes erd
207 if possible, that enables geometry autodetection, which is reasonable virtually
208 all of the time it is offered.
211 \begin_layout Subsection
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.
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.
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.
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.
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.
247 \begin_layout Itemize
248 The geometry limits are: 2-1024 tracks per side for HDD, 1-256 tracks per
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.
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.
261 \begin_layout Itemize
262 Note: Although the IDs are 128 bits long, they are not MD5 hashes.
266 \begin_layout Subsection
267 Importing from command line
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.
279 \begin_layout Subsubsection
283 \begin_layout Standard
284 The syntax for ImageMaker when making images is:
287 \begin_layout LyX-Code
288 $ java ImageMaker <format> [<options>...] <destination> <source> <name>
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.
301 \begin_layout LyX-Code
302 --BIOS BIOS image (note: VGABIOS is also of this type).
305 \begin_layout LyX-Code
306 --CDROM CD-ROM image.
309 \begin_layout LyX-Code
310 --HDD=cylinders,sectors,heads Hard disk with specified geometry.
313 \begin_layout LyX-Code
314 --floppy=tracks,sectors,sides Floppy disk with specified geometry.
317 \begin_layout LyX-Code
318 --floppy160 160KiB floppy (40 tracks, 8 sectors, Single sided).
321 \begin_layout LyX-Code
322 --floppy180 180KiB floppy (40 tracks, 9 sectors, Single sided).
325 \begin_layout LyX-Code
326 --floppy320 320KiB floppy (40 tracks, 8 sectors, Double sided).
329 \begin_layout LyX-Code
330 --floppy360 360KiB floppy (40 tracks, 9 sectors, Double sided).
333 \begin_layout LyX-Code
334 --floppy410 410KiB floppy (41 tracks, 10 sectors, Double sided).
337 \begin_layout LyX-Code
338 --floppy420 420KiB floppy (42 tracks, 10 sectors, Double sided).
341 \begin_layout LyX-Code
342 --floppy720 720KiB floppy (80 tracks, 9 sectors, Double sided).
345 \begin_layout LyX-Code
346 --floppy800 800KiB floppy (80 tracks, 10 sectors, Double sided).
349 \begin_layout LyX-Code
350 --floppy820 820KiB floppy (82 tracks, 10 sectors, Double sided).
353 \begin_layout LyX-Code
354 --floppy830 830KiB floppy (83 tracks, 10 sectors, Double sided).
357 \begin_layout LyX-Code
358 --floppy880 880KiB floppy (80 tracks, 11 sectors, Double sided).
361 \begin_layout LyX-Code
362 --floppy1040 1040KiB floppy (80 tracks, 13 sectors, Double sided).
365 \begin_layout LyX-Code
366 --floppy1120 1120KiB floppy (80 tracks, 14 sectors, Double sided).
369 \begin_layout LyX-Code
370 --floppy1200 1200KiB floppy (80 tracks, 15 sectors, Double sided).
373 \begin_layout LyX-Code
374 --floppy1440 1440KiB floppy (80 tracks, 18 sectors, Double sided).
377 \begin_layout LyX-Code
378 --floppy1476 1476KiB floppy (82 tracks, 18 sectors, Double sided).
381 \begin_layout LyX-Code
382 --floppy1494 1494KiB floppy (83 tracks, 18 sectors, Double sided).
385 \begin_layout LyX-Code
386 --floppy1600 1600KiB floppy (80 tracks, 20 sectors, Double sided).
389 \begin_layout LyX-Code
390 --floppy1680 1680KiB floppy (80 tracks, 21 sectors, Double sided).
393 \begin_layout LyX-Code
394 --floppy1722 1722KiB floppy (82 tracks, 21 sectors, Double sided).
397 \begin_layout LyX-Code
398 --floppy1743 1743KiB floppy (83 tracks, 21 sectors, Double sided).
401 \begin_layout LyX-Code
402 --floppy1760 1760KiB floppy (80 tracks, 22 sectors, Double sided).
405 \begin_layout LyX-Code
406 --floppy1840 1840KiB floppy (80 tracks, 23 sectors, Double sided).
409 \begin_layout LyX-Code
410 --floppy1920 1920KiB floppy (80 tracks, 24 sectors, Double sided).
413 \begin_layout LyX-Code
414 --floppy2880 2880KiB floppy (80 tracks, 36 sectors, Double sided).
417 \begin_layout LyX-Code
418 --floppy3120 3120KiB floppy (80 tracks, 39 sectors, Double sided).
421 \begin_layout LyX-Code
422 --floppy3200 3200KiB floppy (80 tracks, 40 sectors, Double sided).
425 \begin_layout LyX-Code
426 --floppy3520 3520KiB floppy (80 tracks, 44 sectors, Double sided).
429 \begin_layout LyX-Code
430 --floppy3840 3840KiB floppy (80 tracks, 48 sectors, Double sided).
433 \begin_layout Subsubsection
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.
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.
449 \begin_layout Subsubsection
453 \begin_layout Standard
457 \begin_layout LyX-Code
458 $ java ImageMaker <imagefile>
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).
469 \begin_layout Subsection
470 Advanced: The disk ID algorithm
473 \begin_layout Standard
474 The disk ID is calculated as:
477 \begin_layout LyX-Code
478 Skein-256-128-deprecated(<typecode>|<geometry>|<image>)
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:
489 \begin_layout Itemize
490 Changing the constants would change the IDs, which would invalidate existing
494 \begin_layout Itemize
495 This is not about cryptographic security
498 \begin_layout Itemize
499 The new constants don't improve security that much anyway.
502 \begin_layout Subsubsection
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
512 \begin_layout LyX-Code
513 Byte 0 bits 0-1: Bits 8-9 of track count per side - 1.
516 \begin_layout LyX-Code
517 Byte 0 bits 2-5: Head count - 1.
520 \begin_layout LyX-Code
521 Byte 0 bits 6-7: Reserved, must be 0.
524 \begin_layout LyX-Code
525 Byte 1: Bits 0-7 of track count per side - 1.
528 \begin_layout LyX-Code
529 Byte 2: Sector count per track - 1.
532 \begin_layout Subsubsection
533 CD-ROM and BIOS images
536 \begin_layout Standard
537 CD-ROMs have <typecode> value 2 (single byte) and BIOS images have 3 (single
542 \begin_layout Subsection
543 Advanced: Disk Image format
546 \begin_layout Standard
547 The disk image consists of following parts, concatenated in this order without
551 \begin_layout Itemize
555 \begin_layout Itemize
559 \begin_layout Itemize
563 \begin_layout Itemize
567 \begin_layout Itemize
571 \begin_layout Itemize
572 type-specific geometry/size data
575 \begin_layout Itemize
579 \begin_layout Itemize
583 \begin_layout Subsubsection
587 \begin_layout Standard
588 Magic in disk image files is following 5 bytes:
589 \begin_inset Quotes eld
593 \begin_inset Quotes erd
599 \begin_layout Subsubsection
603 \begin_layout Standard
604 Disk ID is given as 16 bytes, encoding the 128-bit disk ID.
607 \begin_layout Subsubsection
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.
617 \begin_layout Subsubsection
621 \begin_layout Standard
623 Disk name length is given as two-byte big-endian value.
624 New images should have 0 here.
627 \begin_layout Subsubsection
631 \begin_layout Standard
633 Name field is there for backward compatiblity.
634 Disk name length gives length of this field in bytes.
637 \begin_layout Subsubsection
638 Type-specific geometry/size data (floppies and HDDs)
641 \begin_layout Standard
642 Floppies and HDDs have 3-byte geometry data:
645 \begin_layout LyX-Code
646 Byte 0 bits 0-1: Bits 8-9 of track count per side - 1.
649 \begin_layout LyX-Code
650 Byte 0 bits 2-5: Head count - 1.
653 \begin_layout LyX-Code
654 Byte 0 bits 6-7: Reserved, must be 0.
657 \begin_layout LyX-Code
658 Byte 1: Bits 0-7 of track count per side - 1.
661 \begin_layout LyX-Code
662 Byte 2: Sector count per track - 1.
665 \begin_layout Subsubsection
666 Type specific-geometry/size data (CD-ROMs)
669 \begin_layout Standard
670 CD-ROMs have 4-byte big-endian sector (512 bytes!) count.
673 \begin_layout Subsubsection
674 Type specific-geometry/size data (BIOS images)
677 \begin_layout Standard
678 BIOS images have 4-byte big-endian byte (not sector or block) count.
681 \begin_layout Subsubsection
682 Actual image data (floppy/HDD)
685 \begin_layout Standard
686 Floppy or HDD imagedata consists of following subparts:
689 \begin_layout Itemize
693 \begin_layout Itemize
697 \begin_layout Itemize
701 \begin_layout Itemize
705 \begin_layout Standard
706 Storage method is single byte.
707 Sectors present gives number of last nonzero sector + 1 (zero if image
711 \begin_layout Subsubsection
712 Floppy/HDD storage method 0: Raw storage
715 \begin_layout Standard
716 This storage method has empty header.
717 Image data is raw dump of first sectors present sectors.
720 \begin_layout Subsubsection
721 Floppy/HDD storage method 1: Sectormap
724 \begin_layout Standard
725 Image data header contains bitfield with just enough bytes to have one bit
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.
734 \begin_layout Standard
735 Image data contains dumps of all present sectors in order of increasing
739 \begin_layout Subsubsection
740 Floppy/HDD storage method 2: Extent first sector zero
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.
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.
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.
765 \begin_layout Subsubsection
766 Floppy/HDD storage method 3: Extent first sector nonzero
769 \begin_layout Standard
770 Same as storage method 2 but first block is nonzero sector block.
773 \begin_layout Subsubsection
774 Actual image data (CD-ROMs and BIOS images)
777 \begin_layout Standard
778 These store image data raw.
779 The amount of data is specified by sector/byte count.
782 \begin_layout Subsubsection
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.
793 \begin_layout Section
797 \begin_layout Standard
798 The actual emulator is invoked as:
801 \begin_layout LyX-Code
802 $ java JPCApplication <options>...
805 \begin_layout Standard
806 The valid options are:
809 \begin_layout LyX-Code
810 -autoexec <script> Execute contents of specified file as commands when starting
814 \begin_layout LyX-Code
815 -noautoexec Don't run autoexec files.
818 \begin_layout LyX-Code
819 -norenames Copy&Delete files instead of renaming.
820 Mainly meant for debugging copy&delte code.
823 \begin_layout Standard
824 If no arguments are given, defaults of autoexec file of 'assemble.jpcrrinit'
828 \begin_layout Subsection
832 \begin_layout Standard
833 When emulator is started, command line comes up.
834 Following commands are known:
837 \begin_layout Itemize
838 'exit': exit immediately
841 \begin_layout Itemize
842 'library <library>': set library directory to <library>.
845 \begin_layout Itemize
846 'load <plugin>': Load plugin (no arguments)
849 \begin_layout Itemize
850 'load <plugin>(<arguments>)': load plugin with arguments.
853 \begin_layout Itemize
854 'command <command> [<arguments>...]': Invoke command via external command interface.
857 \begin_layout Itemize
858 'call<command> [<arguments>...]': Invoke command via external command interface
859 and print return values.
862 \begin_layout Itemize
863 'lsdisks [<filename>]' Print listing of all known disks.
864 If <filename> is specified, save output to specified file.
867 \begin_layout Itemize
868 'diskinfo [<filename>] <imagename>' Print Information about <imagename>
869 (can be disk name or ID).
870 If <filename> is specified, save output to specified file.
873 \begin_layout Standard
874 When one gets command line, its useful to load some plugins.
875 See section about plugins.
876 Note: Load runner plugin (PCControl/PCRunner and so) last, as some runners
877 like to start PC immediately.
880 \begin_layout Subsection
881 PC settings dialog notes
884 \begin_layout Itemize
885 CPU divider base frequency before division is 1GHz.
888 \begin_layout Itemize
889 Images can be specified by name or by ID.
890 Name is relative to library directory.
891 If the image is in subdirectory of image directory, the directory separator
892 is is '/' regardless of what the host OS uses.
895 \begin_layout Itemize
896 CD-ROM and hdc are mutually exclusive
899 \begin_layout Itemize
900 Modules is comma-seperated list of modules to load.
901 To pass arguments to some modules, enclose the arguments in ().
902 Same module can be specified twice only if parameters differ.
905 \begin_layout Itemize
906 Setting boot device doesn't work with some BIOS versions.
907 Those versions prompt the boot device anyway.
910 \begin_layout Subsection
911 Audio output channels
914 \begin_layout Standard
915 PC can have one or more audio output channels.
916 The name of audio output associated with PC speaker is: 'org.jpc.emulator.peripher
918 Modules that have audio outputs get channel names of form <classname>-<sequenti
919 al>, where <classname> is name of main module class and sequential is number
921 Note that same module can have multiple output channels.
922 If multiple modules of same class request audio outputs, the <sequential>
923 values of subsequent module start where previous left off.
926 \begin_layout Subsection
930 \begin_layout Standard
931 Plugins actually execute the tasks of the emulator.
932 They can be loaded using
933 \begin_inset Quotes eld
937 \begin_inset Quotes erd
940 or 'load <plugin>(<arguments>)
941 \begin_inset Quotes erd
947 \begin_layout Standard
948 Different Plugins using the same output (like running PCMonitor and RAWVideoDump
949 er) should not conflict because connector output hold locking is desinged
950 to handle multiple readers.
953 \begin_layout Standard
954 If no plugin used requires GUI, then the emulator can be run without having
958 \begin_layout Subsubsection
959 plugin: org.jpc.plugins.PCControl
962 \begin_layout Standard
963 Takes optionally 'extramenu=<file>' and 'uncompressedsave=1', requires and
967 \begin_layout Standard
968 Runs the PC emulator core.
969 Has capability to start/stop emulation, breakpoint after certain time or
970 start/end of VGA vertical retrace.
971 Also can create, savestate and loadstate PC emulation.
972 Memory dumping is supported.
976 \begin_layout Standard
977 'extramenu=<file>' causes Plugin to load extra menu entries from <file>.
978 'uncompressedsave=1' causes savestates to be written uncompressed (useful
979 if they are stored in VCS supporting delta compression).
982 \begin_layout Subsubsection
983 plugin: org.jpc.plugins.PCRunner
986 \begin_layout Standard
987 Takes 'movie=<file>' as argument and optionally 'stoptime=<time>' Does not
991 \begin_layout Standard
992 Loads PC from savestate and just runs it.
994 Also automatically quits once stoptime is reached.
997 \begin_layout Subsubsection
998 plugin: org.jpc.plugins.PCMonitor
1001 \begin_layout Standard
1002 No arguments, requires and uses GUI.
1005 \begin_layout Standard
1006 VGA monitor for emulated PC.
1009 \begin_layout Subsubsection
1010 plugin: org.jpc.plugins.VirtualKeyboard
1013 \begin_layout Standard
1014 No arguments, requires and uses GUI.
1017 \begin_layout Standard
1018 On-screen keyboard for emulated PC.
1021 \begin_layout Subsubsection
1022 plugin: org.jpc.plugins.PCStartStopTest
1025 \begin_layout Standard
1026 No arguments, requires and uses GUI.
1029 \begin_layout Standard
1030 Small plugin testing remote PC start/stop.
1031 Also supports sending some common keypresses.
1034 \begin_layout Subsubsection
1035 plugin: org.jpc.plugins.RAWVideoDumper
1038 \begin_layout Standard
1039 Takes 'rawoutput=<file>' as argument.
1040 Does not require nor use GUI.
1043 \begin_layout Standard
1044 Dumps all generated frames to RAW file <file>.
1045 Rawoutput is required.
1046 The raw file consists of concatenation of zlib streams.
1047 The uncompressed stream is concatenation of time skips (FFh FFh FFh FFh),
1048 each acting as time offset of 2^32-1 nanoseconds and saved frames.
1049 The saved frame has time offset in nanoseconds (big endian) as first four
1050 bytes (must be at most 2^32-2, as 2^32-1 is reserved for time skip).
1051 The next two bytes are big-endian width, next two big-endian height.
1052 Finally frame has 4 * width * height bytes of data that encodes pixels
1053 using 4 bytes per pixel, in left-to-right, up-to-down order.
1054 Byte 0 of each pixel is reserved, byte 1 is the red channel, byte 2 is
1055 green channel and byte 3 is blue channel.
1058 \begin_layout Standard
1059 Dumping to pipe is supported.
1062 \begin_layout Subsubsection
1063 plugin: org.jpc.plugins.RAWAudioDumper
1066 \begin_layout Standard
1067 Takes 'src=<name of audio output channel>', 'file=<output-filename>' and
1068 'offset=<offset>' as arguments, separated by ','.
1069 Does not require nor use GUI.
1072 \begin_layout Standard
1073 Dumps output from specified audio output channel (src, mandatory) to RAW-format
1074 file (file, mandatory).
1075 The resulting file consists of records, 4 or 8 bytes each.
1076 4 byte record consists of 0xFF 0xFF 0xFF 0xFF and means to increase next
1078 \begin_inset Formula $2^{32}-1$
1082 Otherwise record is 8 bytes.
1083 Each 8 byte record has three fields.
1084 First 4 byte unsinged big endian timedelta value (in nanoseconds, must
1086 \begin_inset Formula $2^{32}-1$
1089 ), then 2 byte signed big endian new left channel volume, then 2 byte signed
1090 big endian new right channel volume.
1091 Optionally 'offset' can be set to positive value (in nanoseconds) to delay
1095 \begin_layout Subsubsection
1096 plugin: org.jpc.plugins.LuaPlugin
1099 \begin_layout Standard
1100 Takes 'kernel=<name of lua kernel file>', other parameters are passed to
1101 kernel, requires and uses GUI.
1104 \begin_layout Standard
1105 Lua VM for executing scripts.
1108 \begin_layout Subsubsection
1109 plugin: org.jpc.plugins.JoystickInput
1112 \begin_layout Standard
1114 Displays window for sending joystick input.
1117 \begin_layout Section
1121 \begin_layout Subsection
1122 org.jpc.modules.Joystick:
1125 \begin_layout Itemize
1129 \begin_layout Itemize
1130 Resources: I/O port 0x201
1133 \begin_layout Standard
1134 Emulates joystick game port.
1137 \begin_layout Subsection
1138 org.jpc.modules.SoundCard
1141 \begin_layout Itemize
1142 Arguments: Optional resources specification
1145 \begin_layout Itemize
1146 Resources (defaults): I/O port 0x220-0x22F, IRQ 5, DMA 1, DMA 5
1149 \begin_layout Standard
1150 Emulates Sound card.
1153 \begin_layout Subsection
1154 org.jpc.modules.FMCard
1157 \begin_layout Itemize
1158 Arguments: Optional resources specification
1161 \begin_layout Itemize
1162 Resources (defaults): I/O port 0x338-0x33B
1165 \begin_layout Standard
1169 \begin_layout Subsection
1170 org.jpc.modules.BasicFPU:
1173 \begin_layout Itemize
1177 \begin_layout Itemize
1181 \begin_layout Standard
1182 Crude FPU (x87) emulator.
1185 \begin_layout Section
1189 \begin_layout Standard
1190 Hacks are saved to savestates but not movies.
1193 \begin_layout Subsection
1197 \begin_layout Standard
1198 Force bit 1 of physical address 0x0410 to zero, signaling that the system
1200 BIOS assumes system has FPU but some games use that bit to detect FPU,
1201 trying to use it if it is
1202 \begin_inset Quotes eld
1206 \begin_inset Quotes erd
1210 Try this if game startup hangs with lots of trying to use FPU but not present
1212 Don't use if there is FPU present.
1213 Needed to get games like Blake Stone / Wolfenstein 3-D to work (FPU emulator
1214 allows it to start but causes graphical glitches).
1217 \begin_layout Subsection
1221 \begin_layout Standard
1222 Update basic VGA parameters before vretrace, not after it.
1224 Commander Keen 4) don't like if this isn't done and some games (e.g.
1225 Mario & Luigi) don't like if it is done.
1226 Wrong value manifests as jerky scrolling (scrolling back and forth and
1227 fixed statusbars move).
1230 \begin_layout Section
1231 Some error messages and explanations
1234 \begin_layout Itemize
1235 <filename> is Not a valid image file
1238 \begin_layout Itemize
1239 <filename> is not image file
1242 \begin_layout Itemize
1243 <filename> claims to be floppy with illegal geometry: <x> tracks, <y> sides
1247 \begin_layout Itemize
1248 <filename> claims to be HDD with illegal geometry: <x> tracks, <y> sides
1252 \begin_layout Itemize
1253 Can't read disk image sector map.
1256 \begin_layout Itemize
1257 Can't read disk image extent.
1260 \begin_layout Standard
1261 Code expects <filename> to be valid JPC-RR format image, but it isn't JPC-RR
1262 image at all or its corrupt.
1265 \begin_layout Itemize
1266 <filename> is image of unknown type.
1269 \begin_layout Itemize
1270 <filename> has unrecognized geometry <x> <y> <z>
1273 \begin_layout Standard
1274 Possibly corrupt image, not JPC-RR image, or JPC-RR image from future version
1275 containing something current version can't comprehend.
1278 \begin_layout Itemize
1279 Invalid format specifier <something>.
1282 \begin_layout Itemize
1283 Invalid syntax of --floppy= or --HDD= option.
1286 \begin_layout Itemize
1287 Invalid format specifier/option <something>.
1290 \begin_layout Standard
1291 Invalid option or format specifier was given.
1295 \begin_layout Itemize
1296 java ImageMaker [<options>...] <format> <destination> <source> <diskname>
1299 \begin_layout Standard
1300 Check syntax of command.
1301 Especially that diskname is present!
1304 \begin_layout Itemize
1305 The image has <nnn> sectors while it should have <yyy> according to selected
1309 \begin_layout Itemize
1310 Raw image file length not divisible by 512.
1313 \begin_layout Itemize
1314 Trying to read sector out of range.
1317 \begin_layout Standard
1318 The selected geometry is wrong or raw image is incomplete.
1321 \begin_layout Itemize
1322 Invalid disk name (Should not happen!).
1325 \begin_layout Itemize
1326 Invalid geometry to be written.
1329 \begin_layout Standard
1330 This is a very likely a bug in program.
1333 \begin_layout Itemize
1334 What the heck <filename> is? It's not regular file nor directory.
1337 \begin_layout Standard
1338 That sort of file can't be used as input for image making, or the file just
1342 \begin_layout Itemize
1343 BIOS images can only be made out of regular files.
1346 \begin_layout Itemize
1347 CD images can only be made out of regular files.
1350 \begin_layout Standard
1351 Source image specified is not regular file, but image of that type can't
1352 be made of anything else.
1355 \begin_layout Itemize
1356 Can't read raw bios image file.
1359 \begin_layout Itemize
1360 Can't read sector <nnn> from image.
1363 \begin_layout Standard
1364 Reading the raw image file failed for some reason.
1367 \begin_layout Itemize
1368 Bad library line: "<something>".
1372 \begin_layout Standard
1373 Syntax error in image library.
1376 \begin_layout Itemize
1377 Removing image <something> a.k.a.
1378 "<something>" as it no longer exists.
1381 \begin_layout Standard
1382 The image file no longer exists so it gets removed from library.
1385 \begin_layout Itemize
1386 Removing image <something> a.k.a.
1387 "<something>" due to <some> conflict.
1390 \begin_layout Standard
1391 Image library code killed some image from library due to some kind of conflict
1392 with image being added.
1395 \begin_layout Itemize
1396 Too much data to fit into given space.
1399 \begin_layout Standard
1400 The tree you gave contains takes just too much space to fit into disk of
1404 \begin_layout Section
1405 Advanced: Savestate/movie format
1408 \begin_layout Subsection
1409 Special character classes
1412 \begin_layout Subsubsection
1416 \begin_layout Standard
1417 Following Unicode codepoints (encoded as UTF-8) are interpretted as space
1421 \begin_layout Itemize
1422 Codepoints 0x20, and 0x09.
1425 \begin_layout Itemize
1426 Codepoints 0x1680, 0x180E, 0x2028, 0x205F and 0x3000
1429 \begin_layout Itemize
1430 Codepoints 0x2000-0x200A.
1433 \begin_layout Subsubsection
1437 \begin_layout Standard
1438 Following byte sequences are interpretted as linefeeds (line change):
1441 \begin_layout Itemize
1442 Byte 0x0A (UTF-8 encoded codepoint 0x0A)
1445 \begin_layout Itemize
1446 Byte 0x0D (UTF-8 encoded codepoint 0x0D)
1449 \begin_layout Itemize
1450 Byte 0x1C (UTF-8 encoded codepoint 0x1C)
1453 \begin_layout Itemize
1454 Byte 0x1D (UTF-8 encoded codepoint 0x1D)
1457 \begin_layout Itemize
1458 Byte 0x1E (UTF-8 encoded codepoint 0x1E)
1461 \begin_layout Itemize
1462 Bytes 0xC2 0x85 (UTF-8 for unicode control character NL, codepoint 0x85)
1465 \begin_layout Itemize
1466 Bytes 0xE2 0x80 0xA9 (UTF-8 encoded codepoint 0x2029)
1469 \begin_layout Subsection
1473 \begin_layout Standard
1474 JRSR archive format packs multiple text archive members to text archive.
1475 It does not support binary members.
1476 JRSR archives have first five or six bytes form the magic.
1478 \begin_inset Quotes eld
1482 \begin_inset Quotes erd
1485 followed by LINEFEED character There are four kinds of lines after that
1486 (lines are terminated by LINEFEED byte/bytes):
1489 \begin_layout Itemize
1493 \begin_layout Itemize
1497 \begin_layout Itemize
1501 \begin_layout Itemize
1505 \begin_layout Standard
1506 Sequencing rules are as follows: Start member is allowed anywhere (after
1508 Member line is allowed only inside member (member started but not ended).
1509 End member is only allowed inside member.
1510 End of file is only allowed outside member.
1511 Blank line is allowed anywhere after magic.
1514 \begin_layout Subsubsection
1518 \begin_layout Standard
1519 Start member line is given as
1520 \begin_inset Quotes eld
1524 \begin_inset Quotes erd
1527 <SPACE>+ <membername> <LINEFEED>.
1528 <SPACE>+ any number of SPACE characters at least one and <LINEFEED> is
1530 The member name is UTF-8 encoded and maximum allowed line length is 2048
1531 bytes (including LINEFEED, which means name is limited to 509-2040 codepoints
1532 depending on characters used).
1533 Starting member inside another implicitly ends the previous member.
1536 \begin_layout Subsubsection
1540 \begin_layout Standard
1541 Member line is given as
1542 \begin_inset Quotes eld
1546 \begin_inset Quotes erd
1549 <content><LINEFEED>.
1550 It gives another line for member contents.
1551 <content> is passed raw to layers above (followed by line termination)
1554 \begin_layout Subsubsection
1558 \begin_layout Standard
1559 End member line is given as
1560 \begin_inset Quotes eld
1564 \begin_inset Quotes erd
1568 It ends the current member.
1569 The following line can only be start member line or file may end.
1572 \begin_layout Subsubsection
1576 \begin_layout Standard
1577 Blank line is given as <LINEFEED>.
1578 Lines like that are ignored.
1581 \begin_layout Subsection
1582 Four-to-Five encoding
1585 \begin_layout Standard
1586 Binary members are encoded into text by so-called four-to-five encoding.
1587 This encoding can encode single byte to two, two bytes to three, three
1588 bytes to four and four bytes to five.
1589 Four-to-five encoding has five kinds of blocks.
1590 All SPACE and LINEFEED characters are completely ignored, even in middle
1594 \begin_layout Subsubsection
1598 \begin_layout Standard
1599 End stream block is encoded as '!'.
1600 It ends the stream instantly.
1601 There is also implicit end of stream at end of input to decoding.
1604 \begin_layout Subsubsection
1605 Other four block types
1608 \begin_layout Standard
1609 Other four block types take the value to be encoded, read it as big-endian
1611 Then they write it as base-93 big-endian value.
1612 Then length specific constants are added to digits of that number to yield
1613 ASCII values for characters (those are stored in order):
1616 \begin_layout Standard
1617 \begin_inset Tabular
1618 <lyxtabular version="3" rows="5" columns="6">
1620 <column alignment="center" valignment="top" width="0">
1621 <column alignment="center" valignment="top" width="0">
1622 <column alignment="center" valignment="top" width="0">
1623 <column alignment="center" valignment="top" width="0">
1624 <column alignment="center" valignment="top" width="0">
1625 <column alignment="center" valignment="top" width="0">
1627 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1630 \begin_layout Plain Layout
1636 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1639 \begin_layout Plain Layout
1645 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1648 \begin_layout Plain Layout
1654 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1657 \begin_layout Plain Layout
1663 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1666 \begin_layout Plain Layout
1672 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1675 \begin_layout Plain Layout
1683 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1686 \begin_layout Plain Layout
1692 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1695 \begin_layout Plain Layout
1701 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1704 \begin_layout Plain Layout
1710 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1713 \begin_layout Plain Layout
1719 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1722 \begin_layout Plain Layout
1728 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1731 \begin_layout Plain Layout
1739 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1742 \begin_layout Plain Layout
1748 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1751 \begin_layout Plain Layout
1757 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1760 \begin_layout Plain Layout
1766 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1769 \begin_layout Plain Layout
1775 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1778 \begin_layout Plain Layout
1784 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1787 \begin_layout Plain Layout
1795 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1798 \begin_layout Plain Layout
1804 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1807 \begin_layout Plain Layout
1813 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1816 \begin_layout Plain Layout
1822 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1825 \begin_layout Plain Layout
1831 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1834 \begin_layout Plain Layout
1840 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1843 \begin_layout Plain Layout
1851 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1854 \begin_layout Plain Layout
1860 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1863 \begin_layout Plain Layout
1869 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1872 \begin_layout Plain Layout
1878 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1881 \begin_layout Plain Layout
1887 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1890 \begin_layout Plain Layout
1896 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1899 \begin_layout Plain Layout
1913 \begin_layout Standard
1914 Blocks which encode values greater than what is possible for value of that
1915 length are fatal errors.
1919 \begin_layout Subsection
1920 Line component encoing
1923 \begin_layout Standard
1924 Line component encoding sits on top of UTF-8 encoding.
1925 Line component encoding encodes non-empty 1-D array of non-empty strings
1926 into line, and thus array of those into member.
1927 Empty lines or lines that don't contain any components are ignored.
1928 Line starts with depth value of 0 and must end with depth value of zero.
1931 \begin_layout Standard
1932 Components are seperated by component separators.
1933 Empty components are ignored.
1934 Following codepoints are separators on depth 0 if not escaped:
1937 \begin_layout Itemize
1939 The depth is read pre-increment.
1942 \begin_layout Itemize
1944 The depth is read post-decrement.
1947 \begin_layout Itemize
1951 \begin_layout Standard
1952 The following characters are special:
1955 \begin_layout Itemize
1957 Increments depth by 1 if not escaped (and appears in component).
1960 \begin_layout Itemize
1962 Decrements depth by 1 if not escaped (and appears in component).
1963 Depth going negative is an error.
1966 \begin_layout Itemize
1970 Next character is interpretted as literal.
1971 Error if at end of line.
1974 \begin_layout Standard
1975 Otherwise, characters are interpretted as literals and appear in components.
1976 Depth must be zero at end of line.
1979 \begin_layout Subsection
1983 \begin_layout Standard
1984 Header section is in archive member "header".
1985 It uses line component encoding.
1986 The first component of each line is name of header, and subsequent ones
1988 How many parameters are expected is dependent on what header it is:
1991 \begin_layout Subsubsection
1995 \begin_layout Itemize
1996 Header name: "PROJECTID"
1999 \begin_layout Itemize
2003 \begin_layout Itemize
2004 Argument #1: <project-id-string>
2007 \begin_layout Itemize
2011 \begin_layout Standard
2013 Project ID is generated when PC is assembled and is then preserved in save
2015 It is used for computing rerecord counts.
2016 Emulator treats it as opaque string, the IDs it generates are formed by
2017 48 random hexadecimal digits.
2020 \begin_layout Subsubsection
2024 \begin_layout Itemize
2025 Header name: "SAVESTATEID"
2028 \begin_layout Itemize
2032 \begin_layout Itemize
2033 Argument #1: <savestate-id-string>
2036 \begin_layout Itemize
2040 \begin_layout Standard
2041 Gives save state ID.
2042 Each save state has its own save state ID.
2043 Treated as opaque string, but generated as 48 random hexadecimal digits.
2044 The presence of this header signals whether there is save state to be loaded.
2045 If this header is present, save state load will be attempted.
2046 If absent, save state is not to be loaded even if present (and correct
2047 savestate load would be technically impossible anyway).
2050 \begin_layout Standard
2051 The value is used to prevent loading incompatible save states in preserve
2052 event stream mode and also to find the point in event stream where one
2056 \begin_layout Subsubsection
2060 \begin_layout Itemize
2061 Header name: "RERECORDS"
2064 \begin_layout Itemize
2068 \begin_layout Itemize
2069 Argument #1: <rerecords>
2072 \begin_layout Itemize
2076 \begin_layout Standard
2077 Gives rerecord count.
2078 PC assembly (except when loading save state) initializes current rerecord
2080 Must be non-negative and decimal number using ASCII digit characters.
2083 \begin_layout LyX-Code
2084 On loading save state:
2087 \begin_layout LyX-Code
2088 1) If project ID matches with previous:
2091 \begin_layout LyX-Code
2092 1a) If loaded rerecord count is larger or equal to current rerecord count:
2095 \begin_layout LyX-Code
2096 1a-a) Current rerecord count is loaded rerecord count + 1.
2099 \begin_layout LyX-Code
2103 \begin_layout LyX-Code
2104 1b-a) Current rerecord count increments by 1.
2107 \begin_layout LyX-Code
2111 \begin_layout LyX-Code
2112 2a) Current rerecord count is loaded rerecord count + 1.
2115 \begin_layout Standard
2116 The current rerecord count at time of save is saved to save state.
2119 \begin_layout Subsubsection
2123 \begin_layout Itemize
2124 Header name: "AUTHORS"
2127 \begin_layout Itemize
2128 Components: 2 or more
2131 \begin_layout Itemize
2132 Arguments: free form
2135 \begin_layout Itemize
2139 \begin_layout Standard
2140 Gives authors of run.
2141 Each argument gives one author.
2142 May be present multiple times.
2145 \begin_layout Subsubsection
2149 \begin_layout Itemize
2150 Header name: "COMMENT"
2153 \begin_layout Itemize
2154 Components: 2 or more
2157 \begin_layout Itemize
2158 Arguments: free form
2161 \begin_layout Itemize
2165 \begin_layout Standard
2166 Various kinds of free form data.
2167 Not parsed further by emulator.
2170 \begin_layout Subsection
2171 Initialization segment:
2174 \begin_layout Standard
2175 If SAVESTATEID header isn't present (not a save state), member "initialization"
2176 gives PC initialization parameters for assembling the PC.
2177 It is present anyway even if SAVESTATEID is present (savestate).
2180 \begin_layout Standard
2181 Following parameters are used (space separates components):
2184 \begin_layout LyX-Code
2188 \begin_layout Standard
2189 Gives Image ID of main system BIOS (mandatory)
2192 \begin_layout LyX-Code
2196 \begin_layout Standard
2197 Gives Image ID of VGA BIOS (mandatory).
2200 \begin_layout LyX-Code
2204 \begin_layout Standard
2205 Gives Image ID of hda.
2206 Present only if system has hard disk hda.
2209 \begin_layout LyX-Code
2213 \begin_layout Standard
2214 Gives Image ID of hdb.
2215 Present only if system has hard disk hdb.
2218 \begin_layout LyX-Code
2222 \begin_layout Standard
2223 Gives Image ID of hdc.
2224 Present only if system has hard disk hdc.
2227 \begin_layout LyX-Code
2231 \begin_layout Standard
2232 Gives Image ID of hdd.
2233 Present only if system has hard disk hdd.
2236 \begin_layout LyX-Code
2240 \begin_layout Standard
2241 Gives Image ID of disk in slot <num>.
2242 Slot number must be non-negative.
2245 \begin_layout LyX-Code
2246 \begin_inset Quotes eld
2250 \begin_inset Quotes erd
2256 \begin_layout Standard
2257 kGives image name of disk in slot <num>.
2258 Slot number must be non-negative.
2259 The slot must be previously declared using
2260 \begin_inset Quotes eld
2264 \begin_inset Quotes erd
2270 \begin_layout LyX-Code
2274 \begin_layout Standard
2275 Gives Image slot to initially put into floppy drive fda.
2276 Disk must be of floppy type.
2277 If none present, no disk is initially put there.
2280 \begin_layout LyX-Code
2284 \begin_layout Standard
2285 Gives Image slot to initially put into floppy drive fdb.
2286 Disk must be of floppy type.
2287 If none present, no disk is initially put there.
2290 \begin_layout LyX-Code
2294 \begin_layout Standard
2295 Gives Image slot to initially put into CD-ROM drive hdc.
2296 Not allowed if hard disk hdc is present.
2297 Disk must be of CD-ROM type.
2298 If none present no disk is initially put there.
2301 \begin_layout LyX-Code
2302 "INITIALTIME" <time>
2305 \begin_layout Standard
2306 Number of milliseconds since Unix epoch to system start up time.
2310 \begin_layout Standard
2315 \begin_layout LyX-Code
2316 "CPUDIVIDER" <divider>
2319 \begin_layout Standard
2320 Set CPU frequency divider (dividing the 1GHz master clock).
2321 Allowed range is 1-256.
2325 \begin_layout LyX-Code
2326 "MEMORYSIZE" <pages>
2329 \begin_layout Standard
2330 Number of 4KiB pages of RAM memory.
2331 Allowed range 256-262144.
2335 \begin_layout LyX-Code
2339 \begin_layout Standard
2341 Valid devices are "FLOPPY" (boot from fda), "HDD" (boot from hda) and "CDROM"
2345 \begin_layout LyX-Code
2346 "LOADMODULEA" <module> <parameters>
2349 \begin_layout Standard
2350 Load module <module> with parameters <parameters>.
2353 \begin_layout LyX-Code
2354 "LOADMODULE" <module>
2357 \begin_layout Standard
2358 Load module <module> with no parameters
2361 \begin_layout LyX-Code
2362 \begin_inset Quotes eld
2366 \begin_inset Quotes erd
2372 \begin_layout Standard
2373 Use class <fpu> as FPU emulator.
2376 \begin_layout LyX-Code
2377 \begin_inset Quotes eld
2381 \begin_inset Quotes erd
2387 \begin_layout Standard
2388 Use I/O port delay emulation (each I/O port read/write takes 666ns).
2391 \begin_layout LyX-Code
2392 \begin_inset Quotes eld
2396 \begin_inset Quotes erd
2402 \begin_layout Standard
2403 Emulate VGA horizontal retrace.
2406 \begin_layout Subsection
2407 Event record format:
2410 \begin_layout Standard
2411 Event record is in archive member "events".
2412 It uses line component encoding.
2413 Each line gives an event.
2414 First component of each line gives time stamp.
2415 These timestamps MUST be in increasing order and all MUST be non-negative.
2416 Time stamp time unit is exactly 1 nanosecond of emulated time.
2419 \begin_layout Standard
2420 The second component of each line is name of class to dispatch to.
2421 Further components are passed as-is to event handlers.
2422 Classes with names consisting only of uppercase A-Z and 0-9 are special
2424 It is error to encounter unknown such special class.
2427 \begin_layout Subsubsection
2431 \begin_layout Itemize
2432 Dispatch to: SAVESTATE
2435 \begin_layout Itemize
2436 Argument #1: Savestate id
2439 \begin_layout Itemize
2440 Argument #2 (optional): Rerecord count at time of saving savestate
2443 \begin_layout Standard
2444 Signals that savestate has occured here.
2445 The save state IDs MUST be unique in entire event stream.
2446 The second argument to savestate (if present) is rerecord count at time
2447 of saving that savestate (useful for calulating rerecord count of movie
2448 starting from savestate).
2449 No time restrictions
2452 \begin_layout Subsubsection
2456 \begin_layout Itemize
2460 \begin_layout Itemize
2462 \begin_inset Quotes eld
2466 \begin_inset Quotes erd
2470 \begin_inset Quotes eld
2474 \begin_inset Quotes erd
2480 \begin_layout Standard
2481 Controls various options.
2483 \begin_inset Quotes eld
2487 \begin_inset Quotes erd
2490 turns on absolute mode (default) where event timestamps are absolute.
2492 \begin_inset Quotes eld
2496 \begin_inset Quotes erd
2499 turns on relative mode where event timestamps are relative to last event
2501 The OPTION event itself is not affected by timing change.
2502 No time restrictions.
2503 Unknown arguments are errors.
2506 \begin_layout Subsubsection
2507 Keyboard keypress/keyrelease event:
2510 \begin_layout Itemize
2511 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2514 \begin_layout Itemize
2515 Argument #1: Fixed: "KEYEDGE"
2518 \begin_layout Itemize
2519 Argument #2: Key number.
2520 Valid values are 1-83, 85-95, 129-197 and 199-223
2523 \begin_layout Standard
2524 Send key press or key release.
2525 Keys work in toggle button manner.
2526 The event time must be multiple of 66 666, and must not be less than 60
2527 * 66 666 TUs after last PAUSE event, 20 * 66 666 TUs after last KEYEDGE
2528 on key >128 and 10 * 66 666 TUs after last KEYEDGE on key <128.
2531 \begin_layout Subsubsection
2535 \begin_layout Itemize
2536 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2539 \begin_layout Itemize
2540 Argument #1: Fixed: "PAUSE"
2543 \begin_layout Standard
2544 Send pause key event.
2545 The time restrictions are identical to KEYEDGE event.
2548 \begin_layout Subsubsection
2552 \begin_layout Itemize
2553 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2556 \begin_layout Itemize
2557 Argument #1: Fixed: "MOUSEBUTTON"
2560 \begin_layout Itemize
2561 Argument #2: Number of button to release or press (0-4)
2564 \begin_layout Standard
2565 Presses or releases the designated mouse button.
2568 \begin_layout Subsubsection
2569 X mouse motion event:
2572 \begin_layout Itemize
2573 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2576 \begin_layout Itemize
2577 Argument #1: Fixed: "XMOUSEMOTION"
2580 \begin_layout Itemize
2581 Argument #2: Number of units to move (-255 - 255)
2584 \begin_layout Standard
2585 Move the mouse in X direction by specified amount.
2589 \begin_layout Subsubsection
2590 Y mouse motion event:
2593 \begin_layout Itemize
2594 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2597 \begin_layout Itemize
2598 Argument #1: Fixed: "YMOUSEMOTION"
2601 \begin_layout Itemize
2602 Argument #2: Number of units to move (-255 - 255)
2605 \begin_layout Standard
2606 Move the mouse in Y direction by specified amount.
2610 \begin_layout Subsubsection
2611 Z mouse motion event:
2614 \begin_layout Itemize
2615 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2618 \begin_layout Itemize
2619 Argument #1: Fixed: "ZMOUSEMOTION"
2622 \begin_layout Itemize
2623 Argument #2: Number of units to move (-7 - 7)
2626 \begin_layout Standard
2627 Move the mouse in Z direction (scrollwheel) by specified amount.
2630 \begin_layout Subsubsection
2631 Joystick button event:
2634 \begin_layout Itemize
2635 Dispatch to: org.jpc.modules.Joystick
2638 \begin_layout Itemize
2640 \begin_inset Quotes eld
2644 \begin_inset Quotes erd
2648 \begin_inset Quotes eld
2652 \begin_inset Quotes erd
2656 \begin_inset Quotes eld
2660 \begin_inset Quotes erd
2664 \begin_inset Quotes eld
2668 \begin_inset Quotes erd
2674 \begin_layout Itemize
2676 \begin_inset Quotes eld
2680 \begin_inset Quotes erd
2684 \begin_inset Quotes eld
2688 \begin_inset Quotes erd
2694 \begin_layout Standard
2695 Send button down/up event.
2696 No time restrictions.
2699 \begin_layout Subsubsection
2700 Joystick axis event:
2703 \begin_layout Itemize
2704 Dispatch to: org.jpc.modules.Joystick
2707 \begin_layout Itemize
2709 \begin_inset Quotes eld
2713 \begin_inset Quotes erd
2717 \begin_inset Quotes eld
2721 \begin_inset Quotes erd
2725 \begin_inset Quotes eld
2729 \begin_inset Quotes erd
2733 \begin_inset Quotes eld
2737 \begin_inset Quotes erd
2743 \begin_layout Itemize
2744 Argument #2: Multivibrator unstable state length in ns.
2747 \begin_layout Standard
2748 Set amount of time multivibrator remains in unstable state.
2749 No time restrictions.
2752 \begin_layout Subsubsection
2756 \begin_layout Itemize
2757 Dispatch to: org.jpc.emulator.PC$ResetButton
2760 \begin_layout Itemize
2764 \begin_layout Standard
2768 \begin_layout Subsubsection
2772 \begin_layout Itemize
2773 Dispatch to: org.jpc.emulator.PC$DiskChanger
2776 \begin_layout Itemize
2777 Argument #1: Fixed: "FDA"
2780 \begin_layout Itemize
2781 Argument #2: Number of image slot to put there.
2785 \begin_layout Standard
2786 The disk number MUST be -1 or valid disk number.
2787 -1 MUST NOT be used if there is no disk in floppy drive A.
2788 This event causes specified disk to be placed to FDA or FDA disk to be
2789 ejected with no replacement if disk number is -1.
2790 The specified disk if not -1 must be of floppy type.
2791 The specified disk if valid must not be in any other drive.
2794 \begin_layout Subsubsection
2798 \begin_layout Itemize
2799 Dispatch to: org.jpc.emulator.PC$DiskChanger
2802 \begin_layout Itemize
2803 Argument #1: Fixed: "FDB"
2806 \begin_layout Itemize
2807 Argument #2: Number of image slot to put there.
2811 \begin_layout Standard
2812 The disk number MUST be -1 or valid disk number.
2813 -1 MUST NOT be used if there is no disk in floppy drive B.
2814 This event causes specified disk to be placed to FDB or FDB disk to be
2815 ejected with no replacement if disk number is -1.
2816 The specified disk if not -1 must be of floppy type.
2817 The specified disk if valid must not be in any other drive.
2820 \begin_layout Subsubsection
2824 \begin_layout Itemize
2825 Dispatch to: org.jpc.emulator.PC$DiskChanger
2828 \begin_layout Itemize
2829 Argument #1: Fixed: "CDROM"
2832 \begin_layout Itemize
2833 Argument #2: Number of image slot to put there.
2837 \begin_layout Standard
2838 The disk number MUST be -1 or valid disk number.
2839 -1 MUST NOT be used if there is no disk in CD-ROM.
2840 This event causes specified disk to be placed to CD-ROM or CD-ROM disk
2841 to be ejected with no replacement if disk number is -1.
2842 The specified disk if not -1 must be of CD-ROM type.
2845 \begin_layout Standard
2846 This event has no effect if CD-ROM is locked.
2849 \begin_layout Subsubsection
2850 Write protect floppy:
2853 \begin_layout Itemize
2854 Dispatch to: org.jpc.emulator.PC$DiskChanger
2857 \begin_layout Itemize
2858 Argument #1: Fixed: "WRITEPROTECT"
2861 \begin_layout Itemize
2862 Argument #2: Number of image slot to manipulate
2865 \begin_layout Standard
2866 Write protects specified disk.
2867 The disk MUST NOT be in any drive and MUST be valid floppy-type disk.
2870 \begin_layout Subsubsection
2871 Write unprotect floppy:
2874 \begin_layout Itemize
2875 Dispatch to: org.jpc.emulator.PC$DiskChanger
2878 \begin_layout Itemize
2879 Argument #1: Fixed: "WRITEUNPROTECT"
2882 \begin_layout Itemize
2883 Argument #2: Number of image slot to manipulate
2886 \begin_layout Standard
2887 Disables write protection specified disk.
2888 The disk MUST NOT be in any drive and MUST be valid floppy-type disk.
2891 \begin_layout Subsection
2895 \begin_layout Standard
2896 Diskinfo sections are named
2897 \begin_inset Quotes eld
2901 \begin_inset Quotes erd
2905 They use line component encoding, fieldtype being first component on each
2906 line (value being the second).
2907 Following fields are defined:
2910 \begin_layout Subsubsection
2914 \begin_layout Standard
2915 Gives type of image.
2919 \begin_layout Itemize
2920 \begin_inset Quotes eld
2924 \begin_inset Quotes erd
2930 \begin_layout Itemize
2931 \begin_inset Quotes eld
2935 \begin_inset Quotes erd
2941 \begin_layout Itemize
2942 \begin_inset Quotes eld
2946 \begin_inset Quotes erd
2952 \begin_layout Itemize
2953 \begin_inset Quotes eld
2957 \begin_inset Quotes erd
2960 (BIOS/VGABIOS image)
2963 \begin_layout Itemize
2964 \begin_inset Quotes eld
2968 \begin_inset Quotes erd
2971 (what the heck is this???)
2974 \begin_layout Subsubsection
2978 \begin_layout Standard
2982 \begin_layout Subsubsection
2986 \begin_layout Standard
2987 (BIOS images only) Gives length of BIOS image
2990 \begin_layout Subsubsection
2994 \begin_layout Standard
2995 MD5 of raw disk/BIOS image without any headers or trailers.
2998 \begin_layout Subsubsection
3002 \begin_layout Standard
3003 (FLOPPY/HDD/CDROM images only) Number of total sectors on disk.
3006 \begin_layout Subsubsection
3010 \begin_layout Standard
3011 (FLOPPY/HDD images only) Number of tracks on disk per side (1-256 for floppy,
3015 \begin_layout Subsubsection
3019 \begin_layout Standard
3020 (FLOPPY/HDD images only) Number of sides on disk (1 or 2 for floppy, 1-16
3024 \begin_layout Subsubsection
3028 \begin_layout Standard
3029 (FLOPPY/HDD images only) Number of sectors per track (1-255 for floppy,
3033 \begin_layout Subsubsection
3037 \begin_layout Standard
3038 Line from image comment block.
3039 Usually give data about files image has.
3040 May or may not be present (multiple times)
3043 \begin_layout Subsection
3047 \begin_layout Standard
3048 Output info is stored in section
3049 \begin_inset Quotes eld
3053 \begin_inset Quotes erd
3057 Its relatively new, so it might not be present (then the contents have
3058 to be guessed based on modules present).
3059 Each line gives information about one output, first field being the type
3063 \begin_layout Subsubsection
3067 \begin_layout Standard
3068 For video output, there are no parameters so line is just
3069 \begin_inset Quotes eld
3073 \begin_inset Quotes erd
3079 \begin_layout Subsubsection
3083 \begin_layout Standard
3084 For audio output, the only parameter is name of output, so first component
3086 \begin_inset Quotes eld
3090 \begin_inset Quotes erd
3093 and second component is name of audio output.
3096 \begin_layout Subsection
3100 \begin_layout Standard
3101 Actual savestate format is not documented here.
3102 It is close to impossible to comprehend without access to emulator source
3106 \begin_layout Section
3107 Advanced: Making class dumpable
3110 \begin_layout Standard
3111 Class is made dumpable by implementing interface org.jpc.emulator.SRDumpable
3112 and implementing method dumpSRPartial(org.jpc.emulator.SRDumper) and constructor
3113 <init>(org.jpc.emulator.SRLoader).
3114 Non-static inner classes can not be dumpable (make them static using tricks
3115 similar to what javac uses).
3118 \begin_layout Standard
3119 If dumped class has dumpable superclass, the first thing dumping function
3120 needs to do is to call dumper function of superclass and first thing loading
3121 constructor needs to do is to call loading constructor of superclass.
3122 If class has no dumpable superclass, dumper doesn't need to do anything
3123 special, while loader needs to call objectCreated(this) on SRLoader object
3124 passed as parameter.
3128 \begin_layout Standard
3129 Following these fixed parts, dump all members that are part of mutable state
3133 \begin_layout Subsection
3134 Member dumping/loading functions
3137 \begin_layout Standard
3138 There is dumping/loading function for following (all functions dumping/loading
3139 reference types can handle null):
3142 \begin_layout Itemize
3143 boolean: SRDumper.dumpBoolean, SRLoader.loadBoolean
3146 \begin_layout Itemize
3147 byte: SRDumper.dumpByte, SRLoader.loadByte
3150 \begin_layout Itemize
3151 short: SRDumper.dumpShort, SRLoader.loadShort
3154 \begin_layout Itemize
3155 int: SRDumper.dumpInt, SRLoader.loadInt
3158 \begin_layout Itemize
3159 long: SRDumper.dumpLong, SRLoader.loadLong
3162 \begin_layout Itemize
3163 String: SRDumper.dumpString, SRLoader.loadString
3166 \begin_layout Itemize
3167 boolean[]: SRDumper.dumpArray, SRLoader.loadArrayBoolean
3170 \begin_layout Itemize
3171 byte[]: SRDumper.dumpArray, SRLoader.loadArrayByte
3174 \begin_layout Itemize
3175 short[]: SRDumper.dumpArray, SRLoader.loadArrayShort
3178 \begin_layout Itemize
3179 int[]: SRDumper.dumpArray, SRLoader.loadArrayInt
3182 \begin_layout Itemize
3183 long[]: SRDumper.dumpArray, SRLoader.loadArrayLong
3186 \begin_layout Itemize
3187 double[]: SRDumper.dumpArray, SRLoader.loadArrayDouble
3190 \begin_layout Itemize
3191 <dumpable type>: SRDumper.dumpObject, SRLoader.loadObject
3194 \begin_layout Itemize
3195 special object: SRDumper.specialObject, SRLoader.specialObject
3198 \begin_layout Subsubsection
3202 \begin_layout Itemize
3203 Dumpable objects come out as type of org.jpc.emulator.SRDumpable.
3206 \begin_layout Itemize
3207 Special objects are various static objects that don't need to be stored
3208 because they don't have mutable fields.
3211 \begin_layout Itemize
3212 Don't dump fields related to event state feedback.
3215 \begin_layout Itemize
3216 Don't dump temporary flags that are only used while PC is running.
3217 Savestate when PC is running isn't possible anyway.
3220 \begin_layout Itemize
3221 Some connectors dump fields related to connector output, some don't.
3224 \begin_layout Section
3225 Advanced: Making output connectors
3228 \begin_layout Standard
3229 Implementing interface org.jpc.emulator.DisplayController signals that this
3230 is display controller, inhibiting loading of the standard VGA display controlle
3231 r if loaded as module.
3235 \begin_layout Subsection
3236 Interface org.jpc.emulator.OutputConnector
3239 \begin_layout Standard
3240 Class is made to be output connector by implementing this interface.
3241 This interface specifies the methods used for output hold locking.
3242 Class org.jpc.emulator.OutputConnectorLocking has implementations of these
3243 that are suitable for calling.
3247 \begin_layout Subsubsection
3248 Method subscribeOutput(Object)
3251 \begin_layout Standard
3252 Subscribes the output, with specified object as handle.
3255 \begin_layout Subsubsection
3256 Method unsubscribeOutput(Object)
3259 \begin_layout Standard
3260 Unsubscribe the specified handle object from output.
3263 \begin_layout Subsubsection
3264 Method waitOutput(Object)
3267 \begin_layout Standard
3268 Wait for output on specified connector using specified handle object.
3269 Returns true on success, false if wait was interrupted by thread interrupt.
3273 \begin_layout Subsubsection
3274 Method releaseOutput(Object)
3277 \begin_layout Standard
3278 Release connector from p.o.v.
3283 \begin_layout Subsubsection
3287 \begin_layout Standard
3288 Release threads waiting on waitOutput() and block until all subscribers
3289 have returned from waitOutput() and enteired releaseOutput().
3292 \begin_layout Subsubsection
3293 Method releaseOutputWaitAll(object)
3296 \begin_layout Standard
3297 Like releaseOutput(), but waits until all handles have released their output.
3300 \begin_layout Subsection
3301 Class org.jpc.emulator.VGADigtalOut
3304 \begin_layout Standard
3305 Class org.jpc.emulator.VGADigtalOut (already implements OutputConnector) implements
3306 VGA output connector.
3307 If module provodes output connector, it needs to implement org.jpc.emulator.Displa
3311 \begin_layout Subsubsection
3315 \begin_layout Standard
3316 Get width of display (watch out, can return 0).
3319 \begin_layout Subsubsection
3323 \begin_layout Standard
3324 Get height of display (watch out, can return 0).
3327 \begin_layout Subsubsection
3328 Methods getDirtyXMin(), getDirtyXMax(), getDirtyYMin(), getDirtyYMax()
3331 \begin_layout Standard
3332 Returns the dirty region (region modified since last output).
3335 \begin_layout Subsubsection
3339 \begin_layout Standard
3340 Get buffer of ints, at least width * height elements (left-to-right, top-down,
3341 one value per pixel) giving pixel data.
3342 Value for each pixel is 65536 * <red-component> + 256 * <green-component>
3346 \begin_layout Subsubsection
3347 Method resizeDisplay(int _width, int _height)
3350 \begin_layout Standard
3351 Resize the display to be of specified size.
3354 \begin_layout Subsubsection
3355 Method dirtyDisplayRegion(int x, int y, int w, int h)
3358 \begin_layout Standard
3359 Mark the specified region as dirty.
3362 \begin_layout Subsubsection
3363 Method resetDirtyRegion()
3366 \begin_layout Standard
3367 Resets the dirty region to be empty.
3370 \begin_layout Subsection
3371 Class org.jpc.emulator.PC method getVideoOutput()
3374 \begin_layout Standard
3375 Get VGA output connector for PC.
3378 \begin_layout Subsection
3379 Interface org.jpc.emulator.DisplayController.
3382 \begin_layout Standard
3383 Implementing this class signals that module is VGA controller.
3384 There can be only one such module active at time and presence of such module
3385 prevents loading builtin VGA controller emulation code.
3388 \begin_layout Subsubsection
3389 Method getOutputDevice()
3392 \begin_layout Standard
3393 Get VGA output connector for this VGA device.
3396 \begin_layout Subsection
3397 Class org.jpc.emulator.SoundDigitalOut
3400 \begin_layout Standard
3401 Class org.jpc.emulator.SoundDigitalOut provodes output connector for sound.
3402 Each connector can transfer stereo signal at arbitiary sampling rate.
3403 Modules that have audio connectors need to implement interface org.jpc.emulator.So
3404 undOutputDevice, as this signals that output connectors should be created.
3407 \begin_layout Subsubsection
3408 Method addSample(long, short, short)
3411 \begin_layout Standard
3412 Add stereo sample at time given by first argument.
3413 The second and third arguments give volume on left and right channels.
3416 \begin_layout Subsubsection
3417 Method addSample(long, short)
3420 \begin_layout Standard
3421 Add mono sample at time given by first argument.
3422 The second argument give volume on both channels.
3425 \begin_layout Subsubsection
3426 Method readBlock(Block)
3429 \begin_layout Standard
3430 Reads block of output (atomic versus addSample).
3431 Block structure has following fields which are filled:
3434 \begin_layout Itemize
3435 timeBase: Time base for block.
3438 \begin_layout Itemize
3439 baseLeft: Left volume at time base.
3442 \begin_layout Itemize
3443 baseRight: Right volume at time base
3446 \begin_layout Itemize
3447 blockNo: Sequence number of block filled.
3450 \begin_layout Itemize
3451 samples: Number of samples in block
3454 \begin_layout Itemize
3455 sampleTiming: Number of nanoseconds since last sample
3458 \begin_layout Itemize
3459 sampleLeft: Left channel samples
3462 \begin_layout Itemize
3463 sampleRight: Right channel samples
3466 \begin_layout Subsection
3467 Interface org.jpc.emulator.SoundOutputDevice
3470 \begin_layout Standard
3471 Implementing this interface signals that module has audio output channels.
3474 \begin_layout Subsubsection
3475 Method org.jpc.emulator.SoundOutputDevice.requestedSoundChannels()
3478 \begin_layout Standard
3479 Return the number of sound channels module has.
3482 \begin_layout Subsubsection
3483 Method org.jpc.emulator.SoundOutputDevice.soundChannelCallback(SoundDigitalOut)
3486 \begin_layout Standard
3487 This is called once per sound channel requested giving precreated sound
3491 \begin_layout Subsection
3492 Class org.jpc.emulator.PC method getSoundOut(String)
3495 \begin_layout Standard
3496 Get sound output with specified name.
3499 \begin_layout Section
3500 Advanced: Writing event targets
3503 \begin_layout Standard
3504 Whereas output connectors are the way output is dispatched, input is dispatched
3506 Event targets need to implement interface org.jpc.emulator.EventDispatchTarget.
3509 \begin_layout Standard
3510 Event targets also provode methods which then encode events and dispatch
3511 them forward (without doing anything else) to event recorder.
3512 Also, event targets may have methods for obtaining state.
3515 \begin_layout Subsection
3516 Interface org.jpc.emulator.EventDispatchTarget
3519 \begin_layout Standard
3520 Interface that marks class capable of receiving events.
3523 \begin_layout Subsubsection
3524 Method setEventRecorder(EventRecorder)
3527 \begin_layout Standard
3528 Set the event recorder input events are sent to.
3531 \begin_layout Subsubsection
3532 Method startEventCheck()
3535 \begin_layout Standard
3536 Signals target to reset all state related to event checking and state feedback.
3537 This may be called at any time in order to reinitialialize event checking/feedb
3541 \begin_layout Subsubsection
3542 Method doEvent(long, String[], int) throws IOException
3545 \begin_layout Standard
3546 Event dispatch handler.
3547 The first argument is event time, second is parameters and third is what
3549 If target doesn't like the event, throw IOException.
3550 Following types (the integer parameter) are used:
3553 \begin_layout LyX-Code
3554 0 (EventRecorder.EVENT_TIMED): Time has been assigned for event.
3557 \begin_layout LyX-Code
3558 1 (EventRecorder.EVENT_STATE_EFFECT_FUTURE): Future event in event replay
3559 for reinitialization
3562 \begin_layout LyX-Code
3563 2 (EventRecorder.EVENT_STATE_EFFECT): Past event in event replay reinitialization
3566 \begin_layout LyX-Code
3567 3 (EventRecorder.EVENT_EXECUTE): This event occurs now.
3571 \begin_layout Subsubsection
3572 Method endEventCheock()
3575 \begin_layout Standard
3576 End event reinitialization.
3580 \begin_layout Subsubsection
3581 Method getEventTimeLowBound(long, String[]) throws IOException
3584 \begin_layout Standard
3585 Return the time value that's the earliest possiblity for this event to occur.
3586 Returning any time in past (including -1) causes event to fire as soon
3588 The long parameter gives the current scheduled time for event.
3591 \begin_layout Section
3595 \begin_layout Standard
3596 Modules are various extensions that run inside emulator core.
3597 As such, they affect sync.
3598 Modules must implement interface org.jpc.emulator.HardwareComponent (they
3599 are hardware components) and must be dumpable.
3600 Additionally, they need either constructor <init>() or <init>(String).
3601 The first is if no parameters are passed, the second is for case where
3602 parameters are passed.
3605 \begin_layout Standard
3606 Aside of the constructors, modules need to obey the ordinary conventions
3607 for hardware components.
3608 No code outside modules needs to know that module exists.
3611 \begin_layout Section
3615 \begin_layout Standard
3616 Plugins handle various UI tasks.
3617 They need to implement interface org.jpc.Plugin.
3620 \begin_layout Subsection
3621 Interface org.jpc.pluginsbase.Plugin
3624 \begin_layout Subsubsection
3625 Method systemShutdown()
3628 \begin_layout Standard
3629 Called when emulator shuts down.
3630 Either called in dedicated thread or in thread that called emulatorShutdown().
3631 These handlers should do the bare minimum to get files on disk to consistent
3633 After these calls from all plugins have finished, emulator exits.
3634 Do not try to manipulate UI from these methods, as doing that easily leads
3638 \begin_layout Subsubsection
3639 Method reconnect(PC)
3642 \begin_layout Standard
3643 Gives new PC to connect to.
3644 Null is passed if plugin should disconnect.
3647 \begin_layout Subsubsection
3651 \begin_layout Standard
3652 Called in dedicated thread after plugin is initialized.
3655 \begin_layout Subsubsection
3659 \begin_layout Standard
3660 Called after PC has stopped.
3663 \begin_layout Subsubsection
3667 \begin_layout Standard
3668 Called before PC starts.
3671 \begin_layout Subsubsection
3672 Method notifyArguments(String[])
3675 \begin_layout Standard
3676 Pass arguments from command line.
3679 \begin_layout Subsubsection
3680 Constructor <init>(Plugins)
3683 \begin_layout Standard
3684 This constructor is used to initialize plugins that don't take parameters.
3687 \begin_layout Subsubsection
3688 Constructor <init>(Plugins, String)
3691 \begin_layout Standard
3692 This constructor is used to initialize plugins that take parameters.
3695 \begin_layout Subsection
3696 Class org.jpc.pluginsbase.Plugins
3699 \begin_layout Standard
3700 This class provodes various methods for manipulating plugins.
3703 \begin_layout Subsubsection
3704 Method isShuttingDown()
3707 \begin_layout Standard
3708 Returns true if Plugins.shutdownEmulator() has been called somehow, either
3709 via VM exit, CTRL+C or explicitly.
3710 Useful to skip cleanups involving GUI, as these are too deadlock-prone.
3713 \begin_layout Subsubsection
3714 Method shutdownEmulator()
3717 \begin_layout Standard
3718 Shut down and exit the emulator.
3719 All plugin shutdown functions are called in this thread.
3722 \begin_layout Subsubsection
3723 Method reconnectPC(PC)
3726 \begin_layout Standard
3727 Signal reconnectPC event to all plugins.
3730 \begin_layout Subsubsection
3734 \begin_layout Standard
3735 Signal pcStarting() event to all plugins.
3738 \begin_layout Subsubsection
3742 \begin_layout Standard
3743 Signal pcStopping() event to all plugins.
3746 \begin_layout Section
3747 Inter-plugin communication
3750 \begin_layout Subsection
3751 Receiving communications
3754 \begin_layout Standard
3755 To receive invocation/call by name 'foo-bar', declare public method named
3757 Arguments to this method can currently be String, Integer (int) or Long
3759 Last argument may be array over these types to get variable number of arguments.
3760 On call, each argument gets value from call.
3761 If last argument is array, it gets all overflowing arguments.
3762 If return type is void or method returns boolean false, call is assumed
3764 If return value is boolean true, it is assumed that there is more processing.
3767 \begin_layout Subsection
3768 void org.jpc.pluginsbase.Plugins.invokeExternalCommand(String cmd, Object[]
3772 \begin_layout Standard
3773 Invoke command asynchronously, broadcasting to all plugins.
3774 Does not wait for slow commands to complete.
3775 cmd is the name to send and args are the arguments to pass.
3778 \begin_layout Subsection
3779 void org.jpc.pluginsbase.Plugins.invokeExternalCommandSynchronous(String cmd,
3783 \begin_layout Standard
3784 Same as invokeExternalCommand, but waits for slow commands to complete.
3787 \begin_layout Subsection
3788 Object[] org.jpc.pluginsbase.Plugins.invokeExternalCommandReturn(String cmd,
3792 \begin_layout Standard
3793 Similar to invokeExternalCommandSynchornous, but:
3796 \begin_layout Itemize
3797 Quits calling more plugins when it gets successful reply.
3800 \begin_layout Itemize
3804 \begin_layout Subsection
3805 void org.jpc.pluginsbase.Plugins.returnValue(Object...
3809 \begin_layout Standard
3810 Gives return value to return from call and signals that command has completed.
3813 \begin_layout Subsection
3814 void org.jpc.pluginsbase.Plugins.signalCommandCompletion()
3817 \begin_layout Standard
3818 Signals that command has completed.
3819 Only needed if there is no return value and eci_ method returned false
3823 \begin_layout Section
3824 Lua kernel programming
3827 \begin_layout Standard
3828 At startup, kernel gets its arguments in 'args' table and the script name
3829 to run in 'scriptname' string.
3830 It should enter the named script in protected mode.
3833 \begin_layout Standard
3834 The Lua VM exports numerious callbacks to kernel.
3835 The kernel can then choose to omit, wrap or re-export these to Lua scripts.
3838 \begin_layout Itemize
3839 Always grab any functions used into local variables so nobody can mess with
3843 \begin_layout Itemize
3844 Don't use global variables in kernel (except for those passed).