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 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.
869 \begin_layout Subsection
870 PC settings dialog notes
873 \begin_layout Itemize
874 CPU divider base frequency before division is 1GHz.
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.
884 \begin_layout Itemize
885 CD-ROM and hdc are mutually exclusive
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.
894 \begin_layout Itemize
895 Setting boot device doesn't work with some BIOS versions.
896 Those versions prompt the boot device anyway.
899 \begin_layout Subsection
900 Audio output channels
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
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
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.
915 \begin_layout Subsection
919 \begin_layout Standard
920 Plugins actually execute the tasks of the emulator.
921 They can be loaded using
922 \begin_inset Quotes eld
926 \begin_inset Quotes erd
929 or 'load <plugin>(<arguments>)
930 \begin_inset Quotes erd
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.
942 \begin_layout Standard
943 If no plugin used requires GUI, then the emulator can be run without having
947 \begin_layout Subsubsection
948 plugin: org.jpc.plugins.PCControl
951 \begin_layout Standard
952 Takes optionally 'extramenu=<file>' and 'uncompressedsave=1', requires and
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.
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).
971 \begin_layout Subsubsection
972 plugin: org.jpc.plugins.PCRunner
975 \begin_layout Standard
976 Takes 'movie=<file>' as argument and optionally 'stoptime=<time>' Does not
980 \begin_layout Standard
981 Loads PC from savestate and just runs it.
983 Also automatically quits once stoptime is reached.
986 \begin_layout Subsubsection
987 plugin: org.jpc.plugins.PCMonitor
990 \begin_layout Standard
991 No arguments, requires and uses GUI.
994 \begin_layout Standard
995 VGA monitor for emulated PC.
998 \begin_layout Subsubsection
999 plugin: org.jpc.plugins.VirtualKeyboard
1002 \begin_layout Standard
1003 No arguments, requires and uses GUI.
1006 \begin_layout Standard
1007 On-screen keyboard for emulated PC.
1010 \begin_layout Subsubsection
1011 plugin: org.jpc.plugins.PCStartStopTest
1014 \begin_layout Standard
1015 No arguments, requires and uses GUI.
1018 \begin_layout Standard
1019 Small plugin testing remote PC start/stop.
1020 Also supports sending some common keypresses.
1023 \begin_layout Subsubsection
1024 plugin: org.jpc.plugins.RAWVideoDumper
1027 \begin_layout Standard
1028 Takes 'rawoutput=<file>' as argument.
1029 Does not require nor use GUI.
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.
1047 \begin_layout Standard
1048 Dumping to pipe is supported.
1051 \begin_layout Subsubsection
1052 plugin: org.jpc.plugins.RAWAudioDumper
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.
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
1067 \begin_inset Formula $2^{32}-1$
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
1075 \begin_inset Formula $2^{32}-1$
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
1084 \begin_layout Subsubsection
1085 plugin: org.jpc.plugins.LuaPlugin
1088 \begin_layout Standard
1089 Takes 'kernel=<name of lua kernel file>', other parameters are passed to
1090 kernel, requires and uses GUI.
1093 \begin_layout Standard
1094 Lua VM for executing scripts.
1097 \begin_layout Subsubsection
1098 plugin: org.jpc.plugins.JoystickInput
1101 \begin_layout Standard
1103 Displays window for sending joystick input.
1106 \begin_layout Section
1110 \begin_layout Subsection
1111 org.jpc.modules.Joystick:
1114 \begin_layout Itemize
1118 \begin_layout Itemize
1119 Resources: I/O port 0x201
1122 \begin_layout Standard
1123 Emulates joystick game port.
1126 \begin_layout Subsection
1127 org.jpc.modules.SoundCard
1130 \begin_layout Itemize
1131 Arguments: Optional resources specification
1134 \begin_layout Itemize
1135 Resources (defaults): I/O port 0x220-0x22F, IRQ 5, DMA 1, DMA 5
1138 \begin_layout Standard
1139 Emulates Sound card.
1142 \begin_layout Subsection
1143 org.jpc.modules.FMCard
1146 \begin_layout Itemize
1147 Arguments: Optional resources specification
1150 \begin_layout Itemize
1151 Resources (defaults): I/O port 0x338-0x33B
1154 \begin_layout Standard
1158 \begin_layout Subsection
1159 org.jpc.modules.BasicFPU:
1162 \begin_layout Itemize
1166 \begin_layout Itemize
1170 \begin_layout Standard
1171 Crude FPU (x87) emulator.
1174 \begin_layout Section
1178 \begin_layout Standard
1179 Hacks are saved to savestates but not movies.
1182 \begin_layout Subsection
1186 \begin_layout Standard
1187 Force bit 1 of physical address 0x0410 to zero, signaling that the system
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
1195 \begin_inset Quotes erd
1199 Try this if game startup hangs with lots of trying to use FPU but not present
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).
1206 \begin_layout Subsection
1210 \begin_layout Standard
1211 Update basic VGA parameters before vretrace, not after it.
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).
1219 \begin_layout Section
1220 Some error messages and explanations
1223 \begin_layout Itemize
1224 <filename> is Not a valid image file
1227 \begin_layout Itemize
1228 <filename> is not image file
1231 \begin_layout Itemize
1232 <filename> claims to be floppy with illegal geometry: <x> tracks, <y> sides
1236 \begin_layout Itemize
1237 <filename> claims to be HDD with illegal geometry: <x> tracks, <y> sides
1241 \begin_layout Itemize
1242 Can't read disk image sector map.
1245 \begin_layout Itemize
1246 Can't read disk image extent.
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.
1254 \begin_layout Itemize
1255 <filename> is image of unknown type.
1258 \begin_layout Itemize
1259 <filename> has unrecognized geometry <x> <y> <z>
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.
1267 \begin_layout Itemize
1268 Invalid format specifier <something>.
1271 \begin_layout Itemize
1272 Invalid syntax of --floppy= or --HDD= option.
1275 \begin_layout Itemize
1276 Invalid format specifier/option <something>.
1279 \begin_layout Standard
1280 Invalid option or format specifier was given.
1284 \begin_layout Itemize
1285 java ImageMaker [<options>...] <format> <destination> <source> <diskname>
1288 \begin_layout Standard
1289 Check syntax of command.
1290 Especially that diskname is present!
1293 \begin_layout Itemize
1294 The image has <nnn> sectors while it should have <yyy> according to selected
1298 \begin_layout Itemize
1299 Raw image file length not divisible by 512.
1302 \begin_layout Itemize
1303 Trying to read sector out of range.
1306 \begin_layout Standard
1307 The selected geometry is wrong or raw image is incomplete.
1310 \begin_layout Itemize
1311 Invalid disk name (Should not happen!).
1314 \begin_layout Itemize
1315 Invalid geometry to be written.
1318 \begin_layout Standard
1319 This is a very likely a bug in program.
1322 \begin_layout Itemize
1323 What the heck <filename> is? It's not regular file nor directory.
1326 \begin_layout Standard
1327 That sort of file can't be used as input for image making, or the file just
1331 \begin_layout Itemize
1332 BIOS images can only be made out of regular files.
1335 \begin_layout Itemize
1336 CD images can only be made out of regular files.
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.
1344 \begin_layout Itemize
1345 Can't read raw bios image file.
1348 \begin_layout Itemize
1349 Can't read sector <nnn> from image.
1352 \begin_layout Standard
1353 Reading the raw image file failed for some reason.
1356 \begin_layout Itemize
1357 Bad library line: "<something>".
1361 \begin_layout Standard
1362 Syntax error in image library.
1365 \begin_layout Itemize
1366 Removing image <something> a.k.a.
1367 "<something>" as it no longer exists.
1370 \begin_layout Standard
1371 The image file no longer exists so it gets removed from library.
1374 \begin_layout Itemize
1375 Removing image <something> a.k.a.
1376 "<something>" due to <some> conflict.
1379 \begin_layout Standard
1380 Image library code killed some image from library due to some kind of conflict
1381 with image being added.
1384 \begin_layout Itemize
1385 Too much data to fit into given space.
1388 \begin_layout Standard
1389 The tree you gave contains takes just too much space to fit into disk of
1393 \begin_layout Section
1394 Advanced: Savestate/movie format
1397 \begin_layout Subsection
1398 Special character classes
1401 \begin_layout Subsubsection
1405 \begin_layout Standard
1406 Following Unicode codepoints (encoded as UTF-8) are interpretted as space
1410 \begin_layout Itemize
1411 Codepoints 0x20, and 0x09.
1414 \begin_layout Itemize
1415 Codepoints 0x1680, 0x180E, 0x2028, 0x205F and 0x3000
1418 \begin_layout Itemize
1419 Codepoints 0x2000-0x200A.
1422 \begin_layout Subsubsection
1426 \begin_layout Standard
1427 Following byte sequences are interpretted as linefeeds (line change):
1430 \begin_layout Itemize
1431 Byte 0x0A (UTF-8 encoded codepoint 0x0A)
1434 \begin_layout Itemize
1435 Byte 0x0D (UTF-8 encoded codepoint 0x0D)
1438 \begin_layout Itemize
1439 Byte 0x1C (UTF-8 encoded codepoint 0x1C)
1442 \begin_layout Itemize
1443 Byte 0x1D (UTF-8 encoded codepoint 0x1D)
1446 \begin_layout Itemize
1447 Byte 0x1E (UTF-8 encoded codepoint 0x1E)
1450 \begin_layout Itemize
1451 Bytes 0xC2 0x85 (UTF-8 for unicode control character NL, codepoint 0x85)
1454 \begin_layout Itemize
1455 Bytes 0xE2 0x80 0xA9 (UTF-8 encoded codepoint 0x2029)
1458 \begin_layout Subsection
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.
1467 \begin_inset Quotes eld
1471 \begin_inset Quotes erd
1474 followed by LINEFEED character There are four kinds of lines after that
1475 (lines are terminated by LINEFEED byte/bytes):
1478 \begin_layout Itemize
1482 \begin_layout Itemize
1486 \begin_layout Itemize
1490 \begin_layout Itemize
1494 \begin_layout Standard
1495 Sequencing rules are as follows: Start member is allowed anywhere (after
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.
1503 \begin_layout Subsubsection
1507 \begin_layout Standard
1508 Start member line is given as
1509 \begin_inset Quotes eld
1513 \begin_inset Quotes erd
1516 <SPACE>+ <membername> <LINEFEED>.
1517 <SPACE>+ any number of SPACE characters at least one and <LINEFEED> is
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.
1525 \begin_layout Subsubsection
1529 \begin_layout Standard
1530 Member line is given as
1531 \begin_inset Quotes eld
1535 \begin_inset Quotes erd
1538 <content><LINEFEED>.
1539 It gives another line for member contents.
1540 <content> is passed raw to layers above (followed by line termination)
1543 \begin_layout Subsubsection
1547 \begin_layout Standard
1548 End member line is given as
1549 \begin_inset Quotes eld
1553 \begin_inset Quotes erd
1557 It ends the current member.
1558 The following line can only be start member line or file may end.
1561 \begin_layout Subsubsection
1565 \begin_layout Standard
1566 Blank line is given as <LINEFEED>.
1567 Lines like that are ignored.
1570 \begin_layout Subsection
1571 Four-to-Five encoding
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
1583 \begin_layout Subsubsection
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.
1593 \begin_layout Subsubsection
1594 Other four block types
1597 \begin_layout Standard
1598 Other four block types take the value to be encoded, read it as big-endian
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):
1605 \begin_layout Standard
1606 \begin_inset Tabular
1607 <lyxtabular version="3" rows="5" columns="6">
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">
1616 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1619 \begin_layout Plain Layout
1625 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1628 \begin_layout Plain Layout
1634 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1637 \begin_layout Plain Layout
1643 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1646 \begin_layout Plain Layout
1652 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1655 \begin_layout Plain Layout
1661 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1664 \begin_layout Plain Layout
1672 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1675 \begin_layout Plain Layout
1681 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1684 \begin_layout Plain Layout
1690 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1693 \begin_layout Plain Layout
1699 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1702 \begin_layout Plain Layout
1708 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1711 \begin_layout Plain Layout
1717 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1720 \begin_layout Plain Layout
1728 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1731 \begin_layout Plain Layout
1737 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1740 \begin_layout Plain Layout
1746 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1749 \begin_layout Plain Layout
1755 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1758 \begin_layout Plain Layout
1764 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1767 \begin_layout Plain Layout
1773 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1776 \begin_layout Plain Layout
1784 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1787 \begin_layout Plain Layout
1793 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1796 \begin_layout Plain Layout
1802 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1805 \begin_layout Plain Layout
1811 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1814 \begin_layout Plain Layout
1820 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1823 \begin_layout Plain Layout
1829 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1832 \begin_layout Plain Layout
1840 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1843 \begin_layout Plain Layout
1849 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1852 \begin_layout Plain Layout
1858 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1861 \begin_layout Plain Layout
1867 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1870 \begin_layout Plain Layout
1876 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1879 \begin_layout Plain Layout
1885 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1888 \begin_layout Plain Layout
1902 \begin_layout Standard
1903 Blocks which encode values greater than what is possible for value of that
1904 length are fatal errors.
1908 \begin_layout Subsection
1909 Line component encoing
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.
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:
1926 \begin_layout Itemize
1928 The depth is read pre-increment.
1931 \begin_layout Itemize
1933 The depth is read post-decrement.
1936 \begin_layout Itemize
1940 \begin_layout Standard
1941 The following characters are special:
1944 \begin_layout Itemize
1946 Increments depth by 1 if not escaped (and appears in component).
1949 \begin_layout Itemize
1951 Decrements depth by 1 if not escaped (and appears in component).
1952 Depth going negative is an error.
1955 \begin_layout Itemize
1959 Next character is interpretted as literal.
1960 Error if at end of line.
1963 \begin_layout Standard
1964 Otherwise, characters are interpretted as literals and appear in components.
1965 Depth must be zero at end of line.
1968 \begin_layout Subsection
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
1977 How many parameters are expected is dependent on what header it is:
1980 \begin_layout Subsubsection
1984 \begin_layout Itemize
1985 Header name: "PROJECTID"
1988 \begin_layout Itemize
1992 \begin_layout Itemize
1993 Argument #1: <project-id-string>
1996 \begin_layout Itemize
2000 \begin_layout Standard
2002 Project ID is generated when PC is assembled and is then preserved in save
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.
2009 \begin_layout Subsubsection
2013 \begin_layout Itemize
2014 Header name: "SAVESTATEID"
2017 \begin_layout Itemize
2021 \begin_layout Itemize
2022 Argument #1: <savestate-id-string>
2025 \begin_layout Itemize
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).
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
2045 \begin_layout Subsubsection
2049 \begin_layout Itemize
2050 Header name: "RERECORDS"
2053 \begin_layout Itemize
2057 \begin_layout Itemize
2058 Argument #1: <rerecords>
2061 \begin_layout Itemize
2065 \begin_layout Standard
2066 Gives rerecord count.
2067 PC assembly (except when loading save state) initializes current rerecord
2069 Must be non-negative and decimal number using ASCII digit characters.
2072 \begin_layout LyX-Code
2073 On loading save state:
2076 \begin_layout LyX-Code
2077 1) If project ID matches with previous:
2080 \begin_layout LyX-Code
2081 1a) If loaded rerecord count is larger or equal to current rerecord count:
2084 \begin_layout LyX-Code
2085 1a-a) Current rerecord count is loaded rerecord count + 1.
2088 \begin_layout LyX-Code
2092 \begin_layout LyX-Code
2093 1b-a) Current rerecord count increments by 1.
2096 \begin_layout LyX-Code
2100 \begin_layout LyX-Code
2101 2a) Current rerecord count is loaded rerecord count + 1.
2104 \begin_layout Standard
2105 The current rerecord count at time of save is saved to save state.
2108 \begin_layout Subsubsection
2112 \begin_layout Itemize
2113 Header name: "AUTHORS"
2116 \begin_layout Itemize
2117 Components: 2 or more
2120 \begin_layout Itemize
2121 Arguments: free form
2124 \begin_layout Itemize
2128 \begin_layout Standard
2129 Gives authors of run.
2130 Each argument gives one author.
2131 May be present multiple times.
2134 \begin_layout Subsubsection
2138 \begin_layout Itemize
2139 Header name: "COMMENT"
2142 \begin_layout Itemize
2143 Components: 2 or more
2146 \begin_layout Itemize
2147 Arguments: free form
2150 \begin_layout Itemize
2154 \begin_layout Standard
2155 Various kinds of free form data.
2156 Not parsed further by emulator.
2159 \begin_layout Subsection
2160 Initialization segment:
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).
2169 \begin_layout Standard
2170 Following parameters are used (space separates components):
2173 \begin_layout LyX-Code
2177 \begin_layout Standard
2178 Gives Image ID of main system BIOS (mandatory)
2181 \begin_layout LyX-Code
2185 \begin_layout Standard
2186 Gives Image ID of VGA BIOS (mandatory).
2189 \begin_layout LyX-Code
2193 \begin_layout Standard
2194 Gives Image ID of hda.
2195 Present only if system has hard disk hda.
2198 \begin_layout LyX-Code
2202 \begin_layout Standard
2203 Gives Image ID of hdb.
2204 Present only if system has hard disk hdb.
2207 \begin_layout LyX-Code
2211 \begin_layout Standard
2212 Gives Image ID of hdc.
2213 Present only if system has hard disk hdc.
2216 \begin_layout LyX-Code
2220 \begin_layout Standard
2221 Gives Image ID of hdd.
2222 Present only if system has hard disk hdd.
2225 \begin_layout LyX-Code
2229 \begin_layout Standard
2230 Gives Image ID of disk in slot <num>.
2231 Slot number must be non-negative.
2234 \begin_layout LyX-Code
2235 \begin_inset Quotes eld
2239 \begin_inset Quotes erd
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
2253 \begin_inset Quotes erd
2259 \begin_layout LyX-Code
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.
2269 \begin_layout LyX-Code
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.
2279 \begin_layout LyX-Code
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.
2290 \begin_layout LyX-Code
2291 "INITIALTIME" <time>
2294 \begin_layout Standard
2295 Number of milliseconds since Unix epoch to system start up time.
2299 \begin_layout Standard
2304 \begin_layout LyX-Code
2305 "CPUDIVIDER" <divider>
2308 \begin_layout Standard
2309 Set CPU frequency divider (dividing the 1GHz master clock).
2310 Allowed range is 1-256.
2314 \begin_layout LyX-Code
2315 "MEMORYSIZE" <pages>
2318 \begin_layout Standard
2319 Number of 4KiB pages of RAM memory.
2320 Allowed range 256-262144.
2324 \begin_layout LyX-Code
2328 \begin_layout Standard
2330 Valid devices are "FLOPPY" (boot from fda), "HDD" (boot from hda) and "CDROM"
2334 \begin_layout LyX-Code
2335 "LOADMODULEA" <module> <parameters>
2338 \begin_layout Standard
2339 Load module <module> with parameters <parameters>.
2342 \begin_layout LyX-Code
2343 "LOADMODULE" <module>
2346 \begin_layout Standard
2347 Load module <module> with no parameters
2350 \begin_layout LyX-Code
2351 \begin_inset Quotes eld
2355 \begin_inset Quotes erd
2361 \begin_layout Standard
2362 Use class <fpu> as FPU emulator.
2365 \begin_layout LyX-Code
2366 \begin_inset Quotes eld
2370 \begin_inset Quotes erd
2376 \begin_layout Standard
2377 Use I/O port delay emulation (each I/O port read/write takes 666ns).
2380 \begin_layout LyX-Code
2381 \begin_inset Quotes eld
2385 \begin_inset Quotes erd
2391 \begin_layout Standard
2392 Emulate VGA horizontal retrace.
2395 \begin_layout Subsection
2396 Event record format:
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.
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
2413 It is error to encounter unknown such special class.
2416 \begin_layout Subsubsection
2420 \begin_layout Itemize
2421 Dispatch to: SAVESTATE
2424 \begin_layout Itemize
2425 Argument #1: Savestate id
2428 \begin_layout Itemize
2429 Argument #2 (optional): Rerecord count at time of saving savestate
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
2441 \begin_layout Subsubsection
2445 \begin_layout Itemize
2449 \begin_layout Itemize
2451 \begin_inset Quotes eld
2455 \begin_inset Quotes erd
2459 \begin_inset Quotes eld
2463 \begin_inset Quotes erd
2469 \begin_layout Standard
2470 Controls various options.
2472 \begin_inset Quotes eld
2476 \begin_inset Quotes erd
2479 turns on absolute mode (default) where event timestamps are absolute.
2481 \begin_inset Quotes eld
2485 \begin_inset Quotes erd
2488 turns on relative mode where event timestamps are relative to last event
2490 The OPTION event itself is not affected by timing change.
2491 No time restrictions.
2492 Unknown arguments are errors.
2495 \begin_layout Subsubsection
2496 Keyboard keypress/keyrelease event:
2499 \begin_layout Itemize
2500 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2503 \begin_layout Itemize
2504 Argument #1: Fixed: "KEYEDGE"
2507 \begin_layout Itemize
2508 Argument #2: Key number.
2509 Valid values are 1-83, 85-95, 129-197 and 199-223
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.
2520 \begin_layout Subsubsection
2524 \begin_layout Itemize
2525 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2528 \begin_layout Itemize
2529 Argument #1: Fixed: "PAUSE"
2532 \begin_layout Standard
2533 Send pause key event.
2534 The time restrictions are identical to KEYEDGE event.
2537 \begin_layout Subsubsection
2541 \begin_layout Itemize
2542 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2545 \begin_layout Itemize
2546 Argument #1: Fixed: "MOUSEBUTTON"
2549 \begin_layout Itemize
2550 Argument #2: Number of button to release or press (0-4)
2553 \begin_layout Standard
2554 Presses or releases the designated mouse button.
2557 \begin_layout Subsubsection
2558 X mouse motion event:
2561 \begin_layout Itemize
2562 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2565 \begin_layout Itemize
2566 Argument #1: Fixed: "XMOUSEMOTION"
2569 \begin_layout Itemize
2570 Argument #2: Number of units to move (-255 - 255)
2573 \begin_layout Standard
2574 Move the mouse in X direction by specified amount.
2578 \begin_layout Subsubsection
2579 Y mouse motion event:
2582 \begin_layout Itemize
2583 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2586 \begin_layout Itemize
2587 Argument #1: Fixed: "YMOUSEMOTION"
2590 \begin_layout Itemize
2591 Argument #2: Number of units to move (-255 - 255)
2594 \begin_layout Standard
2595 Move the mouse in Y direction by specified amount.
2599 \begin_layout Subsubsection
2600 Z mouse motion event:
2603 \begin_layout Itemize
2604 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2607 \begin_layout Itemize
2608 Argument #1: Fixed: "ZMOUSEMOTION"
2611 \begin_layout Itemize
2612 Argument #2: Number of units to move (-7 - 7)
2615 \begin_layout Standard
2616 Move the mouse in Z direction (scrollwheel) by specified amount.
2619 \begin_layout Subsubsection
2620 Joystick button event:
2623 \begin_layout Itemize
2624 Dispatch to: org.jpc.modules.Joystick
2627 \begin_layout Itemize
2629 \begin_inset Quotes eld
2633 \begin_inset Quotes erd
2637 \begin_inset Quotes eld
2641 \begin_inset Quotes erd
2645 \begin_inset Quotes eld
2649 \begin_inset Quotes erd
2653 \begin_inset Quotes eld
2657 \begin_inset Quotes erd
2663 \begin_layout Itemize
2665 \begin_inset Quotes eld
2669 \begin_inset Quotes erd
2673 \begin_inset Quotes eld
2677 \begin_inset Quotes erd
2683 \begin_layout Standard
2684 Send button down/up event.
2685 No time restrictions.
2688 \begin_layout Subsubsection
2689 Joystick axis event:
2692 \begin_layout Itemize
2693 Dispatch to: org.jpc.modules.Joystick
2696 \begin_layout Itemize
2698 \begin_inset Quotes eld
2702 \begin_inset Quotes erd
2706 \begin_inset Quotes eld
2710 \begin_inset Quotes erd
2714 \begin_inset Quotes eld
2718 \begin_inset Quotes erd
2722 \begin_inset Quotes eld
2726 \begin_inset Quotes erd
2732 \begin_layout Itemize
2733 Argument #2: Multivibrator unstable state length in ns.
2736 \begin_layout Standard
2737 Set amount of time multivibrator remains in unstable state.
2738 No time restrictions.
2741 \begin_layout Subsubsection
2745 \begin_layout Itemize
2746 Dispatch to: org.jpc.emulator.PC$ResetButton
2749 \begin_layout Itemize
2753 \begin_layout Standard
2757 \begin_layout Subsubsection
2761 \begin_layout Itemize
2762 Dispatch to: org.jpc.emulator.PC$DiskChanger
2765 \begin_layout Itemize
2766 Argument #1: Fixed: "FDA"
2769 \begin_layout Itemize
2770 Argument #2: Number of image slot to put there.
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.
2783 \begin_layout Subsubsection
2787 \begin_layout Itemize
2788 Dispatch to: org.jpc.emulator.PC$DiskChanger
2791 \begin_layout Itemize
2792 Argument #1: Fixed: "FDB"
2795 \begin_layout Itemize
2796 Argument #2: Number of image slot to put there.
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.
2809 \begin_layout Subsubsection
2813 \begin_layout Itemize
2814 Dispatch to: org.jpc.emulator.PC$DiskChanger
2817 \begin_layout Itemize
2818 Argument #1: Fixed: "CDROM"
2821 \begin_layout Itemize
2822 Argument #2: Number of image slot to put there.
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.
2834 \begin_layout Standard
2835 This event has no effect if CD-ROM is locked.
2838 \begin_layout Subsubsection
2839 Write protect floppy:
2842 \begin_layout Itemize
2843 Dispatch to: org.jpc.emulator.PC$DiskChanger
2846 \begin_layout Itemize
2847 Argument #1: Fixed: "WRITEPROTECT"
2850 \begin_layout Itemize
2851 Argument #2: Number of image slot to manipulate
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.
2859 \begin_layout Subsubsection
2860 Write unprotect floppy:
2863 \begin_layout Itemize
2864 Dispatch to: org.jpc.emulator.PC$DiskChanger
2867 \begin_layout Itemize
2868 Argument #1: Fixed: "WRITEUNPROTECT"
2871 \begin_layout Itemize
2872 Argument #2: Number of image slot to manipulate
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.
2880 \begin_layout Subsection
2884 \begin_layout Standard
2885 Diskinfo sections are named
2886 \begin_inset Quotes eld
2890 \begin_inset Quotes erd
2894 They use line component encoding, fieldtype being first component on each
2895 line (value being the second).
2896 Following fields are defined:
2899 \begin_layout Subsubsection
2903 \begin_layout Standard
2904 Gives type of image.
2908 \begin_layout Itemize
2909 \begin_inset Quotes eld
2913 \begin_inset Quotes erd
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
2949 (BIOS/VGABIOS image)
2952 \begin_layout Itemize
2953 \begin_inset Quotes eld
2957 \begin_inset Quotes erd
2960 (what the heck is this???)
2963 \begin_layout Subsubsection
2967 \begin_layout Standard
2971 \begin_layout Subsubsection
2975 \begin_layout Standard
2976 (BIOS images only) Gives length of BIOS image
2979 \begin_layout Subsubsection
2983 \begin_layout Standard
2984 MD5 of raw disk/BIOS image without any headers or trailers.
2987 \begin_layout Subsubsection
2991 \begin_layout Standard
2992 (FLOPPY/HDD/CDROM images only) Number of total sectors on disk.
2995 \begin_layout Subsubsection
2999 \begin_layout Standard
3000 (FLOPPY/HDD images only) Number of tracks on disk per side (1-256 for floppy,
3004 \begin_layout Subsubsection
3008 \begin_layout Standard
3009 (FLOPPY/HDD images only) Number of sides on disk (1 or 2 for floppy, 1-16
3013 \begin_layout Subsubsection
3017 \begin_layout Standard
3018 (FLOPPY/HDD images only) Number of sectors per track (1-255 for floppy,
3022 \begin_layout Subsubsection
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)
3032 \begin_layout Subsection
3036 \begin_layout Standard
3037 Output info is stored in section
3038 \begin_inset Quotes eld
3042 \begin_inset Quotes erd
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
3052 \begin_layout Subsubsection
3056 \begin_layout Standard
3057 For video output, there are no parameters so line is just
3058 \begin_inset Quotes eld
3062 \begin_inset Quotes erd
3068 \begin_layout Subsubsection
3072 \begin_layout Standard
3073 For audio output, the only parameter is name of output, so first component
3075 \begin_inset Quotes eld
3079 \begin_inset Quotes erd
3082 and second component is name of audio output.
3085 \begin_layout Subsection
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
3095 \begin_layout Section
3096 Advanced: Making class dumpable
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).
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.
3117 \begin_layout Standard
3118 Following these fixed parts, dump all members that are part of mutable state
3122 \begin_layout Subsection
3123 Member dumping/loading functions
3126 \begin_layout Standard
3127 There is dumping/loading function for following (all functions dumping/loading
3128 reference types can handle null):
3131 \begin_layout Itemize
3132 boolean: SRDumper.dumpBoolean, SRLoader.loadBoolean
3135 \begin_layout Itemize
3136 byte: SRDumper.dumpByte, SRLoader.loadByte
3139 \begin_layout Itemize
3140 short: SRDumper.dumpShort, SRLoader.loadShort
3143 \begin_layout Itemize
3144 int: SRDumper.dumpInt, SRLoader.loadInt
3147 \begin_layout Itemize
3148 long: SRDumper.dumpLong, SRLoader.loadLong
3151 \begin_layout Itemize
3152 String: SRDumper.dumpString, SRLoader.loadString
3155 \begin_layout Itemize
3156 boolean[]: SRDumper.dumpArray, SRLoader.loadArrayBoolean
3159 \begin_layout Itemize
3160 byte[]: SRDumper.dumpArray, SRLoader.loadArrayByte
3163 \begin_layout Itemize
3164 short[]: SRDumper.dumpArray, SRLoader.loadArrayShort
3167 \begin_layout Itemize
3168 int[]: SRDumper.dumpArray, SRLoader.loadArrayInt
3171 \begin_layout Itemize
3172 long[]: SRDumper.dumpArray, SRLoader.loadArrayLong
3175 \begin_layout Itemize
3176 double[]: SRDumper.dumpArray, SRLoader.loadArrayDouble
3179 \begin_layout Itemize
3180 <dumpable type>: SRDumper.dumpObject, SRLoader.loadObject
3183 \begin_layout Itemize
3184 special object: SRDumper.specialObject, SRLoader.specialObject
3187 \begin_layout Subsubsection
3191 \begin_layout Itemize
3192 Dumpable objects come out as type of org.jpc.emulator.SRDumpable.
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.
3200 \begin_layout Itemize
3201 Don't dump fields related to event state feedback.
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.
3209 \begin_layout Itemize
3210 Some connectors dump fields related to connector output, some don't.
3213 \begin_layout Section
3214 Advanced: Making output connectors
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.
3224 \begin_layout Subsection
3225 Interface org.jpc.emulator.OutputConnector
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.
3236 \begin_layout Subsubsection
3237 Method subscribeOutput(Object)
3240 \begin_layout Standard
3241 Subscribes the output, with specified object as handle.
3244 \begin_layout Subsubsection
3245 Method unsubscribeOutput(Object)
3248 \begin_layout Standard
3249 Unsubscribe the specified handle object from output.
3252 \begin_layout Subsubsection
3253 Method waitOutput(Object)
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.
3262 \begin_layout Subsubsection
3263 Method releaseOutput(Object)
3266 \begin_layout Standard
3267 Release connector from p.o.v.
3272 \begin_layout Subsubsection
3276 \begin_layout Standard
3277 Release threads waiting on waitOutput() and block until all subscribers
3278 have returned from waitOutput() and enteired releaseOutput().
3281 \begin_layout Subsubsection
3282 Method releaseOutputWaitAll(object)
3285 \begin_layout Standard
3286 Like releaseOutput(), but waits until all handles have released their output.
3289 \begin_layout Subsection
3290 Class org.jpc.emulator.VGADigtalOut
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
3300 \begin_layout Subsubsection
3304 \begin_layout Standard
3305 Get width of display (watch out, can return 0).
3308 \begin_layout Subsubsection
3312 \begin_layout Standard
3313 Get height of display (watch out, can return 0).
3316 \begin_layout Subsubsection
3317 Methods getDirtyXMin(), getDirtyXMax(), getDirtyYMin(), getDirtyYMax()
3320 \begin_layout Standard
3321 Returns the dirty region (region modified since last output).
3324 \begin_layout Subsubsection
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>
3335 \begin_layout Subsubsection
3336 Method resizeDisplay(int _width, int _height)
3339 \begin_layout Standard
3340 Resize the display to be of specified size.
3343 \begin_layout Subsubsection
3344 Method dirtyDisplayRegion(int x, int y, int w, int h)
3347 \begin_layout Standard
3348 Mark the specified region as dirty.
3351 \begin_layout Subsubsection
3352 Method resetDirtyRegion()
3355 \begin_layout Standard
3356 Resets the dirty region to be empty.
3359 \begin_layout Subsection
3360 Class org.jpc.emulator.PC method getVideoOutput()
3363 \begin_layout Standard
3364 Get VGA output connector for PC.
3367 \begin_layout Subsection
3368 Interface org.jpc.emulator.DisplayController.
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.
3377 \begin_layout Subsubsection
3378 Method getOutputDevice()
3381 \begin_layout Standard
3382 Get VGA output connector for this VGA device.
3385 \begin_layout Subsection
3386 Class org.jpc.emulator.SoundDigitalOut
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.
3396 \begin_layout Subsubsection
3397 Method addSample(long, short, short)
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.
3405 \begin_layout Subsubsection
3406 Method addSample(long, short)
3409 \begin_layout Standard
3410 Add mono sample at time given by first argument.
3411 The second argument give volume on both channels.
3414 \begin_layout Subsubsection
3415 Method readBlock(Block)
3418 \begin_layout Standard
3419 Reads block of output (atomic versus addSample).
3420 Block structure has following fields which are filled:
3423 \begin_layout Itemize
3424 timeBase: Time base for block.
3427 \begin_layout Itemize
3428 baseLeft: Left volume at time base.
3431 \begin_layout Itemize
3432 baseRight: Right volume at time base
3435 \begin_layout Itemize
3436 blockNo: Sequence number of block filled.
3439 \begin_layout Itemize
3440 samples: Number of samples in block
3443 \begin_layout Itemize
3444 sampleTiming: Number of nanoseconds since last sample
3447 \begin_layout Itemize
3448 sampleLeft: Left channel samples
3451 \begin_layout Itemize
3452 sampleRight: Right channel samples
3455 \begin_layout Subsection
3456 Interface org.jpc.emulator.SoundOutputDevice
3459 \begin_layout Standard
3460 Implementing this interface signals that module has audio output channels.
3463 \begin_layout Subsubsection
3464 Method org.jpc.emulator.SoundOutputDevice.requestedSoundChannels()
3467 \begin_layout Standard
3468 Return the number of sound channels module has.
3471 \begin_layout Subsubsection
3472 Method org.jpc.emulator.SoundOutputDevice.soundChannelCallback(SoundDigitalOut)
3475 \begin_layout Standard
3476 This is called once per sound channel requested giving precreated sound
3480 \begin_layout Subsection
3481 Class org.jpc.emulator.PC method getSoundOut(String)
3484 \begin_layout Standard
3485 Get sound output with specified name.
3488 \begin_layout Section
3489 Advanced: Writing event targets
3492 \begin_layout Standard
3493 Whereas output connectors are the way output is dispatched, input is dispatched
3495 Event targets need to implement interface org.jpc.emulator.EventDispatchTarget.
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.
3504 \begin_layout Subsection
3505 Interface org.jpc.emulator.EventDispatchTarget
3508 \begin_layout Standard
3509 Interface that marks class capable of receiving events.
3512 \begin_layout Subsubsection
3513 Method setEventRecorder(EventRecorder)
3516 \begin_layout Standard
3517 Set the event recorder input events are sent to.
3520 \begin_layout Subsubsection
3521 Method startEventCheck()
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
3530 \begin_layout Subsubsection
3531 Method doEvent(long, String[], int) throws IOException
3534 \begin_layout Standard
3535 Event dispatch handler.
3536 The first argument is event time, second is parameters and third is what
3538 If target doesn't like the event, throw IOException.
3539 Following types (the integer parameter) are used:
3542 \begin_layout LyX-Code
3543 0 (EventRecorder.EVENT_TIMED): Time has been assigned for event.
3546 \begin_layout LyX-Code
3547 1 (EventRecorder.EVENT_STATE_EFFECT_FUTURE): Future event in event replay
3548 for reinitialization
3551 \begin_layout LyX-Code
3552 2 (EventRecorder.EVENT_STATE_EFFECT): Past event in event replay reinitialization
3555 \begin_layout LyX-Code
3556 3 (EventRecorder.EVENT_EXECUTE): This event occurs now.
3560 \begin_layout Subsubsection
3561 Method endEventCheock()
3564 \begin_layout Standard
3565 End event reinitialization.
3569 \begin_layout Subsubsection
3570 Method getEventTimeLowBound(long, String[]) throws IOException
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
3577 The long parameter gives the current scheduled time for event.
3580 \begin_layout Section
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.
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.
3600 \begin_layout Section
3604 \begin_layout Standard
3605 Plugins handle various UI tasks.
3606 They need to implement interface org.jpc.Plugin.
3609 \begin_layout Subsection
3610 Interface org.jpc.pluginsbase.Plugin
3613 \begin_layout Subsubsection
3614 Method systemShutdown()
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
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
3627 \begin_layout Subsubsection
3628 Method reconnect(PC)
3631 \begin_layout Standard
3632 Gives new PC to connect to.
3633 Null is passed if plugin should disconnect.
3636 \begin_layout Subsubsection
3640 \begin_layout Standard
3641 Called in dedicated thread after plugin is initialized.
3644 \begin_layout Subsubsection
3648 \begin_layout Standard
3649 Called after PC has stopped.
3652 \begin_layout Subsubsection
3656 \begin_layout Standard
3657 Called before PC starts.
3660 \begin_layout Subsubsection
3661 Method notifyArguments(String[])
3664 \begin_layout Standard
3665 Pass arguments from command line.
3668 \begin_layout Subsubsection
3669 Constructor <init>(Plugins)
3672 \begin_layout Standard
3673 This constructor is used to initialize plugins that don't take parameters.
3676 \begin_layout Subsubsection
3677 Constructor <init>(Plugins, String)
3680 \begin_layout Standard
3681 This constructor is used to initialize plugins that take parameters.
3684 \begin_layout Subsection
3685 Class org.jpc.pluginsbase.Plugins
3688 \begin_layout Standard
3689 This class provodes various methods for manipulating plugins.
3692 \begin_layout Subsubsection
3693 Method isShuttingDown()
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.
3702 \begin_layout Subsubsection
3703 Method shutdownEmulator()
3706 \begin_layout Standard
3707 Shut down and exit the emulator.
3708 All plugin shutdown functions are called in this thread.
3711 \begin_layout Subsubsection
3712 Method reconnectPC(PC)
3715 \begin_layout Standard
3716 Signal reconnectPC event to all plugins.
3719 \begin_layout Subsubsection
3723 \begin_layout Standard
3724 Signal pcStarting() event to all plugins.
3727 \begin_layout Subsubsection
3731 \begin_layout Standard
3732 Signal pcStopping() event to all plugins.
3735 \begin_layout Section
3736 Inter-plugin communication
3739 \begin_layout Subsection
3740 Receiving communications
3743 \begin_layout Standard
3744 To receive invocation/call by name 'foo-bar', declare public method named
3746 Arguments to this method can currently be String, Integer (int) or 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
3753 If return value is boolean true, it is assumed that there is more processing.
3756 \begin_layout Subsection
3757 void org.jpc.pluginsbase.Plugins.invokeExternalCommand(String cmd, Object[]
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.
3767 \begin_layout Subsection
3768 void org.jpc.pluginsbase.Plugins.invokeExternalCommandSynchronous(String cmd,
3772 \begin_layout Standard
3773 Same as invokeExternalCommand, but waits for slow commands to complete.
3776 \begin_layout Subsection
3777 Object[] org.jpc.pluginsbase.Plugins.invokeExternalCommandReturn(String cmd,
3781 \begin_layout Standard
3782 Similar to invokeExternalCommandSynchornous, but:
3785 \begin_layout Itemize
3786 Quits calling more plugins when it gets successful reply.
3789 \begin_layout Itemize
3793 \begin_layout Subsection
3794 void org.jpc.pluginsbase.Plugins.returnValue(Object...
3798 \begin_layout Standard
3799 Gives return value to return from call and signals that command has completed.
3802 \begin_layout Subsection
3803 void org.jpc.pluginsbase.Plugins.signalCommandCompletion()
3806 \begin_layout Standard
3807 Signals that command has completed.
3808 Only needed if there is no return value and eci_ method returned false
3812 \begin_layout Section
3813 Lua kernel programming
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.
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.
3827 \begin_layout Itemize
3828 Always grab any functions used into local variables so nobody can mess with
3832 \begin_layout Itemize
3833 Don't use global variables in kernel (except for those passed).