Compare commits

...

3 commits

Author SHA1 Message Date
Gwenhael Le Moine
d556cca321
remove useage of .msf and .cat files by inlining messages 2024-09-26 13:51:03 +02:00
Gwenhael Le Moine
be691df487
[pack] define messages in C instead of loading external .cat file 2024-09-26 11:06:43 +02:00
Gwenhael Le Moine
ffb19ef50c
ui4x_main is main 2024-09-26 10:55:14 +02:00
19 changed files with 508 additions and 855 deletions

View file

@ -48,26 +48,15 @@ DOTOS = src/cpu.o \
src/romram.o \
src/romram49.o \
src/serial.o \
src/x_func.o
src/x_func.o \
src/chf_messages.o
DOTOS_UI4x = src/ui4x_config.o \
src/ui4x_common.o \
src/ui4x_sdl2.o \
src/ui4x_ncurses.o \
src/ui4x_emulator.o \
src/ui4x_main.o
MSFS = src/MSFs/cpu.msf \
src/MSFs/debug.msf \
src/MSFs/disk_io.msf \
src/MSFs/flash49.msf \
src/MSFs/modules.msf \
src/MSFs/saturn.msf \
src/MSFs/serial.msf \
src/MSFs/util.msf \
src/MSFs/x11.msf \
src/MSFs/x_func.msf \
libChf/src/chf.msf
src/main.o
MAKEFLAGS +=-j$(NUM_CORES) -l$(NUM_CORES)
@ -114,7 +103,7 @@ override CPPFLAGS := -I./src/ -D_GNU_SOURCE=1 \
.PHONY: all clean clean-all pretty-code install mrproper get-roms install
all: libChf/libChf.a dist/saturn dist/saturn.cat docs
all: libChf/libChf.a dist/saturn docs
# Building
libChf/libChf.a:
@ -127,11 +116,6 @@ dist/pack: src/pack.o src/disk_io.o src/debug.o libChf/libChf.a
# UNUSED
$(CC) $^ -o $@ $(CFLAGS) $(LIBS)
dist/saturn.cat: $(MSFS)
for msf in $? ; \
do gencat $@ $$msf ; \
done
doc:
make -C docs
make -C libChf doc
@ -143,7 +127,7 @@ clean:
make -C docs clean
mrproper: clean
rm -f dist/saturn dist/saturn.cat dist/pack
rm -f dist/saturn dist/pack
make -C dist/ROMs mrproper
make -C libChf mrproper
make -C docs mrproper
@ -160,7 +144,7 @@ get-roms:
make -C dist/ROMs get-roms
# Installation
install: dist/saturn dist/saturn.cat dist/Saturn.ad doc
install: dist/saturn doc
install -m 755 -d -- $(DESTDIR)$(PREFIX)/bin
install -c -m 755 dist/saturn $(DESTDIR)$(PREFIX)/bin/saturn
install -c -m 755 dist/saturn48gx $(DESTDIR)$(PREFIX)/bin/saturn48gx
@ -168,18 +152,10 @@ install: dist/saturn dist/saturn.cat dist/Saturn.ad doc
install -c -m 755 dist/saturn40g $(DESTDIR)$(PREFIX)/bin/saturn40g
install -c -m 755 dist/saturn49g $(DESTDIR)$(PREFIX)/bin/saturn49g
install -c -m 644 dist/saturn.cat $(DESTDIR)$(PREFIX)/bin/saturn.cat #FIXME
install -m 755 -d -- $(DESTDIR)$(PREFIX)/share/locale/C/LC_MESSAGES
install -c -m 644 dist/saturn.cat $(DESTDIR)$(PREFIX)/share/locale/C/LC_MESSAGES/saturn.cat
install -m 755 -d -- $(DESTDIR)$(PREFIX)/share/saturn
install -c -m 644 dist/saturn.cat $(DESTDIR)$(PREFIX)/share/saturn.cat #FIXME
install -c -m 644 dist/hplogo.png $(DESTDIR)$(PREFIX)/share/saturn/hplogo.png
cp -R dist/ROMs/ $(DESTDIR)$(PREFIX)/share/saturn/
install -m 755 -d -- $(DESTDIR)/etc/X11/app-defaults
install -c -m 644 dist/Saturn.ad $(DESTDIR)/etc/X11/app-defaults/Saturn
install -m 755 -d -- $(DESTDIR)$(DOCDIR)
cp -R COPYING LICENSE README* docs-4.1.1.1 docs/*.{info,dvi,ps,pdf} libChf/docs/*.{info,dvi,ps,pdf} $(DESTDIR)$(DOCDIR)
@ -195,10 +171,7 @@ uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/saturn48sx
rm -f $(DESTDIR)$(PREFIX)/bin/saturn40g
rm -f $(DESTDIR)$(PREFIX)/bin/saturn49g
rm -f $(DESTDIR)$(PREFIX)/bin/saturn.cat
rm -f $(DESTDIR)$(PREFIX)/share/locale/C/LC_MESSAGES/saturn.cat
rm -fr $(DESTDIR)$(PREFIX)/share/saturn
rm -f $(DESTDIR)/etc/X11/app-defaults/Saturn
rm -fr $(DESTDIR)$(DOCDIR)
rm -f $(DESTDIR)$(PREFIX)/share/applications/saturn48gx.desktop
rm -f $(DESTDIR)$(PREFIX)/share/applications/saturn48sx.desktop

View file

@ -1,3 +1,6 @@
#ifndef _CHF_H
#define _CHF_H 1
/* .+
.identifier : $Id: Chf.h,v 2.2 2001/01/25 11:56:44 cibrario Exp $
@ -51,6 +54,8 @@
.- */
#include <stdlib.h>
/* -------------------------------------------------------------------------
Win32 & UNICODE support
------------------------------------------------------------------------- */
@ -269,3 +274,5 @@ void ChfGenerate( const int module_id, const ChfChar* file_name, const int line_
const ChfChar* ChfGetMessage( const int module_id, const int condition_code, const ChfChar* default_message );
/* Retrieve top condition */
const ChfDescriptor* ChfGetTopCondition( void );
#endif /*!_CHF_H*/

View file

@ -1,3 +1,6 @@
#ifndef _CHF_PRIV_H
#define _CHF_PRIV_H 1
/* .+
.identifier : $Id: ChfPriv.h,v 2.2 2001/01/25 11:57:57 cibrario Exp $
@ -37,6 +40,8 @@
.- */
#include "Chf.h"
/* -------------------------------------------------------------------------
Macros
------------------------------------------------------------------------- */
@ -132,3 +137,5 @@ ChfContext* _ChfGetContext( void );
#define ChfStrncpy strncpy
#define ChfSprintf sprintf
#define ChfVsprintf vsprintf
#endif /*!_CHF_PRIV_H*/

View file

@ -1,15 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by chf.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
# ifndef APSTUDIO_READONLY_SYMBOLS
# define _APS_NEXT_RESOURCE_VALUE 101
# define _APS_NEXT_COMMAND_VALUE 40001
# define _APS_NEXT_CONTROL_VALUE 1000
# define _APS_NEXT_SYMED_VALUE 101
# endif
#endif

View file

@ -1,64 +0,0 @@
$ .+
$ .identifier : $Id: cpu.msf,v 4.1 2000/12/11 09:54:19 cibrario Rel $
$ .context : SATURN, Saturn CPU / HP48 emulator
$ .title : $RCSfile: cpu.msf,v $
$ .kind : Message catalog source
$ .author : Ivan Cibrario B.
$ .site : CSTV-CNR
$ .creation : 13-Feb-1998
$ .keywords : *
$ .description :
$ Message catalog source file for the CPU emulation modules.
$ .notes :
$ . $Log: cpu.msf,v $
$ . Revision 4.1 2000/12/11 09:54:19 cibrario
$ . Public release.
$ .
$ . Revision 3.13 2000/11/09 11:27:48 cibrario
$ . Revised to add file selection box GUI element, CPU halt/run
$ . requests and emulator's extended functions:
$ .
$ . - New messages: 118, 119, 303
$ .
$ . Revision 3.8 2000/10/19 14:56:52 cibrario
$ . Bug fix:
$ . Removed lines with empty directives
$ .
$ Revision 3.1 2000/09/20 13:44:30 cibrario
$ Revised to implement passive CPU shutdown:
$ - new messages 114, 115, 116, 117
$ .
$ Revision 1.1 1998/02/18 11:50:36 cibrario
$ Initial revision
$ .-
$set 1
11 Cpu
$set 11
101 Function [%s] called
102 Executing @ PC[%05X]
103 CPU shutdown executed
104 CPU wake-up executed
105 %s request accepted
106 %s request pending
107 RTI loop to service %s
108 RTI returning
109 INTON servicing %s
110 CPU emulator [%s]
111 Timer1 expired CTRL[%01X]
112 Timer2 expired CTRL[%01X]
113 Emulator interrupt request detected
114 Timer[%s] Ctrl[%01X] Val[%08X]
115 Timer[%s] expires in [%d]d ms
116 Starting idle loop, timeout [%d]d ms
117 Spooling up after [%d]d us in idle loop
118 CPU halted by CpuHaltRequest()
119 CPU awoken by CpuRunRequest()
201 Can't restore CPU status from disk; resetting CPU
202 Monitor command syntax error [%s]
301 Bad opcode @ PC[%05X], N[%01X]
302 Can't save CPU status to disk
303 Halt/Run requests not allowed; #undef CPU_SPIN_SHUTDN
401 Internal error [%s]
402 Unexpected CPU shutdown

View file

@ -1,29 +0,0 @@
$ .+
$ .identifier : $Id: debug.msf,v 4.1 2000/12/11 09:54:19 cibrario Rel $
$ .context : SATURN, Saturn CPU / HP48 emulator
$ .title : $RCSfile: debug.msf,v $
$ .kind : Message catalog source
$ .author : Ivan Cibrario B.
$ .site : CSTV-CNR
$ .creation : 13-Feb-1998
$ .keywords : *
$ .description :
$ Message catalog source file for the debugging support modules.
$ .notes :
$ . $Log: debug.msf,v $
$ . Revision 4.1 2000/12/11 09:54:19 cibrario
$ . Public release.
$ .
$ . Revision 3.8 2000/10/19 14:55:10 cibrario
$ . Bug fix:
$ . Removed lines with empty directives
$ .
$ Revision 1.1 1998/02/18 11:54:02 cibrario
$ Initial revision
$ .-
$set 1
30 Debug
$set 30
201 Debug not supported; Rebuild with -DDEBUG

View file

@ -1,44 +0,0 @@
$ .+
$ .identifier : $Id: disk_io.msf,v 4.1 2000/12/11 09:54:19 cibrario Rel $
$ .context : SATURN, Saturn CPU / HP48 emulator
$ .title : $RCSfile: disk_io.msf,v $
$ .kind : Message catalog source
$ .author : Ivan Cibrario B.
$ .site : CSTV-CNR
$ .creation : 13-Feb-1998
$ .keywords : *
$ .description :
$ Message catalog source file for the disk I/O functions.
$ .notes :
$ . $Log: disk_io.msf,v $
$ . Revision 4.1 2000/12/11 09:54:19 cibrario
$ . Public release.
$ .
$ . Revision 3.14 2000/11/13 10:32:24 cibrario
$ . Implemented fast load/save; improved keyboard interface emulation at
$ . high emulated CPU speed:
$ .
$ . - Fixed spelling error in message 405
$ . - Added new messages: 407, 408
$ .
$ . Revision 3.8 2000/10/19 14:58:41 cibrario
$ . Bug fix:
$ . Removed lines with empty directives
$ .
$ Revision 1.1 1998/02/17 11:54:49 cibrario
$ Initial revision
$ .-
$set 1
13 Disk_IO
$set 13
101 Function [%s] called
401 Can't open file [%s]
402 getc() failed reading file [%s]
403 putc() failed writing file [%s]
404 fread() failed reading file [%s]
405 fwrite() failed writing file [%s]
406 Close file [%s] failed
407 File [%s] has a bad header
408 File [%s] is too large

View file

@ -1,38 +0,0 @@
$ .+
$ .identifier : $Id: flash49.msf,v 4.1 2000/12/11 09:54:19 cibrario Rel $
$ .context : SATURN, Saturn CPU / HPxx emulator
$ .title : $RCSfile: flash49.msf,v $
$ .kind : Message catalog source
$ .author : Ivan Cibrario B.
$ .site : CSTV-CNR
$ .creation : 25-Sep-2000
$ .keywords : *
$ .description :
$ Message catalog source file for the flash rom emulator.
$ .notes :
$ . $Log: flash49.msf,v $
$ . Revision 4.1 2000/12/11 09:54:19 cibrario
$ . Public release.
$ .
$ . Revision 3.8 2000/10/19 15:00:41 cibrario
$ . Bug fix:
$ . Removed lines with empty directives
$ .
$ Revision 3.3 2000/09/26 15:30:28 cibrario
$ *** empty log message ***
$ .-
$set 1
16 Flash
$set 16
101 Read (Nibble) A[%08X] D[%01X]
102 Write (Nibble) A[%08X] D[%01X]
103 FSM STATE[%d] CYCLE[%d]
104 \tFSM Args: (Byte)A[%08X] D[%02X]
105 \tFSM Next: STATE[%d] RESULT[%02X]
106 \tFSM Operation: [%s]
201 Command unknown/not implemented - FSM Info:\n\
\tSTATE[%d] CYCLE[%d] A[%08X] D[%02X]
202 Invalid address in Write to Buffer - FSM Info:\n\
\tSTATE[%d] CYCLE[%d] A[%08X] D[%02X]

View file

@ -1,103 +0,0 @@
$ .+
$ .identifier : $Id: modules.msf,v 4.1 2000/12/11 09:54:19 cibrario Rel $
$ .context : SATURN, Saturn CPU / HP48 emulator
$ .title : $RCSfile: modules.msf,v $
$ .kind : Message catalog source
$ .author : Ivan Cibrario B.
$ .site : CSTV-CNR
$ .creation : 13-Feb-1998
$ .keywords : *
$ .description :
$ Message catalog source file for the peripheral modules emulator.
$ .notes :
$ . $Log: modules.msf,v $
$ . Revision 4.1 2000/12/11 09:54:19 cibrario
$ . Public release.
$ .
$ . Revision 3.8 2000/10/19 14:58:01 cibrario
$ . Bug fix:
$ . Removed lines with empty directives
$ .
$ Revision 3.3 2000/09/26 15:05:33 cibrario
$ Revised to implement Flash ROM write access:
$ - Added message 312
$ .
$ Revision 3.2 2000/09/22 14:07:04 cibrario
$ Implemented preliminary support of HP49 hw architecture:
$ - added new messages: 311, 407, 408
$ .
$ Revision 2.7 2000/09/19 11:13:12 cibrario
$ Deeply revised to implement config/unconfig cache.
$ .
$ Revision 2.4 2000/09/12 15:48:57 cibrario
$ Added messages 112, 113, 114, 211, 212, 306, 307, 308, 309, 310
$ .
$ Revision 2.1 2000/09/08 15:22:17 cibrario
$ Updated message 209; added message 210. Both updates reflect the
$ changes made to the keyboard emulation module in order to
$ accommodate the new GUI.
$ .
$ Revision 1.1 1998/02/17 14:53:53 cibrario
$ Initial revision
$ .-
$set 1
12 Modules
$set 12
101 Function [%s] called
102 Initializing module [%s]
103 Resetting module [%s]
106 ModGetID -> [%05X]
107 CONFIG M[%s] A[%05X] S[%05X]
108 UNCNFG M[%s] A[%05X] S[%05X]
109 Saving module [%s]
110 Function [%s] not implemented
111 Modules emulator: [%s]
112 Bank Switcher F/F set to A[%05X]
113 Port 1 has been write-protected
114 Port 2 has been write-protected
115 >>> PerfCtr [%s]=[%d]
116 Cached UNCNFG completed
117 Cached CONFIG A[%05X] completed
118 Late UNCNFG cache hit
119 Late UNCNFG cache miss
202 Bad ModConfig [%05X] ignored
203 Bad ModUnconfig [%05X] ignored
204 Bad HdwWrite A[%05X] N[%01X]
205 Bad HdwRead A[%05X]
206 Resetting all modules
207 Can't initialize internal RAM from disk
208 Can't initialize HDW from disk
209 Bad key [%s] ignored
210 Bad out_bit [%x] ignored
211 Can't initialize Port 1 from disk
212 Can't initialize Port 2 from disk
213 Unable to find CONFIG cache victim; flushing cache
301 Read from unmapped A[%05X]
302 Write to unmapped A[%05X] N[%01X]
303 Write into ROM A[%05X] D[%01X]
304 Can't save internal RAM status to disk
305 Can't save HDW status to disk
306 Can't save Port 1 status to disk
307 Write into CE1 A[%05X] D[%01X]
308 Can't save Port 1 status to disk
309 Read from NCE3 A[%05X] when Port 2 is not present
310 Write into NCE3 A[%05X] D[%01X] when Port 2 is not present
311 Hardware configuration [%s] not supported
312 Can't save Flash ROM status to disk
401 Can't save module mapping info
402 Can't initialize internal ROM
403 Dynamic allocation of ModMap failed
404 Bad alloc_c [%d] after FlushCache()
405 Cached struct ModMap chain corrupted; freeing unlinked entry
406 Unable to find CONFIG cache victim after cache flush
407 Allocation of ModStatus_xx failed ([%d]d bytes needed)
408 ModInit() invoked without registering a ModDescription first
501 A[%05X] -> *Not Mapped*
502 A[%05X] -> M[%s] R[%05X]
503 Device\t\t\tAddress\tSize\tStatus
504 %s\t%05X\t%05X\t%s
505 Configured
506 Size_configured
507 *Unconfigured*

View file

@ -1,33 +0,0 @@
$ .+
$ .identifier : $Id: saturn.msf,v 4.1 2000/12/11 09:54:19 cibrario Rel $
$ .context : SATURN, Saturn CPU / HP48 emulator
$ .title : $RCSfile: saturn.msf,v $
$ .kind : Message catalog source
$ .author : Ivan Cibrario B.
$ .site : CSTV-CNR
$ .creation : 8-Sep-2000
$ .keywords : *
$ .description :
$ Message catalog source file for the main program.
$ .notes :
$ . $Log: saturn.msf,v $
$ . Revision 4.1 2000/12/11 09:54:19 cibrario
$ . Public release.
$ .
$ . Revision 3.9 2000/10/24 16:11:48 cibrario
$ . Added messages 10/501 and 10/502 as suggested by GPL
$ .
$ . Revision 3.8 2000/10/19 15:01:20 cibrario
$ . Bug fix:
$ . Removed lines with empty directives
$ .
$ Revision 2.1 2000/09/08 15:35:43 cibrario
$ *** empty log message ***
$ .-
$set 1
10 Main
$set 10
501 saturn %s - A poor-man's emulator of HP48GX, HP49, HP39/40\nCopyright (C) 1998-2000 Ivan Cibrario Bertolotti\n
502 This program is free software, and comes with ABSOLUTELY NO WARRANTY;\nfor details see the accompanying documentation.\n\n

View file

@ -1,62 +0,0 @@
$ .+
$ .identifier : $Id: serial.msf,v 4.1 2000/12/11 09:54:19 cibrario Rel $
$ .context : SATURN, Saturn CPU / HP48 emulator
$ .title : $RCSfile: serial.msf,v $
$ .kind : Message catalog source
$ .author : Ivan Cibrario B.
$ .site : CSTV-CNR
$ .creation : 13-Sep-2000
$ .keywords : *
$ .description :
$ Message catalog source file for the serial port emulator.
$ .notes :
$ . $Log: serial.msf,v $
$ . Revision 4.1 2000/12/11 09:54:19 cibrario
$ . Public release.
$ .
$ . Revision 3.16 2000/11/21 16:42:18 cibrario
$ . Ultrix/IRIX support:
$ . - New message: 203
$ .
$ . Revision 3.8 2000/10/19 15:00:10 cibrario
$ . Bug fix:
$ . Removed lines with empty directives
$ .
$ Revision 3.2 2000/09/22 14:38:08 cibrario
$ Implemented preliminary support of HP49 hw architecture:
$ - New messages: 408, 409
$ .
$ Revision 2.6 2000/09/15 09:26:18 cibrario
$ Added new messages: 403, 404, 405, 406, 407,
$ needed by the implementation of USE_STREAMSPTY
$ .
$ Revision 2.5 2000/09/14 15:44:49 cibrario
$ *** empty log message ***
$ .-
$set 1
15 Serial
$set 15
101 Function [%s] called
102 Serial port emulator: [%s]
103 Read [%s]; value [%01X]
104 Write [%s]; value [%01X](old) -> [%01X](new)
105 Read RBR; value [%02X]
106 Write TBR; value [%02X]
107 Pseudo-terminal name is [%s]
201 Read from empty receiver buffer, rcs [%01X]
202 Write into full transmitter buffer, tcs [%01X]
203 Pseudo-terminals not supported
301 Error draining transmitter buffer
302 Error charging receiver buffer
303 Error shutting down pseudo-terminal
401 openpty() failed on master pty
402 fcntl() failed on master pty
403 Can't open() pty master [%s]
404 grantpt() failed on master pty
405 unlockpt() failed on master pty
406 Can't open() pty slave [%s]
407 ioctl(I_PUSH,[%s]) failed on slave pty
408 tcgetattr() failed on master pty
409 tcsetattr() failed on master pty

View file

@ -1,38 +0,0 @@
$ .+
$ .identifier : $Id: util.msf,v 4.1 2000/12/11 09:54:19 cibrario Rel $
$ .context : SATURN, Saturn CPU / HPxx emulator
$ .title : $RCSfile: util.msf,v $
$ .kind : Message catalog source
$ .author : Ivan Cibrario B.
$ .site : CSTV-CNR
$ .creation : 2-Oct-2000
$ .keywords : *
$ .description :
$ Message catalog source file for the utility programs.
$ .notes :
$ . $Log: util.msf,v $
$ . Revision 4.1 2000/12/11 09:54:19 cibrario
$ . Public release.
$ .
$ . Revision 3.8 2000/10/19 15:01:43 cibrario
$ . Bug fix:
$ . Removed lines with empty directives
$ .
$ Revision 3.6 2000/10/02 13:59:02 cibrario
$ *** empty log message ***
$ .-
$set 1
17 Utilities
$set 17
1 Usage:\n\
pack <emu48_source_rom> <saturn_dest_rom>
2 Command line syntax error
3 stat(%s) failed
4 Invalid source file size: %d
5 malloc(%d) failed
6 open(%s) failed
7 read(%s) failed
8 WriteNibblesToFile() failed

View file

@ -1,77 +0,0 @@
$ .+
$ .identifier : $Id: x11.msf,v 4.1 2000/12/11 09:54:19 cibrario Rel $
$ .context : SATURN, Saturn CPU / HP48 emulator
$ .title : $RCSfile: x11.msf,v $
$ .kind : Message catalog source
$ .author : Ivan Cibrario B.
$ .site : CSTV-CNR
$ .creation : 13-Feb-1998
$ .keywords : *
$ .description :
$ Message catalog source file for the X11 interface modules and main program.
$ .notes :
$ . $Log: x11.msf,v $
$ . Revision 4.1 2000/12/11 09:54:19 cibrario
$ . Public release.
$ .
$ . Revision 3.17 2000/11/23 17:03:52 cibrario
$ . Implemented sutil library and assorted bug fixes:
$ . - Added ending newline
$ .
$ . Revision 3.16 2000/11/21 16:43:40 cibrario
$ . Ultrix/IRIX support:
$ . - Removed single quote from message 402
$ .
$ . Revision 3.15 2000/11/15 14:16:14 cibrario
$ . GUI enhancements and assorted bug fixes:
$ . - Revised message 108 to list the new command-line option -batchXfer
$ . - Added new messages 204 and 402
$ .
$ . Revision 3.13 2000/11/09 11:39:18 cibrario
$ . Revised to add file selection box GUI element, CPU halt/run
$ . requests and emulator's extended functions:
$ .
$ . - New messages: 113, 114, 203, 303
$ .
$ . Revision 3.9 2000/10/24 16:12:25 cibrario
$ . Revised messages 108 (updated command-line options) and 301
$ .
$ . Revision 3.8 2000/10/19 14:59:23 cibrario
$ . Bug fix:
$ . Removed lines with empty directives
$ .
$ Revision 2.1 2000/09/08 15:31:18 cibrario
$ - Updated messages 104, 105, 108
$ - Removed message 106
$ - New messages 109, 110, 111, 112, 201, 202, 302
$ .
$ Revision 1.1 1998/02/19 12:01:14 cibrario
$ Initial revision
$ .-
$set 1
14 X11
$set 14
101 Function [%s] called
102 LCD Parameter [%s]: [%05X]
103 X Expose event LCD window, count=%d
104 Pressed key [%s]
105 Released key [%s]
107 X11 Interface [%s]
108 Usage:\n\t%s [-reset] [-monitor] [-batchXfer] [-stateDir <>]\n\t\t[-face <>] [-hw <>]\n\t\t[-cpu <>] [-mod <>] [-hdw <>]\n\t\t[-rom <>] [-ram <>] [-port1 <>] [-port2 <>]
109 Selected GUI face [%s]
110 Active GUI face has [%d] keys
111 Created key [%d], inOut [%s]
112 Found compoundString for widget [%s], value [%s]
113 Traversing widget [%s]
114 Current widget has [%d] children
201 Xt action called with wrong argc: [%d]
202 X Atom [%s] unknown
203 FSB continuation procedure not set
204 Too many messages not yet acknowledged (> [%d]).\n\tGUI logging temporarily suspended
301 Invalid option [%s] ignored
302 WM_COMMAND property bad or not set
303 No text segment found in a FSB XmString
401 X Window System fatal error
402 Face [%s] has no keys; the application resource\n\tfile probably is missing, corrupt, or unreachable

View file

@ -1,46 +0,0 @@
$ .+
$ .identifier : $Id: x_func.msf,v 4.1 2000/12/11 09:54:19 cibrario Rel $
$ .context : SATURN, Saturn CPU / HPxx emulator
$ .title : $RCSfile: x_func.msf,v $
$ .kind : Message catalog source
$ .author : Ivan Cibrario B.
$ .site : CSTV-CNR
$ .creation : 3-Nov-2000
$ .keywords : *
$ .description :
$ Message catalog source file for the emulator's extended functions.
$ .notes :
$ . $Log: x_func.msf,v $
$ . Revision 4.1 2000/12/11 09:54:19 cibrario
$ . Public release.
$ .
$ . Revision 3.14 2000/11/13 11:14:19 cibrario
$ . Implemented fast load/save; improved keyboard interface emulation at
$ . high emulated CPU speed:
$ .
$ . - Added new messages: 105, 106, 107, 202, 203, 303, 501, 502
$ .
$ . Revision 3.13 2000/11/09 11:42:22 cibrario
$ . *** empty log message ***
$ .
$ .-
$set 1
18 X_Func
$set 18
101 Function [%s] called
102 Emulator's extended function #[%01X]
103 Emulator speed set to [%d]MHz
104 Emulator at maximum speed
105 Transferring [%s]
106 Kget START[%05X] END[%05X] HDR[%s]
107 Send START[%05X] END[%05X] HDR[%s]
201 Invalid function code #[%01X] ignored
202 Operation aborted by user
203 Operation failed
301 Cpu Halt requests not allowed.\n\tRebuild with CPU_SPIN_SHUTDN undefined in config.h
302 Cpu speed control not available.\n\tRebuild with REAL_CPU_SPEED defined in config.h
303 Can't determine binary header for hw [%s]
501 Load object from disk...
502 Save object to disk...

159
src/chf_messages.c Normal file
View file

@ -0,0 +1,159 @@
#include "chf_messages.h"
ChfTable message_table[] = {
{CPU_CHF_MODULE_ID, CPU_I_CALLED, "Function [%s] called" },
{CPU_CHF_MODULE_ID, CPU_I_EXECUTING, "Executing @ PC[%05X]" },
{CPU_CHF_MODULE_ID, CPU_I_SHUTDN, "CPU shutdown executed" },
{CPU_CHF_MODULE_ID, CPU_I_WAKE, "CPU wake-up executed" },
{CPU_CHF_MODULE_ID, CPU_I_INT, "%s request accepted" },
{CPU_CHF_MODULE_ID, CPU_I_INT_PENDING, "%s request pending" },
{CPU_CHF_MODULE_ID, CPU_I_RTI_LOOP, "RTI loop to service %s" },
{CPU_CHF_MODULE_ID, CPU_I_RTI_END, "RTI returning" },
{CPU_CHF_MODULE_ID, CPU_I_INTON, "INTON servicing %s" },
{CPU_CHF_MODULE_ID, CPU_I_REVISION, "CPU emulator [%s]" },
{CPU_CHF_MODULE_ID, CPU_I_TIMER1_EX, "Timer1 expired CTRL[%01X]" },
{CPU_CHF_MODULE_ID, CPU_I_TIMER2_EX, "Timer2 expired CTRL[%01X]" },
{CPU_CHF_MODULE_ID, CPU_I_EMULATOR_INT, "Emulator interrupt request detected" },
{CPU_CHF_MODULE_ID, CPU_I_TIMER_ST, "Timer[%s] Ctrl[%01X] Val[%08X]" },
{CPU_CHF_MODULE_ID, CPU_I_TIMER_EXP, "Timer[%s] expires in [%d]d ms" },
{CPU_CHF_MODULE_ID, CPU_I_IDLE_X_LOOP, "Starting idle loop, timeout [%d]d ms" },
{CPU_CHF_MODULE_ID, CPU_I_ELAPSED, "Spooling up after [%d]d us in idle loop" },
{CPU_CHF_MODULE_ID, CPU_I_HALT, "CPU halted by CpuHaltRequest()" },
{CPU_CHF_MODULE_ID, CPU_I_RUN, "CPU awoken by CpuRunRequest()" },
{CPU_CHF_MODULE_ID, CPU_W_RESETTING, "Can't restore CPU status from disk; resetting CPU" },
{CPU_CHF_MODULE_ID, CPU_W_BAD_MONITOR_CMD, "Monitor command syntax error [%s]" },
{CPU_CHF_MODULE_ID, CPU_E_BAD_OPCODE, "Bad opcode @ PC[%05X], N[%01X]" },
{CPU_CHF_MODULE_ID, CPU_E_SAVE, "Can't save CPU status to disk" },
{CPU_CHF_MODULE_ID, CPU_E_NO_HALT, "Halt/Run requests not allowed; #undef CPU_SPIN_SHUTDN" },
{CPU_CHF_MODULE_ID, CPU_F_INTERR, "Internal error [%s]" },
{CPU_CHF_MODULE_ID, CPU_F_BAD_SHUTDN, "Unexpected CPU shutdown" },
{DEBUG_CHF_MODULE_ID, DEBUG_W_NOT_SUPPORTED, "Debug not supported; Rebuild with -DDEBUG" },
{DEBUG_CHF_MODULE_ID, DEBUG_W_BAD_CMD, "Debug: Invalid command" },
{DISK_IO_CHF_MODULE_ID, DISK_IO_S_OK, "Disk IO: OK" },
{DISK_IO_CHF_MODULE_ID, DISK_IO_I_CALLED, "Function [%s] called" },
{DISK_IO_CHF_MODULE_ID, DISK_IO_E_OPEN, "Can't open file [%s]" },
{DISK_IO_CHF_MODULE_ID, DISK_IO_E_GETC, "getc() failed reading file [%s]" },
{DISK_IO_CHF_MODULE_ID, DISK_IO_E_PUTC, "putc() failed writing file [%s]" },
{DISK_IO_CHF_MODULE_ID, DISK_IO_E_READ, "fread() failed reading file [%s]" },
{DISK_IO_CHF_MODULE_ID, DISK_IO_E_WRITE, "fwrite() failed writing file [%s]" },
{DISK_IO_CHF_MODULE_ID, DISK_IO_E_CLOSE, "Close file [%s] failed" },
{DISK_IO_CHF_MODULE_ID, DISK_IO_E_BAD_HDR, "File [%s] has a bad header" },
{DISK_IO_CHF_MODULE_ID, DISK_IO_E_SIZE, "File [%s] is too large" },
{FLASH_CHF_MODULE_ID, FLASH_I_READ, "Read (Nibble) A[%08X] D[%01X]" },
{FLASH_CHF_MODULE_ID, FLASH_I_WRITE, "Write (Nibble) A[%08X] D[%01X]" },
{FLASH_CHF_MODULE_ID, FLASH_I_FSM, "FSM STATE[%d] CYCLE[%d]" },
{FLASH_CHF_MODULE_ID, FLASH_I_FSM_AD, "\tFSM Args: (Byte)A[%08X] D[%02X]" },
{FLASH_CHF_MODULE_ID, FLASH_I_FSM_RESULT, "\tFSM Next: STATE[%d] RESULT[%02X]" },
{FLASH_CHF_MODULE_ID, FLASH_I_FSM_OP, "\tFSM Operation: [%s]" },
{FLASH_CHF_MODULE_ID, FLASH_W_BAD_CMD, "Command unknown/not implemented - FSM Info:\n\\tSTATE[%d] CYCLE[%d] A[%08X] D[%02X]" },
{FLASH_CHF_MODULE_ID, FLASH_W_BAD_ADDRESS, "Invalid address in Write to Buffer - FSM Info:\n\\tSTATE[%d] CYCLE[%d] A[%08X] D[%02X]"},
{FLASH_CHF_MODULE_ID, FLASH_E_xxx, "FLASH_E_xxx" },
{FLASH_CHF_MODULE_ID, FLASH_F_xxx, "FLASH_F_xxx" },
{MOD_CHF_MODULE_ID, MOD_I_CALLED, "Function [%s] called" },
{MOD_CHF_MODULE_ID, MOD_I_INITIALIZING, "Initializing module [%s]" },
{MOD_CHF_MODULE_ID, MOD_I_RESETTING, "Resetting module [%s]" },
{MOD_CHF_MODULE_ID, MOD_I_GET_ID, "ModGetID -> [%05X]" },
{MOD_CHF_MODULE_ID, MOD_I_CONFIG, "CONFIG M[%s] A[%05X] S[%05X]" },
{MOD_CHF_MODULE_ID, MOD_I_UNCONFIG, "UNCNFG M[%s] A[%05X] S[%05X]" },
{MOD_CHF_MODULE_ID, MOD_I_SAVING, "Saving module [%s]" },
{MOD_CHF_MODULE_ID, MOD_I_NOT_IMPLEMENTED, "Function [%s] not implemented" },
{MOD_CHF_MODULE_ID, MOD_I_REVISION, "Modules emulator: [%s]" },
{MOD_CHF_MODULE_ID, MOD_I_BS_ADDRESS, "Bank Switcher F/F set to A[%05X]" },
{MOD_CHF_MODULE_ID, MOD_I_PORT_1_WP, "Port 1 has been write-protected" },
{MOD_CHF_MODULE_ID, MOD_I_PORT_2_WP, "Port 2 has been write-protected" },
{MOD_CHF_MODULE_ID, MOD_I_PERF_CTR, ">>> PerfCtr [%s]=[%d]" },
{MOD_CHF_MODULE_ID, MOD_I_CACHED_UNCONFIG, "Cached UNCNFG completed" },
{MOD_CHF_MODULE_ID, MOD_I_CACHED_CONFIG, "Cached CONFIG A[%05X] completed" },
{MOD_CHF_MODULE_ID, MOD_I_UNCONFIG_L_HIT, "Late UNCNFG cache hit" },
{MOD_CHF_MODULE_ID, MOD_I_UNCONFIG_L_MISS, "Late UNCNFG cache miss" },
{MOD_CHF_MODULE_ID, MOD_W_BAD_CONFIG, "Bad ModConfig [%05X] ignored" },
{MOD_CHF_MODULE_ID, MOD_W_BAD_UNCONFIG, "Bad ModUnconfig [%05X] ignored" },
{MOD_CHF_MODULE_ID, MOD_W_HDW_WRITE, "Bad HdwWrite A[%05X] N[%01X]" },
{MOD_CHF_MODULE_ID, MOD_W_HDW_READ, "Bad HdwRead A[%05X]" },
{MOD_CHF_MODULE_ID, MOD_W_RESETTING_ALL, "Resetting all modules" },
{MOD_CHF_MODULE_ID, MOD_W_RAM_INIT, "Can't initialize internal RAM from disk" },
{MOD_CHF_MODULE_ID, MOD_W_HDW_INIT, "Can't initialize HDW from disk" },
{MOD_CHF_MODULE_ID, MOD_W_BAD_KEY, "Bad key [%s] ignored" },
{MOD_CHF_MODULE_ID, MOD_W_BAD_OUT_BIT, "Bad out_bit [%x] ignored" },
{MOD_CHF_MODULE_ID, MOD_W_PORT_1_INIT, "Can't initialize Port 1 from disk" },
{MOD_CHF_MODULE_ID, MOD_W_PORT_2_INIT, "Can't initialize Port 2 from disk" },
{MOD_CHF_MODULE_ID, MOD_W_NO_VICTIM, "Unable to find CONFIG cache victim; flushing cache" },
{MOD_CHF_MODULE_ID, MOD_E_BAD_READ, "Read from unmapped A[%05X]" },
{MOD_CHF_MODULE_ID, MOD_E_BAD_WRITE, "Write to unmapped A[%05X] N[%01X]" },
{MOD_CHF_MODULE_ID, MOD_E_ROM_WRITE, "Write into ROM A[%05X] D[%01X]" },
{MOD_CHF_MODULE_ID, MOD_E_RAM_SAVE, "Can't save internal RAM status to disk" },
{MOD_CHF_MODULE_ID, MOD_E_HDW_SAVE, "Can't save HDW status to disk" },
{MOD_CHF_MODULE_ID, MOD_E_PORT_1_SAVE, "Can't save Port 1 status to disk" },
{MOD_CHF_MODULE_ID, MOD_E_CE1_WRITE, "Write into CE1 A[%05X] D[%01X]" },
{MOD_CHF_MODULE_ID, MOD_E_PORT_2_SAVE, "Can't save Port 1 status to disk" },
{MOD_CHF_MODULE_ID, MOD_E_NCE3_READ, "Read from NCE3 A[%05X] when Port 2 is not present" },
{MOD_CHF_MODULE_ID, MOD_E_NCE3_WRITE, "Write into NCE3 A[%05X] D[%01X] when Port 2 is not present" },
{MOD_CHF_MODULE_ID, MOD_E_NO_MATCH, "Hardware configuration [%s] not supported" },
{MOD_CHF_MODULE_ID, MOD_E_ROM_SAVE, "Can't save Flash ROM status to disk" },
{MOD_CHF_MODULE_ID, MOD_F_MAP_SAVE, "Can't save module mapping info" },
{MOD_CHF_MODULE_ID, MOD_F_ROM_INIT, "Can't initialize internal ROM" },
{MOD_CHF_MODULE_ID, MOD_F_MAP_ALLOC, "Dynamic allocation of ModMap failed" },
{MOD_CHF_MODULE_ID, MOD_F_BAD_ALLOC_C, "Bad alloc_c [%d] after FlushCache()" },
{MOD_CHF_MODULE_ID, MOD_F_CHAIN_CORRUPTED, "Cached struct ModMap chain corrupted; freeing unlinked entry" },
{MOD_CHF_MODULE_ID, MOD_F_NO_VICTIM, "Unable to find CONFIG cache victim after cache flush" },
{MOD_CHF_MODULE_ID, MOD_F_MOD_STATUS_ALLOC, "Allocation of ModStatus_xx failed ([%d]d bytes needed)" },
{MOD_CHF_MODULE_ID, MOD_F_NO_DESCRIPTION, "ModInit() invoked without registering a ModDescription first" },
{MOD_CHF_MODULE_ID, MOD_M_NOT_MAPPED, "A[%05X] -> *Not Mapped*" },
{MOD_CHF_MODULE_ID, MOD_M_MAPPED, "A[%05X] -> M[%s] R[%05X]" },
{MOD_CHF_MODULE_ID, MOD_M_MAP_TABLE_TITLE, "Device\t\t\tAddress\tSize\tStatus" },
{MOD_CHF_MODULE_ID, MOD_M_MAP_TABLE_ROW, "%s\t%05X\t%05X\t%s" },
{MOD_CHF_MODULE_ID, MOD_M_MAP_CONFIGURED, "Configured" },
{MOD_CHF_MODULE_ID, MOD_M_MAP_SZ_CONFIGURED, "Size_configured" },
{MOD_CHF_MODULE_ID, MOD_M_MAP_UNCONFIGURED, "*Unconfigured*" },
{MAIN_CHF_MODULE_ID, MAIN_M_COPYRIGHT,
"saturn %s - A poor-man's emulator of HP48GX, HP49, HP39/40\nCopyright (C) 1998-2000 Ivan Cibrario Bertolotti\n" },
{MAIN_CHF_MODULE_ID, MAIN_M_LICENSE,
"This program is free software, and comes with ABSOLUTELY NO WARRANTY;\nfor details see the accompanying documentation.\n\n" },
{SERIAL_CHF_MODULE_ID, SERIAL_I_CALLED, "Function [%s] called" },
{SERIAL_CHF_MODULE_ID, SERIAL_I_REVISION, "Serial port emulator: [%s]" },
{SERIAL_CHF_MODULE_ID, SERIAL_I_READ, "Read [%s]; value [%01X]" },
{SERIAL_CHF_MODULE_ID, SERIAL_I_WRITE, "Write [%s]; value [%01X](old) -> [%01X](new)" },
{SERIAL_CHF_MODULE_ID, SERIAL_I_RBR, "Read RBR; value [%02X]" },
{SERIAL_CHF_MODULE_ID, SERIAL_I_TBR, "Write TBR; value [%02X]" },
{SERIAL_CHF_MODULE_ID, SERIAL_I_PTY_NAME, "Pseudo-terminal name is [%s]" },
{SERIAL_CHF_MODULE_ID, SERIAL_W_EMPTY_RRB, "Read from empty receiver buffer, rcs [%01X]" },
{SERIAL_CHF_MODULE_ID, SERIAL_W_FULL_TRB, "Write into full transmitter buffer, tcs [%01X]" },
{SERIAL_CHF_MODULE_ID, SERIAL_W_NOPTY, "Pseudo-terminals not supported" },
{SERIAL_CHF_MODULE_ID, SERIAL_E_TRB_DRAIN, "Error draining transmitter buffer" },
{SERIAL_CHF_MODULE_ID, SERIAL_E_RRB_CHARGE, "Error charging receiver buffer" },
{SERIAL_CHF_MODULE_ID, SERIAL_E_PTY_CLOSE, "Error shutting down pseudo-terminal" },
{SERIAL_CHF_MODULE_ID, SERIAL_F_OPENPTY, "openpty() failed on master pty" },
{SERIAL_CHF_MODULE_ID, SERIAL_F_FCNTL, "fcntl() failed on master pty" },
{SERIAL_CHF_MODULE_ID, SERIAL_F_OPEN_MASTER, "Can't open() pty master [%s]" },
{SERIAL_CHF_MODULE_ID, SERIAL_F_GRANTPT, "grantpt() failed on master pty" },
{SERIAL_CHF_MODULE_ID, SERIAL_F_UNLOCKPT, "unlockpt() failed on master pty" },
{SERIAL_CHF_MODULE_ID, SERIAL_F_OPEN_SLAVE, "Can't open() pty slave [%s]" },
{SERIAL_CHF_MODULE_ID, SERIAL_F_PUSH, "ioctl(I_PUSH,[%s]) failed on slave pty" },
{SERIAL_CHF_MODULE_ID, SERIAL_F_TCGETATTR, "tcgetattr() failed on master pty" },
{SERIAL_CHF_MODULE_ID, SERIAL_F_TCSETATTR, "tcsetattr() failed on master pty" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_I_CALLED, "Function [%s] called" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_I_CODE, "Emulator's extended function #[%01X]" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_I_SET_SPEED, "Emulator speed set to [%d]MHz" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_I_MAX_SPEED, "Emulator at maximum speed" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_I_FILE_NAME, "Transferring [%s]" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_I_KGET, "Kget START[%05X] END[%05X] HDR[%s]" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_I_SEND, "Send START[%05X] END[%05X] HDR[%s]" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_W_BAD_CODE, "Invalid function code #[%01X] ignored" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_W_ABORTED, "Operation aborted by user" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_W_FAILED, "Operation failed" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_E_NO_HALT, "Cpu Halt requests not allowed.\n\tRebuild with CPU_SPIN_SHUTDN undefined in config.h" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_E_NO_SPEED, "Cpu speed control not available.\n\tRebuild with REAL_CPU_SPEED defined in config.h" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_E_NO_BIN_HDR, "Can't determine binary header for hw [%s]" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_F_xxx, "X_FUNC_F_xxx" },
{X_FUNC_CHF_MODULE_ID, X_FUNC_M_KGET, "Load object from disk..." },
{X_FUNC_CHF_MODULE_ID, X_FUNC_M_SEND, "Save object to disk..." },
};
size_t message_table_size = sizeof( message_table ) / sizeof( message_table[ 0 ] );

188
src/chf_messages.h Normal file
View file

@ -0,0 +1,188 @@
#ifndef _CHF_MESSAGES_H
#define _CHF_MESSAGES_H 1
#include <stdlib.h>
#include <Chf.h>
// #include "../libChf/src/Chf.h"
/* Chf Module Identifiers:
Each main module of the emulator has its own Chf Module Identifier; the
values defined here must match those actually used in the message catalogs.
*/
#define CPU_CHF_MODULE_ID 11
#define DEBUG_CHF_MODULE_ID 30
#define DISK_IO_CHF_MODULE_ID 13
#define FLASH_CHF_MODULE_ID 16 /* 3.3 */
#define MOD_CHF_MODULE_ID 12
#define MAIN_CHF_MODULE_ID 10
#define SERIAL_CHF_MODULE_ID 15 /* 2.5 */
#define X_FUNC_CHF_MODULE_ID 18 /* 3.13 */
/*---------------------------------------------------------------------------
Chf condition codes
---------------------------------------------------------------------------*/
// cpu.h
#define CPU_I_CALLED 101 /* Function %s called */
#define CPU_I_EXECUTING 102 /* Executing @PC %X */
#define CPU_I_SHUTDN 103 /* Shutdown */
#define CPU_I_WAKE 104 /* Wake */
#define CPU_I_INT 105 /* %s request accepted */
#define CPU_I_INT_PENDING 106 /* %s request pending */
#define CPU_I_RTI_LOOP 107 /* RTI loop to service %s */
#define CPU_I_RTI_END 108 /* RTI returning */
#define CPU_I_INTON 109 /* INTON servicing %s */
#define CPU_I_REVISION 110 /* CPU emulation revision: %s */
#define CPU_I_TIMER1_EX 111 /* Timer 1 expired; ctrl=%x */
#define CPU_I_TIMER2_EX 112 /* Timer 1 expired; ctrl=%x */
#define CPU_I_EMULATOR_INT 113 /* Emulator interrupt req. detected */
#define CPU_I_TIMER_ST 114 /* 3.1: Timer %s st: ctrl %x, val %x */
#define CPU_I_TIMER_EXP 115 /* 3.1: Timer %s expiration %d ms */
#define CPU_I_IDLE_X_LOOP 116 /* 3.1: Start idle loop, t/out %d ms */
#define CPU_I_ELAPSED 117 /* 3.1: Spent %d us in idle loop */
#define CPU_I_HALT 118 /* 3.13: CPU halted */
#define CPU_I_RUN 119 /* 3.13: CPU running */
#define CPU_W_RESETTING 201 /* Resetting CPU */
#define CPU_W_BAD_MONITOR_CMD 202 /* Bad monitor command: %s */
#define CPU_E_BAD_OPCODE 301 /* Bad opc. pc=%x, value=%x */
#define CPU_E_SAVE 302 /* Can't save CPU status */
#define CPU_E_NO_HALT 303 /* 3.13: Halt/Run not allowed */
#define CPU_F_INTERR 401 /* Internal error %s */
#define CPU_F_BAD_SHUTDN 402 /* Unexpected CPU shutdown */
// debug.h
#define DEBUG_W_NOT_SUPPORTED 201 /* Debug not supported */
#define DEBUG_W_BAD_CMD 202 /* Invalid command */
// disk_io.h
#define DISK_IO_S_OK 0 /* Function completed succesfully */
#define DISK_IO_I_CALLED 101 /* Function %s called */
#define DISK_IO_E_OPEN 401 /* Open file %s failed */
#define DISK_IO_E_GETC 402 /* getc() from file %s failed */
#define DISK_IO_E_PUTC 403 /* putc() to file %s failed */
#define DISK_IO_E_READ 404 /* fread() from file %s failed */
#define DISK_IO_E_WRITE 405 /* fwrite() to file %s failed */
#define DISK_IO_E_CLOSE 406 /* Close file %s failed */
#define DISK_IO_E_BAD_HDR 407 /* File %s has a bad header */
#define DISK_IO_E_SIZE 408 /* File %s too large */
// flash49.h
#define FLASH_I_READ 101 /* Read from address %x: %d */
#define FLASH_I_WRITE 102 /* Write address %x, datum %x */
#define FLASH_I_FSM 103 /* FSM from state %d, cycle %d */
#define FLASH_I_FSM_AD 104 /* FSM address %x, data %x */
#define FLASH_I_FSM_RESULT 105 /* FSM next state %d, result %x */
#define FLASH_I_FSM_OP 106 /* FSM operation %s */
#define FLASH_W_BAD_CMD 201 /* Bad cmd st%d, cycle%d, a%x, d%d */
#define FLASH_W_BAD_ADDRESS 202 /* Bad addr st%d, cycle%d, a%x, d%d */
#define FLASH_E_xxx 301
#define FLASH_F_xxx 401
// modules.h
#define MOD_I_CALLED 101 /* Function %s called */
#define MOD_I_INITIALIZING 102 /* Initializing module %s */
#define MOD_I_RESETTING 103 /* Resetting module %s */
#define MOD_I_GET_ID 106 /* ModGetID returning %x */
#define MOD_I_CONFIG 107 /* ModConfig %s %x %x completed */
#define MOD_I_UNCONFIG 108 /* ModUnconfig %s %x %x completed */
#define MOD_I_SAVING 109 /* Saving status of module %s */
#define MOD_I_NOT_IMPLEMENTED 110 /* Function %s not implemented */
#define MOD_I_REVISION 111 /* Modules revision: %s */
#define MOD_I_BS_ADDRESS 112 /* 2.4: Bank Switcher address: %x */
#define MOD_I_PORT_1_WP 113 /* 2.4: Port 1 is write protected */
#define MOD_I_PORT_2_WP 114 /* 2.4: Port 2 is write protected */
#define MOD_I_PERF_CTR 115 /* 2.7: Value of PerfCtr %s is %d */
#define MOD_I_CACHED_UNCONFIG 116 /* 2.7: Cached ModUnconfig completed */
#define MOD_I_CACHED_CONFIG 117 /* 2.7: Cached ModConfig %x comp. */
#define MOD_I_UNCONFIG_L_HIT 118 /* 2.7: Late unconfig hit */
#define MOD_I_UNCONFIG_L_MISS 119 /* 2.7: Late unconfig miss */
#define MOD_W_BAD_CONFIG 202 /* Bad ModConfig %x ignored */
#define MOD_W_BAD_UNCONFIG 203 /* Bad ModUnconfig %x ignored */
#define MOD_W_HDW_WRITE 204 /* Bad HdwWrite %x, %x */
#define MOD_W_HDW_READ 205 /* Bad HdwRead %x */
#define MOD_W_RESETTING_ALL 206 /* Resetting all modules */
#define MOD_W_RAM_INIT 207 /* Can't initialize internal RAM */
#define MOD_W_HDW_INIT 208 /* Can't initialize HDW */
#define MOD_W_BAD_KEY 209 /* 2.1: Bad key %s ignored */
#define MOD_W_BAD_OUT_BIT 210 /* 2.1: Bad out_bit %x ignored */
#define MOD_W_PORT_1_INIT 211 /* 2.4: Can't initialize Port 1 */
#define MOD_W_PORT_2_INIT 212 /* 2.4: Can't initialize Port 2 */
#define MOD_W_NO_VICTIM 213 /* 2.7: No cache victim; flush/retry */
#define MOD_E_BAD_READ 301 /* Read unmapped addr %x */
#define MOD_E_BAD_WRITE 302 /* Write unmapped addr %x datum %x */
#define MOD_E_ROM_WRITE 303 /* Write into ROM addr %x datum %x */
#define MOD_E_RAM_SAVE 304 /* Can't save internal RAM status */
#define MOD_E_HDW_SAVE 305 /* Can't save HDW status */
#define MOD_E_PORT_1_SAVE 306 /* 2.4: Can't save Port 1 status */
#define MOD_E_CE1_WRITE 307 /* 2.4: Ce1Write addr %x datum %x */
#define MOD_E_PORT_2_SAVE 308 /* 2.4: Can't save Port 2 status */
#define MOD_E_NCE3_READ 309 /* 2.4: Read from NCE3 addr %x */
#define MOD_E_NCE3_WRITE 310 /* 2.4: Wr. to NCE3 addr %x datum %x */
#define MOD_E_NO_MATCH 311 /* 3.2: Hw desription %s not found */
#define MOD_E_ROM_SAVE 312 /* 3.3: Can't save Flash ROM */
#define MOD_F_MAP_SAVE 401 /* Can't save mod_map information */
#define MOD_F_ROM_INIT 402 /* Can't initialize internal ROM */
#define MOD_F_MAP_ALLOC 403 /* Dynamic map allocation failed */
#define MOD_F_BAD_ALLOC_C 404 /* 2.7: Bad alloc_c %d aft FlushCache*/
#define MOD_F_CHAIN_CORRUPTED 405 /* 2.7: ModMap chain corrupted */
#define MOD_F_NO_VICTIM 406 /* 2.7: No cache victim after flush */
#define MOD_F_MOD_STATUS_ALLOC 407 /* 3.2: ModStatus_xx alloc failed %d */
#define MOD_F_NO_DESCRIPTION 408 /* 3.2: No module description */
#define MOD_M_NOT_MAPPED 501 /* Address %x not mapped */
#define MOD_M_MAPPED 502 /* Address %x mapped to %s:%x */
#define MOD_M_MAP_TABLE_TITLE 503 /* */
#define MOD_M_MAP_TABLE_ROW 504 /* %s %x %x %s */
#define MOD_M_MAP_CONFIGURED 505 /* Configured */
#define MOD_M_MAP_SZ_CONFIGURED 506 /* Size configured */
#define MOD_M_MAP_UNCONFIGURED 507 /* Unconfigured */
// main.c
#define MAIN_M_COPYRIGHT 501
#define MAIN_M_LICENSE 502
// serial.h
#define SERIAL_I_CALLED 101 /* Function %s called */
#define SERIAL_I_REVISION 102 /* Serial port emulation rev. %s */
#define SERIAL_I_READ 103 /* Read %s -> %x */
#define SERIAL_I_WRITE 104 /* Write %s %x -> %x */
#define SERIAL_I_RBR 105 /* Read RBR -> %x */
#define SERIAL_I_TBR 106 /* Write TBR <- %x */
#define SERIAL_I_PTY_NAME 107 /* pty name is %s */
#define SERIAL_W_EMPTY_RRB 201 /* Read from empty RX buffer, rcs=%x */
#define SERIAL_W_FULL_TRB 202 /* Write into full TX buffer, tcs=%x */
#define SERIAL_W_NOPTY 203 /* 3.16: Pty support not available */
#define SERIAL_E_TRB_DRAIN 301 /* Error draining TX buffer */
#define SERIAL_E_RRB_CHARGE 302 /* Error charging RX buffer */
#define SERIAL_E_PTY_CLOSE 303 /* Error closing pty */
#define SERIAL_F_OPENPTY 401 /* openpty() failed on master pty */
#define SERIAL_F_FCNTL 402 /* fcntl() failed on master pty */
#define SERIAL_F_OPEN_MASTER 403 /* Can't open pty master %s */
#define SERIAL_F_GRANTPT 404 /* grantpt() failed on master pty */
#define SERIAL_F_UNLOCKPT 405 /* unlockpt() failed on master pty */
#define SERIAL_F_OPEN_SLAVE 406 /* Can't open pty slave %s */
#define SERIAL_F_PUSH 407 /* ioctl(I_PUSH,%s) failed on slave */
#define SERIAL_F_TCGETATTR 408 /* tcgetattr() failed on master */
#define SERIAL_F_TCSETATTR 409 /* tcsetattr() failed on master */
// x_func.h
#define X_FUNC_I_CALLED 101 /* Function %s called */
#define X_FUNC_I_CODE 102 /* Function code %d */
#define X_FUNC_I_SET_SPEED 103 /* Speed set to %dMhz (%d mult.) */
#define X_FUNC_I_MAX_SPEED 104 /* Emulator at max speed */
#define X_FUNC_I_FILE_NAME 105 /* Transferring file name %s */
#define X_FUNC_I_KGET 106 /* Kget start:%x end:%x hdr:%s */
#define X_FUNC_I_SEND 107 /* Send start:%x end:%x hdr:%s */
#define X_FUNC_W_BAD_CODE 201 /* Bad function code %d ignored */
#define X_FUNC_W_ABORTED 202 /* Aborted by user */
#define X_FUNC_W_FAILED 203 /* Operation failed */
#define X_FUNC_E_NO_HALT 301 /* Cpu halt not allowed */
#define X_FUNC_E_NO_SPEED 302 /* No speed control available */
#define X_FUNC_E_NO_BIN_HDR 303 /* Can't determine hdr for hw %s */
#define X_FUNC_F_xxx 401
#define X_FUNC_M_KGET 501 /* FSB title for Kget function */
#define X_FUNC_M_SEND 502 /* FSB title for Send function */
extern ChfTable message_table[];
extern size_t message_table_size;
#endif /*!_CHF_MESSAGES_H*/

107
src/main.c Normal file
View file

@ -0,0 +1,107 @@
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include "ui4x_config.h"
#include "ui4x_emulator.h"
#include "ui4x_common.h"
#include "config.h"
#include "cpu.h"
#include "monitor.h"
#include "chf_messages.h"
#define UI_REFRESH_RATE_Hz 64
#define CONDITION_STACK_SIZE 16
#define HANDLER_STACK_SIZE 8
void signal_handler( int sig )
{
switch ( sig ) {
/* case SIGINT: /\* Ctrl-C *\/ */
/* enter_debugger |= USER_INTERRUPT; */
/* break; */
case SIGALRM:
ui_get_event();
ui_update_display();
break;
case SIGPIPE:
ui_stop();
exit_emulator();
exit( 0 );
default:
break;
}
}
int main( int argc, char** argv )
{
config = *config_init( argc, argv );
/* Chf initialization with msgcat subsystem; notice that on
some systems (e.g. Digital UNIX) catopen() can succeed even
if it was not able to open the right message catalog;
better try it now.
*/
if ( ( ChfStaticInit( argv[ 0 ], /* Application's name */
CHF_DEFAULT, /* Options */
message_table, /* Name of the message catalog */
message_table_size, /* message catalog size */
CONDITION_STACK_SIZE, /* Size of the condition stack */
HANDLER_STACK_SIZE, /* Size of the handler stack */
EXIT_FAILURE /* Abnormal exit code */
) ) != CHF_S_OK ) {
fprintf( stderr, "saturn-E-Primary Chf initialization failed\n" );
exit( EXIT_FAILURE );
}
/* 3.9: Print out MAIN_M_COPYRIGHT and MAIN_M_LICENSE on stdout now */
fprintf( stdout, ChfGetMessage( MAIN_CHF_MODULE_ID, MAIN_M_COPYRIGHT, "" ), "$Revision: 4.1 $" );
/* fprintf( stdout, ChfGetMessage( CHF_MODULE_ID, MAIN_M_LICENSE, "" ) ); */
init_emulator( &config );
/* (G)UI */
setup_ui( &config );
ui_start( &config );
sigset_t set;
struct sigaction sa;
sigemptyset( &set );
sigaddset( &set, SIGALRM );
sa.sa_handler = signal_handler;
sa.sa_mask = set;
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
#endif
sigaction( SIGALRM, &sa, ( struct sigaction* )0 );
/************************************/
/* set the real time interval timer */
/************************************/
/*
Every <interval>µs setitimer will trigger a SIGALRM
which will getUI events and refresh UI in signal_handler
*/
struct itimerval it;
it.it_interval.tv_sec = 0;
it.it_interval.tv_usec = 1000000 / UI_REFRESH_RATE_Hz;
it.it_value.tv_sec = it.it_interval.tv_sec;
it.it_value.tv_usec = it.it_interval.tv_usec;
setitimer( ITIMER_REAL, &it, ( struct itimerval* )0 );
if ( config.monitor )
/* Invoke Monitor */
Monitor();
else
/* Call Emulator directly */
Emulator();
/* never reached */
return EXIT_SUCCESS;
}

View file

@ -83,6 +83,18 @@ static char rcs_id[] = "$Id";
#include "cpu.h"
#include "disk_io.h"
/* Condition codes used by this utility */
#define UTIL_CHF_MODULE_ID 17
#define UTIL_I_PACK_USAGE 1
#define UTIL_F_PACK_CMD_LINE 2
#define UTIL_F_PACK_STAT 3
#define UTIL_F_PACK_SRC_SIZE 4
#define UTIL_F_PACK_MALLOC 5
#define UTIL_F_PACK_OPEN 6
#define UTIL_F_PACK_READ 7
#define UTIL_F_PACK_WRITE_NIBBLES 8
#define CHF_MODULE_ID UTIL_CHF_MODULE_ID
#include <Chf.h>
@ -101,24 +113,20 @@ static char rcs_id[] = "$Id";
/* Conditional prefix and mandatory suffix to make a message catalog
name from cat_base_name.
*/
static const char cat_prefix[] = "./";
static const char cat_suffix[] = ".cat";
#define CAT_PREFIX_LEN ( sizeof( cat_prefix ) + 1 )
#define CAT_SUFFIX_LEN ( sizeof( cat_suffix ) + 1 )
/* Message catalog base_name */
/* Message catalog */
static const char cat_base_name[] = "saturn";
ChfTable message_table[] = {
{UTIL_CHF_MODULE_ID, UTIL_I_PACK_USAGE, "Usage:\n pack <emu48_source_rom> <saturn_dest_rom>"},
{UTIL_CHF_MODULE_ID, UTIL_F_PACK_CMD_LINE, "Command line syntax error" },
{UTIL_CHF_MODULE_ID, UTIL_F_PACK_STAT, "stat(%s) failed" },
{UTIL_CHF_MODULE_ID, UTIL_F_PACK_SRC_SIZE, "Invalid source file size: %d" },
{UTIL_CHF_MODULE_ID, UTIL_F_PACK_MALLOC, "malloc(%d) failed" },
{UTIL_CHF_MODULE_ID, UTIL_F_PACK_OPEN, "open(%s) failed" },
{UTIL_CHF_MODULE_ID, UTIL_F_PACK_READ, "read(%s) failed" },
{UTIL_CHF_MODULE_ID, UTIL_F_PACK_WRITE_NIBBLES, "WriteNibblesToFile() failed" },
};
/* Condition codes used by this utility */
#define UTIL_I_PACK_USAGE 1
#define UTIL_F_PACK_CMD_LINE 2
#define UTIL_F_PACK_STAT 3
#define UTIL_F_PACK_SRC_SIZE 4
#define UTIL_F_PACK_MALLOC 5
#define UTIL_F_PACK_OPEN 6
#define UTIL_F_PACK_READ 7
#define UTIL_F_PACK_WRITE_NIBBLES 8
size_t message_table_size = sizeof( message_table ) / sizeof( message_table[ 0 ] );
/*---------------------------------------------------------------------------
Public functions
@ -138,68 +146,29 @@ static const char cat_base_name[] = "saturn";
.- */
int main( int argc, char* argv[] )
{
char* cat_name; /* Message catalog name */
struct stat statb; /* stat() buffer on source file */
char* b; /* Source buffer */
Nibble* nb; /* Nibble buffer */
int d; /* Source file descriptor */
int i;
int st;
if ( ( cat_name = malloc( sizeof( cat_base_name ) + CAT_PREFIX_LEN + CAT_SUFFIX_LEN + 1 ) ) == NULL ) {
fprintf( stderr, "Cat_name initialization failed\n" );
exit( EXIT_FAILURE );
}
/* Generate catalog name, without optional prefix */
strcpy( cat_name, cat_base_name );
strcat( cat_name, cat_suffix );
/* Chf initialization with msgcat subsystem;
notice that on some systems (e.g. Digital UNIX) catopen() can succeed
even if it was not able to open the right message catalog; better
try it now.
*/
if ( ( st = ChfMsgcatInit( argv[ 0 ], /* Application's name */
CHF_DEFAULT, /* Options */
cat_name, /* Name of the message catalog */
CONDITION_STACK_SIZE, /* Size of the condition stack */
HANDLER_STACK_SIZE, /* Size of the handler stack */
EXIT_FAILURE /* Abnormal exit code */
) ) != CHF_S_OK ||
ChfGetMessage( CHF_MODULE_ID, UTIL_I_PACK_USAGE, NULL ) == NULL ) {
if ( st != CHF_S_OK && st != CHF_F_CATOPEN ) {
fprintf( stderr, "Chf initialization failed\n" );
exit( EXIT_FAILURE );
} else {
fprintf( stderr, "Default message catalog open failed; trying alternate\n" );
/* Bring down Chf before initializing it again */
if ( st == CHF_S_OK )
ChfExit();
/* Try alternate message catalog name (with prefix) */
strcpy( cat_name, cat_prefix );
strcat( cat_name, cat_base_name );
strcat( cat_name, cat_suffix );
if ( ( st = ChfMsgcatInit( argv[ 0 ], /* Application's name */
CHF_DEFAULT, /* Options */
cat_name, /* Name of the message catalog */
CONDITION_STACK_SIZE, /* Size of the condition stack */
HANDLER_STACK_SIZE, /* Size of the handler stack */
EXIT_FAILURE /* Abnormal exit code */
) ) != CHF_S_OK ||
ChfGetMessage( CHF_MODULE_ID, UTIL_I_PACK_USAGE, NULL ) == NULL ) {
fprintf( stderr, "Alternate Chf initialization failed\n" );
exit( EXIT_FAILURE );
}
}
if ( ChfStaticInit( argv[ 0 ], /* Application's name */
CHF_DEFAULT, /* Options */
message_table, /* message catalog */
message_table_size, /* message catalog size */
CONDITION_STACK_SIZE, /* Size of the condition stack */
HANDLER_STACK_SIZE, /* Size of the handler stack */
EXIT_FAILURE /* Abnormal exit code */
) != CHF_S_OK ) {
fprintf( stderr, "Chf initialization failed\n" );
exit( EXIT_FAILURE );
}
/* cat_name no longer needed */
free( cat_name );
/* Now, do some useful work; pack argv[1] into argv[2] */
if ( argc != 3 ) {
ChfCondition UTIL_I_PACK_USAGE, CHF_INFO ChfEnd;

View file

@ -1,208 +0,0 @@
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include "ui4x_config.h"
#include "ui4x_emulator.h"
#include "ui4x_common.h"
#include "config.h"
#include "cpu.h"
#include "monitor.h"
#define UI_REFRESH_RATE_Hz 64
/* Chf condition codes (main program only) */
#define CHF_MODULE_ID MAIN_CHF_MODULE_ID
#include <Chf.h>
#define MAIN_M_COPYRIGHT 501
#define MAIN_M_LICENSE 502
/*---------------------------------------------------------------------------
Chf parameters - Do not change.
---------------------------------------------------------------------------*/
#define CONDITION_STACK_SIZE 16
#define HANDLER_STACK_SIZE 8
/* Conditional prefix and mandatory suffix to make a message catalog
name from argv[0]
*/
static const char cat_prefix[] = "./";
static const char cat_suffix[] = ".cat";
#define CAT_PREFIX_LEN ( sizeof( cat_prefix ) + 1 )
#define CAT_SUFFIX_LEN ( sizeof( cat_suffix ) + 1 )
static void adjust_setlocale( void )
{
fprintf( stderr, "saturn-W-locale probably bad; reverting to C locale\n" );
putenv( "LC_ALL=C" );
putenv( "LC_COLLATE=C" );
putenv( "LC_CTYPE=C" );
putenv( "LC_MESSAGES=C" );
putenv( "LC_MONETARY=C" );
putenv( "LC_NUMERIC=C" );
putenv( "LC_TIME=C" );
putenv( "LANG=C" );
}
void signal_handler( int sig )
{
switch ( sig ) {
/* case SIGINT: /\* Ctrl-C *\/ */
/* enter_debugger |= USER_INTERRUPT; */
/* break; */
case SIGALRM:
ui_get_event();
ui_update_display();
break;
case SIGPIPE:
ui_stop();
exit_emulator();
exit( 0 );
default:
break;
}
}
int main( int argc, char** argv )
{
config = *config_init( argc, argv );
char* cat_name;
int st;
int retry = 0;
if ( ( cat_name = malloc( strlen( argv[ 0 ] ) + CAT_PREFIX_LEN + CAT_SUFFIX_LEN + 1 ) ) == NULL ) {
fprintf( stderr, "saturn-E-cat_name initialization failed\n" );
exit( EXIT_FAILURE );
}
/* Generate catalog name, without optional prefix */
strcpy( cat_name, argv[ 0 ] );
strcat( cat_name, cat_suffix );
/* 3.15: Retry the initialization steps below two times; before trying
the second time, adjust the setlocale() environment variables
with adjust_setlocale()
*/
while ( retry < 2 ) {
/* Chf initialization with msgcat subsystem; notice that on
some systems (e.g. Digital UNIX) catopen() can succeed even
if it was not able to open the right message catalog;
better try it now.
*/
if ( ( st = ChfMsgcatInit( argv[ 0 ], /* Application's name */
CHF_DEFAULT, /* Options */
cat_name, /* Name of the message catalog */
CONDITION_STACK_SIZE, /* Size of the condition stack */
HANDLER_STACK_SIZE, /* Size of the handler stack */
EXIT_FAILURE /* Abnormal exit code */
) ) != CHF_S_OK ||
ChfGetMessage( CHF_MODULE_ID, MAIN_M_COPYRIGHT, NULL ) == NULL )
fprintf( stderr, "saturn-E-Primary Chf initialization failed (%d)\n", st );
else
break;
/* if ( ( st = ChfStaticInit( argv[ 0 ], /\* Application's name *\/ */
/* CHF_DEFAULT, /\* Options *\/ */
/* [], /\* Name of the message catalog *\/ */
/* CONDITION_STACK_SIZE, /\* Size of the condition stack *\/ */
/* HANDLER_STACK_SIZE, /\* Size of the handler stack *\/ */
/* EXIT_FAILURE /\* Abnormal exit code *\/ */
/* ) ) != CHF_S_OK || */
/* ChfGetMessage( CHF_MODULE_ID, MAIN_M_COPYRIGHT, NULL ) == NULL ) */
/* fprintf( stderr, "saturn-E-Primary Chf initialization failed (%d)\n", st ); */
/* else */
/* break; */
/* Bring down Chf before initializing it again */
if ( st == CHF_S_OK )
ChfExit();
/* Try alternate message catalog name (with prefix) */
strcpy( cat_name, cat_prefix );
strcat( cat_name, argv[ 0 ] );
strcat( cat_name, cat_suffix );
if ( ( st = ChfMsgcatInit( argv[ 0 ], /* Application's name */
CHF_DEFAULT, /* Options */
cat_name, /* Name of the message catalog */
CONDITION_STACK_SIZE, /* Size of the condition stack */
HANDLER_STACK_SIZE, /* Size of the handler stack */
EXIT_FAILURE /* Abnormal exit code */
) ) != CHF_S_OK ||
ChfGetMessage( CHF_MODULE_ID, MAIN_M_COPYRIGHT, NULL ) == NULL )
fprintf( stderr, "saturn-E-Alternate Chf initialization failed (%d)\n", st );
else
break;
/* Bring down Chf before initializing it again */
if ( st == CHF_S_OK )
ChfExit();
/* Attempt to adjust setlocale() environment variables */
if ( retry++ == 0 )
adjust_setlocale();
}
if ( retry == 2 ) {
fprintf( stderr, "saturn-F-Application aborted\n" );
exit( EXIT_FAILURE );
}
/* cat_name no longer needed */
free( cat_name );
/* 3.9: Print out MAIN_M_COPYRIGHT and MAIN_M_LICENSE on stdout now */
fprintf( stdout, ChfGetMessage( CHF_MODULE_ID, MAIN_M_COPYRIGHT, "" ), "$Revision: 4.1 $" );
/* fprintf( stdout, ChfGetMessage( CHF_MODULE_ID, MAIN_M_LICENSE, "" ) ); */
init_emulator( &config );
/* (G)UI */
setup_ui( &config );
ui_start( &config );
sigset_t set;
struct sigaction sa;
sigemptyset( &set );
sigaddset( &set, SIGALRM );
sa.sa_handler = signal_handler;
sa.sa_mask = set;
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
#endif
sigaction( SIGALRM, &sa, ( struct sigaction* )0 );
/************************************/
/* set the real time interval timer */
/************************************/
/*
Every <interval>µs setitimer will trigger a SIGALRM
which will getUI events and refresh UI in signal_handler
*/
struct itimerval it;
it.it_interval.tv_sec = 0;
it.it_interval.tv_usec = 1000000 / UI_REFRESH_RATE_Hz;
it.it_value.tv_sec = it.it_interval.tv_sec;
it.it_value.tv_usec = it.it_interval.tv_usec;
setitimer( ITIMER_REAL, &it, ( struct itimerval* )0 );
if ( config.monitor )
/* Invoke Monitor */
Monitor();
else
/* Call Emulator directly */
Emulator();
/* never reached */
return EXIT_SUCCESS;
}