1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
|
**************************************************************************
* Apple II+ Emulator version 0.04 for Linux *
* *
* Original Author: Alexander Jean-Claude Bottema *
* Email : d91a1bo@meryl.csd.uu.se *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
* *
* Modified: Dec 8 1995 by Stephen Lee <sl14@cornell.edu> *
* Modified: Jan 97 by Aaron Culliney <aculline@bbn.com> *
* <chernabog@baldmountain.bbn.com> *
* Modified: Jun 97 by Aaron Culliney <aculline@bbn.com> *
* <chernabog@baldmountain.bbn.com> *
**************************************************************************
Contents
========
0. Installation issues (briefly)
1. Why did I make an Apple II+ Emulator when there are so many available?
2. System Files
3. Keyboard & keys
4. Diskette database
5. Future plans
6. Status of the current emulator
7. Can you port this to DOS?
8. Availability
9. Known problems
10. Changes since the last
11. Final words
0. Installation issues (briefly)
================================
Requirements: SVGA lib version 1.2.9 (or later, see 9.) Tested under 1.2.10.
Kernel 1.0 (or later). Tested under 2.0.28.
libc 4.4.4 (or later). Tested under 5.2.18.
joystick 0.8.0 (or later) for PC Joystick support.
flex 2.5.2 (optional for recompiling lex files)
1) Unpack this distribution in a temporary directory. Or if you
prefer, in some common directory like /usr/local (where I put mine).
2) If you don't want apple2 debugger support or you don't want PC
Joystick support, edit the .config file in the src directory to
reflect this. You may also need to directly edit the Makefile
for the appropriate VGA include/library path.
3) As root, type "make" to make the program. Type "make install" to
install the apple2 program in $(BINDIR) and the man page in $(MANDIR),
(both configurable in .config). The program is installed with the
suid bit set because svgalib requires the program to be suid root (for
now).
4) Copy the .apple2 configuration file to your home directory, and
read section 2 for further information on how to configure this file.
You can configure some of the settings from within the emulator, (F10
for the menu screen), but you need the system path correctly set to
point to the rom files before you start the emulator. The emulator
won't run without the rom files (see section 2).
6) After you're done configuring, type "apple2" to run the
emulator. F1 selects disk drive #1, F2 selects disk drive #2, F10
further sets/configures runtime parameters.
1. Why did I make an Apple II+ Emulator when there are so many available?
=========================================================================
For three reasons. The first is that there are no Apple II emulators
especially written for Linux; hence they do not take advantages that
are commonly provided in Linux systems, e.g. the SVGA library
distribution. However, there is an Apple II emulator for X-Windows
that easily can be compiled on most UN*X architectures, but the major
disadvantage is slow emulation. You cannot obtain a fast emulator by
writing it in C, despite the elegant optimizations provided by GNU-C,
but of course it becomes more portable if you do that.
By contrast, this Apple II emulator is partly written in 386 (AT&T)
assembler; partly in C. Only those issues that were not time critical
were written in C. Especially the CPU emulation was written in
optimized assembler to achieve optimum performance. The emulator
approximately runs twice as fast as an ordinary Apple II+ computer if
it is running on a 486 DX-50.
The second reason is that there is no Apple II emulator which is 100%
usable. Either it is too slow or it is simply too fast (= there is no
option to trim the speed of the emulator). Furthermore, many
implementors happily avoid implementing mixed text/graphics in high
resolution mode; mostly because it complicates the programming. I have
never seen an Apple II+ emulator that is entirely complete. I think
most emulators fail on implementing the undocumented 6502 instructions
(those that are listed as ???), hence some games (or applications) may
not work despite they should.
The third reason is that no emulator support an easy way to switch
diskettes given a database of diskettes. With this emulator you can
easily switch diskettes through an intuitive interface. You can also
add additional information for each diskette (in your database), e.g.
which keys to use for a particular game program. The information is
kept in a plain text file that can be edited with an ordinary text
editor, preferbly GNU-Emacs.
2. System files
===============
Before you can run the emulator, three vital system files must be
available. These are:
apple_II.rom (12k) This file contains the ROM of your Apple II+.
It is not distributed due to copyright issues.
You have to get this file on your own. If you
have been running another emulator, you can
probably use its ROM files directly. Technically
speaking, this file is a memory dump of the
consecutive addresses from D000 to FFFF. This
file may also be called by other names such as
apple.rom or apple2.rom, but is referenced
internally as apple_II.rom.
slot6.rom (256 bytes) Memory dump of the consecutive addresses from
C600 to C6FF. This file is not distributed
either due to the same reasons as above. This
file may also be called by other names such as
controller.rom, but is referenced internally
as slot6.rom.
character.rom This file is distributed.
Other important files
---------------------
.apple2 This file is distributed. The file contains default
parameter settings. The most important parameter is
the setting of the system path, i.e. the directory
where the three vital system (ROM) files are
stored. Most of the other parameters can be
changed during run time via the interface
(activated by pressing F10).
Parameters (that can be set in .apple2):
speed = <percentage>% Speed of the emulator
path = <directory> Diskette database directory
color = off Monochrome mode
on Plain color mode
interpolated Interpolated color mode
sound = off Silent mode
pc speaker Sound through PC speaker
joystick = off Joystick disabled
linear Linear joystick mode
pc joystick PC Joystick (see CHANGES)
digital (Atari) digital joystick mode
not yet supported
joystick range 1-256 range of joystick
origin_x = 0-255 Origin of the joystick (X)
origin_y = 0-255 Origin of the joystick (Y)
sensitivity <percentage>% Joystick sensitivity
system_path = <directory> Directory where the system
ROM files are stored.
pc joystick parms You don't want to fool
around with these, you
generate these parms from
F10 screen "Calibrate" menu
item.
dsk.info An example is distributed. This file contains
information for various diskettes kept in the database.
Syntax:
{<Name of diskette>} i.e. the name is written
within curly braces.
<Any information...>
{<Name of another diskette>} ... etc.
3. Keyboard & keys
==================
F1 To switch diskettes in Drive A, Slot 6
F2 To switch diskettes in Drive B, Slot 6
F4 Pause
F5 Keyboard layout
F8 Words from the author
F9 Toggle between maximum speed and configured speed.
F10 General parameter settings
Print Screen/SysRq Apple II Reset key
Pause/Break Reboot Apple II emulator
The numeric keypad is used for joystick emulation.
Delete Joystick button 0
End Joystick button 1
Page Down Joystick button 2
F7 Debugger - (if it's compiled into the source).
Edit the Makefile if you don't want the
debugger. The emulator will run slightly
faster without the debugger.
4. Diskette database
====================
The diskettes are provided as plain binary files. These are actually
raw dumps, containing the tracks from 0 to 34. For the standard
143360 byte .dsk format each track is partitioned into sectors
numbered from 0 to 15. Each sector is 256 bytes. Hence, the data is
organized as the following:
File offset (in bytes) Sector Track
---------------------- ------ -----
0 0 0
256 1 0
512 2 0
. . .
. . .
. . .
3840 15 0
4096 0 1
4352 1 1
. . .
. . .
. . .
143104 15 34
To transfer Apple II diskettes into this format requires that you own
an original Apple II. Since the drives provided by the IBM PC's are
not compatible with the original Apple II drives there are no
conversion programs directly available. If you have used other Apple
II emulators it is most likely that the files will work with this
emulator too. It seems to be a common standard to structure the
diskettes in the above described way, e.g. the ApplePC and Apl2em
emulators for DOS uses the same structure.
Emulated diskettes MUST have the .dsk or .nib extension (143360 bytes
or 232960 bytes respectively), otherwise the emulator will not
recognize the file as a valid diskette. However, it is valid to
compress them by using gnu-zip (then the extension becomes .dsk.gz or
.nib.gz). The emulator will automatically decompress/compress them
whenever required (note that it assumes /bin/gzip exists).
Note that you can add information/documentation for the dsk-diskettes
by using an ordinary text editor and edit the file "dsk.info". The
name of the diskette is written in curly braces (without the .dsk
extension) followed by any information.
5. Future plans
===============
I intend to improve the emulator. Actually, for the next major release
(i.e. version 1.00) the emulator will be entirely rewritten. For minor
changes, see file CHANGES.
[Note from Stephen Lee: since this hasn't happened yet, I took to
improving the existing emulator until Alexander release a new one.]
[Note from Aaron Culliney: since this still hasn't happened, I also
took the liberty to fix a few things and add some functionality.]
[v004 note: decided to add in some more features, and fix problems as
they've arisen.]
6. Status of the current emulator
=================================
Works in standard VGA Y
Works in SVGA (then using SVGA facilities) Y
Disk drive emulation (slot 6) (.dsk & .nib) Y
Disk drive emulation (slot 5) N (release 1.00)
High resolution emulation Y
Low resolution emulation Y
Mixed mode (in all resolution modes) Y
Correct color emulation (both Low and Hi-res) Y
Interpolated color emulation Y
Configurable speed Y
Diskette switching Y
Diskette database Y
Interface for parameter settings, etc. Y
Sound emulation (PC speaker) Y
Flashing text Y
Joystick emulation through numeric keypad Y
Virtual console switching Y (only when emu. is paused)
Raw keyboard mode (reading scancodes) Y
Undocumented 6502 instructions Y
Language card (i.e. additonal 16k RAM) Y
Serial card N (maybe release 1.00)
Works on DOS N (AND NEVER WILL)
Apple II Debugger Y
PC Joystick kernel module support Y
7. Can you port this to DOS?
============================
No, for two reasons. The first, and probably the most important, is
that the current emulator use kernel specific issues that are not, and
never will be, available in DOS. Future emulators will be based on the
same principles, so the emulator will never run in DOS. The second
reason is that DOS is a bad operating system. It is a pain in the neck
to write and debug programs in DOS and there is no usable memory
management provided by the kernel (if the DOS "interrupts" can be
called a "kernel" at all).
With this free software I hope that more users will switch to Linux
(which is a great operating system) and I have a dream that one day,
DOS will become a minority.
8. Availability
===============
This distribution is available at ftp.apple.asimov.net, and
tsx-11.mit.edu, and sites mirroring these.
9. Known problems
=================
Problem: SVGAlib version 1.2.8 and below has a bug in
keyboard-handling that makes the '-' key (in the emulator)
unusable.
Solution: Please use SVGAlib version 1.2.9 or above.
Problem: The REPT (repeat) key repeats too fast.
Answer: The current implementation is a kludge by me [Stephen]. I
might fix it later, but again, I might not.
Problem: I can't switch virtual consoles while running the program
under gdb [Aaron].
Answer: Actually you do, it's just that the graphic mode stays valid.
If you have the svgalib utility "textmode", try a "shell
textmode" reset. I haven't played around enough to figure out
how/if you can get back to graphic mode after this.
Problem: Compiling with optimization causes the debugger to choke
[Aaron].
Answer: I'm playing fast and loose with the debugger's assembly hooks.
I think it's something to do with -fomit-frame-pointer. And
since I don't see much speed gain, I'm ignoring the problem
for now.
10. Changes
===========
see file CHANGES
11. Final words
===============
Note that albeit you can switch between digital and linear joystick
emulation, only linear mode is presently supported. I still haven't
figured out how the atari (digital) joystick emulation works, so I'll
save it to the next release (as I said in the previous release :-) )
[PC Joystick mode is just another linear mode. In general linear mode
seems to work fine for most games. If a game seems to be having
trouble with it, change the range from $100 (256) to $80 (128) with
center points at $80 and $40 respectively. Switching around ranges
often seems to do the trick for most games, but I bet I'm not handling
the joystick softswich values correctly. documentation on this is
scant. -Aaron]
I hope you will enjoy this emulator. I do. Many games (that I have
ported) works perfectly, even those that use undocumented 6502
instructions. Suggestions to improvements are welcome. My email
address will be valid at least one more year, i.e. as long as I am a
computer science student at the University of Uppsala in Sweden.
/ Alexander Jean-Claude Bottema (Email: d91a1bo@meryl.csd.uu.se)
Oct. 9 1994 15:44:21
|