Don't use popups, use statusbar
[jpcrr.git] / manual.lyx
blob4ae9b90b0d085946bd87b623c9721f6efb25024d
1 #LyX 1.6.6 created this file. For more info see http://www.lyx.org/
2 \lyxformat 345
3 \begin_document
4 \begin_header
5 \textclass article
6 \use_default_options true
7 \language finnish
8 \inputencoding auto
9 \font_roman default
10 \font_sans default
11 \font_typewriter default
12 \font_default_family default
13 \font_sc false
14 \font_osf false
15 \font_sf_scale 100
16 \font_tt_scale 100
18 \graphics default
19 \paperfontsize default
20 \spacing single
21 \use_hyperref false
22 \papersize default
23 \use_geometry true
24 \use_amsmath 1
25 \use_esint 1
26 \cite_engine basic
27 \use_bibtopic false
28 \paperorientation portrait
29 \leftmargin 2cm
30 \topmargin 2cm
31 \rightmargin 1cm
32 \bottommargin 2cm
33 \headheight 1cm
34 \headsep 1cm
35 \footskip 1cm
36 \secnumdepth 3
37 \tocdepth 3
38 \paragraph_separation indent
39 \defskip medskip
40 \quotes_language english
41 \papercolumns 1
42 \papersides 1
43 \paperpagestyle default
44 \tracking_changes false
45 \output_changes false
46 \author "" 
47 \author "" 
48 \end_header
50 \begin_body
52 \begin_layout Title
53 JPC-RR: User's manual
54 \end_layout
56 \begin_layout Section
57 Licence
58 \end_layout
60 \begin_layout Standard
61 JPC-RR is licenced under GNU GPL v2.
62  See file 
63 \begin_inset Quotes eld
64 \end_inset
66 LICENSE
67 \begin_inset Quotes erd
68 \end_inset
71 \end_layout
73 \begin_layout Section
74 Getting started
75 \end_layout
77 \begin_layout Subsection
78 Prerequisites
79 \end_layout
81 \begin_layout Standard
82 To get started, you need BIOS image, VGABIOS image and DOS boot floppy and
83  JDK for Java 6 standard edition (later versions should they appear should
84  also work).
85  Note: JRE is not enough.
87 \end_layout
89 \begin_layout Standard
90 Note that to play back recorded movies, you need exact same version of BIOS
91  image, VGABIOS image and DOS boot floppy as was used when making the movie
92  (in addition to exact same versions of other needed media).
93 \end_layout
95 \begin_layout Subsection
96 Compiling
97 \end_layout
99 \begin_layout Standard
100 See compile.sh or compile.bat.
101  The streamtools stuff is only needed for dumping videos.
102 \end_layout
104 \begin_layout Subsection
105 Getting started
106 \end_layout
108 \begin_layout Standard
109 First you need to get and make some important images.
110  Obtain BIOS image, VGABIOS image and DOS boot floppy from somewhere.
111  After starting the emulator, use Drives -> Import Image to import the images
112  (ignore the error about no BIOS images being found).
113 \end_layout
115 \begin_layout Subsection
116 Running emulator
117 \end_layout
119 \begin_layout Standard
120 There is premade autoexec script called assemble.jpcrrinit that has fairly
121  reasonable defaults.
122  To use it:
123 \end_layout
125 \begin_layout LyX-Code
126 java JPCApplication -library library -autoexec assemble.jpcrrinit
127 \end_layout
129 \begin_layout Standard
130 The 
131 \begin_inset Quotes eld
132 \end_inset
134 -library library
135 \begin_inset Quotes erd
136 \end_inset
138  specifies that contents of directory 'library' are to be used as library.
139  The script pops up settings for new emulated PC (if you want to load savestate,
140  click cancel).
141  Select BIOS and VGABIOS for BIOS and VGABIOS image (they should be already
142  selected), DOSfloppy for fda (boot device should be set to fda) and game
143  image as some HD drive 
144 \end_layout
146 \begin_layout Subsection
147 Bootup tips
148 \end_layout
150 \begin_layout Itemize
151 Putting the game as hdd (the fourth hard disk slot) causes boot to be bit
152  faster.
153 \end_layout
155 \begin_layout Itemize
156 Some BIOS versions have 
157 \begin_inset Quotes eld
158 \end_inset
160 press F12 to select boot device
161 \begin_inset Quotes erd
162 \end_inset
165  Hit <enter> from emulated keyboard and that prompt will go away in about
166  half emulated second (it stays several emulated seconds otherwise).
168 \end_layout
170 \begin_layout Itemize
171 If game doesn't need lots of memory, hitting F5 to skip intialization files
172  is fastest.
173  If it does need more memory, run config.sys commands but not autoexec.bat.
175 \end_layout
177 \begin_layout Itemize
178 Some DOS disks have DOSIDLE with them, don't use it as it messes badly with
179  emulator.
180 \end_layout
182 \begin_layout Section
183 Making JPC-RR format images from raw images
184 \end_layout
186 \begin_layout Standard
187 Due to various factors, JPC-RR can't use raw image files directly but requires
188  its own image format.
190 \end_layout
192 \begin_layout Subsection
193 Importing images from GUI:
194 \end_layout
196 \begin_layout Standard
197 Use Drives -> Import Image to import existing directories or image files.
198  Dialog prompting parameters will be displayed.
199  When importing floppy images, check 
200 \begin_inset Quotes eld
201 \end_inset
203 standard geometry
204 \begin_inset Quotes erd
205 \end_inset
207  if possible, that enables geometry autodetection, which is reasonable virtually
208  all of the time it is offered.
209 \end_layout
211 \begin_layout Subsection
212 Notes
213 \end_layout
215 \begin_layout Itemize
216 If making image from directory, the names of the files must conform to FAT
217  naming restrictions (8+3 character names, no spaces, etc).
218  Avoid filenames with non-ASCII characters.
220 \end_layout
222 \begin_layout Itemize
223 The DOS limit of 112 or 224 files for floppies does not apply to images
224  created from directory trees.
225  The minimum limit value used is 512.
226  If even that isn't enough, the limit is automatically increased to fit
227  all the needed directory entries.
228 \end_layout
230 \begin_layout Itemize
231 Making boot disks from tree does NOT work.
232  Even if you got system boot files there, it still won't work.
233 \end_layout
235 \begin_layout Itemize
236 Only floppy disks and hard drives can be made from directory trees.
237  BIOS images and CDROM images require image file.
238 \end_layout
240 \begin_layout Itemize
241 Avoid floppies with custom geometry (floppy geometry does affect disk ID).
242  Disks with over 63 sectors per track don't work with DOS.
243  Wheither disks with over 127 tracks per side work with DOS is unknown.
244  Also avoid 1024-tracks per side HDDs.
245 \end_layout
247 \begin_layout Itemize
248 The geometry limits are: 2-1024 tracks per side for HDD, 1-256 tracks per
249  side for floppy.
250  1-63 sectors per track for HDD, 1-255 sectors per track for floppy.
251  1-16 sides for HDD, 1 or 2 sides for floppy.
252  This gives size limit of 65280KiB for floppy disks (but note the DOS limit!)
253  and 516096KiB for HDDs.
254 \end_layout
256 \begin_layout Itemize
257 There are multiple image file contents that represent the same image.
258  The one with smallest size is picked when creating image.
259 \end_layout
261 \begin_layout Itemize
262 Note: Although the IDs are 128 bits long, they are not MD5 hashes.
264 \end_layout
266 \begin_layout Subsection
267 Importing from command line
268 \end_layout
270 \begin_layout Standard
271 There is tool called ImageMaker that can make JPC-RR images from raw images.
272  Each image has format, ID an name.
273  Format and name are specified when making image.
274  ID is automatically calculated from format and contents.
275  Name does not affect the ID but is purely for convience so one doesn't
276  have to specify long image IDs manually.
277 \end_layout
279 \begin_layout Subsubsection
280 Syntax
281 \end_layout
283 \begin_layout Standard
284 The syntax for ImageMaker when making images is:
285 \end_layout
287 \begin_layout LyX-Code
288 $ java ImageMaker <format> [<options>...] <destination> <source> <name>
289 \end_layout
291 \begin_layout Standard
292 <destination> is file name for JPC-RR format image to write.
293  <source> is either name of regular file (raw image file) or name of directory
294  tree with files (supported for making floppy or hard disk images only).
295  In case of directory tree, the files are layout deterministically to disk,
296  so the ID will always be the same for given geometry and type.
297  <name> is name to give to disk.
298  <format> is one of:
299 \end_layout
301 \begin_layout LyX-Code
302 --BIOS BIOS image (note: VGABIOS is also of this type).
303 \end_layout
305 \begin_layout LyX-Code
306 --CDROM CD-ROM image.
307 \end_layout
309 \begin_layout LyX-Code
310 --HDD=cylinders,sectors,heads Hard disk with specified geometry.
311 \end_layout
313 \begin_layout LyX-Code
314 --floppy=tracks,sectors,sides Floppy disk with specified geometry.
315 \end_layout
317 \begin_layout LyX-Code
318 --floppy160 160KiB floppy (40 tracks, 8 sectors, Single sided).
319 \end_layout
321 \begin_layout LyX-Code
322 --floppy180 180KiB floppy (40 tracks, 9 sectors, Single sided).
323 \end_layout
325 \begin_layout LyX-Code
326 --floppy320 320KiB floppy (40 tracks, 8 sectors, Double sided).
327 \end_layout
329 \begin_layout LyX-Code
330 --floppy360 360KiB floppy (40 tracks, 9 sectors, Double sided).
331 \end_layout
333 \begin_layout LyX-Code
334 --floppy410 410KiB floppy (41 tracks, 10 sectors, Double sided).
335 \end_layout
337 \begin_layout LyX-Code
338 --floppy420 420KiB floppy (42 tracks, 10 sectors, Double sided).
339 \end_layout
341 \begin_layout LyX-Code
342 --floppy720 720KiB floppy (80 tracks, 9 sectors, Double sided).
343 \end_layout
345 \begin_layout LyX-Code
346 --floppy800 800KiB floppy (80 tracks, 10 sectors, Double sided).
347 \end_layout
349 \begin_layout LyX-Code
350 --floppy820 820KiB floppy (82 tracks, 10 sectors, Double sided).
351 \end_layout
353 \begin_layout LyX-Code
354 --floppy830 830KiB floppy (83 tracks, 10 sectors, Double sided).
355 \end_layout
357 \begin_layout LyX-Code
358 --floppy880 880KiB floppy (80 tracks, 11 sectors, Double sided).
359 \end_layout
361 \begin_layout LyX-Code
362 --floppy1040 1040KiB floppy (80 tracks, 13 sectors, Double sided).
363 \end_layout
365 \begin_layout LyX-Code
366 --floppy1120 1120KiB floppy (80 tracks, 14 sectors, Double sided).
367 \end_layout
369 \begin_layout LyX-Code
370 --floppy1200 1200KiB floppy (80 tracks, 15 sectors, Double sided).
371 \end_layout
373 \begin_layout LyX-Code
374 --floppy1440 1440KiB floppy (80 tracks, 18 sectors, Double sided).
375 \end_layout
377 \begin_layout LyX-Code
378 --floppy1476 1476KiB floppy (82 tracks, 18 sectors, Double sided).
379 \end_layout
381 \begin_layout LyX-Code
382 --floppy1494 1494KiB floppy (83 tracks, 18 sectors, Double sided).
383 \end_layout
385 \begin_layout LyX-Code
386 --floppy1600 1600KiB floppy (80 tracks, 20 sectors, Double sided).
387 \end_layout
389 \begin_layout LyX-Code
390 --floppy1680 1680KiB floppy (80 tracks, 21 sectors, Double sided).
391 \end_layout
393 \begin_layout LyX-Code
394 --floppy1722 1722KiB floppy (82 tracks, 21 sectors, Double sided).
395 \end_layout
397 \begin_layout LyX-Code
398 --floppy1743 1743KiB floppy (83 tracks, 21 sectors, Double sided).
399 \end_layout
401 \begin_layout LyX-Code
402 --floppy1760 1760KiB floppy (80 tracks, 22 sectors, Double sided).
403 \end_layout
405 \begin_layout LyX-Code
406 --floppy1840 1840KiB floppy (80 tracks, 23 sectors, Double sided).
407 \end_layout
409 \begin_layout LyX-Code
410 --floppy1920 1920KiB floppy (80 tracks, 24 sectors, Double sided).
411 \end_layout
413 \begin_layout LyX-Code
414 --floppy2880 2880KiB floppy (80 tracks, 36 sectors, Double sided).
415 \end_layout
417 \begin_layout LyX-Code
418 --floppy3120 3120KiB floppy (80 tracks, 39 sectors, Double sided).
419 \end_layout
421 \begin_layout LyX-Code
422 --floppy3200 3200KiB floppy (80 tracks, 40 sectors, Double sided).
423 \end_layout
425 \begin_layout LyX-Code
426 --floppy3520 3520KiB floppy (80 tracks, 44 sectors, Double sided).
427 \end_layout
429 \begin_layout LyX-Code
430 --floppy3840 3840KiB floppy (80 tracks, 48 sectors, Double sided).
431 \end_layout
433 \begin_layout Subsubsection
434 Other options
435 \end_layout
437 \begin_layout LyX-Code
438 --volumelabel=label Give specified volume label (affects ID).
439  Only meaningful when making image out of directory tree.
440  Default is no volume label.
441 \end_layout
443 \begin_layout LyX-Code
444 --timestamp=YYYYMMDDHHMMSS Give specified timestamp for files (affects ID).
445  Only meaningful when making image out of directory tree.
446  The default timestamp is 19900101T000000Z.
447 \end_layout
449 \begin_layout Subsubsection
450 Image information
451 \end_layout
453 \begin_layout Standard
454 When invoked as:
455 \end_layout
457 \begin_layout LyX-Code
458 $ java ImageMaker <imagefile>
459 \end_layout
461 \begin_layout Standard
462 Variety of information about image is displayed (especially for floppies/HDDs).
463  Two important fields are calculated and claimed disk ID.
464  They should be the same.
465  If they are not, then the image file is corrupt (sadly, imagemaker has
466  bugs and bugs that cause it to write corrupt images have been seen).
467 \end_layout
469 \begin_layout Subsection
470 Advanced: The disk ID algorithm
471 \end_layout
473 \begin_layout Standard
474 The disk ID is calculated as:
475 \end_layout
477 \begin_layout LyX-Code
478 Skein-256-128-deprecated(<typecode>|<geometry>|<image>)
479 \end_layout
481 \begin_layout Standard
482 Where Skein-256-128-deprecated is Skein hash function with 256-bit internal
483  state and 128-bit output using the deprecated rotation constants (as specified
484  in Skein hash function reference documentation versions 1.0 and 1.1).
485  The <image> is the whole image, including parts not stored in image file.
486  The reason for keeping using the deprecated constants are:
487 \end_layout
489 \begin_layout Itemize
490 Changing the constants would change the IDs, which would invalidate existing
491  images
492 \end_layout
494 \begin_layout Itemize
495 This is not about cryptographic security
496 \end_layout
498 \begin_layout Itemize
499 The new constants don't improve security that much anyway.
500 \end_layout
502 \begin_layout Subsubsection
503 Floppies and HDDs
504 \end_layout
506 \begin_layout Standard
507 Floppies have <typecode> value 0 (single byte) and HDDs have 1 (single byte).
508  <geometry> is as follows (this is exactly the same form as it appears in
509  image header):
510 \end_layout
512 \begin_layout LyX-Code
513 Byte 0 bits 0-1: Bits 8-9 of track count per side - 1.
514 \end_layout
516 \begin_layout LyX-Code
517 Byte 0 bits 2-5: Head count - 1.
518 \end_layout
520 \begin_layout LyX-Code
521 Byte 0 bits 6-7: Reserved, must be 0.
522 \end_layout
524 \begin_layout LyX-Code
525 Byte 1: Bits 0-7 of track count per side - 1.
526 \end_layout
528 \begin_layout LyX-Code
529 Byte 2: Sector count per track - 1.
530 \end_layout
532 \begin_layout Subsubsection
533 CD-ROM and BIOS images
534 \end_layout
536 \begin_layout Standard
537 CD-ROMs have <typecode> value 2 (single byte) and BIOS images have 3 (single
538  byte).
539  <geometry> is blank.
540 \end_layout
542 \begin_layout Subsection
543 Advanced: Disk Image format
544 \end_layout
546 \begin_layout Standard
547 The disk image consists of following parts, concatenated in this order without
548  padding:
549 \end_layout
551 \begin_layout Itemize
552 Magic
553 \end_layout
555 \begin_layout Itemize
556 Disk ID
557 \end_layout
559 \begin_layout Itemize
560 Type code
561 \end_layout
563 \begin_layout Itemize
564 Disk name length
565 \end_layout
567 \begin_layout Itemize
568 Disk name
569 \end_layout
571 \begin_layout Itemize
572 type-specific geometry/size data
573 \end_layout
575 \begin_layout Itemize
576 Actual image data
577 \end_layout
579 \begin_layout Itemize
580 Comments
581 \end_layout
583 \begin_layout Subsubsection
584 Magic
585 \end_layout
587 \begin_layout Standard
588 Magic in disk image files is following 5 bytes: 
589 \begin_inset Quotes eld
590 \end_inset
592 IMAGE
593 \begin_inset Quotes erd
594 \end_inset
597 \end_layout
599 \begin_layout Subsubsection
600 Disk ID
601 \end_layout
603 \begin_layout Standard
604 Disk ID is given as 16 bytes, encoding the 128-bit disk ID.
605 \end_layout
607 \begin_layout Subsubsection
608 Type code
609 \end_layout
611 \begin_layout Standard
612 Type code is single byte.
613  0 for floppies, 1 for HDDs, 2 for CD-ROMs and 3 for BIOS images.
614  Other values are reserved.
615 \end_layout
617 \begin_layout Subsubsection
618 Disk name length
619 \end_layout
621 \begin_layout Standard
622 Obsolete.
623  Disk name length is given as two-byte big-endian value.
624  New images should have 0 here.
625 \end_layout
627 \begin_layout Subsubsection
628 Disk name
629 \end_layout
631 \begin_layout Standard
632 Ignored.
633  Name field is there for backward compatiblity.
634  Disk name length gives length of this field in bytes.
635 \end_layout
637 \begin_layout Subsubsection
638 Type-specific geometry/size data (floppies and HDDs)
639 \end_layout
641 \begin_layout Standard
642 Floppies and HDDs have 3-byte geometry data:
643 \end_layout
645 \begin_layout LyX-Code
646 Byte 0 bits 0-1: Bits 8-9 of track count per side - 1.
647 \end_layout
649 \begin_layout LyX-Code
650 Byte 0 bits 2-5: Head count - 1.
651 \end_layout
653 \begin_layout LyX-Code
654 Byte 0 bits 6-7: Reserved, must be 0.
655 \end_layout
657 \begin_layout LyX-Code
658 Byte 1: Bits 0-7 of track count per side - 1.
659 \end_layout
661 \begin_layout LyX-Code
662 Byte 2: Sector count per track - 1.
663 \end_layout
665 \begin_layout Subsubsection
666 Type specific-geometry/size data (CD-ROMs)
667 \end_layout
669 \begin_layout Standard
670 CD-ROMs have 4-byte big-endian sector (512 bytes!) count.
671 \end_layout
673 \begin_layout Subsubsection
674 Type specific-geometry/size data (BIOS images)
675 \end_layout
677 \begin_layout Standard
678 BIOS images have 4-byte big-endian byte (not sector or block) count.
679 \end_layout
681 \begin_layout Subsubsection
682 Actual image data (floppy/HDD)
683 \end_layout
685 \begin_layout Standard
686 Floppy or HDD imagedata consists of following subparts:
687 \end_layout
689 \begin_layout Itemize
690 Storage method
691 \end_layout
693 \begin_layout Itemize
694 Sectors present
695 \end_layout
697 \begin_layout Itemize
698 Image data header
699 \end_layout
701 \begin_layout Itemize
702 Image data
703 \end_layout
705 \begin_layout Standard
706 Storage method is single byte.
707  Sectors present gives number of last nonzero sector + 1 (zero if image
708  is all zeroes)
709 \end_layout
711 \begin_layout Subsubsection
712 Floppy/HDD storage method 0: Raw storage
713 \end_layout
715 \begin_layout Standard
716 This storage method has empty header.
717  Image data is raw dump of first sectors present sectors.
718 \end_layout
720 \begin_layout Subsubsection
721 Floppy/HDD storage method 1: Sectormap
722 \end_layout
724 \begin_layout Standard
725 Image data header contains bitfield with just enough bytes to have one bit
726  per present sector.
727  The order of bits is such that number of bit corresponding to each sector
728  in byte is sector number modulo 8 and byte number is floor of sector number
729  divided by 8 when sector numbers are counted from zero.
730  If bit corresponding to sector is set, then the sector is present in image
731  data, otherwise it is absent and assumed to be all-zeroes.
732 \end_layout
734 \begin_layout Standard
735 Image data contains dumps of all present sectors in order of increasing
736  sector number.
737 \end_layout
739 \begin_layout Subsubsection
740 Floppy/HDD storage method 2: Extent first sector zero
741 \end_layout
743 \begin_layout Standard
744 Image data is empty as storage-specific data is mangled with image data.
745  The image data alternates between blocks encoding zero sectors and blocks
746  encoding nonzero sectors.
747  The first block encodes zero sectors.
749 \end_layout
751 \begin_layout Standard
752 Block encoding zero sectors consist of single 1-4 byte little-endian value
753  encoding number of sectors in block - 1.
754  Number of bytes is determined by sectors present value.
755  It is 1 for 1-256 sectors, 2 for 257-65536, 3 for 65537-16777216 and 4
756  for more than 16777216.
757  All sectors in block are filled with zeroes and are not stored.
758 \end_layout
760 \begin_layout Standard
761 Block encoding nonzero sectors has same block count as zero sector block
762  but is followed by the sectors stored raw.
763 \end_layout
765 \begin_layout Subsubsection
766 Floppy/HDD storage method 3: Extent first sector nonzero
767 \end_layout
769 \begin_layout Standard
770 Same as storage method 2 but first block is nonzero sector block.
771 \end_layout
773 \begin_layout Subsubsection
774 Actual image data (CD-ROMs and BIOS images)
775 \end_layout
777 \begin_layout Standard
778 These store image data raw.
779  The amount of data is specified by sector/byte count.
780 \end_layout
782 \begin_layout Subsubsection
783 Comments
784 \end_layout
786 \begin_layout Standard
787 Comments are given as list of strings, with UTF-8 encoded strings following
788  2-octet big-endian length.
789  Comment list is terminated by entry with length 0 (0x00 0x00).
790  Comments are optional and may be absent.
791 \end_layout
793 \begin_layout Section
794 The actual emulator
795 \end_layout
797 \begin_layout Standard
798 The actual emulator is invoked as:
799 \end_layout
801 \begin_layout LyX-Code
802 $ java JPCApplication <options>...
803 \end_layout
805 \begin_layout Standard
806 The valid options are:
807 \end_layout
809 \begin_layout LyX-Code
810 -autoexec <script> Execute contents of specified file as commands when starting
811  up.
812 \end_layout
814 \begin_layout LyX-Code
815 -noautoexec Don't run autoexec files.
816 \end_layout
818 \begin_layout LyX-Code
819 -norenames Copy&Delete files instead of renaming.
820  Mainly meant for debugging copy&delte code.
821 \end_layout
823 \begin_layout Standard
824 If no arguments are given, defaults of autoexec file of 'assemble.jpcrrinit'
825  are used.
826 \end_layout
828 \begin_layout Subsection
829 Command line
830 \end_layout
832 \begin_layout Standard
833 When emulator is started, command line comes up.
834  Following commands are known:
835 \end_layout
837 \begin_layout Itemize
838 'exit': exit immediately
839 \end_layout
841 \begin_layout Itemize
842 'library <library>': set library directory to <library>.
843 \end_layout
845 \begin_layout Itemize
846 'load <plugin>': Load plugin (no arguments)
847 \end_layout
849 \begin_layout Itemize
850 'load <plugin>(<arguments>)': load plugin with arguments.
851 \end_layout
853 \begin_layout Itemize
854 'command <command> [<arguments>...]': Invoke command via external command interface.
855 \end_layout
857 \begin_layout Itemize
858 'call<command> [<arguments>...]': Invoke command via external command interface
859  and print return values.
860 \end_layout
862 \begin_layout Itemize
863 'lsdisks [<filename>]' Print listing of all known disks.
864  If <filename> is specified, save output to specified file.
865 \end_layout
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.
871 \end_layout
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.
878 \end_layout
880 \begin_layout Subsection
881 PC settings dialog notes
882 \end_layout
884 \begin_layout Itemize
885 CPU divider base frequency before division is 1GHz.
886 \end_layout
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.
893 \end_layout
895 \begin_layout Itemize
896 CD-ROM and hdc are mutually exclusive
897 \end_layout
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.
903 \end_layout
905 \begin_layout Itemize
906 Setting boot device doesn't work with some BIOS versions.
907  Those versions prompt the boot device anyway.
908 \end_layout
910 \begin_layout Subsection
911 Audio output channels
912 \end_layout
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
917 al.PCSpeaker-0'.
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
920  starting from zero.
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.
924 \end_layout
926 \begin_layout Subsection
927 Plugins
928 \end_layout
930 \begin_layout Standard
931 Plugins actually execute the tasks of the emulator.
932  They can be loaded using 
933 \begin_inset Quotes eld
934 \end_inset
936 load <plugin>
937 \begin_inset Quotes erd
938 \end_inset
940  or 'load <plugin>(<arguments>)
941 \begin_inset Quotes erd
942 \end_inset
944  from command line.
945 \end_layout
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.
951 \end_layout
953 \begin_layout Standard
954 If no plugin used requires GUI, then the emulator can be run without having
955  GUI available.
956 \end_layout
958 \begin_layout Subsubsection
959 plugin: org.jpc.plugins.PCControl
960 \end_layout
962 \begin_layout Standard
963 Takes optionally 'extramenu=<file>' and 'uncompressedsave=1', requires and
964  uses GUI.
965 \end_layout
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.
974 \end_layout
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).
980 \end_layout
982 \begin_layout Subsubsection
983 plugin: org.jpc.plugins.PCRunner
984 \end_layout
986 \begin_layout Standard
987 Takes 'movie=<file>' as argument and optionally 'stoptime=<time>' Does not
988  require nor use GUI.
989 \end_layout
991 \begin_layout Standard
992 Loads PC from savestate and just runs it.
993  CTRL+C to quit.
994  Also automatically quits once stoptime is reached.
995 \end_layout
997 \begin_layout Subsubsection
998 plugin: org.jpc.plugins.PCMonitor
999 \end_layout
1001 \begin_layout Standard
1002 No arguments, requires and uses GUI.
1003 \end_layout
1005 \begin_layout Standard
1006 VGA monitor for emulated PC.
1007 \end_layout
1009 \begin_layout Subsubsection
1010 plugin: org.jpc.plugins.VirtualKeyboard
1011 \end_layout
1013 \begin_layout Standard
1014 No arguments, requires and uses GUI.
1015 \end_layout
1017 \begin_layout Standard
1018 On-screen keyboard for emulated PC.
1019 \end_layout
1021 \begin_layout Subsubsection
1022 plugin: org.jpc.plugins.PCStartStopTest
1023 \end_layout
1025 \begin_layout Standard
1026 No arguments, requires and uses GUI.
1027 \end_layout
1029 \begin_layout Standard
1030 Small plugin testing remote PC start/stop.
1031  Also supports sending some common keypresses.
1032 \end_layout
1034 \begin_layout Subsubsection
1035 plugin: org.jpc.plugins.RAWVideoDumper
1036 \end_layout
1038 \begin_layout Standard
1039 Takes 'rawoutput=<file>' as argument.
1040  Does not require nor use GUI.
1041 \end_layout
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.
1056 \end_layout
1058 \begin_layout Standard
1059 Dumping to pipe is supported.
1060 \end_layout
1062 \begin_layout Subsubsection
1063 plugin: org.jpc.plugins.RAWAudioDumper
1064 \end_layout
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.
1070 \end_layout
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
1077  time delta by 
1078 \begin_inset Formula $2^{32}-1$
1079 \end_inset
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
1085  be smaller than 
1086 \begin_inset Formula $2^{32}-1$
1087 \end_inset
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
1092  the audio by.
1093 \end_layout
1095 \begin_layout Subsubsection
1096 plugin: org.jpc.plugins.LuaPlugin
1097 \end_layout
1099 \begin_layout Standard
1100 Takes 'kernel=<name of lua kernel file>', other parameters are passed to
1101  kernel, requires and uses GUI.
1102 \end_layout
1104 \begin_layout Standard
1105 Lua VM for executing scripts.
1106 \end_layout
1108 \begin_layout Subsubsection
1109 plugin: org.jpc.plugins.JoystickInput
1110 \end_layout
1112 \begin_layout Standard
1113 No parameters.
1114  Displays window for sending joystick input.
1115 \end_layout
1117 \begin_layout Section
1118 Modules
1119 \end_layout
1121 \begin_layout Subsection
1122 org.jpc.modules.Joystick:
1123 \end_layout
1125 \begin_layout Itemize
1126 Arguments: none.
1127 \end_layout
1129 \begin_layout Itemize
1130 Resources: I/O port 0x201
1131 \end_layout
1133 \begin_layout Standard
1134 Emulates joystick game port.
1135 \end_layout
1137 \begin_layout Subsection
1138 org.jpc.modules.SoundCard
1139 \end_layout
1141 \begin_layout Itemize
1142 Arguments: Optional resources specification
1143 \end_layout
1145 \begin_layout Itemize
1146 Resources (defaults): I/O port 0x220-0x22F, IRQ 5, DMA 1, DMA 5
1147 \end_layout
1149 \begin_layout Standard
1150 Emulates Sound card.
1151 \end_layout
1153 \begin_layout Subsection
1154 org.jpc.modules.FMCard
1155 \end_layout
1157 \begin_layout Itemize
1158 Arguments: Optional resources specification
1159 \end_layout
1161 \begin_layout Itemize
1162 Resources (defaults): I/O port 0x338-0x33B
1163 \end_layout
1165 \begin_layout Standard
1166 Emulates FM card.
1167 \end_layout
1169 \begin_layout Subsection
1170 org.jpc.modules.BasicFPU:
1171 \end_layout
1173 \begin_layout Itemize
1174 Arguments: none.
1175 \end_layout
1177 \begin_layout Itemize
1178 Resources: None.
1179 \end_layout
1181 \begin_layout Standard
1182 Crude FPU (x87) emulator.
1183 \end_layout
1185 \begin_layout Section
1186 Hacks
1187 \end_layout
1189 \begin_layout Standard
1190 Hacks are saved to savestates but not movies.
1191 \end_layout
1193 \begin_layout Subsection
1194 NO_FPU
1195 \end_layout
1197 \begin_layout Standard
1198 Force bit 1 of physical address 0x0410 to zero, signaling that the system
1199  has no FPU.
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
1203 \end_inset
1205 present
1206 \begin_inset Quotes erd
1207 \end_inset
1210  Try this if game startup hangs with lots of trying to use FPU but not present
1211  errors.
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).
1215 \end_layout
1217 \begin_layout Subsection
1218 VGA_DRAW
1219 \end_layout
1221 \begin_layout Standard
1222 Update basic VGA parameters before vretrace, not after it.
1223  Some games (e.g.
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).
1228 \end_layout
1230 \begin_layout Section
1231 Some error messages and explanations
1232 \end_layout
1234 \begin_layout Itemize
1235 <filename> is Not a valid image file
1236 \end_layout
1238 \begin_layout Itemize
1239 <filename> is not image file
1240 \end_layout
1242 \begin_layout Itemize
1243 <filename> claims to be floppy with illegal geometry: <x> tracks, <y> sides
1244  and <z> sectors.
1245 \end_layout
1247 \begin_layout Itemize
1248 <filename> claims to be HDD with illegal geometry: <x> tracks, <y> sides
1249  and <z> sectors.
1250 \end_layout
1252 \begin_layout Itemize
1253 Can't read disk image sector map.
1254 \end_layout
1256 \begin_layout Itemize
1257 Can't read disk image extent.
1258 \end_layout
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.
1263 \end_layout
1265 \begin_layout Itemize
1266 <filename> is image of unknown type.
1267 \end_layout
1269 \begin_layout Itemize
1270 <filename> has unrecognized geometry <x> <y> <z>
1271 \end_layout
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.
1276 \end_layout
1278 \begin_layout Itemize
1279 Invalid format specifier <something>.
1280 \end_layout
1282 \begin_layout Itemize
1283 Invalid syntax of --floppy= or --HDD= option.
1284 \end_layout
1286 \begin_layout Itemize
1287 Invalid format specifier/option <something>.
1288 \end_layout
1290 \begin_layout Standard
1291 Invalid option or format specifier was given.
1292  Check for typos.
1293 \end_layout
1295 \begin_layout Itemize
1296 java ImageMaker [<options>...] <format> <destination> <source> <diskname>
1297 \end_layout
1299 \begin_layout Standard
1300 Check syntax of command.
1301  Especially that diskname is present!
1302 \end_layout
1304 \begin_layout Itemize
1305 The image has <nnn> sectors while it should have <yyy> according to selected
1306  geometry.
1307 \end_layout
1309 \begin_layout Itemize
1310 Raw image file length not divisible by 512.
1311 \end_layout
1313 \begin_layout Itemize
1314 Trying to read sector out of range.
1315 \end_layout
1317 \begin_layout Standard
1318 The selected geometry is wrong or raw image is incomplete.
1319 \end_layout
1321 \begin_layout Itemize
1322 Invalid disk name (Should not happen!).
1323 \end_layout
1325 \begin_layout Itemize
1326 Invalid geometry to be written.
1327 \end_layout
1329 \begin_layout Standard
1330 This is a very likely a bug in program.
1331 \end_layout
1333 \begin_layout Itemize
1334 What the heck <filename> is? It's not regular file nor directory.
1335 \end_layout
1337 \begin_layout Standard
1338 That sort of file can't be used as input for image making, or the file just
1339  doesn't exist.
1340 \end_layout
1342 \begin_layout Itemize
1343 BIOS images can only be made out of regular files.
1344 \end_layout
1346 \begin_layout Itemize
1347 CD images can only be made out of regular files.
1348 \end_layout
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.
1353 \end_layout
1355 \begin_layout Itemize
1356 Can't read raw bios image file.
1357 \end_layout
1359 \begin_layout Itemize
1360 Can't read sector <nnn> from image.
1361 \end_layout
1363 \begin_layout Standard
1364 Reading the raw image file failed for some reason.
1365 \end_layout
1367 \begin_layout Itemize
1368 Bad library line: "<something>".
1369  Ignored.
1370 \end_layout
1372 \begin_layout Standard
1373 Syntax error in image library.
1374 \end_layout
1376 \begin_layout Itemize
1377 Removing image <something> a.k.a.
1378  "<something>" as it no longer exists.
1379 \end_layout
1381 \begin_layout Standard
1382 The image file no longer exists so it gets removed from library.
1383 \end_layout
1385 \begin_layout Itemize
1386 Removing image <something> a.k.a.
1387  "<something>" due to <some> conflict.
1388 \end_layout
1390 \begin_layout Standard
1391 Image library code killed some image from library due to some kind of conflict
1392  with image being added.
1393 \end_layout
1395 \begin_layout Itemize
1396 Too much data to fit into given space.
1397 \end_layout
1399 \begin_layout Standard
1400 The tree you gave contains takes just too much space to fit into disk of
1401  this size.
1402 \end_layout
1404 \begin_layout Section
1405 Advanced: Savestate/movie format
1406 \end_layout
1408 \begin_layout Subsection
1409 Special character classes
1410 \end_layout
1412 \begin_layout Subsubsection
1413 SPACE
1414 \end_layout
1416 \begin_layout Standard
1417 Following Unicode codepoints (encoded as UTF-8) are interpretted as space
1418  characters:
1419 \end_layout
1421 \begin_layout Itemize
1422 Codepoints 0x20, and 0x09.
1423 \end_layout
1425 \begin_layout Itemize
1426 Codepoints 0x1680, 0x180E, 0x2028, 0x205F and 0x3000
1427 \end_layout
1429 \begin_layout Itemize
1430 Codepoints 0x2000-0x200A.
1431 \end_layout
1433 \begin_layout Subsubsection
1434 LINEFEED
1435 \end_layout
1437 \begin_layout Standard
1438 Following byte sequences are interpretted as linefeeds (line change):
1439 \end_layout
1441 \begin_layout Itemize
1442 Byte 0x0A (UTF-8 encoded codepoint 0x0A)
1443 \end_layout
1445 \begin_layout Itemize
1446 Byte 0x0D (UTF-8 encoded codepoint 0x0D)
1447 \end_layout
1449 \begin_layout Itemize
1450 Byte 0x1C (UTF-8 encoded codepoint 0x1C)
1451 \end_layout
1453 \begin_layout Itemize
1454 Byte 0x1D (UTF-8 encoded codepoint 0x1D)
1455 \end_layout
1457 \begin_layout Itemize
1458 Byte 0x1E (UTF-8 encoded codepoint 0x1E)
1459 \end_layout
1461 \begin_layout Itemize
1462 Bytes 0xC2 0x85 (UTF-8 for unicode control character NL, codepoint 0x85)
1463 \end_layout
1465 \begin_layout Itemize
1466 Bytes 0xE2 0x80 0xA9 (UTF-8 encoded codepoint 0x2029)
1467 \end_layout
1469 \begin_layout Subsection
1470 JRSR archive
1471 \end_layout
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.
1477  It is 
1478 \begin_inset Quotes eld
1479 \end_inset
1481 JRSR
1482 \begin_inset Quotes erd
1483 \end_inset
1485  followed by LINEFEED character There are four kinds of lines after that
1486  (lines are terminated by LINEFEED byte/bytes):
1487 \end_layout
1489 \begin_layout Itemize
1490 Start member
1491 \end_layout
1493 \begin_layout Itemize
1494 Member line
1495 \end_layout
1497 \begin_layout Itemize
1498 End member
1499 \end_layout
1501 \begin_layout Itemize
1502 Blank line
1503 \end_layout
1505 \begin_layout Standard
1506 Sequencing rules are as follows: Start member is allowed anywhere (after
1507  magic).
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.
1512 \end_layout
1514 \begin_layout Subsubsection
1515 Start member
1516 \end_layout
1518 \begin_layout Standard
1519 Start member line is given as 
1520 \begin_inset Quotes eld
1521 \end_inset
1523 !BEGIN
1524 \begin_inset Quotes erd
1525 \end_inset
1527  <SPACE>+ <membername> <LINEFEED>.
1528  <SPACE>+ any number of SPACE characters at least one and <LINEFEED> is
1529  LINEFEED chacter.
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.
1534 \end_layout
1536 \begin_layout Subsubsection
1537 Member line:
1538 \end_layout
1540 \begin_layout Standard
1541 Member line is given as 
1542 \begin_inset Quotes eld
1543 \end_inset
1546 \begin_inset Quotes erd
1547 \end_inset
1549 <content><LINEFEED>.
1550  It gives another line for member contents.
1551  <content> is passed raw to layers above (followed by line termination)
1552 \end_layout
1554 \begin_layout Subsubsection
1555 End member
1556 \end_layout
1558 \begin_layout Standard
1559 End member line is given as 
1560 \begin_inset Quotes eld
1561 \end_inset
1563 !END
1564 \begin_inset Quotes erd
1565 \end_inset
1567 <LINEFEED>.
1568  It ends the current member.
1569  The following line can only be start member line or file may end.
1570 \end_layout
1572 \begin_layout Subsubsection
1573 Blank line
1574 \end_layout
1576 \begin_layout Standard
1577 Blank line is given as <LINEFEED>.
1578  Lines like that are ignored.
1579 \end_layout
1581 \begin_layout Subsection
1582 Four-to-Five encoding
1583 \end_layout
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
1591  of blocks.
1592 \end_layout
1594 \begin_layout Subsubsection
1595 End stream block
1596 \end_layout
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.
1602 \end_layout
1604 \begin_layout Subsubsection
1605 Other four block types
1606 \end_layout
1608 \begin_layout Standard
1609 Other four block types take the value to be encoded, read it as big-endian
1610  value.
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):
1614 \end_layout
1616 \begin_layout Standard
1617 \begin_inset Tabular
1618 <lyxtabular version="3" rows="5" columns="6">
1619 <features>
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">
1626 <row>
1627 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1628 \begin_inset Text
1630 \begin_layout Plain Layout
1631 To encode
1632 \end_layout
1634 \end_inset
1635 </cell>
1636 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1637 \begin_inset Text
1639 \begin_layout Plain Layout
1640 1st char.
1641 \end_layout
1643 \end_inset
1644 </cell>
1645 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1646 \begin_inset Text
1648 \begin_layout Plain Layout
1649 2nd char.
1650 \end_layout
1652 \end_inset
1653 </cell>
1654 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1655 \begin_inset Text
1657 \begin_layout Plain Layout
1658 3rd char.
1659 \end_layout
1661 \end_inset
1662 </cell>
1663 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1664 \begin_inset Text
1666 \begin_layout Plain Layout
1667 4th char.
1668 \end_layout
1670 \end_inset
1671 </cell>
1672 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1673 \begin_inset Text
1675 \begin_layout Plain Layout
1676 5th char.
1677 \end_layout
1679 \end_inset
1680 </cell>
1681 </row>
1682 <row>
1683 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1684 \begin_inset Text
1686 \begin_layout Plain Layout
1687 1 byte
1688 \end_layout
1690 \end_inset
1691 </cell>
1692 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1693 \begin_inset Text
1695 \begin_layout Plain Layout
1697 \end_layout
1699 \end_inset
1700 </cell>
1701 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1702 \begin_inset Text
1704 \begin_layout Plain Layout
1706 \end_layout
1708 \end_inset
1709 </cell>
1710 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1711 \begin_inset Text
1713 \begin_layout Plain Layout
1715 \end_layout
1717 \end_inset
1718 </cell>
1719 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1720 \begin_inset Text
1722 \begin_layout Plain Layout
1724 \end_layout
1726 \end_inset
1727 </cell>
1728 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1729 \begin_inset Text
1731 \begin_layout Plain Layout
1733 \end_layout
1735 \end_inset
1736 </cell>
1737 </row>
1738 <row>
1739 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1740 \begin_inset Text
1742 \begin_layout Plain Layout
1743 2 bytes
1744 \end_layout
1746 \end_inset
1747 </cell>
1748 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1749 \begin_inset Text
1751 \begin_layout Plain Layout
1753 \end_layout
1755 \end_inset
1756 </cell>
1757 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1758 \begin_inset Text
1760 \begin_layout Plain Layout
1762 \end_layout
1764 \end_inset
1765 </cell>
1766 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1767 \begin_inset Text
1769 \begin_layout Plain Layout
1771 \end_layout
1773 \end_inset
1774 </cell>
1775 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1776 \begin_inset Text
1778 \begin_layout Plain Layout
1780 \end_layout
1782 \end_inset
1783 </cell>
1784 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1785 \begin_inset Text
1787 \begin_layout Plain Layout
1789 \end_layout
1791 \end_inset
1792 </cell>
1793 </row>
1794 <row>
1795 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1796 \begin_inset Text
1798 \begin_layout Plain Layout
1799 3 bytes
1800 \end_layout
1802 \end_inset
1803 </cell>
1804 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1805 \begin_inset Text
1807 \begin_layout Plain Layout
1809 \end_layout
1811 \end_inset
1812 </cell>
1813 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1814 \begin_inset Text
1816 \begin_layout Plain Layout
1818 \end_layout
1820 \end_inset
1821 </cell>
1822 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1823 \begin_inset Text
1825 \begin_layout Plain Layout
1827 \end_layout
1829 \end_inset
1830 </cell>
1831 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1832 \begin_inset Text
1834 \begin_layout Plain Layout
1836 \end_layout
1838 \end_inset
1839 </cell>
1840 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1841 \begin_inset Text
1843 \begin_layout Plain Layout
1845 \end_layout
1847 \end_inset
1848 </cell>
1849 </row>
1850 <row>
1851 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1852 \begin_inset Text
1854 \begin_layout Plain Layout
1855 4 bytes
1856 \end_layout
1858 \end_inset
1859 </cell>
1860 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1861 \begin_inset Text
1863 \begin_layout Plain Layout
1865 \end_layout
1867 \end_inset
1868 </cell>
1869 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1870 \begin_inset Text
1872 \begin_layout Plain Layout
1874 \end_layout
1876 \end_inset
1877 </cell>
1878 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1879 \begin_inset Text
1881 \begin_layout Plain Layout
1883 \end_layout
1885 \end_inset
1886 </cell>
1887 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1888 \begin_inset Text
1890 \begin_layout Plain Layout
1892 \end_layout
1894 \end_inset
1895 </cell>
1896 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1897 \begin_inset Text
1899 \begin_layout Plain Layout
1901 \end_layout
1903 \end_inset
1904 </cell>
1905 </row>
1906 </lyxtabular>
1908 \end_inset
1911 \end_layout
1913 \begin_layout Standard
1914 Blocks which encode values greater than what is possible for value of that
1915  length are fatal errors.
1917 \end_layout
1919 \begin_layout Subsection
1920 Line component encoing
1921 \end_layout
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.
1929 \end_layout
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:
1935 \end_layout
1937 \begin_layout Itemize
1938 Codepoint of '('.
1939  The depth is read pre-increment.
1940 \end_layout
1942 \begin_layout Itemize
1943 Codepoint of ')'.
1944  The depth is read post-decrement.
1945 \end_layout
1947 \begin_layout Itemize
1948 Any SPACE character
1949 \end_layout
1951 \begin_layout Standard
1952 The following characters are special:
1953 \end_layout
1955 \begin_layout Itemize
1956 '('.
1957  Increments depth by 1 if not escaped (and appears in component).
1958 \end_layout
1960 \begin_layout Itemize
1961 ')'.
1962  Decrements depth by 1 if not escaped (and appears in component).
1963  Depth going negative is an error.
1964 \end_layout
1966 \begin_layout Itemize
1968 \backslash
1970  Next character is interpretted as literal.
1971  Error if at end of line.
1972 \end_layout
1974 \begin_layout Standard
1975 Otherwise, characters are interpretted as literals and appear in components.
1976  Depth must be zero at end of line.
1977 \end_layout
1979 \begin_layout Subsection
1980 Header section:
1981 \end_layout
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
1987  are arguments.
1988  How many parameters are expected is dependent on what header it is:
1989 \end_layout
1991 \begin_layout Subsubsection
1992 PROJECTID header:
1993 \end_layout
1995 \begin_layout Itemize
1996 Header name: "PROJECTID"
1997 \end_layout
1999 \begin_layout Itemize
2000 Components: 2
2001 \end_layout
2003 \begin_layout Itemize
2004 Argument #1: <project-id-string>
2005 \end_layout
2007 \begin_layout Itemize
2008 Mandatory: Yes
2009 \end_layout
2011 \begin_layout Standard
2012 Gives project ID.
2013  Project ID is generated when PC is assembled and is then preserved in save
2014  states.
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.
2018 \end_layout
2020 \begin_layout Subsubsection
2021 SAVESTATEID header:
2022 \end_layout
2024 \begin_layout Itemize
2025 Header name: "SAVESTATEID"
2026 \end_layout
2028 \begin_layout Itemize
2029 Components: 2
2030 \end_layout
2032 \begin_layout Itemize
2033 Argument #1: <savestate-id-string>
2034 \end_layout
2036 \begin_layout Itemize
2037 Mandatory: No
2038 \end_layout
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).
2048 \end_layout
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
2053  left off.
2054 \end_layout
2056 \begin_layout Subsubsection
2057 RERECORDS header:
2058 \end_layout
2060 \begin_layout Itemize
2061 Header name: "RERECORDS"
2062 \end_layout
2064 \begin_layout Itemize
2065 Components: 2
2066 \end_layout
2068 \begin_layout Itemize
2069 Argument #1: <rerecords>
2070 \end_layout
2072 \begin_layout Itemize
2073 Mandatory: Yes
2074 \end_layout
2076 \begin_layout Standard
2077 Gives rerecord count.
2078  PC assembly (except when loading save state) initializes current rerecord
2079  count to zero.
2080  Must be non-negative and decimal number using ASCII digit characters.
2081 \end_layout
2083 \begin_layout LyX-Code
2084 On loading save state:
2085 \end_layout
2087 \begin_layout LyX-Code
2088 1) If project ID matches with previous:
2089 \end_layout
2091 \begin_layout LyX-Code
2092 1a) If loaded rerecord count is larger or equal to current rerecord count:
2093 \end_layout
2095 \begin_layout LyX-Code
2096 1a-a) Current rerecord count is loaded rerecord count + 1.
2097 \end_layout
2099 \begin_layout LyX-Code
2100 1b) Otherwise
2101 \end_layout
2103 \begin_layout LyX-Code
2104 1b-a) Current rerecord count increments by 1.
2105 \end_layout
2107 \begin_layout LyX-Code
2108 2) Otherwise
2109 \end_layout
2111 \begin_layout LyX-Code
2112 2a) Current rerecord count is loaded rerecord count + 1.
2113 \end_layout
2115 \begin_layout Standard
2116 The current rerecord count at time of save is saved to save state.
2117 \end_layout
2119 \begin_layout Subsubsection
2120 AUTHORS header:
2121 \end_layout
2123 \begin_layout Itemize
2124 Header name: "AUTHORS"
2125 \end_layout
2127 \begin_layout Itemize
2128 Components: 2 or more
2129 \end_layout
2131 \begin_layout Itemize
2132 Arguments: free form
2133 \end_layout
2135 \begin_layout Itemize
2136 Mandatory: No
2137 \end_layout
2139 \begin_layout Standard
2140 Gives authors of run.
2141  Each argument gives one author (who has full name but no nickname).
2142  May be present multiple times.
2143 \end_layout
2145 \begin_layout Subsubsection
2146 AUTHORNICKS header:
2147 \end_layout
2149 \begin_layout Itemize
2150 Header name: "AUTHORNICKS"
2151 \end_layout
2153 \begin_layout Itemize
2154 Components: 2 or more
2155 \end_layout
2157 \begin_layout Itemize
2158 Arguments: free form
2159 \end_layout
2161 \begin_layout Itemize
2162 Mandatory: No
2163 \end_layout
2165 \begin_layout Standard
2166 Gives authors of run.
2167  Each argument gives one author (who has nickname but no full name).
2168  May be present multiple times.
2169 \end_layout
2171 \begin_layout Subsubsection
2172 AUTHORFULL header:
2173 \end_layout
2175 \begin_layout Itemize
2176 Header name: "AUTHORFULL"
2177 \end_layout
2179 \begin_layout Itemize
2180 Components: 3
2181 \end_layout
2183 \begin_layout Itemize
2184 Arguments: free form
2185 \end_layout
2187 \begin_layout Itemize
2188 Mandatory: No
2189 \end_layout
2191 \begin_layout Standard
2192 Gives author of run.
2193  First argument is full name of author, and second is nickname of author.
2194  May be present multiple times.
2195 \end_layout
2197 \begin_layout Subsubsection
2198 COMMENT header:
2199 \end_layout
2201 \begin_layout Itemize
2202 Header name: "COMMENT"
2203 \end_layout
2205 \begin_layout Itemize
2206 Components: 2 or more
2207 \end_layout
2209 \begin_layout Itemize
2210 Arguments: free form
2211 \end_layout
2213 \begin_layout Itemize
2214 Mandatory: No
2215 \end_layout
2217 \begin_layout Standard
2218 Various kinds of free form data.
2219  Not parsed further by emulator.
2220 \end_layout
2222 \begin_layout Subsection
2223 Initialization segment:
2224 \end_layout
2226 \begin_layout Standard
2227 If SAVESTATEID header isn't present (not a save state), member "initialization"
2228  gives PC initialization parameters for assembling the PC.
2229  It is present anyway even if SAVESTATEID is present (savestate).
2230 \end_layout
2232 \begin_layout Standard
2233 Following parameters are used (space separates components):
2234 \end_layout
2236 \begin_layout LyX-Code
2237 "BIOS" <id>
2238 \end_layout
2240 \begin_layout Standard
2241 Gives Image ID of main system BIOS (mandatory)
2242 \end_layout
2244 \begin_layout LyX-Code
2245 "VGABIOS" <id>
2246 \end_layout
2248 \begin_layout Standard
2249 Gives Image ID of VGA BIOS (mandatory).
2250 \end_layout
2252 \begin_layout LyX-Code
2253 "HDA" <id>
2254 \end_layout
2256 \begin_layout Standard
2257 Gives Image ID of hda.
2258  Present only if system has hard disk hda.
2259 \end_layout
2261 \begin_layout LyX-Code
2262 "HDB" <id>
2263 \end_layout
2265 \begin_layout Standard
2266 Gives Image ID of hdb.
2267  Present only if system has hard disk hdb.
2268 \end_layout
2270 \begin_layout LyX-Code
2271 "HDC" <id>
2272 \end_layout
2274 \begin_layout Standard
2275 Gives Image ID of hdc.
2276  Present only if system has hard disk hdc.
2277 \end_layout
2279 \begin_layout LyX-Code
2280 "HDD" <id>
2281 \end_layout
2283 \begin_layout Standard
2284 Gives Image ID of hdd.
2285  Present only if system has hard disk hdd.
2286 \end_layout
2288 \begin_layout LyX-Code
2289 "DISK" <num> <id>
2290 \end_layout
2292 \begin_layout Standard
2293 Gives Image ID of disk in slot <num>.
2294  Slot number must be non-negative.
2295 \end_layout
2297 \begin_layout LyX-Code
2298 \begin_inset Quotes eld
2299 \end_inset
2301 DISKNAME
2302 \begin_inset Quotes erd
2303 \end_inset
2305  <num> <name>
2306 \end_layout
2308 \begin_layout Standard
2309 kGives image name of disk in slot <num>.
2310  Slot number must be non-negative.
2311  The slot must be previously declared using 
2312 \begin_inset Quotes eld
2313 \end_inset
2315 DISK
2316 \begin_inset Quotes erd
2317 \end_inset
2320 \end_layout
2322 \begin_layout LyX-Code
2323 "FDA" <num>
2324 \end_layout
2326 \begin_layout Standard
2327 Gives Image slot to initially put into floppy drive fda.
2328  Disk must be of floppy type.
2329  If none present, no disk is initially put there.
2330 \end_layout
2332 \begin_layout LyX-Code
2333 "FDB" <num>
2334 \end_layout
2336 \begin_layout Standard
2337 Gives Image slot to initially put into floppy drive fdb.
2338  Disk must be of floppy type.
2339  If none present, no disk is initially put there.
2340 \end_layout
2342 \begin_layout LyX-Code
2343 "CDROM" <num>
2344 \end_layout
2346 \begin_layout Standard
2347 Gives Image slot to initially put into CD-ROM drive hdc.
2348  Not allowed if hard disk hdc is present.
2349  Disk must be of CD-ROM type.
2350  If none present no disk is initially put there.
2351 \end_layout
2353 \begin_layout LyX-Code
2354 "INITIALTIME" <time>
2355 \end_layout
2357 \begin_layout Standard
2358 Number of milliseconds since Unix epoch to system start up time.
2359  Allowed range:
2360 \end_layout
2362 \begin_layout Standard
2363 0-4102444799999.
2364  Mandatory.
2365 \end_layout
2367 \begin_layout LyX-Code
2368 "CPUDIVIDER" <divider>
2369 \end_layout
2371 \begin_layout Standard
2372 Set CPU frequency divider (dividing the 1GHz master clock).
2373  Allowed range is 1-256.
2374  Mandatory.
2375 \end_layout
2377 \begin_layout LyX-Code
2378 "MEMORYSIZE" <pages>
2379 \end_layout
2381 \begin_layout Standard
2382 Number of 4KiB pages of RAM memory.
2383  Allowed range 256-262144.
2384  Mandatory.
2385 \end_layout
2387 \begin_layout LyX-Code
2388 "BOOT" <device>
2389 \end_layout
2391 \begin_layout Standard
2392 Set boot device.
2393  Valid devices are "FLOPPY" (boot from fda), "HDD" (boot from hda) and "CDROM"
2394  (boot from CD).
2395 \end_layout
2397 \begin_layout LyX-Code
2398 "LOADMODULEA" <module> <parameters>
2399 \end_layout
2401 \begin_layout Standard
2402 Load module <module> with parameters <parameters>.
2403 \end_layout
2405 \begin_layout LyX-Code
2406 "LOADMODULE" <module>
2407 \end_layout
2409 \begin_layout Standard
2410 Load module <module> with no parameters
2411 \end_layout
2413 \begin_layout LyX-Code
2414 \begin_inset Quotes eld
2415 \end_inset
2418 \begin_inset Quotes erd
2419 \end_inset
2421  <fpu>
2422 \end_layout
2424 \begin_layout Standard
2425 Use class <fpu> as FPU emulator.
2426 \end_layout
2428 \begin_layout LyX-Code
2429 \begin_inset Quotes eld
2430 \end_inset
2432 IOPORTDELAY
2433 \begin_inset Quotes erd
2434 \end_inset
2437 \end_layout
2439 \begin_layout Standard
2440 Use I/O port delay emulation (each I/O port read/write takes 666ns).
2441 \end_layout
2443 \begin_layout LyX-Code
2444 \begin_inset Quotes eld
2445 \end_inset
2447 VGAHRETRACE
2448 \begin_inset Quotes erd
2449 \end_inset
2452 \end_layout
2454 \begin_layout Standard
2455 Emulate VGA horizontal retrace.
2456 \end_layout
2458 \begin_layout Subsection
2459 Event record format:
2460 \end_layout
2462 \begin_layout Standard
2463 Event record is in archive member "events".
2464  It uses line component encoding.
2465  Each line gives an event.
2466  First component of each line gives time stamp.
2467  These timestamps MUST be in increasing order and all MUST be non-negative.
2468  Time stamp time unit is exactly 1 nanosecond of emulated time.
2469 \end_layout
2471 \begin_layout Standard
2472 The second component of each line is name of class to dispatch to.
2473  Further components are passed as-is to event handlers.
2474  Classes with names consisting only of uppercase A-Z and 0-9 are special
2475  and reserved.
2476  It is error to encounter unknown such special class.
2477 \end_layout
2479 \begin_layout Subsubsection
2480 Savestate event
2481 \end_layout
2483 \begin_layout Itemize
2484 Dispatch to: SAVESTATE
2485 \end_layout
2487 \begin_layout Itemize
2488 Argument #1: Savestate id
2489 \end_layout
2491 \begin_layout Itemize
2492 Argument #2 (optional): Rerecord count at time of saving savestate
2493 \end_layout
2495 \begin_layout Standard
2496 Signals that savestate has occured here.
2497  The save state IDs MUST be unique in entire event stream.
2498  The second argument to savestate (if present) is rerecord count at time
2499  of saving that savestate (useful for calulating rerecord count of movie
2500  starting from savestate).
2501  No time restrictions
2502 \end_layout
2504 \begin_layout Subsubsection
2505 Option event
2506 \end_layout
2508 \begin_layout Itemize
2509 Dispatch to: OPTION
2510 \end_layout
2512 \begin_layout Itemize
2513 Argument #1: 
2514 \begin_inset Quotes eld
2515 \end_inset
2517 ABSOLUTE
2518 \begin_inset Quotes erd
2519 \end_inset
2521  or 
2522 \begin_inset Quotes eld
2523 \end_inset
2525 RELATIVE
2526 \begin_inset Quotes erd
2527 \end_inset
2530 \end_layout
2532 \begin_layout Standard
2533 Controls various options.
2535 \begin_inset Quotes eld
2536 \end_inset
2538 ABSOLUTE
2539 \begin_inset Quotes erd
2540 \end_inset
2542  turns on absolute mode (default) where event timestamps are absolute.
2544 \begin_inset Quotes eld
2545 \end_inset
2547 RELATIVE
2548 \begin_inset Quotes erd
2549 \end_inset
2551  turns on relative mode where event timestamps are relative to last event
2552  in stream.
2553  The OPTION event itself is not affected by timing change.
2554  No time restrictions.
2555  Unknown arguments are errors.
2556 \end_layout
2558 \begin_layout Subsubsection
2559 Keyboard keypress/keyrelease event:
2560 \end_layout
2562 \begin_layout Itemize
2563 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2564 \end_layout
2566 \begin_layout Itemize
2567 Argument #1: Fixed: "KEYEDGE"
2568 \end_layout
2570 \begin_layout Itemize
2571 Argument #2: Key number.
2572  Valid values are 1-83, 85-95, 129-197 and 199-223
2573 \end_layout
2575 \begin_layout Standard
2576 Send key press or key release.
2577  Keys work in toggle button manner.
2578  The event time must be multiple of 66 666, and must not be less than 60
2579  * 66 666 TUs after last PAUSE event, 20 * 66 666 TUs after last KEYEDGE
2580  on key >128 and 10 * 66 666 TUs after last KEYEDGE on key <128.
2581 \end_layout
2583 \begin_layout Subsubsection
2584 Pause event:
2585 \end_layout
2587 \begin_layout Itemize
2588 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2589 \end_layout
2591 \begin_layout Itemize
2592 Argument #1: Fixed: "PAUSE"
2593 \end_layout
2595 \begin_layout Standard
2596 Send pause key event.
2597  The time restrictions are identical to KEYEDGE event.
2598 \end_layout
2600 \begin_layout Subsubsection
2601 Mouse button event:
2602 \end_layout
2604 \begin_layout Itemize
2605 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2606 \end_layout
2608 \begin_layout Itemize
2609 Argument #1: Fixed: "MOUSEBUTTON"
2610 \end_layout
2612 \begin_layout Itemize
2613 Argument #2: Number of button to release or press (0-4)
2614 \end_layout
2616 \begin_layout Standard
2617 Presses or releases the designated mouse button.
2618 \end_layout
2620 \begin_layout Subsubsection
2621 X mouse motion event:
2622 \end_layout
2624 \begin_layout Itemize
2625 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2626 \end_layout
2628 \begin_layout Itemize
2629 Argument #1: Fixed: "XMOUSEMOTION"
2630 \end_layout
2632 \begin_layout Itemize
2633 Argument #2: Number of units to move (-255 - 255)
2634 \end_layout
2636 \begin_layout Standard
2637 Move the mouse in X direction by specified amount.
2638  Positive is right.
2639 \end_layout
2641 \begin_layout Subsubsection
2642 Y mouse motion event:
2643 \end_layout
2645 \begin_layout Itemize
2646 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2647 \end_layout
2649 \begin_layout Itemize
2650 Argument #1: Fixed: "YMOUSEMOTION"
2651 \end_layout
2653 \begin_layout Itemize
2654 Argument #2: Number of units to move (-255 - 255)
2655 \end_layout
2657 \begin_layout Standard
2658 Move the mouse in Y direction by specified amount.
2659  Positive is up.
2660 \end_layout
2662 \begin_layout Subsubsection
2663 Z mouse motion event:
2664 \end_layout
2666 \begin_layout Itemize
2667 Dispatch to: org.jpc.emulator.peripheral.Keyboard
2668 \end_layout
2670 \begin_layout Itemize
2671 Argument #1: Fixed: "ZMOUSEMOTION"
2672 \end_layout
2674 \begin_layout Itemize
2675 Argument #2: Number of units to move (-7 - 7)
2676 \end_layout
2678 \begin_layout Standard
2679 Move the mouse in Z direction (scrollwheel) by specified amount.
2680 \end_layout
2682 \begin_layout Subsubsection
2683 Joystick button event:
2684 \end_layout
2686 \begin_layout Itemize
2687 Dispatch to: org.jpc.modules.Joystick
2688 \end_layout
2690 \begin_layout Itemize
2691 Argument #1: 
2692 \begin_inset Quotes eld
2693 \end_inset
2695 BUTTONA
2696 \begin_inset Quotes erd
2697 \end_inset
2700 \begin_inset Quotes eld
2701 \end_inset
2703 BUTTONB
2704 \begin_inset Quotes erd
2705 \end_inset
2708 \begin_inset Quotes eld
2709 \end_inset
2711 BUTTONC
2712 \begin_inset Quotes erd
2713 \end_inset
2715  or 
2716 \begin_inset Quotes eld
2717 \end_inset
2719 BUTTOND
2720 \begin_inset Quotes erd
2721 \end_inset
2724 \end_layout
2726 \begin_layout Itemize
2727 Argument #2: 
2728 \begin_inset Quotes eld
2729 \end_inset
2732 \begin_inset Quotes erd
2733 \end_inset
2735  if released, 
2736 \begin_inset Quotes eld
2737 \end_inset
2740 \begin_inset Quotes erd
2741 \end_inset
2743  if pressed
2744 \end_layout
2746 \begin_layout Standard
2747 Send button down/up event.
2748  No time restrictions.
2749 \end_layout
2751 \begin_layout Subsubsection
2752 Joystick axis event:
2753 \end_layout
2755 \begin_layout Itemize
2756 Dispatch to: org.jpc.modules.Joystick
2757 \end_layout
2759 \begin_layout Itemize
2760 Argument #1: 
2761 \begin_inset Quotes eld
2762 \end_inset
2764 AXISA
2765 \begin_inset Quotes erd
2766 \end_inset
2769 \begin_inset Quotes eld
2770 \end_inset
2772 AXISB
2773 \begin_inset Quotes erd
2774 \end_inset
2777 \begin_inset Quotes eld
2778 \end_inset
2780 AXISC
2781 \begin_inset Quotes erd
2782 \end_inset
2784  or 
2785 \begin_inset Quotes eld
2786 \end_inset
2788 AXISD
2789 \begin_inset Quotes erd
2790 \end_inset
2793 \end_layout
2795 \begin_layout Itemize
2796 Argument #2: Multivibrator unstable state length in ns.
2797 \end_layout
2799 \begin_layout Standard
2800 Set amount of time multivibrator remains in unstable state.
2801  No time restrictions.
2802 \end_layout
2804 \begin_layout Subsubsection
2805 Reboot:
2806 \end_layout
2808 \begin_layout Itemize
2809 Dispatch to: org.jpc.emulator.PC$ResetButton
2810 \end_layout
2812 \begin_layout Itemize
2813 No arguments
2814 \end_layout
2816 \begin_layout Standard
2817 Reboots the PC.
2818 \end_layout
2820 \begin_layout Subsubsection
2821 Fda disk change:
2822 \end_layout
2824 \begin_layout Itemize
2825 Dispatch to: org.jpc.emulator.PC$DiskChanger
2826 \end_layout
2828 \begin_layout Itemize
2829 Argument #1: Fixed: "FDA"
2830 \end_layout
2832 \begin_layout Itemize
2833 Argument #2: Number of image slot to put there.
2835 \end_layout
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 floppy drive A.
2840  This event causes specified disk to be placed to FDA or FDA disk to be
2841  ejected with no replacement if disk number is -1.
2842  The specified disk if not -1 must be of floppy type.
2843  The specified disk if valid must not be in any other drive.
2844 \end_layout
2846 \begin_layout Subsubsection
2847 Fdb disk change:
2848 \end_layout
2850 \begin_layout Itemize
2851 Dispatch to: org.jpc.emulator.PC$DiskChanger
2852 \end_layout
2854 \begin_layout Itemize
2855 Argument #1: Fixed: "FDB"
2856 \end_layout
2858 \begin_layout Itemize
2859 Argument #2: Number of image slot to put there.
2861 \end_layout
2863 \begin_layout Standard
2864 The disk number MUST be -1 or valid disk number.
2865  -1 MUST NOT be used if there is no disk in floppy drive B.
2866  This event causes specified disk to be placed to FDB or FDB disk to be
2867  ejected with no replacement if disk number is -1.
2868  The specified disk if not -1 must be of floppy type.
2869  The specified disk if valid must not be in any other drive.
2870 \end_layout
2872 \begin_layout Subsubsection
2873 Change CDROM:
2874 \end_layout
2876 \begin_layout Itemize
2877 Dispatch to: org.jpc.emulator.PC$DiskChanger
2878 \end_layout
2880 \begin_layout Itemize
2881 Argument #1: Fixed: "CDROM"
2882 \end_layout
2884 \begin_layout Itemize
2885 Argument #2: Number of image slot to put there.
2887 \end_layout
2889 \begin_layout Standard
2890 The disk number MUST be -1 or valid disk number.
2891  -1 MUST NOT be used if there is no disk in CD-ROM.
2892  This event causes specified disk to be placed to CD-ROM or CD-ROM disk
2893  to be ejected with no replacement if disk number is -1.
2894  The specified disk if not -1 must be of CD-ROM type.
2895 \end_layout
2897 \begin_layout Standard
2898 This event has no effect if CD-ROM is locked.
2899 \end_layout
2901 \begin_layout Subsubsection
2902 Write protect floppy:
2903 \end_layout
2905 \begin_layout Itemize
2906 Dispatch to: org.jpc.emulator.PC$DiskChanger
2907 \end_layout
2909 \begin_layout Itemize
2910 Argument #1: Fixed: "WRITEPROTECT"
2911 \end_layout
2913 \begin_layout Itemize
2914 Argument #2: Number of image slot to manipulate 
2915 \end_layout
2917 \begin_layout Standard
2918 Write protects specified disk.
2919  The disk MUST NOT be in any drive and MUST be valid floppy-type disk.
2920 \end_layout
2922 \begin_layout Subsubsection
2923 Write unprotect floppy:
2924 \end_layout
2926 \begin_layout Itemize
2927 Dispatch to: org.jpc.emulator.PC$DiskChanger
2928 \end_layout
2930 \begin_layout Itemize
2931 Argument #1: Fixed: "WRITEUNPROTECT"
2932 \end_layout
2934 \begin_layout Itemize
2935 Argument #2: Number of image slot to manipulate 
2936 \end_layout
2938 \begin_layout Standard
2939 Disables write protection specified disk.
2940  The disk MUST NOT be in any drive and MUST be valid floppy-type disk.
2941 \end_layout
2943 \begin_layout Subsection
2944 Diskinfo sections
2945 \end_layout
2947 \begin_layout Standard
2948 Diskinfo sections are named 
2949 \begin_inset Quotes eld
2950 \end_inset
2952 diskinfo-
2953 \begin_inset Quotes erd
2954 \end_inset
2956 <id of disk>.
2957  They use line component encoding, fieldtype being first component on each
2958  line (value being the second).
2959  Following fields are defined:
2960 \end_layout
2962 \begin_layout Subsubsection
2963 TYPE
2964 \end_layout
2966 \begin_layout Standard
2967 Gives type of image.
2968  Possible values are
2969 \end_layout
2971 \begin_layout Itemize
2972 \begin_inset Quotes eld
2973 \end_inset
2975 FLOPPY
2976 \begin_inset Quotes erd
2977 \end_inset
2979  (floppy disk)
2980 \end_layout
2982 \begin_layout Itemize
2983 \begin_inset Quotes eld
2984 \end_inset
2987 \begin_inset Quotes erd
2988 \end_inset
2990  (Hard disk)
2991 \end_layout
2993 \begin_layout Itemize
2994 \begin_inset Quotes eld
2995 \end_inset
2997 CDROM
2998 \begin_inset Quotes erd
2999 \end_inset
3001  (CD-ROM)
3002 \end_layout
3004 \begin_layout Itemize
3005 \begin_inset Quotes eld
3006 \end_inset
3008 BIOS
3009 \begin_inset Quotes erd
3010 \end_inset
3012  (BIOS/VGABIOS image)
3013 \end_layout
3015 \begin_layout Itemize
3016 \begin_inset Quotes eld
3017 \end_inset
3019 UNKNOWN
3020 \begin_inset Quotes erd
3021 \end_inset
3023  (what the heck is this???)
3024 \end_layout
3026 \begin_layout Subsubsection
3028 \end_layout
3030 \begin_layout Standard
3031 Gives ID of disk.
3032 \end_layout
3034 \begin_layout Subsubsection
3035 IMAGELENGTH
3036 \end_layout
3038 \begin_layout Standard
3039 (BIOS images only) Gives length of BIOS image
3040 \end_layout
3042 \begin_layout Subsubsection
3043 IMAGEMD5
3044 \end_layout
3046 \begin_layout Standard
3047 MD5 of raw disk/BIOS image without any headers or trailers.
3048 \end_layout
3050 \begin_layout Subsubsection
3051 TOTALSECTORS
3052 \end_layout
3054 \begin_layout Standard
3055 (FLOPPY/HDD/CDROM images only) Number of total sectors on disk.
3056 \end_layout
3058 \begin_layout Subsubsection
3059 TRACKS
3060 \end_layout
3062 \begin_layout Standard
3063 (FLOPPY/HDD images only) Number of tracks on disk per side (1-256 for floppy,
3064  1-1024 for HDD).
3065 \end_layout
3067 \begin_layout Subsubsection
3068 SIDES
3069 \end_layout
3071 \begin_layout Standard
3072 (FLOPPY/HDD images only) Number of sides on disk (1 or 2 for floppy, 1-16
3073  for HDD).
3074 \end_layout
3076 \begin_layout Subsubsection
3077 SECTORS
3078 \end_layout
3080 \begin_layout Standard
3081 (FLOPPY/HDD images only) Number of sectors per track (1-255 for floppy,
3082  1-63 for HDD).
3083 \end_layout
3085 \begin_layout Subsubsection
3086 COMMENT
3087 \end_layout
3089 \begin_layout Standard
3090 Line from image comment block.
3091  Usually give data about files image has.
3092  May or may not be present (multiple times)
3093 \end_layout
3095 \begin_layout Subsection
3096 Output info
3097 \end_layout
3099 \begin_layout Standard
3100 Output info is stored in section 
3101 \begin_inset Quotes eld
3102 \end_inset
3104 output-info
3105 \begin_inset Quotes erd
3106 \end_inset
3109  Its relatively new, so it might not be present (then the contents have
3110  to be guessed based on modules present).
3111  Each line gives information about one output, first field being the type
3112  of output.
3113 \end_layout
3115 \begin_layout Subsubsection
3116 Video output
3117 \end_layout
3119 \begin_layout Standard
3120 For video output, there are no parameters so line is just 
3121 \begin_inset Quotes eld
3122 \end_inset
3124 VIDEO
3125 \begin_inset Quotes erd
3126 \end_inset
3128  (one component).
3129 \end_layout
3131 \begin_layout Subsubsection
3132 Audio output
3133 \end_layout
3135 \begin_layout Standard
3136 For audio output, the only parameter is name of output, so first component
3137  is 
3138 \begin_inset Quotes eld
3139 \end_inset
3141 AUDIO
3142 \begin_inset Quotes erd
3143 \end_inset
3145  and second component is name of audio output.
3146 \end_layout
3148 \begin_layout Subsection
3149 Savestates
3150 \end_layout
3152 \begin_layout Standard
3153 Actual savestate format is not documented here.
3154  It is close to impossible to comprehend without access to emulator source
3155  anyway.
3156 \end_layout
3158 \begin_layout Section
3159 Advanced: Making class dumpable
3160 \end_layout
3162 \begin_layout Standard
3163 Class is made dumpable by implementing interface org.jpc.emulator.SRDumpable
3164  and implementing method dumpSRPartial(org.jpc.emulator.SRDumper) and constructor
3165  <init>(org.jpc.emulator.SRLoader).
3166  Non-static inner classes can not be dumpable (make them static using tricks
3167  similar to what javac uses).
3168 \end_layout
3170 \begin_layout Standard
3171 If dumped class has dumpable superclass, the first thing dumping function
3172  needs to do is to call dumper function of superclass and first thing loading
3173  constructor needs to do is to call loading constructor of superclass.
3174  If class has no dumpable superclass, dumper doesn't need to do anything
3175  special, while loader needs to call objectCreated(this) on SRLoader object
3176  passed as parameter.
3178 \end_layout
3180 \begin_layout Standard
3181 Following these fixed parts, dump all members that are part of mutable state
3182  in emulator core.
3183 \end_layout
3185 \begin_layout Subsection
3186 Member dumping/loading functions
3187 \end_layout
3189 \begin_layout Standard
3190 There is dumping/loading function for following (all functions dumping/loading
3191  reference types can handle null):
3192 \end_layout
3194 \begin_layout Itemize
3195 boolean: SRDumper.dumpBoolean, SRLoader.loadBoolean
3196 \end_layout
3198 \begin_layout Itemize
3199 byte: SRDumper.dumpByte, SRLoader.loadByte
3200 \end_layout
3202 \begin_layout Itemize
3203 short: SRDumper.dumpShort, SRLoader.loadShort
3204 \end_layout
3206 \begin_layout Itemize
3207 int: SRDumper.dumpInt, SRLoader.loadInt
3208 \end_layout
3210 \begin_layout Itemize
3211 long: SRDumper.dumpLong, SRLoader.loadLong
3212 \end_layout
3214 \begin_layout Itemize
3215 String: SRDumper.dumpString, SRLoader.loadString
3216 \end_layout
3218 \begin_layout Itemize
3219 boolean[]: SRDumper.dumpArray, SRLoader.loadArrayBoolean
3220 \end_layout
3222 \begin_layout Itemize
3223 byte[]: SRDumper.dumpArray, SRLoader.loadArrayByte
3224 \end_layout
3226 \begin_layout Itemize
3227 short[]: SRDumper.dumpArray, SRLoader.loadArrayShort
3228 \end_layout
3230 \begin_layout Itemize
3231 int[]: SRDumper.dumpArray, SRLoader.loadArrayInt
3232 \end_layout
3234 \begin_layout Itemize
3235 long[]: SRDumper.dumpArray, SRLoader.loadArrayLong
3236 \end_layout
3238 \begin_layout Itemize
3239 double[]: SRDumper.dumpArray, SRLoader.loadArrayDouble
3240 \end_layout
3242 \begin_layout Itemize
3243 <dumpable type>: SRDumper.dumpObject, SRLoader.loadObject
3244 \end_layout
3246 \begin_layout Itemize
3247 special object: SRDumper.specialObject, SRLoader.specialObject
3248 \end_layout
3250 \begin_layout Subsubsection
3251 Notes:
3252 \end_layout
3254 \begin_layout Itemize
3255 Dumpable objects come out as type of org.jpc.emulator.SRDumpable.
3256 \end_layout
3258 \begin_layout Itemize
3259 Special objects are various static objects that don't need to be stored
3260  because they don't have mutable fields.
3261 \end_layout
3263 \begin_layout Itemize
3264 Don't dump fields related to event state feedback.
3265 \end_layout
3267 \begin_layout Itemize
3268 Don't dump temporary flags that are only used while PC is running.
3269  Savestate when PC is running isn't possible anyway.
3270 \end_layout
3272 \begin_layout Itemize
3273 Some connectors dump fields related to connector output, some don't.
3274 \end_layout
3276 \begin_layout Section
3277 Advanced: Making output connectors
3278 \end_layout
3280 \begin_layout Standard
3281 Implementing interface org.jpc.emulator.DisplayController signals that this
3282  is display controller, inhibiting loading of the standard VGA display controlle
3283 r if loaded as module.
3285 \end_layout
3287 \begin_layout Subsection
3288 Interface org.jpc.emulator.OutputConnector
3289 \end_layout
3291 \begin_layout Standard
3292 Class is made to be output connector by implementing this interface.
3293  This interface specifies the methods used for output hold locking.
3294  Class org.jpc.emulator.OutputConnectorLocking has implementations of these
3295  that are suitable for calling.
3297 \end_layout
3299 \begin_layout Subsubsection
3300 Method subscribeOutput(Object)
3301 \end_layout
3303 \begin_layout Standard
3304 Subscribes the output, with specified object as handle.
3305 \end_layout
3307 \begin_layout Subsubsection
3308 Method unsubscribeOutput(Object)
3309 \end_layout
3311 \begin_layout Standard
3312 Unsubscribe the specified handle object from output.
3313 \end_layout
3315 \begin_layout Subsubsection
3316 Method waitOutput(Object)
3317 \end_layout
3319 \begin_layout Standard
3320 Wait for output on specified connector using specified handle object.
3321  Returns true on success, false if wait was interrupted by thread interrupt.
3322  Blocking.
3323 \end_layout
3325 \begin_layout Subsubsection
3326 Method releaseOutput(Object)
3327 \end_layout
3329 \begin_layout Standard
3330 Release connector from p.o.v.
3331  of given handle.
3332  Does not block.
3333 \end_layout
3335 \begin_layout Subsubsection
3336 Method holdOutput()
3337 \end_layout
3339 \begin_layout Standard
3340 Release threads waiting on waitOutput() and block until all subscribers
3341  have returned from waitOutput() and enteired releaseOutput().
3342 \end_layout
3344 \begin_layout Subsubsection
3345 Method releaseOutputWaitAll(object)
3346 \end_layout
3348 \begin_layout Standard
3349 Like releaseOutput(), but waits until all handles have released their output.
3350 \end_layout
3352 \begin_layout Subsection
3353 Class org.jpc.emulator.VGADigtalOut
3354 \end_layout
3356 \begin_layout Standard
3357 Class org.jpc.emulator.VGADigtalOut (already implements OutputConnector) implements
3358  VGA output connector.
3359  If module provodes output connector, it needs to implement org.jpc.emulator.Displa
3360 yController.
3361 \end_layout
3363 \begin_layout Subsubsection
3364 Method getWidth()
3365 \end_layout
3367 \begin_layout Standard
3368 Get width of display (watch out, can return 0).
3369 \end_layout
3371 \begin_layout Subsubsection
3372 Method getHeight()
3373 \end_layout
3375 \begin_layout Standard
3376 Get height of display (watch out, can return 0).
3377 \end_layout
3379 \begin_layout Subsubsection
3380 Methods getDirtyXMin(), getDirtyXMax(), getDirtyYMin(), getDirtyYMax()
3381 \end_layout
3383 \begin_layout Standard
3384 Returns the dirty region (region modified since last output).
3385 \end_layout
3387 \begin_layout Subsubsection
3388 Method getBuffer()
3389 \end_layout
3391 \begin_layout Standard
3392 Get buffer of ints, at least width * height elements (left-to-right, top-down,
3393  one value per pixel) giving pixel data.
3394  Value for each pixel is 65536 * <red-component> + 256 * <green-component>
3395  + <blue-component>.
3396 \end_layout
3398 \begin_layout Subsubsection
3399 Method resizeDisplay(int _width, int _height)
3400 \end_layout
3402 \begin_layout Standard
3403 Resize the display to be of specified size.
3404 \end_layout
3406 \begin_layout Subsubsection
3407 Method dirtyDisplayRegion(int x, int y, int w, int h)
3408 \end_layout
3410 \begin_layout Standard
3411 Mark the specified region as dirty.
3412 \end_layout
3414 \begin_layout Subsubsection
3415 Method resetDirtyRegion()
3416 \end_layout
3418 \begin_layout Standard
3419 Resets the dirty region to be empty.
3420 \end_layout
3422 \begin_layout Subsection
3423 Class org.jpc.emulator.PC method getVideoOutput()
3424 \end_layout
3426 \begin_layout Standard
3427 Get VGA output connector for PC.
3428 \end_layout
3430 \begin_layout Subsection
3431 Interface org.jpc.emulator.DisplayController.
3432 \end_layout
3434 \begin_layout Standard
3435 Implementing this class signals that module is VGA controller.
3436  There can be only one such module active at time and presence of such module
3437  prevents loading builtin VGA controller emulation code.
3438 \end_layout
3440 \begin_layout Subsubsection
3441 Method getOutputDevice()
3442 \end_layout
3444 \begin_layout Standard
3445 Get VGA output connector for this VGA device.
3446 \end_layout
3448 \begin_layout Subsection
3449 Class org.jpc.emulator.SoundDigitalOut
3450 \end_layout
3452 \begin_layout Standard
3453 Class org.jpc.emulator.SoundDigitalOut provodes output connector for sound.
3454  Each connector can transfer stereo signal at arbitiary sampling rate.
3455  Modules that have audio connectors need to implement interface org.jpc.emulator.So
3456 undOutputDevice, as this signals that output connectors should be created.
3457 \end_layout
3459 \begin_layout Subsubsection
3460 Method addSample(long, short, short)
3461 \end_layout
3463 \begin_layout Standard
3464 Add stereo sample at time given by first argument.
3465  The second and third arguments give volume on left and right channels.
3466 \end_layout
3468 \begin_layout Subsubsection
3469 Method addSample(long, short)
3470 \end_layout
3472 \begin_layout Standard
3473 Add mono sample at time given by first argument.
3474  The second argument give volume on both channels.
3475 \end_layout
3477 \begin_layout Subsubsection
3478 Method readBlock(Block)
3479 \end_layout
3481 \begin_layout Standard
3482 Reads block of output (atomic versus addSample).
3483  Block structure has following fields which are filled:
3484 \end_layout
3486 \begin_layout Itemize
3487 timeBase: Time base for block.
3488 \end_layout
3490 \begin_layout Itemize
3491 baseLeft: Left volume at time base.
3492 \end_layout
3494 \begin_layout Itemize
3495 baseRight: Right volume at time base
3496 \end_layout
3498 \begin_layout Itemize
3499 blockNo: Sequence number of block filled.
3500 \end_layout
3502 \begin_layout Itemize
3503 samples: Number of samples in block
3504 \end_layout
3506 \begin_layout Itemize
3507 sampleTiming: Number of nanoseconds since last sample
3508 \end_layout
3510 \begin_layout Itemize
3511 sampleLeft: Left channel samples
3512 \end_layout
3514 \begin_layout Itemize
3515 sampleRight: Right channel samples
3516 \end_layout
3518 \begin_layout Subsection
3519 Interface org.jpc.emulator.SoundOutputDevice
3520 \end_layout
3522 \begin_layout Standard
3523 Implementing this interface signals that module has audio output channels.
3524 \end_layout
3526 \begin_layout Subsubsection
3527 Method org.jpc.emulator.SoundOutputDevice.requestedSoundChannels()
3528 \end_layout
3530 \begin_layout Standard
3531 Return the number of sound channels module has.
3532 \end_layout
3534 \begin_layout Subsubsection
3535 Method org.jpc.emulator.SoundOutputDevice.soundChannelCallback(SoundDigitalOut)
3536 \end_layout
3538 \begin_layout Standard
3539 This is called once per sound channel requested giving precreated sound
3540  channel.
3541 \end_layout
3543 \begin_layout Subsection
3544 Class org.jpc.emulator.PC method getSoundOut(String)
3545 \end_layout
3547 \begin_layout Standard
3548 Get sound output with specified name.
3549 \end_layout
3551 \begin_layout Section
3552 Advanced: Writing event targets
3553 \end_layout
3555 \begin_layout Standard
3556 Whereas output connectors are the way output is dispatched, input is dispatched
3557  via event targets.
3558  Event targets need to implement interface org.jpc.emulator.EventDispatchTarget.
3559 \end_layout
3561 \begin_layout Standard
3562 Event targets also provode methods which then encode events and dispatch
3563  them forward (without doing anything else) to event recorder.
3564  Also, event targets may have methods for obtaining state.
3565 \end_layout
3567 \begin_layout Subsection
3568 Interface org.jpc.emulator.EventDispatchTarget
3569 \end_layout
3571 \begin_layout Standard
3572 Interface that marks class capable of receiving events.
3573 \end_layout
3575 \begin_layout Subsubsection
3576 Method setEventRecorder(EventRecorder)
3577 \end_layout
3579 \begin_layout Standard
3580 Set the event recorder input events are sent to.
3581 \end_layout
3583 \begin_layout Subsubsection
3584 Method startEventCheck()
3585 \end_layout
3587 \begin_layout Standard
3588 Signals target to reset all state related to event checking and state feedback.
3589  This may be called at any time in order to reinitialialize event checking/feedb
3590 ack state.
3591 \end_layout
3593 \begin_layout Subsubsection
3594 Method doEvent(long, String[], int) throws IOException
3595 \end_layout
3597 \begin_layout Standard
3598 Event dispatch handler.
3599  The first argument is event time, second is parameters and third is what
3600  to do with it.
3601  If target doesn't like the event, throw IOException.
3602  Following types (the integer parameter) are used:
3603 \end_layout
3605 \begin_layout LyX-Code
3606 0 (EventRecorder.EVENT_TIMED): Time has been assigned for event.
3607 \end_layout
3609 \begin_layout LyX-Code
3610 1 (EventRecorder.EVENT_STATE_EFFECT_FUTURE): Future event in event replay
3611  for reinitialization
3612 \end_layout
3614 \begin_layout LyX-Code
3615 2 (EventRecorder.EVENT_STATE_EFFECT): Past event in event replay reinitialization
3616 \end_layout
3618 \begin_layout LyX-Code
3619 3 (EventRecorder.EVENT_EXECUTE): This event occurs now.
3620  Execute the effect.
3621 \end_layout
3623 \begin_layout Subsubsection
3624 Method endEventCheock()
3625 \end_layout
3627 \begin_layout Standard
3628 End event reinitialization.
3629  Usually unused.
3630 \end_layout
3632 \begin_layout Subsubsection
3633 Method getEventTimeLowBound(long, String[]) throws IOException
3634 \end_layout
3636 \begin_layout Standard
3637 Return the time value that's the earliest possiblity for this event to occur.
3638  Returning any time in past (including -1) causes event to fire as soon
3639  as possible.
3640  The long parameter gives the current scheduled time for event.
3641 \end_layout
3643 \begin_layout Section
3644 Writing modules
3645 \end_layout
3647 \begin_layout Standard
3648 Modules are various extensions that run inside emulator core.
3649  As such, they affect sync.
3650  Modules must implement interface org.jpc.emulator.HardwareComponent (they
3651  are hardware components) and must be dumpable.
3652  Additionally, they need either constructor <init>() or <init>(String).
3653  The first is if no parameters are passed, the second is for case where
3654  parameters are passed.
3655 \end_layout
3657 \begin_layout Standard
3658 Aside of the constructors, modules need to obey the ordinary conventions
3659  for hardware components.
3660  No code outside modules needs to know that module exists.
3661 \end_layout
3663 \begin_layout Section
3664 Writing plugins
3665 \end_layout
3667 \begin_layout Standard
3668 Plugins handle various UI tasks.
3669  They need to implement interface org.jpc.Plugin.
3670 \end_layout
3672 \begin_layout Subsection
3673 Interface org.jpc.pluginsbase.Plugin
3674 \end_layout
3676 \begin_layout Subsubsection
3677 Method systemShutdown()
3678 \end_layout
3680 \begin_layout Standard
3681 Called when emulator shuts down.
3682  Either called in dedicated thread or in thread that called emulatorShutdown().
3683  These handlers should do the bare minimum to get files on disk to consistent
3684  state.
3685  After these calls from all plugins have finished, emulator exits.
3686  Do not try to manipulate UI from these methods, as doing that easily leads
3687  into deadlock.
3688 \end_layout
3690 \begin_layout Subsubsection
3691 Method reconnect(PC) 
3692 \end_layout
3694 \begin_layout Standard
3695 Gives new PC to connect to.
3696  Null is passed if plugin should disconnect.
3697 \end_layout
3699 \begin_layout Subsubsection
3700 Method main()
3701 \end_layout
3703 \begin_layout Standard
3704 Called in dedicated thread after plugin is initialized.
3705 \end_layout
3707 \begin_layout Subsubsection
3708 Method pcStopping()
3709 \end_layout
3711 \begin_layout Standard
3712 Called after PC has stopped.
3713 \end_layout
3715 \begin_layout Subsubsection
3716 Method pcStarting()
3717 \end_layout
3719 \begin_layout Standard
3720 Called before PC starts.
3721 \end_layout
3723 \begin_layout Subsubsection
3724 Method notifyArguments(String[])
3725 \end_layout
3727 \begin_layout Standard
3728 Pass arguments from command line.
3729 \end_layout
3731 \begin_layout Subsubsection
3732 Constructor <init>(Plugins)
3733 \end_layout
3735 \begin_layout Standard
3736 This constructor is used to initialize plugins that don't take parameters.
3737 \end_layout
3739 \begin_layout Subsubsection
3740 Constructor <init>(Plugins, String)
3741 \end_layout
3743 \begin_layout Standard
3744 This constructor is used to initialize plugins that take parameters.
3745 \end_layout
3747 \begin_layout Subsection
3748 Class org.jpc.pluginsbase.Plugins
3749 \end_layout
3751 \begin_layout Standard
3752 This class provodes various methods for manipulating plugins.
3753 \end_layout
3755 \begin_layout Subsubsection
3756 Method isShuttingDown()
3757 \end_layout
3759 \begin_layout Standard
3760 Returns true if Plugins.shutdownEmulator() has been called somehow, either
3761  via VM exit, CTRL+C or explicitly.
3762  Useful to skip cleanups involving GUI, as these are too deadlock-prone.
3763 \end_layout
3765 \begin_layout Subsubsection
3766 Method shutdownEmulator()
3767 \end_layout
3769 \begin_layout Standard
3770 Shut down and exit the emulator.
3771  All plugin shutdown functions are called in this thread.
3772 \end_layout
3774 \begin_layout Subsubsection
3775 Method reconnectPC(PC)
3776 \end_layout
3778 \begin_layout Standard
3779 Signal reconnectPC event to all plugins.
3780 \end_layout
3782 \begin_layout Subsubsection
3783 Method pcStarted()
3784 \end_layout
3786 \begin_layout Standard
3787 Signal pcStarting() event to all plugins.
3788 \end_layout
3790 \begin_layout Subsubsection
3791 Method pcStopped()
3792 \end_layout
3794 \begin_layout Standard
3795 Signal pcStopping() event to all plugins.
3796 \end_layout
3798 \begin_layout Section
3799 Inter-plugin communication
3800 \end_layout
3802 \begin_layout Subsection
3803 Receiving communications
3804 \end_layout
3806 \begin_layout Standard
3807 To receive invocation/call by name 'foo-bar', declare public method named
3808  'eci_foo_bar'.
3809  Arguments to this method can currently be String, Integer (int) or Long
3810  (long).
3811  Last argument may be array over these types to get variable number of arguments.
3812  On call, each argument gets value from call.
3813  If last argument is array, it gets all overflowing arguments.
3814  If return type is void or method returns boolean false, call is assumed
3815  to have completed.
3816  If return value is boolean true, it is assumed that there is more processing.
3817 \end_layout
3819 \begin_layout Subsection
3820 void org.jpc.pluginsbase.Plugins.invokeExternalCommand(String cmd, Object[]
3821  args) 
3822 \end_layout
3824 \begin_layout Standard
3825 Invoke command asynchronously, broadcasting to all plugins.
3826  Does not wait for slow commands to complete.
3827  cmd is the name to send and args are the arguments to pass.
3828 \end_layout
3830 \begin_layout Subsection
3831 void org.jpc.pluginsbase.Plugins.invokeExternalCommandSynchronous(String cmd,
3832  Object[] args) 
3833 \end_layout
3835 \begin_layout Standard
3836 Same as invokeExternalCommand, but waits for slow commands to complete.
3837 \end_layout
3839 \begin_layout Subsection
3840 Object[] org.jpc.pluginsbase.Plugins.invokeExternalCommandReturn(String cmd,
3841  Object[] args) 
3842 \end_layout
3844 \begin_layout Standard
3845 Similar to invokeExternalCommandSynchornous, but:
3846 \end_layout
3848 \begin_layout Itemize
3849 Quits calling more plugins when it gets successful reply.
3850 \end_layout
3852 \begin_layout Itemize
3853 Returns said reply
3854 \end_layout
3856 \begin_layout Subsection
3857 void org.jpc.pluginsbase.Plugins.returnValue(Object...
3858  ret)
3859 \end_layout
3861 \begin_layout Standard
3862 Gives return value to return from call and signals that command has completed.
3863 \end_layout
3865 \begin_layout Subsection
3866 void org.jpc.pluginsbase.Plugins.signalCommandCompletion()
3867 \end_layout
3869 \begin_layout Standard
3870 Signals that command has completed.
3871  Only needed if there is no return value and eci_ method returned false
3872  (not done yet).
3873 \end_layout
3875 \begin_layout Section
3876 Lua kernel programming
3877 \end_layout
3879 \begin_layout Standard
3880 At startup, kernel gets its arguments in 'args' table and the script name
3881  to run in 'scriptname' string.
3882  It should enter the named script in protected mode.
3883 \end_layout
3885 \begin_layout Standard
3886 The Lua VM exports numerious callbacks to kernel.
3887  The kernel can then choose to omit, wrap or re-export these to Lua scripts.
3888 \end_layout
3890 \begin_layout Itemize
3891 Always grab any functions used into local variables so nobody can mess with
3892  them
3893 \end_layout
3895 \begin_layout Itemize
3896 Don't use global variables in kernel (except for those passed).
3897 \end_layout
3899 \end_body
3900 \end_document