Home » Archimedes archive » Acorn User » AU 1997-10 A.adf » Extras » Apple][e/!Virtu/Data/Docs/Tech

Apple][e/!Virtu/Data/Docs/Tech

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-10 A.adf » Extras
Filename: Apple][e/!Virtu/Data/Docs/Tech
Read OK:
File size: 1FF4 bytes
Load address: 0000
Exec address: 0000
File contents
Technical Notes
===============

Apple2eROM Image
~~~~~~~~~~~~~~~~
    The Apple2eROM image file should be the same format as used by the AppleWin
emulator (for the IBM PC) and is as follows:

+&0000 External I/O ROM ($C000-$CFFF)
+&1000 Internal I/O ROM ($C000-$CFFF)
+&2000 Monitor ROM      ($D000-$FFFF)

Processor Emulation
~~~~~~~~~~~~~~~~~~~
    The NMOS 6502 had several problems which were rectified in later models in the
series. Virtu accurately emulates the known bugs found in the original:

- jump indirect wraps the effective address at a page boundary
- invalid flags after an arithmetic operation in decimal mode

    Another problem with the NMOS 6502 was the operation of undefined or
'undocumented' opcodes which were executable, but not legal instructions. Most of
these opcodes result in the CPU attempting to effectively execute two legal
instructions at once, and thus produce obscure, and even amusing operations. Virtu
implements these opcodes as multi-byte NOP instructions as per the operand length of
the opcodes in a Rockwell R6502. The cycle time used is the maximum of the times for
each of the two legal instructions that comprise the undefined instruction.

    The 65C02 amends all the problems mentioned above; however some older software
may rely on this erroneous functionality, thus Virtu's capability to switch between
the two processors becomes desirable. In particular, the indirect jump and undefined
instructions were sometimes used to make copy protection routines hard to follow,
and some games may rely on the incorrect decimal arithmetic result flags for score-
keeping. Note also that although the 65C02 defines the 6502's undefined opcodes as
either new instructions or multi-byte NOPs, the number of bytes consumed (ie operand
length) differs.

Sound Emulation
~~~~~~~~~~~~~~~
    Memory accesses in the range $C030 to $C03F, both reads and writes, generate a
speaker click on an Apple ][. Virtu buffers such accesses and the VVoice module uses
this information to generate square-wave pulses (scaled by volume) for the sound
system. Intense speaker activity at access periods of around 48 microseconds or less
would 'bog down' the sound emulation, since this is the output sample period for
the single sound channel used. To prevent this, accesses are ignored if they occur
at intervals of around 48 microseconds or less. Although a smaller output period
would improve sound resolution, it significantly increases overheads; 48us is a
compromise that gives a fuller sound for the average case.

Disk ][ Drive Emulation
~~~~~~~~~~~~~~~~~~~~~~~
    Virtu currently supports only one type of Apple ][ disk image, the DSK (from the
MSDOS ".dsk" suffix), or DOS order (DO) disk. This image format has no header
information but is simply the sector data itself, ordered by DOS sector number. Thus
for track 0 the sectors 0, 1, 2 ... F are found at offsets $000, $100, $200 ... $F00
in the DSK. This ordering comes in handy when editing DOS disks with a hex file
editor. For reference, the following table translates physical (numbering as encoded
in sector address fields) to DOS sectors and vice versa.

Physical:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
DOS:       0  7  E  6  D  5  C  4  B  3  A  2  9  1  8  F

DOS:       0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
Physical:  0  D  B  9  7  5  3  1  E  C  A  8  6  4  2  F

    The track format emulated is a standard DOS 3.3 16 sector track with 4&4-
encoded sector addressing and 6&2-encoded sector data. Although each sector has its
own volume number in its address field, all sectors on a disk usually have the same
one: Virtu gives each sector the volume number for the disk side it resides on (see
the Virtu "!Help"). DOS usually ignores volume numbers, but some software assigns
unique volume numbers to various disks in order to detect which one is in the drive.
In this case, set the volume number for each disk to that found by cataloging the
original disk or using a sector/nibble editor.

    Disk emulation is performed at the memory-mapped I/O level, not (as in some
emulators) by interception of RWTS (DOS) or MLI (ProDOS) calls. This technique
provides more complete emulation of disk access, though with a performance penalty.
Tracks are 'nibblized' at runtime in a manner analagous to DOS's method of writing
to disk. The resulting nibble data is almost identical to the data stream from a
disk ][ drive and interface card, save for a few changes made to fool the disk up-to-
speed check in RWTS (some emulators patch RWTS instead).

    The nibblizing of a track occurs only when the first nibble is actually
requested, not during disk arm movement. Non-integral track positions are truncated,
so track $11.5 reads track $11, and the maximum track is $22. A track is marked for
flushing when written to, and flushing occurs on:

- reading/writing a new track
- disk flip (A <-> B)
- changing drives (1 <-> 2)
- reset (also sets drive 1, drive motor off, stepper phases off)
- exiting Virtu

    The flush denibblizes the cached track image as DOS does when reading from disk
(except that Virtu ignores sector volume numbers), and if all sectors are error free
writes it back to the disk image. Initializing a disk should work for all DOSs that
use standard sector marks. Problems may occur in the unlikely event of a DOS
requiring unusual track lengths, inter-sector gap lengths or physical sector
orderings. These cases would, however, amount to copy protection anyway.

Video Emulation
~~~~~~~~~~~~~~~
    All standard Apple //e video modes are supported, including text, graphics and
mixed modes. When displaying hires graphics in color Virtu closely emulates the
characteristic odd/even pixel coloring which effectively halves the horizontal
screen resolution from 280 (monochrome) pixels to 140 (colour pair) pixels across.
The bit 7 (delay) half pixel shift and color interference of adjacent delayed and
non-delayed pixels is not emulated due to resolution and performance constraints.
The video modes supported are:

- Lores graphics
- 40 column Text
- 80 column Text
- Lores graphics & 40 column Text
- Lores graphics & 80 column Text
- Hires graphics
- Hires graphics & 40 column Text
- Hires graphics & 80 column Text
- 7M Lores graphics
- Double Lores graphics
- 7M Lores graphics & 40 column Text
- Double Lores graphics & 80 column Text
- ND Hires graphics
- Double Hires graphics
- ND Hires graphics & 40 column Text
- Double Hires graphics & 80 column Text

    7M Lores and ND Hires are little known, and hence little used, video modes which
offer standard modes with reduced color capability. 7M Lores results from viewing
normal Lores then accessing $C05E (DHiresSet). When 80 column mode is not enabled,
this forces normal Hires graphics timing (7Mhz) rather than double Hires timing
(14MHz). The reducton in timing resolution means only black, green, purple and white
colours are available. ND (no delay) Hires can be similarly activated, and because
$C05E disables the colour signal timing delay responsible for 'high bit set' colours
(orange and blue) when not in 80 column mode, the colours available are also only
those in 7M Lores. It seems that the only use for these modes would be to flash on
and off those colours affected for primitive special effects.

Joystick Emulation
~~~~~~~~~~~~~~~~~~
    A memory access in the range $C070 to $C07F starts timers whose pulse widths are
variable from 2 to 3300 microseconds depending on the resistances of the attached
joystick/paddles. The high bit of a paddle address goes low when the timer expires,
and most paddle routines count 11 cycle loops waiting for this change. Some software
may use longer loops to check multiple paddles, and hence the number of accesses is
not a reliable way to emulate these timers. Virtu keeps the signal high for a cycle
count equalling 11 times the paddle value (0 to 255).

Printer Emulation
~~~~~~~~~~~~~~~~~
    Only simple text printer output is supported. Memory writes in the range $C090
to $C09F are output to the printer output file after being ANDed with #$7F to strip
the high bit. Formatting control characters are not filtered out.
00000000  54 65 63 68 6e 69 63 61  6c 20 4e 6f 74 65 73 0a  |Technical Notes.|
00000010  3d 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 0a  |===============.|
00000020  0a 41 70 70 6c 65 32 65  52 4f 4d 20 49 6d 61 67  |.Apple2eROM Imag|
00000030  65 0a 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |e.~~~~~~~~~~~~~~|
00000040  7e 7e 0a 20 20 20 20 54  68 65 20 41 70 70 6c 65  |~~.    The Apple|
00000050  32 65 52 4f 4d 20 69 6d  61 67 65 20 66 69 6c 65  |2eROM image file|
00000060  20 73 68 6f 75 6c 64 20  62 65 20 74 68 65 20 73  | should be the s|
00000070  61 6d 65 20 66 6f 72 6d  61 74 20 61 73 20 75 73  |ame format as us|
00000080  65 64 20 62 79 20 74 68  65 20 41 70 70 6c 65 57  |ed by the AppleW|
00000090  69 6e 0a 65 6d 75 6c 61  74 6f 72 20 28 66 6f 72  |in.emulator (for|
000000a0  20 74 68 65 20 49 42 4d  20 50 43 29 20 61 6e 64  | the IBM PC) and|
000000b0  20 69 73 20 61 73 20 66  6f 6c 6c 6f 77 73 3a 0a  | is as follows:.|
000000c0  0a 2b 26 30 30 30 30 20  45 78 74 65 72 6e 61 6c  |.+&0000 External|
000000d0  20 49 2f 4f 20 52 4f 4d  20 28 24 43 30 30 30 2d  | I/O ROM ($C000-|
000000e0  24 43 46 46 46 29 0a 2b  26 31 30 30 30 20 49 6e  |$CFFF).+&1000 In|
000000f0  74 65 72 6e 61 6c 20 49  2f 4f 20 52 4f 4d 20 28  |ternal I/O ROM (|
00000100  24 43 30 30 30 2d 24 43  46 46 46 29 0a 2b 26 32  |$C000-$CFFF).+&2|
00000110  30 30 30 20 4d 6f 6e 69  74 6f 72 20 52 4f 4d 20  |000 Monitor ROM |
00000120  20 20 20 20 20 28 24 44  30 30 30 2d 24 46 46 46  |     ($D000-$FFF|
00000130  46 29 0a 0a 50 72 6f 63  65 73 73 6f 72 20 45 6d  |F)..Processor Em|
00000140  75 6c 61 74 69 6f 6e 0a  7e 7e 7e 7e 7e 7e 7e 7e  |ulation.~~~~~~~~|
00000150  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 0a 20 20 20 20  |~~~~~~~~~~~.    |
00000160  54 68 65 20 4e 4d 4f 53  20 36 35 30 32 20 68 61  |The NMOS 6502 ha|
00000170  64 20 73 65 76 65 72 61  6c 20 70 72 6f 62 6c 65  |d several proble|
00000180  6d 73 20 77 68 69 63 68  20 77 65 72 65 20 72 65  |ms which were re|
00000190  63 74 69 66 69 65 64 20  69 6e 20 6c 61 74 65 72  |ctified in later|
000001a0  20 6d 6f 64 65 6c 73 20  69 6e 20 74 68 65 0a 73  | models in the.s|
000001b0  65 72 69 65 73 2e 20 56  69 72 74 75 20 61 63 63  |eries. Virtu acc|
000001c0  75 72 61 74 65 6c 79 20  65 6d 75 6c 61 74 65 73  |urately emulates|
000001d0  20 74 68 65 20 6b 6e 6f  77 6e 20 62 75 67 73 20  | the known bugs |
000001e0  66 6f 75 6e 64 20 69 6e  20 74 68 65 20 6f 72 69  |found in the ori|
000001f0  67 69 6e 61 6c 3a 0a 0a  2d 20 6a 75 6d 70 20 69  |ginal:..- jump i|
00000200  6e 64 69 72 65 63 74 20  77 72 61 70 73 20 74 68  |ndirect wraps th|
00000210  65 20 65 66 66 65 63 74  69 76 65 20 61 64 64 72  |e effective addr|
00000220  65 73 73 20 61 74 20 61  20 70 61 67 65 20 62 6f  |ess at a page bo|
00000230  75 6e 64 61 72 79 0a 2d  20 69 6e 76 61 6c 69 64  |undary.- invalid|
00000240  20 66 6c 61 67 73 20 61  66 74 65 72 20 61 6e 20  | flags after an |
00000250  61 72 69 74 68 6d 65 74  69 63 20 6f 70 65 72 61  |arithmetic opera|
00000260  74 69 6f 6e 20 69 6e 20  64 65 63 69 6d 61 6c 20  |tion in decimal |
00000270  6d 6f 64 65 0a 0a 20 20  20 20 41 6e 6f 74 68 65  |mode..    Anothe|
00000280  72 20 70 72 6f 62 6c 65  6d 20 77 69 74 68 20 74  |r problem with t|
00000290  68 65 20 4e 4d 4f 53 20  36 35 30 32 20 77 61 73  |he NMOS 6502 was|
000002a0  20 74 68 65 20 6f 70 65  72 61 74 69 6f 6e 20 6f  | the operation o|
000002b0  66 20 75 6e 64 65 66 69  6e 65 64 20 6f 72 0a 27  |f undefined or.'|
000002c0  75 6e 64 6f 63 75 6d 65  6e 74 65 64 27 20 6f 70  |undocumented' op|
000002d0  63 6f 64 65 73 20 77 68  69 63 68 20 77 65 72 65  |codes which were|
000002e0  20 65 78 65 63 75 74 61  62 6c 65 2c 20 62 75 74  | executable, but|
000002f0  20 6e 6f 74 20 6c 65 67  61 6c 20 69 6e 73 74 72  | not legal instr|
00000300  75 63 74 69 6f 6e 73 2e  20 4d 6f 73 74 20 6f 66  |uctions. Most of|
00000310  0a 74 68 65 73 65 20 6f  70 63 6f 64 65 73 20 72  |.these opcodes r|
00000320  65 73 75 6c 74 20 69 6e  20 74 68 65 20 43 50 55  |esult in the CPU|
00000330  20 61 74 74 65 6d 70 74  69 6e 67 20 74 6f 20 65  | attempting to e|
00000340  66 66 65 63 74 69 76 65  6c 79 20 65 78 65 63 75  |ffectively execu|
00000350  74 65 20 74 77 6f 20 6c  65 67 61 6c 0a 69 6e 73  |te two legal.ins|
00000360  74 72 75 63 74 69 6f 6e  73 20 61 74 20 6f 6e 63  |tructions at onc|
00000370  65 2c 20 61 6e 64 20 74  68 75 73 20 70 72 6f 64  |e, and thus prod|
00000380  75 63 65 20 6f 62 73 63  75 72 65 2c 20 61 6e 64  |uce obscure, and|
00000390  20 65 76 65 6e 20 61 6d  75 73 69 6e 67 20 6f 70  | even amusing op|
000003a0  65 72 61 74 69 6f 6e 73  2e 20 56 69 72 74 75 0a  |erations. Virtu.|
000003b0  69 6d 70 6c 65 6d 65 6e  74 73 20 74 68 65 73 65  |implements these|
000003c0  20 6f 70 63 6f 64 65 73  20 61 73 20 6d 75 6c 74  | opcodes as mult|
000003d0  69 2d 62 79 74 65 20 4e  4f 50 20 69 6e 73 74 72  |i-byte NOP instr|
000003e0  75 63 74 69 6f 6e 73 20  61 73 20 70 65 72 20 74  |uctions as per t|
000003f0  68 65 20 6f 70 65 72 61  6e 64 20 6c 65 6e 67 74  |he operand lengt|
00000400  68 20 6f 66 0a 74 68 65  20 6f 70 63 6f 64 65 73  |h of.the opcodes|
00000410  20 69 6e 20 61 20 52 6f  63 6b 77 65 6c 6c 20 52  | in a Rockwell R|
00000420  36 35 30 32 2e 20 54 68  65 20 63 79 63 6c 65 20  |6502. The cycle |
00000430  74 69 6d 65 20 75 73 65  64 20 69 73 20 74 68 65  |time used is the|
00000440  20 6d 61 78 69 6d 75 6d  20 6f 66 20 74 68 65 20  | maximum of the |
00000450  74 69 6d 65 73 20 66 6f  72 0a 65 61 63 68 20 6f  |times for.each o|
00000460  66 20 74 68 65 20 74 77  6f 20 6c 65 67 61 6c 20  |f the two legal |
00000470  69 6e 73 74 72 75 63 74  69 6f 6e 73 20 74 68 61  |instructions tha|
00000480  74 20 63 6f 6d 70 72 69  73 65 20 74 68 65 20 75  |t comprise the u|
00000490  6e 64 65 66 69 6e 65 64  20 69 6e 73 74 72 75 63  |ndefined instruc|
000004a0  74 69 6f 6e 2e 0a 0a 20  20 20 20 54 68 65 20 36  |tion...    The 6|
000004b0  35 43 30 32 20 61 6d 65  6e 64 73 20 61 6c 6c 20  |5C02 amends all |
000004c0  74 68 65 20 70 72 6f 62  6c 65 6d 73 20 6d 65 6e  |the problems men|
000004d0  74 69 6f 6e 65 64 20 61  62 6f 76 65 3b 20 68 6f  |tioned above; ho|
000004e0  77 65 76 65 72 20 73 6f  6d 65 20 6f 6c 64 65 72  |wever some older|
000004f0  20 73 6f 66 74 77 61 72  65 0a 6d 61 79 20 72 65  | software.may re|
00000500  6c 79 20 6f 6e 20 74 68  69 73 20 65 72 72 6f 6e  |ly on this erron|
00000510  65 6f 75 73 20 66 75 6e  63 74 69 6f 6e 61 6c 69  |eous functionali|
00000520  74 79 2c 20 74 68 75 73  20 56 69 72 74 75 27 73  |ty, thus Virtu's|
00000530  20 63 61 70 61 62 69 6c  69 74 79 20 74 6f 20 73  | capability to s|
00000540  77 69 74 63 68 20 62 65  74 77 65 65 6e 0a 74 68  |witch between.th|
00000550  65 20 74 77 6f 20 70 72  6f 63 65 73 73 6f 72 73  |e two processors|
00000560  20 62 65 63 6f 6d 65 73  20 64 65 73 69 72 61 62  | becomes desirab|
00000570  6c 65 2e 20 49 6e 20 70  61 72 74 69 63 75 6c 61  |le. In particula|
00000580  72 2c 20 74 68 65 20 69  6e 64 69 72 65 63 74 20  |r, the indirect |
00000590  6a 75 6d 70 20 61 6e 64  20 75 6e 64 65 66 69 6e  |jump and undefin|
000005a0  65 64 0a 69 6e 73 74 72  75 63 74 69 6f 6e 73 20  |ed.instructions |
000005b0  77 65 72 65 20 73 6f 6d  65 74 69 6d 65 73 20 75  |were sometimes u|
000005c0  73 65 64 20 74 6f 20 6d  61 6b 65 20 63 6f 70 79  |sed to make copy|
000005d0  20 70 72 6f 74 65 63 74  69 6f 6e 20 72 6f 75 74  | protection rout|
000005e0  69 6e 65 73 20 68 61 72  64 20 74 6f 20 66 6f 6c  |ines hard to fol|
000005f0  6c 6f 77 2c 0a 61 6e 64  20 73 6f 6d 65 20 67 61  |low,.and some ga|
00000600  6d 65 73 20 6d 61 79 20  72 65 6c 79 20 6f 6e 20  |mes may rely on |
00000610  74 68 65 20 69 6e 63 6f  72 72 65 63 74 20 64 65  |the incorrect de|
00000620  63 69 6d 61 6c 20 61 72  69 74 68 6d 65 74 69 63  |cimal arithmetic|
00000630  20 72 65 73 75 6c 74 20  66 6c 61 67 73 20 66 6f  | result flags fo|
00000640  72 20 73 63 6f 72 65 2d  0a 6b 65 65 70 69 6e 67  |r score-.keeping|
00000650  2e 20 4e 6f 74 65 20 61  6c 73 6f 20 74 68 61 74  |. Note also that|
00000660  20 61 6c 74 68 6f 75 67  68 20 74 68 65 20 36 35  | although the 65|
00000670  43 30 32 20 64 65 66 69  6e 65 73 20 74 68 65 20  |C02 defines the |
00000680  36 35 30 32 27 73 20 75  6e 64 65 66 69 6e 65 64  |6502's undefined|
00000690  20 6f 70 63 6f 64 65 73  20 61 73 0a 65 69 74 68  | opcodes as.eith|
000006a0  65 72 20 6e 65 77 20 69  6e 73 74 72 75 63 74 69  |er new instructi|
000006b0  6f 6e 73 20 6f 72 20 6d  75 6c 74 69 2d 62 79 74  |ons or multi-byt|
000006c0  65 20 4e 4f 50 73 2c 20  74 68 65 20 6e 75 6d 62  |e NOPs, the numb|
000006d0  65 72 20 6f 66 20 62 79  74 65 73 20 63 6f 6e 73  |er of bytes cons|
000006e0  75 6d 65 64 20 28 69 65  20 6f 70 65 72 61 6e 64  |umed (ie operand|
000006f0  0a 6c 65 6e 67 74 68 29  20 64 69 66 66 65 72 73  |.length) differs|
00000700  2e 0a 0a 53 6f 75 6e 64  20 45 6d 75 6c 61 74 69  |...Sound Emulati|
00000710  6f 6e 0a 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |on.~~~~~~~~~~~~~|
00000720  7e 7e 0a 20 20 20 20 4d  65 6d 6f 72 79 20 61 63  |~~.    Memory ac|
00000730  63 65 73 73 65 73 20 69  6e 20 74 68 65 20 72 61  |cesses in the ra|
00000740  6e 67 65 20 24 43 30 33  30 20 74 6f 20 24 43 30  |nge $C030 to $C0|
00000750  33 46 2c 20 62 6f 74 68  20 72 65 61 64 73 20 61  |3F, both reads a|
00000760  6e 64 20 77 72 69 74 65  73 2c 20 67 65 6e 65 72  |nd writes, gener|
00000770  61 74 65 20 61 0a 73 70  65 61 6b 65 72 20 63 6c  |ate a.speaker cl|
00000780  69 63 6b 20 6f 6e 20 61  6e 20 41 70 70 6c 65 20  |ick on an Apple |
00000790  5d 5b 2e 20 56 69 72 74  75 20 62 75 66 66 65 72  |][. Virtu buffer|
000007a0  73 20 73 75 63 68 20 61  63 63 65 73 73 65 73 20  |s such accesses |
000007b0  61 6e 64 20 74 68 65 20  56 56 6f 69 63 65 20 6d  |and the VVoice m|
000007c0  6f 64 75 6c 65 20 75 73  65 73 0a 74 68 69 73 20  |odule uses.this |
000007d0  69 6e 66 6f 72 6d 61 74  69 6f 6e 20 74 6f 20 67  |information to g|
000007e0  65 6e 65 72 61 74 65 20  73 71 75 61 72 65 2d 77  |enerate square-w|
000007f0  61 76 65 20 70 75 6c 73  65 73 20 28 73 63 61 6c  |ave pulses (scal|
00000800  65 64 20 62 79 20 76 6f  6c 75 6d 65 29 20 66 6f  |ed by volume) fo|
00000810  72 20 74 68 65 20 73 6f  75 6e 64 0a 73 79 73 74  |r the sound.syst|
00000820  65 6d 2e 20 49 6e 74 65  6e 73 65 20 73 70 65 61  |em. Intense spea|
00000830  6b 65 72 20 61 63 74 69  76 69 74 79 20 61 74 20  |ker activity at |
00000840  61 63 63 65 73 73 20 70  65 72 69 6f 64 73 20 6f  |access periods o|
00000850  66 20 61 72 6f 75 6e 64  20 34 38 20 6d 69 63 72  |f around 48 micr|
00000860  6f 73 65 63 6f 6e 64 73  20 6f 72 20 6c 65 73 73  |oseconds or less|
00000870  0a 77 6f 75 6c 64 20 27  62 6f 67 20 64 6f 77 6e  |.would 'bog down|
00000880  27 20 74 68 65 20 73 6f  75 6e 64 20 65 6d 75 6c  |' the sound emul|
00000890  61 74 69 6f 6e 2c 20 73  69 6e 63 65 20 74 68 69  |ation, since thi|
000008a0  73 20 69 73 20 74 68 65  20 6f 75 74 70 75 74 20  |s is the output |
000008b0  73 61 6d 70 6c 65 20 70  65 72 69 6f 64 20 66 6f  |sample period fo|
000008c0  72 0a 74 68 65 20 73 69  6e 67 6c 65 20 73 6f 75  |r.the single sou|
000008d0  6e 64 20 63 68 61 6e 6e  65 6c 20 75 73 65 64 2e  |nd channel used.|
000008e0  20 54 6f 20 70 72 65 76  65 6e 74 20 74 68 69 73  | To prevent this|
000008f0  2c 20 61 63 63 65 73 73  65 73 20 61 72 65 20 69  |, accesses are i|
00000900  67 6e 6f 72 65 64 20 69  66 20 74 68 65 79 20 6f  |gnored if they o|
00000910  63 63 75 72 0a 61 74 20  69 6e 74 65 72 76 61 6c  |ccur.at interval|
00000920  73 20 6f 66 20 61 72 6f  75 6e 64 20 34 38 20 6d  |s of around 48 m|
00000930  69 63 72 6f 73 65 63 6f  6e 64 73 20 6f 72 20 6c  |icroseconds or l|
00000940  65 73 73 2e 20 41 6c 74  68 6f 75 67 68 20 61 20  |ess. Although a |
00000950  73 6d 61 6c 6c 65 72 20  6f 75 74 70 75 74 20 70  |smaller output p|
00000960  65 72 69 6f 64 0a 77 6f  75 6c 64 20 69 6d 70 72  |eriod.would impr|
00000970  6f 76 65 20 73 6f 75 6e  64 20 72 65 73 6f 6c 75  |ove sound resolu|
00000980  74 69 6f 6e 2c 20 69 74  20 73 69 67 6e 69 66 69  |tion, it signifi|
00000990  63 61 6e 74 6c 79 20 69  6e 63 72 65 61 73 65 73  |cantly increases|
000009a0  20 6f 76 65 72 68 65 61  64 73 3b 20 34 38 75 73  | overheads; 48us|
000009b0  20 69 73 20 61 0a 63 6f  6d 70 72 6f 6d 69 73 65  | is a.compromise|
000009c0  20 74 68 61 74 20 67 69  76 65 73 20 61 20 66 75  | that gives a fu|
000009d0  6c 6c 65 72 20 73 6f 75  6e 64 20 66 6f 72 20 74  |ller sound for t|
000009e0  68 65 20 61 76 65 72 61  67 65 20 63 61 73 65 2e  |he average case.|
000009f0  0a 0a 44 69 73 6b 20 5d  5b 20 44 72 69 76 65 20  |..Disk ][ Drive |
00000a00  45 6d 75 6c 61 74 69 6f  6e 0a 7e 7e 7e 7e 7e 7e  |Emulation.~~~~~~|
00000a10  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |~~~~~~~~~~~~~~~~|
00000a20  7e 0a 20 20 20 20 56 69  72 74 75 20 63 75 72 72  |~.    Virtu curr|
00000a30  65 6e 74 6c 79 20 73 75  70 70 6f 72 74 73 20 6f  |ently supports o|
00000a40  6e 6c 79 20 6f 6e 65 20  74 79 70 65 20 6f 66 20  |nly one type of |
00000a50  41 70 70 6c 65 20 5d 5b  20 64 69 73 6b 20 69 6d  |Apple ][ disk im|
00000a60  61 67 65 2c 20 74 68 65  20 44 53 4b 20 28 66 72  |age, the DSK (fr|
00000a70  6f 6d 20 74 68 65 0a 4d  53 44 4f 53 20 22 2e 64  |om the.MSDOS ".d|
00000a80  73 6b 22 20 73 75 66 66  69 78 29 2c 20 6f 72 20  |sk" suffix), or |
00000a90  44 4f 53 20 6f 72 64 65  72 20 28 44 4f 29 20 64  |DOS order (DO) d|
00000aa0  69 73 6b 2e 20 54 68 69  73 20 69 6d 61 67 65 20  |isk. This image |
00000ab0  66 6f 72 6d 61 74 20 68  61 73 20 6e 6f 20 68 65  |format has no he|
00000ac0  61 64 65 72 0a 69 6e 66  6f 72 6d 61 74 69 6f 6e  |ader.information|
00000ad0  20 62 75 74 20 69 73 20  73 69 6d 70 6c 79 20 74  | but is simply t|
00000ae0  68 65 20 73 65 63 74 6f  72 20 64 61 74 61 20 69  |he sector data i|
00000af0  74 73 65 6c 66 2c 20 6f  72 64 65 72 65 64 20 62  |tself, ordered b|
00000b00  79 20 44 4f 53 20 73 65  63 74 6f 72 20 6e 75 6d  |y DOS sector num|
00000b10  62 65 72 2e 20 54 68 75  73 0a 66 6f 72 20 74 72  |ber. Thus.for tr|
00000b20  61 63 6b 20 30 20 74 68  65 20 73 65 63 74 6f 72  |ack 0 the sector|
00000b30  73 20 30 2c 20 31 2c 20  32 20 2e 2e 2e 20 46 20  |s 0, 1, 2 ... F |
00000b40  61 72 65 20 66 6f 75 6e  64 20 61 74 20 6f 66 66  |are found at off|
00000b50  73 65 74 73 20 24 30 30  30 2c 20 24 31 30 30 2c  |sets $000, $100,|
00000b60  20 24 32 30 30 20 2e 2e  2e 20 24 46 30 30 0a 69  | $200 ... $F00.i|
00000b70  6e 20 74 68 65 20 44 53  4b 2e 20 54 68 69 73 20  |n the DSK. This |
00000b80  6f 72 64 65 72 69 6e 67  20 63 6f 6d 65 73 20 69  |ordering comes i|
00000b90  6e 20 68 61 6e 64 79 20  77 68 65 6e 20 65 64 69  |n handy when edi|
00000ba0  74 69 6e 67 20 44 4f 53  20 64 69 73 6b 73 20 77  |ting DOS disks w|
00000bb0  69 74 68 20 61 20 68 65  78 20 66 69 6c 65 0a 65  |ith a hex file.e|
00000bc0  64 69 74 6f 72 2e 20 46  6f 72 20 72 65 66 65 72  |ditor. For refer|
00000bd0  65 6e 63 65 2c 20 74 68  65 20 66 6f 6c 6c 6f 77  |ence, the follow|
00000be0  69 6e 67 20 74 61 62 6c  65 20 74 72 61 6e 73 6c  |ing table transl|
00000bf0  61 74 65 73 20 70 68 79  73 69 63 61 6c 20 28 6e  |ates physical (n|
00000c00  75 6d 62 65 72 69 6e 67  20 61 73 20 65 6e 63 6f  |umbering as enco|
00000c10  64 65 64 0a 69 6e 20 73  65 63 74 6f 72 20 61 64  |ded.in sector ad|
00000c20  64 72 65 73 73 20 66 69  65 6c 64 73 29 20 74 6f  |dress fields) to|
00000c30  20 44 4f 53 20 73 65 63  74 6f 72 73 20 61 6e 64  | DOS sectors and|
00000c40  20 76 69 63 65 20 76 65  72 73 61 2e 0a 0a 50 68  | vice versa...Ph|
00000c50  79 73 69 63 61 6c 3a 20  20 30 20 20 31 20 20 32  |ysical:  0  1  2|
00000c60  20 20 33 20 20 34 20 20  35 20 20 36 20 20 37 20  |  3  4  5  6  7 |
00000c70  20 38 20 20 39 20 20 41  20 20 42 20 20 43 20 20  | 8  9  A  B  C  |
00000c80  44 20 20 45 20 20 46 0a  44 4f 53 3a 20 20 20 20  |D  E  F.DOS:    |
00000c90  20 20 20 30 20 20 37 20  20 45 20 20 36 20 20 44  |   0  7  E  6  D|
00000ca0  20 20 35 20 20 43 20 20  34 20 20 42 20 20 33 20  |  5  C  4  B  3 |
00000cb0  20 41 20 20 32 20 20 39  20 20 31 20 20 38 20 20  | A  2  9  1  8  |
00000cc0  46 0a 0a 44 4f 53 3a 20  20 20 20 20 20 20 30 20  |F..DOS:       0 |
00000cd0  20 31 20 20 32 20 20 33  20 20 34 20 20 35 20 20  | 1  2  3  4  5  |
00000ce0  36 20 20 37 20 20 38 20  20 39 20 20 41 20 20 42  |6  7  8  9  A  B|
00000cf0  20 20 43 20 20 44 20 20  45 20 20 46 0a 50 68 79  |  C  D  E  F.Phy|
00000d00  73 69 63 61 6c 3a 20 20  30 20 20 44 20 20 42 20  |sical:  0  D  B |
00000d10  20 39 20 20 37 20 20 35  20 20 33 20 20 31 20 20  | 9  7  5  3  1  |
00000d20  45 20 20 43 20 20 41 20  20 38 20 20 36 20 20 34  |E  C  A  8  6  4|
00000d30  20 20 32 20 20 46 0a 0a  20 20 20 20 54 68 65 20  |  2  F..    The |
00000d40  74 72 61 63 6b 20 66 6f  72 6d 61 74 20 65 6d 75  |track format emu|
00000d50  6c 61 74 65 64 20 69 73  20 61 20 73 74 61 6e 64  |lated is a stand|
00000d60  61 72 64 20 44 4f 53 20  33 2e 33 20 31 36 20 73  |ard DOS 3.3 16 s|
00000d70  65 63 74 6f 72 20 74 72  61 63 6b 20 77 69 74 68  |ector track with|
00000d80  20 34 26 34 2d 0a 65 6e  63 6f 64 65 64 20 73 65  | 4&4-.encoded se|
00000d90  63 74 6f 72 20 61 64 64  72 65 73 73 69 6e 67 20  |ctor addressing |
00000da0  61 6e 64 20 36 26 32 2d  65 6e 63 6f 64 65 64 20  |and 6&2-encoded |
00000db0  73 65 63 74 6f 72 20 64  61 74 61 2e 20 41 6c 74  |sector data. Alt|
00000dc0  68 6f 75 67 68 20 65 61  63 68 20 73 65 63 74 6f  |hough each secto|
00000dd0  72 20 68 61 73 20 69 74  73 0a 6f 77 6e 20 76 6f  |r has its.own vo|
00000de0  6c 75 6d 65 20 6e 75 6d  62 65 72 20 69 6e 20 69  |lume number in i|
00000df0  74 73 20 61 64 64 72 65  73 73 20 66 69 65 6c 64  |ts address field|
00000e00  2c 20 61 6c 6c 20 73 65  63 74 6f 72 73 20 6f 6e  |, all sectors on|
00000e10  20 61 20 64 69 73 6b 20  75 73 75 61 6c 6c 79 20  | a disk usually |
00000e20  68 61 76 65 20 74 68 65  20 73 61 6d 65 0a 6f 6e  |have the same.on|
00000e30  65 3a 20 56 69 72 74 75  20 67 69 76 65 73 20 65  |e: Virtu gives e|
00000e40  61 63 68 20 73 65 63 74  6f 72 20 74 68 65 20 76  |ach sector the v|
00000e50  6f 6c 75 6d 65 20 6e 75  6d 62 65 72 20 66 6f 72  |olume number for|
00000e60  20 74 68 65 20 64 69 73  6b 20 73 69 64 65 20 69  | the disk side i|
00000e70  74 20 72 65 73 69 64 65  73 20 6f 6e 20 28 73 65  |t resides on (se|
00000e80  65 0a 74 68 65 20 56 69  72 74 75 20 22 21 48 65  |e.the Virtu "!He|
00000e90  6c 70 22 29 2e 20 44 4f  53 20 75 73 75 61 6c 6c  |lp"). DOS usuall|
00000ea0  79 20 69 67 6e 6f 72 65  73 20 76 6f 6c 75 6d 65  |y ignores volume|
00000eb0  20 6e 75 6d 62 65 72 73  2c 20 62 75 74 20 73 6f  | numbers, but so|
00000ec0  6d 65 20 73 6f 66 74 77  61 72 65 20 61 73 73 69  |me software assi|
00000ed0  67 6e 73 0a 75 6e 69 71  75 65 20 76 6f 6c 75 6d  |gns.unique volum|
00000ee0  65 20 6e 75 6d 62 65 72  73 20 74 6f 20 76 61 72  |e numbers to var|
00000ef0  69 6f 75 73 20 64 69 73  6b 73 20 69 6e 20 6f 72  |ious disks in or|
00000f00  64 65 72 20 74 6f 20 64  65 74 65 63 74 20 77 68  |der to detect wh|
00000f10  69 63 68 20 6f 6e 65 20  69 73 20 69 6e 20 74 68  |ich one is in th|
00000f20  65 20 64 72 69 76 65 2e  0a 49 6e 20 74 68 69 73  |e drive..In this|
00000f30  20 63 61 73 65 2c 20 73  65 74 20 74 68 65 20 76  | case, set the v|
00000f40  6f 6c 75 6d 65 20 6e 75  6d 62 65 72 20 66 6f 72  |olume number for|
00000f50  20 65 61 63 68 20 64 69  73 6b 20 74 6f 20 74 68  | each disk to th|
00000f60  61 74 20 66 6f 75 6e 64  20 62 79 20 63 61 74 61  |at found by cata|
00000f70  6c 6f 67 69 6e 67 20 74  68 65 0a 6f 72 69 67 69  |loging the.origi|
00000f80  6e 61 6c 20 64 69 73 6b  20 6f 72 20 75 73 69 6e  |nal disk or usin|
00000f90  67 20 61 20 73 65 63 74  6f 72 2f 6e 69 62 62 6c  |g a sector/nibbl|
00000fa0  65 20 65 64 69 74 6f 72  2e 0a 0a 20 20 20 20 44  |e editor...    D|
00000fb0  69 73 6b 20 65 6d 75 6c  61 74 69 6f 6e 20 69 73  |isk emulation is|
00000fc0  20 70 65 72 66 6f 72 6d  65 64 20 61 74 20 74 68  | performed at th|
00000fd0  65 20 6d 65 6d 6f 72 79  2d 6d 61 70 70 65 64 20  |e memory-mapped |
00000fe0  49 2f 4f 20 6c 65 76 65  6c 2c 20 6e 6f 74 20 28  |I/O level, not (|
00000ff0  61 73 20 69 6e 20 73 6f  6d 65 0a 65 6d 75 6c 61  |as in some.emula|
00001000  74 6f 72 73 29 20 62 79  20 69 6e 74 65 72 63 65  |tors) by interce|
00001010  70 74 69 6f 6e 20 6f 66  20 52 57 54 53 20 28 44  |ption of RWTS (D|
00001020  4f 53 29 20 6f 72 20 4d  4c 49 20 28 50 72 6f 44  |OS) or MLI (ProD|
00001030  4f 53 29 20 63 61 6c 6c  73 2e 20 54 68 69 73 20  |OS) calls. This |
00001040  74 65 63 68 6e 69 71 75  65 0a 70 72 6f 76 69 64  |technique.provid|
00001050  65 73 20 6d 6f 72 65 20  63 6f 6d 70 6c 65 74 65  |es more complete|
00001060  20 65 6d 75 6c 61 74 69  6f 6e 20 6f 66 20 64 69  | emulation of di|
00001070  73 6b 20 61 63 63 65 73  73 2c 20 74 68 6f 75 67  |sk access, thoug|
00001080  68 20 77 69 74 68 20 61  20 70 65 72 66 6f 72 6d  |h with a perform|
00001090  61 6e 63 65 20 70 65 6e  61 6c 74 79 2e 0a 54 72  |ance penalty..Tr|
000010a0  61 63 6b 73 20 61 72 65  20 27 6e 69 62 62 6c 69  |acks are 'nibbli|
000010b0  7a 65 64 27 20 61 74 20  72 75 6e 74 69 6d 65 20  |zed' at runtime |
000010c0  69 6e 20 61 20 6d 61 6e  6e 65 72 20 61 6e 61 6c  |in a manner anal|
000010d0  61 67 6f 75 73 20 74 6f  20 44 4f 53 27 73 20 6d  |agous to DOS's m|
000010e0  65 74 68 6f 64 20 6f 66  20 77 72 69 74 69 6e 67  |ethod of writing|
000010f0  0a 74 6f 20 64 69 73 6b  2e 20 54 68 65 20 72 65  |.to disk. The re|
00001100  73 75 6c 74 69 6e 67 20  6e 69 62 62 6c 65 20 64  |sulting nibble d|
00001110  61 74 61 20 69 73 20 61  6c 6d 6f 73 74 20 69 64  |ata is almost id|
00001120  65 6e 74 69 63 61 6c 20  74 6f 20 74 68 65 20 64  |entical to the d|
00001130  61 74 61 20 73 74 72 65  61 6d 20 66 72 6f 6d 20  |ata stream from |
00001140  61 0a 64 69 73 6b 20 5d  5b 20 64 72 69 76 65 20  |a.disk ][ drive |
00001150  61 6e 64 20 69 6e 74 65  72 66 61 63 65 20 63 61  |and interface ca|
00001160  72 64 2c 20 73 61 76 65  20 66 6f 72 20 61 20 66  |rd, save for a f|
00001170  65 77 20 63 68 61 6e 67  65 73 20 6d 61 64 65 20  |ew changes made |
00001180  74 6f 20 66 6f 6f 6c 20  74 68 65 20 64 69 73 6b  |to fool the disk|
00001190  20 75 70 2d 74 6f 2d 0a  73 70 65 65 64 20 63 68  | up-to-.speed ch|
000011a0  65 63 6b 20 69 6e 20 52  57 54 53 20 28 73 6f 6d  |eck in RWTS (som|
000011b0  65 20 65 6d 75 6c 61 74  6f 72 73 20 70 61 74 63  |e emulators patc|
000011c0  68 20 52 57 54 53 20 69  6e 73 74 65 61 64 29 2e  |h RWTS instead).|
000011d0  0a 0a 20 20 20 20 54 68  65 20 6e 69 62 62 6c 69  |..    The nibbli|
000011e0  7a 69 6e 67 20 6f 66 20  61 20 74 72 61 63 6b 20  |zing of a track |
000011f0  6f 63 63 75 72 73 20 6f  6e 6c 79 20 77 68 65 6e  |occurs only when|
00001200  20 74 68 65 20 66 69 72  73 74 20 6e 69 62 62 6c  | the first nibbl|
00001210  65 20 69 73 20 61 63 74  75 61 6c 6c 79 0a 72 65  |e is actually.re|
00001220  71 75 65 73 74 65 64 2c  20 6e 6f 74 20 64 75 72  |quested, not dur|
00001230  69 6e 67 20 64 69 73 6b  20 61 72 6d 20 6d 6f 76  |ing disk arm mov|
00001240  65 6d 65 6e 74 2e 20 4e  6f 6e 2d 69 6e 74 65 67  |ement. Non-integ|
00001250  72 61 6c 20 74 72 61 63  6b 20 70 6f 73 69 74 69  |ral track positi|
00001260  6f 6e 73 20 61 72 65 20  74 72 75 6e 63 61 74 65  |ons are truncate|
00001270  64 2c 0a 73 6f 20 74 72  61 63 6b 20 24 31 31 2e  |d,.so track $11.|
00001280  35 20 72 65 61 64 73 20  74 72 61 63 6b 20 24 31  |5 reads track $1|
00001290  31 2c 20 61 6e 64 20 74  68 65 20 6d 61 78 69 6d  |1, and the maxim|
000012a0  75 6d 20 74 72 61 63 6b  20 69 73 20 24 32 32 2e  |um track is $22.|
000012b0  20 41 20 74 72 61 63 6b  20 69 73 20 6d 61 72 6b  | A track is mark|
000012c0  65 64 20 66 6f 72 0a 66  6c 75 73 68 69 6e 67 20  |ed for.flushing |
000012d0  77 68 65 6e 20 77 72 69  74 74 65 6e 20 74 6f 2c  |when written to,|
000012e0  20 61 6e 64 20 66 6c 75  73 68 69 6e 67 20 6f 63  | and flushing oc|
000012f0  63 75 72 73 20 6f 6e 3a  0a 0a 2d 20 72 65 61 64  |curs on:..- read|
00001300  69 6e 67 2f 77 72 69 74  69 6e 67 20 61 20 6e 65  |ing/writing a ne|
00001310  77 20 74 72 61 63 6b 0a  2d 20 64 69 73 6b 20 66  |w track.- disk f|
00001320  6c 69 70 20 28 41 20 3c  2d 3e 20 42 29 0a 2d 20  |lip (A <-> B).- |
00001330  63 68 61 6e 67 69 6e 67  20 64 72 69 76 65 73 20  |changing drives |
00001340  28 31 20 3c 2d 3e 20 32  29 0a 2d 20 72 65 73 65  |(1 <-> 2).- rese|
00001350  74 20 28 61 6c 73 6f 20  73 65 74 73 20 64 72 69  |t (also sets dri|
00001360  76 65 20 31 2c 20 64 72  69 76 65 20 6d 6f 74 6f  |ve 1, drive moto|
00001370  72 20 6f 66 66 2c 20 73  74 65 70 70 65 72 20 70  |r off, stepper p|
00001380  68 61 73 65 73 20 6f 66  66 29 0a 2d 20 65 78 69  |hases off).- exi|
00001390  74 69 6e 67 20 56 69 72  74 75 0a 0a 20 20 20 20  |ting Virtu..    |
000013a0  54 68 65 20 66 6c 75 73  68 20 64 65 6e 69 62 62  |The flush denibb|
000013b0  6c 69 7a 65 73 20 74 68  65 20 63 61 63 68 65 64  |lizes the cached|
000013c0  20 74 72 61 63 6b 20 69  6d 61 67 65 20 61 73 20  | track image as |
000013d0  44 4f 53 20 64 6f 65 73  20 77 68 65 6e 20 72 65  |DOS does when re|
000013e0  61 64 69 6e 67 20 66 72  6f 6d 20 64 69 73 6b 0a  |ading from disk.|
000013f0  28 65 78 63 65 70 74 20  74 68 61 74 20 56 69 72  |(except that Vir|
00001400  74 75 20 69 67 6e 6f 72  65 73 20 73 65 63 74 6f  |tu ignores secto|
00001410  72 20 76 6f 6c 75 6d 65  20 6e 75 6d 62 65 72 73  |r volume numbers|
00001420  29 2c 20 61 6e 64 20 69  66 20 61 6c 6c 20 73 65  |), and if all se|
00001430  63 74 6f 72 73 20 61 72  65 20 65 72 72 6f 72 20  |ctors are error |
00001440  66 72 65 65 0a 77 72 69  74 65 73 20 69 74 20 62  |free.writes it b|
00001450  61 63 6b 20 74 6f 20 74  68 65 20 64 69 73 6b 20  |ack to the disk |
00001460  69 6d 61 67 65 2e 20 49  6e 69 74 69 61 6c 69 7a  |image. Initializ|
00001470  69 6e 67 20 61 20 64 69  73 6b 20 73 68 6f 75 6c  |ing a disk shoul|
00001480  64 20 77 6f 72 6b 20 66  6f 72 20 61 6c 6c 20 44  |d work for all D|
00001490  4f 53 73 20 74 68 61 74  0a 75 73 65 20 73 74 61  |OSs that.use sta|
000014a0  6e 64 61 72 64 20 73 65  63 74 6f 72 20 6d 61 72  |ndard sector mar|
000014b0  6b 73 2e 20 50 72 6f 62  6c 65 6d 73 20 6d 61 79  |ks. Problems may|
000014c0  20 6f 63 63 75 72 20 69  6e 20 74 68 65 20 75 6e  | occur in the un|
000014d0  6c 69 6b 65 6c 79 20 65  76 65 6e 74 20 6f 66 20  |likely event of |
000014e0  61 20 44 4f 53 0a 72 65  71 75 69 72 69 6e 67 20  |a DOS.requiring |
000014f0  75 6e 75 73 75 61 6c 20  74 72 61 63 6b 20 6c 65  |unusual track le|
00001500  6e 67 74 68 73 2c 20 69  6e 74 65 72 2d 73 65 63  |ngths, inter-sec|
00001510  74 6f 72 20 67 61 70 20  6c 65 6e 67 74 68 73 20  |tor gap lengths |
00001520  6f 72 20 70 68 79 73 69  63 61 6c 20 73 65 63 74  |or physical sect|
00001530  6f 72 0a 6f 72 64 65 72  69 6e 67 73 2e 20 54 68  |or.orderings. Th|
00001540  65 73 65 20 63 61 73 65  73 20 77 6f 75 6c 64 2c  |ese cases would,|
00001550  20 68 6f 77 65 76 65 72  2c 20 61 6d 6f 75 6e 74  | however, amount|
00001560  20 74 6f 20 63 6f 70 79  20 70 72 6f 74 65 63 74  | to copy protect|
00001570  69 6f 6e 20 61 6e 79 77  61 79 2e 0a 0a 56 69 64  |ion anyway...Vid|
00001580  65 6f 20 45 6d 75 6c 61  74 69 6f 6e 0a 7e 7e 7e  |eo Emulation.~~~|
00001590  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 0a 20 20 20  |~~~~~~~~~~~~.   |
000015a0  20 41 6c 6c 20 73 74 61  6e 64 61 72 64 20 41 70  | All standard Ap|
000015b0  70 6c 65 20 2f 2f 65 20  76 69 64 65 6f 20 6d 6f  |ple //e video mo|
000015c0  64 65 73 20 61 72 65 20  73 75 70 70 6f 72 74 65  |des are supporte|
000015d0  64 2c 20 69 6e 63 6c 75  64 69 6e 67 20 74 65 78  |d, including tex|
000015e0  74 2c 20 67 72 61 70 68  69 63 73 20 61 6e 64 0a  |t, graphics and.|
000015f0  6d 69 78 65 64 20 6d 6f  64 65 73 2e 20 57 68 65  |mixed modes. Whe|
00001600  6e 20 64 69 73 70 6c 61  79 69 6e 67 20 68 69 72  |n displaying hir|
00001610  65 73 20 67 72 61 70 68  69 63 73 20 69 6e 20 63  |es graphics in c|
00001620  6f 6c 6f 72 20 56 69 72  74 75 20 63 6c 6f 73 65  |olor Virtu close|
00001630  6c 79 20 65 6d 75 6c 61  74 65 73 20 74 68 65 0a  |ly emulates the.|
00001640  63 68 61 72 61 63 74 65  72 69 73 74 69 63 20 6f  |characteristic o|
00001650  64 64 2f 65 76 65 6e 20  70 69 78 65 6c 20 63 6f  |dd/even pixel co|
00001660  6c 6f 72 69 6e 67 20 77  68 69 63 68 20 65 66 66  |loring which eff|
00001670  65 63 74 69 76 65 6c 79  20 68 61 6c 76 65 73 20  |ectively halves |
00001680  74 68 65 20 68 6f 72 69  7a 6f 6e 74 61 6c 0a 73  |the horizontal.s|
00001690  63 72 65 65 6e 20 72 65  73 6f 6c 75 74 69 6f 6e  |creen resolution|
000016a0  20 66 72 6f 6d 20 32 38  30 20 28 6d 6f 6e 6f 63  | from 280 (monoc|
000016b0  68 72 6f 6d 65 29 20 70  69 78 65 6c 73 20 74 6f  |hrome) pixels to|
000016c0  20 31 34 30 20 28 63 6f  6c 6f 75 72 20 70 61 69  | 140 (colour pai|
000016d0  72 29 20 70 69 78 65 6c  73 20 61 63 72 6f 73 73  |r) pixels across|
000016e0  2e 0a 54 68 65 20 62 69  74 20 37 20 28 64 65 6c  |..The bit 7 (del|
000016f0  61 79 29 20 68 61 6c 66  20 70 69 78 65 6c 20 73  |ay) half pixel s|
00001700  68 69 66 74 20 61 6e 64  20 63 6f 6c 6f 72 20 69  |hift and color i|
00001710  6e 74 65 72 66 65 72 65  6e 63 65 20 6f 66 20 61  |nterference of a|
00001720  64 6a 61 63 65 6e 74 20  64 65 6c 61 79 65 64 20  |djacent delayed |
00001730  61 6e 64 0a 6e 6f 6e 2d  64 65 6c 61 79 65 64 20  |and.non-delayed |
00001740  70 69 78 65 6c 73 20 69  73 20 6e 6f 74 20 65 6d  |pixels is not em|
00001750  75 6c 61 74 65 64 20 64  75 65 20 74 6f 20 72 65  |ulated due to re|
00001760  73 6f 6c 75 74 69 6f 6e  20 61 6e 64 20 70 65 72  |solution and per|
00001770  66 6f 72 6d 61 6e 63 65  20 63 6f 6e 73 74 72 61  |formance constra|
00001780  69 6e 74 73 2e 0a 54 68  65 20 76 69 64 65 6f 20  |ints..The video |
00001790  6d 6f 64 65 73 20 73 75  70 70 6f 72 74 65 64 20  |modes supported |
000017a0  61 72 65 3a 0a 0a 2d 20  4c 6f 72 65 73 20 67 72  |are:..- Lores gr|
000017b0  61 70 68 69 63 73 0a 2d  20 34 30 20 63 6f 6c 75  |aphics.- 40 colu|
000017c0  6d 6e 20 54 65 78 74 0a  2d 20 38 30 20 63 6f 6c  |mn Text.- 80 col|
000017d0  75 6d 6e 20 54 65 78 74  0a 2d 20 4c 6f 72 65 73  |umn Text.- Lores|
000017e0  20 67 72 61 70 68 69 63  73 20 26 20 34 30 20 63  | graphics & 40 c|
000017f0  6f 6c 75 6d 6e 20 54 65  78 74 0a 2d 20 4c 6f 72  |olumn Text.- Lor|
00001800  65 73 20 67 72 61 70 68  69 63 73 20 26 20 38 30  |es graphics & 80|
00001810  20 63 6f 6c 75 6d 6e 20  54 65 78 74 0a 2d 20 48  | column Text.- H|
00001820  69 72 65 73 20 67 72 61  70 68 69 63 73 0a 2d 20  |ires graphics.- |
00001830  48 69 72 65 73 20 67 72  61 70 68 69 63 73 20 26  |Hires graphics &|
00001840  20 34 30 20 63 6f 6c 75  6d 6e 20 54 65 78 74 0a  | 40 column Text.|
00001850  2d 20 48 69 72 65 73 20  67 72 61 70 68 69 63 73  |- Hires graphics|
00001860  20 26 20 38 30 20 63 6f  6c 75 6d 6e 20 54 65 78  | & 80 column Tex|
00001870  74 0a 2d 20 37 4d 20 4c  6f 72 65 73 20 67 72 61  |t.- 7M Lores gra|
00001880  70 68 69 63 73 0a 2d 20  44 6f 75 62 6c 65 20 4c  |phics.- Double L|
00001890  6f 72 65 73 20 67 72 61  70 68 69 63 73 0a 2d 20  |ores graphics.- |
000018a0  37 4d 20 4c 6f 72 65 73  20 67 72 61 70 68 69 63  |7M Lores graphic|
000018b0  73 20 26 20 34 30 20 63  6f 6c 75 6d 6e 20 54 65  |s & 40 column Te|
000018c0  78 74 0a 2d 20 44 6f 75  62 6c 65 20 4c 6f 72 65  |xt.- Double Lore|
000018d0  73 20 67 72 61 70 68 69  63 73 20 26 20 38 30 20  |s graphics & 80 |
000018e0  63 6f 6c 75 6d 6e 20 54  65 78 74 0a 2d 20 4e 44  |column Text.- ND|
000018f0  20 48 69 72 65 73 20 67  72 61 70 68 69 63 73 0a  | Hires graphics.|
00001900  2d 20 44 6f 75 62 6c 65  20 48 69 72 65 73 20 67  |- Double Hires g|
00001910  72 61 70 68 69 63 73 0a  2d 20 4e 44 20 48 69 72  |raphics.- ND Hir|
00001920  65 73 20 67 72 61 70 68  69 63 73 20 26 20 34 30  |es graphics & 40|
00001930  20 63 6f 6c 75 6d 6e 20  54 65 78 74 0a 2d 20 44  | column Text.- D|
00001940  6f 75 62 6c 65 20 48 69  72 65 73 20 67 72 61 70  |ouble Hires grap|
00001950  68 69 63 73 20 26 20 38  30 20 63 6f 6c 75 6d 6e  |hics & 80 column|
00001960  20 54 65 78 74 0a 0a 20  20 20 20 37 4d 20 4c 6f  | Text..    7M Lo|
00001970  72 65 73 20 61 6e 64 20  4e 44 20 48 69 72 65 73  |res and ND Hires|
00001980  20 61 72 65 20 6c 69 74  74 6c 65 20 6b 6e 6f 77  | are little know|
00001990  6e 2c 20 61 6e 64 20 68  65 6e 63 65 20 6c 69 74  |n, and hence lit|
000019a0  74 6c 65 20 75 73 65 64  2c 20 76 69 64 65 6f 20  |tle used, video |
000019b0  6d 6f 64 65 73 20 77 68  69 63 68 0a 6f 66 66 65  |modes which.offe|
000019c0  72 20 73 74 61 6e 64 61  72 64 20 6d 6f 64 65 73  |r standard modes|
000019d0  20 77 69 74 68 20 72 65  64 75 63 65 64 20 63 6f  | with reduced co|
000019e0  6c 6f 72 20 63 61 70 61  62 69 6c 69 74 79 2e 20  |lor capability. |
000019f0  37 4d 20 4c 6f 72 65 73  20 72 65 73 75 6c 74 73  |7M Lores results|
00001a00  20 66 72 6f 6d 20 76 69  65 77 69 6e 67 0a 6e 6f  | from viewing.no|
00001a10  72 6d 61 6c 20 4c 6f 72  65 73 20 74 68 65 6e 20  |rmal Lores then |
00001a20  61 63 63 65 73 73 69 6e  67 20 24 43 30 35 45 20  |accessing $C05E |
00001a30  28 44 48 69 72 65 73 53  65 74 29 2e 20 57 68 65  |(DHiresSet). Whe|
00001a40  6e 20 38 30 20 63 6f 6c  75 6d 6e 20 6d 6f 64 65  |n 80 column mode|
00001a50  20 69 73 20 6e 6f 74 20  65 6e 61 62 6c 65 64 2c  | is not enabled,|
00001a60  0a 74 68 69 73 20 66 6f  72 63 65 73 20 6e 6f 72  |.this forces nor|
00001a70  6d 61 6c 20 48 69 72 65  73 20 67 72 61 70 68 69  |mal Hires graphi|
00001a80  63 73 20 74 69 6d 69 6e  67 20 28 37 4d 68 7a 29  |cs timing (7Mhz)|
00001a90  20 72 61 74 68 65 72 20  74 68 61 6e 20 64 6f 75  | rather than dou|
00001aa0  62 6c 65 20 48 69 72 65  73 20 74 69 6d 69 6e 67  |ble Hires timing|
00001ab0  0a 28 31 34 4d 48 7a 29  2e 20 54 68 65 20 72 65  |.(14MHz). The re|
00001ac0  64 75 63 74 6f 6e 20 69  6e 20 74 69 6d 69 6e 67  |ducton in timing|
00001ad0  20 72 65 73 6f 6c 75 74  69 6f 6e 20 6d 65 61 6e  | resolution mean|
00001ae0  73 20 6f 6e 6c 79 20 62  6c 61 63 6b 2c 20 67 72  |s only black, gr|
00001af0  65 65 6e 2c 20 70 75 72  70 6c 65 20 61 6e 64 20  |een, purple and |
00001b00  77 68 69 74 65 0a 63 6f  6c 6f 75 72 73 20 61 72  |white.colours ar|
00001b10  65 20 61 76 61 69 6c 61  62 6c 65 2e 20 4e 44 20  |e available. ND |
00001b20  28 6e 6f 20 64 65 6c 61  79 29 20 48 69 72 65 73  |(no delay) Hires|
00001b30  20 63 61 6e 20 62 65 20  73 69 6d 69 6c 61 72 6c  | can be similarl|
00001b40  79 20 61 63 74 69 76 61  74 65 64 2c 20 61 6e 64  |y activated, and|
00001b50  20 62 65 63 61 75 73 65  0a 24 43 30 35 45 20 64  | because.$C05E d|
00001b60  69 73 61 62 6c 65 73 20  74 68 65 20 63 6f 6c 6f  |isables the colo|
00001b70  75 72 20 73 69 67 6e 61  6c 20 74 69 6d 69 6e 67  |ur signal timing|
00001b80  20 64 65 6c 61 79 20 72  65 73 70 6f 6e 73 69 62  | delay responsib|
00001b90  6c 65 20 66 6f 72 20 27  68 69 67 68 20 62 69 74  |le for 'high bit|
00001ba0  20 73 65 74 27 20 63 6f  6c 6f 75 72 73 0a 28 6f  | set' colours.(o|
00001bb0  72 61 6e 67 65 20 61 6e  64 20 62 6c 75 65 29 20  |range and blue) |
00001bc0  77 68 65 6e 20 6e 6f 74  20 69 6e 20 38 30 20 63  |when not in 80 c|
00001bd0  6f 6c 75 6d 6e 20 6d 6f  64 65 2c 20 74 68 65 20  |olumn mode, the |
00001be0  63 6f 6c 6f 75 72 73 20  61 76 61 69 6c 61 62 6c  |colours availabl|
00001bf0  65 20 61 72 65 20 61 6c  73 6f 20 6f 6e 6c 79 0a  |e are also only.|
00001c00  74 68 6f 73 65 20 69 6e  20 37 4d 20 4c 6f 72 65  |those in 7M Lore|
00001c10  73 2e 20 49 74 20 73 65  65 6d 73 20 74 68 61 74  |s. It seems that|
00001c20  20 74 68 65 20 6f 6e 6c  79 20 75 73 65 20 66 6f  | the only use fo|
00001c30  72 20 74 68 65 73 65 20  6d 6f 64 65 73 20 77 6f  |r these modes wo|
00001c40  75 6c 64 20 62 65 20 74  6f 20 66 6c 61 73 68 20  |uld be to flash |
00001c50  6f 6e 0a 61 6e 64 20 6f  66 66 20 74 68 6f 73 65  |on.and off those|
00001c60  20 63 6f 6c 6f 75 72 73  20 61 66 66 65 63 74 65  | colours affecte|
00001c70  64 20 66 6f 72 20 70 72  69 6d 69 74 69 76 65 20  |d for primitive |
00001c80  73 70 65 63 69 61 6c 20  65 66 66 65 63 74 73 2e  |special effects.|
00001c90  0a 0a 4a 6f 79 73 74 69  63 6b 20 45 6d 75 6c 61  |..Joystick Emula|
00001ca0  74 69 6f 6e 0a 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |tion.~~~~~~~~~~~|
00001cb0  7e 7e 7e 7e 7e 7e 7e 0a  20 20 20 20 41 20 6d 65  |~~~~~~~.    A me|
00001cc0  6d 6f 72 79 20 61 63 63  65 73 73 20 69 6e 20 74  |mory access in t|
00001cd0  68 65 20 72 61 6e 67 65  20 24 43 30 37 30 20 74  |he range $C070 t|
00001ce0  6f 20 24 43 30 37 46 20  73 74 61 72 74 73 20 74  |o $C07F starts t|
00001cf0  69 6d 65 72 73 20 77 68  6f 73 65 20 70 75 6c 73  |imers whose puls|
00001d00  65 20 77 69 64 74 68 73  20 61 72 65 0a 76 61 72  |e widths are.var|
00001d10  69 61 62 6c 65 20 66 72  6f 6d 20 32 20 74 6f 20  |iable from 2 to |
00001d20  33 33 30 30 20 6d 69 63  72 6f 73 65 63 6f 6e 64  |3300 microsecond|
00001d30  73 20 64 65 70 65 6e 64  69 6e 67 20 6f 6e 20 74  |s depending on t|
00001d40  68 65 20 72 65 73 69 73  74 61 6e 63 65 73 20 6f  |he resistances o|
00001d50  66 20 74 68 65 20 61 74  74 61 63 68 65 64 0a 6a  |f the attached.j|
00001d60  6f 79 73 74 69 63 6b 2f  70 61 64 64 6c 65 73 2e  |oystick/paddles.|
00001d70  20 54 68 65 20 68 69 67  68 20 62 69 74 20 6f 66  | The high bit of|
00001d80  20 61 20 70 61 64 64 6c  65 20 61 64 64 72 65 73  | a paddle addres|
00001d90  73 20 67 6f 65 73 20 6c  6f 77 20 77 68 65 6e 20  |s goes low when |
00001da0  74 68 65 20 74 69 6d 65  72 20 65 78 70 69 72 65  |the timer expire|
00001db0  73 2c 0a 61 6e 64 20 6d  6f 73 74 20 70 61 64 64  |s,.and most padd|
00001dc0  6c 65 20 72 6f 75 74 69  6e 65 73 20 63 6f 75 6e  |le routines coun|
00001dd0  74 20 31 31 20 63 79 63  6c 65 20 6c 6f 6f 70 73  |t 11 cycle loops|
00001de0  20 77 61 69 74 69 6e 67  20 66 6f 72 20 74 68 69  | waiting for thi|
00001df0  73 20 63 68 61 6e 67 65  2e 20 53 6f 6d 65 20 73  |s change. Some s|
00001e00  6f 66 74 77 61 72 65 0a  6d 61 79 20 75 73 65 20  |oftware.may use |
00001e10  6c 6f 6e 67 65 72 20 6c  6f 6f 70 73 20 74 6f 20  |longer loops to |
00001e20  63 68 65 63 6b 20 6d 75  6c 74 69 70 6c 65 20 70  |check multiple p|
00001e30  61 64 64 6c 65 73 2c 20  61 6e 64 20 68 65 6e 63  |addles, and henc|
00001e40  65 20 74 68 65 20 6e 75  6d 62 65 72 20 6f 66 20  |e the number of |
00001e50  61 63 63 65 73 73 65 73  20 69 73 0a 6e 6f 74 20  |accesses is.not |
00001e60  61 20 72 65 6c 69 61 62  6c 65 20 77 61 79 20 74  |a reliable way t|
00001e70  6f 20 65 6d 75 6c 61 74  65 20 74 68 65 73 65 20  |o emulate these |
00001e80  74 69 6d 65 72 73 2e 20  56 69 72 74 75 20 6b 65  |timers. Virtu ke|
00001e90  65 70 73 20 74 68 65 20  73 69 67 6e 61 6c 20 68  |eps the signal h|
00001ea0  69 67 68 20 66 6f 72 20  61 20 63 79 63 6c 65 0a  |igh for a cycle.|
00001eb0  63 6f 75 6e 74 20 65 71  75 61 6c 6c 69 6e 67 20  |count equalling |
00001ec0  31 31 20 74 69 6d 65 73  20 74 68 65 20 70 61 64  |11 times the pad|
00001ed0  64 6c 65 20 76 61 6c 75  65 20 28 30 20 74 6f 20  |dle value (0 to |
00001ee0  32 35 35 29 2e 0a 0a 50  72 69 6e 74 65 72 20 45  |255)...Printer E|
00001ef0  6d 75 6c 61 74 69 6f 6e  0a 7e 7e 7e 7e 7e 7e 7e  |mulation.~~~~~~~|
00001f00  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 0a 20 20 20 20 4f  |~~~~~~~~~~.    O|
00001f10  6e 6c 79 20 73 69 6d 70  6c 65 20 74 65 78 74 20  |nly simple text |
00001f20  70 72 69 6e 74 65 72 20  6f 75 74 70 75 74 20 69  |printer output i|
00001f30  73 20 73 75 70 70 6f 72  74 65 64 2e 20 4d 65 6d  |s supported. Mem|
00001f40  6f 72 79 20 77 72 69 74  65 73 20 69 6e 20 74 68  |ory writes in th|
00001f50  65 20 72 61 6e 67 65 20  24 43 30 39 30 0a 74 6f  |e range $C090.to|
00001f60  20 24 43 30 39 46 20 61  72 65 20 6f 75 74 70 75  | $C09F are outpu|
00001f70  74 20 74 6f 20 74 68 65  20 70 72 69 6e 74 65 72  |t to the printer|
00001f80  20 6f 75 74 70 75 74 20  66 69 6c 65 20 61 66 74  | output file aft|
00001f90  65 72 20 62 65 69 6e 67  20 41 4e 44 65 64 20 77  |er being ANDed w|
00001fa0  69 74 68 20 23 24 37 46  20 74 6f 20 73 74 72 69  |ith #$7F to stri|
00001fb0  70 0a 74 68 65 20 68 69  67 68 20 62 69 74 2e 20  |p.the high bit. |
00001fc0  46 6f 72 6d 61 74 74 69  6e 67 20 63 6f 6e 74 72  |Formatting contr|
00001fd0  6f 6c 20 63 68 61 72 61  63 74 65 72 73 20 61 72  |ol characters ar|
00001fe0  65 20 6e 6f 74 20 66 69  6c 74 65 72 65 64 20 6f  |e not filtered o|
00001ff0  75 74 2e 0a                                       |ut..|
00001ff4