summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorG. Branden Robinson <g.branden.robinson@gmail.com>2017-03-30 06:20:32 -0700
committerG. Branden Robinson <g.branden.robinson@gmail.com>2017-03-30 06:20:32 -0700
commit108a3cd52ec61f4919d281e93d11a3181c063bee (patch)
treed4d329b298447ac96d407a8daf32fa7ffc9b532d
parent19b0c5e0755e213172625e814ef089398abd7de1 (diff)
xtrs (4.9c-4) unstable; urgency=mediumHEADdebian/4.9c-4archive/debian/4.9c-4master
* Makefile: Undefine HAVE_SIGIO. (Closes: #511645) * Update Maintainer full name and email address from the "old me" to the "new me". [dgit import package xtrs 4.9c-4]
-rw-r--r--Makefile2
-rw-r--r--Makefile.local2
-rw-r--r--cassette.man7
-rw-r--r--cassette.txt107
-rw-r--r--cpmutil.html21
-rw-r--r--debian/README.Debian74
-rw-r--r--debian/README.contrib-only28
-rw-r--r--debian/changelog635
-rw-r--r--debian/checklist14
-rw-r--r--debian/compat1
-rw-r--r--debian/config15
-rw-r--r--debian/control30
-rw-r--r--debian/copyright46
-rw-r--r--debian/dirs7
-rw-r--r--debian/menu5
-rw-r--r--debian/patches247
-rw-r--r--debian/po/POTFILES.in1
-rw-r--r--debian/po/cs.po66
-rw-r--r--debian/po/da.po66
-rw-r--r--debian/po/de.po64
-rw-r--r--debian/po/es.po63
-rw-r--r--debian/po/fr.po70
-rw-r--r--debian/po/gl.po50
-rw-r--r--debian/po/it.po50
-rw-r--r--debian/po/ja.po66
-rw-r--r--debian/po/pt.po69
-rw-r--r--debian/po/pt_BR.po66
-rw-r--r--debian/po/ru.po63
-rw-r--r--debian/po/sv.po67
-rw-r--r--debian/po/templates.pot42
-rw-r--r--debian/po/vi.po50
-rw-r--r--debian/postinst23
-rwxr-xr-xdebian/rules102
-rw-r--r--debian/templates12
-rw-r--r--debian/trs80faq.html2261
-rw-r--r--debug.c90
-rw-r--r--trs_disk.c20
-rw-r--r--trs_imp_exp.c446
-rw-r--r--trs_keyboard.c10
-rw-r--r--trs_memory.c2
-rw-r--r--trs_printer.c2
-rw-r--r--trs_xinterface.c130
-rw-r--r--xtrs.man3
-rw-r--r--xtrs.txt561
-rw-r--r--z80.c1928
-rw-r--r--z80.h104
46 files changed, 6126 insertions, 1662 deletions
diff --git a/Makefile b/Makefile
index 94d8ab2..8d27a70 100644
--- a/Makefile
+++ b/Makefile
@@ -143,7 +143,7 @@ z80code: $(Z80CODE)
include Makefile.local
CFLAGS = $(DEBUG) $(ENDIAN) $(DEFAULT_ROM) $(READLINE) $(DISKDIR) $(IFLAGS) \
- $(APPDEFAULTS) -DKBWAIT -DHAVE_SIGIO
+ $(APPDEFAULTS) -DKBWAIT
LIBS = $(XLIB) $(READLINELIBS) $(EXTRALIBS)
ZMACFLAGS = -h
diff --git a/Makefile.local b/Makefile.local
index 091457f..3575d99 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -50,7 +50,7 @@ DISKDIR = -DDISKDIR='"."'
# these lines. As of xtrs 2.7, it is now OK to use this feature again.
READLINE = -DREADLINE
-READLINELIBS = -lreadline -lncurses
+READLINELIBS = -lreadline
# If you want to debug the emulator, use the -g flag instead:
diff --git a/cassette.man b/cassette.man
index f226f2e..c9d13fa 100644
--- a/cassette.man
+++ b/cassette.man
@@ -15,13 +15,6 @@ works very much like an actual tape recorder.
This manual page also describes the image formats that the emulator
supports and their limitations.
-In this release, two cassette programs are supplied. The original
-\fBcassette\fP is a C-shell script; it should work with most versions
-of /bin/csh. If you do not have /bin/csh installed, you can use
-\fBcassette.sh\fP, which is a Bourne shell script. It requires a
-modern version of the Bourne shell that supports user-defined functions,
-so it may not work on older Unix systems.
-
.SH Commands
.B pos
generates a status message including the filename being used as the
diff --git a/cassette.txt b/cassette.txt
index ccab8bf..fa7e72b 100644
--- a/cassette.txt
+++ b/cassette.txt
@@ -1,18 +1,16 @@
-cassette(1) cassette(1)
+cassette(1) General Commands Manual cassette(1)
-
-
-Name
+Name
cassette - data cassette image manipulator for xtrs TRS-80 emulator
-Syntax
- cassette
+Syntax
+ cassette
-Description
- To control the emulated cassette used by xtrs, a file called ".cas-
+Description
+ To control the emulated cassette used by xtrs, a file called ".cas-
sette.ctl" in the current directory keeps track of what file is cur-
rently "loaded" as the cassette tape and the current position within
- that file. The cassette shell script provides a way to manipulate this
+ that file. The cassette shell script provides a way to manipulate this
file; typing "help" at its prompt shows its commands. You may use this
script to load and position cassette tape files. The operation works
very much like an actual tape recorder.
@@ -20,90 +18,82 @@ cassette(1) cassette(1)
This manual page also describes the image formats that the emulator
supports and their limitations.
- In this release, two cassette programs are supplied. The original cas-
- sette is a C-shell script; it should work with most versions of
- /bin/csh. If you do not have /bin/csh installed, you can use cas-
- sette.sh, which is a Bourne shell script. It requires a modern version
- of the Bourne shell that supports user-defined functions, so it may not
- work on older Unix systems.
-
-
-Commands
- pos generates a status message including the filename being used as the
+Commands
+ pos generates a status message including the filename being used as the
cassette image and the current position within the image, in bytes.
- load [filename] changes the cassette image currently being used to the
+ load [filename] changes the cassette image currently being used to the
file specified, and resets the position counter to zero.
- type typename tells the emulator what type of image is loaded. Usually
- this is detected from the file extension, but you can override the
- detected value with this command. The supported types are listed in
+ type typename tells the emulator what type of image is loaded. Usually
+ this is detected from the file extension, but you can override the
+ detected value with this command. The supported types are listed in
the next section.
- rew [position] changes the position counter to the position specified.
+ rew [position] changes the position counter to the position specified.
If no position is given, the counter is reset to zero.
- ff [position] changes the position counter to the position specified.
+ ff [position] changes the position counter to the position specified.
If no position is given, the counter is set to the end of the file.
- quit exits the cassette shell script.
+ quit exits the cassette shell script.
-Types
- xtrs supports several different types of cassette images, each of which
+Types
+ xtrs supports several different types of cassette images, each of which
represents cassette data in a different format.
- cas format is fairly compact and is compatible with other TRS-80 emula-
+ cas format is fairly compact and is compatible with other TRS-80 emula-
tors that have cassette support. This format represents the bit stream
- that (the emulator thinks) the TRS-80 cassette routines were trying to
+ that (the emulator thinks) the TRS-80 cassette routines were trying to
save to the tape, not the actual electrical signals on the tape.
- On writing, the emulator monitors the values that the TRS-80 software
- is sending to the cassette port and their timing, auto-recognizes
- whether a 250-bps, 500-bps, or 1500-bps format is being written,
- decodes the signals into a string of 0 and 1 bits, packs the bits into
+ On writing, the emulator monitors the values that the TRS-80 software
+ is sending to the cassette port and their timing, auto-recognizes
+ whether a 250-bps, 500-bps, or 1500-bps format is being written,
+ decodes the signals into a string of 0 and 1 bits, packs the bits into
bytes, and writes them to the cas file. On reading, the emulator auto-
detects whether software is trying to read at 250, 500, or 1500 bps and
- encodes the 0's and 1's back into the signals that the TRS-80 software
- is expecting. This somewhat roundabout method should work with most
- TRS-80 cassette routines that read and write signals compatible with
- the ROM cassette routines, but it may fail with custom routines that
+ encodes the 0's and 1's back into the signals that the TRS-80 software
+ is expecting. This somewhat roundabout method should work with most
+ TRS-80 cassette routines that read and write signals compatible with
+ the ROM cassette routines, but it may fail with custom routines that
are too different.
- Note that generally nothing useful will happen if you try to write a
- cas image at one speed and read it at another. There are differences
+ Note that generally nothing useful will happen if you try to write a
+ cas image at one speed and read it at another. There are differences
in the actual bit streams that standard TRS-80 software records at each
- of the three different speeds, not just differences in encoding the
- electrical signals on the tape. Thus an incoming bit stream that was
- originally recorded at one speed will not be understood when read back
- in at a different speed. For example, Level 2 Basic programs are tok-
- enized, while Level 1 Basic programs are not, and the two Basic imple-
+ of the three different speeds, not just differences in encoding the
+ electrical signals on the tape. Thus an incoming bit stream that was
+ originally recorded at one speed will not be understood when read back
+ in at a different speed. For example, Level 2 Basic programs are tok-
+ enized, while Level 1 Basic programs are not, and the two Basic imple-
mentations record different binary information at the start of the pro-
- gram and between lines. Also, when a file is saved at 1500 bps, stan-
- dard TRS-80 software puts an extra 0 bit after every 8 data bits, and
+ gram and between lines. Also, when a file is saved at 1500 bps, stan-
+ dard TRS-80 software puts an extra 0 bit after every 8 data bits, and
these extra bits are packed into the cas file along with the data bits.
- cpt format (for "cassette pulse train") encodes the exact values and
+ cpt format (for "cassette pulse train") encodes the exact values and
timing of the signals that the TRS-80 cassette routine sends to the
cassette output port to be recorded on the tape. Timing is to the
nearest microsecond. This format emulates a perfect, noise-free cas-
sette, so any cassette routines that even halfway worked on real hard-
ware should work with it.
- wav format is a standard sound file format. The wav format is interme-
+ wav format is a standard sound file format. The wav format is interme-
diate in emulation accuracy between cas and cpt. It does represent
actual signals, not decoded bits, but its timing precision is limited
by the sample rate used. The default rate for new wav files is 44,100
Hz; you can change this with the -samplerate command line option to
- xtrs.
+ xtrs.
- You can play wav files written by xtrs through your sound card and hear
+ You can play wav files written by xtrs through your sound card and hear
roughly what a real TRS-80 cassette sounds like. A real TRS-80 should
- be able to read wav files written by xtrs if you copy them to a cas-
+ be able to read wav files written by xtrs if you copy them to a cas-
sette or connect the TRS-80 directly to the sound card's output. This
feature has not been tested extensively, but it does seem to work, at
least for short programs.
- xtrs can also read wav files. It can read back the wav files that it
+ xtrs can also read wav files. It can read back the wav files that it
writes without error. Reading wav files sampled from real cassettes is
more difficult because of the noise introduced, but in brief testing it
does seem to work. The signal processing algorithms used are very
@@ -118,27 +108,24 @@ cassette(1) cassette(1)
header xtrs rejects, try using sox(1) to convert it to a more vanilla
format.
- direct format is similar to wav format, except that the samples go to
+ direct format is similar to wav format, except that the samples go to
(or come from) your sound card directly, not a wav file. Direct format
requires the Open Sound System /dev/dsp device. Extending the code to
work with other sound interfaces would probably not be hard, but is
left as an exercise for the reader. Please send me the changes if you
do this.
- debug format is the same as cpt format except that the data is written
+ debug format is the same as cpt format except that the data is written
in human-readable ASCII. The cassette output is assumed to be 0 ini-
tially. Each line of output gives a new value (0, 1, or 2), and the
amount of time (in microseconds) to wait before changing the output to
this value.
-
-Authors
- xtrs 1.0 was written by David Gingold and Alec Wolman. The current
+Authors
+ xtrs 1.0 was written by David Gingold and Alec Wolman. The current
version was revised and much extended by Timothy Mann (see http://tim-
mann.org/). An initial version of this man page, and the translation
from C-shell (cassette) to Bourne shell (cassette.sh), are due to Bran-
den Robinson.
-
-
cassette(1)
diff --git a/cpmutil.html b/cpmutil.html
index 502bf29..100dbec 100644
--- a/cpmutil.html
+++ b/cpmutil.html
@@ -7,19 +7,10 @@
<meta name="description" content="Roland Gerlachs's CP/M Utilities for xtrs">
<meta name="keywords" content="TRS-80, TRS80, CP/M, Montezuma, UNIX, xtrs"></head><body>
<!-- navigation begin -->
-<script language="JavaScript"><!--
-if (document.images) {
- home1 = new Image(19,19); home1.src = "../home.png"; home2 = new Image(19,19); home2.src = "../home-on.png";
- up1 = new Image(19,19); up1.src = "../up.png"; up2 = new Image(19,19); up2.src = "../up-on.png";
-}
-function hiLite(imgName,imgObjName) {
-if (document.images) {
- document.images[imgName].src = eval(imgObjName + ".src");
-}}
-//--></script>
<table align="right"><tbody><tr><td>
-<a href="http://members.optusnet.com.au/%7Ergerlach/trs-80/" onmouseover="hiLite('up','up2')" onmouseout="hiLite('up','up1')"><img src="cpmutil_files/up.png" alt="UP" name="up" border="0" height="19" width="19"></a>
-<a href="http://members.optusnet.com.au/%7Ergerlach/" onmouseover="hiLite('home','home2')" onmouseout="hiLite('home','home1')"><img src="cpmutil_files/home.png" alt="HOME" name="home" border="0" height="19" width="19"></a>
+<a href="http://members.optusnet.com.au/%7Ergerlach/trs-80/">Roland Gerlach's TRS-80 page</a>
+<br>
+<a href="http://members.optusnet.com.au/%7Ergerlach/">Roland Gerlach's home page</a>
</td></tr></tbody></table>
<!-- navigation end -->
@@ -216,9 +207,13 @@ you will have problems reading this disk.
</dd></dl>
+<p><strong>Note:</strong> On this Debian system, the CP/M utility disk is
+already installed in uncompressed form, and is available at <a
+href="file:///usr/lib/xtrs/cpmutil.dsk">/usr/lib/xtrs/cpmutil.dsk</a>.</p>
+
<center>
<p></p><hr>Comments and suggestions are welcome, send them to
<a href="http://members.optusnet.com.au/%7Ergerlach/contact.html">Roland Gerlach</a>.<p></p>
</center>
-</body></html> \ No newline at end of file
+</body></html>
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..f61238e
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,74 @@
+The xtrs package will not function as it ships because it requires a ROM image
+from one of the original TRS-80 Model I, III, 4, or 4P computers to operate.
+Because of licensing restrictions on the ROM images, they cannot be distributed
+with this Debian package. You will need to obtain one or more ROM images and
+install them where xtrs expects to find them for the program to work. See
+/usr/share/doc/xtrs/README.contrib-only for more information.
+
+The Model 4 emulation mode uses the Model III ROMs, so xtrs will have full
+functionality if you have one ROM each from the Model I and Model III computers.
+The Model 4P had no BASIC interpreter ROM, but instead had a boot ROM and could
+load the standard Model III ROM from a file shipped with the operating system.
+There is, on the other hand, a freely-licensed minimal 4P boot ROM provided with
+xtrs that can bootstrap a Model 4 operating system (such as LDOS). Since I am
+aware of no DFSG-free Model 4 OS that can be shipped with this package, the
+existence of this free boot ROM is insufficient, in my opinion, to permit xtrs
+to be placed in Debian's main archive.
+
+There are at least three variants of the Model I ROM around, but I know of no
+practical operational differences between them; at least none that I can
+remember after fifteen years. In any case the differences are largely cosmetic
+(minor changes to the copyright notice) and all should work.
+
+Place Model I, Model III, and Model 4P ROM image files in the following files,
+respectively:
+
+ /usr/local/lib/xtrs/level2rom.hex
+ /usr/local/lib/xtrs/romimage.m3
+ /usr/local/lib/xtrs/romimage.m4p
+
+They should be mode 644 ("chmod 644 /usr/local/lib/xtrs/*" as root).
+
+These files will not be removed or replaced during an upgrade, downgrade,
+removal, or purge of the xtrs package--you will have to delete them manually if
+you want to be rid of them.
+
+xtrs can operate with only the ROM images--it will boot to the Model I or III
+BASIC interpreter. If you wish to use some of the software designed for use
+with the Model I/III/4, you will need to provide it in the form of disk images,
+and boot to a disk operating system. See trs80faq.html in /usr/share/doc/xtrs
+for more information. It is theoretically possible to use cassette images of
+executable programs, but I know of no one who has made cassette images in this
+fashion. In practice, people simply use disk images.
+
+Please read /usr/share/doc/xtrs/trs80faq.html before attempting to work with
+disk images. The manual pages for xtrs(1) and mkdisk(1) will also be helpful.
+
+If you wish to work with cassette images, please read the manual page for the
+cassette(1) program.
+
+Finally, you may wish to observe the licensing of the ROM images and software
+you use with xtrs. If you own the original computer(s), you have a license to
+use the corresponding ROMs. Alternatively, a book was published in the 1980's
+called _Microsoft BASIC Decoded & Other Mysteries for the TRS-80_ (James
+Farvour; IJG Computer Services; ISBN 0-936200-01-4) which had the source code
+for the Model I Level II ROMs (no Level I ROM images are available, to my
+knowledge). If you own that book, you also have license to use the Model I ROM
+images.
+
+Licenses to use software for the Model I/III/4 are often restricted to original
+owners of the disks or cassettes, as applicable. However, a couple of dozen
+software packages for the Model I/III/4 published by Misosys Software are freely
+available for use, including the LDOS operating system, compilers for BASIC and
+K&R C, an editor/assembler, a disassembler, and some utilities and applications
+(including games). Please see Tim Mann's TRS-80 page for more information:
+
+ http://www.tim-mann.org/trs80.html
+
+Enjoy your retrocomputing!
+
+-- Branden Robinson
+
+$Id: README.Debian 110 2008-02-07 04:09:22Z branden $
+
+vim:set ai et ts=4 sw=4 tw=80:
diff --git a/debian/README.contrib-only b/debian/README.contrib-only
new file mode 100644
index 0000000..5b1fa80
--- /dev/null
+++ b/debian/README.contrib-only
@@ -0,0 +1,28 @@
+The xtrs package is in the "contrib" distribution of Debian because it requires
+a ROM image from one of the original TRS-80 Model I, III, 4, or 4P computers to
+operate. Because of licensing restrictions on the ROM images, they may not be
+distributed with the Debian package.
+
+There is a freely-licensed boot ROM for Model 4P emulation provided with xtrs;
+however, this boot image can only be used to boot an operating system designed
+for the Model 4 (it is not sophisticated enough to load the BASIC interpreter
+ROM for Model III compatiblity mode, provided on Model 4P TRSDOS disks as a file
+called MODELA/III). There are no known free operating systems for the TRS-80
+Model 4P, and there may never be. Since most users will likely be using this
+emulator to run proprietary legacy applications for the TRS-80 computers, I do
+not regard this exception as sufficient to recategorize xtrs for inclusion in
+main.
+
+If someone ports a free OS to the TRS-80, however, that could change. This
+isn't an implausible prospect; see the Contiki Project at
+ http://www.sics.se/contiki/
+for an example of a freely-licensed 8-bit OS that has been ported to platforms
+contemporary with the TRS-80.
+
+See /usr/doc/xtrs/README.Debian for more information on using xtrs in Debian.
+
+-- Branden Robinson
+
+$Id: README.contrib-only 110 2008-02-07 04:09:22Z branden $
+
+vim:set ai et ts=4 sw=4 tw=80:
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..8902e0d
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,635 @@
+xtrs (4.9c-4) unstable; urgency=medium
+
+ * Makefile: Undefine HAVE_SIGIO. (Closes: #511645)
+ * Update Maintainer full name and email address from the "old me" to the
+ "new me".
+
+ -- G. Branden Robinson <g.branden.robinson@gmail.com> Thu, 30 Mar 2017 09:20:32 -0400
+
+xtrs (4.9c-3.5) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Fix function declare: type of 'state' defaults to 'int'
+ [-Werror=implicit-int] (Closes: #798765)
+
+ -- YunQiang Su <syq@debian.org> Mon, 19 Oct 2015 01:22:15 +0800
+
+xtrs (4.9c-3.4) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Work around the FTBFS on sparc (due to REG_PC conflicting with
+ architecture-specific defines) by renaming all REG_* into reg_*
+ (Closes: #650815).
+
+ -- Cyril Brulebois <kibi@debian.org> Fri, 17 Feb 2012 15:43:47 +0000
+
+xtrs (4.9c-3.3) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Fix "replacing libreadline5-dev build dependency with libreadline-
+ dev" (Closes: #553884)
+ * Build using -Wno-error=unused-but-set-variable.
+ * debian/rules: use DEB_HOST_ARCH_ENDIAN to guess host endianness.
+
+ -- Hector Oron <zumbi@debian.org> Sun, 18 Sep 2011 22:31:19 +0000
+
+xtrs (4.9c-3.2) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Fix pending l10n issues. Debconf translations:
+ - Italian (Vincenzo Campanella). Closes: #575101
+
+ -- Christian Perrier <bubulle@debian.org> Tue, 25 May 2010 06:55:54 +0200
+
+xtrs (4.9c-3.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Use the correct versioned dependency on debhelper (>= 5)
+ * Drop x-dev from build dependencies
+ * Fix pending l10n issues. Debconf translations:
+ - Galician (Marce Villarino). Closes: #537431
+ - Vietnamese (Clytie Siddall). Closes: #574432
+
+ -- Christian Perrier <bubulle@debian.org> Mon, 22 Mar 2010 00:46:12 +0100
+
+xtrs (4.9c-3) unstable; urgency=low
+
+ * Update my copyright notice in debian/copyright since I wrote the help
+ window patch this year.
+ * Update architecture-detection logic to use a more modern interface to
+ dpkg-architecture and recognize armeb. Thanks, Riku Voipio!
+ (Closes: #480129)
+
+ -- Branden Robinson <branden@debian.org> Mon, 12 May 2008 02:36:30 -0400
+
+xtrs (4.9c-2) unstable; urgency=low
+
+ * When handling X Enter and Leave events, track which one we handled
+ previously, and fake a Leave event before handling an Enter if the
+ previous of these two events was also an Enter. This prevents the global
+ autorepeat from getting wrongly kept off when two Enter events are seen in
+ a row, as can happen when the unclutter X client is used.
+ * Add Portuguese debconf template translations; thanks, Américo Monteiro!
+ (Closes: #437302)
+ * Update TRS-80 FAQ to be based on Tim Mann's version 1.59 (2007-02-21).
+ * Implement an overlay window that summarizes the first few paragraphs of
+ keyboard usage information from the manpage; F11 toggles the window on and
+ off. Update the xtrs(1) manpage to mention this feature.
+ * Patch Makefile.local to not explicitly link against ncurses, which is only
+ used indirectly via GNU readline (brought to light by the new
+ symbols-aware dpkg-shlibdeps).
+ * Increment debhelper compatibility level to 5.
+ * Update README.Debian and README.contrib-only.
+ * Fix debian/rules to stop ignoring errors from "$(MAKE) clean" (he noted
+ wryly, in light of who filed #325372--though in fairness this package
+ doesn't use GNU Automake).
+ * Update Debian menu section to "Applications/Emulators" per new Debian Menu
+ Policy.
+ * Stop shipping useless empty directory /usr/lib/menu.
+ * Increment Standards-Version to 3.7.3.
+
+ -- Branden Robinson <branden@debian.org> Thu, 07 Feb 2008 00:09:13 -0500
+
+xtrs (4.9c-1) unstable; urgency=low
+
+ * Merge upstream 4.9c release.
+ + Fix the new -e command-line option to IMPORT/CMD and EXPORT/CMD to
+ actually work.
+ * Fix non-ASCII character in Debian changelog entry for previous release.
+ * Update Japanese debconf template translations to remove period from the
+ end of the title of the debconf note, for consistency with the other
+ translations. Thanks to Kenshi Muto for his consulation on this issue.
+ * Scale back the .hex file mtime update fix in debian/rules to just
+ fakerom.hex and xtrsrom4p.hex, as in the new upstream release only these
+ files are affected.
+
+ -- Branden Robinson <branden@debian.org> Mon, 15 May 2006 01:21:50 -0400
+
+xtrs (4.9b-1) unstable; urgency=low
+
+ * Merge upstream 4.9b release.
+ + Bundle Roland Gerlach's CP/M utilties for xtrs and corresponding
+ documentation.
+ + Add -emtsafe command-line option to xtrs to prevent emulator traps from
+ writing to unexpected places in the host filesystem. Use this flag if
+ you believe your xtrs instances may run malicious code aware of xtrs's
+ traps within the emulator.
+ + Add -e command-line option to the IMPORT/CMD and EXPORT/CMD utilities.
+ Use this flag if your TRS-80 operating system uses the NEWDOS/80
+ convention for representing the ending record number in an open file
+ control block, and this fact is not autodetected by the emulator.
+ + Drop old method of importing/exporting files from the host filesystem
+ using fake I/O ports. IMPORT/BAS and EXPORT/BAS are no longer provided.
+ + Merge Debian patches by Branden Robinson to add watchpoints and the
+ zbxinfo command to the debugger, and make miscellaneous cleanups.
+ + Merge Debian patches by Andreas Jochens to make signed/unsigned casts
+ where appropriate.
+ * Update CP/M utility disk documentation to point Debian users to the
+ locally installed copy of the disk in /usr/lib/xtrs.
+ * Drop patches to debug.c, trs_imp_exp.c, trs_cassette.c, and z80.c from
+ debian/patches, as they have been merged upstream.
+ * Update TRS-80 FAQ to be based on Tim Mann's version 1.58 (2006-04-22).
+ + Update URLs to various TRS-80 resources.
+ * Fix grammar errors in package description and remove statement claiming
+ instructions on retrieving ROM images are available in the package. This
+ is no longer true, as I know of no active site offering them for download.
+ * Update debian/rules to touch the mtimes on the assembled .hex files before
+ invoking Make on the upstream sources; when Tim Mann renamed the Z-80
+ assembly sources from ".z" to ".z80", their mtimes got updated and
+ therefore Make thinks the .hex files need to be remade, using the zmac
+ assembler, which is not widely available. This is hopefully a temporary
+ kludge, and the timestamps will be fixed in the next xtrs release.
+ * Add empty, phony binary-indep target to debian/rules to keep lintian
+ happy.
+ * Remove period from title of debconf note template, per squawking from
+ lintian about section 6.5.4.2.4 of the Developers' Reference. I went
+ ahead and updated the po files for cs, da, de, es, fr, pt_BR, ru, and sv
+ (Czech, Danish, German, Spanish, French, Brazilian Portuguese, Russian,
+ and Swedish) and un-fuzzied them, on the wild assumption that periods
+ don't belong in titles in those languages either. I left Japanese alone
+ because I do not understand its grammar and because I do not know what a
+ Japanese period looks like. Japanese translators, please consider
+ un-fuzzing this translation with an appropriate update, and send a patch
+ to the BTS.
+ * Increment Standards-Version to 3.7.2; no changes necessary.
+
+ -- Branden Robinson <branden@debian.org> Sun, 14 May 2006 01:07:16 -0400
+
+xtrs (4.9a-2) unstable; urgency=low
+
+ * Update README.Debian to stop documenting now-defunct site where Model I
+ and Model III ROM images can be obtained. Also migrate /usr/doc
+ references to /usr/share/doc.
+ * Update comment in z80.c to make it more legible (submitted upstream).
+ * Tweak zbx debugger UI (submitted upstream):
+ + Report maximum number of traps when user tries to set too many.
+ + Inform user of existence of "help" command when entering debugger.
+ + Implement "zbxinfo" command, which credits authors, reports number of
+ traps set, size of address space, maximum length of zbx command line,
+ and whether GNU Readline support is enabled. Document existence of
+ "zbxinfo" command in help output.
+ + Kill off hard tab in help output.
+ * Implement "watch" command in zbx debugger, providing the ability to set
+ watchpoints on addresses in memory (submitted upstream).
+ * Add upstream location of TRS-80 FAQ to Debian copyright file.
+ * Update TRS-80 FAQ to be based on Tim Mann's version 1.57 (2005-09-17).
+ + Update question 14: What are the differences among single, double, quad,
+ and high density floppy media?
+ + Add question 26: How can I read the back of a disk that was written in a
+ flippy drive?
+ * Add Czech debconf template translations; thanks, Katarína "Bubli"
+ Machálková! (Closes: #319855)
+ * Add Swedish debconf template translations; thanks, Daniel Nylander!
+ (Closes: #330443)
+ * Bump Debian standards version to 3.6.2; no changes needed.
+
+ -- Branden Robinson <branden@debian.org> Sat, 5 Nov 2005 11:42:38 -0500
+
+xtrs (4.9a-1) unstable; urgency=low
+
+ * Package new upstream version.
+ * Update copyright file to reflect new upstream archive and copyright notice
+ for Debian modifications. I never signed a written instrument assigning
+ copyright in my changes to Software in the Public Interest, Inc., so under
+ my understanding of U.S. law, the copyright remains with me.
+ * Update TRS-80 FAQ to be based on Tim Mann's version 1.53 (2005-04-07).
+
+ -- Branden Robinson <branden@debian.org> Fri, 29 Apr 2005 23:51:58 -0500
+
+xtrs (4.9-5) unstable; urgency=low
+
+ * Actually apply the patches in debian/patches, which were neglected in the
+ 4.9-4 release.
+ * Add recognition of amd64 and ppc64 architectures in debian/rules (thanks,
+ Andreas Jochens).
+ * Update build-dependency on libreadline4-dev (>= 4.1) to libreadline5-dev.
+ Thanks to Andreas Jochens for pointing this out.
+ * Apply patch from Andreas Jochens to fix compilation errors on AMD64
+ by adding more explicit casts. (Closes: #288767)
+
+ -- Branden Robinson <branden@debian.org> Thu, 13 Jan 2005 18:51:57 -0500
+
+xtrs (4.9-4) unstable; urgency=low
+
+ * Transcode changelog to UTF-8.
+ * Modernify comments and metadata in templates.pot.
+ * Modernize comments and metadata in existing po files.
+ * Re-run debconf-update po on existing po files (this recoded them to UTF-8,
+ reflowed the text, and made some other cosmetic fixes).
+ * Add Japanese debconf template translations (thanks, Hideki Yamane).
+ (Closes: #264120)
+ * Add Danish debconf template translations (thanks, Morten Bo Johansen).
+ (Closes: #285963)
+ * Update TRS-80 FAQ to be based on Tim Mann's version 1.50 (2004/12/06).
+ * Rename plain text documentation to use an extension of ".txt" instead of
+ ".text".
+ * Tidy up style of debian/rules file.
+ * Migrate from using dh_installmanpages to dh_installman in debian/rules.
+ * Bump Standards-Version to 3.6.1; changelog already recoded per above -- no
+ other changes necessary.
+ * Quote strings in Debian menu data fields (per Lintian). Reflow menu data.
+ * Replace build-dependency on dummy package xlibs-dev with
+ build-dependencies on libx11-dev and x-dev.
+
+ -- Branden Robinson <branden@debian.org> Fri, 24 Dec 2004 22:51:10 -0500
+
+xtrs (4.9-3) unstable; urgency=low
+
+ * debian/compat: put debhelper compatibility delcaration in this file, as
+ recommended by debhelper(7)
+ * debian/control:
+ - Standards-Version bumped to 3.5.9
+ - replace hard-coded dependency on debconf with ${misc:Depends} per
+ debhelper(7)
+ * debian/po/fr.po: add French debconf template translations (thanks, Pierre
+ Machard) (Closes: #168252)
+ * debian/po/pt_BR.po: add Brazilian Portuguese debconf template translations
+ (thanks, Andre Luis Lopes) (Closes: #179518)
+ * debian/rules: remove DH_COMPAT delcaration in favor of debian/compat,
+ above
+ * debian/trs80faq.html: update to revision 1.45
+
+ -- Branden Robinson <branden@debian.org> Tue, 29 Apr 2003 00:24:56 -0500
+
+xtrs (4.9-2) unstable; urgency=low
+
+ * debian/control:
+ - added build dependency on po-debconf and increment versioned build
+ dependency on debhelper to (>= 4.1.16)
+ - bumped Standards-Version to 3.5.7
+ * debian/copyright: cosmetic fixes
+ * debian/patches: drop patch to Makefile.local; set DEBUG and PREFIX
+ variables via debian/rules instead
+ * debian/{po/,templates*}: coverted to po-debconf
+ * debian/rules:
+ - bump DH_COMPAT to 4
+ - drop "sh" and "sheb" as recongized Debian architectures; add "sh3" and
+ "sh4"
+ - support "noopt" in DEB_BUILD_OPTIONS
+ - minor changes for debhelper 4.x
+ - pass -Wall, -Werror, and -D_REENTRANT as DEBUG flags to upstream make
+ - pass PREFIX=/usr to upstream make
+ * debian/trs80faq.html: update to revision 1.43
+
+ -- Branden Robinson <branden@debian.org> Thu, 24 Oct 2002 22:06:01 -0500
+
+xtrs (4.9-1) unstable; urgency=low
+
+ * new upstream version
+ + added -iconic option
+ + support more sample formats when doing I/O on /dev/dsp, because not all
+ sound hardware supports 8-bit formats
+ + support T-state waiting before raising DRQ after Read or Read Address
+ commands on real floppy drives, not just image files
+ + support setting of track and sector registers on a Read Address to the
+ values read from the ID field on floppy image files, not just real
+ drives
+ + bugfixes and documentation updates
+ * debian/copyright: updated
+ * debian/trs80faq.html: latest version (1.37) from Tim Mann's website
+ * debian/rules: README.tpm no longer exists in upstream distribution; stop
+ trying to ship it
+
+ -- Branden Robinson <branden@debian.org> Sun, 19 May 2002 01:35:01 -0500
+
+xtrs (4.8-2) unstable; urgency=low
+
+ * debian/README.Debian: update Tim Mann's website URL (Closes: #130498)
+ * debian/templates.ru: added Russian template translation (thanks, Ilgiz
+ Kalmetev) (Closes: #137705)
+ * debian/trs80faq.html: latest version (21 Mar) from Tim Mann's website
+
+ -- Branden Robinson <branden@debian.org> Sat, 23 Mar 2002 02:43:52 -0500
+
+xtrs (4.8-1) unstable; urgency=low
+
+ * new upstream version
+ + fix for untimely flushing of output to X server
+ + added heuristic to flush key transition queue if emulated keyboard not
+ polled often enough
+ * debian/copyright: updated
+ * debian/patches: removed a patch that is now upstream
+
+ -- Branden Robinson <branden@debian.org> Fri, 31 Aug 2001 17:33:18 -0500
+
+xtrs (4.7-4) unstable; urgency=low
+
+ * debian/templates.es: added Spanish translation of debconf templates
+ (thanks, Carlos Valdivia Yagüe) (Closes: #106368)
+
+ -- Branden Robinson <branden@debian.org> Tue, 31 Jul 2001 05:09:00 -0500
+
+xtrs (4.7-3) unstable; urgency=low
+
+ * debian/templates.de: added German translation of debconf templates
+ (thanks, Michael Bramer) (Closes: #106212)
+
+ -- Branden Robinson <branden@debian.org> Sun, 22 Jul 2001 15:46:22 -0500
+
+xtrs (4.7-2) unstable; urgency=low
+
+ * Makefile.local: add -Werror to compile flags since xtrs compiles silently
+ under -Wall on i386
+ * debian/rules:
+ - added endianness info for sh and sheb architectures (Closes: #105682)
+ - reworded unknown endianness error message
+ - added all to dh_installdebconf
+ * debian/control
+ - added dependency on debconf
+ - minor rewording in extended description
+ * debian/{config,templates}: wrote a debconf question to discuss the
+ required ROM/OS issue
+ * debian/{postrm,prerm}: removed these since they did nothing
+ significant that debhelper won't automatically generate
+
+ -- Branden Robinson <branden@debian.org> Sat, 21 Jul 2001 00:04:23 -0500
+
+xtrs (4.7-1) unstable; urgency=low
+
+ * new upstream version
+ + improved the keyboard handling and a few other minor tweaks and fixes
+ * debian/rules: add endianness info for hppa, hurd-i386, mips, mipsel, and
+ s390
+ * debian/trs80faq.html: latest version (28 Jun) from Tim Mann's website
+
+ -- Branden Robinson <branden@debian.org> Sat, 14 Jul 2001 01:28:22 -0500
+
+xtrs (4.5a-2) unstable; urgency=low
+
+ * debian/rules: identified ia64 as a little-endian architecture
+
+ -- Branden Robinson <branden@debian.org> Thu, 12 Jul 2001 17:30:06 -0500
+
+xtrs (4.5a-1) unstable; urgency=low
+
+ * new upstream version
+ + fixes for manpage and Makefile typos
+ * debian/control:
+ - add groff to Build-Depends (Closes: #96548)
+ - bumped Standards-Version to 3.5.4 (no changes required)
+ * debian/patches: fixes to Makefile and xtrs.man applied upstream
+ * debian/rules: use html2text instead of lynx
+
+ -- Branden Robinson <branden@debian.org> Thu, 10 May 2001 22:56:24 -0500
+
+xtrs (4.5-1) unstable; urgency=low
+
+ * new upstream version
+ + completes the emulation of undocumented Z-80 instructions and has
+ several other small improvements
+ * cmddump.man, hex2dump.man: manpages now upstream
+ * debian/trs80faq.html: latest version from Tim Mann's website
+
+ -- Branden Robinson <branden@debian.org> Sat, 5 May 2001 01:01:56 -0500
+
+xtrs (4.4-1) unstable; urgency=low
+
+ * new upstream version
+ + adds emulation of the Alpha Products joystick (using keys on the
+ numeric pad) and several other small changes
+ * cmddump.man, hex2dump.man: wrote these manual pages
+ * debian/control:
+ - updated extended description
+ - changed build dependency on xlib6g-dev to xlibs-dev
+ - bumped Standards-Version to 3.5.2 (no changes needed)
+ * debian/rules: remove dh_undocumented call; there are no more
+ undocumented commands
+ * debian/trs80faq.html: latest version from Tim Mann's website
+
+ -- Branden Robinson <branden@debian.org> Thu, 22 Feb 2001 23:23:10 -0500
+
+xtrs (4.3-1) unstable; urgency=low
+
+ * new upstream version
+ + emulation of the serial port
+ + emulation of the Radio Shack and Micro Labs hi-res graphics cards for
+ the Model III
+ + misc. bugfixes
+ * debian/control: updated extended description
+ * debian/trs80faq.html: new upstream version (21 Jul 2000)
+
+ -- Branden Robinson <branden@debian.org> Sat, 22 Jul 2000 18:35:03 -0500
+
+xtrs (4.2-1) unstable; urgency=low
+
+ * new upstream version
+ + emulation of the Model I HRG1B 384*192 graphics card
+ + the -scale command line option now allows independent scaling in the
+ X and Y dimensions
+ + misc. bugfixes
+ * debian/control: fixed some wording in extended description
+ * debian/trs80faq.html: new upstream version (22 Jun 2000)
+
+ -- Branden Robinson <branden@debian.org> Sat, 1 Jul 2000 14:04:18 -0500
+
+xtrs (4.1-2) unstable; urgency=low
+
+ * debian/rules: be sure to build big-endian on big-endian architectures
+
+ -- Branden Robinson <branden@debian.org> Sat, 3 Jun 2000 16:26:17 -0400
+
+xtrs (4.1-1) unstable; urgency=low
+
+ * new upstream version
+ + Added emulation of real Radio Shack hard drive controllers (WD1010).
+ + F9 will now get you into the debugger (zbx) even if you didn't start
+ xtrs with the -debug flag.
+ + misc. bugfixes
+ * migrated Debian changes from previous versions forward
+ * debian/README.contrib-only: minor clarification
+ * debian/checklist: file for my own use reminding me what I need to
+ update whenever a new upstream version is released
+ * debian/control: added libncurses5-dev, libreadline4-dev (>= 4.1), and
+ xlib6g-dev (>= 3.3.6-4) to Build-Depends
+ * debian/copyright: religiously follow policy 6.6
+ * debian/patches: our patches to upstream; these are NOT automatically
+ applied by the build process
+ * debian/trs80faq.html: new upstream version
+
+ -- Branden Robinson <branden@debian.org> Sun, 21 May 2000 03:46:53 -0400
+
+xtrs (4.0-1) unstable; urgency=low
+
+ * the "it's X* 4.0, but not the one you thought! ha ha ha ha ha" release
+ * new upstream version
+ + added emulation of software-switchable Model I 3.54MHz clock speedup
+ kit
+ + added emulation of Orchestra-85 and Orchestra-90 sound hardware
+ + added emulation of TimeDate80, TChron1, TRSWatch, and T-Timer
+ battery-powered clocks (not Y2K tested :) )
+ + added -scale option
+ + added support for Level I BASIC .cas files
+ + changed -samplerate default to 44.1kHz
+ + updated documentation of EXPORT.COM in xtrs manpage (should have been
+ in 3.9)
+ + fixed bug in switching between 80x24 and 64x16 modes when invoked
+ with -usefont options
+ + worked around X event race when invoking with -resize
+ + fixed obscure bugs in Model 4 hi-res graphics card emulation
+ + fixed bug that sometimes causes F10 reboot to hang the emulator until
+ the next X event is received
+ + worked around problem that kept Level II BASIC from being able to
+ read .cas files
+ * migrated Debian changes from previous versions forward
+ * debian/control: updated package description
+ * debian/README.Debian: updated
+
+ -- Branden Robinson <branden@debian.org> Tue, 4 Apr 2000 04:55:53 -0400
+
+xtrs (3.9a-1) unstable; urgency=low
+
+ * new upstream version
+ + Fixed a bug in the GENIE support and added one more GENIE feature:
+ printer interface at port 0xFD.
+ * Makefile: don't generate deroffed manpages in default rule
+ * trs_keyboard.c: don't catch Alt_L or Alt_R key events, since lots of
+ window managers use them
+ * xtrs.man:
+ - documented usage of Meta instead of Alt keys (emulator already used
+ Alt and Meta keys for the same thing)
+ - undocumented usage of Home as "right-shift" key for Model I (emulator
+ had already disposed of this)
+ * debian/control: added Build-Depends
+ * debian/copyright: updated
+ * debian/trs80faq.html: new upstream version
+
+ -- Branden Robinson <branden@debian.org> Sat, 4 Dec 1999 17:57:50 -0500
+
+xtrs (3.9-1) unstable; urgency=low
+
+ * new upstream version
+ + important fixes to sound support for recent Linux kernels
+ + supports GENIE, German Model I clone
+ + provides latest CP/M utility disk
+ + merged almost all Debian patches from 3.8-1
+ * Makefile.local:
+ - turn on -Wall
+ - set PREFIX and MANDIR to Debian-preferred values
+ * cassette.man: remove paragraph about C-shell and Bourne versions
+ * debian/README.{Debian,contrib-only}: minor rewordings
+ * debian/control:
+ - bumped the standards version to 3.1.1
+ - tweaked some awkward English in the description
+ * debian/copyright: updated
+ * debian/rules:
+ - also ship cpmutil.dsk
+ - ship Bourne version of cassette shell script
+ * debian/trs80faq.html: new version
+
+ -- Branden Robinson <branden@debian.org> Sun, 28 Nov 1999 01:46:32 -0500
+
+xtrs (3.8-2) unstable; urgency=low
+
+ * debian/control: rewrote extended description
+ * debian/rules: ship text versions of HTML documents, per new policy
+
+ -- Branden Robinson <branden@debian.org> Wed, 10 Nov 1999 21:36:59 -0500
+
+xtrs (3.8-1) unstable; urgency=low
+
+ * New upstream version. There have been quite a few since I last
+ released. Sorry about that. XFree86 is a harsh mistress.
+ * Policy 3.0.1 compliant and lintian-clean.
+ * The TRS-80 fonts are now hard-coded into the binary and no longer
+ available as X fonts.
+ * Moved place where xtrs looks for ROM files. See
+ /usr/share/doc/xtrs/README.Debian.
+ * Provide utility disk image in /usr/lib/xtrs. (Not shipping cpmutil.dsk
+ as upstream author says it is outdated.)
+ * Ship disk specification HTML document.
+ * Updated TRS-80 FAQ HTML document.
+ * Updated copyright notice.
+ * Moved binary and manpage out of X11 directories.
+ * main.c: canonicalize program_name here, not in trs_xinterface.c, so
+ that error messages are consistent
+ * Makefile:
+ - clean rule deletes compile_rom binary, and keeps deroffed manpages
+ - veryclean rule deletes deroffed manpages
+ - use Debian-canonical file modes when installing
+ - install cmddump, hex2cmd, and mkdisk
+ * Makefile.local:
+ - compile-in expected paths for ROM files
+ - build using readline and ncurses (for zbx internal debugger)
+ - Debian-canonical flags to cc
+ - LDFLAGS and IFLAGS that make sense with our X directories
+ - create a PREFIX variable that gets prepended to BINDIR and MANDIR
+ * trs_xinterface.c:
+ - remove canonicalization of program_name, this is now in main.c
+ - change logic for finding ROM files; check command line options, X
+ resources, compiled-in path to ROM files, then finally fall back on a
+ built-in ROM image
+ * debian/README.Debian: minor factual and stylistic updates
+ * debian/README.contrib-ony: elaborated on a couple of things
+ * debian/control:
+ - remove suggests: c-shell
+ - remove discussion of c-shell requirement in description
+ * debian/cassette.sh: rewrote Tim Mann's csh cassette script in Bourne;
+ since his script made heavy use of array variables, this was a lot of
+ fun :-P
+ * debian/menu: updated menu entry to reflect moved binary
+
+ -- Branden Robinson <branden@debian.org> Sat, 6 Nov 1999 19:58:54 -0500
+
+xtrs (2.6-2) unstable; urgency=low
+
+ * debian/control: tweaked normal and extended descriptions
+ * debian/menu: deleted space to make lintian happy
+
+ -- Branden Robinson <branden@debian.org> Sun, 18 Oct 1998 15:36:44 -0400
+
+xtrs (2.6-1) unstable; urgency=low
+
+ * new upstream release
+
+ -- Branden Robinson <branden@debian.org> Sat, 17 Oct 1998 17:46:21 -0400
+
+xtrs (2.4-1) unstable; urgency=low
+
+ * new upstream release -- 2.3 was only out for a few hours, so this time
+ it wasn't my fault
+
+ -- Branden Robinson <branden@debian.org> Thu, 15 Oct 1998 01:42:58 -0400
+
+xtrs (2.2-1) unstable; urgency=low
+
+ * new upstream release -- I missed 1.10, 2.0, and 2.1, which had some
+ nifty new features.
+ * The upstream author (Tim Mann) did not provide an upstream changelog
+ entry for version 2.2, but here is what I could gather from a diff -u:
+ - tweaked autodelay code in trs_interrupt.c
+ - added "Running games" section to manpage and corrected some typos
+
+ -- Branden Robinson <branden@debian.org> Thu, 1 Oct 1998 07:01:16 -0400
+
+xtrs (1.9-4) frozen unstable; urgency=low
+
+ * fixed typo in Makefile (thanks, Roland Gerlach)
+ * created README.contrib-only in expectation of forthcoming policy
+ * restored upstream author's manpage nomenclature
+
+ -- Branden Robinson <branden@debian.org> Wed, 15 Apr 1998 10:13:25 -0500
+
+xtrs (1.9-3) unstable; urgency=low
+
+ * edits and additions to README.Debian
+ * wrote TODO.Debian
+ * edited package description
+
+ -- Branden Robinson <branden@debian.org> Tue, 17 Mar 1998 14:30:45 -0500
+
+xtrs (1.9-2) unstable; urgency=low
+
+ * fixed typo in /usr/lib/menu/xtrs
+ * tweaked package description
+ * tweaked postinst and prerm in staggeringly insignificant ways
+
+ -- Branden Robinson <branden@debian.org> Thu, 5 Mar 1998 16:34:08 -0500
+
+xtrs (1.9-1) unstable; urgency=low
+
+ * initial release
+
+ -- Branden Robinson <branden@debian.org> Thu, 5 Mar 1998 12:09:45 -0500
+
+# $Id: changelog 120 2008-05-12 06:38:58Z branden $
+# vim:set ai et sw=2 ts=2 tw=78:
diff --git a/debian/checklist b/debian/checklist
new file mode 100644
index 0000000..da3f1f3
--- /dev/null
+++ b/debian/checklist
@@ -0,0 +1,14 @@
+New upstream version checklist:
+* summarize new features in debian/changelog
+* see if any new features should be mentioned in debian/control
+* ensure new upstream files are shipped, and deleted files upstream are no
+ longer shipped, as appropriate
+* migrate patches
+* update copyright file (source location)
+* check for new trs80faq.html
+ + edit out header link section from trs80faq.html
+ + edit out footer link section from trs80faq.html
+
+$Id: checklist 111 2008-02-07 04:12:07Z branden $
+
+vim:set ai et ts=2 sw=2 tw=80:
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5
diff --git a/debian/config b/debian/config
new file mode 100644
index 0000000..48e379c
--- /dev/null
+++ b/debian/config
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# $Id: config 111 2008-02-07 04:12:07Z branden $
+
+set -e
+
+# source debconf library
+. /usr/share/debconf/confmodule
+
+db_input high xtrs/roms_needed || true
+db_go
+
+exit 0
+
+# vim:set ai et sw=4 ts=4 tw=80:
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..038e14b
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,30 @@
+Source: xtrs
+Section: contrib/otherosfs
+Priority: extra
+Maintainer: G. Branden Robinson <g.branden.robinson@gmail.com>
+Build-Depends: libncurses5-dev, libreadline-dev, libx11-dev, groff, debhelper (>= 5), po-debconf, html2text
+Standards-Version: 3.7.3
+
+Package: xtrs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: emulator for TRS-80 Model I/III/4/4P computers
+ xtrs is an X-based emulator for the Tandy/Radio Shack line of Zilog
+ Z-80-based microcomputers popular in the late 1970s and early 1980s. It
+ features cassette, floppy, and hard drive emulation, timer interrupt
+ emulation, file import and export from the host operating system, support for
+ most of the undocumented Z-80 instructions, and a built-in debugger. Real
+ floppy drives can be used, and, if an OSS-compatible sound driver is
+ available, application-based sound can be played and real cassettes read and
+ written directly through the sound card or via WAVE files. Several hi-res
+ graphics cards are emulated and, in Model 4/4P mode, mice are supported.
+ There is also real-time clock, sound card, serial port, joystick, and CPU
+ clock speedup emulation.
+ .
+ xtrs requires ROM images from the original machines. The ROMs are
+ copyrighted by Radio Shack and are not freely licensed. (Exception: in Model
+ 4P mode, a freely licensed boot ROM included with this package can be used to
+ boot a Model 4 operating system from a diskette image.)
+# $Id: control 118 2008-02-07 05:09:37Z branden $
+#
+# vim:set ai et sw=2 ts=2 tw=78:
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..92365ec
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,46 @@
+Package: xtrs
+Obtained from: http://www.tim-mann.org/trs80/xtrs-4.9c.tar.gz
+ http://www.tim-mann.org/trs80faq.html
+Upstream authors: David Gingold, Alec Wolman, Timothy Mann
+Debian package author: Branden Robinson
+
+Debian copyright notice and license terms:
+
+Unless otherwise noted, all independently copyrightable modifications and
+additions to xtrs found in its Debian packages bear the following copyright
+and license terms:
+
+Copyright 1998-2006, 2008 Branden Robinson
+
+This software may be copied, modified, and used for any purpose
+without fee, provided that (1) the above copyright notice is
+retained, and (2) modified versions are clearly marked as having
+been modified, with the modifier's name and the date included.
+
+Original copyright notice and license terms:
+
+********************************************************************************
+
+Copyright (C) 1992 Clarendon Hill Software.
+
+Permission is granted to any individual or institution to use, copy, or
+redistribute this software, provided this copyright notice is retained.
+
+This software is provided "as is" without any expressed or implied
+warranty. If this software brings on any sort of damage -- physical,
+monetary, emotional, or brain -- too bad. You've got no one to blame but
+yourself.
+
+The software may be modified for your own purposes, but modified
+versions must retain this notice.
+
+********************************************************************************
+
+Copyright (c) 1996-2000, Timothy Mann
+
+This software may be copied, modified, and used for any purpose
+without fee, provided that (1) the above copyright notice is
+retained, and (2) modified versions are clearly marked as having
+been modified, with the modifier's name and the date included.
+
+$Id: copyright 119 2008-02-08 08:08:02Z branden $
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..9fb0443
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1,7 @@
+# $Id: dirs 117 2008-02-07 05:08:51Z branden $
+usr
+usr/bin
+usr/share/doc
+usr/share/man
+usr/share/man/man1
+usr/lib/xtrs
diff --git a/debian/menu b/debian/menu
new file mode 100644
index 0000000..dab89c8
--- /dev/null
+++ b/debian/menu
@@ -0,0 +1,5 @@
+?package(xtrs):\
+ needs="X11"\
+ section="Applications/Emulators"\
+ title="xtrs"\
+ command="/usr/bin/xtrs"
diff --git a/debian/patches b/debian/patches
new file mode 100644
index 0000000..685d4df
--- /dev/null
+++ b/debian/patches
@@ -0,0 +1,247 @@
+--- cassette.man~
++++ cassette.man
+@@ -15,13 +15,6 @@
+ This manual page also describes the image formats that the emulator
+ supports and their limitations.
+
+-In this release, two cassette programs are supplied. The original
+-\fBcassette\fP is a C-shell script; it should work with most versions
+-of /bin/csh. If you do not have /bin/csh installed, you can use
+-\fBcassette.sh\fP, which is a Bourne shell script. It requires a
+-modern version of the Bourne shell that supports user-defined functions,
+-so it may not work on older Unix systems.
+-
+ .SH Commands
+ .B pos
+ generates a status message including the filename being used as the
+--- trs_keyboard.c~ Thu Jun 14 12:02:00 2001
++++ trs_keyboard.c Sat Jul 14 00:39:08 2001
+@@ -673,8 +673,8 @@
+ /* 0xffe6 XK_Shift_Lock */ { TK_NULL, TK_Neutral },
+ /* 0xffe7 XK_Meta_L */ { TK_Clear, TK_Neutral },
+ /* 0xffe8 XK_Meta_R */ { TK_Down, TK_ForceShiftPersistent },
+-/* 0xffe9 XK_Alt_L */ { TK_Clear, TK_Neutral },
+-/* 0xffea XK_Alt_R */ { TK_Down, TK_ForceShiftPersistent },
++/* 0xffe9 XK_Alt_L */ { TK_NULL, TK_Neutral },
++/* 0xffea XK_Alt_R */ { TK_NULL, TK_Neutral },
+ /* 0xffeb XK_Super_L */ { TK_NULL, TK_Neutral },
+ /* 0xffec XK_Super_R */ { TK_NULL, TK_Neutral },
+ /* 0xffed XK_Hyper_L */ { TK_NULL, TK_Neutral },
+Index: trs_xinterface.c
+===================================================================
+--- trs_xinterface.c (revision 69)
++++ trs_xinterface.c (working copy)
+@@ -916,6 +916,23 @@
+ char buf[10];
+ XComposeStatus status;
+
++ /*
++ * Of Enter and Leave events, track which kind we saw last. X clients
++ * like "unclutter" will sythesize an Enter event on their own.
++ *
++ * Historically, xtrs assumed that every Enter would be preceded by a
++ * Leave. When this was not the case, xtrs would clobber the global
++ * autorepeat state to off; it wrongly stored the off state because the
++ * xtrs window already had focus.
++ *
++ * This enum is tri-valued with the zero value being UNDEF because we
++ * don't want to fake a Leave event the first time we Enter; that would
++ * cause restore_repeat() to read from repeat_state before it has been
++ * initialized, possibly storing a bogus global autorepeat state.
++ */
++ enum enter_leave_t { UNDEF, ENTER, LEAVE };
++ static enum enter_leave_t enter_leave;
++
+ if (trs_model > 1) {
+ (void)trs_uart_check_avail();
+ }
+@@ -949,6 +966,17 @@
+ #if XDEBUG
+ debug("EnterNotify\n");
+ #endif
++ if (enter_leave == ENTER) {
++ /*
++ * The last Enter/Leave event we saw was an Enter; pretend we saw a
++ * Leave event first.
++ */
++/*#if XDEBUG*/
++ debug("faking a LeaveNotify event first\n");
++/*#endif*/
++ restore_repeat();
++ }
++ enter_leave = ENTER;
+ save_repeat();
+ trs_xlate_keysym(0x10000); /* all keys up */
+ break;
+@@ -957,6 +985,7 @@
+ #if XDEBUG
+ debug("LeaveNotify\n");
+ #endif
++ enter_leave = LEAVE;
+ restore_repeat();
+ trs_xlate_keysym(0x10000); /* all keys up */
+ break;
+Index: trs_xinterface.c
+===================================================================
+--- trs_xinterface.c (revision 104)
++++ trs_xinterface.c (revision 106)
+@@ -82,6 +82,7 @@
+ static Display *display;
+ static int screen;
+ static Window window;
++static Window help_window;
+ static GC gc;
+ static GC gc_inv;
+ static GC gc_xor;
+@@ -625,6 +626,98 @@
+ #endif
+ }
+
++/*
++ * show help
++ */
++
++void trs_show_help()
++{
++ XWindowAttributes parent_attrs;
++ unsigned int help_width = 495;
++ unsigned int help_height = 365;
++ unsigned int help_xpos, help_ypos;
++ unsigned long foreground, background;
++ GC help_gc;
++ XGCValues values;
++ char *help_font_name = "9x15";
++ XFontStruct *help_font_info;
++ int font_height;
++ int text_line;
++ int i;
++ static char *helpitems[] = {
++ "F1: Model 4/4P F1 key",
++ "F2: Model 4/4P F2 key",
++ "F3: Model 4/4P F3 key",
++ "F4: Model 4/4P caps lock key",
++ "F5: TRS-80 @ key",
++ "F6: TRS-80 0 key",
++ "F7: signal disk change in emulated floppy drive",
++ "F8: exit emulator",
++ "F9: enter zbx debugger",
++ "F10: TRS-80 reset button",
++ "",
++ "LeftArrow, Backspace, Delete: TRS-80 left arrow key",
++ "RightArrow, Tab: TRS-80 right arrow key",
++ "UpArrow: TRS-80 up arrow key",
++ "DownArrow, Linefeed: TRS-80 down arrow key",
++ "",
++ "Esc, Break: TRS-80 break key",
++ "Home, Clear, LeftAlt: TRS-80 clear key",
++ "Control: Model 4/4P control key",
++ "RightAlt: shifted TRS-80 down arrow key",
++ "",
++ "F11 (Shift+F1 on some systems) toggles this help.",
++ "See the xtrs(1) manual page for more information.",
++ NULL
++ };
++
++ foreground = BlackPixel(display, screen);
++ background = WhitePixel(display, screen);
++ (void) XGetWindowAttributes(display, window, &parent_attrs);
++ if ((parent_attrs.width < help_width)
++ || (parent_attrs.height < help_height)) {
++ (void) fprintf(stderr, "%s: cannot display help window; parent window"
++ " dimensions not large enough to contain it\n",
++ program_name);
++ return;
++ }
++
++ help_xpos = (parent_attrs.width - help_width) / 2;
++ help_ypos = (parent_attrs.height - help_height) / 2;
++ help_window = XCreateSimpleWindow(display, window, help_xpos, help_ypos,
++ help_width, help_height, 1, foreground,
++ background);
++ help_font_info = XLoadQueryFont(display, help_font_name);
++ if (NULL == help_font_info) {
++ (void) fprintf(stderr, "%s: cannot display help window; cannot open"
++ " \"%s\" font\n", program_name, help_font_name);
++ return;
++ }
++ help_gc = XCreateGC(display, help_window, 0, &values);
++ XSetFont(display, help_gc, help_font_info->fid);
++ XSetBackground(display, help_gc, WhitePixel(display,screen));
++ XSetForeground(display, help_gc, BlackPixel(display,screen));
++
++ font_height = help_font_info->ascent + help_font_info->descent;
++ text_line = font_height;
++
++ XMapWindow(display, help_window);
++
++ for (i = 0; NULL != helpitems[i]; i++) {
++ size_t len;
++ int text_width;
++
++ len = strlen(helpitems[i]);
++ text_width = XTextWidth(help_font_info, helpitems[i], len);
++
++ XDrawString(display, help_window, help_gc, 10, text_line, helpitems[i],
++ len);
++ text_line += font_height;
++ }
++
++ return;
++}
++
+ /* exits if something really bad happens */
+ void trs_screen_init()
+ {
+@@ -998,6 +1091,14 @@
+ #endif
+ switch (key) {
+ /* Trap some function keys here */
++ case XK_F11:
++ if (!help_window) {
++ trs_show_help();
++ } else {
++ XUnmapWindow(display, help_window);
++ help_window = 0;
++ }
++ break;
+ case XK_F10:
+ trs_reset(0);
+ key = 0;
+Index: xtrs.man
+===================================================================
+--- xtrs.man (revision 104)
++++ xtrs.man (working copy)
+@@ -68,6 +68,9 @@
+ signals a disk change in the emulated floppy drives (see below). F8
+ exits the program. F9 enters the debugger (zbx). F10 is the reset button.
+
++F11 (or Shift+F1 on some systems) toggles an overlay window which
++summarizes the above information.
++
+ In Model III, 4, and 4P modes, the left and right shift keys are
+ distinct; in Model I mode, they are the same. The PageUp and PageDown
+ keys always activate the positions that correspond to the Model
+Index: Makefile.local
+===================================================================
+--- Makefile.local (revision 104)
++++ Makefile.local (working copy)
+@@ -50,7 +50,7 @@
+ # these lines. As of xtrs 2.7, it is now OK to use this feature again.
+
+ READLINE = -DREADLINE
+-READLINELIBS = -lreadline -lncurses
++READLINELIBS = -lreadline
+
+ # If you want to debug the emulator, use the -g flag instead:
+
+--- Makefile.orig 2017-03-30 09:17:41.055300129 -0400
++++ Makefile 2017-03-30 09:17:48.455224512 -0400
+@@ -143,7 +143,7 @@
+ include Makefile.local
+
+ CFLAGS = $(DEBUG) $(ENDIAN) $(DEFAULT_ROM) $(READLINE) $(DISKDIR) $(IFLAGS) \
+- $(APPDEFAULTS) -DKBWAIT -DHAVE_SIGIO
++ $(APPDEFAULTS) -DKBWAIT
+ LIBS = $(XLIB) $(READLINELIBS) $(EXTRALIBS)
+
+ ZMACFLAGS = -h
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
new file mode 100644
index 0000000..cef83a3
--- /dev/null
+++ b/debian/po/POTFILES.in
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] templates
diff --git a/debian/po/cs.po b/debian/po/cs.po
new file mode 100644
index 0000000..caff1ca
--- /dev/null
+++ b/debian/po/cs.po
@@ -0,0 +1,66 @@
+# debconf templates for xtrs package
+# Czech translation
+#
+# $Id: cs.po 88 2006-05-14 03:23:44Z branden $
+#
+# Copyright:
+# Branden Robinson, 2001
+# Katarna "Bubli" Machlkov, 2005
+#
+# This file is distributed under the same license as the xtrs package.
+# Please see debian/copyright.
+#
+# Translators, if you are not familiar with the PO format, gettext
+# documentation is worth reading, especially sections dedicated to
+# this format, e.g. by running:
+# info -n '(gettext)PO Files'
+# info -n '(gettext)Header Entry'
+#
+# Some information specific to po-debconf is available at
+# /usr/share/doc/po-debconf/README-trans
+# or http://www.debian.org/intl/l10n/po-debconf/README-trans
+#
+# Developers do not need to manually edit POT or PO files.
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs 4.9b-1\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"PO-Revision-Date: 2005-07-23 18:46+0200\n"
+"Last-Translator: Katarina Machalkova <bubli@bubli.org>\n"
+"Language-Team: Czech <debian-l10n-czech@lists.debian.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-2\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr "Obrazy pamt ROM a/nebo operan systm potebn pro bh xtrs"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"Balek xtrs nebude fungovat tak, jak je dodvn, protoe pro svoji funkci "
+"potebuje obraz pamti ROM jednoho z originlnch pota TRS-80 Model I, "
+"III, 4 nebo 4P. (Pro reim Model 4P je vyadovn pouze obraz disku "
+"kompatibilnho operanho systmu.) Obrazy pamt ROM a operan systmy TRS-"
+"80 nemou bt dodvny s tmto debianm balkem kvli licennm omezenm. "
+"Aby program fungoval, muste si tento software obstarat sami a nainstalovat "
+"jej tam, kde jej xtrs oekv. "
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr "Dal informace viz /share/doc/xtrs/README.Debian."
diff --git a/debian/po/da.po b/debian/po/da.po
new file mode 100644
index 0000000..2b34b81
--- /dev/null
+++ b/debian/po/da.po
@@ -0,0 +1,66 @@
+# debconf templates for xtrs package
+# Danish translation
+#
+# $Id: da.po 88 2006-05-14 03:23:44Z branden $
+#
+# Copyrights:
+# Branden Robinson, 2001
+# Morten Bo Johansen, 2004
+#
+# This file is distributed under the same license as the xtrs package.
+# Please see debian/copyright.
+#
+# Translators, if you are not familiar with the PO format, gettext
+# documentation is worth reading, especially sections dedicated to
+# this format, e.g. by running:
+# info -n '(gettext)PO Files'
+# info -n '(gettext)Header Entry'
+#
+# Some information specific to po-debconf is available at
+# /usr/share/doc/po-debconf/README-trans
+# or http://www.debian.org/intl/l10n/po-debconf/README-trans
+#
+# Developers do not need to manually edit POT or PO files.
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs 4.9b-1\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"PO-Revision-Date: 2004-12-16 15:43+0100\n"
+"Last-Translator: Morten Bo Johansen <mojo@mbjnet.dk>\n"
+"Language-Team: Danish <dansk@klid.dk>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr "Xtrs kræver et ROM-aftryk og/eller et styresystem for at fungere"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"Xtrs-pakken kan ikke fungere umiddelbart, fordi den kræver et ROM-aftryk fra "
+"en af de originale computere af mærket TRS-80 Model I, III, 4 eller 4P. For "
+"Model 4P kræves der kun et disketteaftryk med et kompatibelt styresystem. På "
+"grund af licensbegrænsninger på ROM-aftrykkene og på styresystemet for TRS-"
+"80, kan de ikke distribueres med denne Debian-pakke. For at få programmet "
+"til at fungere, må du selv hente denne software og installere den der hvor "
+"xtrs forventer at finde den."
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr "Se /usr/share/doc/xtrs/README.Debian for flere oplysninger."
diff --git a/debian/po/de.po b/debian/po/de.po
new file mode 100644
index 0000000..eccce1b
--- /dev/null
+++ b/debian/po/de.po
@@ -0,0 +1,64 @@
+# debconf templates for xtrs package
+# German translation
+#
+# $Id: de.po 88 2006-05-14 03:23:44Z branden $
+#
+# Copyrights:
+# Branden Robinson, 2001
+# Michael Bramer, 2001
+#
+# This file is distributed under the same license as the xtrs package.
+# Please see debian/copyright.
+#
+# Translators, if you are not familiar with the PO format, gettext
+# documentation is worth reading, especially sections dedicated to
+# this format, e.g. by running:
+# info -n '(gettext)PO Files'
+# info -n '(gettext)Header Entry'
+#
+# Some information specific to po-debconf is available at
+# /usr/share/doc/po-debconf/README-trans
+# or http://www.debian.org/intl/l10n/po-debconf/README-trans
+#
+# Developers do not need to manually edit POT or PO files.
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs 4.9b-1\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr "Rom-Images und/oder ein Betriebsystem wird für xtrs benötigt"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"So wie das xtrs Paket ausgeliefert wird, wird es nicht funktionieren, da es "
+"ein ROM-Image vom originalen TRS-80 Modell I, III, 4 oder 4P Computer zum "
+"arbeiten braucht. (Im Modell 4P wird nur ein Disketten-Image vom "
+"Betriebsystem benötigt.) Durch Lizenzbestimmungen dieser Images, können "
+"diese nicht mit dem Debian Paket ausgeliefert werden. Sie müssen diese "
+"besorgen und an einer Stelle installieren, wo sie von xtrs zum Arbeiten "
+"erwartet werden."
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr ""
+"Siehe auch /usr/share/doc/xtrs/README.Debian für weitere Informationen."
diff --git a/debian/po/es.po b/debian/po/es.po
new file mode 100644
index 0000000..5d7ef34
--- /dev/null
+++ b/debian/po/es.po
@@ -0,0 +1,63 @@
+# debconf templates for xtrs package
+# Spanish translation
+#
+# $Id: es.po 88 2006-05-14 03:23:44Z branden $
+#
+# Copyrights:
+# Branden Robinson, 2001
+# Carlos Valdivia Yagüe, 2001
+#
+# This file is distributed under the same license as the xtrs package.
+# Please see debian/copyright.
+#
+# Translators, if you are not familiar with the PO format, gettext
+# documentation is worth reading, especially sections dedicated to
+# this format, e.g. by running:
+# info -n '(gettext)PO Files'
+# info -n '(gettext)Header Entry'
+#
+# Some information specific to po-debconf is available at
+# /usr/share/doc/po-debconf/README-trans
+# or http://www.debian.org/intl/l10n/po-debconf/README-trans
+#
+# Developers do not need to manually edit POT or PO files.
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs 4.9b-1\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr "xtrs necesita las imágenes ROM y/o el sistema operativo"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"El paquete xtrs no funcionará con solo instalarlo, sino que necesita una "
+"imagen ROM de algún ordenador TRS-80; modelo I, III, 4, o 4P. (Para el "
+"modelo 4P, únicamente es necesaria una imagen de disco de un sistema "
+"operativo compatible.) Debido a las restricciones de las licencias de las "
+"imágenes ROM y los sistemas operativos TRS-80, no pueden incluirse en este "
+"paquete Debian. Tendrá que obtener este software por su cuenta e instalarlo "
+"donde xtrs espera encontrarlo para que funcione debidamente."
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr "Lea /usr/share/doc/xtrs/README.Debian para obtener más información."
diff --git a/debian/po/fr.po b/debian/po/fr.po
new file mode 100644
index 0000000..26a52e2
--- /dev/null
+++ b/debian/po/fr.po
@@ -0,0 +1,70 @@
+# debconf templates for xtrs package
+# French translation
+#
+# $Id: fr.po 88 2006-05-14 03:23:44Z branden $
+#
+# Copyrights:
+# Branden Robinson, 2001
+# Pierre Machard, 2002
+#
+# This file is distributed under the same license as the xtrs package.
+# Please see debian/copyright.
+#
+# Translators, if you are not familiar with the PO format, gettext
+# documentation is worth reading, especially sections dedicated to
+# this format, e.g. by running:
+# info -n '(gettext)PO Files'
+# info -n '(gettext)Header Entry'
+#
+# Some information specific to po-debconf is available at
+# /usr/share/doc/po-debconf/README-trans
+# or http://www.debian.org/intl/l10n/po-debconf/README-trans
+#
+# Developers do not need to manually edit POT or PO files.
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs 4.9b-1\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"PO-Revision-Date: 2002-11-02 12:24+0100\n"
+"Last-Translator: Pierre Machard <pmachard@tuxfamily.org>\n"
+"Language-Team: Debian l10n French <debian-l10n-french@lists.debian.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr ""
+"Images ROM et/ou système d'exploitation nécessaires au fonctionnement d'xtrs"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"Le paquet xtrs qui vient d'être installé ne fonctionnera pas tel quel car il "
+"a besoin de l'image ROM d'un ordinateur TRS-80 Modèle 1, III, 4 ou 4P pour "
+"fonctionner (dans le mode modèle 4P, il suffit d'une image disque d'un "
+"système d'exploitation compatible). En raison de restrictions sur la licence "
+"des images ROM et des systèmes d'exploitation TRS-80, ils ne peuvent pas "
+"être distribués avec ce paquet Debian. Vous devrez obtenir ce logiciel et "
+"l'installer à l'endroit où xtrs s'attend à le trouver pour que le programme "
+"fonctionne."
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr ""
+"Veuillez lire /usr/share/doc/xtrs/README.Debian pour de plus amples "
+"informations."
diff --git a/debian/po/gl.po b/debian/po/gl.po
new file mode 100644
index 0000000..42ca6f3
--- /dev/null
+++ b/debian/po/gl.po
@@ -0,0 +1,50 @@
+# Copyright (C) 2009 Marce Villairno
+# This file is distributed under the same license as the xtrs package.
+#
+# Marce Villarino <mvillarino@users.sourceforge.net>, 2009.
+# Marce Villarino <mvillarino@gmail.com>, 2009.
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs 4.9\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"PO-Revision-Date: 2009-07-18 10:35+0200\n"
+"Last-Translator: Marce Villarino <mvillarino@gmail.com>\n"
+"Language-Team: Galician <proxecto@trasno.net>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Lokalize 0.3\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr "Xtrs precisa de imaxes ROM ou dun sistema operativo para funcionar"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"O paquete xtrs non funcionará tal como se subministra porque require dunha "
+"imaxe ROM dun dos ordenadores orixinais TR-80 Modelos I, III, 4 ou 4P para "
+"funcionar (No modo Model 4P só se precisa unha imaxe de disco dun sistema "
+"operativo compatíbel). Debido a restricións nas licenzas das imaxes ROM e "
+"nos sistemas operativos TRS-80 non se poden distribuir xunto co paquete "
+"Debian, deberá obter este software e instalalo no lugar que xtrs agarda "
+"achalo para que o programa funcione."
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr "Consulte /usr/share/doc/xtrs/README.Debian para máis información."
diff --git a/debian/po/it.po b/debian/po/it.po
new file mode 100644
index 0000000..7bf8651
--- /dev/null
+++ b/debian/po/it.po
@@ -0,0 +1,50 @@
+# ITALIAN TRANSLATION OF XTRS' PO-DEBCONF FILE.
+# COPYRIGHT (C) 2010 THE XTRS' COPYRIGHT HOLDER
+# This file is distributed under the same license as the xtrs package.
+# Vincenzo Campanella <vinz65@gmail.com>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"PO-Revision-Date: 2010-03-15 05:50+0100\n"
+"Last-Translator: Vincenzo Campanella <vinz65@gmail.com>\n"
+"Language-Team: Italian <tp@lists.linux.it>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr "Immagini ROM e sistema operativo necessari per l'operatività di xtrs"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"Il pacchetto xtrs non funzionerà così come fornito, in quanto per la sua "
+"operatività è richiesta un'immagine ROM da un computer TRS-80 modello I, "
+"III, 4 o 4P (nel caso del modello 4P è sufficiente solo un disco con "
+"l'immagine di un sistema operativo compatibile). A causa delle restrizioni "
+"di licenza sulle immagini ROM e sui sistemi operativi TRS-80, questi non "
+"possono essere distribuiti con il pacchetto Debian. Sarà quindi necessario "
+"procurarsi questo software e installarlo nella posizione in cui xtrs si "
+"attende di trovarlo."
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr ""
+"Per maggiori informazioni consultare «/usr/share/doc/xtrs/README.Debian»."
diff --git a/debian/po/ja.po b/debian/po/ja.po
new file mode 100644
index 0000000..77dc4cb
--- /dev/null
+++ b/debian/po/ja.po
@@ -0,0 +1,66 @@
+# debconf templates for xtrs package
+# Japanese translation
+#
+# $Id: ja.po 92 2006-05-15 05:04:14Z branden $
+#
+# Copyrights:
+# Branden Robinson, 2001
+# Hideki Yamane, 2004
+#
+# This file is distributed under the same license as the xtrs package.
+# Please see debian/copyright.
+#
+# Translators, if you are not familiar with the PO format, gettext
+# documentation is worth reading, especially sections dedicated to
+# this format, e.g. by running:
+# info -n '(gettext)PO Files'
+# info -n '(gettext)Header Entry'
+#
+# Some information specific to po-debconf is available at
+# /usr/share/doc/po-debconf/README-trans
+# or http://www.debian.org/intl/l10n/po-debconf/README-trans
+#
+# Developers do not need to manually edit POT or PO files.
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs 4.9b-1\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"PO-Revision-Date: 2004-08-07 15:03+0900\n"
+"Last-Translator: Hideki Yamane <henrich@samba.gr.jp>\n"
+"Language-Team: Japanese <debian-japanese@lists.debian.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr "xtrs の動作には ROM イメージならびに OS が必要です"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"xtrs パッケージは、動作にオリジナルの TRS-80 Model I・III・4・4P コンピュータ"
+"のうちいずれかの ROM イメージを必要とするので、動作しない状態で出荷されていま"
+"す。(Model 4P モードでは、互換 OS のディスクイメージのみが必要になります。) "
+"ROM イメージと TRS-80 の OS についてのライセンス上の制限のため、この Debian "
+"パッケージと共に配布することはできません。このソフトウェアを取得した上で、プ"
+"ログラムが動作するように xtrs から見える所にインストールする必要があります。"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr ""
+"より詳細については、/usr/share/doc/xtrs/README.Debian を参照して下さい。"
diff --git a/debian/po/pt.po b/debian/po/pt.po
new file mode 100644
index 0000000..d627ff8
--- /dev/null
+++ b/debian/po/pt.po
@@ -0,0 +1,69 @@
+# debconf templates for xtrs package
+# Portuguese translation
+#
+# $Id: pt.po 103 2007-09-12 10:24:43Z branden $
+#
+# Copyrights:
+# Branden Robinson, 2001
+# Américo Monteiro <a_monteiro@netcabo.pt>, 2007
+#
+# This file is distributed under the same license as the xtrs package.
+# Please see debian/copyright.
+#
+# Translators, if you are not familiar with the PO format, gettext
+# documentation is worth reading, especially sections dedicated to
+# this format, e.g. by running:
+# info -n '(gettext)PO Files'
+# info -n '(gettext)Header Entry'
+#
+# Some information specific to po-debconf is available at
+# /usr/share/doc/po-debconf/README-trans
+# or http://www.debian.org/intl/l10n/po-debconf/README-trans
+#
+# Developers do not need to manually edit POT or PO files.
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs 4.9c-1\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"PO-Revision-Date: 2007-08-11 17:02+0100\n"
+"Last-Translator: Américo Monteiro <a_monteiro@netcabo.pt>\n"
+"Language-Team: Portuguese <traduz@debianpt.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr ""
+"São necessárias imagens ROM e/ou sistema operativo para o xtrs funcionar"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"O pacote xtrs não irá funcionar como é distribuido, porque requer uma imagem "
+"ROM de um dos computadores originais TRS-80 Model I, III ou 4P para poder "
+"operar, (No modo Model 4P, apenas é necessária uma imagem de disco de um "
+"sistema operativo compatível). Por causa das restrições de licenciamento "
+"das imagens ROM e dos sistemas operativos do TRS-80, não podem ser "
+"distribuidas com este pacote Debian. Você precisa obter este software e "
+"instalá-lo onde o xtrs espera encontrá-lo para que o programa possa "
+"funcionar."
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr "Veja /usr/share/doc/xtrs/README.Debian para mais informação."
diff --git a/debian/po/pt_BR.po b/debian/po/pt_BR.po
new file mode 100644
index 0000000..206313a
--- /dev/null
+++ b/debian/po/pt_BR.po
@@ -0,0 +1,66 @@
+# debconf templates for xtrs package
+# Brazilian Portuguese translation
+#
+# $Id: pt_BR.po 88 2006-05-14 03:23:44Z branden $
+#
+# Copyrights:
+# Branden Robinson, 2001
+# André Luís Lopes, 2003
+#
+# This file is distributed under the same license as the xtrs package.
+# Please see debian/copyright.
+#
+# Translators, if you are not familiar with the PO format, gettext
+# documentation is worth reading, especially sections dedicated to
+# this format, e.g. by running:
+# info -n '(gettext)PO Files'
+# info -n '(gettext)Header Entry'
+#
+# Some information specific to po-debconf is available at
+# /usr/share/doc/po-debconf/README-trans
+# or http://www.debian.org/intl/l10n/po-debconf/README-trans
+#
+# Developers do not need to manually edit POT or PO files.
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs 4.9b-1\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"PO-Revision-Date: 2003-02-02 19:28-0200\n"
+"Last-Translator: André Luís Lopes <andrelop@ig.com.br>\n"
+"Language-Team: Debian-BR Project <debian-l10n-portuguese@lists.debian.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr "Imagens ROM e/ou sistema operacional necessários para o xtrs funcionar"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"O pacote xtrs não irá funcionar como ele é distribuído uma vez que o mesmo "
+"requer uma imagem ROM de um dos modelos de computadores TRS-80 Modelo I, III "
+"ou 4P para funcionar. (No modo Modelo 4P, somente uma imagem de disco de um "
+"sistema operacional é requerido.) Devido as restrições de licenciamento das "
+"imagens ROM e dos sistemas operacionais TRS-80, os mesmos não podem ser "
+"distribuídos com o pacote Debian. Você precisará obter esse software e "
+"instalá-lo onde o xtrs espera encontrá-lo para funcionar."
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr "Consulte /usr/share/doc/xtrs/README.Debian para maiores informações."
diff --git a/debian/po/ru.po b/debian/po/ru.po
new file mode 100644
index 0000000..8ae9720
--- /dev/null
+++ b/debian/po/ru.po
@@ -0,0 +1,63 @@
+# debconf templates for xtrs package
+# Russian translation
+#
+# $Id: ru.po 88 2006-05-14 03:23:44Z branden $
+#
+# Copyrights:
+# Branden Robinson, 2001
+# Ilgiz Kalmetev, 2002
+#
+# This file is distributed under the same license as the xtrs package.
+# Please see debian/copyright.
+#
+# Translators, if you are not familiar with the PO format, gettext
+# documentation is worth reading, especially sections dedicated to
+# this format, e.g. by running:
+# info -n '(gettext)PO Files'
+# info -n '(gettext)Header Entry'
+#
+# Some information specific to po-debconf is available at
+# /usr/share/doc/po-debconf/README-trans
+# or http://www.debian.org/intl/l10n/po-debconf/README-trans
+#
+# Developers do not need to manually edit POT or PO files.
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs 4.9b-1\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr "Образы ROM и/или операционной системы, необходимые для работы xtrs"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"Пакет xtrs не будет функционировать потому, что ему требуется для работы "
+"образ ROM одного из оригинальных компьютеров TRS-80 Model I, III, 4 или 4P. "
+"(В режиме модели 4P, требуется только образ диска совместимой операионной "
+"системы.) Из-за лицензионных ограничений на образы ROM и операционных "
+"систем TRS-80, они не могут распространяться с этим пакетом Debian. Вам "
+"понадобится достать это программное обеспечение и установить там, где xtrs "
+"ожидает его найти."
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr "См. более полную информацию в /usr/share/doc/xtrs/README.Debian."
diff --git a/debian/po/sv.po b/debian/po/sv.po
new file mode 100644
index 0000000..ce5e237
--- /dev/null
+++ b/debian/po/sv.po
@@ -0,0 +1,67 @@
+# debconf templates for xtrs package
+# Swedish translation
+#
+# $Id: sv.po 88 2006-05-14 03:23:44Z branden $
+#
+# Copyright:
+# Branden Robinson, 2001
+# Daniel Nylander, 2005
+#
+# This file is distributed under the same license as the xtrs package.
+# Please see debian/copyright.
+#
+# Translators, if you are not familiar with the PO format, gettext
+# documentation is worth reading, especially sections dedicated to
+# this format, e.g. by running:
+# info -n '(gettext)PO Files'
+# info -n '(gettext)Header Entry'
+#
+# Some information specific to po-debconf is available at
+# /usr/share/doc/po-debconf/README-trans
+# or http://www.debian.org/intl/l10n/po-debconf/README-trans
+#
+# Developers do not need to manually edit POT or PO files.
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs 4.9b-1\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"PO-Revision-Date: 2005-09-28 04:07-0700\n"
+"Last-Translator: Daniel Nylander <po@danielnylander.se>\n"
+"Language-Team: Swedish <sv@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr ""
+"ROM-dumpar och/eller operativsystem som behövs för att xtrs skall köras"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"xtrs-paketet kommer inte att fungera direkt efter installation eftersom det "
+"kräver en ROM-dump från en original TRS-80 Model I, III, 4 eller 4P dator "
+"för att starta. (I Model 4P-läget krävs bara en diskimage av ett "
+"kompatibelt operativsystem.) På grund av licensrestriktioner av ROM-dumpar "
+"och TRS-80 operativsystemet kan dessa inte distribueras tillsammans med "
+"detta Debian-paket. Du måste skaffa denna mjukvara och installera den där "
+"xtrs förväntar sig att hitta den för att köra programmet."
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr "Se /usr/share/doc/xtrs/README.Debian för mer information."
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
new file mode 100644
index 0000000..1728ff1
--- /dev/null
+++ b/debian/po/templates.pot
@@ -0,0 +1,42 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr ""
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr ""
diff --git a/debian/po/vi.po b/debian/po/vi.po
new file mode 100644
index 0000000..077967e
--- /dev/null
+++ b/debian/po/vi.po
@@ -0,0 +1,50 @@
+# Vietnamese translation for Xtrs.
+# Copyright © 2010 Free Software Foundation, Inc.
+# Clytie Siddall <clytie@riverland.net.au>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: xtrs\n"
+"Report-Msgid-Bugs-To: xtrs@packages.debian.org\n"
+"POT-Creation-Date: 2010-03-14 17:24+0100\n"
+"PO-Revision-Date: 2010-03-18 18:41+0930\n"
+"Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n"
+"Language-Team: Vietnamese <vi-VN@googlegroups.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Generator: LocFactoryEditor 1.8\n"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "ROM images and/or operating system needed for xtrs to operate"
+msgstr "Ảnh ROM và/hay hệ điều hành yêu cầu bởi xtrs để thao tác"
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid ""
+"The xtrs package will not function as it ships because it requires a ROM "
+"image from one of the original TRS-80 Model I, III, 4, or 4P computers to "
+"operate. (In Model 4P mode, only a disk image of a compatible operating "
+"system is required.) Because of licensing restrictions on the ROM images "
+"and TRS-80 operating systems, they cannot be distributed with this Debian "
+"package. You will need to obtain this software and install it where xtrs "
+"expects to find it for the program to work."
+msgstr ""
+"Gói xtrs không chạy được như được phát hành, vì nó yêu cầu một ảnh ROM từ "
+"một của những máy tính TDS-80 gốc kiểu I, III, 4 hay 4P. (Trong chế độ kiểu "
+"4P, chỉ yêu cầu một ảnh đĩa của một hệ điều hành tương thích.) Do sự hạn chế "
+"cấp quyền sử dụng ảnh ROM và hệ điều hành TRS-80, không thể phát hành được "
+"cùng với gói Debian này. Để sử dụng được thì bạn cần phải lấy phần mềm này "
+"và cài đặt nó vào vị trí thích hợp với xtrs."
+
+#. Type: note
+#. Description
+#: ../templates:1001
+msgid "See /usr/share/doc/xtrs/README.Debian for more information."
+msgstr ""
+"Xem tập tin Đọc Đi « /usr/share/doc/xtrs/README.Debian » để tìm thêm thông "
+"tin."
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 0000000..226b94c
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Debian xtrs package post-installation script
+# Copyright 2001 Branden Robinson.
+# Licensed under the GNU General Public License, version 2. See the file
+# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
+
+# $Id: postinst 111 2008-02-07 04:12:07Z branden $
+
+set -e
+
+trap "message ;\
+ message 'Received signal. Aborting xtrs package postinst script.' ;\
+ message ;\
+ exit 1" 1 2 3 15
+
+# source debconf library
+. /usr/share/debconf/confmodule
+
+#DEBHELPER#
+
+exit 0
+
+# vim:set ai et sw=4 ts=4 tw=80:
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..f57e4bb
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,102 @@
+#!/usr/bin/make -f
+# Debian package build rules file for xtrs
+# Copyright 1997-1999 Joey Hess.
+# Copyright 1999, 2004 Branden Robinson.
+# Licensed under the GNU General Public License, version 2. See the file
+# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# Command for converting HTML to plain text.
+#HTML2TEXT=lynx -dump -nolist
+HTML2TEXT=html2text -nobs -style pretty
+
+ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
+ENDIANNESS=$(shell dpkg-architecture -qDEB_HOST_ARCH_ENDIAN)
+
+ifeq ($(ENDIANNESS),)
+$(error endianness of $(ARCH) architecture is unknown\; cannot continue)
+endif
+
+# if $DEB_BUILD_OPTIONS *doesn't* contain "noopt"
+ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+OPTIMIZE:=-O2
+endif
+
+PLAINTEXT_GOALS=cpmutil.txt dskspec.txt debian/trs80faq.txt
+
+%.txt: %.html
+ $(HTML2TEXT) $< >$@
+
+build: build-stamp
+build-stamp: $(PLAINTEXT_GOALS)
+ dh_testdir
+
+# Touch the mtimes on some of the assembled .hex files; when Tim Mann
+# renamed the Z-80 assembly sources from ".z" to ".z80", their mtimes got
+# updated and therefore Make thinks the .hex files need to be remade, using
+# the zmac assembler, which is not widely available.
+#
+# This is hopefully a temporary kludge, and the timestamps will be fixed in
+# the next (post-4.9c) xtrs release.
+ for F in \
+ fakerom.hex \
+ xtrsrom4p.hex \
+ ; do \
+ touch "$$F"; \
+ done
+ifeq ($(ENDIANNESS),big)
+ $(MAKE) DEBUG="-Wall -Werror -Wno-error=unused-but-set-variable $(OPTIMIZE) -g -D_REENTRANT" PREFIX=/usr \
+ ENDIAN=-Dbig_endian
+else
+ $(MAKE) DEBUG="-Wall -Werror -Wno-error=unused-but-set-variable $(OPTIMIZE) -g -D_REENTRANT" PREFIX=/usr
+endif
+
+ : >$@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ -rm $(PLAINTEXT_GOALS)
+ $(MAKE) clean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ $(MAKE) PREFIX=debian/xtrs/usr install
+ install -m 755 cassette.sh debian/xtrs/usr/bin/cassette
+ install -m 644 cpmutil.dsk utility.dsk debian/xtrs/usr/lib/xtrs
+
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installdocs README xtrsrom4p.README cpmutil.html dskspec.html \
+ debian/README.contrib-only debian/trs80faq.html $(PLAINTEXT_GOALS)
+ dh_installdebconf
+ dh_installmenu
+ dh_installman cassette.man cmddump.man hex2cmd.man mkdisk.man xtrs.man
+ dh_installchangelogs ChangeLog
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+# This source package builds no architecture-independent binary packages.
+binary-indep:
+
+binary: binary-arch
+.PHONY: build clean binary-arch binary-indep binary install
+
+# vim:set ai noet sw=8 ts=8 tw=80:
diff --git a/debian/templates b/debian/templates
new file mode 100644
index 0000000..6be7920
--- /dev/null
+++ b/debian/templates
@@ -0,0 +1,12 @@
+Template: xtrs/roms_needed
+Type: note
+_Description: ROM images and/or operating system needed for xtrs to operate
+ The xtrs package will not function as it ships because it requires a ROM
+ image from one of the original TRS-80 Model I, III, 4, or 4P computers to
+ operate. (In Model 4P mode, only a disk image of a compatible operating
+ system is required.) Because of licensing restrictions on the ROM images and
+ TRS-80 operating systems, they cannot be distributed with this Debian
+ package. You will need to obtain this software and install it where xtrs
+ expects to find it for the program to work.
+ .
+ See /usr/share/doc/xtrs/README.Debian for more information.
diff --git a/debian/trs80faq.html b/debian/trs80faq.html
new file mode 100644
index 0000000..b110167
--- /dev/null
+++ b/debian/trs80faq.html
@@ -0,0 +1,2261 @@
+<HTML>
+<HEAD>
+<TITLE>TRS-80 Model I/III/4: Frequently Asked Questions</TITLE>
+</HEAD>
+<body bgcolor="#fff0f5">
+
+<H2>TRS-80 Model I/III/4: Frequently Asked Questions</H2>
+
+Here are a few frequently asked questions on the Radio Shack TRS-80
+Model I, Model III, and Model 4. These are Z-80 based machines that
+were first introduced in 1977. The three models were partly
+compatible with one another, and incompatible with most everything
+else. Today they are of interest only to the nostalgic and a few
+folks who have specialized applications that were never ported to
+newer machines. The following are questions that people frequently
+ask <i>me</i>; your mileage may vary!
+This FAQ is available on the Web through the page
+<A HREF=
+"http://tim-mann.org/trs80.html"
+>http://tim-mann.org/trs80.html</A>.
+
+<pre>
+$Id: trs80faq.html,v 1.59 2007/02/21 05:16:37 mann Exp $
+</pre>
+
+<HR>
+<H2>Contents</H2>
+
+<UL>
+<LI><A HREF="#[1]">
+ [1] Where can I get TRS-80 software and hardware?
+ </A></LI>
+<li><a href="#[2]">
+ [2] Where can I get information to repair or upgrade my TRS-80?
+ </a></li>
+<li><a href="#[3]">
+ [3] How can I read my TRS-80 floppy disks in a PC?
+ </a></li>
+<LI><A HREF="#[4]">
+ [4] What TRS-80 emulators do you recommend?
+ </A></LI>
+<LI><A HREF="#[5]">
+ [5] What is a .DSK file?
+ </A></LI>
+<LI><A HREF="#[6]">
+ [6] How can I convert my real TRS-80 floppy disks to .DSK files?
+ </A></LI>
+<LI><A HREF="#[7]">
+ [7] How can I convert .DSK files to real TRS-80 floppy disks?
+ </A></LI>
+<LI><A HREF="#[8]">
+ [8] How can I get individual files off a .DSK file or TRS-80
+ floppy disk?
+ </A></LI>
+<LI><A HREF="#[9]">
+ [9] How can I put individual files onto a .DSK file or TRS-80 floppy disk?
+ </A></LI>
+<li><a href="#[10]">
+ [10] What do I do with TRS-80 software that comes in .ZIP files?
+ </a></li>
+<li><a href="#[11]">
+ [11] What are the system file passwords and password back doors
+ on TRS-80 operating systems?
+ </a></li>
+<li><a href="#[12]">
+ [12] What problems do PC floppy disk controllers have with TRS-80
+ disk formats? What problems do different TRS-80 models have with each
+ other's disk formats?
+ </a></li>
+<li><a href="#[13]">
+ [13] How can TRSDOS 2.3 be patched to read single-density disks written by
+ a Model III, Model 4, or PC?
+ </a></li>
+<li><a href="#[14]">
+ [14] What are the differences among single, double, quad, and high
+ density floppy media?
+ </a></li>
+<li><a href="#[15]">
+ [15] Which PC floppy controllers and drives can handle single density (FM)?
+ </a></li>
+<li><a href="#[16]">
+ [16] What PC add-on cards can handle single density (FM) and
+ other unusual formats?
+ </a></li>
+<li><a href="#[17]">
+ [17] How can I add lowercase to a TRS-80 Model I?
+ </a></li>
+<li><a href="#[18]">
+ [18] My Model 4 or 4P has video problems in Model 4 mode, but
+ is fine in Model III mode. How can I fix it?
+ </a></li>
+<li><a href="#[19]">
+ [19] I want to add or replace TRS-80 floppy disk drives.
+ What's going on with the setup and cabling?
+ </a></li>
+<li><a href="#[20]">
+ [20] What about using high density (1.2MB 5.25-inch or 1.44MB 3.25-inch)
+ drives on a TRS-80?
+ </a></li>
+<li><a href="#[21]">
+ [21] What about using low density (360KB 5.25-inch or 720KB 3.25-inch)
+ drives on a PC?
+ </a></li>
+<li><a href="#[22]">
+ [22] What are some other good references for detailed information
+ about floppy disks and drives?
+ </a></li>
+<li><a href="#[23]">
+ [23] How do I determine what PDRIVE settings to use for a
+ NEWDOS/80 disk?
+ </a></li>
+<li><a href="#[24]">
+ [24] How do I make a bootable double-density Model I LDOS 5.3.1
+ system disk from the single-density master disk set?
+ </a></li>
+<li><a href="#[25]">
+ [25] What about using 8-inch drives on a PC?
+ </a></li>
+<li><a href="#[26]">
+ [26] How can I read the back of a disk that was written in a
+ flippy drive?
+ </a></li>
+</UL>
+
+<HR>
+
+<H3><A NAME="[1]">
+ [1] Where can I get TRS-80 software and hardware?
+</A></H3>
+
+<p>A huge collection of TRS-80 software is available for download
+from the TRS-80 Revived Pages,
+<A HREF="http://www.trs-80.com/"
+>http://www.trs-80.com/</A>.
+
+<p>Most software from Misosys, Logical Systems, Galactic Software
+Ltd., Powersoft, and Breeze/QSD is now available for free download by
+permission of the copyright owner, Roy Soltoff (owner of Misosys).
+See <a href="http://tim-mann.org/trs80.html"
+>http://tim-mann.org/trs80.html</a>.
+
+<p>Computer News 80 has some commercial software and hardware
+products, a library of freeware disks, and a small monthly newsletter
+that still supports the TRS-80 I/III/4. You can contact them via the
+Web at <a href="http://www.ebaystores.com/computernews80/"
+>http://www.ebaystores.com/computernews80/</a>.
+
+<p>M. A. D. Software deals in TRS-80 products. Among other things,
+they have upgrades to the Model 4P ROMs and the MODELA/III file (Model
+III ROM image). Check out their Web site at <a
+href="http://madsoft.lonestar.org/" >http://madsoft.lonestar.org/</a>,
+or contact them via email at
+madcs@madsoft.lonestar.org or via US mail at:
+
+<p><address>
+ M. A. D. Software<br>
+ P. O. Box 331323<br>
+ Fort Worth, TX 76133-1323
+</address>
+
+<p>Archive Software is a small venture run by Cord Coslor.
+Cord buys and sells used TRS-80 Model I/III/4 software and hardware
+(among other things). Here is his new contact information as of
+2-Apr-2001:
+
+<p><address>
+ Cord Coslor<br>
+ Archive Software<br>
+ 21939 Hernando Ave.<br>
+ Port Charlotte, FL 33952<br>
+ (941) 625-1649<br>
+ e-mail: ArchiveSoftware@juno.com<br>
+ web: <a href="http://www.archivenews.net"
+ >www.archivenews.net</a>
+</address>
+
+<p>Ian Mavric of Melbourne, Australia runs "The Right Stuff (aka
+TRS-80 Oldtimer Centre)". He deals in both hardware and software.
+See his Web page at
+<a href="http://www.netspace.net.au/~ianmav/trs80/"
+>http://www.netspace.net.au/~ianmav/trs80/</a>.
+
+<p>There is a page of TRS-80s for sale linked from
+<a href="http://www.trs-80.com/">http://www.trs-80.com/</a>.
+
+<p>You can still order some software from Tandy Software Replacement
+and/or Radio Shack Unlimited, formerly Radio Shack National Parts.
+You can ask at a store or call Radio Shack at 800-843-7422. I'm told
+that you might have to bug people for a while and maybe ask for a
+supervisor or someone who's been there longer, before you find someone
+who believes this is possible and knows how to do it. The purpose of
+Tandy Software Replacement is to supply replacement disks to people
+whose originals have been destroyed, so generally they do not provide
+manuals or packaging, and the prices are very low. They don't
+actually seem to care whether you originally owned the software.
+Radio Shack Unlimited also stocks (or can make up) full packages of
+some software, including manuals.
+
+<p>You can try bidding in the <a href="http://www.ebay.com">eBay</a>
+auctions. Prices tend to be inflated, though.
+
+<hr>
+<H3><A NAME="[2]">
+ [2] Where can I get information to repair or upgrade my TRS-80?
+</A></H3>
+
+<p>More hardware information is starting to appear on the Web these
+days. See the TRS-80 links on my Web page, at <a
+href="http://tim-mann.org/trs80links.html"
+>http://tim-mann.org/trs80links.html</a>, both the "history and
+technical data" and "software and documentation downloads" sections.
+
+<p>You can ask on the newsgroup
+<a href="news:comp.sys.tandy">comp.sys.tandy</a>. This is a good
+place for TRS-80 software questions too. You might also try searching
+back postings to the group with <a href="http://dejanews.com/">Deja
+News</a>.
+
+<p>Also try the sources given in topic <a href="#[1]">[1]</a> to see
+if they carry hardware manuals. Tandy Software Replacement or Radio
+Shack Unlimited are said to be able to photocopy and sell manuals, but
+I haven't tried this.
+
+<p>Computer News 80 has a mail-in repair service; see topic <a
+href="#[1]">[1]</a>.
+
+<p>Tandy Repair Centers may or may not be able to fix your TRS-80.
+There is some danger that they won't know how to find the necessary
+parts and information. They don't see a lot of these machines any more.
+
+<hr>
+<H3><A NAME="[3]">
+ [3] How can I read my TRS-80 floppy disks in a PC?
+</A></H3>
+
+<p>This is a somewhat complex topic, and much of the rest of this FAQ
+is devoted to the details. There are a number of approaches, but I
+think the best is to copy the disks to virtual disk image (.DSK)
+files, as used by the various TRS-80 emulators; see the next few
+topics in this FAQ. Once you have your data in .DSK format, it
+will be much easier to work with. You can use an emulator to run the
+TRS-80 software that is on the disks, get directory listings, examine
+or print the data, extract individual files, etc.
+
+<p>Another approach that people sometimes try is to run TRSCROSS.
+This is an MS-DOS program for reading and writing TRS-80 diskettes
+that directly extracts individual files from the disks, without making
+a .DSK image. It's a very old program that seems to have trouble
+working on modern, fast PCs, and it puts your data into a format that
+is not directly usable with emulators. I do not recommend this
+approach, but if you really want to try it, TRSCROSS is available from
+my <a href="http://tim-mann.org/misosys.html">Misosys software page</a>.
+
+<p>Another approach that doesn't work well is to try to read the disks
+in Linux without using an emulator. The Linux floppy driver is quite
+versatile, but (at least as of this writing) no matter how you
+configure it, you won't be able to read TRS-80 disks through the
+normal open/close/read/write interface that programs like "dd" use.
+First, the driver assumes that sector numbering always starts from 1,
+but most TRS-80 formats start it from zero. Second, the driver
+assumes that all sectors are written with a normal data address mark,
+but most TRS-80 formats write some sectors (usually those on the
+directory track) with a different DAM. The TRS-80 emulator for Linux
+(xtrs) talks to the floppy driver using the low-level "raw command"
+interface, which lets it get around these problems.
+
+<p>Still another approach is to connect a serial or parallel cable
+between your PC and a real TRS-80, and transfer the data over that.
+This is a lot slower than reading a floppy, but in some cases you can
+be stuck doing it when the other approaches discussed below don't
+work. Jeff Vavasour's Model I emulator includes instructions on how
+to do this with a Model I; see topic <a href="#[4]">[4]</a>. I don't
+have any advice beyond that, not having tried this approach myself.
+
+<hr>
+<H3><A NAME="[4]">
+ [4] What TRS-80 emulators do you recommend?
+</A></H3>
+
+<p>Under <b>Linux</b> and other <b>Unix</b>-compatible operating systems, I
+recommend the <a href="http://tim-mann.org/xtrs.html" >xtrs</a>
+Model I/III/4/4P emulator. It should work on any version of Unix with
+the X Window System, except that its support for physical floppy disk
+drives works only under Linux, and sound works only under Linux or
+other systems that have OSS-compatible sound drivers. It is free
+software with full source code included.
+
+<p>Under <b>Windows NT/2000/XP/2003</b>, the following TRS-80 emulators are
+available. Due to a limitation of Windows NT family operating
+systems, neither one supports physical floppy disk drives, only floppy
+images (.DSK files). They are both quite full featured otherwise.
+<ul>
+<li>Matthew Reed's new <a
+href="http://www.arrowweb.com/mkr/">TRS32</a> emulates Models I, III,
+and 4. The unregistered shareware version can be downloaded for free,
+but omits a few features. The full version costs $69.
+
+<li>Wade Fincher's <a
+href="http://asub.arknet.edu/wade/wintrs80.htm">WinTRS-80</a>
+emulates Models I, III, 4, and 4P.
+It is downloadable free of charge, but source code is not available.
+</ul>
+
+<p>The TRS-80 emulators available for <b>MS-DOS</b> or <b>Windows 95/98/ME</b>
+<i>do</i> support physical floppy drives. I don't think any of them run under
+Windows NT/2000/XP/2003 at all, however.
+<ul>
+ <li><a href="http://discover-net.net/~dmkeil/" >David Keil's Model I
+ emulator</a>. The full version can be
+ downloaded free of charge, but a $10 contribution is requested
+ if you find it useful.
+ <li><a href="http://discover-net.net/~dmkeil/" >David Keil's Model III/4/4P
+ emulator</a>. The full version can be
+ downloaded free of charge, but a $10 contribution is requested
+ if you find it useful.
+ <li><a href="http://www.arrowweb.com/mkr/" >Matthew Reed's Model
+ I/III emulator</a>. The unregistered shareware
+ version can be downloaded free of charge, but emulates the
+ Model I only. The registered version costs $29.
+ <li><a href="http://www.arrowweb.com/mkr/" >Matthew Reed's Model 4
+ emulator</a>. The unregistered shareware version can
+ be downloaded free of charge, but omits Model III mode and a
+ few other features. The registered version costs $49.
+ <li><a href="http://www.vavasour.ca/jeff/trs80.html"
+ >Jeff Vavasour's Model I emulator</a>. This is now
+ downloadable free of charge.
+ <li>Jeff Vavasour's Model III/4 emulator</a>. This is available by
+ mail order from <a href="http://www.ebaystores.com/computernews80/"
+ >Computer News 80</a>. The price is $59.95.
+</ul>
+
+<hr>
+<H3><A NAME="[5]">
+ [5] What is a .DSK file?
+</A></H3>
+
+<p>A .DSK file is an image of a TRS-80 floppy disk in a file. They
+are used by TRS-80 emulators.
+
+<p>Warning: There are three kinds of .DSK files with different
+internal formats, one that originated with Jeff Vavasour's Model I
+emulator (JV1), one that originated with his Model III/4 emulator
+(JV3), and one that originated with David Keil's emulators (DMK). Each
+one adds support for more TRS-80 disk formats. Each of Jeff's
+emulators works only with the kind of .DSK file that was designed for
+it. Matthew Reed's emulators work with JV1 and JV3
+transparently. David Keil's emulators and <strong>xtrs</strong>
+work with all three kinds.
+
+<p>Technical details of the JV1 and JV3 formats are now available from
+my Web page, <a
+href="http://tim-mann.org/trs80/dskspec.html"
+>http://tim-mann.org/trs80/dskspec.html</a>.
+Technical details of the DMK format are available from David Keil's
+Web page, <a
+href="http://discover-net.net/~dmkeil/trs80/trstech.htm#Technical-DMK-disks"
+>http://discover-net.net/~dmkeil/trs80/trstech.htm#Technical-DMK-disks</a>.
+
+<hr>
+<H3><A NAME="[6]">
+ [6] How can I convert my real TRS-80 floppy disks to .DSK files?
+</A></H3>
+
+<p>There are several possibilities:
+
+<p>(A) One way is to transfer data over the TRS-80's serial port or
+printer port. That's probably the best way if you have a Model I,
+because a stock Model I can read and write only single density, but
+many PCs cannot deal with single density (see topic <a
+href="#[12]">[12]</a>). Jeff Vavasour's Model I emulator includes
+instructions on how to do this; see topic <a href="#[4]">[4]</a>.
+
+<p>(B) A faster and more convenient way, if you can get it to work, is to
+read the disks in a PC with a 5.25-inch floppy drive. Under MS-DOS or MS
+Windows, try Matthew Reed's freeware READDISK program. See <a
+href="http://www.arrowweb.com/mkr/readdisk_doc.html"
+>http://www.arrowweb.com/mkr/readdisk_doc.html</a>.
+
+<p>(C)If you have problems with READDISK or you are using
+Linux, you can copy the disks with an emulator, as follows.
+
+<ol>
+<li>Get a TRS-80 emulator that supports both .DSK files and real floppy
+drives. See topic <a href="#[4]">[4]</a>. Read the emulator's
+instructions and get it running.</li>
+
+<li>Find a PC with a real 5.25-inch floppy drive attached. In theory, a
+40-track DD drive is best if your TRS-80 had 40-track or 35-track
+drives, but you can use 80-track HD drives too. (On a PC, 40-track DD
+drives are usually called 180KB or 360KB drives, depending on whether
+they are single or double sided.) The trouble with this theory is
+that DD drives may not work with some emulators (see topic
+<a href="#[21]">[21]</a>), and if your DD drive
+is a pullout from a TRS-80, you may have difficulty cabling and jumpering
+it correctly for a PC.</li>
+
+<li>Configure the emulator with an LDOS or other operating system .DSK
+file as drive :0, a new, empty .DSK file as drive :1, and the real
+drive as drive :2. If you are using a Model I emulator with LDOS,
+note that Model I LDOS comes on two .DSK files, so configure the
+emulator with the second one (LDOSXTRA.DSK) as drive :3. Note:
+never try to use drive :3 for a double-sided disk (read or virtual) on
+the Model I; a limitation of the Model I hardware (which the emulators
+have no choice but to emulate faithfully) makes this fail to work.</li>
+
+<li>Boot the emulated machine. Model I LDOS requires an extra driver
+to deal with double density, so if you are using it, type FDUBL to the
+emulator after booting.</li>
+
+<li>Put the floppy into the real drive and copy it to the emulated
+drive (.DSK) file. If you are using LDOS 5.3.1, the command is QFB :2
+:1. On LS-DOS 6.3.1, the command is DISKCOPY :2 :1. Both those
+commands format the floppy automatically.
+</li> </ol>
+
+<p>The above instructions assume that the disk is in a format that can
+be copied by LDOS. For TRSDOS 1.3 and NEWDOS/80 disks that LDOS
+doesn't understand, you can get a TRSDOS 1.3 or NEWDOS/80 image from
+<a href="http://www.trs-80.com" >http://www.trs-80.com</a>, use that
+as the operating system in the above procedure, and use appropriate
+TRSDOS 1.3 or NEWDOS/80 commands to copy the disk. Sorry; I can't
+help with the details, but see topic <a href="#[23]">[23]</a> for more
+help with NEWDOS/80.
+
+<p>(D) For copy-protected disks (or normal disks, actually), you can also
+try running one of the many TRS-80 copy utilities on an emulator,
+copying from a real PC drive to a .DSK image. This will work if the
+copy utility is compatible with the emulator and the physical disk can
+be read by a PC floppy controller. The procedure is generally similar
+to the instructions outlined above, but the details depend on which
+copy utility you're using. I've had good results with SuperUtility
+(available from <a href="http://tim-mann.org/misosys.html"
+>http://tim-mann.org/misosys.html</a>) running under xtrs, and I
+think it runs well under David Keil's emulator too. If you are using
+Model I SuperUtility, be sure to set the emulator to emulate either a
+Tandy or Percom double density adapter, not both at once. The CopyCat
+program available from <a href="http://discover-net.net/~dmkeil/"
+>David Keil's web site</a> is also handy, as it only copies disks and
+is much more automated than SuperUtility. CopyCat works well under
+David Keil's emulator and under xtrs version 4.9 or later. Other copy
+utilities that are sometimes useful include Trakcess and HyperZap,
+though HyperZap has problems analyzing real disks when run under an
+emulator.
+
+<p>(E) Another method is to buy a Catweasel universal floppy
+controller card and copy the disks with it using the cw2dmk program
+from my Catweasel Tools. This method is good for disks that your PC
+can't read. See topic <a href="#[12]">[12]</a> for some reasons why
+your PC may not be able to read certain TRS-80 disks. See topic <a
+href="#[16]">[16]</a> and <a
+href="http://tim-mann.org/catweasel.html"
+>http://tim-mann.org/catweasel.html</a> for more
+information on the Catweasel and the tools.
+
+<hr>
+<H3><A NAME="[7]">
+ [7] How can I convert .DSK files to real TRS-80 floppy disks?
+</A></H3>
+
+<p>There are several possibilities:
+
+<p>(A) One way would be to transfer data from your newer computer to a
+real TRS-80 through its serial port or printer port. That may be the
+only way if you have a Model I, because a stock Model I can read and
+write only single density, but many PCs cannot deal with single
+density (see topic <a href="#[12]">[12]</a>). However, I don't know
+of any software for transferring data <i>to</i> the TRS-80 Model I through a
+serial or parallel port. (Kermit did exist for the Model 4, and you may
+be able to find XMODEM or the like, but I can't help with them.)
+
+<p>(B) A faster and more convenient way, if you can get it to work, is
+to write the disks in a PC with a 5.25-inch floppy drive. If you have Linux
+on your PC and your disk is a standard double-density format (40 or 80
+tracks, 1 or 2 sides), you can use the programs trsfmt and diskdmp by
+Tony Duell, available from
+<a href=
+"http://tim-mann.org/trs80/trsdsk.tar.gz"
+>http://tim-mann.org/trs80/trsdsk.tar.gz</a>.
+See the documentation included in the tar file. If you don't understand
+what to do with .tar.gz files, see the next method instead.
+
+<p>(C) A more general way to write TRS-80 floppy disks in a PC with a
+5.25-inch floppy drive is to use an emulator. Suitable emulators are
+available for both Linux and DOS or Windows. Here is a procedure you
+can follow.
+
+<ol>
+<li>Get a TRS-80 emulator that supports both .DSK files and real
+floppy drives. See topic <a href="#[4]">[4]</a>. Please don't
+say, "But I don't need an emulator, I have a real machine!" You need
+an emulator to run this procedure, and they are nice to have anyway,
+so get one.</li>
+
+<li>Get the files working for you in the emulator as .DSK files. Read
+the instructions for the emulator to find out how to do this.</li>
+
+<li>Find a PC with a real 5.25-inch floppy drive attached. In theory, a
+40-track DD drive is best if your TRS-80 had 40-track or 35-track
+drives, but you can use 80-track HD drives too. (On a PC, 40-track DD
+drives are usually called 180KB or 360KB drives, depending on whether
+they are single or double sided.) The trouble with this theory is
+that DD drives may not work with some emulators, and if your DD drive
+is a pullout from a TRS-80, you may have difficulty cabling and jumpering
+it correctly for a PC.</li>
+
+<li>Bulk-erase a 5.25-inch floppy, preferably using an AC bulk tape eraser as
+sold by Radio Shack and others. You may be able to omit this step if
+you are using a 40-track drive, but it's a good idea to do it anyway.
+It is best to use floppies that are rated for double density or quad
+density, not high density. High density floppies may work in a
+pinch, but don't expect double density data to stay stable on them for
+a long time.</li>
+
+<li>Configure the emulator with an LDOS or other operating system .DSK
+file as drive :0, the .DSK file you want to convert as drive :1, and
+the real drive as drive :2. If you are using a Model I emulator with
+LDOS, note that Model I LDOS comes on two .DSK files, so configure the
+emulator with the second one (LDOSXTRA.DSK) as drive :3. Note:
+never try to use drive :3 for a double-sided disk (read or virtual) on
+the Model I; a limitation of the Model I hardware (which the emulators
+have no choice but to emulate faithfully) makes this fail to work.</li>
+
+<li>Boot the emulated machine. Model I LDOS requires an extra driver
+to deal with double density, so if you are using it, type FDUBL to the
+emulator after booting.</li>
+
+<li>Put the floppy into the real drive and copy the emulated drive
+(.DSK) file to it. If you are using LDOS 5.3.1, the command is QFB :1
+:2. On LS-DOS 6.3.1, the command is DISKCOPY :1 :2. Both those
+commands format the floppy automatically.
+</li> </ol>
+
+<p>The above instructions assume that the disk is in a format that can
+be copied by LDOS. For TRSDOS 1.3 and NEWDOS/80 disks that LDOS
+doesn't understand, you can get a TRSDOS 1.3 or NEWDOS/80 image from
+<a href="http://www.trs-80.com" >http://www.trs-80.com</a>, use that
+as the operating system in the above procedure, and use appropriate
+TRSDOS 1.3 or NEWDOS/80 commands to copy the disk. Sorry; I can't
+help with the details, but see topic <a href="#[23]">[23]</a> for more
+help with NEWDOS/80.
+
+<p>(D) For copy-protected disks (or normal disks, actually), you can also
+try running one of the many TRS-80 copy utilities on an emulator,
+copying from a .DSK image to a real PC disk drive. This will work if the
+copy utility is compatible with the emulator and the physical disk format
+can be written by your PC floppy controller.
+The procedure is generally similar
+to the instructions outlined above, but the details depend on which
+copy utility you're using. I've had good results with SuperUtility
+(available from <a href="http://tim-mann.org/misosys.html"
+>http://tim-mann.org/misosys.html</a>) running under xtrs, and I
+think it runs well under David Keil's emulator too. If you are using
+Model I SuperUtility, be sure to set the emulator to emulate either a
+Tandy or Percom double density adapter, not both at once. The CopyCat
+program available from <a href="http://discover-net.net/~dmkeil/"
+>David Keil's web site</a> is also handy, as it only copies disks and
+is much more automated than SuperUtility. CopyCat works well under
+David Keil's emulator and under xtrs version 4.9 or later. Other copy
+utilities that are sometimes useful include Trakcess and HyperZap.
+
+<p>(E) Another method is to buy a Catweasel universal floppy
+controller card and copy the disks with it using the dmk2cw program
+from my Catweasel Tools. This method is good
+for disk formats that your PC can't write. See topic <a
+href="#[12]">[12]</a> for some reasons why your PC may not be able to
+write certain kinds of TRS-80 disks. See topic <a
+href="#[16]">[16]</a> and <a
+href="http://tim-mann.org/catweasel.html"
+>http://tim-mann.org/catweasel.html</a> for more
+information on the Catweasel and the tools.
+
+<p>(F) If you need a copy of LS-DOS 6.3.1 on a real floppy and have no
+other way to do it, M. A. D. Software will make a diskette for you for
+$7.50 US plus shipping. Paper documentation is included. You can
+request a single-sided or double-sided floppy. This service was
+announced on 19 January 1998. See topic <a href="#[1]">[1]</a> for
+contact information.
+
+<hr>
+<H3><A NAME="[8]">
+ [8] How can I get individual files off a .DSK file or TRS-80
+ floppy disk?
+</A></H3>
+
+<p>Most of the TRS-80 emulators have programs for doing this. Read
+the instructions for your emulator to find out how to use them.
+Sometimes the program runs on the emulated Z-80 (a /CMD file); other
+times it runs on the host operating system (an .EXE file).
+
+<p>Under Jeff Vavasour's Model I emulator, the relevant program is
+VREAD.EXE. Under Jeff's Model III/4 emulator, it is EXPORT/CMD.
+Under Matthew Reed's emulators, the program is TRSREAD.EXE and is
+available only with registration. Under xtrs and David Keil's
+emulators, the program is called EXPORT/CMD (not the same program as
+Jeff's).
+
+<hr>
+<H3><A NAME="[9]">
+ [9] How can I put individual files onto a .DSK
+ file or TRS-80 floppy disk?
+</A></H3>
+
+<p>Most of the TRS-80 emulators have programs for doing this. Read
+the instructions for your emulator to find out how to use them.
+Sometimes the program runs on the emulated Z-80 (a /CMD file); other
+times it runs on the host operating system (an .EXE file).
+
+<p>Under Jeff Vavasour's Model I emulator, the relevant program is
+VWRITE.EXE. Under Jeff's Model III/4 emulator, it is IMPORT/CMD.
+Under Matthew Reed's Model I/III emulator, the program is TRSWRITE.EXE
+and is available only with the registered version. Under xtrs and
+David Keil's emulators, the program is called IMPORT/CMD (not the same
+program as Jeff's).
+
+<hr>
+<H3><A NAME="[10]">
+ [10] What do I do with TRS-80 software that comes in .ZIP files?
+</A></H3>
+
+<p>Some TRS-80 software you will find on the Web is supplied in .ZIP
+archive files. You need to unzip these files to unpack their
+contents. There actually are unzip programs that run on a TRS-80, but
+they're slow and may not support all the compression types used by
+modern zip programs. So you'll generally want to unzip these archives
+on on your PC or Unix box. You can get free unzip programs from <a
+href="http://www.info-zip.org/pub/infozip/"
+>http://www.info-zip.org/pub/infozip/</a>.
+
+<p>Within some .ZIP archives is a .DSK file. This is an emulated
+floppy disk file. See topic <a href="#[5]">[5]</a> and the rest of
+this FAQ for instructions on how to deal with .DSK files.
+
+<p>Other .ZIP archives contain individual files extracted from TRS-80
+disks. You can use these with an emulated (or real) TRS-80 by copying
+the files onto a .DSK file or a real floppy. See topic <a
+href="#[9]">[9]</a> for instructions.
+
+<p>Some .ZIP archives of TRS-80 software may contain both a .DSK
+and the individual files extracted from it. This is perhaps the most
+convenient form, but obviously takes up twice as much space as either
+of the others.
+
+<hr>
+<H3><A NAME="[11]">
+ [11] What are the system file passwords and password back doors
+ on TRS-80 operating systems?
+</A></H3>
+
+<p>The table below is based partly on documentation and partly on
+actual test. Where a filename matches more than one pattern, use the
+first one that matches. If a password doesn't work, try others from
+the table and let me know of the error. If you have password
+information for other Model I/III/4 operating systems, let me know.
+The values in the TRSDOS 6 column should also work for versions of
+LS-DOS prior to 6.3.1.
+
+<pre>
+Files LDOS 5.1.0 LDOS 5.3.1 TRSDOS 6 LS-DOS 6.3.1
+----- ---------- ---------- -------- ------------
+basic/* (unused) basic basic basic
+lbasic/* basic (unused) (unused) (unused)
+config/sys ccc ccc ccc ccc
+*/sys wolves system lsidos system6
+*/flt gsltd filter filter filter
+*/dvr gsltd driver driver driver
+*/dct rrw3 driver utility driver or utility
+*/cmd rrw3 utility utility utility
+*/hlp (unused) help (unused) help
+back door rs0lt0ff rs0lt0ff (nflag$ bit7) (nflag$ bit7)
+</pre>
+
+The password listed as "back door" gives you access to all files
+regardless of what their real passwords are. It's documented! I
+confirmed by looking at the source code that TRSDOS/LS-DOS 6 has no
+such password, but I found that later versions of it have another,
+undocumented back door: if you turn on bit 7 of NFLAG$, all file
+password checking is disabled. The command MEMORY (A="N", B=128) will
+do this. This back door can be found in TRSDOS 6.2 and LS-DOS 6.3.1,
+but not in TRSDOS 6.1.2.
+
+<p>Model I TRSDOS 2.3 also has
+a back door password; the originally intended password is unknown, but
+the string "ubett" hashes to the correct value and can be used.
+The strings "f3gum", "nv36", and many others also work.
+VTOS 3.0 also has such a back door; the password "hadu" can be used.
+
+<p>The password "password" is a standard default in the TRS-80 world.
+If you're insistently prompted for a password in a situation where you
+don't think a password should be needed, try "password".
+
+<p>Another way to reconstruct TRS-80 passwords is through exhaustive
+search. This is quite fast because TRS-80 operating systems hash their
+passwords down to 16-bit values, so you need only find some password
+that hashes to the same value, not the exact original password. Here
+is a C program to do that.
+
+<pre>
+/* trspwhash
+ * Usage: trspwhash password // Hash a password
+ * trspwhash -u 0xhash // Unhash a password to letters
+ * trspwhash -n 0xhash // Unhash a password to letters and digits
+ */
+#include &lt;stdio.h&gt;
+
+unsigned int
+pwhash(unsigned char pw[8])
+{
+ unsigned char *p = &pw[7];
+ unsigned int count = 8;
+ unsigned int hl, t1, t2;
+
+ hl = 0xffff;
+ do {
+ t1 = hl & 0x07;
+ t2 = hl & 0xff;
+ hl = (t1 &lt;&lt; 13) ^ (t1 &lt;&lt; 9) ^ (t1 &lt;&lt; 2) ^
+ (t2 &lt;&lt; 8) ^ (t2 &lt;&lt; 4) ^ (t2 &gt;&gt; 3) ^
+ (hl &gt;&gt; 8) ^ (*p-- &lt;&lt; 8);
+ } while (--count);
+ return hl;
+}
+
+void
+usage()
+{
+ fprintf(stderr, "usage: trspwhash [-u | -n] arg\n");
+ exit(1);
+}
+
+int
+main(int argc, char **argv)
+{
+ unsigned int goal;
+ unsigned char pw[16];
+ int i;
+ if (argc == 2) {
+ strncpy(pw, argv[1], 8);
+ pw[8] = '\0';
+ strcat(pw, " ");
+ for (i = 0; i &lt; 8; i++) {
+ if (islower(pw[i])) pw[i] = toupper(pw[i]);
+ }
+ printf("%04x\n", pwhash(pw));
+ } else if (argc == 3 && strcmp(argv[1], "-u") == 0) {
+ goal = strtoul(argv[2], (void*)0, 0);
+ strcpy(pw, " ");
+ for (;;) {
+ if (pwhash(pw) == goal) printf("%s\n", pw);
+ i = 0;
+ for (;;) {
+ switch (pw[i]) {
+ case ' ':
+ pw[i] = 'A';
+ break;
+ case 'Z':
+ pw[i] = 'A';
+ i++;
+ if (i == 8) exit(0);
+ continue;
+ default:
+ pw[i]++;
+ break;
+ }
+ break;
+ }
+ }
+ } else if (argc == 3 && strcmp(argv[1], "-n") == 0) {
+ goal = strtoul(argv[2], (void*)0, 0);
+ strcpy(pw, " ");
+ for (;;) {
+ if (pwhash(pw) == goal) printf("%s\n", pw);
+ i = 0;
+ for (;;) {
+ switch (pw[i]) {
+ case ' ':
+ pw[i] = 'A';
+ break;
+ case 'Z':
+ pw[i] = '0';
+ break;
+ case '9':
+ pw[i] = 'A';
+ i++;
+ if (i == 8) exit(0);
+ continue;
+ default:
+ pw[i]++;
+ break;
+ }
+ break;
+ }
+ }
+ } else {
+ usage();
+ }
+ return 0;
+}
+</pre>
+
+<hr>
+<h3><a name="[12]">
+ [12] What problems do PC floppy disk controllers have with TRS-80
+ disk formats? What problems do different TRS-80 models have with each
+ other's disk formats?
+</a></h3>
+
+<p>The Western Digital 177x/179x floppy disk controllers that were
+used in TRS-80s have some capabilities that PC disk controllers
+generally lack. The executive summary is that (1) many standard PC
+floppy controllers can't handle single density at all, (2) even those
+that can handle single density generally cannot read the directory
+track on a Model I TRSDOS disk, and (3) there can also be problems
+reading double density disks. Here are more details.
+
+<p>Many PCs cannot handle single density (FM) encoding. The original
+Model I used single density exclusively, and even a Model I with a
+double density adaptor requires a single density boot sector on system
+disks. The original IBM PC controller required extra outboard
+components to support clock/data separation for single density, but
+IBM left them off to reduce their manufacturing costs. (So I'm told;
+I wasn't involved with PCs in that era.) This started the tradition
+of leaving out single density support in PCs. Modern PCs use more
+highly integrated IO chips that include data separation on the chip,
+but many still omit single density support. See topic <a
+href="#[15]">[15]</a> for a rundown on what PC controllers support
+single density and topic <a href="#[16]">[16]</a> for other hardware
+solutions that are available.
+
+<p>The WD1771, used in the TRS-80 Model I, is able to read and write
+single-density sectors with nonstandard data address marks (DAMs) 0xF9
+and 0xFA, as well as the standard ones 0xFB (data) and 0xF8 (deleted
+data). The WD1791/1793 and later chips, used in the Model III and 4,
+can read all such sectors, but cannot distinguish between 0xFB
+and 0xFA or between 0xF9 and 0xF8. Model I's with double density adaptors
+have *both* controllers, and use the 1771 for single density, so they
+are fully compatible with stock Model I's. PC disk controllers, even
+those that do single density, cannot read sectors that use the 0xFA or
+0xF9 DAM at all. (I have actually tested this only with 0xFA on a
+PC87306. I'd welcome corrections if other standard PC controllers can
+handle these data address marks.) See topic <a href="#[16]">[16]</a>
+for devices that can read these disks.
+
+<p>These differences would be no problem if Model I software did not
+actually use the nonstandard DAMs, but unfortunately, it does. In
+particular, Model I TRSDOS 2.x distinguishes between normal data
+sectors and directory sectors by using 0xFB for the former and 0xFA
+for the latter. On Model III/4 TRSDOS-like systems, where 0xFA is not
+fully supported, 0xF8 is used instead.
+Some later Model I systems (such as LDOS 5.0.2 and later) also
+switched to 0xF8 on the directory to allow for direct media
+compatibility with the Model III/4, while others stuck with 0xFA for
+direct Model I TRSDOS compatibility. Patches for TRSDOS 2.3 were
+developed that allow it to read and/or write 0xF8 directory sectors,
+but they were not widely used. (See topic <a href="#[13]">[13]</a>.)
+Special software is supplied with
+Model III/4 operating systems that allows them to read Model I disks
+and/or convert them to Model III/4 format. (The REPAIR command on
+LDOS is an example of the latter.) No such software can work on a PC
+controller, however, because the 0xFA sectors cannot be read at all.
+
+<p>There are also many gratuitous format differences amongst the
+various TRSDOS-like TRS-80 operating systems. For most of the
+systems, a single-density, single-sided, 35-track disk is a common
+denominator, except for the DAM problem just discussed. Adding more
+tracks is usually not a problem, though some systems may insist that
+the directory remain on track 17, while others put the directory
+location in track 0, sector 0, byte 2. The various systems diverged
+in the way they generalized the format to work with double density and
+other larger drives. The main streams were LDOS, NEWDOS, and Model
+III TRSDOS 1.3. LDOS uses a variable number of sectors per granule
+(allocation unit) that must evenly divide the number of sectors per
+track, and uses exactly one cylinder for the dirctory. I believe
+NEWDOS always uses 5 sectors per allocation unit, but allows varying
+the packing of granules onto the disk and the number of granules used
+for the directory. Model III TRSDOS 1.3 made a large number of
+unnecessary changes to the format; it was clearly inspired by the Model
+I format, but it is not a compatible extension.
+
+<p>Many PC disk controllers have difficulty reading double density
+disks formatted by older releases of TRS-80 operating systems, even
+with the proper software on the PC. Many TRS-80 operating systems
+formatted the disks with too short a gap between the index hole and
+the first sector. Late releases of the
+Model III and 4 operating systems were corrected to format floppies
+with the proper gap lengths.
+
+<p>Working around the index hole problem can be tricky. With some
+drive/controller combinations, it may work to put a piece of tape over
+the index hole, but this is not usually successful. Another
+possibility is to read the disk with a Catweasel controller, if you
+have one; see topic <a href="#[16]">[16]</a>.
+Here are instructions for another approach, from Amardeep S. Chana:
+
+<ol>
+<li>Locate wire number 8 in your floppy disk cable. Wire 1 normally
+has a colored stripe, and the wires are numbered sequentially from
+there.
+
+<li>Cut this wire and install a switch so you can connect and
+disconnect this wire easily.
+
+<li>Use one of the more reliable pieces of software to attempt a read
+on a real 360K drive:
+ <ol>
+ <li>xtrs
+ <li>DMK emulator
+ <li>Anadisk or Teledisk
+ </ol>
+READDISK is not very reliable; it is too sensitive to
+controller/drive combinations.
+
+<li>First attempt a read with the switch closed. You will get an
+error. Then open the switch and retry. If it is a post index sector
+gap problem, this will fix it.
+
+<li>Note that you must always first try with switch closed and then
+retry. The software doesn't initialize the controller properly if you
+just always leave the switch open. That wire is the index sense line.
+After at least one pulse has been detected, the system no longer needs
+index pulses for reads and the rest of the diskette should read fine.
+</ol>
+
+<p>Nick Andrew adds that with older drives (such as original TRS-80
+drives), the drive itself does not need to see the index pulse, but
+the PC controller may still need to see at least one pulse to get
+started. In this case you can do without the switch; instead, insert
+a piece of cardboard alongside the disk after the first attempted
+access, positioning it so as to block the index hole sensor.
+
+<hr> <h3><a name="[13]"> [13] How can TRSDOS 2.3 be patched to read
+single-density disks written by a Model III, Model 4, or PC? </a></h3>
+
+There is a one-byte patch to TRSDOS 2.3 that allows it to read
+disks written with standard data address marks (0xF8 and 0xFB instead
+of 0xFA and 0xFB; see topic <a href="#[12]">[12]</a>). If you can
+find a PC that supports single density (many do not), you could use an
+emulator to make Model I disks on it, which you could then read on the
+Model I with the help of this patch. The patch is also useful if for
+some reason you need to make Model I disks on a Model III or 4. For
+instance, suppose you have a PC that can't write single density, but
+you also have a real Model III or 4, which can. In that case, you could
+copy software to a double density disk on the PC, then copy the double
+density disk to single density on the Model III or 4.
+
+Here's a description of the patch, from the Misosys EDAS manual.
+(EDAS was distributed on a Model III/4-compatible disk that Model I
+TRSDOS couldn't read without the patch.) If you want to apply the
+patch on a Model III or 4 before moving the disk over to a Model I,
+you can use Method (1), changing the drive number in line 10 as
+needed. <b>New:</b> I've also added a section to Method (1) that will
+let the modified disk boot even if its own directory track has 0xF8
+data address marks.
+
+<h4>Model I TRSDOS 2.3 Patch</h4>
+
+<p>Model I TRSDOS users will find difficulty in reading the distribution
+disk due to the data address mark used for the directory. Therefore, before
+making a BACKUP or copying EDAS files from the diskette, you will need to
+change one byte of the TRSDOS 2.3 disk driver using one of the following
+three methods. This change will not affect the operation of your TRSDOS.
+
+<p>Method (1) directly modifies the system diskette with a patch. To
+prepare for this patch, obtain a fresh BACKUP of your TRSDOS 2.3 to use for
+this operation. Then enter the following BASIC program and RUN it. After you
+RUN the program, re-BOOT your TRSDOS diskette to correct the byte in memory.
+
+<pre>
+ 10 OPEN"R",1,"SYS0/SYS.WKIA:0"
+ 20 FIELD 1,171 AS R1$, 1 AS RS$, 84 AS R2$
+ 30 GET 1,3: LSET RS$="&lt;": PUT 1,3: CLOSE
+</pre>
+
+<p><i>Added 10-18-2000:</i> If you are using this patch on a TRSDOS
+2.3 disk that itself has 0xF8 data address marks, the disk will not
+boot unless you also patch the boot sector. You can do so by adding
+the following lines to the program. Methods (2) and (3) will not work
+for this purpose. You might get the message "INTERNAL ERROR IN LINE
+60" when you run the program, for unknown reasons, but it works anyway.
+
+<pre>
+ 40 OPEN"R",1,"BOOT/SYS.WKIA:0"
+ 50 FIELD 1,220 AS R1$, 1 AS RS$, 35 AS R2$
+ 60 GET 1,1: LSET RS$=CHR$(28): PUT 1,1: CLOSE
+</pre>
+
+<p>Method (2) uses DEBUG to change the byte in memory. Use this if you do
+not want to patch your TRSDOS system diskette and are familiar with DEBUG.
+
+<ol>
+ <li>At TRSDOS Ready, type DEBUG followed by &lt;ENTER&gt;.
+ <li>Depress the &lt;BREAK&gt; key to enter the DEBUGger.
+ <li>Type M46B0 followed by the &lt;SPACE&gt; bar.
+ <li>Type 3C followed by &lt;ENTER&gt;.
+ <li>Type G402D followed by &lt;ENTER&gt;.
+</ol>
+
+<p>Method (3) uses a POKE from BASIC to change the value directly in
+memory. This procedure is as follows:
+
+<ol>
+ <li>Enter BASIC (files = 0, protect no memory)
+ <li>Type POKE &H46B0,60 followed by &lt;ENTER&gt;.
+ <li>Type CMD"S" followed by &lt;ENTER&gt;.
+</ol>
+
+<hr> <h3><a name="[14]"> [14] What are the differences among single,
+double, quad, and high density floppy media? </a></h3>
+
+<p>There is essentially no difference between single and double
+density media (if you can actually find any single density media
+anymore). Double density media has been tested and certified for
+double density recording, which is slightly more demanding than single
+density recording; conceivably, a dropout that might not be noticed in
+single density could be a problem in double density. In practice,
+though, I suspect that back in the days when manufacturers sold both
+DD and SD media, the media came off the same production line and the
+SD media would have met the DD standard nearly all the time.
+
+<p>"Quad density" 5.25-inch media is certified for double density recording
+at 80 tracks per side rather than 40 tracks per side. This is quite
+different from "high density," discussed below. 80 TPS quad density
+media should work fine at 40 TPS double density. I've been told that
+there can be problems using 40 TPS double density media at 80 TPS quad
+density; I believe the person who told me this, but neither of us
+really knows the reason. All 3.5-inch media is certified for 80 TPS.
+
+<p>You will also sometimes see media labelled as one-sided or
+two-sided. Both types have magnetic material on both sides, but on
+the disks advertised as one-sided, the second side may not have been
+tested. It's even possible, though unlikely, that the second side was
+tested and failed.
+
+<p>Occasionally you'll find a "flippy" 5.25-inch disk. Such a disk
+can be recorded on both sides by removing it from the drive and
+flipping it over. It has two separate write-protect notches and two
+separate index hole cutouts in the jacket. Sometimes users would make
+their own flippy disks with a hole punch.
+
+<p>There were also a few "flippy drives" made. These had two
+write-protect sensors and two index-hole sensors, and they could thus
+read and write on the reverse side of an ordinary diskette inserted
+into the drive upside-down. If you have disks written in a flippy
+drive but you don't have a flippy drive, the reverse side will be
+quite hard to read. See topic <a href="#[26]">[26]</a> for ways to do
+it.
+
+<p>"High density" media is very different, and should not be
+interchanged with single/double/quad density media. It has different
+magnetic properties (higher coercivity, requiring a higher write
+current from the disk drive). If you try to format DD media as HD,
+the media will be too strongly magnetized and bleed-through can occur,
+garbling your data either immediately or after the disk has sat on the
+shelf for a while. Such a disk may also be difficult to erase and
+rewrite with new data. Similarly, formatting HD media as DD is not a
+good idea either; the media will be too weakly magnetized, and your
+data may be completely unreadable or may fade away after a while.
+These problems are worse on 5.25-inch disks than on 3.5-inch disks because the
+difference in coercivity is greater for 5.25-inch media, but they exist
+for both types of disk.
+
+<p>You can distinguish between 3.5-inch HD and DD media by looking for a
+hole in the jacket on the opposite edge from the write-enable hole; HD
+media has the extra hole, while DD media does not. You cannot
+reliably distinguish between 5.25-inch HD and DD media if they are not
+labelled. There are a couple of ways of guessing: DD media usually
+has a hub reinforcing ring (but not always), while HD media generally
+does not. The color of the media also tends to be different; HD media
+is darker.
+
+<hr> <h3><a name="[15]">[15] Which PC floppy controllers and drives can handle
+single density (FM)?
+</a></h3>
+
+<p>Some folks will tell you that you need an older PC to get single
+density (FM) support. This is wrong. The floppy disk
+<strong>controllers</strong> in many PCs being produced today support
+FM, and many older ones do not. Some controllers will support FM on
+all floppy <strong>drives</strong>, while other controllers have
+problems with 5.25-inch 1.2MB HD drives and may require you to change a
+jumper in the drive or (more likely) use a 5.25-inch 360K DD drive instead.
+
+<p>If you need to read and write single density disks, the best thing
+to do is to try it on the PCs that you have available and see if you
+can find one where it works. This is more accurate and usually easier
+method than opening up the box and peering at the part number on the
+FDC or SuperIO chip (which might not give you a definite answer
+anyway). If you can't find one that works, the information below
+and in topic <a href="#[16]">[16]</a> may be of some help.
+
+<p>The detailed information below was gleaned from newsgroup
+and Classic Computer mailing list postings by Amardeep S. Chana, Don
+Maslin, Pete Cervasio, Allison Parent, Tony Duell, Nick
+Andrew, and Knut Roll-Lund, together with some knowledge of my own.
+I've liberally borrowed from their words for this answer. Don't take
+this listing as absolute truth; in particular, some of the posters
+were not in full agreement on some points! Feel free to send
+additions or corrections if you have some information.
+
+<p><strong>Controllers</strong> The answer to the question "does floppy
+disk controller chip X support single density (FM)?" can be "yes",
+"no", or "implementation dependent" (that is, "maybe"). With early
+controllers, the answer was "maybe", because more external components
+were needed to handle data separation for both FM and MFM than for MFM
+alone. As mentioned in topic <a href="#[12]">[12]</a>, the original
+IBM PC omitted the external components needed to support FM, and many
+later compatibles followed suit. Modern controllers typically
+integrate data separation on the main chip, but some support FM and
+some do not. It seems that in some cases, a PC may be able to read
+single density but not write it, or it may be able to read and write
+but not format; these behaviors may depend on external components, not
+just the controller chip.
+
+<p>Note: if you are going to use this information, do not rely on
+software to identify your FDC chip. Open the box and look. Newer
+"compatible" chips often look to software like older chips, but the
+status of their FM support may be different.
+Also, be aware that the information below may be incomplete or wrong in
+some details. If you know more, send mail.
+
+<p><strong>Drives</strong> In principle, all floppy disk drives support
+single density; the drive cannot tell whether you are giving it FM or
+MFM encoded data. However, it seems that some controllers cannot do
+FM on 5.25-inch drives that spin at 360 RPM, only on drives that spin at
+300 RPM. Doing FM on a 360 RPM 5.25-inch drive requires a data rate of
+150 Kb/s, which apparently is not implemented in some controllers.
+Most 5.25-inch 1.2MB HD drives spin at 360 RPM at all times, but some are
+dual spindle speed. A dual spindle speed drive spins at 360 RPM for
+HD but slows down to 300 RPM for SD and DD. Teac 5.25-inch drives can
+generally be set for dual spindle speed by changing a jumper, but
+other brands may not have this ability.
+
+<p>Unfortunately, we did not understand the rotation speed issue when
+gathering most of the information below. It's quite possible that
+some controller that are recorded as not supporting FM at all were
+actually tried only with 360 RPM 5.25-inch drives, and would have worked with
+300 RPM 5.25-inch drives. It's also possible that some controllers that are
+recorded as supporting FM were only tried with 300 RPM 5.25-inch drives and
+won't work with 360 RPM 5.25-inch drives. This could also explain why different
+people reported inconsistent results for some controllers.
+
+<h4>Will not support single density (FM)</h4>
+<ul>
+<li>Intel 82078
+<li>Intel 82091AA Super I/O
+<li>Goldstar Prime 1 (?)
+<li>NS PC87332 Super I/O (?)
+<li>Motorola MCS3201FN (?)
+</ul>
+
+<p>The Intel 82078 data sheet implies that the parts do not support
+single density. The MFM bit in its command set is defined as (1 =
+double density mode, 0 = reserved). On PC FDCs that do support FM,
+setting this bit to 0 selects FM. Tim had a system that used a 82078
+on the motherboard, and FM did not work on it (he tried only a 360 RPM
+drive). Similar wording is used on the 82091AA data sheet.
+
+<p>Amardeep has a card with the Goldstar "Prime 1" chip and
+it does not read or write FM.
+
+<p>The NS PC87332 data sheet is not specific about whether FM is
+supported. Amardeep tested the PC87332 and it failed to support FM in
+a Dell XMT590.
+
+<p><i>Amardeep says:</i>
+I found a board with the Motorola MCS3201FN and it doesn't do FM. The
+data sheet contains much contradictory information. Verbiage only declares
+compatibility with IBM system 34 double density. But it also says the MFM
+bit is (1 = MFM, 0 = FM) and selection tables show various FM data rates and
+sector sizes. The electrical characteristics show only double density
+ratings.
+<i>Don says:</i>
+The two examples that I have been exposed to
+suggest that it does not support FM.
+
+<h4>Will support single density (FM)</h4>
+<ul>
+<li>NS PC87306 Super I/O
+<li>NS PC87307/PC97307 Super I/O
+<li>SMC FDC37C65
+<li>SMC FDC37C78
+<li>Intel 82077AA
+<li>Intel 82077SL
+<li>NS 8477
+<li>Goldstar Prime 2c or 3b
+</ul>
+
+<p>The above NS and SMC parts are completely
+stand alone with on board filters, write precomp generators, and data
+separators. They should work with FM in any board implementation,
+unless something specific is done to prevent it (not likely). This is
+per the National and SMSC (new name for SMC semiconductor) data
+sheets. Amardeep tested the NS PC87306 and SMC FDC37C65 using Jeff
+Vavasour's Model 4 emulator and Tim Mann's xtrs 2.8 under Linux. They
+both read and write FM with no problems. It is important to verify
+the part number on the chip itself. Many of the newer NS parts
+will identify themselves to software as PC87306, but may not
+support single density.
+
+<p>Tim has a machine that uses the NS PC97307, and FM works just fine
+on it. Tim used a 360 RPM drive, so 300 RPM drives should work with
+this chip too. The PC87307/PC97307 data sheet is not specific about
+whether FM is supported. Note that some software may incorrectly
+identify these parts as PC87306.
+
+<p>The Intel 82077AA and 82077SL data sheet clearly states these parts
+support FM. Again, verify the part number on the chip. Newer Super
+I/O parts like Winbond W83877F or SMC FDC37C665IR may identify
+themselves to software as 82077's but may have different characteristics.
+
+<p>The NS 8477 data sheet indicates that it does support FM (it is
+functionally and pin for pin compatible with the Intel 82077).
+
+<p>A sewing machine/embroidery website
+mentioned that "Goldstar Prime 2c or 3b chipset" controller cards can
+be used to read single density embroidery diskettes. The URL is
+<a href="http://www.wilcom.com.au/stestdsk.htm"
+>http://www.wilcom.com.au/stestdsk.htm</a>.
+
+<h4>Implementation dependent</h4>
+<ul>
+<li>NS 8473
+<li>NEC 765
+<li>Intel 8272
+</ul>
+
+<p>This category is meant for older chips that require external
+components as part of the data separation logic (or that require
+external components if FM is to be supported). Thus they may
+or may not support FM depending on the implementation.
+
+<p>The 1988 data sheet for the NS 8473 states on page 8-32, "While the
+controller and data separator support both FM and MFM encoding, the
+filter switch circuitry only supports the IBM standard MFM data rates.
+To provide both FM and MFM filters external logic may be necessary."
+<i>Don says:</i> I have DTK FDC cards with the 8473 and read Osborne 1
+disks with them just prior to writing this. <i>Amardeep says:</i> I
+have to recant my original statement that none of my 8473 boards
+worked. All three of them do work (read/write/format) at this time.
+Must have been an error on my part.
+
+<p>I believe the 765 was the chip in the original IBM PC, as discussed
+above. <i>Amardeep says:</i> Intel 8272 is a NEC 765 clone and
+therefore dependent on implementation.
+
+<h4>Uncertain</h4>
+<ul>
+<li>SMC FDC37C665IR
+<li>SMC FDC37C665GT/FDC37C666GT
+<li>Winbond W83877F, 977TF, 83977EF, or other Winbond parts
+<li>UMC 8397
+<li>UMC 8398
+<li>UMC UM82C862F or other UMC Super I/O chips
+<li>WD 37C65
+</ul>
+
+<p>Available information on these chips is contradictory. Perhaps
+some individual chips of the same part number work with FM and some
+don't, perhaps they have bugs that affect some software drivers and
+not others, or perhaps there is a 300 RPM vs. 360 RPM problem in some
+cases. More testing may be needed.
+
+<p>The FDC37C665GT and FDC37C665IR have very similar data sheets, and
+neither mentions that FM is not supported. However, Pete has an
+FDC37C665IR in one of his machines, and FM works on it; while Tim has
+an SMC FDC37C665GT in one of his machines, and its FM support does not
+work---it can neither read FM nor format FM disks that can be read by
+other systems. Tim was using a 360 RPM drive, and Pete did not report
+what kind of drive he was using, so it's possible that this was the
+issue.
+
+<p>Amardeep says that the Winbond chips have never worked in FM on any
+adapter or motherboard he's ever encountered them on; no idea if it's
+the chip or the implementation. Pete says that on his ASUS board, the
+Winbond W83877F actually will read and write FM but will not format
+FM. Nick Andrew says that the Winbond 83977EF could only read some
+sectors when he tried it with xtrs. Steve Tate said that a W83877AF
+worked fine for him using 22disk.
+
+<p><i>Tony says:</i> The data sheet claims the UMC 8398 will do FM or
+MFM. In my experience it will correctly handle MFM disks (with both
+standard and my own software). When you try FM, it <i>almost</i>
+works. It just mangles the last byte in the sector. This is
+(apparently) a known problem with this chip. <i>Allison says:</i>
+The last byte mashed in the UMC is also common to most 765s and is related
+to DMA read/write timing such that if you delay the DMA request by about
+1-3uS (several FDD bit times) in FM mode it should work fine.
+<i>Amardeep says:</i> The UMC 8398's data sheet says it
+does support FM without any external components. Also, the 8397 could be
+listed with it. It was the predecessor without high density drive support
+for XT applications. Its data sheet also says FM support is provided.
+Since Tony's and my testing shows FM tends to fail, and Allison believes it
+is DMA related, "uncertain" may be the best category for them.
+
+<p><i>Amardeep says:</i> UMC did make some Super I/O chips (UM82C862F)
+but I couldn't find data sheets for them. I have two IDE/FDC/IO
+paddle boards with that chip and neither handles FM. <i>Allison
+says:</i> I have used UMC SuperIO chips to do FM with ease using the
+internal data separator.
+
+<p><i>Don says:</i> I have the WD 37C65 in the WD FOX card and
+it will also read/write FM. <i>Amardeep says:</i> The only information
+I have on the WD 37C65 is the Always IN2000 card I have with that
+chip cannot read or write FM. The data
+sheet shows there is really no external circuitry associated with data
+separator or filters. Yet we have seen examples that pass and fail, so it
+might be a revision thing or an untested feature, or DMA mangling or...
+
+<hr> <h3><a name="[16]"
+>[16] What PC add-on cards can read single density (FM) and
+ other unusual formats?
+</a></h3>
+
+<p>Several different types of add-on floppy controller cards
+are available for the PC that will let you read floppy formats that
+your built-in controller may not be able to handle, such as single
+density (FM).
+
+<p>Sometimes an add-on floppy card will have a 765-compatible floppy
+controller that supports FM. The Adaptec AHA1542CF SCSI hard disk
+controller includes a floppy disk controller on the same card that
+supports FM and works with both 300 RPM and 360 RPM drives; so do some
+other Adaptec cards. This card is easy to use; you just plug it into
+any spare ISA slot and disable your motherboard FDC.
+
+<p>The Catweasel universal floppy disk controller (see <a
+href="http://www.jschoenfeld.com/" >http://www.jschoenfeld.com/</a>)
+uses custom hardware that
+can be programmed to handle just about any format. The software that
+comes with the Catweasel can read Amiga, Apple II, and a bunch of
+other obscure old formats. I've written a program for the Catweasel
+that can copy any disk written by a TRS-80 to the DMK image format
+(see topic <a href="#[5]">[5]</a>, including single density and
+"copy-protected" disks. It supports both 300 RPM and 360 RPM drives.
+The program is now available on the Web at <a
+href="http://tim-mann.org/catweasel.html"
+>http://tim-mann.org/catweasel.html</a>. It runs on Linux,
+MS-DOS, and Windows 95; probably also Windows 98 and Windows ME. It
+is untested on other versions of Windows, but probably will not run on
+versions that keep tighter control over the hardware such as NT, 2000,
+and XP; however, you can use it by booting off an MS-DOS floppy.
+Catweasel cards were in short supply for a while, but as of July 2000
+they should be available for purchase again.
+
+<p>I've heard people mention the
+MicroSolutions CompatiCard, but the
+<a href="http://www.faqs.org/faqs/CPM-faq/"
+>CP/M FAQ</a> says that it is a
+discontinued product, so you'd have to find a used one somewhere.
+I don't know what chip it uses.
+
+<p>The <a href="http://retro.icequake.net/dob/" >Central Point Copy II
+PC Option Board</a> uses a custom chip and can copy many kinds of
+disk, including FM, MFM, GCR, and even disks that used the "weak
+bits" method of copy protection. This is also a discontinued product.
+I had one of these on loan for a while and read the documentation, but
+never found time to install it in a machine and try it.
+
+<p>I've heard that add-on floppy controller cards for the PC that are
+specifically intended for disk duplication or for converting disks
+from other kinds of machines often use Western Digital 17xx chips or
+custom hardware that is more versatile than standard PC controllers.
+I don't know specific model names or where to get these cards.
+
+<hr><h3><a name="[17]">
+[17] How can I add lowercase to a TRS-80 Model I?
+</a></h3>
+
+<p>Displaying lowercase letters on a TRS-80 Model I requires both a
+hardware modification and a software driver. If you aren't sure
+whether you have the hardware modification, go into Basic and type
+"POKE 15840,98". If you have lowercase, you will see a lowercase "b"
+in the middle of the screen; if not, you will see a quotation mark.
+If you need the hardware modification, the next section describes how
+to install it; if not,
+<a href="#lcdrivers">skip down</a> to the section about software
+drivers.
+
+<h4>Lowercase hardware modification</h4>
+
+<p>A stock Model I has only 7-bit wide video memory. This is enough
+for 6-bit, uppercase-only ASCII and the TRS-80's 6-bit graphics
+characters, but not for lowercase. In a stock machine, the missing
+bit6 is synthesized as !bit7 & !bit5. You can add a true 8th bit
+using the following instructions.
+
+<p>You will need a low-power soldering iron, thin rosin-core solder, thin
+insulated copper wire (such as wire-wrap wire), one 2102 static memory
+chip (1K x 1 bit) and preferably a new character generator ROM.
+The character generator replacement is needed to make the modified machine
+compatible with the Level II Basic ROM's display driver and to give it true
+descenders on lowercase letters. If you don't have a new character generator,
+you will need to install an SPDT switch to turn off the mod when using
+Level II Basic or other software that doesn't have a lowercase driver,
+and your lowercase g, j, p, q, and y (and maybe a) will be shifted up
+a couple of pixels from the baseline.
+
+<p><i><strong>New:</strong></i>
+M.A.D. Software is advertising Model I lowercase
+modification assemblies on their
+<a href="http://madsoft.lonestar.org/garage/">Garage Sale page</a>!
+These should include the 2102 and the character generator ROM, but
+check with M.A.D. Software before ordering to be sure.
+
+<p>Turn your TRS-80 keyboard unit face down on a cloth, and remove the six
+bottom screws, being careful to note which went where. Now turn it face
+up and lift off the cover. Lift up the keyboard, being careful not to
+pull the ribbon cable at the left front loose. Remove the plastic spacers
+between the two boards, and lift out the boards, setting them down with
+the component side of the logic board up.
+
+<p>Find Z45 in the lower left corner of the board. The new 2102 will be
+mounted piggyback over this one. Bend pins 11 and 12 of the new 2102
+straight out, and set it over Z45. Solder (quickly, with low heat) each
+pin of the new 2102, except 11 and 12, to the corresponding one on Z45.
+
+<p>Find Z30. From its left side run three traces, a narrow one between
+two wide ones. Cut through the narrow one with a sharp knife, being
+sure to break the connection completely without damaging other traces.
+(This trace connects Z30 pin 13 to Z60 pin 4.)
+
+<p><i>If you don't have a replacement character generator:</i> Find a
+mounting place for the SPDT switch where you will be able to get to it
+after the case is reassembled. Run a wire from pin 11 of the new chip
+to Z60 pin 5. Run a second wire from Z60 pin 4 to the common terminal
+of the switch. Run a third wire from another terminal of the switch to
+Z30 pin 13. Run a fourth wire from the remaining terminal of the
+switch to the new chip's pin 12. One switch position will now give you
+uppercase only but will work with Level II Basic; the other will give
+you lowercase in software that has a lowercase driver and meaningless
+symbols in software that doesn't.
+
+<p><i>If you do have a replacement character generator:</i> Run a wire
+from pin 11 of the new chip to Z60 pin 5. Run a second wire from pin
+12 of the new chip to Z60 pin 4. Remove the old character generator
+ROM chip (Z29) and replace it with the new one. I think Z29 was
+socketed, but if it isn't, you will have to very carefully desolder it
+without overheating the PC board and making the traces lift, and
+preferably without overheating the old chip in case you need to use it
+again. I suggest installing a socket for the new chip.
+
+<p>Reverse the disassembly procedure to put your machine back together. If
+you kept the old CG ROM and installed a switch, try both switch positions
+to see what they do. If anything doesn't work, go back and carefully
+recheck your wiring.
+
+<h4><a name="lcdrivers">Lowercase software drivers</a></h4>
+
+<p>The display driver in the Model I Level II Basic ROM forces everything to
+upper case. In fact, it actually writes ASCII codes between 0x00
+and 0x1f into the video RAM and expects them to display as uppercase
+letters. That's why you get meaningless symbols if you don't replace
+the character generator: the standard character generator has those
+symbols in positions 0x00 to 0x1f, but you can't see them until you
+add the 8th bit of video memory.
+
+<p>TRSDOS uses the ROM driver, but alternative operating
+systems like LDOS and Newdos include a lowercase driver, as do
+many other programs. Usually these programs will detect and use
+lowercase automatically if it is present.
+
+<p>It is possible to add a lowercase driver to TRSDOS or even to
+cassette-based Level II Basic. In the future I'll probably add
+a listing of such a driver here.
+
+<hr>
+<H3><A NAME="[18]">
+ [18] My Model 4 or 4P has video problems in Model 4 mode, but
+ is fine in Model III mode. How can I fix it?
+</a></h3>
+
+This answer is based on material contributed by David Gish
+(gish@gomemphis.com) and others.
+
+<p>The model 4/4P uses two different methods for generating horizontal
+sync pulses for the monitor, depending on whether it's in 64 character
+mode (Model III) or 80-character mode (Model 4). In 64-char mode,
+horizontal sync is derived from the master clock, which is regulated
+by a crystal and thus very stable. However, in 80-char mode a
+Phase-Locked Loop circuit (PLL) is used to generate the signal, and it
+drifts out of calibration over time. This can result in display
+wrap-around or a total loss of sync. There is a trimmer capacitor that
+can be adjusted to fix it.
+
+<p>The biggest problem in making the adjustment is getting to it with
+the power turned on so that you can see what you're doing. The trimmer
+cap is on the motherboard, with no access from outside the case. On
+the Model 4, it's near the top at the back, but the case and a metal
+shield are in the way. On the Model 4P, it's near the front of the
+CRT, but just far enough under it that you can't get to it with a pot
+tweaker.
+
+<p><i>If some of the terms below leave you behind or the procedure sounds
+scary, you should definitely not tackle this yourself -- take it to a
+friend who's a hardware techie. Warning: whenever you have the case
+open, be careful what you touch, especially with metal objects.
+You can get a shock even if power is off, and if power is on, a metal
+object touching the wrong two contacts could easily short out the power
+supply and fry it.</i>
+
+<h4>Model 4</h4>
+
+<p>1. Unplug all cables from the computer. Position the computer on its
+back panel to provide access to the case bottom. Remove the ten
+screws from the case bottom, noting carefully which went where for
+later reassembly.
+
+<p>2. Position the computer upright and remove the screw and washer
+from the top of the back panel.
+
+<p>3. Position the computer upright with the video screen towards
+you. <i><strong>Very carefully</strong></i> remove the case top,
+lifting straight up, looking into the case through the vent holes and
+the disk bay openings to be certain that you do not catch
+the neck (back end) of the picture tube on anything. It is all too
+easy to break the picture tube, a very expensive mistake. Once the
+tube is clear, rotate the case top 90 degrees counterclockwise
+and set it down to the left of the base, being careful not to
+overstretch the connecting cables.
+
+<p>4. Remove the internal metal shields as needed to gain access to
+the main circuit board.
+
+<p>5. Turn the machine on and boot it into Model III (64-column) mode.
+It's adequate to go into cassette Basic by holding down the Break key
+and pressing the orange reset button. Type enough commands to fill
+the screen with text.
+
+<p>6. Adjust the monitor's horizontal sync back and forth until the picture
+breaks up in both directions, then set the adjustment to the middle of
+this range. This completes the Model III mode adjustment.
+
+<p>7. Insert a TRSDOS-6.x disk and boot the system to place it in 80-column
+mode. Type the date and then do a DIR to fill the screen edge-to-edge (if
+the screen's unreadable, you'll have to type blind).
+
+<p>8. Find the trimmer cap. Early (non-gate-array) versions may not
+have this cap; it does not appear in the Model 4 Technical Reference
+Manual, 1983 edition. Hopefully this video problem does not occur on
+those machines. On gate array machines, it should be approximately
+3 inches from the left of the main circuit board when viewed from the
+back, and should be labelled C210.
+
+<p>9. Adjust the trimmer. You'll need a small pot tweaker, preferably
+a non-metallic one. You shouldn't have to adjust it much; it's very
+sensitive. Turn the brightness up so you can see the whole raster
+pattern and set the trimmer so that the image is stable and centered
+in the pattern, with no bent or warped edges.
+
+<p>10. Turn the power off and unplug the machine.
+
+<p>11. Reassemble the machine -- you did pay attention to how it came
+apart, didn't you? Again be very careful not to damage the picture
+tube.
+
+<h4>Model 4P</h4>
+
+<p>1. Remove the case and front bezel. The main case is held on by screws
+near the front and two large ones under the handle. The front bezel is
+held on by several screws inside the case.
+
+<p>2. Remove the top of the monitor enclosure.
+
+<p>3. Turn the machine on and boot it into Model III (64-column) mode,
+or just reboot it with no disk and wait for the multi-lingual "insert
+disk" screen to appear.
+
+<p>4. Adjust the monitor's horizontal sync back and forth until the picture
+breaks up in both directions, then set the adjustment to the middle of
+this range. The picture should centered and clean. Replace the top of the
+enclosure.
+
+<p>The PLL adjustment must be done with power on while observing the
+screen, since it is very sensitive. This means that the cables all
+need to be hooked up at the time. To access the trimmer cap you have
+to shift the motherboard forward enough to move the trimmer beyond the
+front of the CRT, but still have the critical cables connected. This
+is impossible with the factory-supplied disk drive cable connected at
+the rear, but the disk drive needs to be connected in order to boot
+the system into 80-column mode!
+
+<p>David Gish came up with the plan below, which works but involves
+disconnecting the disk drives from the
+motherboard <i>with power on</i>. This is <i>not</i> generally
+recommended, except as a last resort. If you do this, follow the
+indicated steps carefully to minimize the risk.
+
+<p>An alternative solution is to replace the factory cable with a
+longer one so that you don't have to unplug it. If you do that, you
+can change to the longer cable after step 7, then omit steps 11 and
+12.
+
+<p>5. Turn the machine off and lay it on its left side. Keep it on its side
+for this entire procedure.
+
+<p>6. Remove all mounting screws from the motherboard. It should now be
+loose, but will not move much due to the cable connections.
+
+<p>7. Apply electrical tape to the edge connectors at the rear of the
+motherboard to prevent shorting these against the frame while moving the
+motherboard around.
+
+<p>7a. If you have a longer disk drive signal cable, replace the
+factory cable with it at this point. See topic <a href="#[19]">[19]</a>
+for information on making cables.
+
+<p>8. Carefully examine the motherboard to be sure nothing else is shorting
+against the frame and turn the machine on.
+
+<p>9. Insert a TRSDOS-6.x disk and boot the system to place it in 80-column
+mode. Type the date and then do a DIR to fill the screen edge-to-edge (if
+the screen's unreadable, you'll have to type blind.)
+
+<p>10. Remove the TRSDOS disk.
+
+<p>10a. If you replaced the factory disk drive cable with a longer one
+(step 7a), you can now skip the somewhat dangerous steps 11 and 12 and
+go directly to step 13.
+
+<p>11. Carefully unplug the power connectors from both disk drives. This is
+to prevent damage during the next step. (Warning: There is an unshielded,
+solid-metal fan in this area cooling the monitor enclosure!)
+
+<p>12. Carefully disconnect the disk drive interface ribbon cable from the
+motherboard. This will free the back of the board and give you enough play
+to move it forward.
+
+<p>13. Move the motherboard out and forward, paying close attention to the
+rear edge connectors. Now you know the reason for the tape. Watch all
+cables while doing this to make sure you're not over-stretching them.
+
+<p>14. Eventually, you should be able to expose the trimmer cap enough
+to make the adjustment. It is probably labeled C231. You'll need a
+small pot tweaker, preferably a non-metallic one. You shouldn't
+have to adjust it much since, as mentioned above, it's very
+sensitive. Turn the brightness up so you can see the whole raster
+pattern and set the trimmer so that the image is stable and centered
+in the pattern, with no bent or warped edges. (Note: another source
+suggests removing the jumper from E1/E2 and putting on in E9/10 while
+making the adjustment, then moving it back to E1/E2 when you're done.)
+
+<p>15. Turn the power off and unplug the machine.
+
+<p>16. Remove the tape on the motherboard connectors and reassemble the
+machine -- you did pay attention to how it came apart, didn't you?
+Remember to reconnect the disk drive power and data cables.
+
+<hr>
+<H3><A NAME="[19]">
+ [19] I want to add or replace TRS-80 floppy disk drives.
+ What's going on with the setup and cabling?
+</a></h3>
+
+<p>Cabling a TRS-80 disk drive is a bit tricky. It works differently
+from a PC, and there are some differences among the TRS-80 models,
+and differences between the Radio Shack way of doing things and other
+ways that are sometimes used. I'm sorry there is so much detail here,
+but I don't really see how to condense it to a cookbook "just do this"
+approach, since there are several things you might want to do with the
+information.
+
+<p>Generally, Radio Shack handled drive select by pulling pins in the
+cable connectors. On the Model I, each drive was internally jumpered
+to respond on all four different drive selects, the three standard
+ones from the Shugart definition (pins 10, 12, 14) and one extra one
+that R.S. defined (pin 32, which later was officially defined as side
+select for two-sided drives). On the cable, there were four drive
+connectors, and each had a different one of those four pins left, with
+the other three removed. On the Model III and 4, the internal drives
+and external drives were cabled separately, so it was not necessary to
+use four different pins for drive select. Instead, the first two
+drives are pins 10 and 12 on the internal cable, while the other two
+drives are pins 10 and 12 on the external cable. However, the
+pin-pulled system is still used.
+
+<p>An alternative way that many users switched to was to use a plain
+cable with all 34 pins intact. Then you have to open up each drive
+and make sure that a different drive select is jumpered on each one.
+Usually they are jumpers marked DS1, DS2, DS3 (and sometimes also
+DS4) or DS0, DS1, DS2 (and sometimes also DS3). Many drives don't
+have a jumper for the fourth drive select. Drives that were intended
+for Radio Shack Model I systems may have pin 32 hardwired instead of
+using a jumper, so beware.
+
+<p>If you want to use double-sided drives on a TRS-80, you may
+have to switch to the pins-intact system in order to bring side
+select to every drive. If you have some single-sided drives in the
+system, make sure that none of them have pin 32 interally hardwired to
+one of the drive selects. TRS-80 Models III, 4, and 4P have
+side-select support implemented in the floppy controller and brought
+out to pin 32. On the Model I, if you limit yourself to three drives,
+you can use the fourth drive select as a side select, as it's
+conveniently already wired to the correct pin. LDOS and probably
+other Model I operating systems support this. (Let me emphasize that
+if any of the drives in a real Model I system is double sided, you can
+have at most three drives. Some Model I emulators allow you to have a
+fourth drive, but that drive definitely must be single-sided.)
+
+<p>Pre-made cables and new drives that are commonly available today
+usually use the PC system. A PC floppy drive cable has a twist in it
+between the two drive connectors (there are always only two). The
+twist allows both drives to be jumpered the same way, and allows the
+PC to control the motors on the two drives separately. Both drives
+are jumpered for drive select on pin 12 (DS2) and motor control on pin
+16 (MOT), but the twist reverses the order of pins 10, 12, 14, and 16
+on the first drive, effectively moving its drive select to pin 14 and
+motor control to pin 10. A PC-style cable won't work properly with a
+TRS-80, because the TRS-80 controller always sends motor control on
+pin 16, not pin 10, but it's easy to find ribbon cable and
+insulation-displacement (IDC) connectors to make up your own straight
+cable if you need one. Or if you only need to connect one drive, you
+can plug it into the connector before the twist. Because of this
+system, new drives are always jumpered for DS2 by default, but they
+can usually be changed. Occasionally you may find a newer drive that
+is hardwired for DS2 and has no jumpers; you might be stuck cutting
+traces and soldering if this happens to you.
+
+<p>Also see the article <a
+href="http://nemesis.lonestar.org/computers/tandy/hardware/model16_6000/floppyfix.html"
+>Utilizing 5.25-inch or 3.5-inch media on your Tandy/Radio Shack computer system</a>
+on Frank Durda IV's web site. This is mostly about replacing
+8-inch drives with 5.25-inch or 3.5-inch drives, but has some other useful
+information too.
+
+<p>People sometimes also ask about the other internal jumpers in
+TRS-80 floppy drives. The exact jumpers that are present vary
+depending on the drive manufacturer, but here are some typical
+settings. MX or MUX should be open (off); it causes the drive to
+ignore drive-select and always respond. HM should be closed (on); it
+causes the heads to load when the drive motor turns on. HS should be
+open (off); it causes the heads to load only when the drive is
+selected (mutually exclusive with HM).
+
+<hr><H3><A NAME="[20]">
+ [20] What about using high density (1.2MB 5.25-inch or 1.44MB 3.25-inch) drives
+ on a TRS-80?
+</a></h3>
+
+<p>There are two things you might want to do: (1) treat the drive as
+single/double density, or (2) use the drive's high density capability
+with a TRS-80 floppy controller that was designed for 8-inch drives, if
+you have one.
+
+<p>(1) Both high density and double density 3.5-inch drives spin at 300
+RPM like a double density 5.25 drive, and 3.5-inch double density uses the
+same data rate as 5.25-inch double density, so a 3.5-inch drive makes a
+compatible replacement for a 5.25-inch drive. The 3.5-inch drive will be
+double sided with 80 tracks per side, which most TRS-80 software can
+handle. You will have to be sure that the internal jumpers are set
+correctly, and that there is no confusion about the Disk Change output
+from the drive (not used on a TRS-80), or the High Density signal
+(which may have to be wired correctly to make sure the drive uses the
+correct write current). If you have a drive you'd like to use but
+don't have documentation on its jumpers, search the Web to see if the
+drive manufacturer has a Web site that you can get the information
+from. For example, <a href="http://www.teac.com/DSPD/catalog.htm#OldFD"
+>Teac</a> does. Also be sure to use the appropriate
+media; see topic <a href="#[14]">[14]</a>.
+
+<p>A high-density 5.25-inch drive spins at 360 RPM, not 300 RPM, so it
+can't be used directly as a replacement for a 300 RPM TRS-80 drive.
+However, some models of 5.25-inch drive have dual-speed motors and can be
+jumpered to run at 300 RPM when in double density mode. For example,
+the common <a href="http://www.teac.com/DSPD/catalog.htm#OldFD">Teac
+FD55GFR</a> drives can do this. If you have a drive you'd like to use
+but don't have documentation on its jumpers, search the Web to see if
+the drive manufacturer has a Web site that you can get the information
+from. Again you'll have to be careful about cabling the Disk Change
+and High Density signals. The manufacturer's documentation for your
+drive should be helpful here.
+
+<p>(2) If your TRS-80 has an 8-inch disk controller, you can try
+treating a high-density drive as an 8-inch drive. This should more or
+less work, but I haven't tried it and can't give detailed help. You
+would have to make an adapter cable from the 50-pin card edge
+connector to the 34-pin connector on the drive. The
+<a href="http://www.faqs.org/faqs/CPM-faq/">CP/M FAQ</a> provides
+some useful information for making such cable (see Q14 and Q16). A
+5.25-inch HD drive spins at 360 RPM just like an 8-inch DD drive, uses
+the same data rate, and has 80 tracks (vs. 77 for an 8-inch drive), so
+it makes a compatible replacement. There could be minor issues
+because 8-inch drives spin continuously and load/unload the heads when
+active, while 5.25-inch drives always have the heads loaded but are
+spun down when not active.
+
+<p>A 3.5-inch HD drive spins at only 300 RPM, but does use the same data
+rate and does have 80 tracks. Some software may tolerate a 3.5-inch HD
+drive in place of an 8-inch drive, but only the first 5/6 of each track
+will be used. Formatting may write arbitrary garbage to the remaining
+1/6; hopefully this will not be anything that will cause confusion
+when trying to read the first 5/6, but that can't be guaranteed.
+
+<p>Also see the article <a
+href="http://nemesis.lonestar.org/computers/tandy/hardware/model16_6000/floppyfix.html"
+>Utilizing 5.25-inch or 3.5-inch media on your Tandy/Radio Shack computer system</a>
+on Frank Durda IV's web site. This is mostly about replacing
+8-inch drives with 5.25-inch or 3.5-inch drives.
+
+<hr><h3><a name="[21]">
+ [21] What about using low density (360KB 5.25-inch or 720KB 3.25-inch)
+ drives on a PC?
+</a></h3>
+
+<p>Generally this should work fine, but there are a few problems to
+watch out for:
+
+<p>Check the cabling. A drive pulled out of an old TRS-80 will be
+expecting drive selection to be handled differently from the PC method;
+see topic <a href="#[19]">[19]</a>.
+
+<p>Set the correct drive type in your
+BIOS! Both operating systems and TRS-80 emulators need to know the
+drive type in order to use the correct read/write data rate. There is
+no way to autodetect this information, so software has to believe the
+BIOS settings. If they are wrong, reading and writing will fail in
+odd ways.
+
+<p><i>Amardeep S. Chana reports:</i>
+There is a problem in Jeff Vavasour's emulator code (both Model 4
+and CoCo II, and their support utilities) that incorrectly operates a 360K DD
+drive on a HD capable controller. I think what it does is use 300Kbps
+data rate instead of 250Kbps. You can create disks and read/write to
+them, but a real TRS-80 can't read them. Disks created on a real
+TRS-80 won't read on the PC, either.
+Using a 1.2MB drive does not show this problem. Using a 360K drive on
+an XT-type controller does not show this problem either. Setting the
+CMOS type of the 360KB drive to "720K 3.5-inch" also makes the problem
+go away.
+
+<hr><H3><A NAME="[22]">
+ [22] What are some other good on-line references for detailed information
+ about floppy disks and drives?
+</a></h3>
+
+<ul>
+<li><a href="http://www.moria.de/~michael/floppy/"
+ >The floppy user guide</a>,
+ by Michael Haardt, Alain Knaff, and David C. Niemi.
+<li><a href="http://www.tux.org/pub/knaff/fdutils/Fdutils_toc.html"
+ >Linux floppy utilities</a>, by Alain Knaff.
+<li><a href="http://cma.zdnet.com/book/upgraderepair/ch13/ch13.htm"
+ >Upgrading &amp; Repairing PCs Eighth Edition</a>, Que Books, chapter 13.
+<li><a href="http://pilot.ucdavis.edu/davidk/documentation/trs-tech.htm"
+ >Western Digital 1771 and 179x data sheets</a>
+<li><a href="http://www.intel.com"
+ >Intel</a> - for 82078, 82077, and other Intel floppy
+ disk controller data sheets.
+<li><a href="http://www.smsc.com"
+ >Standard Microsystems Corporation</a> - for FDC37xxx, FDC87xxx, and
+ FDC97xxx data sheets.
+<li><a href="http://www.national.com"
+ >National Semiconductor</a> - for PC87xxx and PC97xxx SuperIO data sheets.
+<li><a href="http://pluto.njcc.com/~hjohnson/"
+ >Herb's Stuff</a> - photocopies of drive manuals, etc.
+<li><a
+href="http://nemesis.lonestar.org/computers/tandy/hardware/model16_6000/floppyfix.html"
+>Utilizing 5.25-inch or 3.5-inch media on your Tandy/Radio Shack computer
+ system</a>, by Frank Durda IV - largely about replacing
+8-inch drives with 5.25-inch or 3.5-inch drives, but has other useful information too.
+</ul>
+
+<hr><h3><a name="[23]">
+ [23] How do I determine what PDRIVE settings to use for a
+ NEWDOS/80 disk?
+</a></h3>
+
+<p>This question comes up a lot, but I'm a complete LDOS bigot with no
+NEWDOS/80 experience, so I'm not equipped to answer it. Here is some
+information kindly supplied by others:
+
+<h4>Answer by Nick Andrew</h4>
+
+<p>Let's say you
+have a diskette, no idea whatsoever how it is formatted.
+
+Notes:
+<ul>
+ <li>This process may only work on NEWDOS/80 diskettes
+ <li>SD diskettes are usually 10 sectors/track
+ <li>DD diskettes are usually 18 sectors/track
+ <li>For double-sided, multiply number of sectors by 2
+ <li>DD diskettes usually format track 0 single density, and 1 fewer DD
+ track
+ <li>I assume user has an 80tk DSDD drive and it's not drive 3 (which
+ on a Model I can only be single sided)
+ <li>When changing PDRIVE settings, remember to add A on the end to
+ activate it
+ <li>Quick way to copy PDRIVE settings which is not shown in the online
+ NEWDOS/80 manual is "PDRIVE 0 2=9" which will copy from #9 into #2
+ <li>User is using NEWDOS/80 v2 with ZAP/CMD
+ <li>Reading sectors on superzap:<br>
+ "dd"<br>
+ "2,0" (e.g. drive 2, sector 0)<br>
+ "+" and "-" to step forward and back, "k" to choose another
+ sector,<br>
+ "x" to return to the menu (or you can type "EXIT" while sector
+ browsing)
+</ul>
+
+<p>
+a1. set pdrive to double sided single density 10 sectors/track<br>
+a2. use zap read sectors 0 through 5<br>
+a3. if sector 5 fails, you have a double-density diskette, track 0 SD,
+go to b1.<br>
+a4. read sectors 6 through 10.<br>
+a5. if sector 10 fails, you have a single-sided single-density
+diskette. go to c1.<br>
+a6. if sector 10 is identical to sector 0, you have a side-select
+problem (on a Model I, drive 3 can be single-sided only)<br>
+a7. read sectors 11 through 20.<br>
+a8. if sector 20 fails, you have a 40 track diskette.<br>
+a9. look for the directory track. Look at sector 0 byte 2. Also try
+disk sectors 170, 340, 400, 800 looking for the 'P' marker on the sector.
+
+<p>
+b1. set pdrive to DSDD 18 sectors/track<br>
+b2. read sectors 0 through 18.<br>
+b3. if sector 18 fails, you have a single-sided diskette.<br>
+b4. read sectors 19 through 36.<br>
+b5. if sector 36 fails, you have a 40 track diskette.<br>
+b6. look for the directory track. Look at sector 0 byte 2. Also try
+disk sectors 170, 340, 400, 612, 720, 800, 1440 looking for the 'P'
+marker on the sector.
+
+<p>
+c1. set pdrive to SSSD 10 sectors/track<br>
+c2. read sectors 0 through 10.<br>
+c3. if sector 10 fails, you have a 40-track diskette.<br>
+c4. look for the directory track. Look at sector 0 byte 2. Also try
+disk sectors 170, 400 looking for the 'P' marker on the sector.
+
+<h4>Answer by Phil Ereaut</h4>
+
+<p>In Newdos the mysterious Pdrives are just information for each drive,
+such as, No. of tracks, Single or double density, Single or Double
+sided, and a few other parameters needed by the DOS to interface with
+that that disk on that drive.
+
+<p>The pdrive information can be displayed by the command "Pdrive 0".
+Unfortunately, this display does not really mean much to anyone who
+has not read and understood the manual.
+
+<p>The first line of the display may be:
+
+<pre>
+0* TI = A, TD = E, TC = 40, SPT = 18, TSR = 00, GPL = 2, DDSL = 17, DDGA = 2
+</pre>
+
+<p>This would be a Drive 0, 40 Track, 5 Inch, Single sided, Double
+Density disk.
+
+<p>Generally, the settings for standard type disks are much the same, but
+a few people along the way, used many and varied settings for their
+GPL, DDSl, etc, which can makes it difficult to read, if you get one
+of these disks.
+
+<p>A Newdos Pdrive table is kept on each disk at, Track 0, Sector 2.
+ONLY the table on the SYSTEM disk is used for the drive settings. It
+has 10 rows of 16 bytes each, from 00 - 9F hex. Each row is the Pdrive
+values 0 to 9 as shown when a "Pdrive 0" command is done. These are
+the permanent Pdrive parameters, kept on the SYSTEM disk.
+
+<p>The number of these actually used is dependant on the number of
+drives in use on the system, and are termed active drive slots. The
+others are spares, which can be copied to the active drive slots to
+allow different type of disks to be used in those drives.
+This is done by using the Pdrive command. Example:
+
+<pre>
+pdrive 0,1=6,A
+</pre>
+
+<p>This command moves the values stored in slot 6 to Slot 1. The ,A
+causes the change to be made in memory as well as to disk.
+If ,A is not used, the change is made only on disk and thus does
+not take effect until the next time you reboot.
+[Note: information about ,A corrected by Robert Kircher. Thanks.]
+
+<p>New single Pdrive parameters also can be input, and saved in the
+table. Example:
+
+<pre>
+pdrive 0,1,TD=G,DDSL=20
+</pre>
+
+<p>This command changes the parameters in slot 1 on disk only.
+Adding the ,A at the end of the command would also make the change in memory.
+
+<p>A Pdrive table is on every disk, but it is only the table on the
+SYSTEM disk that is used by the System. One use for this table on a
+NON SYSTEM disk can be to determine the Pdrive's of this particular
+disk. Usually, on a non system disk, the top Pdrive shown is the
+Pdrive settings for that disk. (Even though it is not used by the
+System for that disk) This allows us to read these settings with a
+machine language program, and display the settings of an unknown disk.
+
+<p>The following contains information about the parameters, and where
+they are obtained from. It is not necessary to know ALL of this to
+use Pdrives. A general understanding of the parameters shown in the
+displayed Pdrive table, and use of some the tables below to interpret
+the letters, etc, such as, TI = A is all that is required. Some of
+the settings are as shown in the byte; others use bit mapping of the
+byte to store the values. Bytes bit mapped are: 02, 07, 0D and 0E, 0F
+
+<p>The table is set up as shown for row 0 (Shown in Hex):
+
+<pre>
+00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
+DDSL Lumps * TC SPT GPL * DDSL DDGA TSR - TI - TD
+11 48 04 28 12 02 00 01 11 02 00 00 00 01 00 04
+</pre>
+
+<p>This would be shown in the displayed pdrive table using "Pdrive 0" as
+follows. (Values are displayed in decimal.)
+
+<pre>
+0* TI = A, TD = E, TC = 40, SPT = 18, TSR = 00, GPL = 2, DDSL = 17, DDGA = 2
+</pre>
+
+<p>This would be a 40 Track, 5 Inch, Single sided, Double Density disk.
+
+<pre>
+DDSL = Disk Directory starting lump
+Lumps = Total lumps on disk
+TC = Track Count: No of tracks on disk
+SPT = Sectors per Track
+GPL = Granules per Lump
+DDGA = Disk Directory Granule Allocation: No of Granules used by the Directory
+TSR = Track step rate: Speed of stepping between tracks
+TI = Shows interface type, and other required parameters.
+TD = Shows Disk size, Density, No of sides, SPT
+
+Byte 02 (TI & Tsr)
+Bit 0 = TSR
+Bit 1 = TSR
+Bit 2 = A or E (Bits 2&4) or B (Bits 2&3)
+Bit 3 = D or B (Bits 2&3)
+Bit 4 = C or E (Bits 2&4)
+Bit 5 = M
+Bit 6 = K
+Bit 7 = H
+
+Byte 07
+Bit 0 = 8 Inch Disk
+Bit 1 = Double Sided
+Bit 2 =
+Bit 3 = I (Lowest track sector is 1)
+Bit 4 =
+Bit 5 = L (Two steps between tracks)
+Bit 6 = K & J (Track 0 Opposite Density)
+Bit 7 = Double Density
+
+Bytes 0D & 0E (TI)
+Byte 0D Byte 0E
+Bit: 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
+ H I E D C B A M L K J I
+A = Standard Interface
+B = Omnikron
+C = Percom Doubler
+D = Apparat Disk Controller
+E = LNW type
+H = 8 Inch drives only. Head settle to be done
+I = Lowest sector on Track is 1 (Model3 Trsdos)(Set by flag M)
+J = Track No's start from 1 (Is set by K)
+K = Track 0 formatted in opposite density to other tracks (Flag J is
+ set by flag K)
+L = Two steps between tracks. Allows 40 Track disks to be read on 80
+ Track drive
+M = Standard Trsdos Model 3 (Flag M sets flag I)
+
+Byte 0F (TD Parameter)
+Bit 0 = A : 5 inch Single Density Single Sided 10 Secs per Track
+Bit 1 = B : 8 inch Single Density Single Sided 17 Secs per Track
+Bit 2 = C : 5 inch Single Density Double Sided 20 Secs per Track
+Bit 3 = D : 8 inch Single Density Double Sided 34 Secs per Track
+Bit 4 = E : 5 inch Double Density Single Sided 18 Secs per Track
+Bit 5 = F : 8 inch Double Density Single Sided 26 Secs per Track
+Bit 6 = G : 5 inch Double Density Double Sided 36 Secs per Track
+Bit 7 = H : 8 inch Double Density Double Sided 52 Secs per Track
+(Note that NEWDOS uses the term "track" to mean "cylinder" -- that is,
+for double-sided diskettes, NEWDOS counts sectors on both sides of the
+disk as part of the same "track".)
+</pre>
+
+<p>Normally the disk is mapped in Tracks, Sectors, and granules. Newdos
+uses a different method of disk mapping, using Lumps, in place of
+Tracks. These lumps can overlap tracks, starting on one track and
+ending on the next track. This can be confusing (only to us; the DOS
+knows what it's doing), particularly with the directory, which starts
+on a particular lump, not on a particular track.
+
+<p>In the example shown above: Sectors per Granule = 5 (Standard for
+Newdos): Gpl = 2. Therefore there are 10 sectors per lump. The
+Directory starts on lump 17, (DDSL = 17). Therefore the Directory
+starts on sector 170. As each track has 18 sectors, the Directory
+starts on Track 9 Sector 8. This does not really worry the average
+user, as the System does all the work. Only those of us who are silly
+enough to play around with this stuff, really care whether it is
+tracks, or Lumps, or Doughnuts.
+
+<h4>For more NEWDOS/80 information</h4>
+
+<ul>
+<li><a href="http://www.kjsl.com/trs80/nd80cmds.html"
+>NEWDOS/80 Command Summary</a>
+
+<li><a href="http://pilot.ucdavis.edu/davidk/documentation/trs-oper.htm"
+>TRS-80 Documentation Preservation Pages: Operation Manuals</a>
+(includes NEWDOS/80 Model III manual)
+
+</ul>
+
+<hr><h3><a name="[24]">
+ [24] How do I make a bootable double-density Model I LDOS 5.3.1
+ system disk from the single-density master disk set?
+</a></h3>
+
+Here is one procedure that works:
+
+<ul>
+<li>Put the single-density LDOS master disk in drive 0.
+<li>Put a blank disk in drive 1.
+<li>Boot.
+<li>Type <tt>FDUBL (TANDY)</tt> or
+<tt>FDUBL (PERCOM)</tt>, depending on whether you have a
+Tandy or non-Tandy double density adaptor. If you are doing this
+procedure on an emulator rather than a real machine, check which type
+of adaptor it is emulating.
+<li>Type <tt>FORMAT :1 (SYSTEM)</tt>
+<li>Answer the questions that FORMAT asks.
+<li>Type <tt>SOLE :1</tt>
+<li>Type <tt>BACKUP :0 :1 (SYS,INV)</tt>
+<li>Type <tt>SYSTEM (DRIVE=1,SYSGEN)</tt>
+</ul>
+
+<p>The disk in drive 1 is now a bootable, double-density LDOS system disk.
+Test it as follows:
+
+<ul>
+<li>Remove the LDOS master disk from drive 0.
+<li>Move the new disk from drive 1 to drive 0.
+<li>Boot.
+</ul>
+
+<p>At this point you may want to put the remaining LDOS files from the
+LDOSXTRA disk onto your new boot disk:
+
+<ul>
+<li>Insert the LDOSXTRA disk in drive 1.
+<li>Type <tt>BACKUP :1 :0 (SYS,INV)</tt>
+</ul>
+
+<hr><h3><a name="[25]">
+ [25] What about using 8-inch drives on a PC?
+</a></h3>
+
+<p>It's surprisingly easy to use an 8-inch drive on a PC. An 8-inch
+drive looks electrically very similar to a 5.25-inch HD (1.2MB) drive:
+it spins at 360 RPM, has 77 (vs 80) tracks, and the data rate is the
+same. The main difference is that 8-inch drives use an older 50-pin
+version of the Shugart bus, so you will need a 34- to 50-pin adapter.
+The <a href="http://www.faqs.org/faqs/CPM-faq/"
+>CP/M FAQ</a> provides some useful information for making such cables,
+but watch out for the difference between the IBM PC "twisted cable" standard
+and the original Shugart SA400 34-pin bus. At this writing, Q14 in
+the CP/M FAQ gives wiring that is right for the old bus but wrong for
+the IBM PC version. See Q16 for the changes that IBM made.
+You can also buy a nice pre-made adapter from D-Bit (see
+<a href="http://www.dbit.com/fdadap.html"
+>http://www.dbit.com/fdadap.html</a>), but I haven't tried these.
+There could be minor issues because 8-inch drives spin continuously
+and normally load/unload the heads when active, while 5.25-inch drives
+always have the heads loaded but are spun down when not active.
+However, when I tried this, I didn't experience any problems.
+
+<p>As with all floppy drives, the BIOS settings are important.
+Tell the PC BIOS that your 8-inch drive is a 5.25-inch 1.2MB drive,
+and it should be happy.
+
+<p>You can also plug an 8-inch drive into a Catweasel card (see topic
+<a href="#[16]">[16]</a>) using the same type of 34- to 50-pin adapter
+discussed above. I have one set up this way and working.
+
+<hr><h3><a name="[26]">
+ [26] How can I read the back of a disk that was written in a
+ flippy drive?
+</a></h3>
+
+<p>A <i>flippy drive</i> has one head, two write-protect sensors, and
+two index-hole sensors. You can put an ordinary floppy disk into it
+with either side up and read/write to that side. To access the other
+side, you have to remove the disk and turn it over.
+This is a similar concept to the "flippy disk", but there the
+<i>disk</i> is special: it has two index holes in the jacket and two
+write protect notches, so you can put it into an ordinary 1-sided
+floppy drive with either side up.
+
+<p>If you have a disk that was written in a flippy drive, but you
+don't have any flippy drives, reading it will be difficult, and
+writing to it even more difficult. Technically, the index hole signal
+shouldn't be needed in order to read or write an ordinary floppy disk,
+only to format it (though the signal may be needed to read or write
+certain unusual formats). So if you only need to read/write the disk,
+you might expect to be able to put it in an ordinary drive upside down
+and have it just work. Unfortunately, this doesn't work on drives and
+disk controllers made for modern PCs. Modern drives often have
+circuitry in them that refuses to send any data to the controller
+unless the drive has seen the index hole go by a few times and can tell
+that the motor is up to speed. Also, the controller itself may refuse
+to accept data until it has seen some index pulses.
+
+<p>You also might think of trying to read the back of a flippy using
+the second head in a regular 2-sided drive. This doesn't work for two
+reasons. First, the disk is spinning the wrong way, so the stream of
+clock and data bits comes out in reversed order, and a regular floppy
+disk controller can't decode it. It's possible to program a Catweasel
+to decode the reversed data, but the back head in a 2-sided drive is
+offset inward slightly from the front head, so it cannot be positioned
+over the data from the first couple of tracks on the back of a flippy.
+When the head is against the track 0 stop, it's reading track 2 or 3;
+the lower numbered tracks are unreachable. Because of this problem, my
+<a href="catweasel.html">Catweasel Floppy Read/Write Tools</a> don't
+attempt to decode data from the back of a flippy, but they do have a
+feature that <i>detects</i> if there is reversed data on the back and
+prints a message reading "Possibly a flippy disk; check reverse side
+too".
+
+<p>Here are a few ways to read (and possibly write) the back of a
+flippy:
+
+<p>(1) The easiest way is to take a hole punch and carefully punch an
+extra index hole (in both sides of the jacket, but <i>not</i> in the
+magnetic media!) and an extra write protect notch. The easiest way to
+see exactly where the holes should go is to take the magnetic media
+out of an extra disk that you don't mind destroying (so that you can
+see through the jacket's index hole) and use that as a template.
+
+<p>(2) If you are good with electronics, you may be able to modify a
+drive to generate fake index pulses. See <a
+href="http://siliconsonic.de/t/flipside.html"
+>http://siliconsonic.de/t/flipside.html</a> for one modification idea.
+Although the page about the modification refers to the Catweasel, a
+drive modified in this way should work with a standard PC floppy disk
+controller too. Note that the fake index pulses don't come at the
+same point in the disk's rotation as the real index pulse would. This
+should not be a problem unless you are dealing with one of the rare
+special formats that depends on index pulse position.
+
+<p>(3) If you have a Catweasel and you use my <a
+href="catweasel.html">Catweasel Floppy Read/Write Tools</a>, the -h0
+flag will let cw2dmk read a disk even if the Catweasel doesn't receive
+any index pulses. However, you still need to have a drive that will
+send data to the Catweasel even when the drive doesn't see any index
+holes. An old, TRS-80 vintage drive should work. A newer model of
+drive that will work is the Mitsubishi MF504B or MF504C, if you open
+the drive up and remove the jumper marked RD. Currently dmk2cw
+doesn't support writing to a disk without using the index hole.
+
+<hr>
+<p>** End of TRS-80 Model I/III/4 FAQ **
+
+</BODY></HTML>
diff --git a/debug.c b/debug.c
index 97bc5cd..fc0b568 100644
--- a/debug.c
+++ b/debug.c
@@ -278,22 +278,22 @@ void debug_print_registers()
printf("Flags: %d %d %d %d %d %d %d %d %d %d %d\n\n",
(SIGN_FLAG != 0),
(ZERO_FLAG != 0),
- (REG_F & UNDOC5_MASK) != 0,
+ (reg_F & UNDOC5_MASK) != 0,
(HALF_CARRY_FLAG != 0),
- (REG_F & UNDOC3_MASK) != 0,
+ (reg_F & UNDOC3_MASK) != 0,
(OVERFLOW_FLAG != 0),
(SUBTRACT_FLAG != 0),
(CARRY_FLAG != 0),
z80_state.iff1, z80_state.iff2, z80_state.interrupt_mode);
printf("A F: %.2x %.2x IX: %.4x AF': %.4x\n",
- REG_A, REG_F, REG_IX, REG_AF_PRIME);
+ reg_A, reg_F, reg_IX, reg_AF_PRIME);
printf("B C: %.2x %.2x IY: %.4x BC': %.4x\n",
- REG_B, REG_C, REG_IY, REG_BC_PRIME);
+ reg_B, reg_C, reg_IY, reg_BC_PRIME);
printf("D E: %.2x %.2x PC: %.4x DE': %.4x\n",
- REG_D, REG_E, REG_PC, REG_DE_PRIME);
+ reg_D, reg_E, reg_PC, reg_DE_PRIME);
printf("H L: %.2x %.2x SP: %.4x HL': %.4x\n",
- REG_H, REG_L, REG_SP, REG_HL_PRIME);
+ reg_H, reg_L, reg_SP, reg_HL_PRIME);
printf("\nT-state counter: %" TSTATE_T_LEN " ", z80_state.t_count);
printf("Delay setting: %d (%s)\n",
@@ -377,7 +377,7 @@ static void debug_run()
stop_signaled = 0;
- t = traps[REG_PC];
+ t = traps[reg_PC];
while(!stop_signaled)
{
if(t)
@@ -385,7 +385,7 @@ static void debug_run()
if(t & TRACE_FLAG)
{
printf("Trace: ");
- disassemble(REG_PC);
+ disassemble(reg_PC);
}
if(t & DISASSEMBLE_ON_FLAG)
{
@@ -397,7 +397,7 @@ static void debug_run()
}
}
- if(print_instructions) disassemble(REG_PC);
+ if(print_instructions) disassemble(reg_PC);
continuous = (!print_instructions && num_traps == 0);
if (z80_run(continuous)) {
@@ -405,7 +405,7 @@ static void debug_run()
stop_signaled = 1;
}
- t = traps[REG_PC];
+ t = traps[reg_PC];
if(t & BREAKPOINT_FLAG)
{
stop_signaled = 1;
@@ -413,7 +413,7 @@ static void debug_run()
if(t & BREAK_ONCE_FLAG)
{
stop_signaled = 1;
- clear_trap_address(REG_PC, BREAK_ONCE_FLAG);
+ clear_trap_address(reg_PC, BREAK_ONCE_FLAG);
}
/*
@@ -452,7 +452,7 @@ static void debug_run()
}
signal(SIGINT, old_signal_handler);
- printf("Stopped at %.4x\n", REG_PC);
+ printf("Stopped at %.4x\n", reg_PC);
}
void debug_shell()
@@ -474,7 +474,7 @@ void debug_shell()
while(!done)
{
printf("\n");
- disassemble(REG_PC);
+ disassemble(reg_PC);
sigemptyset(&set);
sigaddset(&set, SIGALRM);
@@ -523,7 +523,7 @@ void debug_shell()
}
else if(!strcmp(command, "clear"))
{
- clear_trap_address(REG_PC, 0);
+ clear_trap_address(reg_PC, 0);
}
else if(!strcmp(command, "cont"))
{
@@ -569,7 +569,7 @@ void debug_shell()
}
else
{
- start = REG_PC;
+ start = reg_PC;
lines = 10;
}
@@ -591,7 +591,7 @@ void debug_shell()
else if(!strcmp(command, "next") || !strcmp(command, "nextint"))
{
int is_call = 0, is_rst = 0;
- switch(mem_read(REG_PC)) {
+ switch(mem_read(reg_PC)) {
case 0xCD: /* call address */
is_call = 1;
break;
@@ -633,10 +633,10 @@ void debug_shell()
break;
}
if (is_call) {
- set_trap((REG_PC + 3) % ADDRESS_SPACE, BREAK_ONCE_FLAG);
+ set_trap((reg_PC + 3) % ADDRESS_SPACE, BREAK_ONCE_FLAG);
debug_run();
} else if (is_rst) {
- set_trap((REG_PC + 1) % ADDRESS_SPACE, BREAK_ONCE_FLAG);
+ set_trap((reg_PC + 1) % ADDRESS_SPACE, BREAK_ONCE_FLAG);
debug_run();
} else {
z80_run((!strcmp(command, "nextint")) ? 0 : -1);
@@ -674,47 +674,47 @@ void debug_shell()
if(sscanf(input, "%*s $%[a-zA-Z] = %x", regname, &value) == 2)
{
if(!strcasecmp(regname, "a")) {
- REG_A = value;
+ reg_A = value;
} else if(!strcasecmp(regname, "f")) {
- REG_F = value;
+ reg_F = value;
} else if(!strcasecmp(regname, "b")) {
- REG_B = value;
+ reg_B = value;
} else if(!strcasecmp(regname, "c")) {
- REG_C = value;
+ reg_C = value;
} else if(!strcasecmp(regname, "d")) {
- REG_D = value;
+ reg_D = value;
} else if(!strcasecmp(regname, "e")) {
- REG_E = value;
+ reg_E = value;
} else if(!strcasecmp(regname, "h")) {
- REG_H = value;
+ reg_H = value;
} else if(!strcasecmp(regname, "l")) {
- REG_L = value;
+ reg_L = value;
} else if(!strcasecmp(regname, "sp")) {
- REG_SP = value;
+ reg_SP = value;
} else if(!strcasecmp(regname, "pc")) {
- REG_PC = value;
+ reg_PC = value;
} else if(!strcasecmp(regname, "af")) {
- REG_AF = value;
+ reg_AF = value;
} else if(!strcasecmp(regname, "bc")) {
- REG_BC = value;
+ reg_BC = value;
} else if(!strcasecmp(regname, "de")) {
- REG_DE = value;
+ reg_DE = value;
} else if(!strcasecmp(regname, "hl")) {
- REG_HL = value;
+ reg_HL = value;
} else if(!strcasecmp(regname, "af'")) {
- REG_AF_PRIME = value;
+ reg_AF_PRIME = value;
} else if(!strcasecmp(regname, "bc'")) {
- REG_BC_PRIME = value;
+ reg_BC_PRIME = value;
} else if(!strcasecmp(regname, "de'")) {
- REG_DE_PRIME = value;
+ reg_DE_PRIME = value;
} else if(!strcasecmp(regname, "hl'")) {
- REG_HL_PRIME = value;
+ reg_HL_PRIME = value;
} else if(!strcasecmp(regname, "ix")) {
- REG_IX = value;
+ reg_IX = value;
} else if(!strcasecmp(regname, "iy")) {
- REG_IY = value;
+ reg_IY = value;
} else if(!strcasecmp(regname, "i")) {
- REG_I = value;
+ reg_I = value;
} else {
printf("Unrecognized register name %s.\n", regname);
}
@@ -743,7 +743,7 @@ void debug_shell()
if(sscanf(input, "stop at %x", &address) != 1 &&
sscanf(input, "break %x", &address) != 1)
{
- address = REG_PC;
+ address = reg_PC;
}
address %= ADDRESS_SPACE;
set_trap(address, BREAKPOINT_FLAG);
@@ -754,7 +754,7 @@ void debug_shell()
if(sscanf(input, "trace %x", &address) != 1)
{
- address = REG_PC;
+ address = reg_PC;
}
address %= ADDRESS_SPACE;
set_trap(address, TRACE_FLAG);
@@ -889,10 +889,10 @@ test_add(int a, int b)
if(carry_out(a, b, result) & 0x80) flags |= CARRY_MASK;
do_add_flags(a, b, result);
- if(REG_F != flags)
+ if(reg_F != flags)
{
printf("error: %d + %d = %d, expected %.2x, got %.2x\n",
- a, b, result, flags, REG_F);
+ a, b, result, flags, reg_F);
}
}
@@ -919,10 +919,10 @@ test_sub(int a, int b)
do_sub_flags(a, b, result);
- if(REG_F != flags)
+ if(reg_F != flags)
{
printf("error: %d - %d = %d, expected %.2x, got %.2x\n",
- a, b, result, flags, REG_F);
+ a, b, result, flags, reg_F);
}
}
diff --git a/trs_disk.c b/trs_disk.c
index a7f7b84..adad588 100644
--- a/trs_disk.c
+++ b/trs_disk.c
@@ -1196,7 +1196,7 @@ trs_disk_select_write(unsigned char data)
static int old_data = -1;
if ((trs_disk_debug_flags & DISKDEBUG_FDCREG) && data != old_data) {
- debug("select_write(0x%02x) pc 0x%04x\n", data, REG_PC);
+ debug("select_write(0x%02x) pc 0x%04x\n", data, reg_PC);
old_data = data;
}
@@ -1284,7 +1284,7 @@ unsigned char
trs_disk_track_read(void)
{
if (trs_disk_debug_flags & DISKDEBUG_FDCREG) {
- debug("track_read() => 0x%02x pc 0x%04x\n", state.track, REG_PC);
+ debug("track_read() => 0x%02x pc 0x%04x\n", state.track, reg_PC);
}
return state.track;
}
@@ -1293,7 +1293,7 @@ void
trs_disk_track_write(unsigned char data)
{
if (trs_disk_debug_flags & DISKDEBUG_FDCREG) {
- debug("track_write(0x%02x) pc 0x%04x\n", data, REG_PC);
+ debug("track_write(0x%02x) pc 0x%04x\n", data, reg_PC);
}
state.track = data;
}
@@ -1302,7 +1302,7 @@ unsigned char
trs_disk_sector_read(void)
{
if (trs_disk_debug_flags & DISKDEBUG_FDCREG) {
- debug("sector_read() => 0x%02x pc 0x%04x\n", state.sector, REG_PC);
+ debug("sector_read() => 0x%02x pc 0x%04x\n", state.sector, reg_PC);
}
return state.sector;
}
@@ -1335,7 +1335,7 @@ void
trs_disk_sector_write(unsigned char data)
{
if (trs_disk_debug_flags & DISKDEBUG_FDCREG) {
- debug("sector_write(0x%02x) pc 0x%04x\n", data, REG_PC);
+ debug("sector_write(0x%02x) pc 0x%04x\n", data, reg_PC);
}
if (trs_model == 1 && (trs_disk_doubler & TRSDISK_TANDY)) {
switch (data) {
@@ -1529,7 +1529,7 @@ trs_disk_data_read(void)
break;
}
if (trs_disk_debug_flags & DISKDEBUG_FDCREG) {
- debug("data_read() => 0x%02x pc 0x%04x\n", state.data, REG_PC);
+ debug("data_read() => 0x%02x pc 0x%04x\n", state.data, reg_PC);
}
return state.data;
}
@@ -1541,7 +1541,7 @@ trs_disk_data_write(unsigned char data)
int c;
if (trs_disk_debug_flags & DISKDEBUG_FDCREG) {
- debug("data_write(0x%02x) pc 0x%04x\n", data, REG_PC);
+ debug("data_write(0x%02x) pc 0x%04x\n", data, reg_PC);
}
switch (state.currcommand & TRSDISK_CMDMASK) {
case TRSDISK_WRITE:
@@ -2126,7 +2126,7 @@ trs_disk_status_read(void)
}
if ((trs_disk_debug_flags & DISKDEBUG_FDCREG) &&
state.status != last_status) {
- debug("status_read() => 0x%02x pc 0x%04x\n", state.status, REG_PC);
+ debug("status_read() => 0x%02x pc 0x%04x\n", state.status, reg_PC);
last_status = state.status;
}
@@ -2160,7 +2160,7 @@ trs_disk_command_write(unsigned char cmd)
trs_event_func event;
if (trs_disk_debug_flags & DISKDEBUG_FDCREG) {
- debug("command_write(0x%02x) pc 0x%04x\n", cmd, REG_PC);
+ debug("command_write(0x%02x) pc 0x%04x\n", cmd, reg_PC);
}
/* Handle DMK partial track reformat */
@@ -3124,7 +3124,7 @@ real_verify()
}
void
-real_restore(curdrive)
+real_restore(int curdrive)
{
#if __linux
DiskState *d = &disk[curdrive];
diff --git a/trs_imp_exp.c b/trs_imp_exp.c
index 739b760..73f5498 100644
--- a/trs_imp_exp.c
+++ b/trs_imp_exp.c
@@ -50,64 +50,64 @@ void do_emt_system()
int res;
if (trs_emtsafe) {
error("potentially dangerous emulator trap blocked");
- REG_A = EACCES;
- REG_F &= ~ZERO_MASK;
+ reg_A = EACCES;
+ reg_F &= ~ZERO_MASK;
return;
}
- res = system((char *)mem_pointer(REG_HL, 0));
+ res = system((char *)mem_pointer(reg_HL, 0));
if (res == -1) {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
} else {
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
}
- REG_BC = res;
+ reg_BC = res;
}
void do_emt_mouse()
{
int x, y;
unsigned int buttons, sens;
- switch (REG_B) {
+ switch (reg_B) {
case 1:
trs_get_mouse_pos(&x, &y, &buttons);
- REG_HL = x;
- REG_DE = y;
- REG_A = buttons;
- if (REG_A) {
- REG_F &= ~ZERO_MASK;
+ reg_HL = x;
+ reg_DE = y;
+ reg_A = buttons;
+ if (reg_A) {
+ reg_F &= ~ZERO_MASK;
} else {
- REG_F |= ZERO_MASK;
+ reg_F |= ZERO_MASK;
}
break;
case 2:
- trs_set_mouse_pos(REG_HL, REG_DE);
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ trs_set_mouse_pos(reg_HL, reg_DE);
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
break;
case 3:
trs_get_mouse_max(&x, &y, &sens);
- REG_HL = x;
- REG_DE = y;
- REG_A = sens;
- if (REG_A) {
- REG_F &= ~ZERO_MASK;
+ reg_HL = x;
+ reg_DE = y;
+ reg_A = sens;
+ if (reg_A) {
+ reg_F &= ~ZERO_MASK;
} else {
- REG_F |= ZERO_MASK;
+ reg_F |= ZERO_MASK;
}
break;
case 4:
- trs_set_mouse_max(REG_HL, REG_DE, REG_C);
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ trs_set_mouse_max(reg_HL, reg_DE, reg_C);
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
break;
case 5:
- REG_A = trs_get_mouse_type();
- if (REG_A) {
- REG_F &= ~ZERO_MASK;
+ reg_A = trs_get_mouse_type();
+ if (reg_A) {
+ reg_F &= ~ZERO_MASK;
} else {
- REG_F |= ZERO_MASK;
+ reg_F |= ZERO_MASK;
}
break;
default:
@@ -118,28 +118,28 @@ void do_emt_mouse()
void do_emt_getddir()
{
- if (REG_HL + REG_BC > 0x10000 ||
- REG_HL + strlen(trs_disk_dir) + 1 > REG_HL + REG_BC) {
- REG_A = EFAULT;
- REG_F &= ~ZERO_MASK;
- REG_BC = 0xFFFF;
+ if (reg_HL + reg_BC > 0x10000 ||
+ reg_HL + strlen(trs_disk_dir) + 1 > reg_HL + reg_BC) {
+ reg_A = EFAULT;
+ reg_F &= ~ZERO_MASK;
+ reg_BC = 0xFFFF;
return;
}
- strcpy((char *)mem_pointer(REG_HL, 1), trs_disk_dir);
- REG_A = 0;
- REG_F |= ZERO_MASK;
- REG_BC = strlen(trs_disk_dir);
+ strcpy((char *)mem_pointer(reg_HL, 1), trs_disk_dir);
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
+ reg_BC = strlen(trs_disk_dir);
}
void do_emt_setddir()
{
if (trs_emtsafe) {
error("potentially dangerous emulator trap blocked");
- REG_A = EACCES;
- REG_F &= ~ZERO_MASK;
+ reg_A = EACCES;
+ reg_F &= ~ZERO_MASK;
return;
}
- trs_disk_dir = strdup((char *)mem_pointer(REG_HL, 0));
+ trs_disk_dir = strdup((char *)mem_pointer(reg_HL, 0));
if (trs_disk_dir[0] == '~' &&
(trs_disk_dir[1] == '/' || trs_disk_dir[1] == '\0')) {
char* home = getenv("HOME");
@@ -150,14 +150,14 @@ void do_emt_setddir()
trs_disk_dir = p;
}
}
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
}
void do_emt_open()
{
int fd, oflag, eoflag;
- eoflag = REG_BC;
+ eoflag = reg_BC;
switch (eoflag & EO_ACCMODE) {
case EO_RDONLY:
default:
@@ -177,52 +177,52 @@ void do_emt_open()
if (trs_emtsafe && oflag != O_RDONLY) {
error("potentially dangerous emulator trap blocked");
- REG_A = EACCES;
- REG_F &= ~ZERO_MASK;
+ reg_A = EACCES;
+ reg_F &= ~ZERO_MASK;
return;
}
- fd = open((char *)mem_pointer(REG_HL, 0), oflag, REG_DE);
+ fd = open((char *)mem_pointer(reg_HL, 0), oflag, reg_DE);
if (fd >= 0) {
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
} else {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
}
- REG_DE = fd;
+ reg_DE = fd;
}
void do_emt_close()
{
int res;
- res = close(REG_DE);
+ res = close(reg_DE);
if (res >= 0) {
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
} else {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
}
}
void do_emt_read()
{
int size;
- if (REG_HL + REG_BC > 0x10000) {
- REG_A = EFAULT;
- REG_F &= ~ZERO_MASK;
- REG_BC = 0xFFFF;
+ if (reg_HL + reg_BC > 0x10000) {
+ reg_A = EFAULT;
+ reg_F &= ~ZERO_MASK;
+ reg_BC = 0xFFFF;
return;
}
- size = read(REG_DE, mem_pointer(REG_HL, 1), REG_BC);
+ size = read(reg_DE, mem_pointer(reg_HL, 1), reg_BC);
if (size >= 0) {
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
} else {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
}
- REG_BC = size;
+ reg_BC = size;
}
@@ -231,50 +231,50 @@ void do_emt_write()
int size;
if (trs_emtsafe) {
error("potentially dangerous emulator trap blocked");
- REG_A = EACCES;
- REG_F &= ~ZERO_MASK;
+ reg_A = EACCES;
+ reg_F &= ~ZERO_MASK;
return;
}
- if (REG_HL + REG_BC > 0x10000) {
- REG_A = EFAULT;
- REG_F &= ~ZERO_MASK;
- REG_BC = 0xFFFF;
+ if (reg_HL + reg_BC > 0x10000) {
+ reg_A = EFAULT;
+ reg_F &= ~ZERO_MASK;
+ reg_BC = 0xFFFF;
return;
}
- size = write(REG_DE, mem_pointer(REG_HL, 0), REG_BC);
+ size = write(reg_DE, mem_pointer(reg_HL, 0), reg_BC);
if (size >= 0) {
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
} else {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
}
- REG_BC = size;
+ reg_BC = size;
}
void do_emt_lseek()
{
int i;
off_t offset;
- if (REG_HL + 8 > 0x10000) {
- REG_A = EFAULT;
- REG_F &= ~ZERO_MASK;
+ if (reg_HL + 8 > 0x10000) {
+ reg_A = EFAULT;
+ reg_F &= ~ZERO_MASK;
return;
}
offset = 0;
for (i=0; i<8; i++) {
- offset = offset + (mem_read(REG_HL + i) << i*8);
+ offset = offset + (mem_read(reg_HL + i) << i*8);
}
- offset = lseek(REG_DE, offset, REG_BC);
+ offset = lseek(reg_DE, offset, reg_BC);
if (offset != (off_t) -1) {
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
} else {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
}
- for (i=REG_HL; i<8; i++) {
- mem_write(REG_HL + i, offset & 0xff);
+ for (i=reg_HL; i<8; i++) {
+ mem_write(reg_HL + i, offset & 0xff);
offset >>= 8;
}
}
@@ -283,40 +283,40 @@ void do_emt_strerror()
{
char *msg;
int size;
- if (REG_HL + REG_BC > 0x10000) {
- REG_A = EFAULT;
- REG_F &= ~ZERO_MASK;
- REG_BC = 0xFFFF;
+ if (reg_HL + reg_BC > 0x10000) {
+ reg_A = EFAULT;
+ reg_F &= ~ZERO_MASK;
+ reg_BC = 0xFFFF;
return;
}
errno = 0;
- msg = strerror(REG_A);
+ msg = strerror(reg_A);
size = strlen(msg);
if (errno != 0) {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
- } else if (REG_BC < size + 2) {
- REG_A = ERANGE;
- REG_F &= ~ZERO_MASK;
- size = REG_BC - 1;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
+ } else if (reg_BC < size + 2) {
+ reg_A = ERANGE;
+ reg_F &= ~ZERO_MASK;
+ size = reg_BC - 1;
} else {
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
}
- memcpy(mem_pointer(REG_HL, 1), msg, size);
- mem_write(REG_HL + size++, '\r');
- mem_write(REG_HL + size, '\0');
+ memcpy(mem_pointer(reg_HL, 1), msg, size);
+ mem_write(reg_HL + size++, '\r');
+ mem_write(reg_HL + size, '\0');
if (errno == 0) {
- REG_BC = size;
+ reg_BC = size;
} else {
- REG_BC = 0xFFFF;
+ reg_BC = 0xFFFF;
}
}
void do_emt_time()
{
time_t now = time(0);
- if (REG_A == 1) {
+ if (reg_A == 1) {
#if __alpha
struct tm *loctm = localtime(&now);
now += loctm->tm_gmtoff;
@@ -349,11 +349,11 @@ void do_emt_time()
error("trouble computing local time in emt_time");
}
#endif
- } else if (REG_A != 0) {
+ } else if (reg_A != 0) {
error("unsupported function code to emt_time");
}
- REG_BC = (now >> 16) & 0xffff;
- REG_DE = now & 0xffff;
+ reg_BC = (now >> 16) & 0xffff;
+ reg_DE = now & 0xffff;
}
void do_emt_opendir()
@@ -363,77 +363,77 @@ void do_emt_opendir()
if (dir[i] == NULL) break;
}
if (i == MAX_OPENDIR) {
- REG_DE = 0xffff;
- REG_A = EMFILE;
+ reg_DE = 0xffff;
+ reg_A = EMFILE;
return;
}
- dir[i] = opendir((char *)mem_pointer(REG_HL, 0));
+ dir[i] = opendir((char *)mem_pointer(reg_HL, 0));
if (dir[i] == NULL) {
- REG_DE = 0xffff;
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_DE = 0xffff;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
} else {
- REG_DE = i;
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_DE = i;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
}
}
void do_emt_closedir()
{
- int i = REG_DE;
+ int i = reg_DE;
int ok;
if (i < 0 || i >= MAX_OPENDIR || dir[i] == NULL) {
- REG_A = EBADF;
- REG_F &= ~ZERO_MASK;
+ reg_A = EBADF;
+ reg_F &= ~ZERO_MASK;
return;
}
ok = closedir(dir[i]);
dir[i] = NULL;
if (ok >= 0) {
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
} else {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
}
}
void do_emt_readdir()
{
- int size, i = REG_DE;
+ int size, i = reg_DE;
struct dirent *result;
if (i < 0 || i >= MAX_OPENDIR || dir[i] == NULL) {
- REG_A = EBADF;
- REG_F &= ~ZERO_MASK;
- REG_BC = 0xFFFF;
+ reg_A = EBADF;
+ reg_F &= ~ZERO_MASK;
+ reg_BC = 0xFFFF;
return;
}
- if (REG_HL + REG_BC > 0x10000) {
- REG_A = EFAULT;
- REG_F &= ~ZERO_MASK;
- REG_BC = 0xFFFF;
+ if (reg_HL + reg_BC > 0x10000) {
+ reg_A = EFAULT;
+ reg_F &= ~ZERO_MASK;
+ reg_BC = 0xFFFF;
return;
}
result = readdir(dir[i]);
if (result == NULL) {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
- REG_BC = 0xFFFF;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
+ reg_BC = 0xFFFF;
return;
}
size = strlen(result->d_name);
- if (size + 1 > REG_BC) {
- REG_A = ERANGE;
- REG_F &= ~ZERO_MASK;
- REG_BC = 0xFFFF;
+ if (size + 1 > reg_BC) {
+ reg_A = ERANGE;
+ reg_F &= ~ZERO_MASK;
+ reg_BC = 0xFFFF;
return;
}
- strcpy((char *)mem_pointer(REG_HL, 1), result->d_name);
- REG_A = 0;
- REG_F |= ZERO_MASK;
- REG_BC = size;
+ strcpy((char *)mem_pointer(reg_HL, 1), result->d_name);
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
+ reg_BC = size;
}
void do_emt_chdir()
@@ -441,47 +441,47 @@ void do_emt_chdir()
int ok;
if (trs_emtsafe) {
error("potentially dangerous emulator trap blocked");
- REG_A = EACCES;
- REG_F &= ~ZERO_MASK;
+ reg_A = EACCES;
+ reg_F &= ~ZERO_MASK;
return;
}
- ok = chdir((char *)mem_pointer(REG_HL, 0));
+ ok = chdir((char *)mem_pointer(reg_HL, 0));
if (ok < 0) {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
} else {
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
}
}
void do_emt_getcwd()
{
char *result;
- if (REG_HL + REG_BC > 0x10000) {
- REG_A = EFAULT;
- REG_F &= ~ZERO_MASK;
- REG_BC = 0xFFFF;
+ if (reg_HL + reg_BC > 0x10000) {
+ reg_A = EFAULT;
+ reg_F &= ~ZERO_MASK;
+ reg_BC = 0xFFFF;
return;
}
- result = getcwd((char *)mem_pointer(REG_HL, 1), REG_BC);
+ result = getcwd((char *)mem_pointer(reg_HL, 1), reg_BC);
if (result == NULL) {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
- REG_BC = 0xFFFF;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
+ reg_BC = 0xFFFF;
return;
}
- REG_A = 0;
- REG_F |= ZERO_MASK;
- REG_BC = strlen(result);
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
+ reg_BC = strlen(result);
}
void do_emt_misc()
{
- switch (REG_A) {
+ switch (reg_A) {
case 0:
trs_disk_change_all();
- REG_HL = trs_disk_changecount;
+ reg_HL = trs_disk_changecount;
break;
case 1:
trs_exit();
@@ -493,60 +493,60 @@ void do_emt_misc()
trs_reset(0);
break;
case 4:
- REG_HL = trs_disk_changecount;
+ reg_HL = trs_disk_changecount;
break;
case 5:
- REG_HL = trs_model;
+ reg_HL = trs_model;
break;
case 6:
- REG_HL = trs_disk_getsize(REG_BC);
+ reg_HL = trs_disk_getsize(reg_BC);
break;
case 7:
- trs_disk_setsize(REG_BC, REG_HL);
+ trs_disk_setsize(reg_BC, reg_HL);
break;
case 8:
- REG_HL = trs_disk_getstep(REG_BC);
+ reg_HL = trs_disk_getstep(reg_BC);
break;
case 9:
- trs_disk_setstep(REG_BC, REG_HL);
+ trs_disk_setstep(reg_BC, reg_HL);
break;
case 10:
- REG_HL = grafyx_get_microlabs();
+ reg_HL = grafyx_get_microlabs();
break;
case 11:
- grafyx_set_microlabs(REG_HL);
+ grafyx_set_microlabs(reg_HL);
break;
case 12:
- REG_HL = z80_state.delay;
- REG_BC = trs_autodelay;
+ reg_HL = z80_state.delay;
+ reg_BC = trs_autodelay;
break;
case 13:
- z80_state.delay = REG_HL;
- trs_autodelay = REG_BC;
+ z80_state.delay = reg_HL;
+ trs_autodelay = reg_BC;
break;
case 14:
- REG_HL = stretch_amount;
+ reg_HL = stretch_amount;
break;
case 15:
- stretch_amount = REG_HL;
+ stretch_amount = reg_HL;
break;
case 16:
- REG_HL = trs_disk_doubler;
+ reg_HL = trs_disk_doubler;
break;
case 17:
- trs_disk_doubler = REG_HL;
+ trs_disk_doubler = reg_HL;
break;
case 18:
- REG_HL = sb_get_volume();
+ reg_HL = sb_get_volume();
break;
case 19:
- sb_set_volume(REG_HL);
+ sb_set_volume(reg_HL);
break;
case 20:
- REG_HL = trs_disk_truedam;
+ reg_HL = trs_disk_truedam;
break;
case 21:
- trs_disk_truedam = REG_HL;
+ trs_disk_truedam = reg_HL;
break;
default:
error("unsupported function code to emt_misc");
@@ -560,37 +560,37 @@ void do_emt_ftruncate()
off_t offset;
if (trs_emtsafe) {
error("potentially dangerous emulator trap blocked");
- REG_A = EACCES;
- REG_F &= ~ZERO_MASK;
+ reg_A = EACCES;
+ reg_F &= ~ZERO_MASK;
return;
}
- if (REG_HL + 8 > 0x10000) {
- REG_A = EFAULT;
- REG_F &= ~ZERO_MASK;
+ if (reg_HL + 8 > 0x10000) {
+ reg_A = EFAULT;
+ reg_F &= ~ZERO_MASK;
return;
}
offset = 0;
for (i=0; i<8; i++) {
- offset = offset + (mem_read(REG_HL + i) << i*8);
+ offset = offset + (mem_read(reg_HL + i) << i*8);
}
- result = ftruncate(REG_DE, offset);
+ result = ftruncate(reg_DE, offset);
if (result == 0) {
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
} else {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
}
}
void do_emt_opendisk()
{
- char *name = (char *)mem_pointer(REG_HL, 0);
+ char *name = (char *)mem_pointer(reg_HL, 0);
char *qname;
int i;
int oflag, eoflag;
- eoflag = REG_BC;
+ eoflag = reg_BC;
switch (eoflag & EO_ACCMODE) {
case EO_RDONLY:
default:
@@ -610,8 +610,8 @@ void do_emt_opendisk()
if (trs_emtsafe && oflag != O_RDONLY) {
error("potentially dangerous emulator trap blocked");
- REG_A = EACCES;
- REG_F &= ~ZERO_MASK;
+ reg_A = EACCES;
+ reg_F &= ~ZERO_MASK;
return;
}
@@ -627,56 +627,56 @@ void do_emt_opendisk()
if (!od[i].inuse) break;
}
if (i == MAX_OPENDISK) {
- REG_DE = 0xffff;
- REG_A = EMFILE;
- REG_F &= ~ZERO_MASK;
+ reg_DE = 0xffff;
+ reg_A = EMFILE;
+ reg_F &= ~ZERO_MASK;
free(qname);
return;
}
- od[i].fd = open(qname, oflag, REG_DE);
+ od[i].fd = open(qname, oflag, reg_DE);
free(qname);
if (od[i].fd >= 0) {
od[i].inuse = 1;
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
} else {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
}
- REG_DE = od[i].fd;
+ reg_DE = od[i].fd;
}
void do_emt_closedisk()
{
int i;
int res;
- if (REG_DE == 0xffff) {
+ if (reg_DE == 0xffff) {
for (i = 0; i < MAX_OPENDISK; i++) {
if (od[i].inuse) {
close(od[i].fd);
od[i].inuse = 0;
}
}
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
return;
}
for (i = 0; i < MAX_OPENDISK; i++) {
- if (od[i].inuse && od[i].fd == REG_DE) break;
+ if (od[i].inuse && od[i].fd == reg_DE) break;
}
if (i == MAX_OPENDISK) {
- REG_A = EBADF;
- REG_F &= ~ZERO_MASK;
+ reg_A = EBADF;
+ reg_F &= ~ZERO_MASK;
return;
}
od[i].inuse = 0;
res = close(od[i].fd);
if (res >= 0) {
- REG_A = 0;
- REG_F |= ZERO_MASK;
+ reg_A = 0;
+ reg_F |= ZERO_MASK;
} else {
- REG_A = errno;
- REG_F &= ~ZERO_MASK;
+ reg_A = errno;
+ reg_F &= ~ZERO_MASK;
}
}
diff --git a/trs_keyboard.c b/trs_keyboard.c
index 0f51c01..681473f 100644
--- a/trs_keyboard.c
+++ b/trs_keyboard.c
@@ -685,8 +685,8 @@ KeyTable function_key_table[] = {
/* 0xffe6 XK_Shift_Lock */ { TK_NULL, TK_Neutral },
/* 0xffe7 XK_Meta_L */ { TK_Clear, TK_Neutral },
/* 0xffe8 XK_Meta_R */ { TK_Down, TK_ForceShiftPersistent },
-/* 0xffe9 XK_Alt_L */ { TK_Clear, TK_Neutral },
-/* 0xffea XK_Alt_R */ { TK_Down, TK_ForceShiftPersistent },
+/* 0xffe9 XK_Alt_L */ { TK_NULL, TK_Neutral },
+/* 0xffea XK_Alt_R */ { TK_NULL, TK_Neutral },
/* 0xffeb XK_Super_L */ { TK_NULL, TK_Neutral },
/* 0xffec XK_Super_R */ { TK_NULL, TK_Neutral },
/* 0xffed XK_Hyper_L */ { TK_NULL, TK_Neutral },
@@ -885,7 +885,7 @@ int trs_kb_mem_read(int address)
static int timesseen;
/* Prevent endless recursive calls to this routine (by mem_read_word
- below) if REG_SP happens to point to keyboard memory. */
+ below) if reg_SP happens to point to keyboard memory. */
if (recursion) return 0;
/* Avoid delaying key state changes in queue for too long */
@@ -922,8 +922,8 @@ int trs_kb_mem_read(int address)
if (timesseen++ >= 16) {
recursion = 1;
for (i=0; i<=4; i+=2) {
- if (mem_read_word(REG_SP + 2 + i) == 0x4015) {
- wait = mem_read_word(REG_SP + 10 + i) == 0x004c;
+ if (mem_read_word(reg_SP + 2 + i) == 0x4015) {
+ wait = mem_read_word(reg_SP + 10 + i) == 0x004c;
break;
}
}
diff --git a/trs_memory.c b/trs_memory.c
index 5d98e8c..eb9bcd6 100644
--- a/trs_memory.c
+++ b/trs_memory.c
@@ -149,7 +149,7 @@ void mem_map(int which)
memory_map = which + (trs_model << 4) + (romin << 2);
}
-void mem_romin(state)
+extern void mem_romin(int state)
{
romin = (state & 1);
memory_map = (memory_map & ~4) + (romin << 2);
diff --git a/trs_printer.c b/trs_printer.c
index 8edd950..3352787 100644
--- a/trs_printer.c
+++ b/trs_printer.c
@@ -16,7 +16,7 @@
#include "z80.h"
#include "trs.h"
-void trs_printer_write(value)
+extern void trs_printer_write(int value)
{
if(value == 0x0D)
{
diff --git a/trs_xinterface.c b/trs_xinterface.c
index f8498e3..2f0da7b 100644
--- a/trs_xinterface.c
+++ b/trs_xinterface.c
@@ -82,6 +82,7 @@ static Pixmap trs_box[2][64];
static Display *display;
static int screen;
static Window window;
+static Window help_window;
static GC gc;
static GC gc_inv;
static GC gc_xor;
@@ -625,6 +626,98 @@ void trs_screen_unbatch()
#endif
}
+/*
+ * show help
+ */
+
+void trs_show_help()
+{
+ XWindowAttributes parent_attrs;
+ unsigned int help_width = 495;
+ unsigned int help_height = 365;
+ unsigned int help_xpos, help_ypos;
+ unsigned long foreground, background;
+ GC help_gc;
+ XGCValues values;
+ char *help_font_name = "9x15";
+ XFontStruct *help_font_info;
+ int font_height;
+ int text_line;
+ int i;
+ static char *helpitems[] = {
+ "F1: Model 4/4P F1 key",
+ "F2: Model 4/4P F2 key",
+ "F3: Model 4/4P F3 key",
+ "F4: Model 4/4P caps lock key",
+ "F5: TRS-80 @ key",
+ "F6: TRS-80 0 key",
+ "F7: signal disk change in emulated floppy drive",
+ "F8: exit emulator",
+ "F9: enter zbx debugger",
+ "F10: TRS-80 reset button",
+ "",
+ "LeftArrow, Backspace, Delete: TRS-80 left arrow key",
+ "RightArrow, Tab: TRS-80 right arrow key",
+ "UpArrow: TRS-80 up arrow key",
+ "DownArrow, Linefeed: TRS-80 down arrow key",
+ "",
+ "Esc, Break: TRS-80 break key",
+ "Home, Clear, LeftAlt: TRS-80 clear key",
+ "Control: Model 4/4P control key",
+ "RightAlt: shifted TRS-80 down arrow key",
+ "",
+ "F11 (Shift+F1 on some systems) toggles this help.",
+ "See the xtrs(1) manual page for more information.",
+ NULL
+ };
+
+ foreground = BlackPixel(display, screen);
+ background = WhitePixel(display, screen);
+ (void) XGetWindowAttributes(display, window, &parent_attrs);
+ if ((parent_attrs.width < help_width)
+ || (parent_attrs.height < help_height)) {
+ (void) fprintf(stderr, "%s: cannot display help window; parent window"
+ " dimensions not large enough to contain it\n",
+ program_name);
+ return;
+ }
+
+ help_xpos = (parent_attrs.width - help_width) / 2;
+ help_ypos = (parent_attrs.height - help_height) / 2;
+ help_window = XCreateSimpleWindow(display, window, help_xpos, help_ypos,
+ help_width, help_height, 1, foreground,
+ background);
+ help_font_info = XLoadQueryFont(display, help_font_name);
+ if (NULL == help_font_info) {
+ (void) fprintf(stderr, "%s: cannot display help window; cannot open"
+ " \"%s\" font\n", program_name, help_font_name);
+ return;
+ }
+ help_gc = XCreateGC(display, help_window, 0, &values);
+ XSetFont(display, help_gc, help_font_info->fid);
+ XSetBackground(display, help_gc, WhitePixel(display,screen));
+ XSetForeground(display, help_gc, BlackPixel(display,screen));
+
+ font_height = help_font_info->ascent + help_font_info->descent;
+ text_line = font_height;
+
+ XMapWindow(display, help_window);
+
+ for (i = 0; NULL != helpitems[i]; i++) {
+ size_t len;
+ int text_width;
+
+ len = strlen(helpitems[i]);
+ text_width = XTextWidth(help_font_info, helpitems[i], len);
+
+ XDrawString(display, help_window, help_gc, 10, text_line, helpitems[i],
+ len);
+ text_line += font_height;
+ }
+
+ return;
+}
+
/* exits if something really bad happens */
void trs_screen_init()
{
@@ -916,6 +1009,23 @@ void trs_get_event(int wait)
char buf[10];
XComposeStatus status;
+ /*
+ * Of Enter and Leave events, track which kind we saw last. X clients
+ * like "unclutter" will sythesize an Enter event on their own.
+ *
+ * Historically, xtrs assumed that every Enter would be preceded by a
+ * Leave. When this was not the case, xtrs would clobber the global
+ * autorepeat state to off; it wrongly stored the off state because the
+ * xtrs window already had focus.
+ *
+ * This enum is tri-valued with the zero value being UNDEF because we
+ * don't want to fake a Leave event the first time we Enter; that would
+ * cause restore_repeat() to read from repeat_state before it has been
+ * initialized, possibly storing a bogus global autorepeat state.
+ */
+ enum enter_leave_t { UNDEF, ENTER, LEAVE };
+ static enum enter_leave_t enter_leave;
+
if (trs_model > 1) {
(void)trs_uart_check_avail();
}
@@ -949,6 +1059,17 @@ void trs_get_event(int wait)
#if XDEBUG
debug("EnterNotify\n");
#endif
+ if (enter_leave == ENTER) {
+ /*
+ * The last Enter/Leave event we saw was an Enter; pretend we saw a
+ * Leave event first.
+ */
+#if XDEBUG
+ debug("faking a LeaveNotify event first\n");
+#endif
+ restore_repeat();
+ }
+ enter_leave = ENTER;
save_repeat();
trs_xlate_keysym(0x10000); /* all keys up */
break;
@@ -957,6 +1078,7 @@ void trs_get_event(int wait)
#if XDEBUG
debug("LeaveNotify\n");
#endif
+ enter_leave = LEAVE;
restore_repeat();
trs_xlate_keysym(0x10000); /* all keys up */
break;
@@ -969,6 +1091,14 @@ void trs_get_event(int wait)
#endif
switch (key) {
/* Trap some function keys here */
+ case XK_F11:
+ if (!help_window) {
+ trs_show_help();
+ } else {
+ XUnmapWindow(display, help_window);
+ help_window = 0;
+ }
+ break;
case XK_F10:
trs_reset(0);
key = 0;
diff --git a/xtrs.man b/xtrs.man
index 5353eff..30b6c48 100644
--- a/xtrs.man
+++ b/xtrs.man
@@ -68,6 +68,9 @@ equivalent to the 0 key (so that a shifted 0 can be obtained). F7
signals a disk change in the emulated floppy drives (see below). F8
exits the program. F9 enters the debugger (zbx). F10 is the reset button.
+F11 (or Shift+F1 on some systems) toggles an overlay window which
+summarizes the above information.
+
In Model III, 4, and 4P modes, the left and right shift keys are
distinct; in Model I mode, they are the same. The PageUp and PageDown
keys always activate the positions that correspond to the Model
diff --git a/xtrs.txt b/xtrs.txt
index d74dba6..c3e263e 100644
--- a/xtrs.txt
+++ b/xtrs.txt
@@ -1,4 +1,4 @@
-xtrs(1) xtrs(1)
+xtrs(1) General Commands Manual xtrs(1)
Name
xtrs - TRS-80 Model I/III/4/4P emulator for the X Window System
@@ -69,391 +69,394 @@ Keys
nals a disk change in the emulated floppy drives (see below). F8 exits
the program. F9 enters the debugger (zbx). F10 is the reset button.
- In Model III, 4, and 4P modes, the left and right shift keys are dis-
- tinct; in Model I mode, they are the same. The PageUp and PageDown
- keys always activate the positions that correspond to the Model
- III/4/4P left and right shift keys (address bit 7, data bits 0 and 1
- respectively), even in Model I mode. The End key activates an unused
+ F11 (or Shift+F1 on some systems) toggles an overlay window which sum-
+ marizes the above information.
+
+ In Model III, 4, and 4P modes, the left and right shift keys are dis-
+ tinct; in Model I mode, they are the same. The PageUp and PageDown
+ keys always activate the positions that correspond to the Model
+ III/4/4P left and right shift keys (address bit 7, data bits 0 and 1
+ respectively), even in Model I mode. The End key activates an unused
position in the keyboard matrix (address bit 7, data bit 7).
- The keys [, \, ], ^, , {, |, }, and ~ also activate unused positions
- in the keyboard matrix (address bit 3, data bits 3-7). With many
- TRS-80 keyboard drivers, these keys map to the corresponding ASCII
- characters; with others, they do nothing. In some cases you may find
- the shift state is reversed from what it should be; if you press [ but
- { is displayed instead (etc.), see the -shiftbracket and -noshift-
- bracket options below to correct the problem. The Insert key maps to
- the same position as underscore (address bit 3, data bit 7), so that
- this key can be used both with and without shift pressed; with many
+ The keys [, \, ], ^, , {, |, }, and ~ also activate unused positions
+ in the keyboard matrix (address bit 3, data bits 3-7). With many
+ TRS-80 keyboard drivers, these keys map to the corresponding ASCII
+ characters; with others, they do nothing. In some cases you may find
+ the shift state is reversed from what it should be; if you press [ but
+ { is displayed instead (etc.), see the -shiftbracket and -noshift-
+ bracket options below to correct the problem. The Insert key maps to
+ the same position as underscore (address bit 3, data bit 7), so that
+ this key can be used both with and without shift pressed; with many
TRS-80 keyboard drivers one of these maps to ASCII code 0x7f.
- On a German keyboard, the umlaut and "ess-tsett" keys should activate
+ On a German keyboard, the umlaut and "ess-tsett" keys should activate
the corresponding characters used in the GENIE, a German Model I clone.
- This feature is most useful together with the "-charset genie" command
+ This feature is most useful together with the "-charset genie" command
line argument.
- Pressing a key on a PC numeric keypad with NumLock disengaged emulates
- the Alpha Products joystick. Keys 2, 4, 6, 8 (KP Down, KP Left,
- KP Right, KP Up) are the main directions; keys 1, 3, 7, and 9 (KP End,
+ Pressing a key on a PC numeric keypad with NumLock disengaged emulates
+ the Alpha Products joystick. Keys 2, 4, 6, 8 (KP Down, KP Left,
+ KP Right, KP Up) are the main directions; keys 1, 3, 7, and 9 (KP End,
KP Page Down, KP Home, KP Page Up) work as diagonal directions by acti-
- vating two main directions at once; and key 0 (KP Insert) or 5
- (KP Begin) is the fire button. Note that your X server may default to
- sending digits for the keys on the numeric pad even if NumLock is not
- pressed. If you have this problem, you can use the xmodmap program to
+ vating two main directions at once; and key 0 (KP Insert) or 5
+ (KP Begin) is the fire button. Note that your X server may default to
+ sending digits for the keys on the numeric pad even if NumLock is not
+ pressed. If you have this problem, you can use the xmodmap program to
remap your numeric pad, and use the xev program to debug it.
Emulated cassette
- To control the emulated cassette, a file called ".cassette.ctl" in the
- current directory keeps track of what file is currently loaded as the
- cassette tape and the current position within that file. The cas-
- sette(1) shell script provides a way to manipulate this file. You may
- use this script to load and position cassette tape files. The opera-
- tion works very much like an actual tape recorder. See the cassette
- man page for more information about the cassette shell script and the
+ To control the emulated cassette, a file called ".cassette.ctl" in the
+ current directory keeps track of what file is currently loaded as the
+ cassette tape and the current position within that file. The cas-
+ sette(1) shell script provides a way to manipulate this file. You may
+ use this script to load and position cassette tape files. The opera-
+ tion works very much like an actual tape recorder. See the cassette
+ man page for more information about the cassette shell script and the
cassette file formats that are supported.
Printer
- For printer support, any text sent to the TRS-80's printer (using
+ For printer support, any text sent to the TRS-80's printer (using
LPRINT or LLIST, for example) is sent to the standard output.
Emulated floppy disks
- In Model I mode, xtrs emulates a Radio Shack Expansion Interface with
- the Percom Doubler or Radio Shack Doubler installed. The Doubler pro-
- vides double-density disk access by allowing either the stock WD1771
- FDC chip or a WD1791 chip to be selected under program control. At
- powerup the 1771 is selected, so operating systems with no Doubler
- driver see a stock system. By default, the emulator pretends to be
- both a Percom and Radio Shack Doubler at the same time -- it responds
- to the special commands of both -- so a driver for either should work.
- Under LDOS, use the command "FDUBL" (newer versions of LDOS), or
- "PDUBL" or "RDUBL" (older versions) to install the driver. Software
+ In Model I mode, xtrs emulates a Radio Shack Expansion Interface with
+ the Percom Doubler or Radio Shack Doubler installed. The Doubler pro-
+ vides double-density disk access by allowing either the stock WD1771
+ FDC chip or a WD1791 chip to be selected under program control. At
+ powerup the 1771 is selected, so operating systems with no Doubler
+ driver see a stock system. By default, the emulator pretends to be
+ both a Percom and Radio Shack Doubler at the same time -- it responds
+ to the special commands of both -- so a driver for either should work.
+ Under LDOS, use the command "FDUBL" (newer versions of LDOS), or
+ "PDUBL" or "RDUBL" (older versions) to install the driver. Software
that tries to detect which doubler you have (such as Super Utility) may
be confused by the emulation of both at once, so you can choose to emu-
late only one with a command line option; see below.
In Model III, 4, or 4P mode, xtrs emulates the stock floppy controller,
- which uses a WD1793 chip (software-compatible with the WD1791) to pro-
+ which uses a WD1793 chip (software-compatible with the WD1791) to pro-
vide both single and double density.
- Four 5.25-inch floppy drives are emulated, with storage in files named
- diskM-U, where M is the TRS-80 model (1, 3, 4, or 4p) and U is the
- drive unit number (0, 1, 2, or 3). If a file of the required name is
- not found, a drive with no disk in it is emulated (but see below). If
- the user does not have write permission for a floppy file, and/or the
- file has an internal write protect flag set, a write-protect tab is
- emulated. Use the mkdisk(1) program to turn the write protect flag on
- or off. To change floppies in an emulated drive, rename the existing
- file for the drive (if any), rename the new floppy file to the proper
+ Four 5.25-inch floppy drives are emulated, with storage in files named
+ diskM-U, where M is the TRS-80 model (1, 3, 4, or 4p) and U is the
+ drive unit number (0, 1, 2, or 3). If a file of the required name is
+ not found, a drive with no disk in it is emulated (but see below). If
+ the user does not have write permission for a floppy file, and/or the
+ file has an internal write protect flag set, a write-protect tab is
+ emulated. Use the mkdisk(1) program to turn the write protect flag on
+ or off. To change floppies in an emulated drive, rename the existing
+ file for the drive (if any), rename the new floppy file to the proper
name, and hit function key F7 in the emulator.
- If you try to boot an emulated Model I, III, or 4 with no file named
- diskM-0 (that is, no disk in drive 0), xtrs emulates having no floppy
+ If you try to boot an emulated Model I, III, or 4 with no file named
+ diskM-0 (that is, no disk in drive 0), xtrs emulates having no floppy
disk controller. The behavior of a real machine with a disk controller
- in this case didn't seem useful to emulate faithfully: A real Model I
- hangs with a screen full of garbage; a real Model III or 4 goes into a
- retry loop printing "Diskette?" on the screen and rechecking whether
- you've inserted one. A real Model 4P always has a floppy controller,
+ in this case didn't seem useful to emulate faithfully: A real Model I
+ hangs with a screen full of garbage; a real Model III or 4 goes into a
+ retry loop printing "Diskette?" on the screen and rechecking whether
+ you've inserted one. A real Model 4P always has a floppy controller,
however, so xtrs always emulates one.
- Due to a limitation of the original Model I hardware, drive :3 cannot
- be double-sided in Model I mode. In the original Model I, you could
+ Due to a limitation of the original Model I hardware, drive :3 cannot
+ be double-sided in Model I mode. In the original Model I, you could
not have a drive :3 at all if any drive in the system was double-sided,
but the emulator is able to be more forgiving.
Emulated floppy image files can be of any of three types: JV1, compati-
- ble with Jeff Vavasour's popular freeware Model I emulator for MS-DOS;
- JV3, a compatible extension of a format first used in Vavasour's com-
- mercial Model III/4 emulator; or DMK, compatible with David Keil's
- Model 4 emulator. All three types work in xtrs regardless of what
- model it is emulating. A heuristic is used to decide which type of
- image is in a drive, as none of the types has a magic number or signa-
+ ble with Jeff Vavasour's popular freeware Model I emulator for MS-DOS;
+ JV3, a compatible extension of a format first used in Vavasour's com-
+ mercial Model III/4 emulator; or DMK, compatible with David Keil's
+ Model 4 emulator. All three types work in xtrs regardless of what
+ model it is emulating. A heuristic is used to decide which type of
+ image is in a drive, as none of the types has a magic number or signa-
ture.
JV1 supports only single density, single sided, with directory on track
- 17. Sectors must be 256 bytes long. Use FORMAT (DIR=17) if you want
+ 17. Sectors must be 256 bytes long. Use FORMAT (DIR=17) if you want
to format JV1 disks with more (or less) than 35 tracks under LDOS.
- JV3 is much more flexible, though it still does not support everything
- the real controllers could do. It is probably best to use JV3 for all
- the disk images you create, since it is the most widely implemented by
- other emulators, unless you have a special reason to use one of the
- others. A JV3 disk can be formatted with 128, 256, 512, or 1024-byte
- sectors, 1 or 2 sides, single or double density, with either FB (nor-
- mal) or F8 (deleted) data address mark on any sector. In single den-
- sity the nonstandard data address marks FA and F9 are also available.
- You cannot format a sector with an incorrect track number or head num-
+ JV3 is much more flexible, though it still does not support everything
+ the real controllers could do. It is probably best to use JV3 for all
+ the disk images you create, since it is the most widely implemented by
+ other emulators, unless you have a special reason to use one of the
+ others. A JV3 disk can be formatted with 128, 256, 512, or 1024-byte
+ sectors, 1 or 2 sides, single or double density, with either FB (nor-
+ mal) or F8 (deleted) data address mark on any sector. In single den-
+ sity the nonstandard data address marks FA and F9 are also available.
+ You cannot format a sector with an incorrect track number or head num-
ber. You can format a sector with an intentional CRC error in the data
field. xtrs supports at most 5802 total sectors on a JV3 image.
- The original Vavasour JV3 format supported only 256-byte sectors, and
- had a limit of 2901 total sectors. If you use sector sizes other than
- 256 bytes or format more than 2901 sectors on a disk image, emulators
- other than xtrs may be unable to read it. Note that an 80 track, dou-
- ble-sided, double-density (18 sector) 5.25-inch floppy will fit within
- the original 2901 sector limit; the extension to 5802 is primarily for
+ The original Vavasour JV3 format supported only 256-byte sectors, and
+ had a limit of 2901 total sectors. If you use sector sizes other than
+ 256 bytes or format more than 2901 sectors on a disk image, emulators
+ other than xtrs may be unable to read it. Note that an 80 track, dou-
+ ble-sided, double-density (18 sector) 5.25-inch floppy will fit within
+ the original 2901 sector limit; the extension to 5802 is primarily for
emulation of 8-inch drives (discussed below).
- The DMK format is the most flexible. It supports essentially every-
- thing that the original hardware could do, including all "protected"
- disk formats. However, a few protected disks still may not work with
- xtrs due to limitations in xtrs's floppy disk controller emulation
- rather than limitations of the DMK format; see the LIMITATIONS section
+ The DMK format is the most flexible. It supports essentially every-
+ thing that the original hardware could do, including all "protected"
+ disk formats. However, a few protected disks still may not work with
+ xtrs due to limitations in xtrs's floppy disk controller emulation
+ rather than limitations of the DMK format; see the LIMITATIONS section
below.
The program mkdisk(1) makes a blank emulated floppy or "bulk erases" an
- existing one. By default, mkdisk makes a JV3 floppy, but with the -1
- flag it makes a JV1 floppy, or with the -k flag a DMK floppy. See the
+ existing one. By default, mkdisk makes a JV3 floppy, but with the -1
+ flag it makes a JV1 floppy, or with the -k flag a DMK floppy. See the
mkdisk man page for more information.
- Early Model I operating systems used an FA data address mark for the
- directory on single density disks, while later ones wrote F8 but would
+ Early Model I operating systems used an FA data address mark for the
+ directory on single density disks, while later ones wrote F8 but would
accept either upon reading. The change was needed because FA is a non-
- standard DAM that is fully supported only by the WD1771 floppy disk
- controller used in the Model I; the controllers in the Model III and 4
- cannot distinguish between FA and FB (which is used for non-directory
- sectors) upon reading, and cannot write FA. To deal nicely with this
- problem, xtrs implements the following kludge. On writing in single
+ standard DAM that is fully supported only by the WD1771 floppy disk
+ controller used in the Model I; the controllers in the Model III and 4
+ cannot distinguish between FA and FB (which is used for non-directory
+ sectors) upon reading, and cannot write FA. To deal nicely with this
+ problem, xtrs implements the following kludge. On writing in single
density, an F8 data address mark is recorded as FA. On reading with an
emulated WD1771 (available in Model I mode only), FA is returned as FA;
- on reading with a WD179x, FA is returned as F8. This trick makes the
+ on reading with a WD179x, FA is returned as F8. This trick makes the
different operating systems perfectly compatible with each other, which
- is better than on a real Model I! You can use the -truedam flag to
+ is better than on a real Model I! You can use the -truedam flag to
turn off this kludge if you need to; in that case the original hardware
is emulated exactly.
- TRS-80 programs that attempt to measure the rotational speed of their
+ TRS-80 programs that attempt to measure the rotational speed of their
floppy disk drives using timing loops will get the answers they expect,
- even when xtrs does not emulate instructions at the same speed as the
+ even when xtrs does not emulate instructions at the same speed as the
original machines. This works because xtrs keeps a virtual clock (tech-
- nically, a T-state counter), which measures how much time it should
- have taken to execute the instruction stream on a real machine, and it
- ties the emulation of floppy disk index holes to this clock, not to
+ nically, a T-state counter), which measures how much time it should
+ have taken to execute the instruction stream on a real machine, and it
+ ties the emulation of floppy disk index holes to this clock, not to
real time.
Emulated 8-inch floppy disks
- In addition to the four standard 5.25-inch drives, xtrs also emulates
- four 8-inch floppy drives. There is no widely-accepted standard hard-
- ware interface for 8-inch floppies on the TRS-80, so xtrs emulates a
+ In addition to the four standard 5.25-inch drives, xtrs also emulates
+ four 8-inch floppy drives. There is no widely-accepted standard hard-
+ ware interface for 8-inch floppies on the TRS-80, so xtrs emulates a
pseudo-hardware interface of its own and provides an LDOS/LS-DOS driver
for it.
- Storage for the emulated 8-inch disks is in files named diskM-U, where
- M is the TRS-80 model number (1, 3, 4, or 4p) and U is a unit number
+ Storage for the emulated 8-inch disks is in files named diskM-U, where
+ M is the TRS-80 model number (1, 3, 4, or 4p) and U is a unit number
(4, 5, 6, or 7). The only difference between 5.25-inch and 8-inch emu-
- lated drives is that the emulator allows you to format more bytes per
- track in the latter. A new JV3 floppy can be formatted as either
- 5.25-inch or 8-inch depending on whether you initially put it into a
+ lated drives is that the emulator allows you to format more bytes per
+ track in the latter. A new JV3 floppy can be formatted as either
+ 5.25-inch or 8-inch depending on whether you initially put it into a
5.25-inch or 8-inch emulated drive. A new DMK floppy, however, must be
- created with the -8 flag to mkdisk in order to be large enough for use
- in an 8-inch emulated drive. JV1 floppies cannot be used in 8-inch
+ created with the -8 flag to mkdisk in order to be large enough for use
+ in an 8-inch emulated drive. JV1 floppies cannot be used in 8-inch
drives. Be careful not to put an emulated floppy into a 5.25-inch emu-
- lated drive after it has been formatted in an 8-inch emulated drive or
- vice versa; the results are likely to be confusing. Consider using
- different file extensions for the two types; say, .dsk for 5.25-inch
+ lated drive after it has been formatted in an 8-inch emulated drive or
+ vice versa; the results are likely to be confusing. Consider using
+ different file extensions for the two types; say, .dsk for 5.25-inch
and .8in for 8-inch.
To use the emulated 8-inch drives, you'll need a driver. Under LDOS or
LS-DOS, use the program XTRS8/DCT supplied on the emulated floppy util-
- ity.dsk. This driver is a very simple wrapper around the native
+ ity.dsk. This driver is a very simple wrapper around the native
LDOS/LS-DOS floppy driver. Here are detailed instructions.
- First, make sure an appropriate version of LDOS is in emulated floppy
- drive 0, and the supplied file utility.dsk is in another emulated
+ First, make sure an appropriate version of LDOS is in emulated floppy
+ drive 0, and the supplied file utility.dsk is in another emulated
floppy drive. Boot LDOS. If you are using Model I LDOS, be sure FDUBL
is running.
- Second, type the following commands. Here d is the LDOS drive number
+ Second, type the following commands. Here d is the LDOS drive number
you want to use for the 8-inch drive and u is the unit number you chose
- when naming the file. Most likely you will choose d and u to be equal
+ when naming the file. Most likely you will choose d and u to be equal
to reduce confusion.
SYSTEM (DRIVE=d,DRIVER="XTRS8",ENABLE)
Enter unit number ([4]-7): u
- You can repeat these steps with different values of d and u to have
- more than one 8-inch drive. You might want to repeat four times using
- 4, 5, 6, and 7, or you might want to save some drive numbers for hard
+ You can repeat these steps with different values of d and u to have
+ more than one 8-inch drive. You might want to repeat four times using
+ 4, 5, 6, and 7, or you might want to save some drive numbers for hard
drives (see below).
- Finally, it's a good idea to give the SYSTEM (SYSGEN) command (Model
- I/III) or SYSGEN command (Model 4/4P). This command saves the SYSTEM
- settings, so the 8-inch drives will be available again the next time
- you reboot or restart the emulator. If you need to access an 8-inch
- drive after booting from a disk that hasn't been SYSGENed, simply use
+ Finally, it's a good idea to give the SYSTEM (SYSGEN) command (Model
+ I/III) or SYSGEN command (Model 4/4P). This command saves the SYSTEM
+ settings, so the 8-inch drives will be available again the next time
+ you reboot or restart the emulator. If you need to access an 8-inch
+ drive after booting from a disk that hasn't been SYSGENed, simply use
the same SYSTEM command again.
- In case you want to write your own driver for another TRS-80 operating
- system, here are details on the emulated pseudo-hardware. The 8-inch
- drives are accessed through the normal floppy disk controller, exactly
- like 5.25-inch drives. The four 5.25-inch drives have hardware select
- codes 1, 2, 4, and 8, corresponding respectively to files diskM-0, -1,
+ In case you want to write your own driver for another TRS-80 operating
+ system, here are details on the emulated pseudo-hardware. The 8-inch
+ drives are accessed through the normal floppy disk controller, exactly
+ like 5.25-inch drives. The four 5.25-inch drives have hardware select
+ codes 1, 2, 4, and 8, corresponding respectively to files diskM-0, -1,
-2, and -3. The four 8-inch drives have hardware select codes 3, 5, 6,
- and 7, corresponding respectively to files diskM-4, -5, -6, and -7.
+ and 7, corresponding respectively to files diskM-4, -5, -6, and -7.
(See also the -sizemap option below, however.)
Real floppy disks
- Under Linux only, any diskM-U file can be a symbolic link to a real
- floppy disk drive, typically /dev/fd0 or /dev/fd1. Most PCs should be
+ Under Linux only, any diskM-U file can be a symbolic link to a real
+ floppy disk drive, typically /dev/fd0 or /dev/fd1. Most PCs should be
able to read and write TRS-80 compatible floppies in this way. Many PC
- floppy controllers cannot handle single density, however, and some may
- have problems even with double density disks written on a real TRS-80,
- especially disks formatted by older TRS-80 operating systems. Use the
- -doublestep flag if you need to read 35-track or 40-track media in an
- 80-track drive. If you need to write 35-track or 40-track media in an
- 80-track drive, bulk-erase the media first and format it in the
- 80-track drive. Don't write to a disk in an 80-track drive if it has
+ floppy controllers cannot handle single density, however, and some may
+ have problems even with double density disks written on a real TRS-80,
+ especially disks formatted by older TRS-80 operating systems. Use the
+ -doublestep flag if you need to read 35-track or 40-track media in an
+ 80-track drive. If you need to write 35-track or 40-track media in an
+ 80-track drive, bulk-erase the media first and format it in the
+ 80-track drive. Don't write to a disk in an 80-track drive if it has
ever been written to in a 40-track drive. The narrower head used in an
80-track drive cannot erase the full track width written by the head in
a 40-track drive.
If you link one of the 5.25-inch floppy files (diskM-0 through diskM-3)
- to a real floppy drive, TRS-80 programs will see it as a 5.25-inch
- drive, but the actual drive can be either 3.5-inch or 5.25-inch. The
- drive will be operated in double density (or single density), not high
+ to a real floppy drive, TRS-80 programs will see it as a 5.25-inch
+ drive, but the actual drive can be either 3.5-inch or 5.25-inch. The
+ drive will be operated in double density (or single density), not high
density, so be sure to use the appropriate media.
If you link one of the 8-inch floppy files (diskM-4 through diskM-7) to
- a real floppy drive, TRS-80 programs will see it as an 8-inch drive.
- Again, you need to use the XTRS8/DCT driver described above to enable
- LDOS/LS-DOS to access an 8-inch drive. The real drive can be either
- 3.5-inch, 5.25-inch, or 8-inch. A 3.5-inch or 5.25-inch drive will be
- operated in high-density mode, using MFM recording if the TRS-80 is
+ a real floppy drive, TRS-80 programs will see it as an 8-inch drive.
+ Again, you need to use the XTRS8/DCT driver described above to enable
+ LDOS/LS-DOS to access an 8-inch drive. The real drive can be either
+ 3.5-inch, 5.25-inch, or 8-inch. A 3.5-inch or 5.25-inch drive will be
+ operated in high-density mode, using MFM recording if the TRS-80 is
trying to do double density, FM recording if the TRS-80 is trying to do
- single density. In this mode, these drives can hold as much data as a
+ single density. In this mode, these drives can hold as much data as a
standard 8-inch drive. In fact, a 5.25-inch HD drive holds exactly the
- same number of bits per track as an 8-inch drive; a 3.5-inch HD drive
+ same number of bits per track as an 8-inch drive; a 3.5-inch HD drive
can hold 20% more, but we waste that space when using one to emulate an
- 8-inch drive. In both cases we also waste the top three tracks, since
+ 8-inch drive. In both cases we also waste the top three tracks, since
an 8-inch drive has only 77 tracks, not 80.
- The nonstandard FA and F9 data address marks available in single den-
- sity on a real Model I with the WD1771 controller also need special
+ The nonstandard FA and F9 data address marks available in single den-
+ sity on a real Model I with the WD1771 controller also need special
handling. A PC-style floppy disk controller can neither read nor write
- sectors with such DAMs at all. This raises three issues: (1) It will
- be impossible for you to read some Model I disks on your PC even if
+ sectors with such DAMs at all. This raises three issues: (1) It will
+ be impossible for you to read some Model I disks on your PC even if
your PC otherwise supports single density. In particular, Model I TRS-
- DOS 2.3 directory tracks will be unreadable. (2) On writing in single
+ DOS 2.3 directory tracks will be unreadable. (2) On writing in single
density, xtrs silently records a F9 or FA DAM as F8. (3) On reading in
- single density with an emulated WD1771 (Model I mode only), F8 is
- returned as FA. If you need more accurate behavior, the -truedam flag
+ single density with an emulated WD1771 (Model I mode only), F8 is
+ returned as FA. If you need more accurate behavior, the -truedam flag
will turn on error messages on attempts to write F9 or FA DAMs and will
turn off translation of F8 to FA on reading.
Hint: Be sure to set the drive type correctly in your PC's BIOS. Linux
- and xtrs rely on this information to know how fast your drives are
+ and xtrs rely on this information to know how fast your drives are
spinning and hence what data rate to use when reading and writing. All
- 3.5-inch drives spin at 300 RPM. Newer 5.25-inch high-density capable
- drives ("1.2MB" drives) normally always spin at 360 RPM. (Some can be
- jumpered to slow down to 300 RPM when in double-density mode, but you
- should not do that when plugging one into a PC.) Older 5.25-inch
- drives that cannot do high density ("180KB", "360KB" or "720KB"
- 5.25-inch drives) always spin at 300 RPM. All 8-inch drives spin at
+ 3.5-inch drives spin at 300 RPM. Newer 5.25-inch high-density capable
+ drives ("1.2MB" drives) normally always spin at 360 RPM. (Some can be
+ jumpered to slow down to 300 RPM when in double-density mode, but you
+ should not do that when plugging one into a PC.) Older 5.25-inch
+ drives that cannot do high density ("180KB", "360KB" or "720KB"
+ 5.25-inch drives) always spin at 300 RPM. All 8-inch drives spin at
360 RPM. If you plug an 8-inch drive into a PC (this requires a 50-pin
- to 34-pin adaptor cable), tell your BIOS that it is a 5.25-inch 1.2MB
+ to 34-pin adaptor cable), tell your BIOS that it is a 5.25-inch 1.2MB
drive.
Emulated hard disks
xtrs can emulate a hard disk in a file in one of two ways: it can use a
- special, xtrs-specific LDOS driver called XTRSHARD/DCT, or it can emu-
- late the Radio Shack hard drive controller (based on the Western Digi-
+ special, xtrs-specific LDOS driver called XTRSHARD/DCT, or it can emu-
+ late the Radio Shack hard drive controller (based on the Western Digi-
tal WD1010) and use the native drivers for the original hardware.
Using XTRSHARD/DCT
The XTRSHARD/DCT driver has been tested and works under both LDOS 5.3.1
- for Model I or III and TRSDOS/LS-DOS 6.3.1 for Model 4/4P. It may or
- may not work under earlier LDOS versions. It definitely will not work
+ for Model I or III and TRSDOS/LS-DOS 6.3.1 for Model 4/4P. It may or
+ may not work under earlier LDOS versions. It definitely will not work
under other TRS-80 operating systems or with emulators other than xtrs.
- The hard disk format was designed by Matthew Reed for his Model I/III
- and Model 4 emulators; xtrs duplicates the format so that users can
+ The hard disk format was designed by Matthew Reed for his Model I/III
+ and Model 4 emulators; xtrs duplicates the format so that users can
exchange hard drive images across the emulators.
- To use XTRSHARD/DCT, first run the mkdisk program under Unix to create
- a blank hard drive (.hdv) file. Typical usage would be: mkdisk -h
+ To use XTRSHARD/DCT, first run the mkdisk program under Unix to create
+ a blank hard drive (.hdv) file. Typical usage would be: mkdisk -h
mydisk.hdv. See the mkdisk(1) man page for other options.
Second, link the file to an appropriate name. XTRSHARD/DCT supports up
- to eight hard drives, with names of the form hardM-U, where M is the
+ to eight hard drives, with names of the form hardM-U, where M is the
TRS-80 model (1, 3, or 4; in this case Model 4P also uses M=4) and U is
a unit number from 0 to 7. It looks for these files in the same direc-
tory as the floppy disk files diskM-U.
- Third, make sure an appropriate version of LDOS is in emulated floppy
- drive 0, and the supplied file utility.dsk is in another emulated
+ Third, make sure an appropriate version of LDOS is in emulated floppy
+ drive 0, and the supplied file utility.dsk is in another emulated
floppy drive. Boot LDOS. If you are using Model I LDOS 5.3.1, patch a
- bug in the FORMAT command by typing PATCH FORMAT/CMD.UTILITY M1FOR-
- MAT/FIX. You need to apply this patch only once. It must not be
+ bug in the FORMAT command by typing PATCH FORMAT/CMD.UTILITY M1FOR-
+ MAT/FIX. You need to apply this patch only once. It must not be
applied to Model III or Model 4/4P LDOS.
- Fourth, type the following commands. Here d is the LDOS drive number
- you want to use for the hard drive (a typical choice would be 4) and u
+ Fourth, type the following commands. Here d is the LDOS drive number
+ you want to use for the hard drive (a typical choice would be 4) and u
is the unit number you chose when naming the file (most likely 0).
SYSTEM (DRIVE=d,DRIVER="XTRSHARD",ENABLE)
Enter unit number ([0]-7): u
FORMAT d (DIR=1)
- Answer the questions asked by FORMAT as you prefer. The DIR=1 parame-
- ter to FORMAT is optional; it causes the hard drive's directory to be
- on track 1, making the initial size of the image smaller. You can
- repeat these steps with different values of d and u to have more than
+ Answer the questions asked by FORMAT as you prefer. The DIR=1 parame-
+ ter to FORMAT is optional; it causes the hard drive's directory to be
+ on track 1, making the initial size of the image smaller. You can
+ repeat these steps with different values of d and u to have more than
one hard drive.
- Finally, it's a good idea to give the SYSTEM (SYSGEN) command (Model
- I/III) or SYSGEN command (Model 4/4P). This command saves the SYSTEM
+ Finally, it's a good idea to give the SYSTEM (SYSGEN) command (Model
+ I/III) or SYSGEN command (Model 4/4P). This command saves the SYSTEM
settings, so the drive will be available again the next time you reboot
- or restart the emulator. If you need to access the hard disk file
- after booting from a floppy that hasn't been SYSGENed, simply use the
- same SYSTEM command(s) again, but don't FORMAT. You can freely use a
+ or restart the emulator. If you need to access the hard disk file
+ after booting from a floppy that hasn't been SYSGENed, simply use the
+ same SYSTEM command(s) again, but don't FORMAT. You can freely use a
different drive number or (if you renamed the hard disk file) a differ-
ent unit number.
The F7 key currently doesn't allow XTRSHARD/DCT disk changes to be rec-
- ognized, but you can change to a different hard disk file for the same
+ ognized, but you can change to a different hard disk file for the same
unit by renaming files as needed and rebooting LDOS.
- Technical note: XTRSHARD/DCT is a small Z-80 program that implements
- all the required functions of an LDOS disk driver. Instead of talking
- to a real (or emulated) hard disk controller, however, it uses special
- support in xtrs that allows Z-80 programs to open, close, read, and
- write Unix files directly. This support is described further in the
+ Technical note: XTRSHARD/DCT is a small Z-80 program that implements
+ all the required functions of an LDOS disk driver. Instead of talking
+ to a real (or emulated) hard disk controller, however, it uses special
+ support in xtrs that allows Z-80 programs to open, close, read, and
+ write Unix files directly. This support is described further in the
"Data import and export" section below.
Using native hard disk drivers
- Beginning in version 4.1, xtrs also emulates the Radio Shack hard disk
+ Beginning in version 4.1, xtrs also emulates the Radio Shack hard disk
controller (based on the Western Digital WD1010) and will work with the
- native drivers for this hardware. This emulation uses the same hard
+ native drivers for this hardware. This emulation uses the same hard
drive (.hdv) file format that XTRSHARD/DCT does. With LDOS/LS-DOS, the
- RSHARDx/DCT and TRSHD/DCT drivers are known to work. With Montezuma
- CP/M 2.2, the optional Montezuma hard disk drivers are known to work.
+ RSHARDx/DCT and TRSHD/DCT drivers are known to work. With Montezuma
+ CP/M 2.2, the optional Montezuma hard disk drivers are known to work.
The hard disk drivers for NEWDOS/80 and for Radio Shack CP/M 3.0 should
- work, but they have not yet been tested at this writing. Any bugs
+ work, but they have not yet been tested at this writing. Any bugs
should be reported.
- To get started, run the mkdisk program under Unix to create a blank
- hard drive (.hdv) file. Typical usage would be: mkdisk -h mydisk.hdv.
+ To get started, run the mkdisk program under Unix to create a blank
+ hard drive (.hdv) file. Typical usage would be: mkdisk -h mydisk.hdv.
See the mkdisk(1) man page for other options.
- Second, link the file to an appropriate name. The WD1010 emulation
- supports up to four hard drives, with names of the form hardM-U, where
+ Second, link the file to an appropriate name. The WD1010 emulation
+ supports up to four hard drives, with names of the form hardM-U, where
M is the TRS-80 model (1, 3, 4, or 4p) and U is a unit number from 0 to
- 3. It looks for these files in the same directory as the floppy disk
- files diskM-U. If no such files are present, xtrs disables the WD1010
+ 3. It looks for these files in the same directory as the floppy disk
+ files diskM-U. If no such files are present, xtrs disables the WD1010
emulation.
- Note that if hard drive unit 0 is present on a Model 4P (file
- hard4p-0), the Radio Shack boot ROM will always try to boot from it,
- even if the operating system does not support booting from a hard
- drive. If you have this problem, either hold down F2 while booting to
+ Note that if hard drive unit 0 is present on a Model 4P (file
+ hard4p-0), the Radio Shack boot ROM will always try to boot from it,
+ even if the operating system does not support booting from a hard
+ drive. If you have this problem, either hold down F2 while booting to
force the ROM to boot from floppy, or simply avoid using unit number 0.
Stock TRSDOS/LS-DOS 6 systems do not support booting from a hard drive;
- M.A.D. Software's HBUILD6 add-on to LS-DOS for hard drive booting
- should work, but is untested. Montezuma CP/M 2.2 does boot from the
+ M.A.D. Software's HBUILD6 add-on to LS-DOS for hard drive booting
+ should work, but is untested. Montezuma CP/M 2.2 does boot from the
emulated hard drive.
Finally, obtain the correct driver for the operating system you will be
- using, read its documentation, configure the driver, and format the
+ using, read its documentation, configure the driver, and format the
drive. Detailed instructions are beyond the scope of this manual page.
Data import and export
@@ -682,12 +685,12 @@ Joystick
joysticks using the X input extension, but this is not implemented yet.
Running games
- Some games run rather well under xtrs now, provided that your machine
- is fast enough to run the emulation in real time and that you choose
- the right command line options. "Galaxy Invaders Plus" by Big 5 Soft-
+ Some games run rather well under xtrs now, provided that your machine
+ is fast enough to run the emulation in real time and that you choose
+ the right command line options. "Galaxy Invaders Plus" by Big 5 Soft-
ware is particularly good. You will usually want to turn on autodelay,
- and if your machine is slow you may need to reduce the sound sample
- rate. Running your X server in 8-bit/pixel mode also seems to help in
+ and if your machine is slow you may need to reduce the sound sample
+ rate. Running your X server in 8-bit/pixel mode also seems to help in
some cases. Example command lines:
startx -- -bpp 8
@@ -695,7 +698,7 @@ Running games
If you have a slow machine and the sound breaks up, it is possible that
your machine is not fast enough to generate samples at the default rate
- of 44,100 Hz. If you think this may be happening, try "-samplerate
+ of 44,100 Hz. If you think this may be happening, try "-samplerate
11025" or even "-samplerate 8000".
Options
@@ -718,32 +721,32 @@ Options
Specifies the foreground color of the xtrs window.
-title titletext
- Use titletext in the window title bar instead of the program
+ Use titletext in the window title bar instead of the program
name.
-borderwidth width
- Put a border of width pixels around the TRS-80 display. The
+ Put a border of width pixels around the TRS-80 display. The
default is 2.
-scale xfac[,yfac]
- Multiply the horizontal and vertical window size by xfac and
- yfac, respectively. Possible values are integers in the range
- [1,4] for xfac and [1,8] for yfac. Defaults are xfac=1 and
+ Multiply the horizontal and vertical window size by xfac and
+ yfac, respectively. Possible values are integers in the range
+ [1,4] for xfac and [1,8] for yfac. Defaults are xfac=1 and
yfac=2*xfac.
-resize
In Model III or 4/4P mode, resize the X window whenever the emu-
lated display mode changes between 64x16 text (or 512x192 graph-
- ics) and 80x24 text (or 640x240 graphics). This is the default
- in Model III mode, since 80x24 text is not available and the
+ ics) and 80x24 text (or 640x240 graphics). This is the default
+ in Model III mode, since 80x24 text is not available and the
640x240 graphics add-on card is seldom used.
-noresize
In Model III or 4/4P mode, always keep the X window large enough
- for 80x24 text or 640x240 graphics, putting a blank margin
- around the outside when the emulated display mode is 64x16 text
- or 512x192 graphics. This is the default in Model 4/4P mode,
- since otherwise there is an annoying size switch during every
+ for 80x24 text or 640x240 graphics, putting a blank margin
+ around the outside when the emulated display mode is 64x16 text
+ or 512x192 graphics. This is the default in Model 4/4P mode,
+ since otherwise there is an annoying size switch during every
reboot.
-charset name
@@ -751,66 +754,66 @@ Options
In Model I mode, five sets are available. The default, wider, is
a modified Model III set with characters 8 pixels wide; it looks
- better on a modern computer screen with square pixels than the
+ better on a modern computer screen with square pixels than the
real Model I fonts, which were 6 pixels wide. lcmod is the char-
- acter set in the replacement character generator that was sup-
- plied with the Radio Shack lower case modification. (It was
- reconstructed partly from memory and may have some minor bit
+ acter set in the replacement character generator that was sup-
+ plied with the Radio Shack lower case modification. (It was
+ reconstructed partly from memory and may have some minor bit
errors.) stock is the character set in the stock character gen-
- erator supplied with most upper case only machines. Since xtrs
+ erator supplied with most upper case only machines. Since xtrs
currently always emulates the extra bit of display memory needed
- to support lower case, this character set gives you the authen-
- tic, unpleasant effect that real Model I users saw when they
- tried to do homebrew lower case modifications without replacing
- the character generator: lower case letters appear at an incon-
+ to support lower case, this character set gives you the authen-
+ tic, unpleasant effect that real Model I users saw when they
+ tried to do homebrew lower case modifications without replacing
+ the character generator: lower case letters appear at an incon-
sistent height, and if you are using the Level II BASIC ROM dis-
play driver, upper case letters are replaced by meaningless sym-
- bols. early is the same as stock, but with the standard ASCII
- characters [, \, ], and ^ in the positions where most Model I's
+ bols. early is the same as stock, but with the standard ASCII
+ characters [, \, ], and ^ in the positions where most Model I's
had directional arrows. This was the default programming in the
- Motorola character generator ROM that Radio Shack used, and a
- few early machines were actually shipped with this ROM.
- Finally, german or genie gives an approximate emulation of the
- GENIE, a German Model I clone. Characters are 8 pixels wide,
+ Motorola character generator ROM that Radio Shack used, and a
+ few early machines were actually shipped with this ROM.
+ Finally, german or genie gives an approximate emulation of the
+ GENIE, a German Model I clone. Characters are 8 pixels wide,
and double width is supported even though later GENIE models did
not include it.
- In Model III, 4, and 4P modes, three sets are available:
- katakana (the default for Model III) is the original Model III
+ In Model III, 4, and 4P modes, three sets are available:
+ katakana (the default for Model III) is the original Model III
set with Japanese Katakana characters in the alternate character
- positions. This set was also used in early Model 4's. interna-
- tional (the default for Model 4 and 4P) is a later Model 4 set
+ positions. This set was also used in early Model 4's. interna-
+ tional (the default for Model 4 and 4P) is a later Model 4 set
with accented Roman letters in the alternate positions. bold is
- a bold set from a character generator ROM found in one Model
+ a bold set from a character generator ROM found in one Model
III, origin uncertain.
-usefont
Use X fonts instead of the built-in character bitmaps.
-nofont
- Use the built-in character bitmaps, not a X font. This is the
+ Use the built-in character bitmaps, not a X font. This is the
default.
-font fontname
- If -usefont is also given, use the specified X font for normal
+ If -usefont is also given, use the specified X font for normal
width characters. The default uses a common X fixed-width font:
"-misc-fixed-medium-r-normal--20-200-75-75-*-100-iso8859-1".
-widefont fontname
- If -usefont is also given, use the specified X font for double
+ If -usefont is also given, use the specified X font for double
width characters. The default uses a common X fixed-width font,
- scaled to double width: "-misc-fixed-medium-r-nor-
+ scaled to double width: "-misc-fixed-medium-r-nor-
mal--20-200-75-75-*-200-iso8859-1".
-nomicrolabs
In Model I mode, emulate the HRG1B 384x192 hi-res graphics card.
- In Model III mode or Model 4/4P mode, emulate the Radio Shack
+ In Model III mode or Model 4/4P mode, emulate the Radio Shack
hi-res card. This is now the default.
-microlabs
- In Model III or 4/4P mode, emulate the Micro Labs Grafyx Solu-
- tion hi-res graphics card. Note that the Model III and Model
- 4/4P cards from Micro Labs are very different from one another.
+ In Model III or 4/4P mode, emulate the Micro Labs Grafyx Solu-
+ tion hi-res graphics card. Note that the Model III and Model
+ 4/4P cards from Micro Labs are very different from one another.
-debug Enter zbx, the z80 debugger.
@@ -827,42 +830,42 @@ Options
tions on compiling in default romfiles or default romfile names.
-model m
- Specifies which TRS-80 model to emulate. Values accepted are 1
- or I (Model I), 3 or III (Model III), 4 or IV (Model 4), and 4P
+ Specifies which TRS-80 model to emulate. Values accepted are 1
+ or I (Model I), 3 or III (Model III), 4 or IV (Model 4), and 4P
or IVP (Model 4P). Model I is the default.
-delay d
- A crude speed control. After each Z-80 instruction, xtrs busy-
- waits for d iterations around an empty loop. A really smart C
+ A crude speed control. After each Z-80 instruction, xtrs busy-
+ waits for d iterations around an empty loop. A really smart C
optimizer might delete this loop entirely, so it's possible that
- this option won't work if you compile xtrs with too high an
+ this option won't work if you compile xtrs with too high an
optimization level. The default delay is 0.
-autodelay
- Dynamically adjusts the value of -delay to run instructions at
- roughly the same rate as a real machine. The tracking is only
+ Dynamically adjusts the value of -delay to run instructions at
+ roughly the same rate as a real machine. The tracking is only
approximate, but it can be useful for running games.
-noautodelay
Turn off -autodelay. This is the default.
-keystretch cycles
- Fine-tune the keyboard behavior. To prevent keystrokes from
- being lost, xtrs "stretches" the intervals between key transi-
- tions, so that the Z-80 program has time to see each transition
+ Fine-tune the keyboard behavior. To prevent keystrokes from
+ being lost, xtrs "stretches" the intervals between key transi-
+ tions, so that the Z-80 program has time to see each transition
before the next one occurs. Whenever the Z-80 program reads the
- keyboard matrix and sees an emulated key go up or down, xtrs
- waits cycles Z-80 clock cycles (T-states) before it allows the
+ keyboard matrix and sees an emulated key go up or down, xtrs
+ waits cycles Z-80 clock cycles (T-states) before it allows the
program to see another key transition. Key transitions that are
- received during the waiting period or when the Z-80 program is
- not reading the keyboard are held in a queue. The default
+ received during the waiting period or when the Z-80 program is
+ not reading the keyboard are held in a queue. The default
stretch value is 4000 cycles; it should seldom if ever be neces-
sary to change it.
-shiftbracket
Emulate [, \, ], ^, and as shifted keys, and {, |, }, and ~ as
- unshifted. This is the default in Model 4 and 4P modes, and it
- works well with the keyboard driver in Model 4 TRSDOS/LS-DOS 6.
+ unshifted. This is the default in Model 4 and 4P modes, and it
+ works well with the keyboard driver in Model 4 TRSDOS/LS-DOS 6.
-noshiftbracket
Emulate [, \, ], ^, and as unshifted keys, and {, |, }, and ~
diff --git a/z80.c b/z80.c
index dda64d4..07d0bfc 100644
--- a/z80.c
+++ b/z80.c
@@ -162,7 +162,7 @@ static void do_add_flags(int a, int b, int result)
if((result & 0xFF) == 0) f |= ZERO_MASK;
- REG_F = f;
+ reg_F = f;
}
static void do_sub_flags(int a, int b, int result)
@@ -185,7 +185,7 @@ static void do_sub_flags(int a, int b, int result)
if((result & 0xFF) == 0) f |= ZERO_MASK;
- REG_F = f;
+ reg_F = f;
}
@@ -211,7 +211,7 @@ static void do_adc_word_flags(int a, int b, int result)
if((result & 0xFFFF) == 0) f |= ZERO_MASK;
- REG_F = f;
+ reg_F = f;
}
static void do_add_word_flags(int a, int b, int result)
@@ -232,10 +232,10 @@ static void do_add_word_flags(int a, int b, int result)
f = half_carry_table[index & 7] |
(sign_carry_overflow_table[index >> 4] & CARRY_MASK) |
- (REG_F & (ZERO_MASK | PARITY_MASK | SIGN_MASK)) |
+ (reg_F & (ZERO_MASK | PARITY_MASK | SIGN_MASK)) |
((result >> 8) & (UNDOC3_MASK | UNDOC5_MASK));
- REG_F = f;
+ reg_F = f;
}
static void do_sbc_word_flags(int a, int b, int result)
@@ -260,7 +260,7 @@ static void do_sbc_word_flags(int a, int b, int result)
if((result & 0xFFFF) == 0) f |= ZERO_MASK;
- REG_F = f;
+ reg_F = f;
}
static void do_flags_dec_byte(int value)
@@ -278,7 +278,7 @@ static void do_flags_dec_byte(int value)
if(value & 0x80)
set |= SIGN_MASK;
- REG_F = (REG_F & CARRY_MASK) | set
+ reg_F = (reg_F & CARRY_MASK) | set
| (value & (UNDOC3_MASK | UNDOC5_MASK));
}
@@ -297,7 +297,7 @@ static void do_flags_inc_byte(int value)
if(value & 0x80)
set |= SIGN_MASK;
- REG_F = (REG_F & CARRY_MASK) | set
+ reg_F = (reg_F & CARRY_MASK) | set
| (value & (UNDOC3_MASK | UNDOC5_MASK));
}
@@ -310,7 +310,7 @@ static void do_and_byte(int value)
int result;
Uchar set;
- result = (REG_A &= value);
+ result = (reg_A &= value);
set = HALF_CARRY_MASK;
@@ -321,7 +321,7 @@ static void do_and_byte(int value)
if(result & 0x80)
set |= SIGN_MASK;
- REG_F = set | (result & (UNDOC3_MASK | UNDOC5_MASK));
+ reg_F = set | (result & (UNDOC3_MASK | UNDOC5_MASK));
}
static void do_or_byte(int value)
@@ -329,7 +329,7 @@ static void do_or_byte(int value)
int result; /* the result of the or operation */
Uchar set;
- result = (REG_A |= value);
+ result = (reg_A |= value);
set = 0;
@@ -340,7 +340,7 @@ static void do_or_byte(int value)
if(result & 0x80)
set |= SIGN_MASK;
- REG_F = set | (result & (UNDOC3_MASK | UNDOC5_MASK));
+ reg_F = set | (result & (UNDOC3_MASK | UNDOC5_MASK));
}
static void do_xor_byte(int value)
@@ -348,7 +348,7 @@ static void do_xor_byte(int value)
int result; /* the result of the xor operation */
Uchar set;
- result = (REG_A ^= value);
+ result = (reg_A ^= value);
set = 0;
@@ -359,15 +359,15 @@ static void do_xor_byte(int value)
if(result & 0x80)
set |= SIGN_MASK;
- REG_F = set | (result & (UNDOC3_MASK | UNDOC5_MASK));
+ reg_F = set | (result & (UNDOC3_MASK | UNDOC5_MASK));
}
static void do_add_byte(int value)
{
int a, result;
- result = (a = REG_A) + value;
- REG_A = result;
+ result = (a = reg_A) + value;
+ reg_A = result;
do_add_flags(a, value, result);
}
@@ -376,10 +376,10 @@ static void do_adc_byte(int value)
int a, result;
if(CARRY_FLAG)
- result = (a = REG_A) + value + 1;
+ result = (a = reg_A) + value + 1;
else
- result = (a = REG_A) + value;
- REG_A = result;
+ result = (a = reg_A) + value;
+ reg_A = result;
do_add_flags(a, value, result);
}
@@ -387,8 +387,8 @@ static void do_sub_byte(int value)
{
int a, result;
- result = (a = REG_A) - value;
- REG_A = result;
+ result = (a = reg_A) - value;
+ reg_A = result;
do_sub_flags(a, value, result);
}
@@ -396,9 +396,9 @@ static void do_negate()
{
int a;
- a = REG_A;
- REG_A = - a;
- do_sub_flags(0, a, REG_A);
+ a = reg_A;
+ reg_A = - a;
+ do_sub_flags(0, a, reg_A);
}
static void do_sbc_byte(int value)
@@ -406,10 +406,10 @@ static void do_sbc_byte(int value)
int a, result;
if(CARRY_FLAG)
- result = (a = REG_A) - (value + 1);
+ result = (a = reg_A) - (value + 1);
else
- result = (a = REG_A) - value;
- REG_A = result;
+ result = (a = reg_A) - value;
+ reg_A = result;
do_sub_flags(a, value, result);
}
@@ -417,8 +417,8 @@ static void do_add_word(int value)
{
int a, result;
- result = (a = REG_HL) + value;
- REG_HL = result;
+ result = (a = reg_HL) + value;
+ reg_HL = result;
do_add_word_flags(a, value, result);
}
@@ -428,11 +428,11 @@ static void do_adc_word(int value)
int a, result;
if(CARRY_FLAG)
- result = (a = REG_HL) + value + 1;
+ result = (a = reg_HL) + value + 1;
else
- result = (a = REG_HL) + value;
+ result = (a = reg_HL) + value;
- REG_HL = result;
+ reg_HL = result;
do_adc_word_flags(a, value, result);
}
@@ -442,11 +442,11 @@ static void do_sbc_word(int value)
int a, result;
if(CARRY_FLAG)
- result = (a = REG_HL) - (value + 1);
+ result = (a = reg_HL) - (value + 1);
else
- result = (a = REG_HL) - value;
+ result = (a = reg_HL) - value;
- REG_HL = result;
+ reg_HL = result;
do_sbc_word_flags(a, value, result);
}
@@ -468,7 +468,7 @@ static void do_cp(int value)
int index;
int f;
- result = (a = REG_A) - value;
+ result = (a = reg_A) - value;
/*
* Sign, carry, and overflow depend upon values of bit 7.
@@ -485,24 +485,24 @@ static void do_cp(int value)
if((result & 0xFF) == 0) f |= ZERO_MASK;
- REG_F = f;
+ reg_F = f;
}
static void do_cpd()
{
- int oldcarry = REG_F & CARRY_MASK;
+ int oldcarry = reg_F & CARRY_MASK;
int a, value, result;
- value = mem_read(REG_HL);
- result = (a = REG_A) - value;
- REG_HL--;
- REG_BC--;
+ value = mem_read(reg_HL);
+ result = (a = reg_A) - value;
+ reg_HL--;
+ reg_BC--;
do_sub_flags(a, value, result);
- REG_F = (REG_F & ~(CARRY_MASK | OVERFLOW_MASK | UNDOC5_MASK))
- | oldcarry | (REG_BC == 0 ? 0 : OVERFLOW_MASK)
- | (((result - ((REG_F & HALF_CARRY_MASK) >> 4)) & 2) << 4);
- if ((result & 15) == 8 && (REG_F & HALF_CARRY_MASK) != 0) {
- REG_F &= ~UNDOC3_MASK;
+ reg_F = (reg_F & ~(CARRY_MASK | OVERFLOW_MASK | UNDOC5_MASK))
+ | oldcarry | (reg_BC == 0 ? 0 : OVERFLOW_MASK)
+ | (((result - ((reg_F & HALF_CARRY_MASK) >> 4)) & 2) << 4);
+ if ((result & 15) == 8 && (reg_F & HALF_CARRY_MASK) != 0) {
+ reg_F &= ~UNDOC3_MASK;
}
T_COUNT(16);
@@ -510,19 +510,19 @@ static void do_cpd()
static void do_cpi()
{
- int oldcarry = REG_F & CARRY_MASK;
+ int oldcarry = reg_F & CARRY_MASK;
int a, value, result;
- value = mem_read(REG_HL);
- result = (a = REG_A) - value;
- REG_HL++;
- REG_BC--;
+ value = mem_read(reg_HL);
+ result = (a = reg_A) - value;
+ reg_HL++;
+ reg_BC--;
do_sub_flags(a, value, result);
- REG_F = (REG_F & ~(CARRY_MASK | OVERFLOW_MASK | UNDOC5_MASK))
- | oldcarry | (REG_BC == 0 ? 0 : OVERFLOW_MASK)
- | (((result - ((REG_F & HALF_CARRY_MASK) >> 4)) & 2) << 4);
- if ((result & 15) == 8 && (REG_F & HALF_CARRY_MASK) != 0) {
- REG_F &= ~UNDOC3_MASK;
+ reg_F = (reg_F & ~(CARRY_MASK | OVERFLOW_MASK | UNDOC5_MASK))
+ | oldcarry | (reg_BC == 0 ? 0 : OVERFLOW_MASK)
+ | (((result - ((reg_F & HALF_CARRY_MASK) >> 4)) & 2) << 4);
+ if ((result & 15) == 8 && (reg_F & HALF_CARRY_MASK) != 0) {
+ reg_F &= ~UNDOC3_MASK;
}
T_COUNT(16);
@@ -530,24 +530,24 @@ static void do_cpi()
static void do_cpdr()
{
- int oldcarry = REG_F & CARRY_MASK;
- int a = REG_A, value, result;
+ int oldcarry = reg_F & CARRY_MASK;
+ int a = reg_A, value, result;
do
{
- result = a - (value = mem_read(REG_HL));
- REG_HL--;
- REG_BC--;
+ result = a - (value = mem_read(reg_HL));
+ reg_HL--;
+ reg_BC--;
T_COUNT(21);
- } while((REG_BC != 0) && (result != 0));
+ } while((reg_BC != 0) && (result != 0));
do_sub_flags(a, value, result);
- REG_F = (REG_F & ~(CARRY_MASK | OVERFLOW_MASK | UNDOC5_MASK))
- | oldcarry | (REG_BC == 0 ? 0 : OVERFLOW_MASK)
- | (((result - ((REG_F & HALF_CARRY_MASK) >> 4)) & 2) << 4);
- if ((result & 15) == 8 && (REG_F & HALF_CARRY_MASK) != 0) {
- REG_F &= ~UNDOC3_MASK;
+ reg_F = (reg_F & ~(CARRY_MASK | OVERFLOW_MASK | UNDOC5_MASK))
+ | oldcarry | (reg_BC == 0 ? 0 : OVERFLOW_MASK)
+ | (((result - ((reg_F & HALF_CARRY_MASK) >> 4)) & 2) << 4);
+ if ((result & 15) == 8 && (reg_F & HALF_CARRY_MASK) != 0) {
+ reg_F &= ~UNDOC3_MASK;
}
T_COUNT(-5);
@@ -555,24 +555,24 @@ static void do_cpdr()
static void do_cpir()
{
- int oldcarry = REG_F & CARRY_MASK;
- int a = REG_A, value, result;
+ int oldcarry = reg_F & CARRY_MASK;
+ int a = reg_A, value, result;
do
{
- result = a - (value = mem_read(REG_HL));
- REG_HL++;
- REG_BC--;
+ result = a - (value = mem_read(reg_HL));
+ reg_HL++;
+ reg_BC--;
T_COUNT(21);
- } while((REG_BC != 0) && (result != 0));
+ } while((reg_BC != 0) && (result != 0));
do_sub_flags(a, value, result);
- REG_F = (REG_F & ~(CARRY_MASK | OVERFLOW_MASK | UNDOC5_MASK))
- | oldcarry | (REG_BC == 0 ? 0 : OVERFLOW_MASK)
- | (((result - ((REG_F & HALF_CARRY_MASK) >> 4)) & 2) << 4);
- if ((result & 15) == 8 && (REG_F & HALF_CARRY_MASK) != 0) {
- REG_F &= ~UNDOC3_MASK;
+ reg_F = (reg_F & ~(CARRY_MASK | OVERFLOW_MASK | UNDOC5_MASK))
+ | oldcarry | (reg_BC == 0 ? 0 : OVERFLOW_MASK)
+ | (((result - ((reg_F & HALF_CARRY_MASK) >> 4)) & 2) << 4);
+ if ((result & 15) == 8 && (reg_F & HALF_CARRY_MASK) != 0) {
+ reg_F &= ~UNDOC3_MASK;
}
T_COUNT(-5);
@@ -585,7 +585,7 @@ static void do_cpir()
static void do_test_bit(int op, int value, int bit)
{
int result = value & (1 << bit);
- REG_F = (REG_F & CARRY_MASK) | HALF_CARRY_MASK | (result & SIGN_MASK)
+ reg_F = (reg_F & CARRY_MASK) | HALF_CARRY_MASK | (result & SIGN_MASK)
| (result ? 0 : (OVERFLOW_MASK | ZERO_MASK))
| (((op & 7) == 6) ? 0 : (value & (UNDOC3_MASK | UNDOC5_MASK)));
}
@@ -600,7 +600,7 @@ static void do_test_bit(int op, int value, int bit)
static void do_test_bit(int op, int value, int bit)
{
int result = value & (1 << bit);
- REG_F = (REG_F & CARRY_MASK) | HALF_CARRY_MASK
+ reg_F = (reg_F & CARRY_MASK) | HALF_CARRY_MASK
| (result & (UNDOC3_MASK | UNDOC5_MASK | SIGN_MASK))
| (result ? 0 : (OVERFLOW_MASK | ZERO_MASK));
}
@@ -636,7 +636,7 @@ static int rl_byte(int value)
if(value & 0x80)
set |= CARRY_MASK;
- REG_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
+ reg_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
return result;
}
@@ -671,7 +671,7 @@ static int rr_byte(int value)
if(value & 0x1)
set |= CARRY_MASK;
- REG_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
+ reg_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
return result;
}
@@ -705,7 +705,7 @@ static int rlc_byte(int value)
if(parity(result))
set |= PARITY_MASK;
- REG_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
+ reg_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
return result;
}
@@ -734,7 +734,7 @@ static int rrc_byte(int value)
if(parity(result))
set |= PARITY_MASK;
- REG_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
+ reg_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
return result;
}
@@ -749,20 +749,20 @@ static void do_rla()
set = 0;
- if(REG_A & 0x80)
+ if(reg_A & 0x80)
set |= CARRY_MASK;
if(CARRY_FLAG)
{
- REG_A = ((REG_A << 1) & 0xFF) | 1;
+ reg_A = ((reg_A << 1) & 0xFF) | 1;
}
else
{
- REG_A = (REG_A << 1) & 0xFF;
+ reg_A = (reg_A << 1) & 0xFF;
}
- REG_F = (REG_F & (OVERFLOW_MASK | ZERO_MASK | SIGN_MASK))
- | set | (REG_A & (UNDOC3_MASK | UNDOC5_MASK ));
+ reg_F = (reg_F & (OVERFLOW_MASK | ZERO_MASK | SIGN_MASK))
+ | set | (reg_A & (UNDOC3_MASK | UNDOC5_MASK ));
}
static void do_rra()
@@ -771,19 +771,19 @@ static void do_rra()
set = 0;
- if(REG_A & 0x1)
+ if(reg_A & 0x1)
set |= CARRY_MASK;
if(CARRY_FLAG)
{
- REG_A = (REG_A >> 1) | 0x80;
+ reg_A = (reg_A >> 1) | 0x80;
}
else
{
- REG_A = REG_A >> 1;
+ reg_A = reg_A >> 1;
}
- REG_F = (REG_F & (OVERFLOW_MASK | ZERO_MASK | SIGN_MASK))
- | set | (REG_A & (UNDOC3_MASK | UNDOC5_MASK ));
+ reg_F = (reg_F & (OVERFLOW_MASK | ZERO_MASK | SIGN_MASK))
+ | set | (reg_A & (UNDOC3_MASK | UNDOC5_MASK ));
}
static void do_rlca()
@@ -792,17 +792,17 @@ static void do_rlca()
set = 0;
- if(REG_A & 0x80)
+ if(reg_A & 0x80)
{
- REG_A = ((REG_A << 1) & 0xFF) | 1;
+ reg_A = ((reg_A << 1) & 0xFF) | 1;
set |= CARRY_MASK;
}
else
{
- REG_A = (REG_A << 1) & 0xFF;
+ reg_A = (reg_A << 1) & 0xFF;
}
- REG_F = (REG_F & (OVERFLOW_MASK | ZERO_MASK | SIGN_MASK))
- | set | (REG_A & (UNDOC3_MASK | UNDOC5_MASK ));
+ reg_F = (reg_F & (OVERFLOW_MASK | ZERO_MASK | SIGN_MASK))
+ | set | (reg_A & (UNDOC3_MASK | UNDOC5_MASK ));
}
static void do_rrca()
@@ -811,17 +811,17 @@ static void do_rrca()
set = 0;
- if(REG_A & 0x1)
+ if(reg_A & 0x1)
{
- REG_A = (REG_A >> 1) | 0x80;
+ reg_A = (reg_A >> 1) | 0x80;
set |= CARRY_MASK;
}
else
{
- REG_A = REG_A >> 1;
+ reg_A = reg_A >> 1;
}
- REG_F = (REG_F & (OVERFLOW_MASK | ZERO_MASK | SIGN_MASK))
- | set | (REG_A & (UNDOC3_MASK | UNDOC5_MASK ));
+ reg_F = (reg_F & (OVERFLOW_MASK | ZERO_MASK | SIGN_MASK))
+ | set | (reg_A & (UNDOC3_MASK | UNDOC5_MASK ));
}
static int sla_byte(int value)
@@ -842,7 +842,7 @@ static int sla_byte(int value)
if(value & 0x80)
set |= CARRY_MASK;
- REG_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
+ reg_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
return result;
}
@@ -871,7 +871,7 @@ static int sra_byte(int value)
if(value & 0x1)
set |= CARRY_MASK;
- REG_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
+ reg_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
return result;
}
@@ -895,7 +895,7 @@ static int slia_byte(int value)
if(value & 0x80)
set |= CARRY_MASK;
- REG_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
+ reg_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
return result;
}
@@ -918,7 +918,7 @@ static int srl_byte(int value)
if(value & 0x1)
set |= CARRY_MASK;
- REG_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
+ reg_F = (result & (UNDOC3_MASK | UNDOC5_MASK)) | set;
return result;
}
@@ -926,17 +926,17 @@ static int srl_byte(int value)
static void do_ldd()
{
int moved, undoc;
- mem_write(REG_DE, moved = mem_read(REG_HL));
- REG_DE--;
- REG_HL--;
- REG_BC--;
+ mem_write(reg_DE, moved = mem_read(reg_HL));
+ reg_DE--;
+ reg_HL--;
+ reg_BC--;
- if(REG_BC == 0)
+ if(reg_BC == 0)
CLEAR_OVERFLOW();
else
SET_OVERFLOW();
- undoc = REG_A + moved;
- REG_F = (REG_F & ~(UNDOC3_MASK|UNDOC5_MASK|HALF_CARRY_MASK|SUBTRACT_MASK))
+ undoc = reg_A + moved;
+ reg_F = (reg_F & ~(UNDOC3_MASK|UNDOC5_MASK|HALF_CARRY_MASK|SUBTRACT_MASK))
| (undoc & UNDOC3_MASK) | ((undoc & 2) ? UNDOC5_MASK : 0);
T_COUNT(16);
}
@@ -944,17 +944,17 @@ static void do_ldd()
static void do_ldi()
{
int moved, undoc;
- mem_write(REG_DE, moved = mem_read(REG_HL));
- REG_DE++;
- REG_HL++;
- REG_BC--;
+ mem_write(reg_DE, moved = mem_read(reg_HL));
+ reg_DE++;
+ reg_HL++;
+ reg_BC--;
- if(REG_BC == 0)
+ if(reg_BC == 0)
CLEAR_OVERFLOW();
else
SET_OVERFLOW();
- undoc = REG_A + moved;
- REG_F = (REG_F & ~(UNDOC3_MASK|UNDOC5_MASK|HALF_CARRY_MASK|SUBTRACT_MASK))
+ undoc = reg_A + moved;
+ reg_F = (reg_F & ~(UNDOC3_MASK|UNDOC5_MASK|HALF_CARRY_MASK|SUBTRACT_MASK))
| (undoc & UNDOC3_MASK) | ((undoc & 2) ? UNDOC5_MASK : 0);
T_COUNT(16);
}
@@ -964,17 +964,17 @@ static void do_ldir()
/* repeating block load with increment */
int moved, undoc;
- moved = mem_block_transfer(REG_DE, REG_HL, 1, REG_BC);
- T_COUNT(((REG_BC-1) & 0xffff) * 21 + 16);
+ moved = mem_block_transfer(reg_DE, reg_HL, 1, reg_BC);
+ T_COUNT(((reg_BC-1) & 0xffff) * 21 + 16);
/* set registers to final values */
- REG_DE += REG_BC;
- REG_HL += REG_BC;
- REG_BC = 0;
+ reg_DE += reg_BC;
+ reg_HL += reg_BC;
+ reg_BC = 0;
/* set up flags */
- undoc = REG_A + moved;
- REG_F = (REG_F & (CARRY_MASK | ZERO_MASK | SIGN_MASK))
+ undoc = reg_A + moved;
+ reg_F = (reg_F & (CARRY_MASK | ZERO_MASK | SIGN_MASK))
| (undoc & UNDOC3_MASK) | ((undoc & 2) ? UNDOC5_MASK : 0);
}
@@ -983,17 +983,17 @@ static void do_lddr()
/* repeating block load with decrement */
int moved, undoc;
- moved = mem_block_transfer(REG_DE, REG_HL, -1, REG_BC);
- T_COUNT(((REG_BC-1) & 0xffff) * 21 + 16);
+ moved = mem_block_transfer(reg_DE, reg_HL, -1, reg_BC);
+ T_COUNT(((reg_BC-1) & 0xffff) * 21 + 16);
/* set registers to final values */
- REG_DE -= REG_BC;
- REG_HL -= REG_BC;
- REG_BC = 0;
+ reg_DE -= reg_BC;
+ reg_HL -= reg_BC;
+ reg_BC = 0;
/* set up flags */
- undoc = REG_A + moved;
- REG_F = (REG_F & (CARRY_MASK | ZERO_MASK | SIGN_MASK))
+ undoc = reg_A + moved;
+ reg_F = (reg_F & (CARRY_MASK | ZERO_MASK | SIGN_MASK))
| (undoc & UNDOC3_MASK) | ((undoc & 2) ? UNDOC5_MASK : 0);
}
@@ -1003,17 +1003,17 @@ static void do_ld_a_i()
set = 0;
- REG_A = REG_I;
+ reg_A = reg_I;
- if(REG_A & 0x80)
+ if(reg_A & 0x80)
set |= SIGN_MASK;
- if(REG_A == 0)
+ if(reg_A == 0)
set |= ZERO_MASK;
if(z80_state.iff2)
set |= OVERFLOW_MASK;
- REG_F = (REG_F & CARRY_MASK) | (REG_A & (UNDOC3_MASK | UNDOC5_MASK)) | set;
+ reg_F = (reg_F & CARRY_MASK) | (reg_A & (UNDOC3_MASK | UNDOC5_MASK)) | set;
}
static void do_ld_a_r()
@@ -1023,24 +1023,24 @@ static void do_ld_a_r()
set = 0;
/* Fetch a random value. */
- REG_A = (rand() >> 8) & 0xFF;
+ reg_A = (rand() >> 8) & 0xFF;
- if(REG_A & 0x80)
+ if(reg_A & 0x80)
set |= SIGN_MASK;
- if(REG_A == 0)
+ if(reg_A == 0)
set |= ZERO_MASK;
if(z80_state.iff2)
set |= OVERFLOW_MASK;
- REG_F = (REG_F & CARRY_MASK) | (REG_A & (UNDOC3_MASK | UNDOC5_MASK)) | set;
+ reg_F = (reg_F & CARRY_MASK) | (reg_A & (UNDOC3_MASK | UNDOC5_MASK)) | set;
}
/* Completely new implementation adapted from yaze.
The old one was very wrong. */
static void do_daa()
{
- int a = REG_A, f = REG_F;
+ int a = reg_A, f = reg_F;
int alow = a & 0xf;
int carry = f & CARRY_MASK;
int hcarry = f & HALF_CARRY_MASK;
@@ -1062,8 +1062,8 @@ static void do_daa()
}
if (a & 0x100) carry = CARRY_MASK;
- REG_A = a = a & 0xff;
- REG_F = ((a & 0x80) ? SIGN_MASK : 0)
+ reg_A = a = a & 0xff;
+ reg_F = ((a & 0x80) ? SIGN_MASK : 0)
| (a & (UNDOC3_MASK|UNDOC5_MASK))
| (a ? 0 : ZERO_MASK)
| (f & SUBTRACT_MASK)
@@ -1080,23 +1080,23 @@ static void do_rld()
set = 0;
- old_value = mem_read(REG_HL);
+ old_value = mem_read(reg_HL);
/* left-shift old value, add lower bits of a */
- new_value = ((old_value << 4) | (REG_A & 0x0f)) & 0xff;
+ new_value = ((old_value << 4) | (reg_A & 0x0f)) & 0xff;
/* rotate high bits of old value into low bits of a */
- REG_A = (REG_A & 0xf0) | (old_value >> 4);
+ reg_A = (reg_A & 0xf0) | (old_value >> 4);
- if(REG_A & 0x80)
+ if(reg_A & 0x80)
set |= SIGN_MASK;
- if(REG_A == 0)
+ if(reg_A == 0)
set |= ZERO_MASK;
- if(parity(REG_A))
+ if(parity(reg_A))
set |= PARITY_MASK;
- REG_F = (REG_F & CARRY_MASK) | set | (REG_A & (UNDOC3_MASK | UNDOC5_MASK));
- mem_write(REG_HL,new_value);
+ reg_F = (reg_F & CARRY_MASK) | set | (reg_A & (UNDOC3_MASK | UNDOC5_MASK));
+ mem_write(reg_HL,new_value);
}
static void do_rrd()
@@ -1109,23 +1109,23 @@ static void do_rrd()
set = 0;
- old_value = mem_read(REG_HL);
+ old_value = mem_read(reg_HL);
/* right-shift old value, add lower bits of a */
- new_value = (old_value >> 4) | ((REG_A & 0x0f) << 4);
+ new_value = (old_value >> 4) | ((reg_A & 0x0f) << 4);
/* rotate low bits of old value into low bits of a */
- REG_A = (REG_A & 0xf0) | (old_value & 0x0f);
+ reg_A = (reg_A & 0xf0) | (old_value & 0x0f);
- if(REG_A & 0x80)
+ if(reg_A & 0x80)
set |= SIGN_MASK;
- if(REG_A == 0)
+ if(reg_A == 0)
set |= ZERO_MASK;
- if(parity(REG_A))
+ if(parity(reg_A))
set |= PARITY_MASK;
- REG_F = (REG_F & CARRY_MASK) | set | (REG_A & (UNDOC3_MASK | UNDOC5_MASK));
- mem_write(REG_HL,new_value);
+ reg_F = (reg_F & CARRY_MASK) | set | (reg_A & (UNDOC3_MASK | UNDOC5_MASK));
+ mem_write(reg_HL,new_value);
}
@@ -1135,11 +1135,11 @@ static void do_rrd()
static void do_ind()
{
- mem_write(REG_HL, z80_in(REG_C));
- REG_HL--;
- REG_B--;
+ mem_write(reg_HL, z80_in(reg_C));
+ reg_HL--;
+ reg_B--;
- if(REG_B == 0)
+ if(reg_B == 0)
SET_ZERO();
else
CLEAR_ZERO();
@@ -1152,11 +1152,11 @@ static void do_indr()
{
do
{
- mem_write(REG_HL, z80_in(REG_C));
- REG_HL--;
- REG_B--;
+ mem_write(reg_HL, z80_in(reg_C));
+ reg_HL--;
+ reg_B--;
T_COUNT(20);
- } while(REG_B != 0);
+ } while(reg_B != 0);
T_COUNT(-5);
SET_ZERO();
@@ -1165,11 +1165,11 @@ static void do_indr()
static void do_ini()
{
- mem_write(REG_HL, z80_in(REG_C));
- REG_HL++;
- REG_B--;
+ mem_write(reg_HL, z80_in(reg_C));
+ reg_HL++;
+ reg_B--;
- if(REG_B == 0)
+ if(reg_B == 0)
SET_ZERO();
else
CLEAR_ZERO();
@@ -1182,11 +1182,11 @@ static void do_inir()
{
do
{
- mem_write(REG_HL, z80_in(REG_C));
- REG_HL++;
- REG_B--;
+ mem_write(reg_HL, z80_in(reg_C));
+ reg_HL++;
+ reg_B--;
T_COUNT(20);
- } while(REG_B != 0);
+ } while(reg_B != 0);
T_COUNT(-5);
SET_ZERO();
@@ -1218,18 +1218,18 @@ static int in_with_flags(int port)
/* What should the half-carry do? Is this a mistake? */
- REG_F = (REG_F & clear) | set;
+ reg_F = (reg_F & clear) | set;
return value;
}
static void do_outd()
{
- z80_out(REG_C, mem_read(REG_HL));
- REG_HL--;
- REG_B--;
+ z80_out(reg_C, mem_read(reg_HL));
+ reg_HL--;
+ reg_B--;
- if(REG_B == 0)
+ if(reg_B == 0)
SET_ZERO();
else
CLEAR_ZERO();
@@ -1242,11 +1242,11 @@ static void do_outdr()
{
do
{
- z80_out(REG_C, mem_read(REG_HL));
- REG_HL--;
- REG_B--;
+ z80_out(reg_C, mem_read(reg_HL));
+ reg_HL--;
+ reg_B--;
T_COUNT(20);
- } while(REG_B != 0);
+ } while(reg_B != 0);
T_COUNT(-5);
SET_ZERO();
@@ -1255,11 +1255,11 @@ static void do_outdr()
static void do_outi()
{
- z80_out(REG_C, mem_read(REG_HL));
- REG_HL++;
- REG_B--;
+ z80_out(reg_C, mem_read(reg_HL));
+ reg_HL++;
+ reg_B--;
- if(REG_B == 0)
+ if(reg_B == 0)
SET_ZERO();
else
CLEAR_ZERO();
@@ -1272,11 +1272,11 @@ static void do_outir()
{
do
{
- z80_out(REG_C, mem_read(REG_HL));
- REG_HL++;
- REG_B--;
+ z80_out(reg_C, mem_read(reg_HL));
+ reg_HL++;
+ reg_B--;
T_COUNT(20);
- } while(REG_B != 0);
+ } while(reg_B != 0);
T_COUNT(-5);
SET_ZERO();
@@ -1316,19 +1316,19 @@ static void do_im2()
static void do_int()
{
/* handle a maskable interrupt */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC);
z80_state.iff1 = 0;
switch (z80_state.interrupt_mode) {
case 0:
- /* REG_PC = get_irq_vector() & 0x38; */
+ /* reg_PC = get_irq_vector() & 0x38; */
error("interrupt in im0 not supported");
break;
case 1:
- REG_PC = 0x38;
+ reg_PC = 0x38;
break;
case 2:
- /* REG_PC = REG_I << 8 + get_irq_vector(); */
+ /* reg_PC = reg_I << 8 + get_irq_vector(); */
error("interrupt in im2 not supported");
break;
}
@@ -1337,10 +1337,10 @@ static void do_int()
static void do_nmi()
{
/* handle a non-maskable interrupt */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC);
z80_state.iff1 = 0;
- REG_PC = 0x66;
+ reg_PC = 0x66;
}
/*
@@ -1350,794 +1350,794 @@ static void do_CB_instruction()
{
Uchar instruction;
- instruction = mem_read(REG_PC++);
+ instruction = mem_read(reg_PC++);
switch(instruction)
{
case 0x47: /* bit 0, a */
- do_test_bit(instruction, REG_A, 0); T_COUNT(8);
+ do_test_bit(instruction, reg_A, 0); T_COUNT(8);
break;
case 0x40: /* bit 0, b */
- do_test_bit(instruction, REG_B, 0); T_COUNT(8);
+ do_test_bit(instruction, reg_B, 0); T_COUNT(8);
break;
case 0x41: /* bit 0, c */
- do_test_bit(instruction, REG_C, 0); T_COUNT(8);
+ do_test_bit(instruction, reg_C, 0); T_COUNT(8);
break;
case 0x42: /* bit 0, d */
- do_test_bit(instruction, REG_D, 0); T_COUNT(8);
+ do_test_bit(instruction, reg_D, 0); T_COUNT(8);
break;
case 0x43: /* bit 0, e */
- do_test_bit(instruction, REG_E, 0); T_COUNT(8);
+ do_test_bit(instruction, reg_E, 0); T_COUNT(8);
break;
case 0x44: /* bit 0, h */
- do_test_bit(instruction, REG_H, 0); T_COUNT(8);
+ do_test_bit(instruction, reg_H, 0); T_COUNT(8);
break;
case 0x45: /* bit 0, l */
- do_test_bit(instruction, REG_L, 0); T_COUNT(8);
+ do_test_bit(instruction, reg_L, 0); T_COUNT(8);
break;
case 0x4F: /* bit 1, a */
- do_test_bit(instruction, REG_A, 1); T_COUNT(8);
+ do_test_bit(instruction, reg_A, 1); T_COUNT(8);
break;
case 0x48: /* bit 1, b */
- do_test_bit(instruction, REG_B, 1); T_COUNT(8);
+ do_test_bit(instruction, reg_B, 1); T_COUNT(8);
break;
case 0x49: /* bit 1, c */
- do_test_bit(instruction, REG_C, 1); T_COUNT(8);
+ do_test_bit(instruction, reg_C, 1); T_COUNT(8);
break;
case 0x4A: /* bit 1, d */
- do_test_bit(instruction, REG_D, 1); T_COUNT(8);
+ do_test_bit(instruction, reg_D, 1); T_COUNT(8);
break;
case 0x4B: /* bit 1, e */
- do_test_bit(instruction, REG_E, 1); T_COUNT(8);
+ do_test_bit(instruction, reg_E, 1); T_COUNT(8);
break;
case 0x4C: /* bit 1, h */
- do_test_bit(instruction, REG_H, 1); T_COUNT(8);
+ do_test_bit(instruction, reg_H, 1); T_COUNT(8);
break;
case 0x4D: /* bit 1, l */
- do_test_bit(instruction, REG_L, 1); T_COUNT(8);
+ do_test_bit(instruction, reg_L, 1); T_COUNT(8);
break;
case 0x57: /* bit 2, a */
- do_test_bit(instruction, REG_A, 2); T_COUNT(8);
+ do_test_bit(instruction, reg_A, 2); T_COUNT(8);
break;
case 0x50: /* bit 2, b */
- do_test_bit(instruction, REG_B, 2); T_COUNT(8);
+ do_test_bit(instruction, reg_B, 2); T_COUNT(8);
break;
case 0x51: /* bit 2, c */
- do_test_bit(instruction, REG_C, 2); T_COUNT(8);
+ do_test_bit(instruction, reg_C, 2); T_COUNT(8);
break;
case 0x52: /* bit 2, d */
- do_test_bit(instruction, REG_D, 2); T_COUNT(8);
+ do_test_bit(instruction, reg_D, 2); T_COUNT(8);
break;
case 0x53: /* bit 2, e */
- do_test_bit(instruction, REG_E, 2); T_COUNT(8);
+ do_test_bit(instruction, reg_E, 2); T_COUNT(8);
break;
case 0x54: /* bit 2, h */
- do_test_bit(instruction, REG_H, 2); T_COUNT(8);
+ do_test_bit(instruction, reg_H, 2); T_COUNT(8);
break;
case 0x55: /* bit 2, l */
- do_test_bit(instruction, REG_L, 2); T_COUNT(8);
+ do_test_bit(instruction, reg_L, 2); T_COUNT(8);
break;
case 0x5F: /* bit 3, a */
- do_test_bit(instruction, REG_A, 3); T_COUNT(8);
+ do_test_bit(instruction, reg_A, 3); T_COUNT(8);
break;
case 0x58: /* bit 3, b */
- do_test_bit(instruction, REG_B, 3); T_COUNT(8);
+ do_test_bit(instruction, reg_B, 3); T_COUNT(8);
break;
case 0x59: /* bit 3, c */
- do_test_bit(instruction, REG_C, 3); T_COUNT(8);
+ do_test_bit(instruction, reg_C, 3); T_COUNT(8);
break;
case 0x5A: /* bit 3, d */
- do_test_bit(instruction, REG_D, 3); T_COUNT(8);
+ do_test_bit(instruction, reg_D, 3); T_COUNT(8);
break;
case 0x5B: /* bit 3, e */
- do_test_bit(instruction, REG_E, 3); T_COUNT(8);
+ do_test_bit(instruction, reg_E, 3); T_COUNT(8);
break;
case 0x5C: /* bit 3, h */
- do_test_bit(instruction, REG_H, 3); T_COUNT(8);
+ do_test_bit(instruction, reg_H, 3); T_COUNT(8);
break;
case 0x5D: /* bit 3, l */
- do_test_bit(instruction, REG_L, 3); T_COUNT(8);
+ do_test_bit(instruction, reg_L, 3); T_COUNT(8);
break;
case 0x67: /* bit 4, a */
- do_test_bit(instruction, REG_A, 4); T_COUNT(8);
+ do_test_bit(instruction, reg_A, 4); T_COUNT(8);
break;
case 0x60: /* bit 4, b */
- do_test_bit(instruction, REG_B, 4); T_COUNT(8);
+ do_test_bit(instruction, reg_B, 4); T_COUNT(8);
break;
case 0x61: /* bit 4, c */
- do_test_bit(instruction, REG_C, 4); T_COUNT(8);
+ do_test_bit(instruction, reg_C, 4); T_COUNT(8);
break;
case 0x62: /* bit 4, d */
- do_test_bit(instruction, REG_D, 4); T_COUNT(8);
+ do_test_bit(instruction, reg_D, 4); T_COUNT(8);
break;
case 0x63: /* bit 4, e */
- do_test_bit(instruction, REG_E, 4); T_COUNT(8);
+ do_test_bit(instruction, reg_E, 4); T_COUNT(8);
break;
case 0x64: /* bit 4, h */
- do_test_bit(instruction, REG_H, 4); T_COUNT(8);
+ do_test_bit(instruction, reg_H, 4); T_COUNT(8);
break;
case 0x65: /* bit 4, l */
- do_test_bit(instruction, REG_L, 4); T_COUNT(8);
+ do_test_bit(instruction, reg_L, 4); T_COUNT(8);
break;
case 0x6F: /* bit 5, a */
- do_test_bit(instruction, REG_A, 5); T_COUNT(8);
+ do_test_bit(instruction, reg_A, 5); T_COUNT(8);
break;
case 0x68: /* bit 5, b */
- do_test_bit(instruction, REG_B, 5); T_COUNT(8);
+ do_test_bit(instruction, reg_B, 5); T_COUNT(8);
break;
case 0x69: /* bit 5, c */
- do_test_bit(instruction, REG_C, 5); T_COUNT(8);
+ do_test_bit(instruction, reg_C, 5); T_COUNT(8);
break;
case 0x6A: /* bit 5, d */
- do_test_bit(instruction, REG_D, 5); T_COUNT(8);
+ do_test_bit(instruction, reg_D, 5); T_COUNT(8);
break;
case 0x6B: /* bit 5, e */
- do_test_bit(instruction, REG_E, 5); T_COUNT(8);
+ do_test_bit(instruction, reg_E, 5); T_COUNT(8);
break;
case 0x6C: /* bit 5, h */
- do_test_bit(instruction, REG_H, 5); T_COUNT(8);
+ do_test_bit(instruction, reg_H, 5); T_COUNT(8);
break;
case 0x6D: /* bit 5, l */
- do_test_bit(instruction, REG_L, 5); T_COUNT(8);
+ do_test_bit(instruction, reg_L, 5); T_COUNT(8);
break;
case 0x77: /* bit 6, a */
- do_test_bit(instruction, REG_A, 6); T_COUNT(8);
+ do_test_bit(instruction, reg_A, 6); T_COUNT(8);
break;
case 0x70: /* bit 6, b */
- do_test_bit(instruction, REG_B, 6); T_COUNT(8);
+ do_test_bit(instruction, reg_B, 6); T_COUNT(8);
break;
case 0x71: /* bit 6, c */
- do_test_bit(instruction, REG_C, 6); T_COUNT(8);
+ do_test_bit(instruction, reg_C, 6); T_COUNT(8);
break;
case 0x72: /* bit 6, d */
- do_test_bit(instruction, REG_D, 6); T_COUNT(8);
+ do_test_bit(instruction, reg_D, 6); T_COUNT(8);
break;
case 0x73: /* bit 6, e */
- do_test_bit(instruction, REG_E, 6); T_COUNT(8);
+ do_test_bit(instruction, reg_E, 6); T_COUNT(8);
break;
case 0x74: /* bit 6, h */
- do_test_bit(instruction, REG_H, 6); T_COUNT(8);
+ do_test_bit(instruction, reg_H, 6); T_COUNT(8);
break;
case 0x75: /* bit 6, l */
- do_test_bit(instruction, REG_L, 6); T_COUNT(8);
+ do_test_bit(instruction, reg_L, 6); T_COUNT(8);
break;
case 0x7F: /* bit 7, a */
- do_test_bit(instruction, REG_A, 7); T_COUNT(8);
+ do_test_bit(instruction, reg_A, 7); T_COUNT(8);
break;
case 0x78: /* bit 7, b */
- do_test_bit(instruction, REG_B, 7); T_COUNT(8);
+ do_test_bit(instruction, reg_B, 7); T_COUNT(8);
break;
case 0x79: /* bit 7, c */
- do_test_bit(instruction, REG_C, 7); T_COUNT(8);
+ do_test_bit(instruction, reg_C, 7); T_COUNT(8);
break;
case 0x7A: /* bit 7, d */
- do_test_bit(instruction, REG_D, 7); T_COUNT(8);
+ do_test_bit(instruction, reg_D, 7); T_COUNT(8);
break;
case 0x7B: /* bit 7, e */
- do_test_bit(instruction, REG_E, 7); T_COUNT(8);
+ do_test_bit(instruction, reg_E, 7); T_COUNT(8);
break;
case 0x7C: /* bit 7, h */
- do_test_bit(instruction, REG_H, 7); T_COUNT(8);
+ do_test_bit(instruction, reg_H, 7); T_COUNT(8);
break;
case 0x7D: /* bit 7, l */
- do_test_bit(instruction, REG_L, 7); T_COUNT(8);
+ do_test_bit(instruction, reg_L, 7); T_COUNT(8);
break;
case 0x46: /* bit 0, (hl) */
- do_test_bit(instruction, mem_read(REG_HL), 0); T_COUNT(12);
+ do_test_bit(instruction, mem_read(reg_HL), 0); T_COUNT(12);
break;
case 0x4E: /* bit 1, (hl) */
- do_test_bit(instruction, mem_read(REG_HL), 1); T_COUNT(12);
+ do_test_bit(instruction, mem_read(reg_HL), 1); T_COUNT(12);
break;
case 0x56: /* bit 2, (hl) */
- do_test_bit(instruction, mem_read(REG_HL), 2); T_COUNT(12);
+ do_test_bit(instruction, mem_read(reg_HL), 2); T_COUNT(12);
break;
case 0x5E: /* bit 3, (hl) */
- do_test_bit(instruction, mem_read(REG_HL), 3); T_COUNT(12);
+ do_test_bit(instruction, mem_read(reg_HL), 3); T_COUNT(12);
break;
case 0x66: /* bit 4, (hl) */
- do_test_bit(instruction, mem_read(REG_HL), 4); T_COUNT(12);
+ do_test_bit(instruction, mem_read(reg_HL), 4); T_COUNT(12);
break;
case 0x6E: /* bit 5, (hl) */
- do_test_bit(instruction, mem_read(REG_HL), 5); T_COUNT(12);
+ do_test_bit(instruction, mem_read(reg_HL), 5); T_COUNT(12);
break;
case 0x76: /* bit 6, (hl) */
- do_test_bit(instruction, mem_read(REG_HL), 6); T_COUNT(12);
+ do_test_bit(instruction, mem_read(reg_HL), 6); T_COUNT(12);
break;
case 0x7E: /* bit 7, (hl) */
- do_test_bit(instruction, mem_read(REG_HL), 7); T_COUNT(12);
+ do_test_bit(instruction, mem_read(reg_HL), 7); T_COUNT(12);
break;
case 0x87: /* res 0, a */
- REG_A &= ~(1 << 0); T_COUNT(8);
+ reg_A &= ~(1 << 0); T_COUNT(8);
break;
case 0x80: /* res 0, b */
- REG_B &= ~(1 << 0); T_COUNT(8);
+ reg_B &= ~(1 << 0); T_COUNT(8);
break;
case 0x81: /* res 0, c */
- REG_C &= ~(1 << 0); T_COUNT(8);
+ reg_C &= ~(1 << 0); T_COUNT(8);
break;
case 0x82: /* res 0, d */
- REG_D &= ~(1 << 0); T_COUNT(8);
+ reg_D &= ~(1 << 0); T_COUNT(8);
break;
case 0x83: /* res 0, e */
- REG_E &= ~(1 << 0); T_COUNT(8);
+ reg_E &= ~(1 << 0); T_COUNT(8);
break;
case 0x84: /* res 0, h */
- REG_H &= ~(1 << 0); T_COUNT(8);
+ reg_H &= ~(1 << 0); T_COUNT(8);
break;
case 0x85: /* res 0, l */
- REG_L &= ~(1 << 0); T_COUNT(8);
+ reg_L &= ~(1 << 0); T_COUNT(8);
break;
case 0x8F: /* res 1, a */
- REG_A &= ~(1 << 1); T_COUNT(8);
+ reg_A &= ~(1 << 1); T_COUNT(8);
break;
case 0x88: /* res 1, b */
- REG_B &= ~(1 << 1); T_COUNT(8);
+ reg_B &= ~(1 << 1); T_COUNT(8);
break;
case 0x89: /* res 1, c */
- REG_C &= ~(1 << 1); T_COUNT(8);
+ reg_C &= ~(1 << 1); T_COUNT(8);
break;
case 0x8A: /* res 1, d */
- REG_D &= ~(1 << 1); T_COUNT(8);
+ reg_D &= ~(1 << 1); T_COUNT(8);
break;
case 0x8B: /* res 1, e */
- REG_E &= ~(1 << 1); T_COUNT(8);
+ reg_E &= ~(1 << 1); T_COUNT(8);
break;
case 0x8C: /* res 1, h */
- REG_H &= ~(1 << 1); T_COUNT(8);
+ reg_H &= ~(1 << 1); T_COUNT(8);
break;
case 0x8D: /* res 1, l */
- REG_L &= ~(1 << 1); T_COUNT(8);
+ reg_L &= ~(1 << 1); T_COUNT(8);
break;
case 0x97: /* res 2, a */
- REG_A &= ~(1 << 2); T_COUNT(8);
+ reg_A &= ~(1 << 2); T_COUNT(8);
break;
case 0x90: /* res 2, b */
- REG_B &= ~(1 << 2); T_COUNT(8);
+ reg_B &= ~(1 << 2); T_COUNT(8);
break;
case 0x91: /* res 2, c */
- REG_C &= ~(1 << 2); T_COUNT(8);
+ reg_C &= ~(1 << 2); T_COUNT(8);
break;
case 0x92: /* res 2, d */
- REG_D &= ~(1 << 2); T_COUNT(8);
+ reg_D &= ~(1 << 2); T_COUNT(8);
break;
case 0x93: /* res 2, e */
- REG_E &= ~(1 << 2); T_COUNT(8);
+ reg_E &= ~(1 << 2); T_COUNT(8);
break;
case 0x94: /* res 2, h */
- REG_H &= ~(1 << 2); T_COUNT(8);
+ reg_H &= ~(1 << 2); T_COUNT(8);
break;
case 0x95: /* res 2, l */
- REG_L &= ~(1 << 2); T_COUNT(8);
+ reg_L &= ~(1 << 2); T_COUNT(8);
break;
case 0x9F: /* res 3, a */
- REG_A &= ~(1 << 3); T_COUNT(8);
+ reg_A &= ~(1 << 3); T_COUNT(8);
break;
case 0x98: /* res 3, b */
- REG_B &= ~(1 << 3); T_COUNT(8);
+ reg_B &= ~(1 << 3); T_COUNT(8);
break;
case 0x99: /* res 3, c */
- REG_C &= ~(1 << 3); T_COUNT(8);
+ reg_C &= ~(1 << 3); T_COUNT(8);
break;
case 0x9A: /* res 3, d */
- REG_D &= ~(1 << 3); T_COUNT(8);
+ reg_D &= ~(1 << 3); T_COUNT(8);
break;
case 0x9B: /* res 3, e */
- REG_E &= ~(1 << 3); T_COUNT(8);
+ reg_E &= ~(1 << 3); T_COUNT(8);
break;
case 0x9C: /* res 3, h */
- REG_H &= ~(1 << 3); T_COUNT(8);
+ reg_H &= ~(1 << 3); T_COUNT(8);
break;
case 0x9D: /* res 3, l */
- REG_L &= ~(1 << 3); T_COUNT(8);
+ reg_L &= ~(1 << 3); T_COUNT(8);
break;
case 0xA7: /* res 4, a */
- REG_A &= ~(1 << 4); T_COUNT(8);
+ reg_A &= ~(1 << 4); T_COUNT(8);
break;
case 0xA0: /* res 4, b */
- REG_B &= ~(1 << 4); T_COUNT(8);
+ reg_B &= ~(1 << 4); T_COUNT(8);
break;
case 0xA1: /* res 4, c */
- REG_C &= ~(1 << 4); T_COUNT(8);
+ reg_C &= ~(1 << 4); T_COUNT(8);
break;
case 0xA2: /* res 4, d */
- REG_D &= ~(1 << 4); T_COUNT(8);
+ reg_D &= ~(1 << 4); T_COUNT(8);
break;
case 0xA3: /* res 4, e */
- REG_E &= ~(1 << 4); T_COUNT(8);
+ reg_E &= ~(1 << 4); T_COUNT(8);
break;
case 0xA4: /* res 4, h */
- REG_H &= ~(1 << 4); T_COUNT(8);
+ reg_H &= ~(1 << 4); T_COUNT(8);
break;
case 0xA5: /* res 4, l */
- REG_L &= ~(1 << 4); T_COUNT(8);
+ reg_L &= ~(1 << 4); T_COUNT(8);
break;
case 0xAF: /* res 5, a */
- REG_A &= ~(1 << 5); T_COUNT(8);
+ reg_A &= ~(1 << 5); T_COUNT(8);
break;
case 0xA8: /* res 5, b */
- REG_B &= ~(1 << 5); T_COUNT(8);
+ reg_B &= ~(1 << 5); T_COUNT(8);
break;
case 0xA9: /* res 5, c */
- REG_C &= ~(1 << 5); T_COUNT(8);
+ reg_C &= ~(1 << 5); T_COUNT(8);
break;
case 0xAA: /* res 5, d */
- REG_D &= ~(1 << 5); T_COUNT(8);
+ reg_D &= ~(1 << 5); T_COUNT(8);
break;
case 0xAB: /* res 5, e */
- REG_E &= ~(1 << 5); T_COUNT(8);
+ reg_E &= ~(1 << 5); T_COUNT(8);
break;
case 0xAC: /* res 5, h */
- REG_H &= ~(1 << 5); T_COUNT(8);
+ reg_H &= ~(1 << 5); T_COUNT(8);
break;
case 0xAD: /* res 5, l */
- REG_L &= ~(1 << 5); T_COUNT(8);
+ reg_L &= ~(1 << 5); T_COUNT(8);
break;
case 0xB7: /* res 6, a */
- REG_A &= ~(1 << 6); T_COUNT(8);
+ reg_A &= ~(1 << 6); T_COUNT(8);
break;
case 0xB0: /* res 6, b */
- REG_B &= ~(1 << 6); T_COUNT(8);
+ reg_B &= ~(1 << 6); T_COUNT(8);
break;
case 0xB1: /* res 6, c */
- REG_C &= ~(1 << 6); T_COUNT(8);
+ reg_C &= ~(1 << 6); T_COUNT(8);
break;
case 0xB2: /* res 6, d */
- REG_D &= ~(1 << 6); T_COUNT(8);
+ reg_D &= ~(1 << 6); T_COUNT(8);
break;
case 0xB3: /* res 6, e */
- REG_E &= ~(1 << 6); T_COUNT(8);
+ reg_E &= ~(1 << 6); T_COUNT(8);
break;
case 0xB4: /* res 6, h */
- REG_H &= ~(1 << 6); T_COUNT(8);
+ reg_H &= ~(1 << 6); T_COUNT(8);
break;
case 0xB5: /* res 6, l */
- REG_L &= ~(1 << 6); T_COUNT(8);
+ reg_L &= ~(1 << 6); T_COUNT(8);
break;
case 0xBF: /* res 7, a */
- REG_A &= ~(1 << 7); T_COUNT(8);
+ reg_A &= ~(1 << 7); T_COUNT(8);
break;
case 0xB8: /* res 7, b */
- REG_B &= ~(1 << 7); T_COUNT(8);
+ reg_B &= ~(1 << 7); T_COUNT(8);
break;
case 0xB9: /* res 7, c */
- REG_C &= ~(1 << 7); T_COUNT(8);
+ reg_C &= ~(1 << 7); T_COUNT(8);
break;
case 0xBA: /* res 7, d */
- REG_D &= ~(1 << 7); T_COUNT(8);
+ reg_D &= ~(1 << 7); T_COUNT(8);
break;
case 0xBB: /* res 7, e */
- REG_E &= ~(1 << 7); T_COUNT(8);
+ reg_E &= ~(1 << 7); T_COUNT(8);
break;
case 0xBC: /* res 7, h */
- REG_H &= ~(1 << 7); T_COUNT(8);
+ reg_H &= ~(1 << 7); T_COUNT(8);
break;
case 0xBD: /* res 7, l */
- REG_L &= ~(1 << 7); T_COUNT(8);
+ reg_L &= ~(1 << 7); T_COUNT(8);
break;
case 0x86: /* res 0, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) & ~(1 << 0)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) & ~(1 << 0)); T_COUNT(15);
break;
case 0x8E: /* res 1, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) & ~(1 << 1)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) & ~(1 << 1)); T_COUNT(15);
break;
case 0x96: /* res 2, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) & ~(1 << 2)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) & ~(1 << 2)); T_COUNT(15);
break;
case 0x9E: /* res 3, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) & ~(1 << 3)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) & ~(1 << 3)); T_COUNT(15);
break;
case 0xA6: /* res 4, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) & ~(1 << 4)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) & ~(1 << 4)); T_COUNT(15);
break;
case 0xAE: /* res 5, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) & ~(1 << 5)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) & ~(1 << 5)); T_COUNT(15);
break;
case 0xB6: /* res 6, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) & ~(1 << 6)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) & ~(1 << 6)); T_COUNT(15);
break;
case 0xBE: /* res 7, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) & ~(1 << 7)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) & ~(1 << 7)); T_COUNT(15);
break;
case 0x17: /* rl a */
- REG_A = rl_byte(REG_A); T_COUNT(8);
+ reg_A = rl_byte(reg_A); T_COUNT(8);
break;
case 0x10: /* rl b */
- REG_B = rl_byte(REG_B); T_COUNT(8);
+ reg_B = rl_byte(reg_B); T_COUNT(8);
break;
case 0x11: /* rl c */
- REG_C = rl_byte(REG_C); T_COUNT(8);
+ reg_C = rl_byte(reg_C); T_COUNT(8);
break;
case 0x12: /* rl d */
- REG_D = rl_byte(REG_D); T_COUNT(8);
+ reg_D = rl_byte(reg_D); T_COUNT(8);
break;
case 0x13: /* rl e */
- REG_E = rl_byte(REG_E); T_COUNT(8);
+ reg_E = rl_byte(reg_E); T_COUNT(8);
break;
case 0x14: /* rl h */
- REG_H = rl_byte(REG_H); T_COUNT(8);
+ reg_H = rl_byte(reg_H); T_COUNT(8);
break;
case 0x15: /* rl l */
- REG_L = rl_byte(REG_L); T_COUNT(8);
+ reg_L = rl_byte(reg_L); T_COUNT(8);
break;
case 0x16: /* rl (hl) */
- mem_write(REG_HL, rl_byte(mem_read(REG_HL))); T_COUNT(15);
+ mem_write(reg_HL, rl_byte(mem_read(reg_HL))); T_COUNT(15);
break;
case 0x07: /* rlc a */
- REG_A = rlc_byte(REG_A); T_COUNT(8);
+ reg_A = rlc_byte(reg_A); T_COUNT(8);
break;
case 0x00: /* rlc b */
- REG_B = rlc_byte(REG_B); T_COUNT(8);
+ reg_B = rlc_byte(reg_B); T_COUNT(8);
break;
case 0x01: /* rlc c */
- REG_C = rlc_byte(REG_C); T_COUNT(8);
+ reg_C = rlc_byte(reg_C); T_COUNT(8);
break;
case 0x02: /* rlc d */
- REG_D = rlc_byte(REG_D); T_COUNT(8);
+ reg_D = rlc_byte(reg_D); T_COUNT(8);
break;
case 0x03: /* rlc e */
- REG_E = rlc_byte(REG_E); T_COUNT(8);
+ reg_E = rlc_byte(reg_E); T_COUNT(8);
break;
case 0x04: /* rlc h */
- REG_H = rlc_byte(REG_H); T_COUNT(8);
+ reg_H = rlc_byte(reg_H); T_COUNT(8);
break;
case 0x05: /* rlc l */
- REG_L = rlc_byte(REG_L); T_COUNT(8);
+ reg_L = rlc_byte(reg_L); T_COUNT(8);
break;
case 0x06: /* rlc (hl) */
- mem_write(REG_HL, rlc_byte(mem_read(REG_HL))); T_COUNT(15);
+ mem_write(reg_HL, rlc_byte(mem_read(reg_HL))); T_COUNT(15);
break;
case 0x1F: /* rr a */
- REG_A = rr_byte(REG_A); T_COUNT(8);
+ reg_A = rr_byte(reg_A); T_COUNT(8);
break;
case 0x18: /* rr b */
- REG_B = rr_byte(REG_B); T_COUNT(8);
+ reg_B = rr_byte(reg_B); T_COUNT(8);
break;
case 0x19: /* rr c */
- REG_C = rr_byte(REG_C); T_COUNT(8);
+ reg_C = rr_byte(reg_C); T_COUNT(8);
break;
case 0x1A: /* rr d */
- REG_D = rr_byte(REG_D); T_COUNT(8);
+ reg_D = rr_byte(reg_D); T_COUNT(8);
break;
case 0x1B: /* rr e */
- REG_E = rr_byte(REG_E); T_COUNT(8);
+ reg_E = rr_byte(reg_E); T_COUNT(8);
break;
case 0x1C: /* rr h */
- REG_H = rr_byte(REG_H); T_COUNT(8);
+ reg_H = rr_byte(reg_H); T_COUNT(8);
break;
case 0x1D: /* rr l */
- REG_L = rr_byte(REG_L); T_COUNT(8);
+ reg_L = rr_byte(reg_L); T_COUNT(8);
break;
case 0x1E: /* rr (hl) */
- mem_write(REG_HL, rr_byte(mem_read(REG_HL))); T_COUNT(15);
+ mem_write(reg_HL, rr_byte(mem_read(reg_HL))); T_COUNT(15);
break;
case 0x0F: /* rrc a */
- REG_A = rrc_byte(REG_A); T_COUNT(8);
+ reg_A = rrc_byte(reg_A); T_COUNT(8);
break;
case 0x08: /* rrc b */
- REG_B = rrc_byte(REG_B); T_COUNT(8);
+ reg_B = rrc_byte(reg_B); T_COUNT(8);
break;
case 0x09: /* rrc c */
- REG_C = rrc_byte(REG_C); T_COUNT(8);
+ reg_C = rrc_byte(reg_C); T_COUNT(8);
break;
case 0x0A: /* rrc d */
- REG_D = rrc_byte(REG_D); T_COUNT(8);
+ reg_D = rrc_byte(reg_D); T_COUNT(8);
break;
case 0x0B: /* rrc e */
- REG_E = rrc_byte(REG_E); T_COUNT(8);
+ reg_E = rrc_byte(reg_E); T_COUNT(8);
break;
case 0x0C: /* rrc h */
- REG_H = rrc_byte(REG_H); T_COUNT(8);
+ reg_H = rrc_byte(reg_H); T_COUNT(8);
break;
case 0x0D: /* rrc l */
- REG_L = rrc_byte(REG_L); T_COUNT(8);
+ reg_L = rrc_byte(reg_L); T_COUNT(8);
break;
case 0x0E: /* rrc (hl) */
- mem_write(REG_HL, rrc_byte(mem_read(REG_HL))); T_COUNT(15);
+ mem_write(reg_HL, rrc_byte(mem_read(reg_HL))); T_COUNT(15);
break;
case 0xC7: /* set 0, a */
- REG_A |= (1 << 0); T_COUNT(8);
+ reg_A |= (1 << 0); T_COUNT(8);
break;
case 0xC0: /* set 0, b */
- REG_B |= (1 << 0); T_COUNT(8);
+ reg_B |= (1 << 0); T_COUNT(8);
break;
case 0xC1: /* set 0, c */
- REG_C |= (1 << 0); T_COUNT(8);
+ reg_C |= (1 << 0); T_COUNT(8);
break;
case 0xC2: /* set 0, d */
- REG_D |= (1 << 0); T_COUNT(8);
+ reg_D |= (1 << 0); T_COUNT(8);
break;
case 0xC3: /* set 0, e */
- REG_E |= (1 << 0); T_COUNT(8);
+ reg_E |= (1 << 0); T_COUNT(8);
break;
case 0xC4: /* set 0, h */
- REG_H |= (1 << 0); T_COUNT(8);
+ reg_H |= (1 << 0); T_COUNT(8);
break;
case 0xC5: /* set 0, l */
- REG_L |= (1 << 0); T_COUNT(8);
+ reg_L |= (1 << 0); T_COUNT(8);
break;
case 0xCF: /* set 1, a */
- REG_A |= (1 << 1); T_COUNT(8);
+ reg_A |= (1 << 1); T_COUNT(8);
break;
case 0xC8: /* set 1, b */
- REG_B |= (1 << 1); T_COUNT(8);
+ reg_B |= (1 << 1); T_COUNT(8);
break;
case 0xC9: /* set 1, c */
- REG_C |= (1 << 1); T_COUNT(8);
+ reg_C |= (1 << 1); T_COUNT(8);
break;
case 0xCA: /* set 1, d */
- REG_D |= (1 << 1); T_COUNT(8);
+ reg_D |= (1 << 1); T_COUNT(8);
break;
case 0xCB: /* set 1, e */
- REG_E |= (1 << 1); T_COUNT(8);
+ reg_E |= (1 << 1); T_COUNT(8);
break;
case 0xCC: /* set 1, h */
- REG_H |= (1 << 1); T_COUNT(8);
+ reg_H |= (1 << 1); T_COUNT(8);
break;
case 0xCD: /* set 1, l */
- REG_L |= (1 << 1); T_COUNT(8);
+ reg_L |= (1 << 1); T_COUNT(8);
break;
case 0xD7: /* set 2, a */
- REG_A |= (1 << 2); T_COUNT(8);
+ reg_A |= (1 << 2); T_COUNT(8);
break;
case 0xD0: /* set 2, b */
- REG_B |= (1 << 2); T_COUNT(8);
+ reg_B |= (1 << 2); T_COUNT(8);
break;
case 0xD1: /* set 2, c */
- REG_C |= (1 << 2); T_COUNT(8);
+ reg_C |= (1 << 2); T_COUNT(8);
break;
case 0xD2: /* set 2, d */
- REG_D |= (1 << 2); T_COUNT(8);
+ reg_D |= (1 << 2); T_COUNT(8);
break;
case 0xD3: /* set 2, e */
- REG_E |= (1 << 2); T_COUNT(8);
+ reg_E |= (1 << 2); T_COUNT(8);
break;
case 0xD4: /* set 2, h */
- REG_H |= (1 << 2); T_COUNT(8);
+ reg_H |= (1 << 2); T_COUNT(8);
break;
case 0xD5: /* set 2, l */
- REG_L |= (1 << 2); T_COUNT(8);
+ reg_L |= (1 << 2); T_COUNT(8);
break;
case 0xDF: /* set 3, a */
- REG_A |= (1 << 3); T_COUNT(8);
+ reg_A |= (1 << 3); T_COUNT(8);
break;
case 0xD8: /* set 3, b */
- REG_B |= (1 << 3); T_COUNT(8);
+ reg_B |= (1 << 3); T_COUNT(8);
break;
case 0xD9: /* set 3, c */
- REG_C |= (1 << 3); T_COUNT(8);
+ reg_C |= (1 << 3); T_COUNT(8);
break;
case 0xDA: /* set 3, d */
- REG_D |= (1 << 3); T_COUNT(8);
+ reg_D |= (1 << 3); T_COUNT(8);
break;
case 0xDB: /* set 3, e */
- REG_E |= (1 << 3); T_COUNT(8);
+ reg_E |= (1 << 3); T_COUNT(8);
break;
case 0xDC: /* set 3, h */
- REG_H |= (1 << 3); T_COUNT(8);
+ reg_H |= (1 << 3); T_COUNT(8);
break;
case 0xDD: /* set 3, l */
- REG_L |= (1 << 3); T_COUNT(8);
+ reg_L |= (1 << 3); T_COUNT(8);
break;
case 0xE7: /* set 4, a */
- REG_A |= (1 << 4); T_COUNT(8);
+ reg_A |= (1 << 4); T_COUNT(8);
break;
case 0xE0: /* set 4, b */
- REG_B |= (1 << 4); T_COUNT(8);
+ reg_B |= (1 << 4); T_COUNT(8);
break;
case 0xE1: /* set 4, c */
- REG_C |= (1 << 4); T_COUNT(8);
+ reg_C |= (1 << 4); T_COUNT(8);
break;
case 0xE2: /* set 4, d */
- REG_D |= (1 << 4); T_COUNT(8);
+ reg_D |= (1 << 4); T_COUNT(8);
break;
case 0xE3: /* set 4, e */
- REG_E |= (1 << 4); T_COUNT(8);
+ reg_E |= (1 << 4); T_COUNT(8);
break;
case 0xE4: /* set 4, h */
- REG_H |= (1 << 4); T_COUNT(8);
+ reg_H |= (1 << 4); T_COUNT(8);
break;
case 0xE5: /* set 4, l */
- REG_L |= (1 << 4); T_COUNT(8);
+ reg_L |= (1 << 4); T_COUNT(8);
break;
case 0xEF: /* set 5, a */
- REG_A |= (1 << 5); T_COUNT(8);
+ reg_A |= (1 << 5); T_COUNT(8);
break;
case 0xE8: /* set 5, b */
- REG_B |= (1 << 5); T_COUNT(8);
+ reg_B |= (1 << 5); T_COUNT(8);
break;
case 0xE9: /* set 5, c */
- REG_C |= (1 << 5); T_COUNT(8);
+ reg_C |= (1 << 5); T_COUNT(8);
break;
case 0xEA: /* set 5, d */
- REG_D |= (1 << 5); T_COUNT(8);
+ reg_D |= (1 << 5); T_COUNT(8);
break;
case 0xEB: /* set 5, e */
- REG_E |= (1 << 5); T_COUNT(8);
+ reg_E |= (1 << 5); T_COUNT(8);
break;
case 0xEC: /* set 5, h */
- REG_H |= (1 << 5); T_COUNT(8);
+ reg_H |= (1 << 5); T_COUNT(8);
break;
case 0xED: /* set 5, l */
- REG_L |= (1 << 5); T_COUNT(8);
+ reg_L |= (1 << 5); T_COUNT(8);
break;
case 0xF7: /* set 6, a */
- REG_A |= (1 << 6); T_COUNT(8);
+ reg_A |= (1 << 6); T_COUNT(8);
break;
case 0xF0: /* set 6, b */
- REG_B |= (1 << 6); T_COUNT(8);
+ reg_B |= (1 << 6); T_COUNT(8);
break;
case 0xF1: /* set 6, c */
- REG_C |= (1 << 6); T_COUNT(8);
+ reg_C |= (1 << 6); T_COUNT(8);
break;
case 0xF2: /* set 6, d */
- REG_D |= (1 << 6); T_COUNT(8);
+ reg_D |= (1 << 6); T_COUNT(8);
break;
case 0xF3: /* set 6, e */
- REG_E |= (1 << 6); T_COUNT(8);
+ reg_E |= (1 << 6); T_COUNT(8);
break;
case 0xF4: /* set 6, h */
- REG_H |= (1 << 6); T_COUNT(8);
+ reg_H |= (1 << 6); T_COUNT(8);
break;
case 0xF5: /* set 6, l */
- REG_L |= (1 << 6); T_COUNT(8);
+ reg_L |= (1 << 6); T_COUNT(8);
break;
case 0xFF: /* set 7, a */
- REG_A |= (1 << 7); T_COUNT(8);
+ reg_A |= (1 << 7); T_COUNT(8);
break;
case 0xF8: /* set 7, b */
- REG_B |= (1 << 7); T_COUNT(8);
+ reg_B |= (1 << 7); T_COUNT(8);
break;
case 0xF9: /* set 7, c */
- REG_C |= (1 << 7); T_COUNT(8);
+ reg_C |= (1 << 7); T_COUNT(8);
break;
case 0xFA: /* set 7, d */
- REG_D |= (1 << 7); T_COUNT(8);
+ reg_D |= (1 << 7); T_COUNT(8);
break;
case 0xFB: /* set 7, e */
- REG_E |= (1 << 7); T_COUNT(8);
+ reg_E |= (1 << 7); T_COUNT(8);
break;
case 0xFC: /* set 7, h */
- REG_H |= (1 << 7); T_COUNT(8);
+ reg_H |= (1 << 7); T_COUNT(8);
break;
case 0xFD: /* set 7, l */
- REG_L |= (1 << 7); T_COUNT(8);
+ reg_L |= (1 << 7); T_COUNT(8);
break;
case 0xC6: /* set 0, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) | (1 << 0)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) | (1 << 0)); T_COUNT(15);
break;
case 0xCE: /* set 1, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) | (1 << 1)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) | (1 << 1)); T_COUNT(15);
break;
case 0xD6: /* set 2, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) | (1 << 2)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) | (1 << 2)); T_COUNT(15);
break;
case 0xDE: /* set 3, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) | (1 << 3)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) | (1 << 3)); T_COUNT(15);
break;
case 0xE6: /* set 4, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) | (1 << 4)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) | (1 << 4)); T_COUNT(15);
break;
case 0xEE: /* set 5, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) | (1 << 5)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) | (1 << 5)); T_COUNT(15);
break;
case 0xF6: /* set 6, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) | (1 << 6)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) | (1 << 6)); T_COUNT(15);
break;
case 0xFE: /* set 7, (hl) */
- mem_write(REG_HL, mem_read(REG_HL) | (1 << 7)); T_COUNT(15);
+ mem_write(reg_HL, mem_read(reg_HL) | (1 << 7)); T_COUNT(15);
break;
case 0x27: /* sla a */
- REG_A = sla_byte(REG_A); T_COUNT(8);
+ reg_A = sla_byte(reg_A); T_COUNT(8);
break;
case 0x20: /* sla b */
- REG_B = sla_byte(REG_B); T_COUNT(8);
+ reg_B = sla_byte(reg_B); T_COUNT(8);
break;
case 0x21: /* sla c */
- REG_C = sla_byte(REG_C); T_COUNT(8);
+ reg_C = sla_byte(reg_C); T_COUNT(8);
break;
case 0x22: /* sla d */
- REG_D = sla_byte(REG_D); T_COUNT(8);
+ reg_D = sla_byte(reg_D); T_COUNT(8);
break;
case 0x23: /* sla e */
- REG_E = sla_byte(REG_E); T_COUNT(8);
+ reg_E = sla_byte(reg_E); T_COUNT(8);
break;
case 0x24: /* sla h */
- REG_H = sla_byte(REG_H); T_COUNT(8);
+ reg_H = sla_byte(reg_H); T_COUNT(8);
break;
case 0x25: /* sla l */
- REG_L = sla_byte(REG_L); T_COUNT(8);
+ reg_L = sla_byte(reg_L); T_COUNT(8);
break;
case 0x26: /* sla (hl) */
- mem_write(REG_HL, sla_byte(mem_read(REG_HL))); T_COUNT(15);
+ mem_write(reg_HL, sla_byte(mem_read(reg_HL))); T_COUNT(15);
break;
case 0x2F: /* sra a */
- REG_A = sra_byte(REG_A); T_COUNT(8);
+ reg_A = sra_byte(reg_A); T_COUNT(8);
break;
case 0x28: /* sra b */
- REG_B = sra_byte(REG_B); T_COUNT(8);
+ reg_B = sra_byte(reg_B); T_COUNT(8);
break;
case 0x29: /* sra c */
- REG_C = sra_byte(REG_C); T_COUNT(8);
+ reg_C = sra_byte(reg_C); T_COUNT(8);
break;
case 0x2A: /* sra d */
- REG_D = sra_byte(REG_D); T_COUNT(8);
+ reg_D = sra_byte(reg_D); T_COUNT(8);
break;
case 0x2B: /* sra e */
- REG_E = sra_byte(REG_E); T_COUNT(8);
+ reg_E = sra_byte(reg_E); T_COUNT(8);
break;
case 0x2C: /* sra h */
- REG_H = sra_byte(REG_H); T_COUNT(8);
+ reg_H = sra_byte(reg_H); T_COUNT(8);
break;
case 0x2D: /* sra l */
- REG_L = sra_byte(REG_L); T_COUNT(8);
+ reg_L = sra_byte(reg_L); T_COUNT(8);
break;
case 0x2E: /* sra (hl) */
- mem_write(REG_HL, sra_byte(mem_read(REG_HL))); T_COUNT(15);
+ mem_write(reg_HL, sra_byte(mem_read(reg_HL))); T_COUNT(15);
break;
case 0x37: /* slia a [undocumented] */
- REG_A = slia_byte(REG_A); T_COUNT(8);
+ reg_A = slia_byte(reg_A); T_COUNT(8);
break;
case 0x30: /* slia b [undocumented] */
- REG_B = slia_byte(REG_B); T_COUNT(8);
+ reg_B = slia_byte(reg_B); T_COUNT(8);
break;
case 0x31: /* slia c [undocumented] */
- REG_C = slia_byte(REG_C); T_COUNT(8);
+ reg_C = slia_byte(reg_C); T_COUNT(8);
break;
case 0x32: /* slia d [undocumented] */
- REG_D = slia_byte(REG_D); T_COUNT(8);
+ reg_D = slia_byte(reg_D); T_COUNT(8);
break;
case 0x33: /* slia e [undocumented] */
- REG_E = slia_byte(REG_E); T_COUNT(8);
+ reg_E = slia_byte(reg_E); T_COUNT(8);
break;
case 0x34: /* slia h [undocumented] */
- REG_H = slia_byte(REG_H); T_COUNT(8);
+ reg_H = slia_byte(reg_H); T_COUNT(8);
break;
case 0x35: /* slia l [undocumented] */
- REG_L = slia_byte(REG_L); T_COUNT(8);
+ reg_L = slia_byte(reg_L); T_COUNT(8);
break;
case 0x36: /* slia (hl) [undocumented] */
- mem_write(REG_HL, slia_byte(mem_read(REG_HL))); T_COUNT(15);
+ mem_write(reg_HL, slia_byte(mem_read(reg_HL))); T_COUNT(15);
break;
case 0x3F: /* srl a */
- REG_A = srl_byte(REG_A); T_COUNT(8);
+ reg_A = srl_byte(reg_A); T_COUNT(8);
break;
case 0x38: /* srl b */
- REG_B = srl_byte(REG_B); T_COUNT(8);
+ reg_B = srl_byte(reg_B); T_COUNT(8);
break;
case 0x39: /* srl c */
- REG_C = srl_byte(REG_C); T_COUNT(8);
+ reg_C = srl_byte(reg_C); T_COUNT(8);
break;
case 0x3A: /* srl d */
- REG_D = srl_byte(REG_D); T_COUNT(8);
+ reg_D = srl_byte(reg_D); T_COUNT(8);
break;
case 0x3B: /* srl e */
- REG_E = srl_byte(REG_E); T_COUNT(8);
+ reg_E = srl_byte(reg_E); T_COUNT(8);
break;
case 0x3C: /* srl h */
- REG_H = srl_byte(REG_H); T_COUNT(8);
+ reg_H = srl_byte(reg_H); T_COUNT(8);
break;
case 0x3D: /* srl l */
- REG_L = srl_byte(REG_L); T_COUNT(8);
+ reg_L = srl_byte(reg_L); T_COUNT(8);
break;
case 0x3E: /* srl (hl) */
- mem_write(REG_HL, srl_byte(mem_read(REG_HL))); T_COUNT(15);
+ mem_write(reg_HL, srl_byte(mem_read(reg_HL))); T_COUNT(15);
break;
default:
- disassemble(REG_PC - 2);
+ disassemble(reg_PC - 2);
error("unsupported instruction");
}
}
@@ -2150,45 +2150,45 @@ static void do_indexed_instruction(Ushort *ixp)
{
Uchar instruction;
- instruction = mem_read(REG_PC++);
+ instruction = mem_read(reg_PC++);
switch(instruction)
{
/* same for FD, except uses IY */
case 0x8E: /* adc a, (ix + offset) */
- do_adc_byte(mem_read((*ixp + (signed char) mem_read(REG_PC++))
+ do_adc_byte(mem_read((*ixp + (signed char) mem_read(reg_PC++))
& 0xffff));
T_COUNT(19);
break;
case 0x86: /* add a, (ix + offset) */
- do_add_byte(mem_read((*ixp + (signed char) mem_read(REG_PC++))
+ do_add_byte(mem_read((*ixp + (signed char) mem_read(reg_PC++))
& 0xffff));
T_COUNT(19);
break;
case 0x09: /* add ix, bc */
- do_add_word_index(ixp, REG_BC); T_COUNT(15);
+ do_add_word_index(ixp, reg_BC); T_COUNT(15);
break;
case 0x19: /* add ix, de */
- do_add_word_index(ixp, REG_DE); T_COUNT(15);
+ do_add_word_index(ixp, reg_DE); T_COUNT(15);
break;
case 0x29: /* add ix, ix */
do_add_word_index(ixp, *ixp); T_COUNT(15);
break;
case 0x39: /* add ix, sp */
- do_add_word_index(ixp, REG_SP); T_COUNT(15);
+ do_add_word_index(ixp, reg_SP); T_COUNT(15);
break;
case 0xA6: /* and (ix + offset) */
- do_and_byte(mem_read((*ixp + (signed char) mem_read(REG_PC++))
+ do_and_byte(mem_read((*ixp + (signed char) mem_read(reg_PC++))
& 0xffff));
T_COUNT(19);
break;
case 0xBE: /* cp (ix + offset) */
- do_cp(mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff));
+ do_cp(mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff));
T_COUNT(19);
break;
@@ -2196,7 +2196,7 @@ static void do_indexed_instruction(Ushort *ixp)
{
Ushort address;
Uchar value;
- address = *ixp + (signed char) mem_read(REG_PC++);
+ address = *ixp + (signed char) mem_read(reg_PC++);
value = mem_read(address) - 1;
mem_write(address, value);
do_flags_dec_byte(value);
@@ -2212,8 +2212,8 @@ static void do_indexed_instruction(Ushort *ixp)
case 0xE3: /* ex (sp), ix */
{
Ushort temp;
- temp = mem_read_word(REG_SP);
- mem_write_word(REG_SP, *ixp);
+ temp = mem_read_word(reg_SP);
+ mem_write_word(reg_SP, *ixp);
*ixp = temp;
}
T_COUNT(23);
@@ -2223,7 +2223,7 @@ static void do_indexed_instruction(Ushort *ixp)
{
Ushort address;
Uchar value;
- address = *ixp + (signed char) mem_read(REG_PC++);
+ address = *ixp + (signed char) mem_read(reg_PC++);
value = mem_read(address) + 1;
mem_write(address, value);
do_flags_inc_byte(value);
@@ -2237,126 +2237,126 @@ static void do_indexed_instruction(Ushort *ixp)
break;
case 0xE9: /* jp (ix) */
- REG_PC = *ixp;
+ reg_PC = *ixp;
T_COUNT(8);
break;
case 0x7E: /* ld a, (ix + offset) */
- REG_A = mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff);
+ reg_A = mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff);
T_COUNT(19);
break;
case 0x46: /* ld b, (ix + offset) */
- REG_B = mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff);
+ reg_B = mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff);
T_COUNT(19);
break;
case 0x4E: /* ld c, (ix + offset) */
- REG_C = mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff);
+ reg_C = mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff);
T_COUNT(19);
break;
case 0x56: /* ld d, (ix + offset) */
- REG_D = mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff);
+ reg_D = mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff);
T_COUNT(19);
break;
case 0x5E: /* ld e, (ix + offset) */
- REG_E = mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff);
+ reg_E = mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff);
T_COUNT(19);
break;
case 0x66: /* ld h, (ix + offset) */
- REG_H = mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff);
+ reg_H = mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff);
T_COUNT(19);
break;
case 0x6E: /* ld l, (ix + offset) */
- REG_L = mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff);
+ reg_L = mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff);
T_COUNT(19);
break;
case 0x36: /* ld (ix + offset), value */
- mem_write(*ixp + (signed char) mem_read(REG_PC), mem_read((REG_PC+1)&0xffff));
- REG_PC += 2;
+ mem_write(*ixp + (signed char) mem_read(reg_PC), mem_read((reg_PC+1)&0xffff));
+ reg_PC += 2;
T_COUNT(19);
break;
case 0x77: /* ld (ix + offset), a */
- mem_write(*ixp + (signed char) mem_read(REG_PC++), REG_A);
+ mem_write(*ixp + (signed char) mem_read(reg_PC++), reg_A);
T_COUNT(19);
break;
case 0x70: /* ld (ix + offset), b */
- mem_write(*ixp + (signed char) mem_read(REG_PC++), REG_B);
+ mem_write(*ixp + (signed char) mem_read(reg_PC++), reg_B);
T_COUNT(19);
break;
case 0x71: /* ld (ix + offset), c */
- mem_write(*ixp + (signed char) mem_read(REG_PC++), REG_C);
+ mem_write(*ixp + (signed char) mem_read(reg_PC++), reg_C);
T_COUNT(19);
break;
case 0x72: /* ld (ix + offset), d */
- mem_write(*ixp + (signed char) mem_read(REG_PC++), REG_D);
+ mem_write(*ixp + (signed char) mem_read(reg_PC++), reg_D);
T_COUNT(19);
break;
case 0x73: /* ld (ix + offset), e */
- mem_write(*ixp + (signed char) mem_read(REG_PC++), REG_E);
+ mem_write(*ixp + (signed char) mem_read(reg_PC++), reg_E);
T_COUNT(19);
break;
case 0x74: /* ld (ix + offset), h */
- mem_write(*ixp + (signed char) mem_read(REG_PC++), REG_H);
+ mem_write(*ixp + (signed char) mem_read(reg_PC++), reg_H);
T_COUNT(19);
break;
case 0x75: /* ld (ix + offset), l */
- mem_write(*ixp + (signed char) mem_read(REG_PC++), REG_L);
+ mem_write(*ixp + (signed char) mem_read(reg_PC++), reg_L);
T_COUNT(19);
break;
case 0x22: /* ld (address), ix */
- mem_write_word(mem_read_word(REG_PC), *ixp);
- REG_PC += 2;
+ mem_write_word(mem_read_word(reg_PC), *ixp);
+ reg_PC += 2;
T_COUNT(20);
break;
case 0xF9: /* ld sp, ix */
- REG_SP = *ixp;
+ reg_SP = *ixp;
T_COUNT(10);
break;
case 0x21: /* ld ix, value */
- *ixp = mem_read_word(REG_PC);
- REG_PC += 2;
+ *ixp = mem_read_word(reg_PC);
+ reg_PC += 2;
T_COUNT(14);
break;
case 0x2A: /* ld ix, (address) */
- *ixp = mem_read_word(mem_read_word(REG_PC));
- REG_PC += 2;
+ *ixp = mem_read_word(mem_read_word(reg_PC));
+ reg_PC += 2;
T_COUNT(20);
break;
case 0xB6: /* or (ix + offset) */
- do_or_byte(mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff));
+ do_or_byte(mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff));
T_COUNT(19);
break;
case 0xE1: /* pop ix */
- *ixp = mem_read_word(REG_SP);
- REG_SP += 2;
+ *ixp = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(14);
break;
case 0xE5: /* push ix */
- REG_SP -= 2;
- mem_write_word(REG_SP, *ixp);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, *ixp);
T_COUNT(15);
break;
case 0x9E: /* sbc a, (ix + offset) */
- do_sbc_byte(mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff));
+ do_sbc_byte(mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff));
T_COUNT(19);
break;
case 0x96: /* sub a, (ix + offset) */
- do_sub_byte(mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff));
+ do_sub_byte(mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff));
T_COUNT(19);
break;
case 0xAE: /* xor (ix + offset) */
- do_xor_byte(mem_read((*ixp + (signed char) mem_read(REG_PC++)) & 0xffff));
+ do_xor_byte(mem_read((*ixp + (signed char) mem_read(reg_PC++)) & 0xffff));
T_COUNT(19);
break;
@@ -2365,8 +2365,8 @@ static void do_indexed_instruction(Ushort *ixp)
signed char offset, result = 0;
Uchar sub_instruction;
- offset = (signed char) mem_read(REG_PC++);
- sub_instruction = mem_read(REG_PC++);
+ offset = (signed char) mem_read(reg_PC++);
+ sub_instruction = mem_read(reg_PC++);
/* Instructions with (sub_instruction & 7) != 6 are undocumented;
their extra effect is handled after this switch */
@@ -2467,13 +2467,13 @@ static void do_indexed_instruction(Ushort *ixp)
switch (sub_instruction & 7)
{
/* Undocumented cases */
- case 0: REG_B = result; break;
- case 1: REG_C = result; break;
- case 2: REG_D = result; break;
- case 3: REG_E = result; break;
- case 4: REG_H = result; break;
- case 5: REG_L = result; break;
- case 7: REG_A = result; break;
+ case 0: reg_B = result; break;
+ case 1: reg_C = result; break;
+ case 2: reg_D = result; break;
+ case 3: reg_E = result; break;
+ case 4: reg_H = result; break;
+ case 5: reg_L = result; break;
+ case 7: reg_A = result; break;
}
}
}
@@ -2519,49 +2519,49 @@ static void do_indexed_instruction(Ushort *ixp)
do_flags_inc_byte(LOW(ixp)); T_COUNT(8);
break;
case 0x7C: /* ld a, ixh */
- REG_A = HIGH(ixp); T_COUNT(8);
+ reg_A = HIGH(ixp); T_COUNT(8);
break;
case 0x7D: /* ld a, ixl */
- REG_A = LOW(ixp); T_COUNT(8);
+ reg_A = LOW(ixp); T_COUNT(8);
break;
case 0x44: /* ld b, ixh */
- REG_B = HIGH(ixp); T_COUNT(8);
+ reg_B = HIGH(ixp); T_COUNT(8);
break;
case 0x45: /* ld b, ixl */
- REG_B = LOW(ixp); T_COUNT(8);
+ reg_B = LOW(ixp); T_COUNT(8);
break;
case 0x4C: /* ld c, ixh */
- REG_C = HIGH(ixp); T_COUNT(8);
+ reg_C = HIGH(ixp); T_COUNT(8);
break;
case 0x4D: /* ld c, ixl */
- REG_C = LOW(ixp); T_COUNT(8);
+ reg_C = LOW(ixp); T_COUNT(8);
break;
case 0x54: /* ld d, ixh */
- REG_D = HIGH(ixp); T_COUNT(8);
+ reg_D = HIGH(ixp); T_COUNT(8);
break;
case 0x55: /* ld d, ixl */
- REG_D = LOW(ixp); T_COUNT(8);
+ reg_D = LOW(ixp); T_COUNT(8);
break;
case 0x5C: /* ld e, ixh */
- REG_E = HIGH(ixp); T_COUNT(8);
+ reg_E = HIGH(ixp); T_COUNT(8);
break;
case 0x5D: /* ld e, ixl */
- REG_E = LOW(ixp); T_COUNT(8);
+ reg_E = LOW(ixp); T_COUNT(8);
break;
case 0x67: /* ld ixh, a */
- HIGH(ixp) = REG_A; T_COUNT(8);
+ HIGH(ixp) = reg_A; T_COUNT(8);
break;
case 0x60: /* ld ixh, b */
- HIGH(ixp) = REG_B; T_COUNT(8);
+ HIGH(ixp) = reg_B; T_COUNT(8);
break;
case 0x61: /* ld ixh, c */
- HIGH(ixp) = REG_C; T_COUNT(8);
+ HIGH(ixp) = reg_C; T_COUNT(8);
break;
case 0x62: /* ld ixh, d */
- HIGH(ixp) = REG_D; T_COUNT(8);
+ HIGH(ixp) = reg_D; T_COUNT(8);
break;
case 0x63: /* ld ixh, e */
- HIGH(ixp) = REG_E; T_COUNT(8);
+ HIGH(ixp) = reg_E; T_COUNT(8);
break;
case 0x64: /* ld ixh, ixh */
HIGH(ixp) = HIGH(ixp); T_COUNT(8);
@@ -2570,19 +2570,19 @@ static void do_indexed_instruction(Ushort *ixp)
HIGH(ixp) = LOW(ixp); T_COUNT(8);
break;
case 0x6F: /* ld ixl, a */
- LOW(ixp) = REG_A; T_COUNT(8);
+ LOW(ixp) = reg_A; T_COUNT(8);
break;
case 0x68: /* ld ixl, b */
- LOW(ixp) = REG_B; T_COUNT(8);
+ LOW(ixp) = reg_B; T_COUNT(8);
break;
case 0x69: /* ld ixl, c */
- LOW(ixp) = REG_C; T_COUNT(8);
+ LOW(ixp) = reg_C; T_COUNT(8);
break;
case 0x6A: /* ld ixl, d */
- LOW(ixp) = REG_D; T_COUNT(8);
+ LOW(ixp) = reg_D; T_COUNT(8);
break;
case 0x6B: /* ld ixl, e */
- LOW(ixp) = REG_E; T_COUNT(8);
+ LOW(ixp) = reg_E; T_COUNT(8);
break;
case 0x6C: /* ld ixl, ixh */
LOW(ixp) = HIGH(ixp); T_COUNT(8);
@@ -2591,10 +2591,10 @@ static void do_indexed_instruction(Ushort *ixp)
LOW(ixp) = LOW(ixp); T_COUNT(8);
break;
case 0x26: /* ld ixh, value */
- HIGH(ixp) = mem_read(REG_PC++); T_COUNT(11);
+ HIGH(ixp) = mem_read(reg_PC++); T_COUNT(11);
break;
case 0x2E: /* ld ixl, value */
- LOW(ixp) = mem_read(REG_PC++); T_COUNT(11);
+ LOW(ixp) = mem_read(reg_PC++); T_COUNT(11);
break;
case 0xB4: /* or ixh */
do_or_byte(HIGH(ixp)); T_COUNT(8);
@@ -2625,7 +2625,7 @@ static void do_indexed_instruction(Ushort *ixp)
default:
/* Ignore DD or FD prefix and retry as normal instruction;
this is a correct emulation. [undocumented, timing guessed] */
- REG_PC--;
+ reg_PC--;
T_COUNT(4);
break;
}
@@ -2640,21 +2640,21 @@ static int do_ED_instruction()
Uchar instruction;
int debug = 0;
- instruction = mem_read(REG_PC++);
+ instruction = mem_read(reg_PC++);
switch(instruction)
{
case 0x4A: /* adc hl, bc */
- do_adc_word(REG_BC); T_COUNT(15);
+ do_adc_word(reg_BC); T_COUNT(15);
break;
case 0x5A: /* adc hl, de */
- do_adc_word(REG_DE); T_COUNT(15);
+ do_adc_word(reg_DE); T_COUNT(15);
break;
case 0x6A: /* adc hl, hl */
- do_adc_word(REG_HL); T_COUNT(15);
+ do_adc_word(reg_HL); T_COUNT(15);
break;
case 0x7A: /* adc hl, sp */
- do_adc_word(REG_SP); T_COUNT(15);
+ do_adc_word(reg_SP); T_COUNT(15);
break;
case 0xA9: /* cpd */
@@ -2685,28 +2685,28 @@ static int do_ED_instruction()
break;
case 0x78: /* in a, (c) */
- REG_A = in_with_flags(REG_C); T_COUNT(11);
+ reg_A = in_with_flags(reg_C); T_COUNT(11);
break;
case 0x40: /* in b, (c) */
- REG_B = in_with_flags(REG_C); T_COUNT(11);
+ reg_B = in_with_flags(reg_C); T_COUNT(11);
break;
case 0x48: /* in c, (c) */
- REG_C = in_with_flags(REG_C); T_COUNT(11);
+ reg_C = in_with_flags(reg_C); T_COUNT(11);
break;
case 0x50: /* in d, (c) */
- REG_D = in_with_flags(REG_C); T_COUNT(11);
+ reg_D = in_with_flags(reg_C); T_COUNT(11);
break;
case 0x58: /* in e, (c) */
- REG_E = in_with_flags(REG_C); T_COUNT(11);
+ reg_E = in_with_flags(reg_C); T_COUNT(11);
break;
case 0x60: /* in h, (c) */
- REG_H = in_with_flags(REG_C); T_COUNT(11);
+ reg_H = in_with_flags(reg_C); T_COUNT(11);
break;
case 0x68: /* in l, (c) */
- REG_L = in_with_flags(REG_C); T_COUNT(11);
+ reg_L = in_with_flags(reg_C); T_COUNT(11);
break;
case 0x70: /* in (c) [undocumented] */
- (void) in_with_flags(REG_C); T_COUNT(11);
+ (void) in_with_flags(reg_C); T_COUNT(11);
break;
case 0xAA: /* ind */
@@ -2726,7 +2726,7 @@ static int do_ED_instruction()
do_ld_a_i(); T_COUNT(9);
break;
case 0x47: /* ld i, a */
- REG_I = REG_A; T_COUNT(9);
+ reg_I = reg_A; T_COUNT(9);
break;
case 0x5F: /* ld a, r */
@@ -2738,46 +2738,46 @@ static int do_ED_instruction()
break;
case 0x4B: /* ld bc, (address) */
- REG_BC = mem_read_word(mem_read_word(REG_PC));
- REG_PC += 2;
+ reg_BC = mem_read_word(mem_read_word(reg_PC));
+ reg_PC += 2;
T_COUNT(20);
break;
case 0x5B: /* ld de, (address) */
- REG_DE = mem_read_word(mem_read_word(REG_PC));
- REG_PC += 2;
+ reg_DE = mem_read_word(mem_read_word(reg_PC));
+ reg_PC += 2;
T_COUNT(20);
break;
case 0x6B: /* ld hl, (address) */
/* this instruction is redundant with the 2A instruction */
- REG_HL = mem_read_word(mem_read_word(REG_PC));
- REG_PC += 2;
+ reg_HL = mem_read_word(mem_read_word(reg_PC));
+ reg_PC += 2;
T_COUNT(20);
break;
case 0x7B: /* ld sp, (address) */
- REG_SP = mem_read_word(mem_read_word(REG_PC));
- REG_PC += 2;
+ reg_SP = mem_read_word(mem_read_word(reg_PC));
+ reg_PC += 2;
T_COUNT(20);
break;
case 0x43: /* ld (address), bc */
- mem_write_word(mem_read_word(REG_PC), REG_BC);
- REG_PC += 2;
+ mem_write_word(mem_read_word(reg_PC), reg_BC);
+ reg_PC += 2;
T_COUNT(20);
break;
case 0x53: /* ld (address), de */
- mem_write_word(mem_read_word(REG_PC), REG_DE);
- REG_PC += 2;
+ mem_write_word(mem_read_word(reg_PC), reg_DE);
+ reg_PC += 2;
T_COUNT(20);
break;
case 0x63: /* ld (address), hl */
/* this instruction is redundant with the 22 instruction */
- mem_write_word(mem_read_word(REG_PC), REG_HL);
- REG_PC += 2;
+ mem_write_word(mem_read_word(reg_PC), reg_HL);
+ reg_PC += 2;
T_COUNT(20);
break;
case 0x73: /* ld (address), sp */
- mem_write_word(mem_read_word(REG_PC), REG_SP);
- REG_PC += 2;
+ mem_write_word(mem_read_word(reg_PC), reg_SP);
+ reg_PC += 2;
T_COUNT(20);
break;
@@ -2807,35 +2807,35 @@ static int do_ED_instruction()
break;
case 0x79: /* out (c), a */
- z80_out(REG_C, REG_A);
+ z80_out(reg_C, reg_A);
T_COUNT(12);
break;
case 0x41: /* out (c), b */
- z80_out(REG_C, REG_B);
+ z80_out(reg_C, reg_B);
T_COUNT(12);
break;
case 0x49: /* out (c), c */
- z80_out(REG_C, REG_C);
+ z80_out(reg_C, reg_C);
T_COUNT(12);
break;
case 0x51: /* out (c), d */
- z80_out(REG_C, REG_D);
+ z80_out(reg_C, reg_D);
T_COUNT(12);
break;
case 0x59: /* out (c), e */
- z80_out(REG_C, REG_E);
+ z80_out(reg_C, reg_E);
T_COUNT(12);
break;
case 0x61: /* out (c), h */
- z80_out(REG_C, REG_H);
+ z80_out(reg_C, reg_H);
T_COUNT(12);
break;
case 0x69: /* out (c), l */
- z80_out(REG_C, REG_L);
+ z80_out(reg_C, reg_L);
T_COUNT(12);
break;
case 0x71: /* out (c), 0 [undocumented] */
- z80_out(REG_C, 0);
+ z80_out(reg_C, 0);
T_COUNT(12);
break;
@@ -2854,14 +2854,14 @@ static int do_ED_instruction()
case 0x4D: /* reti */
/* no support for alerting peripherals, just like ret */
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(14);
break;
case 0x45: /* retn */
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
z80_state.iff1 = z80_state.iff2; /* restore the iff state */
T_COUNT(14);
break;
@@ -2872,8 +2872,8 @@ static int do_ED_instruction()
case 0x6D: /* ret [undocumented] */
case 0x75: /* ret [undocumented] */
case 0x7D: /* ret [undocumented] */
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(14);
break;
@@ -2888,19 +2888,19 @@ static int do_ED_instruction()
break;
case 0x42: /* sbc hl, bc */
- do_sbc_word(REG_BC);
+ do_sbc_word(reg_BC);
T_COUNT(15);
break;
case 0x52: /* sbc hl, de */
- do_sbc_word(REG_DE);
+ do_sbc_word(reg_DE);
T_COUNT(15);
break;
case 0x62: /* sbc hl, hl */
- do_sbc_word(REG_HL);
+ do_sbc_word(reg_HL);
T_COUNT(15);
break;
case 0x72: /* sbc hl, sp */
- do_sbc_word(REG_SP);
+ do_sbc_word(reg_SP);
T_COUNT(15);
break;
@@ -2971,7 +2971,7 @@ static int do_ED_instruction()
break;
default:
- disassemble(REG_PC - 2);
+ disassemble(reg_PC - 2);
error("unsupported instruction");
}
@@ -3030,7 +3030,7 @@ int z80_run(int continuous)
while (--i) /*nothing*/;
}
- instruction = mem_read(REG_PC++);
+ instruction = mem_read(reg_PC++);
switch(instruction)
{
@@ -3038,283 +3038,283 @@ int z80_run(int continuous)
do_CB_instruction();
break;
case 0xDD: /* DD.. extended instruction */
- do_indexed_instruction(&REG_IX);
+ do_indexed_instruction(&reg_IX);
break;
case 0xED: /* ED.. extended instruction */
ret = do_ED_instruction();
break;
case 0xFD: /* FD.. extended instruction */
- do_indexed_instruction(&REG_IY);
+ do_indexed_instruction(&reg_IY);
break;
case 0x8F: /* adc a, a */
- do_adc_byte(REG_A); T_COUNT(4);
+ do_adc_byte(reg_A); T_COUNT(4);
break;
case 0x88: /* adc a, b */
- do_adc_byte(REG_B); T_COUNT(4);
+ do_adc_byte(reg_B); T_COUNT(4);
break;
case 0x89: /* adc a, c */
- do_adc_byte(REG_C); T_COUNT(4);
+ do_adc_byte(reg_C); T_COUNT(4);
break;
case 0x8A: /* adc a, d */
- do_adc_byte(REG_D); T_COUNT(4);
+ do_adc_byte(reg_D); T_COUNT(4);
break;
case 0x8B: /* adc a, e */
- do_adc_byte(REG_E); T_COUNT(4);
+ do_adc_byte(reg_E); T_COUNT(4);
break;
case 0x8C: /* adc a, h */
- do_adc_byte(REG_H); T_COUNT(4);
+ do_adc_byte(reg_H); T_COUNT(4);
break;
case 0x8D: /* adc a, l */
- do_adc_byte(REG_L); T_COUNT(4);
+ do_adc_byte(reg_L); T_COUNT(4);
break;
case 0xCE: /* adc a, value */
- do_adc_byte(mem_read(REG_PC++)); T_COUNT(7);
+ do_adc_byte(mem_read(reg_PC++)); T_COUNT(7);
break;
case 0x8E: /* adc a, (hl) */
- do_adc_byte(mem_read(REG_HL)); T_COUNT(7);
+ do_adc_byte(mem_read(reg_HL)); T_COUNT(7);
break;
case 0x87: /* add a, a */
- do_add_byte(REG_A); T_COUNT(4);
+ do_add_byte(reg_A); T_COUNT(4);
break;
case 0x80: /* add a, b */
- do_add_byte(REG_B); T_COUNT(4);
+ do_add_byte(reg_B); T_COUNT(4);
break;
case 0x81: /* add a, c */
- do_add_byte(REG_C); T_COUNT(4);
+ do_add_byte(reg_C); T_COUNT(4);
break;
case 0x82: /* add a, d */
- do_add_byte(REG_D); T_COUNT(4);
+ do_add_byte(reg_D); T_COUNT(4);
break;
case 0x83: /* add a, e */
- do_add_byte(REG_E); T_COUNT(4);
+ do_add_byte(reg_E); T_COUNT(4);
break;
case 0x84: /* add a, h */
- do_add_byte(REG_H); T_COUNT(4);
+ do_add_byte(reg_H); T_COUNT(4);
break;
case 0x85: /* add a, l */
- do_add_byte(REG_L); T_COUNT(4);
+ do_add_byte(reg_L); T_COUNT(4);
break;
case 0xC6: /* add a, value */
- do_add_byte(mem_read(REG_PC++)); T_COUNT(7);
+ do_add_byte(mem_read(reg_PC++)); T_COUNT(7);
break;
case 0x86: /* add a, (hl) */
- do_add_byte(mem_read(REG_HL)); T_COUNT(7);
+ do_add_byte(mem_read(reg_HL)); T_COUNT(7);
break;
case 0x09: /* add hl, bc */
- do_add_word(REG_BC); T_COUNT(11);
+ do_add_word(reg_BC); T_COUNT(11);
break;
case 0x19: /* add hl, de */
- do_add_word(REG_DE); T_COUNT(11);
+ do_add_word(reg_DE); T_COUNT(11);
break;
case 0x29: /* add hl, hl */
- do_add_word(REG_HL); T_COUNT(11);
+ do_add_word(reg_HL); T_COUNT(11);
break;
case 0x39: /* add hl, sp */
- do_add_word(REG_SP); T_COUNT(11);
+ do_add_word(reg_SP); T_COUNT(11);
break;
case 0xA7: /* and a */
- do_and_byte(REG_A); T_COUNT(4);
+ do_and_byte(reg_A); T_COUNT(4);
break;
case 0xA0: /* and b */
- do_and_byte(REG_B); T_COUNT(4);
+ do_and_byte(reg_B); T_COUNT(4);
break;
case 0xA1: /* and c */
- do_and_byte(REG_C); T_COUNT(4);
+ do_and_byte(reg_C); T_COUNT(4);
break;
case 0xA2: /* and d */
- do_and_byte(REG_D); T_COUNT(4);
+ do_and_byte(reg_D); T_COUNT(4);
break;
case 0xA3: /* and e */
- do_and_byte(REG_E); T_COUNT(4);
+ do_and_byte(reg_E); T_COUNT(4);
break;
case 0xA4: /* and h */
- do_and_byte(REG_H); T_COUNT(4);
+ do_and_byte(reg_H); T_COUNT(4);
break;
case 0xA5: /* and l */
- do_and_byte(REG_L); T_COUNT(4);
+ do_and_byte(reg_L); T_COUNT(4);
break;
case 0xE6: /* and value */
- do_and_byte(mem_read(REG_PC++)); T_COUNT(7);
+ do_and_byte(mem_read(reg_PC++)); T_COUNT(7);
break;
case 0xA6: /* and (hl) */
- do_and_byte(mem_read(REG_HL)); T_COUNT(7);
+ do_and_byte(mem_read(reg_HL)); T_COUNT(7);
break;
case 0xCD: /* call address */
- address = mem_read_word(REG_PC);
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC + 2);
- REG_PC = address;
+ address = mem_read_word(reg_PC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC + 2);
+ reg_PC = address;
T_COUNT(17);
break;
case 0xC4: /* call nz, address */
if(!ZERO_FLAG)
{
- address = mem_read_word(REG_PC);
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC + 2);
- REG_PC = address;
+ address = mem_read_word(reg_PC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC + 2);
+ reg_PC = address;
T_COUNT(17);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
T_COUNT(10);
}
break;
case 0xCC: /* call z, address */
if(ZERO_FLAG)
{
- address = mem_read_word(REG_PC);
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC + 2);
- REG_PC = address;
+ address = mem_read_word(reg_PC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC + 2);
+ reg_PC = address;
T_COUNT(17);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
T_COUNT(10);
}
break;
case 0xD4: /* call nc, address */
if(!CARRY_FLAG)
{
- address = mem_read_word(REG_PC);
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC + 2);
- REG_PC = address;
+ address = mem_read_word(reg_PC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC + 2);
+ reg_PC = address;
T_COUNT(17);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
T_COUNT(10);
}
break;
case 0xDC: /* call c, address */
if(CARRY_FLAG)
{
- address = mem_read_word(REG_PC);
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC + 2);
- REG_PC = address;
+ address = mem_read_word(reg_PC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC + 2);
+ reg_PC = address;
T_COUNT(17);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
T_COUNT(10);
}
break;
case 0xE4: /* call po, address */
if(!PARITY_FLAG)
{
- address = mem_read_word(REG_PC);
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC + 2);
- REG_PC = address;
+ address = mem_read_word(reg_PC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC + 2);
+ reg_PC = address;
T_COUNT(17);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
T_COUNT(10);
}
break;
case 0xEC: /* call pe, address */
if(PARITY_FLAG)
{
- address = mem_read_word(REG_PC);
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC + 2);
- REG_PC = address;
+ address = mem_read_word(reg_PC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC + 2);
+ reg_PC = address;
T_COUNT(17);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
T_COUNT(10);
}
break;
case 0xF4: /* call p, address */
if(!SIGN_FLAG)
{
- address = mem_read_word(REG_PC);
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC + 2);
- REG_PC = address;
+ address = mem_read_word(reg_PC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC + 2);
+ reg_PC = address;
T_COUNT(17);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
T_COUNT(10);
}
break;
case 0xFC: /* call m, address */
if(SIGN_FLAG)
{
- address = mem_read_word(REG_PC);
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC + 2);
- REG_PC = address;
+ address = mem_read_word(reg_PC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC + 2);
+ reg_PC = address;
T_COUNT(17);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
T_COUNT(10);
}
break;
case 0x3F: /* ccf */
- REG_F = (REG_F & (ZERO_MASK|PARITY_MASK|SIGN_MASK))
- | (~REG_F & CARRY_MASK)
- | ((REG_F & CARRY_MASK) ? HALF_CARRY_MASK : 0)
- | (REG_A & (UNDOC3_MASK|UNDOC5_MASK));
+ reg_F = (reg_F & (ZERO_MASK|PARITY_MASK|SIGN_MASK))
+ | (~reg_F & CARRY_MASK)
+ | ((reg_F & CARRY_MASK) ? HALF_CARRY_MASK : 0)
+ | (reg_A & (UNDOC3_MASK|UNDOC5_MASK));
T_COUNT(4);
break;
case 0xBF: /* cp a */
- do_cp(REG_A); T_COUNT(4);
+ do_cp(reg_A); T_COUNT(4);
break;
case 0xB8: /* cp b */
- do_cp(REG_B); T_COUNT(4);
+ do_cp(reg_B); T_COUNT(4);
break;
case 0xB9: /* cp c */
- do_cp(REG_C); T_COUNT(4);
+ do_cp(reg_C); T_COUNT(4);
break;
case 0xBA: /* cp d */
- do_cp(REG_D); T_COUNT(4);
+ do_cp(reg_D); T_COUNT(4);
break;
case 0xBB: /* cp e */
- do_cp(REG_E); T_COUNT(4);
+ do_cp(reg_E); T_COUNT(4);
break;
case 0xBC: /* cp h */
- do_cp(REG_H); T_COUNT(4);
+ do_cp(reg_H); T_COUNT(4);
break;
case 0xBD: /* cp l */
- do_cp(REG_L); T_COUNT(4);
+ do_cp(reg_L); T_COUNT(4);
break;
case 0xFE: /* cp value */
- do_cp(mem_read(REG_PC++)); T_COUNT(7);
+ do_cp(mem_read(reg_PC++)); T_COUNT(7);
break;
case 0xBE: /* cp (hl) */
- do_cp(mem_read(REG_HL)); T_COUNT(7);
+ do_cp(mem_read(reg_HL)); T_COUNT(7);
break;
case 0x2F: /* cpl */
- REG_A = ~REG_A;
- REG_F = (REG_F & (CARRY_MASK|PARITY_MASK|ZERO_MASK|SIGN_MASK))
+ reg_A = ~reg_A;
+ reg_F = (reg_F & (CARRY_MASK|PARITY_MASK|ZERO_MASK|SIGN_MASK))
| (HALF_CARRY_MASK|SUBTRACT_MASK)
- | (REG_A & (UNDOC3_MASK|UNDOC5_MASK));
+ | (reg_A & (UNDOC3_MASK|UNDOC5_MASK));
T_COUNT(4);
break;
@@ -3324,50 +3324,50 @@ int z80_run(int continuous)
break;
case 0x3D: /* dec a */
- do_flags_dec_byte(--REG_A); T_COUNT(4);
+ do_flags_dec_byte(--reg_A); T_COUNT(4);
break;
case 0x05: /* dec b */
- do_flags_dec_byte(--REG_B); T_COUNT(4);
+ do_flags_dec_byte(--reg_B); T_COUNT(4);
break;
case 0x0D: /* dec c */
- do_flags_dec_byte(--REG_C); T_COUNT(4);
+ do_flags_dec_byte(--reg_C); T_COUNT(4);
break;
case 0x15: /* dec d */
- do_flags_dec_byte(--REG_D); T_COUNT(4);
+ do_flags_dec_byte(--reg_D); T_COUNT(4);
break;
case 0x1D: /* dec e */
- do_flags_dec_byte(--REG_E); T_COUNT(4);
+ do_flags_dec_byte(--reg_E); T_COUNT(4);
break;
case 0x25: /* dec h */
- do_flags_dec_byte(--REG_H); T_COUNT(4);
+ do_flags_dec_byte(--reg_H); T_COUNT(4);
break;
case 0x2D: /* dec l */
- do_flags_dec_byte(--REG_L); T_COUNT(4);
+ do_flags_dec_byte(--reg_L); T_COUNT(4);
break;
case 0x35: /* dec (hl) */
{
- Uchar value = mem_read(REG_HL) - 1;
- mem_write(REG_HL, value);
+ Uchar value = mem_read(reg_HL) - 1;
+ mem_write(reg_HL, value);
do_flags_dec_byte(value);
}
T_COUNT(11);
break;
case 0x0B: /* dec bc */
- REG_BC--;
+ reg_BC--;
T_COUNT(6);
break;
case 0x1B: /* dec de */
- REG_DE--;
+ reg_DE--;
T_COUNT(6);
break;
case 0x2B: /* dec hl */
- REG_HL--;
+ reg_HL--;
T_COUNT(6);
break;
case 0x3B: /* dec sp */
- REG_SP--;
+ reg_SP--;
T_COUNT(6);
break;
@@ -3378,16 +3378,16 @@ int z80_run(int continuous)
case 0x10: /* djnz offset */
/* Zaks says no flag changes. */
- if(--REG_B != 0)
+ if(--reg_B != 0)
{
signed char byte_value;
- byte_value = (signed char) mem_read(REG_PC++);
- REG_PC += byte_value;
+ byte_value = (signed char) mem_read(reg_PC++);
+ reg_PC += byte_value;
T_COUNT(13);
}
else
{
- REG_PC++;
+ reg_PC++;
T_COUNT(8);
}
break;
@@ -3400,9 +3400,9 @@ int z80_run(int continuous)
case 0x08: /* ex af, af' */
{
Ushort temp;
- temp = REG_AF;
- REG_AF = REG_AF_PRIME;
- REG_AF_PRIME = temp;
+ temp = reg_AF;
+ reg_AF = reg_AF_PRIME;
+ reg_AF_PRIME = temp;
}
T_COUNT(4);
break;
@@ -3410,9 +3410,9 @@ int z80_run(int continuous)
case 0xEB: /* ex de, hl */
{
Ushort temp;
- temp = REG_DE;
- REG_DE = REG_HL;
- REG_HL = temp;
+ temp = reg_DE;
+ reg_DE = reg_HL;
+ reg_HL = temp;
}
T_COUNT(4);
break;
@@ -3420,9 +3420,9 @@ int z80_run(int continuous)
case 0xE3: /* ex (sp), hl */
{
Ushort temp;
- temp = mem_read_word(REG_SP);
- mem_write_word(REG_SP, REG_HL);
- REG_HL = temp;
+ temp = mem_read_word(reg_SP);
+ mem_write_word(reg_SP, reg_HL);
+ reg_HL = temp;
}
T_COUNT(19);
break;
@@ -3430,15 +3430,15 @@ int z80_run(int continuous)
case 0xD9: /* exx */
{
Ushort tmp;
- tmp = REG_BC_PRIME;
- REG_BC_PRIME = REG_BC;
- REG_BC = tmp;
- tmp = REG_DE_PRIME;
- REG_DE_PRIME = REG_DE;
- REG_DE = tmp;
- tmp = REG_HL_PRIME;
- REG_HL_PRIME = REG_HL;
- REG_HL = tmp;
+ tmp = reg_BC_PRIME;
+ reg_BC_PRIME = reg_BC;
+ reg_BC = tmp;
+ tmp = reg_DE_PRIME;
+ reg_DE_PRIME = reg_DE;
+ reg_DE = tmp;
+ tmp = reg_HL_PRIME;
+ reg_HL_PRIME = reg_HL;
+ reg_HL = tmp;
}
T_COUNT(4);
break;
@@ -3456,7 +3456,7 @@ int z80_run(int continuous)
internally. When an interrupt or NMI is delivered,
(see below) we undo this decrement to get out of
the halt state. */
- REG_PC--;
+ reg_PC--;
if (continuous > 0 &&
!(z80_state.nmi && !z80_state.nmi_seen) &&
!(z80_state.irq && z80_state.iff1) &&
@@ -3469,160 +3469,160 @@ int z80_run(int continuous)
break;
case 0xDB: /* in a, (port) */
- REG_A = z80_in(mem_read(REG_PC++));
+ reg_A = z80_in(mem_read(reg_PC++));
T_COUNT(10);
break;
case 0x3C: /* inc a */
- REG_A++;
- do_flags_inc_byte(REG_A); T_COUNT(4);
+ reg_A++;
+ do_flags_inc_byte(reg_A); T_COUNT(4);
break;
case 0x04: /* inc b */
- REG_B++;
- do_flags_inc_byte(REG_B); T_COUNT(4);
+ reg_B++;
+ do_flags_inc_byte(reg_B); T_COUNT(4);
break;
case 0x0C: /* inc c */
- REG_C++;
- do_flags_inc_byte(REG_C); T_COUNT(4);
+ reg_C++;
+ do_flags_inc_byte(reg_C); T_COUNT(4);
break;
case 0x14: /* inc d */
- REG_D++;
- do_flags_inc_byte(REG_D); T_COUNT(4);
+ reg_D++;
+ do_flags_inc_byte(reg_D); T_COUNT(4);
break;
case 0x1C: /* inc e */
- REG_E++;
- do_flags_inc_byte(REG_E); T_COUNT(4);
+ reg_E++;
+ do_flags_inc_byte(reg_E); T_COUNT(4);
break;
case 0x24: /* inc h */
- REG_H++;
- do_flags_inc_byte(REG_H); T_COUNT(4);
+ reg_H++;
+ do_flags_inc_byte(reg_H); T_COUNT(4);
break;
case 0x2C: /* inc l */
- REG_L++;
- do_flags_inc_byte(REG_L); T_COUNT(4);
+ reg_L++;
+ do_flags_inc_byte(reg_L); T_COUNT(4);
break;
case 0x34: /* inc (hl) */
{
- Uchar value = mem_read(REG_HL) + 1;
- mem_write(REG_HL, value);
+ Uchar value = mem_read(reg_HL) + 1;
+ mem_write(reg_HL, value);
do_flags_inc_byte(value);
}
T_COUNT(11);
break;
case 0x03: /* inc bc */
- REG_BC++;
+ reg_BC++;
T_COUNT(6);
break;
case 0x13: /* inc de */
- REG_DE++;
+ reg_DE++;
T_COUNT(6);
break;
case 0x23: /* inc hl */
- REG_HL++;
+ reg_HL++;
T_COUNT(6);
break;
case 0x33: /* inc sp */
- REG_SP++;
+ reg_SP++;
T_COUNT(6);
break;
case 0xC3: /* jp address */
- REG_PC = mem_read_word(REG_PC);
+ reg_PC = mem_read_word(reg_PC);
T_COUNT(10);
break;
case 0xE9: /* jp (hl) */
- REG_PC = REG_HL;
+ reg_PC = reg_HL;
T_COUNT(4);
break;
case 0xC2: /* jp nz, address */
if(!ZERO_FLAG)
{
- REG_PC = mem_read_word(REG_PC);
+ reg_PC = mem_read_word(reg_PC);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
}
T_COUNT(10);
break;
case 0xCA: /* jp z, address */
if(ZERO_FLAG)
{
- REG_PC = mem_read_word(REG_PC);
+ reg_PC = mem_read_word(reg_PC);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
}
T_COUNT(10);
break;
case 0xD2: /* jp nc, address */
if(!CARRY_FLAG)
{
- REG_PC = mem_read_word(REG_PC);
+ reg_PC = mem_read_word(reg_PC);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
}
T_COUNT(10);
break;
case 0xDA: /* jp c, address */
if(CARRY_FLAG)
{
- REG_PC = mem_read_word(REG_PC);
+ reg_PC = mem_read_word(reg_PC);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
}
T_COUNT(10);
break;
case 0xE2: /* jp po, address */
if(!PARITY_FLAG)
{
- REG_PC = mem_read_word(REG_PC);
+ reg_PC = mem_read_word(reg_PC);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
}
T_COUNT(10);
break;
case 0xEA: /* jp pe, address */
if(PARITY_FLAG)
{
- REG_PC = mem_read_word(REG_PC);
+ reg_PC = mem_read_word(reg_PC);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
}
T_COUNT(10);
break;
case 0xF2: /* jp p, address */
if(!SIGN_FLAG)
{
- REG_PC = mem_read_word(REG_PC);
+ reg_PC = mem_read_word(reg_PC);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
}
T_COUNT(10);
break;
case 0xFA: /* jp m, address */
if(SIGN_FLAG)
{
- REG_PC = mem_read_word(REG_PC);
+ reg_PC = mem_read_word(reg_PC);
}
else
{
- REG_PC += 2;
+ reg_PC += 2;
}
T_COUNT(10);
break;
@@ -3630,8 +3630,8 @@ int z80_run(int continuous)
case 0x18: /* jr offset */
{
signed char byte_value;
- byte_value = (signed char) mem_read(REG_PC++);
- REG_PC += byte_value;
+ byte_value = (signed char) mem_read(reg_PC++);
+ reg_PC += byte_value;
}
T_COUNT(12);
break;
@@ -3640,13 +3640,13 @@ int z80_run(int continuous)
if(!ZERO_FLAG)
{
signed char byte_value;
- byte_value = (signed char) mem_read(REG_PC++);
- REG_PC += byte_value;
+ byte_value = (signed char) mem_read(reg_PC++);
+ reg_PC += byte_value;
T_COUNT(12);
}
else
{
- REG_PC++;
+ reg_PC++;
T_COUNT(7);
}
break;
@@ -3654,13 +3654,13 @@ int z80_run(int continuous)
if(ZERO_FLAG)
{
signed char byte_value;
- byte_value = (signed char) mem_read(REG_PC++);
- REG_PC += byte_value;
+ byte_value = (signed char) mem_read(reg_PC++);
+ reg_PC += byte_value;
T_COUNT(12);
}
else
{
- REG_PC++;
+ reg_PC++;
T_COUNT(7);
}
break;
@@ -3668,13 +3668,13 @@ int z80_run(int continuous)
if(!CARRY_FLAG)
{
signed char byte_value;
- byte_value = (signed char) mem_read(REG_PC++);
- REG_PC += byte_value;
+ byte_value = (signed char) mem_read(reg_PC++);
+ reg_PC += byte_value;
T_COUNT(12);
}
else
{
- REG_PC++;
+ reg_PC++;
T_COUNT(7);
}
break;
@@ -3682,300 +3682,300 @@ int z80_run(int continuous)
if(CARRY_FLAG)
{
signed char byte_value;
- byte_value = (signed char) mem_read(REG_PC++);
- REG_PC += byte_value;
+ byte_value = (signed char) mem_read(reg_PC++);
+ reg_PC += byte_value;
T_COUNT(12);
}
else
{
- REG_PC++;
+ reg_PC++;
T_COUNT(7);
}
break;
case 0x7F: /* ld a, a */
- REG_A = REG_A; T_COUNT(4);
+ reg_A = reg_A; T_COUNT(4);
break;
case 0x78: /* ld a, b */
- REG_A = REG_B; T_COUNT(4);
+ reg_A = reg_B; T_COUNT(4);
break;
case 0x79: /* ld a, c */
- REG_A = REG_C; T_COUNT(4);
+ reg_A = reg_C; T_COUNT(4);
break;
case 0x7A: /* ld a, d */
- REG_A = REG_D; T_COUNT(4);
+ reg_A = reg_D; T_COUNT(4);
break;
case 0x7B: /* ld a, e */
- REG_A = REG_E; T_COUNT(4);
+ reg_A = reg_E; T_COUNT(4);
break;
case 0x7C: /* ld a, h */
- REG_A = REG_H; T_COUNT(4);
+ reg_A = reg_H; T_COUNT(4);
break;
case 0x7D: /* ld a, l */
- REG_A = REG_L; T_COUNT(4);
+ reg_A = reg_L; T_COUNT(4);
break;
case 0x47: /* ld b, a */
- REG_B = REG_A; T_COUNT(4);
+ reg_B = reg_A; T_COUNT(4);
break;
case 0x40: /* ld b, b */
- REG_B = REG_B; T_COUNT(4);
+ reg_B = reg_B; T_COUNT(4);
break;
case 0x41: /* ld b, c */
- REG_B = REG_C; T_COUNT(4);
+ reg_B = reg_C; T_COUNT(4);
break;
case 0x42: /* ld b, d */
- REG_B = REG_D; T_COUNT(4);
+ reg_B = reg_D; T_COUNT(4);
break;
case 0x43: /* ld b, e */
- REG_B = REG_E; T_COUNT(4);
+ reg_B = reg_E; T_COUNT(4);
break;
case 0x44: /* ld b, h */
- REG_B = REG_H; T_COUNT(4);
+ reg_B = reg_H; T_COUNT(4);
break;
case 0x45: /* ld b, l */
- REG_B = REG_L; T_COUNT(4);
+ reg_B = reg_L; T_COUNT(4);
break;
case 0x4F: /* ld c, a */
- REG_C = REG_A; T_COUNT(4);
+ reg_C = reg_A; T_COUNT(4);
break;
case 0x48: /* ld c, b */
- REG_C = REG_B; T_COUNT(4);
+ reg_C = reg_B; T_COUNT(4);
break;
case 0x49: /* ld c, c */
- REG_C = REG_C; T_COUNT(4);
+ reg_C = reg_C; T_COUNT(4);
break;
case 0x4A: /* ld c, d */
- REG_C = REG_D; T_COUNT(4);
+ reg_C = reg_D; T_COUNT(4);
break;
case 0x4B: /* ld c, e */
- REG_C = REG_E; T_COUNT(4);
+ reg_C = reg_E; T_COUNT(4);
break;
case 0x4C: /* ld c, h */
- REG_C = REG_H; T_COUNT(4);
+ reg_C = reg_H; T_COUNT(4);
break;
case 0x4D: /* ld c, l */
- REG_C = REG_L; T_COUNT(4);
+ reg_C = reg_L; T_COUNT(4);
break;
case 0x57: /* ld d, a */
- REG_D = REG_A; T_COUNT(4);
+ reg_D = reg_A; T_COUNT(4);
break;
case 0x50: /* ld d, b */
- REG_D = REG_B; T_COUNT(4);
+ reg_D = reg_B; T_COUNT(4);
break;
case 0x51: /* ld d, c */
- REG_D = REG_C; T_COUNT(4);
+ reg_D = reg_C; T_COUNT(4);
break;
case 0x52: /* ld d, d */
- REG_D = REG_D; T_COUNT(4);
+ reg_D = reg_D; T_COUNT(4);
break;
case 0x53: /* ld d, e */
- REG_D = REG_E; T_COUNT(4);
+ reg_D = reg_E; T_COUNT(4);
break;
case 0x54: /* ld d, h */
- REG_D = REG_H; T_COUNT(4);
+ reg_D = reg_H; T_COUNT(4);
break;
case 0x55: /* ld d, l */
- REG_D = REG_L; T_COUNT(4);
+ reg_D = reg_L; T_COUNT(4);
break;
case 0x5F: /* ld e, a */
- REG_E = REG_A; T_COUNT(4);
+ reg_E = reg_A; T_COUNT(4);
break;
case 0x58: /* ld e, b */
- REG_E = REG_B; T_COUNT(4);
+ reg_E = reg_B; T_COUNT(4);
break;
case 0x59: /* ld e, c */
- REG_E = REG_C; T_COUNT(4);
+ reg_E = reg_C; T_COUNT(4);
break;
case 0x5A: /* ld e, d */
- REG_E = REG_D; T_COUNT(4);
+ reg_E = reg_D; T_COUNT(4);
break;
case 0x5B: /* ld e, e */
- REG_E = REG_E; T_COUNT(4);
+ reg_E = reg_E; T_COUNT(4);
break;
case 0x5C: /* ld e, h */
- REG_E = REG_H; T_COUNT(4);
+ reg_E = reg_H; T_COUNT(4);
break;
case 0x5D: /* ld e, l */
- REG_E = REG_L; T_COUNT(4);
+ reg_E = reg_L; T_COUNT(4);
break;
case 0x67: /* ld h, a */
- REG_H = REG_A; T_COUNT(4);
+ reg_H = reg_A; T_COUNT(4);
break;
case 0x60: /* ld h, b */
- REG_H = REG_B; T_COUNT(4);
+ reg_H = reg_B; T_COUNT(4);
break;
case 0x61: /* ld h, c */
- REG_H = REG_C; T_COUNT(4);
+ reg_H = reg_C; T_COUNT(4);
break;
case 0x62: /* ld h, d */
- REG_H = REG_D; T_COUNT(4);
+ reg_H = reg_D; T_COUNT(4);
break;
case 0x63: /* ld h, e */
- REG_H = REG_E; T_COUNT(4);
+ reg_H = reg_E; T_COUNT(4);
break;
case 0x64: /* ld h, h */
- REG_H = REG_H; T_COUNT(4);
+ reg_H = reg_H; T_COUNT(4);
break;
case 0x65: /* ld h, l */
- REG_H = REG_L; T_COUNT(4);
+ reg_H = reg_L; T_COUNT(4);
break;
case 0x6F: /* ld l, a */
- REG_L = REG_A; T_COUNT(4);
+ reg_L = reg_A; T_COUNT(4);
break;
case 0x68: /* ld l, b */
- REG_L = REG_B; T_COUNT(4);
+ reg_L = reg_B; T_COUNT(4);
break;
case 0x69: /* ld l, c */
- REG_L = REG_C; T_COUNT(4);
+ reg_L = reg_C; T_COUNT(4);
break;
case 0x6A: /* ld l, d */
- REG_L = REG_D; T_COUNT(4);
+ reg_L = reg_D; T_COUNT(4);
break;
case 0x6B: /* ld l, e */
- REG_L = REG_E; T_COUNT(4);
+ reg_L = reg_E; T_COUNT(4);
break;
case 0x6C: /* ld l, h */
- REG_L = REG_H; T_COUNT(4);
+ reg_L = reg_H; T_COUNT(4);
break;
case 0x6D: /* ld l, l */
- REG_L = REG_L; T_COUNT(4);
+ reg_L = reg_L; T_COUNT(4);
break;
case 0x02: /* ld (bc), a */
- mem_write(REG_BC, REG_A); T_COUNT(7);
+ mem_write(reg_BC, reg_A); T_COUNT(7);
break;
case 0x12: /* ld (de), a */
- mem_write(REG_DE, REG_A); T_COUNT(7);
+ mem_write(reg_DE, reg_A); T_COUNT(7);
break;
case 0x77: /* ld (hl), a */
- mem_write(REG_HL, REG_A); T_COUNT(7);
+ mem_write(reg_HL, reg_A); T_COUNT(7);
break;
case 0x70: /* ld (hl), b */
- mem_write(REG_HL, REG_B); T_COUNT(7);
+ mem_write(reg_HL, reg_B); T_COUNT(7);
break;
case 0x71: /* ld (hl), c */
- mem_write(REG_HL, REG_C); T_COUNT(7);
+ mem_write(reg_HL, reg_C); T_COUNT(7);
break;
case 0x72: /* ld (hl), d */
- mem_write(REG_HL, REG_D); T_COUNT(7);
+ mem_write(reg_HL, reg_D); T_COUNT(7);
break;
case 0x73: /* ld (hl), e */
- mem_write(REG_HL, REG_E); T_COUNT(7);
+ mem_write(reg_HL, reg_E); T_COUNT(7);
break;
case 0x74: /* ld (hl), h */
- mem_write(REG_HL, REG_H); T_COUNT(7);
+ mem_write(reg_HL, reg_H); T_COUNT(7);
break;
case 0x75: /* ld (hl), l */
- mem_write(REG_HL, REG_L); T_COUNT(7);
+ mem_write(reg_HL, reg_L); T_COUNT(7);
break;
case 0x7E: /* ld a, (hl) */
- REG_A = mem_read(REG_HL); T_COUNT(7);
+ reg_A = mem_read(reg_HL); T_COUNT(7);
break;
case 0x46: /* ld b, (hl) */
- REG_B = mem_read(REG_HL); T_COUNT(7);
+ reg_B = mem_read(reg_HL); T_COUNT(7);
break;
case 0x4E: /* ld c, (hl) */
- REG_C = mem_read(REG_HL); T_COUNT(7);
+ reg_C = mem_read(reg_HL); T_COUNT(7);
break;
case 0x56: /* ld d, (hl) */
- REG_D = mem_read(REG_HL); T_COUNT(7);
+ reg_D = mem_read(reg_HL); T_COUNT(7);
break;
case 0x5E: /* ld e, (hl) */
- REG_E = mem_read(REG_HL); T_COUNT(7);
+ reg_E = mem_read(reg_HL); T_COUNT(7);
break;
case 0x66: /* ld h, (hl) */
- REG_H = mem_read(REG_HL); T_COUNT(7);
+ reg_H = mem_read(reg_HL); T_COUNT(7);
break;
case 0x6E: /* ld l, (hl) */
- REG_L = mem_read(REG_HL); T_COUNT(7);
+ reg_L = mem_read(reg_HL); T_COUNT(7);
break;
case 0x3E: /* ld a, value */
- REG_A = mem_read(REG_PC++); T_COUNT(7);
+ reg_A = mem_read(reg_PC++); T_COUNT(7);
break;
case 0x06: /* ld b, value */
- REG_B = mem_read(REG_PC++); T_COUNT(7);
+ reg_B = mem_read(reg_PC++); T_COUNT(7);
break;
case 0x0E: /* ld c, value */
- REG_C = mem_read(REG_PC++); T_COUNT(7);
+ reg_C = mem_read(reg_PC++); T_COUNT(7);
break;
case 0x16: /* ld d, value */
- REG_D = mem_read(REG_PC++); T_COUNT(7);
+ reg_D = mem_read(reg_PC++); T_COUNT(7);
break;
case 0x1E: /* ld e, value */
- REG_E = mem_read(REG_PC++); T_COUNT(7);
+ reg_E = mem_read(reg_PC++); T_COUNT(7);
break;
case 0x26: /* ld h, value */
- REG_H = mem_read(REG_PC++); T_COUNT(7);
+ reg_H = mem_read(reg_PC++); T_COUNT(7);
break;
case 0x2E: /* ld l, value */
- REG_L = mem_read(REG_PC++); T_COUNT(7);
+ reg_L = mem_read(reg_PC++); T_COUNT(7);
break;
case 0x01: /* ld bc, value */
- REG_BC = mem_read_word(REG_PC);
- REG_PC += 2;
+ reg_BC = mem_read_word(reg_PC);
+ reg_PC += 2;
T_COUNT(10);
break;
case 0x11: /* ld de, value */
- REG_DE = mem_read_word(REG_PC);
- REG_PC += 2;
+ reg_DE = mem_read_word(reg_PC);
+ reg_PC += 2;
T_COUNT(10);
break;
case 0x21: /* ld hl, value */
- REG_HL = mem_read_word(REG_PC);
- REG_PC += 2;
+ reg_HL = mem_read_word(reg_PC);
+ reg_PC += 2;
T_COUNT(10);
break;
case 0x31: /* ld sp, value */
- REG_SP = mem_read_word(REG_PC);
- REG_PC += 2;
+ reg_SP = mem_read_word(reg_PC);
+ reg_PC += 2;
T_COUNT(10);
break;
case 0x3A: /* ld a, (address) */
/* this one is missing from Zaks */
- REG_A = mem_read(mem_read_word(REG_PC));
- REG_PC += 2;
+ reg_A = mem_read(mem_read_word(reg_PC));
+ reg_PC += 2;
T_COUNT(13);
break;
case 0x0A: /* ld a, (bc) */
- REG_A = mem_read(REG_BC);
+ reg_A = mem_read(reg_BC);
T_COUNT(7);
break;
case 0x1A: /* ld a, (de) */
- REG_A = mem_read(REG_DE);
+ reg_A = mem_read(reg_DE);
T_COUNT(7);
break;
case 0x32: /* ld (address), a */
- mem_write(mem_read_word(REG_PC), REG_A);
- REG_PC += 2;
+ mem_write(mem_read_word(reg_PC), reg_A);
+ reg_PC += 2;
T_COUNT(13);
break;
case 0x22: /* ld (address), hl */
- mem_write_word(mem_read_word(REG_PC), REG_HL);
- REG_PC += 2;
+ mem_write_word(mem_read_word(reg_PC), reg_HL);
+ reg_PC += 2;
T_COUNT(16);
break;
case 0x36: /* ld (hl), value */
- mem_write(REG_HL, mem_read(REG_PC++));
+ mem_write(reg_HL, mem_read(reg_PC++));
T_COUNT(10);
break;
case 0x2A: /* ld hl, (address) */
- REG_HL = mem_read_word(mem_read_word(REG_PC));
- REG_PC += 2;
+ reg_HL = mem_read_word(mem_read_word(reg_PC));
+ reg_PC += 2;
T_COUNT(16);
break;
case 0xF9: /* ld sp, hl */
- REG_SP = REG_HL;
+ reg_SP = reg_HL;
T_COUNT(6);
break;
@@ -3984,94 +3984,94 @@ int z80_run(int continuous)
break;
case 0xF6: /* or value */
- do_or_byte(mem_read(REG_PC++));
+ do_or_byte(mem_read(reg_PC++));
T_COUNT(7);
break;
case 0xB7: /* or a */
- do_or_byte(REG_A); T_COUNT(4);
+ do_or_byte(reg_A); T_COUNT(4);
break;
case 0xB0: /* or b */
- do_or_byte(REG_B); T_COUNT(4);
+ do_or_byte(reg_B); T_COUNT(4);
break;
case 0xB1: /* or c */
- do_or_byte(REG_C); T_COUNT(4);
+ do_or_byte(reg_C); T_COUNT(4);
break;
case 0xB2: /* or d */
- do_or_byte(REG_D); T_COUNT(4);
+ do_or_byte(reg_D); T_COUNT(4);
break;
case 0xB3: /* or e */
- do_or_byte(REG_E); T_COUNT(4);
+ do_or_byte(reg_E); T_COUNT(4);
break;
case 0xB4: /* or h */
- do_or_byte(REG_H); T_COUNT(4);
+ do_or_byte(reg_H); T_COUNT(4);
break;
case 0xB5: /* or l */
- do_or_byte(REG_L); T_COUNT(4);
+ do_or_byte(reg_L); T_COUNT(4);
break;
case 0xB6: /* or (hl) */
- do_or_byte(mem_read(REG_HL)); T_COUNT(7);
+ do_or_byte(mem_read(reg_HL)); T_COUNT(7);
break;
case 0xD3: /* out (port), a */
- z80_out(mem_read(REG_PC++), REG_A);
+ z80_out(mem_read(reg_PC++), reg_A);
T_COUNT(11);
break;
case 0xC1: /* pop bc */
- REG_BC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_BC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(10);
break;
case 0xD1: /* pop de */
- REG_DE = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_DE = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(10);
break;
case 0xE1: /* pop hl */
- REG_HL = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_HL = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(10);
break;
case 0xF1: /* pop af */
- REG_AF = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_AF = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(10);
break;
case 0xC5: /* push bc */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_BC);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_BC);
T_COUNT(11);
break;
case 0xD5: /* push de */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_DE);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_DE);
T_COUNT(11);
break;
case 0xE5: /* push hl */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_HL);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_HL);
T_COUNT(11);
break;
case 0xF5: /* push af */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_AF);
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_AF);
T_COUNT(11);
break;
case 0xC9: /* ret */
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(10);
break;
case 0xC0: /* ret nz */
if(!ZERO_FLAG)
{
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(11);
} else {
T_COUNT(5);
@@ -4080,8 +4080,8 @@ int z80_run(int continuous)
case 0xC8: /* ret z */
if(ZERO_FLAG)
{
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(11);
} else {
T_COUNT(5);
@@ -4090,8 +4090,8 @@ int z80_run(int continuous)
case 0xD0: /* ret nc */
if(!CARRY_FLAG)
{
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(11);
} else {
T_COUNT(5);
@@ -4100,8 +4100,8 @@ int z80_run(int continuous)
case 0xD8: /* ret c */
if(CARRY_FLAG)
{
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(11);
} else {
T_COUNT(5);
@@ -4110,8 +4110,8 @@ int z80_run(int continuous)
case 0xE0: /* ret po */
if(!PARITY_FLAG)
{
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(11);
} else {
T_COUNT(5);
@@ -4120,8 +4120,8 @@ int z80_run(int continuous)
case 0xE8: /* ret pe */
if(PARITY_FLAG)
{
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(11);
} else {
T_COUNT(5);
@@ -4130,8 +4130,8 @@ int z80_run(int continuous)
case 0xF0: /* ret p */
if(!SIGN_FLAG)
{
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(11);
} else {
T_COUNT(5);
@@ -4140,8 +4140,8 @@ int z80_run(int continuous)
case 0xF8: /* ret m */
if(SIGN_FLAG)
{
- REG_PC = mem_read_word(REG_SP);
- REG_SP += 2;
+ reg_PC = mem_read_word(reg_SP);
+ reg_SP += 2;
T_COUNT(11);
} else {
T_COUNT(5);
@@ -4169,148 +4169,148 @@ int z80_run(int continuous)
break;
case 0xC7: /* rst 00h */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC);
- REG_PC = 0x00;
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC);
+ reg_PC = 0x00;
T_COUNT(11);
break;
case 0xCF: /* rst 08h */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC);
- REG_PC = 0x08;
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC);
+ reg_PC = 0x08;
T_COUNT(11);
break;
case 0xD7: /* rst 10h */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC);
- REG_PC = 0x10;
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC);
+ reg_PC = 0x10;
T_COUNT(11);
break;
case 0xDF: /* rst 18h */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC);
- REG_PC = 0x18;
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC);
+ reg_PC = 0x18;
T_COUNT(11);
break;
case 0xE7: /* rst 20h */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC);
- REG_PC = 0x20;
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC);
+ reg_PC = 0x20;
T_COUNT(11);
break;
case 0xEF: /* rst 28h */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC);
- REG_PC = 0x28;
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC);
+ reg_PC = 0x28;
T_COUNT(11);
break;
case 0xF7: /* rst 30h */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC);
- REG_PC = 0x30;
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC);
+ reg_PC = 0x30;
T_COUNT(11);
break;
case 0xFF: /* rst 38h */
- REG_SP -= 2;
- mem_write_word(REG_SP, REG_PC);
- REG_PC = 0x38;
+ reg_SP -= 2;
+ mem_write_word(reg_SP, reg_PC);
+ reg_PC = 0x38;
T_COUNT(11);
break;
case 0x37: /* scf */
- REG_F = (REG_F & (ZERO_FLAG|PARITY_FLAG|SIGN_FLAG))
+ reg_F = (reg_F & (ZERO_FLAG|PARITY_FLAG|SIGN_FLAG))
| CARRY_MASK
- | (REG_A & (UNDOC3_MASK|UNDOC5_MASK));
+ | (reg_A & (UNDOC3_MASK|UNDOC5_MASK));
T_COUNT(4);
break;
case 0x9F: /* sbc a, a */
- do_sbc_byte(REG_A); T_COUNT(4);
+ do_sbc_byte(reg_A); T_COUNT(4);
break;
case 0x98: /* sbc a, b */
- do_sbc_byte(REG_B); T_COUNT(4);
+ do_sbc_byte(reg_B); T_COUNT(4);
break;
case 0x99: /* sbc a, c */
- do_sbc_byte(REG_C); T_COUNT(4);
+ do_sbc_byte(reg_C); T_COUNT(4);
break;
case 0x9A: /* sbc a, d */
- do_sbc_byte(REG_D); T_COUNT(4);
+ do_sbc_byte(reg_D); T_COUNT(4);
break;
case 0x9B: /* sbc a, e */
- do_sbc_byte(REG_E); T_COUNT(4);
+ do_sbc_byte(reg_E); T_COUNT(4);
break;
case 0x9C: /* sbc a, h */
- do_sbc_byte(REG_H); T_COUNT(4);
+ do_sbc_byte(reg_H); T_COUNT(4);
break;
case 0x9D: /* sbc a, l */
- do_sbc_byte(REG_L); T_COUNT(4);
+ do_sbc_byte(reg_L); T_COUNT(4);
break;
case 0xDE: /* sbc a, value */
- do_sbc_byte(mem_read(REG_PC++)); T_COUNT(7);
+ do_sbc_byte(mem_read(reg_PC++)); T_COUNT(7);
break;
case 0x9E: /* sbc a, (hl) */
- do_sbc_byte(mem_read(REG_HL)); T_COUNT(7);
+ do_sbc_byte(mem_read(reg_HL)); T_COUNT(7);
break;
case 0x97: /* sub a, a */
- do_sub_byte(REG_A); T_COUNT(4);
+ do_sub_byte(reg_A); T_COUNT(4);
break;
case 0x90: /* sub a, b */
- do_sub_byte(REG_B); T_COUNT(4);
+ do_sub_byte(reg_B); T_COUNT(4);
break;
case 0x91: /* sub a, c */
- do_sub_byte(REG_C); T_COUNT(4);
+ do_sub_byte(reg_C); T_COUNT(4);
break;
case 0x92: /* sub a, d */
- do_sub_byte(REG_D); T_COUNT(4);
+ do_sub_byte(reg_D); T_COUNT(4);
break;
case 0x93: /* sub a, e */
- do_sub_byte(REG_E); T_COUNT(4);
+ do_sub_byte(reg_E); T_COUNT(4);
break;
case 0x94: /* sub a, h */
- do_sub_byte(REG_H); T_COUNT(4);
+ do_sub_byte(reg_H); T_COUNT(4);
break;
case 0x95: /* sub a, l */
- do_sub_byte(REG_L); T_COUNT(4);
+ do_sub_byte(reg_L); T_COUNT(4);
break;
case 0xD6: /* sub a, value */
- do_sub_byte(mem_read(REG_PC++)); T_COUNT(7);
+ do_sub_byte(mem_read(reg_PC++)); T_COUNT(7);
break;
case 0x96: /* sub a, (hl) */
- do_sub_byte(mem_read(REG_HL)); T_COUNT(7);
+ do_sub_byte(mem_read(reg_HL)); T_COUNT(7);
break;
case 0xEE: /* xor value */
- do_xor_byte(mem_read(REG_PC++)); T_COUNT(7);
+ do_xor_byte(mem_read(reg_PC++)); T_COUNT(7);
break;
case 0xAF: /* xor a */
- do_xor_byte(REG_A); T_COUNT(4);
+ do_xor_byte(reg_A); T_COUNT(4);
break;
case 0xA8: /* xor b */
- do_xor_byte(REG_B); T_COUNT(4);
+ do_xor_byte(reg_B); T_COUNT(4);
break;
case 0xA9: /* xor c */
- do_xor_byte(REG_C); T_COUNT(4);
+ do_xor_byte(reg_C); T_COUNT(4);
break;
case 0xAA: /* xor d */
- do_xor_byte(REG_D); T_COUNT(4);
+ do_xor_byte(reg_D); T_COUNT(4);
break;
case 0xAB: /* xor e */
- do_xor_byte(REG_E); T_COUNT(4);
+ do_xor_byte(reg_E); T_COUNT(4);
break;
case 0xAC: /* xor h */
- do_xor_byte(REG_H); T_COUNT(4);
+ do_xor_byte(reg_H); T_COUNT(4);
break;
case 0xAD: /* xor l */
- do_xor_byte(REG_L); T_COUNT(4);
+ do_xor_byte(reg_L); T_COUNT(4);
break;
case 0xAE: /* xor (hl) */
- do_xor_byte(mem_read(REG_HL)); T_COUNT(7);
+ do_xor_byte(mem_read(reg_HL)); T_COUNT(7);
break;
default:
- disassemble(REG_PC - 1);
+ disassemble(reg_PC - 1);
error("unsupported instruction");
}
@@ -4329,7 +4329,7 @@ int z80_run(int continuous)
{
if (instruction == 0x76) {
/* Taking a NMI gets us out of a halt */
- REG_PC++;
+ reg_PC++;
}
do_nmi();
z80_state.nmi_seen = TRUE;
@@ -4344,7 +4344,7 @@ int z80_run(int continuous)
{
if (instruction == 0x76) {
/* Taking an interrupt gets us out of a halt */
- REG_PC++;
+ reg_PC++;
}
do_int();
}
@@ -4356,7 +4356,7 @@ int z80_run(int continuous)
void z80_reset()
{
- REG_PC = 0;
+ reg_PC = 0;
z80_state.i = 0;
z80_state.iff1 = 0;
z80_state.iff2 = 0;
diff --git a/z80.h b/z80.h
index f077ee6..b7f6b82 100644
--- a/z80.h
+++ b/z80.h
@@ -135,36 +135,36 @@ struct z80_state_struct
* Register accessors:
*/
-#define REG_A (z80_state.af.byte.high)
-#define REG_F (z80_state.af.byte.low)
-#define REG_B (z80_state.bc.byte.high)
-#define REG_C (z80_state.bc.byte.low)
-#define REG_D (z80_state.de.byte.high)
-#define REG_E (z80_state.de.byte.low)
-#define REG_H (z80_state.hl.byte.high)
-#define REG_L (z80_state.hl.byte.low)
-#define REG_IX_HIGH (z80_state.ix.byte.high)
-#define REG_IX_LOW (z80_state.ix.byte.low)
-#define REG_IY_HIGH (z80_state.iy.byte.high)
-#define REG_IY_LOW (z80_state.iy.byte.low)
-
-#define REG_SP (z80_state.sp.word)
-#define REG_PC (z80_state.pc.word)
-
-#define REG_AF (z80_state.af.word)
-#define REG_BC (z80_state.bc.word)
-#define REG_DE (z80_state.de.word)
-#define REG_HL (z80_state.hl.word)
-
-#define REG_AF_PRIME (z80_state.af_prime.word)
-#define REG_BC_PRIME (z80_state.bc_prime.word)
-#define REG_DE_PRIME (z80_state.de_prime.word)
-#define REG_HL_PRIME (z80_state.hl_prime.word)
-
-#define REG_IX (z80_state.ix.word)
-#define REG_IY (z80_state.iy.word)
-
-#define REG_I (z80_state.i)
+#define reg_A (z80_state.af.byte.high)
+#define reg_F (z80_state.af.byte.low)
+#define reg_B (z80_state.bc.byte.high)
+#define reg_C (z80_state.bc.byte.low)
+#define reg_D (z80_state.de.byte.high)
+#define reg_E (z80_state.de.byte.low)
+#define reg_H (z80_state.hl.byte.high)
+#define reg_L (z80_state.hl.byte.low)
+#define reg_IX_HIGH (z80_state.ix.byte.high)
+#define reg_IX_LOW (z80_state.ix.byte.low)
+#define reg_IY_HIGH (z80_state.iy.byte.high)
+#define reg_IY_LOW (z80_state.iy.byte.low)
+
+#define reg_SP (z80_state.sp.word)
+#define reg_PC (z80_state.pc.word)
+
+#define reg_AF (z80_state.af.word)
+#define reg_BC (z80_state.bc.word)
+#define reg_DE (z80_state.de.word)
+#define reg_HL (z80_state.hl.word)
+
+#define reg_AF_PRIME (z80_state.af_prime.word)
+#define reg_BC_PRIME (z80_state.bc_prime.word)
+#define reg_DE_PRIME (z80_state.de_prime.word)
+#define reg_HL_PRIME (z80_state.hl_prime.word)
+
+#define reg_IX (z80_state.ix.word)
+#define reg_IY (z80_state.iy.word)
+
+#define reg_I (z80_state.i)
#define HIGH(p) (((struct twobyte *)(p))->high)
#define LOW(p) (((struct twobyte *)(p))->low)
@@ -199,28 +199,28 @@ struct z80_state_struct
#define ALL_FLAGS_MASK (CARRY_MASK | SUBTRACT_MASK | OVERFLOW_MASK | \
HALF_CARRY_MASK | ZERO_MASK | SIGN_MASK)
-#define SET_SIGN() (REG_F |= SIGN_MASK)
-#define CLEAR_SIGN() (REG_F &= (~SIGN_MASK))
-#define SET_ZERO() (REG_F |= ZERO_MASK)
-#define CLEAR_ZERO() (REG_F &= (~ZERO_MASK))
-#define SET_HALF_CARRY() (REG_F |= HALF_CARRY_MASK)
-#define CLEAR_HALF_CARRY() (REG_F &= (~HALF_CARRY_MASK))
-#define SET_OVERFLOW() (REG_F |= OVERFLOW_MASK)
-#define CLEAR_OVERFLOW() (REG_F &= (~OVERFLOW_MASK))
-#define SET_PARITY() (REG_F |= PARITY_MASK)
-#define CLEAR_PARITY() (REG_F &= (~PARITY_MASK))
-#define SET_SUBTRACT() (REG_F |= SUBTRACT_MASK)
-#define CLEAR_SUBTRACT() (REG_F &= (~SUBTRACT_MASK))
-#define SET_CARRY() (REG_F |= CARRY_MASK)
-#define CLEAR_CARRY() (REG_F &= (~CARRY_MASK))
-
-#define SIGN_FLAG (REG_F & SIGN_MASK)
-#define ZERO_FLAG (REG_F & ZERO_MASK)
-#define HALF_CARRY_FLAG (REG_F & HALF_CARRY_MASK)
-#define OVERFLOW_FLAG (REG_F & OVERFLOW_MASK)
-#define PARITY_FLAG (REG_F & PARITY_MASK)
-#define SUBTRACT_FLAG (REG_F & SUBTRACT_MASK)
-#define CARRY_FLAG (REG_F & CARRY_MASK)
+#define SET_SIGN() (reg_F |= SIGN_MASK)
+#define CLEAR_SIGN() (reg_F &= (~SIGN_MASK))
+#define SET_ZERO() (reg_F |= ZERO_MASK)
+#define CLEAR_ZERO() (reg_F &= (~ZERO_MASK))
+#define SET_HALF_CARRY() (reg_F |= HALF_CARRY_MASK)
+#define CLEAR_HALF_CARRY() (reg_F &= (~HALF_CARRY_MASK))
+#define SET_OVERFLOW() (reg_F |= OVERFLOW_MASK)
+#define CLEAR_OVERFLOW() (reg_F &= (~OVERFLOW_MASK))
+#define SET_PARITY() (reg_F |= PARITY_MASK)
+#define CLEAR_PARITY() (reg_F &= (~PARITY_MASK))
+#define SET_SUBTRACT() (reg_F |= SUBTRACT_MASK)
+#define CLEAR_SUBTRACT() (reg_F &= (~SUBTRACT_MASK))
+#define SET_CARRY() (reg_F |= CARRY_MASK)
+#define CLEAR_CARRY() (reg_F &= (~CARRY_MASK))
+
+#define SIGN_FLAG (reg_F & SIGN_MASK)
+#define ZERO_FLAG (reg_F & ZERO_MASK)
+#define HALF_CARRY_FLAG (reg_F & HALF_CARRY_MASK)
+#define OVERFLOW_FLAG (reg_F & OVERFLOW_MASK)
+#define PARITY_FLAG (reg_F & PARITY_MASK)
+#define SUBTRACT_FLAG (reg_F & SUBTRACT_MASK)
+#define CARRY_FLAG (reg_F & CARRY_MASK)
extern struct z80_state_struct z80_state;