Skip to content

Commit 2893c25

Browse files
author
Matthias Koeppe
committed
More work on the GTK+ frontend.
1 parent 0df013a commit 2893c25

File tree

8 files changed

+320
-295
lines changed

8 files changed

+320
-295
lines changed

BUGS

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
The current option handling should be replaced with a proper one,
22
using getopt.
33

4-
After finishing Windows-32 support, the source structure should be
5-
cleaned up. There are too many hacks at the moment.
6-
74
When using `mz80' instead of the native Z80 kernel, a lot of things
85
fail.
96

ChangeLog

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2002-01-22 Matthias Koeppe <[email protected]>
2+
3+
Version 0.8
4+
5+
* graphics.c, mz800gtk.c, mz800vga.c, pckey.c: More work on the
6+
GTK+ frontend.
7+
18
2002-01-21 Matthias Koeppe <[email protected]>
29

310
* Makefile, README, TODO, mz800gtk.c, mz800vga.c, pckey.c,

Makefile

+25-24
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
# Makefile for mz800em
22

3-
VERSION=0.7.2
3+
INSTALLPREFIX = /usr/local
44

5-
FAST=1
5+
#FAST=1
6+
#STRANGEMAGIC=1
7+
#USE_MZ80=1
8+
#USE_RAWKEY=1
69

710
#VIDEOFLAGS=-DHAVE_640X480X256
811

12+
## No user-serviceable parts below
13+
14+
VERSION=0.8.0
15+
916
ifdef FAST
1017

1118
# This will make the Z80 kernel faster, BUT you will lose speed
@@ -14,24 +21,13 @@ ifdef FAST
1421
# about register use, and the whole thing will hardly compile on
1522
# low-memory systems.
1623

17-
ifdef PGCC
18-
CC=pgcc
19-
CFLAGS:=$(CFLAGS) -O9 -mpentium -march=pentium \
20-
-B /usr/lib/gcc-lib/i586-pc-linux-gnu/pgcc-2.91.60/ \
21-
-bi586-pc-linux-gnu \
22-
-fno-exceptions
23-
else
24-
#CFLAGS:=$(CFLAGS) -O9 -mpentium -Wall
25-
CFLAGS:=$(CFLAGS) -Wall
26-
endif
27-
28-
PRINTFLAGS=-DPRINT_INVOKES_ENSCRIPT
29-
# -DMZISHPRINTER
24+
CFLAGS:=$(CFLAGS) -O2 -Wall
3025

3126
Z80FLAGS=-DCOPY_BANKSWITCH -DHEAVY_LOAD -DSLOPPY_2 -DUSE_REGS \
3227
-DNO_COUNT_TSTATES -DRISKY_REGS -DWIN95PROOF \
33-
-DDELAYED_UPDATE -DTWO_Z80_COPIES $(PRINTFLAGS)
28+
-DDELAYED_UPDATE -DTWO_Z80_COPIES
3429

30+
SUFFIX=-fast
3531

3632
else
3733

@@ -64,8 +60,12 @@ ifdef DEBUG
6460
CFLAGS:=$(CFLAGS) -g
6561
endif
6662

67-
CFLAGS:=$(CFLAGS) -I. $(INCLUDE) $(RAWKEYFLAGS) $(Z80FLAGS) $(VIDEOFLAGS)
63+
ifdef STRANGEMAGIC
64+
PRINTFLAGS=-DPRINT_INVOKES_ENSCRIPT
65+
# -DMZISHPRINTER
66+
endif
6867

68+
CFLAGS:=$(CFLAGS) -I. $(INCLUDE) $(RAWKEYFLAGS) $(Z80FLAGS) $(VIDEOFLAGS) $(PRINTFLAGS)
6969

7070
#### Targets ####
7171

@@ -95,7 +95,7 @@ MZ800GTK_OBJS=$(MZ800EM_OBJS) mz800gtk.o
9595

9696
.PHONY: all install clean tgz
9797

98-
all: mz800em mzget mzextract
98+
all: mz800em$(SUFFIX) mzget mzextract gmz800em$(SUFFIX)
9999

100100
z80.o: z80.c z80.h cbops.c edops.c z80ops.c
101101
$(CC) -c $(CFLAGS) z80.c -o $@
@@ -114,10 +114,10 @@ GTKCFLAGS=`gtk-config --cflags`
114114
mz800gtk.o: mz800gtk.c
115115
$(CC) -c $(CFLAGS) $(GTKCFLAGS) $< -o $@
116116

117-
mz800em: $(MZ800VGA_OBJS)
117+
mz800em$(SUFFIX): $(MZ800VGA_OBJS)
118118
$(CC) $(CFLAGS) -o $@ $(MZ800VGA_OBJS) -lvga $(RAWKEYLIB) -lm
119119

120-
gmz800em: $(MZ800GTK_OBJS)
120+
gmz800em$(SUFFIX): $(MZ800GTK_OBJS)
121121
$(CC) $(CFLAGS) -o $@ $(MZ800GTK_OBJS) `gtk-config --libs`
122122

123123
mz800em.exe: $(MZ800WIN_OBJS)
@@ -129,21 +129,21 @@ mzget: mzget.o
129129
mzextract: mzextract.o
130130
$(CC) $(CFLAGS) -o mzextract mzextract.o
131131

132-
INSTALLPREFIX = /usr/local
133132
# You also have to edit `main.c' if you want a different target directory.
134133
install:
135-
install -o root -m 4555 -s mz800em $(INSTALLPREFIX)/bin
134+
install -o root -m 4555 -s mz800em$(SUFFIX) $(INSTALLPREFIX)/bin
135+
install -m 555 gmz800em$(SUFFIX) -s $(INSTALLPREFIX)/bin
136136
install -m 555 -s mzget mzextract $(INSTALLPREFIX)/bin
137137
install -m 555 mzjoinimage $(INSTALLPREFIX)/bin
138138
install -m 444 mz700.rom mz700fon.dat mz800.rom $(INSTALLPREFIX)/lib
139139

140140
#install -m 555 mzprint $(INSTALLPREFIX)/bin
141141

142142
change:
143-
$(RM) -f main.o mz800em mz800em.exe
143+
$(RM) -f main.o mz800em mz800em-fast gmz800em gmz800em-fast mz800em.exe
144144

145145
clean:
146-
$(RM) -f *.o *~ *.bak *.s *.i mz800em mz800em.exe mzextract mzget
146+
$(RM) -f *.o *~ *.bak *.s *.i mz800em mz800em-fast gmz800em-fast gzm800em mz800em.exe mzextract mzget
147147

148148
#### Distribution section ####
149149

@@ -159,6 +159,7 @@ FILES = COPYING ChangeLog Makefile README README-700 TODO BUGS \
159159
cbops.c edops.c font.txt \
160160
librawkey.a main.c mz700em.h mzextract.c mzget.c mzjoinimage \
161161
rawkey.h unpix.c z80.c z80.h z80ops.c disk.c graphics.h \
162+
pckey.c mz800gtk.c mz800vga.c \
162163
graphics.c mzterm.c mzmagic mzcat mzprint mzprintw \
163164
$(CYGFILES) $(MZ80FILES) \
164165
mz800em.btx

README

+26-15
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ Description
3636
-----------
3737

3838
`mz800em' is a Sharp MZ800 emulator. Its primary target are GNU/Linux
39-
systems; it uses svgalib there. It has also been ported to Windows-32
40-
systems, using Cygnus Solution's cygwin32 library.
39+
systems; originally it used svgalib there, but now it also supports X
40+
via the GTK+ toolkit. The GTK+ version might run on other UNIX
41+
flavors as well (but probably some signal stuff needs to be changed).
42+
43+
`mz800em' has also been ported to Windows-32 systems, using Cygnus
44+
Solution's cygwin32 library.
4145

4246
You can run MZ80K, MZ700 and MZ800 programs. It supports most m/c
4347
programs and games. There are also methods for loading BASIC programs
@@ -130,12 +134,7 @@ are some ideas taken from README-700:
130134
History etc.
131135
------------
132136

133-
Mz800em is based on Mz700em by Russell Marks. Some of the changes at
134-
the Z80 kernel for version 0.5 (COPY_BANKSWITCH and fetch/read
135-
distinction), which led to a faster kernel, were inspired by a deep
136-
view into SHARP.EXE, a very efficient MZ-800 emulator for DOS machines
137-
by Jaroslav Kysela <[email protected]>, which is unfortunately no
138-
longer supported by the author. See ChangeLog for details.
137+
Mz800em is based on Mz700em by Russell Marks.
139138

140139
Russell writes:
141140

@@ -147,6 +146,13 @@ Russell writes:
147146
had anything else to do with it and probably hasn't even heard of
148147
the MZ700.
149148

149+
Some of the changes at the Z80 kernel for version 0.5 (COPY_BANKSWITCH
150+
and fetch/read distinction), which led to a faster kernel, were
151+
inspired by a deep view into SHARP.EXE, a very efficient MZ-800
152+
emulator for DOS machines by Jaroslav Kysela <[email protected]>,
153+
which is unfortunately no longer supported by the author. See
154+
ChangeLog for details.
155+
150156
Mz800em now optionally works with MZ80, the `Multi-Z80 emulator' by
151157
Neil Bradley (ftp://ftp.synthcom.com/pub/emulators/cpu/makez80.zip),
152158
instead of mz800em's traditional Z80 kernel. MZ80 is coded in mixed
@@ -158,18 +164,23 @@ complex memory-access code for the memory-mapped modes. On
158164
bankswitching instructions, we switch between the two copies if
159165
necessary.
160166

167+
Version 0.8 added a GTK+ frontend (gmz800em). I took the code from
168+
Russell's nc100em-1.2 and modified it to work with mz800em.
169+
161170

162171
Using mz800em
163172
-------------
164173

165174
There's no man page due to this being a really quick hack, so this'll
166175
have to do. Sorry. :-)
167176

168-
In GNU/Linux, mz800em uses SVGALIB, that is, you must run it on the
169-
console. In Windows-32, mz800em runs in a window.
177+
In GNU/Linux, there are two binaries: `mz800em' uses SVGALIB, that is,
178+
it runs on the console, provided that SVGALIB supports your graphics
179+
card. `gmz800em' runs in a window on X. In Windows-32, mz800em runs
180+
in a window.
170181

171-
You can quit with F10. In GNU/Linux, virtual console switching works
172-
as usual with Alt-Fn.
182+
You can quit with F10. In the SVGALIB front-end, virtual console
183+
switching works as usual with Alt-Fn.
173184

174185
The emulated MZ800 attempts to run at 3.546MHz; the speed is
175186
timer-controlled. You can switch the speed control off by typing
@@ -344,9 +355,9 @@ the following features will be enabled:
344355

345356
- Proper keyboard support. The MZ-ish way of reading the keyboard
346357
is replaced by a new method. This will give you better keyboard
347-
response and a normal keyboard layout (assuming German layout I'm
348-
afraid, but you can change this with a little work in
349-
`mzterm.c'; if you did, please send me a patch).
358+
response and a normal keyboard layout (with German layout for the
359+
svgalib and Windows front-ends, but you can change this with a
360+
little work in `pckey.c'; if you did, please send me a patch).
350361

351362
- Printer support. The printer output is appended to a file
352363
`~printer~' in the current working directory. The current LPT mode

TODO

+3-7
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,13 @@ removed conditionally if we decide to include "z80ops.c" two (or
1717
three) times; one copy with ixoriy #define'd 0, and one copy which
1818
becomes active when an dd/fd prefix occurs.
1919

20-
Support the X Window system, maybe using some code from Russell Marks'
21-
Z81 (metalab.unc.edu/pub/Linux/system/emulators/zx/z81-1.2.tar.gz) or
22-
nc100em.
23-
24-
Make a version running in DOS (using DJGPP and the svgalib port to
25-
DJGPP).
26-
2720
Cygwin: Add proper timing. Fix palette problem. Let the process pause
2821
if window is not active, or if it is waiting for mzterm-ish keyboard
2922
input.
3023

24+
GTK+: Improve the GTK+ display code. Add support for the border color
25+
(BCOL).
26+
3127
Add support for the SHARP MZ-900 series, a Z80 machine running at
3228
12MHz, compatible with the MZ-800 series, but featuring 2 pages of
3329
640x200 graphics at 16 colors (4 planes), mapped at addresses

graphics.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ void graphics_write(int addr, int value)
7878
int x, y;
7979
unsigned char *pptr, *buffer;
8080

81-
pptr = buffer = writeptr + ((addr - 0x8000) & 0x1fff) * 8;
81+
pptr = buffer = writeptr + ((addr - 0x8000)
82+
& (mzbpl==40 ? 0x1fff : 0x3fff)) * 8;
8283

8384
switch (WF >> 5) {
8485
case 0: /* Single write -- write to addressed planes */
@@ -114,15 +115,17 @@ void graphics_write(int addr, int value)
114115
if (!directvideo && !writeplaneb) {
115116
x = ((addr - 0x8000) % mzbpl) * 8;
116117
y = (addr - 0x8000) / mzbpl;
117-
req_graphics_update(buffer, x, y, 8);
118+
if (y < 200)
119+
req_graphics_update(buffer, x, y, 8);
118120
}
119121

120122
}
121123

122124
int graphics_read(int addr)
123125
{
124126
int i;
125-
unsigned char *pptr = readptr + ((addr - 0x8000) & 0x1fff) * 8;
127+
unsigned char *pptr = readptr + ((addr - 0x8000)
128+
& (mzbpl==40 ? 0x1fff : 0x3fff)) * 8;
126129
int result = 0;
127130

128131
switch (RF >> 7) {

0 commit comments

Comments
 (0)