delete old code
This commit is contained in:
parent
6ce42fb6b8
commit
a31bfcec42
5 changed files with 0 additions and 2764 deletions
1692
src/_archive/x11.c
1692
src/_archive/x11.c
File diff suppressed because it is too large
Load diff
|
@ -1,157 +0,0 @@
|
|||
#ifndef _X11_H
|
||||
#define _X11_H 1
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
saturn - A poor-man's emulator of some HP calculators
|
||||
Copyright (C) 1998-2000 Ivan Cibrario Bertolotti
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the documentation of this program; if not, write to
|
||||
the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
For more information, please contact the author, preferably by email,
|
||||
at the following address:
|
||||
|
||||
Ivan Cibrario Bertolotti
|
||||
IRITI - National Research Council
|
||||
c/o IEN "Galileo Ferraris"
|
||||
Strada delle Cacce, 91
|
||||
10135 - Torino (ITALY)
|
||||
|
||||
email: cibrario@iriti.cnr.it
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* +-+ */
|
||||
|
||||
/* .+
|
||||
|
||||
.identifier : $Id: x11.h,v 4.1 2000/12/11 09:54:19 cibrario Rel $
|
||||
.context : SATURN, Saturn CPU / HP48 emulator
|
||||
.title : $RCSfile: x11.h,v $
|
||||
.kind : C header
|
||||
.author : Ivan Cibrario B.
|
||||
.site : CSTV-CNR
|
||||
.creation : 17-Feb-1998
|
||||
.keywords : *
|
||||
.description :
|
||||
X11 header.
|
||||
|
||||
.include : *
|
||||
|
||||
.notes :
|
||||
$Log: x11.h,v $
|
||||
Revision 4.1 2000/12/11 09:54:19 cibrario
|
||||
Public release.
|
||||
|
||||
Revision 3.15 2000/11/15 14:14:45 cibrario
|
||||
GUI enhancements and assorted bug fixes:
|
||||
|
||||
- Defined new condition codes: X11_W_TOO_MANY_MSG and X11_F_NO_KEYS
|
||||
|
||||
Revision 3.14 2000/11/13 11:31:16 cibrario
|
||||
Implemented fast load/save; improved keyboard interface emulation at
|
||||
high emulated CPU speed:
|
||||
|
||||
- Revision number bump with no changes
|
||||
|
||||
Revision 3.13 2000/11/09 11:38:50 cibrario
|
||||
Revised to add file selection box GUI element, CPU halt/run
|
||||
requests and emulator's extended functions:
|
||||
|
||||
- New data type: FsbContinuation
|
||||
- New status codes: X11_I_HIER, X11_I_HIER_NC, X11_W_NO_FSB_CONT,
|
||||
X11_E_NO_FSB_TSEG
|
||||
- New prototype: ActivateFSB()
|
||||
|
||||
Revision 3.10 2000/10/24 16:15:04 cibrario
|
||||
Added/Replaced GPL header
|
||||
|
||||
Revision 3.1 2000/09/20 14:02:31 cibrario
|
||||
Revised to implement passive CPU shutdown:
|
||||
- added prototype of IdleXLoop()
|
||||
|
||||
* Revision 2.8 2000/09/19 12:57:35 cibrario
|
||||
* Minor revision to both Saturn.ad and x11.c, to allow keyboard
|
||||
* shortcuts to work on the whole surface of the application's window.
|
||||
*
|
||||
* Revision 2.3 2000/09/12 12:38:10 cibrario
|
||||
* Added definition of X11_RCS_INFO (RCS identification of GUI subsystem)
|
||||
*
|
||||
* Revision 1.2 2000/09/08 15:29:07 cibrario
|
||||
* Changes required by the new GUI:
|
||||
* - Updated templates of status codes X11_I_KEY_PRESS and
|
||||
* X11_I_KEY_RELEASE.
|
||||
* - Removed status code X11_I_X_EVENT.
|
||||
* - Added status codes X11_I_FACE, X11_I_NKEYS, X11_I_KEY,
|
||||
* X11_I_FOUND_CS, X11_W_BAD_ACTION_CALL, X11_W_UNKNOWN_ATOM,
|
||||
* X11_E_NO_WM_COMMAND.
|
||||
* - Declared prototype of new function InitializeGui().
|
||||
*
|
||||
* Revision 1.1 1998/02/19 11:42:59 cibrario
|
||||
* Initial revision
|
||||
*
|
||||
|
||||
.- */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Macro/Data type definitions
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#define X11_RCS_INFO "$Revision: 4.1 $ $State: Rel $"
|
||||
|
||||
typedef void ( *FsbContinuation )( int proceed, char* file_name );
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Global variables
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Chf condition codes
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#define X11_I_CALLED 101 /* Function %s called */
|
||||
#define X11_I_LCD_PAR 102 /* LCD Parameter %s: %x */
|
||||
#define X11_I_LCD_EXPOSE 103 /* LCD X Expose event, count=%d */
|
||||
#define X11_I_KEY_PRESS 104 /* 2.1: Pressed key %s */
|
||||
#define X11_I_KEY_RELEASE 105 /* 2.1: Released key %s */
|
||||
#define X11_I_REVISION 107 /* X11 interface revision: %s */
|
||||
#define X11_I_USAGE 108 /* Usage %s: ... */
|
||||
#define X11_I_FACE 109 /* Selected face %s */
|
||||
#define X11_I_NKEYS 110 /* The face has %d keys */
|
||||
#define X11_I_KEY 111 /* Creating key %d, inOut %s */
|
||||
#define X11_I_FOUND_CS 112 /* Found cs widget %s, value %s */
|
||||
#define X11_I_HIER 113 /* Traversing widget %s */
|
||||
#define X11_I_HIER_NC 114 /* Current widget has %d children */
|
||||
#define X11_W_BAD_ACTION_CALL 201 /* Xt Action called with %d args */
|
||||
#define X11_W_UNKNOWN_ATOM 202 /* X Atom %s unknown */
|
||||
#define X11_W_NO_FSB_CONT 203 /* 3.13: FSB continuation not set */
|
||||
#define X11_W_TOO_MANY_MSG 204 /* 3.15: Too many messages (max %d) */
|
||||
#define X11_E_BAD_OPTION 301 /* Invalid option: %s */
|
||||
#define X11_E_NO_WM_COMMAND 302 /* WM_COMMAND property bad/not set */
|
||||
#define X11_E_NO_FSB_TSEG 303 /* 3.13: No txt seg in fsb XmString */
|
||||
#define X11_F_X_ERROR 401 /* X Window System fatal error */
|
||||
#define X11_F_NO_KEYS 402 /* 3.15: Face has no keys */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Function prototypes
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
void HandleXEvents( void ); /* used in emulator.c */
|
||||
void IdleXLoop( unsigned long max_wait ); /* used in emulator.c */
|
||||
|
||||
void InitializeGui( int argc, char* argv[] ); /* used in main.c */
|
||||
|
||||
void ActivateFSB( char* title, char* file_name, FsbContinuation continuation ); /* used in x_func.c */
|
||||
|
||||
#endif /*!_X11_H*/
|
|
@ -1,534 +0,0 @@
|
|||
/* -------------------------------------------------------------------------
|
||||
saturn - A poor-man's emulator of some HP calculators
|
||||
Copyright (C) 1998-2000 Ivan Cibrario Bertolotti
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the documentation of this program; if not, write to
|
||||
the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
For more information, please contact the author, preferably by email,
|
||||
at the following address:
|
||||
|
||||
Ivan Cibrario Bertolotti
|
||||
IRITI - National Research Council
|
||||
c/o IEN "Galileo Ferraris"
|
||||
Strada delle Cacce, 91
|
||||
10135 - Torino (ITALY)
|
||||
|
||||
email: cibrario@iriti.cnr.it
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* +-+ */
|
||||
|
||||
/* .+
|
||||
|
||||
.identifier : $Id: display.c,v 4.1.1.1 2002/11/11 16:12:46 cibrario Exp $
|
||||
.context : SATURN, Saturn CPU / HP48 emulator
|
||||
.title : $RCSfile: display.c,v $
|
||||
.kind : C source
|
||||
.author : Ivan Cibrario B.
|
||||
.site : CSTV-CNR
|
||||
.creation : 29-Jan-1998
|
||||
.keywords : *
|
||||
.description :
|
||||
This source module emulates the Lcd driver of the Yorke chip.
|
||||
|
||||
References:
|
||||
|
||||
SASM.DOC by HP (HORN disk 4)
|
||||
Guide to the Saturn Processor Rev. 0.00f by Matthew Mastracci
|
||||
entries.srt by Mika Heiskanen (mheiskan@vipunen.hut.fi)
|
||||
x48 source code by Eddie C. Dost (ecd@dressler.de)
|
||||
|
||||
NOTE: In the current (r1.1) implementation, the control fields
|
||||
mod_status.hdw.lcd_offset and mod_status.hdw.lcd_contrast are
|
||||
not supported. Therefore, the emulation accuracy is sometimes
|
||||
poor; for example, the Equation Writer does not work well with
|
||||
large equations.
|
||||
|
||||
.include : config.h, machdep.h, cpu.h, modules.h, display.h
|
||||
|
||||
.notes :
|
||||
$Log: display.c,v $
|
||||
Revision 4.1.1.1 2002/11/11 16:12:46 cibrario
|
||||
Small screen support; preliminary
|
||||
|
||||
Revision 4.1 2000/12/11 09:54:19 cibrario
|
||||
Public release.
|
||||
|
||||
Revision 3.10 2000/10/24 16:14:37 cibrario
|
||||
Added/Replaced GPL header
|
||||
|
||||
Revision 3.8 2000/10/23 13:15:36 cibrario
|
||||
Bug fix:
|
||||
In InitLcd(), added a clip rectangle to GC, to avoid drawing non-existent
|
||||
pixels, that is, pixels that *do* exist in the frame buffer, but should
|
||||
never be viewed on screen.
|
||||
|
||||
Revision 3.5 2000/10/02 09:44:42 cibrario
|
||||
Linux support:
|
||||
- gcc does not like array subscripts with type 'char', and it is right.
|
||||
|
||||
Revision 3.1 2000/09/20 13:47:58 cibrario
|
||||
Minor updates and fixes to avoid gcc compiler warnings on Solaris
|
||||
when -ansi -pedantic -Wall options are selected.
|
||||
|
||||
* Revision 1.1 1998/02/17 14:14:39 cibrario
|
||||
* Initial revision
|
||||
*
|
||||
|
||||
.- */
|
||||
|
||||
#ifndef lint
|
||||
static char rcs_id[] = "$Id: display.c,v 4.1.1.1 2002/11/11 16:12:46 cibrario Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <setjmp.h>
|
||||
#include <string.h> /* 3.1: memset() */
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "machdep.h"
|
||||
#include "cpu.h"
|
||||
#include "modules.h"
|
||||
#include "x11_lcd.h"
|
||||
#include "x11.h"
|
||||
#include "debug.h"
|
||||
|
||||
#define CHF_MODULE_ID X11_CHF_MODULE_ID
|
||||
#include "libChf/src/Chf.h"
|
||||
|
||||
#ifndef LCD_MAG
|
||||
# define LCD_MAG 2 /* 4.1.1.1: Compat. default */
|
||||
#endif
|
||||
|
||||
#define NIBBLES_PER_ROW 34 /* 136 pixel total */
|
||||
#define MAX_ROWS 64 /* 64 rows total */
|
||||
#define N_ANN 6 /* # of annunciators */
|
||||
#define LCD_X_ORIGIN 1 + 4 * ( LCD_MAG - 1 ) /* x origin */
|
||||
|
||||
#if LCD_MAG == 1
|
||||
# define LCD_Y_ORIGIN 14 /* y origin */
|
||||
#else
|
||||
# define LCD_Y_ORIGIN 20 /* y origin */
|
||||
#endif
|
||||
|
||||
/* 3.8: Origin and size of clip rectangle */
|
||||
#define LCD_CLIP_X_ORIGIN LCD_X_ORIGIN
|
||||
#define LCD_CLIP_Y_ORIGIN 0 /* Don't clip annunciators */
|
||||
#define LCD_CLIP_WIDTH 131 * LCD_MAG
|
||||
#define LCD_CLIP_HEIGHT LCD_Y_ORIGIN + 64 * LCD_MAG
|
||||
|
||||
#define MASK_ANN_LEFT 0x81 /* Annunciator's bit masks */
|
||||
#define MASK_ANN_RIGHT 0x82
|
||||
#define MASK_ANN_ALPHA 0x84
|
||||
#define MASK_ANN_BATTERY 0x88
|
||||
#define MASK_ANN_BUSY 0x90
|
||||
#define MASK_ANN_IO 0xA0
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Static/Global variables
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
static /*const*/ unsigned char nibble_bitmap_data[ NIBBLE_VALUES ][ LCD_MAG ] = {
|
||||
#if LCD_MAG == 1
|
||||
{ 0x00 }, /* ---- */
|
||||
{ 0x01 }, /* *--- */
|
||||
{ 0x02 }, /* -*-- */
|
||||
{ 0x03 }, /* **-- */
|
||||
{ 0x04 }, /* --*- */
|
||||
{ 0x05 }, /* *-*- */
|
||||
{ 0x06 }, /* -**- */
|
||||
{ 0x07 }, /* ***- */
|
||||
{ 0x08 }, /* ---* */
|
||||
{ 0x09 }, /* *--* */
|
||||
{ 0x0a }, /* -*-* */
|
||||
{ 0x0b }, /* **-* */
|
||||
{ 0x0c }, /* --** */
|
||||
{ 0x0d }, /* *-** */
|
||||
{ 0x0e }, /* -*** */
|
||||
{ 0x0f } /* **** */
|
||||
#elif LCD_MAG == 2
|
||||
{ 0x00, 0x00 }, /* ---- */
|
||||
{ 0x03, 0x03 }, /* *--- */
|
||||
{ 0x0c, 0x0c }, /* -*-- */
|
||||
{ 0x0f, 0x0f }, /* **-- */
|
||||
{ 0x30, 0x30 }, /* --*- */
|
||||
{ 0x33, 0x33 }, /* *-*- */
|
||||
{ 0x3c, 0x3c }, /* -**- */
|
||||
{ 0x3f, 0x3f }, /* ***- */
|
||||
{ 0xc0, 0xc0 }, /* ---* */
|
||||
{ 0xc3, 0xc3 }, /* *--* */
|
||||
{ 0xcc, 0xcc }, /* -*-* */
|
||||
{ 0xcf, 0xcf }, /* **-* */
|
||||
{ 0xf0, 0xf0 }, /* --** */
|
||||
{ 0xf3, 0xf3 }, /* *-** */
|
||||
{ 0xfc, 0xfc }, /* -*** */
|
||||
{ 0xff, 0xff } /* **** */
|
||||
#else
|
||||
# error "Bad LCD_MAG; supported values are 1 and 2"
|
||||
#endif
|
||||
};
|
||||
|
||||
#define ANN_X( i ) ( 8 * LCD_MAG + ( 22 * LCD_MAG + 1 ) * i )
|
||||
#define ANN_Y( i ) ( 1 + 3 * ( LCD_MAG - 1 ) )
|
||||
static /*const*/ struct {
|
||||
int mask; /* Bit mask */
|
||||
int x, y; /* Position */
|
||||
int w, h; /* Width, Height */
|
||||
unsigned char bitmap_data[ 24 ]; /* Bitmap data */
|
||||
} ann_data[ N_ANN ] = {
|
||||
{MASK_ANN_LEFT, ANN_X( 0 ), ANN_Y( 0 ), 15, 12, { 0xfe, 0x3f, 0xff, 0x7f, 0x9f, 0x7f, 0xcf, 0x7f, 0xe7, 0x7f, 0x03, 0x78,
|
||||
0x03, 0x70, 0xe7, 0x73, 0xcf, 0x73, 0x9f, 0x73, 0xff, 0x73, 0xfe, 0x33 } },
|
||||
{MASK_ANN_RIGHT, ANN_X( 1 ), ANN_Y( 1 ), 15, 12, { 0xfe, 0x3f, 0xff, 0x7f, 0xff, 0x7c, 0xff, 0x79, 0xff, 0x73, 0x0f, 0x60,
|
||||
0x07, 0x60, 0xe7, 0x73, 0xe7, 0x79, 0xe7, 0x7c, 0xe7, 0x7f, 0xe6, 0x3f } },
|
||||
{MASK_ANN_ALPHA, ANN_X( 2 ), ANN_Y( 2 ), 15, 12, { 0xe0, 0x03, 0x18, 0x44, 0x0c, 0x4c, 0x06, 0x2c, 0x07, 0x2c, 0x07, 0x1c,
|
||||
0x07, 0x0c, 0x07, 0x0c, 0x07, 0x0e, 0x0e, 0x4d, 0xf8, 0x38, 0x00, 0x00 } },
|
||||
{MASK_ANN_BATTERY, ANN_X( 3 ), ANN_Y( 3 ), 15, 12, { 0x04, 0x10, 0x02, 0x20, 0x12, 0x24, 0x09, 0x48, 0xc9, 0x49, 0xc9, 0x49,
|
||||
0xc9, 0x49, 0x09, 0x48, 0x12, 0x24, 0x02, 0x20, 0x04, 0x10, 0x00, 0x00 }},
|
||||
{MASK_ANN_BUSY, ANN_X( 4 ), ANN_Y( 4 ), 15, 12, { 0xfc, 0x1f, 0x08, 0x08, 0x08, 0x08, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01,
|
||||
0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0xc8, 0x09, 0xe8, 0x0b, 0xfc, 0x1f } },
|
||||
{MASK_ANN_IO, ANN_X( 5 ), ANN_Y( 5 ), 15, 12, { 0x0c, 0x00, 0x1e, 0x00, 0x33, 0x0c, 0x61, 0x18, 0xcc, 0x30, 0xfe, 0x7f,
|
||||
0xfe, 0x7f, 0xcc, 0x30, 0x61, 0x18, 0x33, 0x0c, 0x1e, 0x00, 0x0c, 0x00 } }
|
||||
};
|
||||
|
||||
static Nibble lcd_buffer[ MAX_ROWS ][ NIBBLES_PER_ROW ];
|
||||
static int ann_buffer;
|
||||
static int clean;
|
||||
|
||||
static Display* display;
|
||||
static Window window;
|
||||
static GC gc;
|
||||
static unsigned long fg_pixel, bg_pixel;
|
||||
static unsigned int depth;
|
||||
|
||||
static Pixmap nibble_pixmap[ NIBBLE_VALUES ];
|
||||
static Pixmap ann_pixmap[ N_ANN ];
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Private functions
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/* .+
|
||||
|
||||
.title : InitPixmaps
|
||||
.kind : C function
|
||||
.creation : 29-Jan-1998
|
||||
.description :
|
||||
This function initializes the pixmaps for the Lcd screen elements and
|
||||
stores them into the appropriate global variables.
|
||||
|
||||
.call :
|
||||
InitPixmaps();
|
||||
.input :
|
||||
void
|
||||
.output :
|
||||
void
|
||||
.status_codes :
|
||||
X11_I_CALLED
|
||||
X11_F_X_ERROR
|
||||
.notes :
|
||||
1.1, 29-Jan-1998, creation
|
||||
|
||||
.- */
|
||||
static void InitPixmaps( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
debug1( DEBUG_C_TRACE, X11_I_CALLED, "InitPixmaps" );
|
||||
|
||||
/* Initialize nibble_pixmap */
|
||||
for ( i = 0; i < NIBBLE_VALUES; i++ ) {
|
||||
if ( ( nibble_pixmap[ i ] = XCreatePixmapFromBitmapData( display, window, ( char* )nibble_bitmap_data[ i ], 4 * LCD_MAG, LCD_MAG,
|
||||
fg_pixel, bg_pixel, depth ) ) == None ) {
|
||||
ChfCondition X11_F_X_ERROR, CHF_FATAL ChfEnd;
|
||||
ChfSignal();
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize ann_pixmap */
|
||||
for ( i = 0; i < N_ANN; i++ ) {
|
||||
if ( ( ann_pixmap[ i ] = XCreatePixmapFromBitmapData( display, window, ( char* )ann_data[ i ].bitmap_data, ann_data[ i ].w,
|
||||
ann_data[ i ].h, fg_pixel, bg_pixel, depth ) ) == None ) {
|
||||
ChfCondition X11_F_X_ERROR, CHF_FATAL ChfEnd;
|
||||
ChfSignal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* .+
|
||||
|
||||
.title : ClearLcd
|
||||
.kind : C function
|
||||
.creation : 29-Jan-1998
|
||||
.description :
|
||||
This function clears the Lcd screen
|
||||
|
||||
.call :
|
||||
ClearLcd();
|
||||
.input :
|
||||
void
|
||||
.output :
|
||||
void
|
||||
.status_codes :
|
||||
X11_I_CALLED
|
||||
.notes :
|
||||
1.1, 29-Jan-1998, creation
|
||||
|
||||
.- */
|
||||
static void ClearLcd( void )
|
||||
{
|
||||
debug1( DEBUG_C_TRACE, X11_I_CALLED, "ClearLcd" );
|
||||
|
||||
/* Clear Lcd display */
|
||||
( void )memset( ( void* )lcd_buffer, 0, sizeof( lcd_buffer ) );
|
||||
ann_buffer = 0;
|
||||
|
||||
XClearWindow( display, window );
|
||||
XFlush( display );
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Public funcitons
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/* .+
|
||||
|
||||
.title : InitLcd
|
||||
.kind : C function
|
||||
.creation : 29-Jan-1998
|
||||
.description :
|
||||
This function initializes the Lcd driver emulator and prepares it for use.
|
||||
The LCD screen is initially cleared.
|
||||
|
||||
.call :
|
||||
InitLcd(lcd_display, lcd_window, lcd_fg_pixel, lcd_bg_pixel);
|
||||
.input :
|
||||
Display *lcd_display, X display
|
||||
Window lcd_window, X window to be used for display
|
||||
unsigned long lcd_fg_pixel, foreground color to be used
|
||||
unsigned long lcd_bg_pixel, background color to be used
|
||||
.output :
|
||||
void
|
||||
.status_codes :
|
||||
X11_I_CALLED
|
||||
X11_F_X_ERROR
|
||||
.notes :
|
||||
1.1, 29-Jan-1998, creation
|
||||
3.8, 23-Oct-2000, bug fix:
|
||||
- added clip rectangle to GC, to avoid drawing non-existent pixels.
|
||||
|
||||
.- */
|
||||
void InitLcd( Display* lcd_display, Window lcd_window, unsigned long lcd_fg_pixel, unsigned long lcd_bg_pixel )
|
||||
{
|
||||
XWindowAttributes xwa;
|
||||
XGCValues gc_values;
|
||||
|
||||
debug1( DEBUG_C_TRACE, X11_I_CALLED, "InitLcdWindow" );
|
||||
|
||||
display = lcd_display;
|
||||
window = lcd_window;
|
||||
fg_pixel = lcd_fg_pixel;
|
||||
bg_pixel = lcd_bg_pixel;
|
||||
|
||||
/* Get window attributes and initialize window depth */
|
||||
if ( XGetWindowAttributes( display, window, &xwa ) == 0 ) {
|
||||
ChfCondition X11_F_X_ERROR, CHF_FATAL ChfEnd;
|
||||
ChfSignal();
|
||||
}
|
||||
|
||||
depth = xwa.depth;
|
||||
|
||||
/* Create GC */
|
||||
gc_values.function = GXcopy;
|
||||
gc_values.plane_mask = AllPlanes;
|
||||
gc_values.subwindow_mode = IncludeInferiors;
|
||||
gc_values.foreground = lcd_fg_pixel;
|
||||
gc_values.background = lcd_bg_pixel;
|
||||
gc_values.graphics_exposures = False;
|
||||
|
||||
gc = XCreateGC( display, window, GCFunction | GCPlaneMask | GCForeground | GCBackground | GCSubwindowMode | GCGraphicsExposures,
|
||||
&gc_values );
|
||||
|
||||
{
|
||||
/* 3.8: This clip rectangle prevents XCopyArea() (in DrawLcd()) from
|
||||
drawing non-visible pixels
|
||||
*/
|
||||
XRectangle rect[ 1 ];
|
||||
|
||||
rect[ 0 ].x = LCD_CLIP_X_ORIGIN; /* This is the clip rectangle */
|
||||
rect[ 0 ].y = LCD_CLIP_Y_ORIGIN;
|
||||
rect[ 0 ].width = LCD_CLIP_WIDTH;
|
||||
rect[ 0 ].height = LCD_CLIP_HEIGHT;
|
||||
|
||||
XSetClipRectangles( display, gc, 0, 0, /* Alsolute clip X,Y origin */
|
||||
rect, 1, YXBanded );
|
||||
}
|
||||
|
||||
/* Initialize Pixmaps */
|
||||
InitPixmaps();
|
||||
|
||||
/* Clear screen and initialize the static memory areas */
|
||||
ClearLcd();
|
||||
|
||||
/* Set the 'display is clean' flag */
|
||||
clean = 1;
|
||||
}
|
||||
|
||||
/* .+
|
||||
|
||||
.title : DrawLcd
|
||||
.kind : C function
|
||||
.creation : 29-Jan-1998
|
||||
.description :
|
||||
This function redraws the Lcd screen from the information contained in
|
||||
the mod_status.hdw structure.
|
||||
|
||||
.call :
|
||||
DrawLcd();
|
||||
.input :
|
||||
void
|
||||
.output :
|
||||
void
|
||||
.status_codes :
|
||||
X11_I_CALLED
|
||||
X11_I_LCD_PAR
|
||||
.notes :
|
||||
1.1, 29-Jan-1998, creation
|
||||
|
||||
.- */
|
||||
void DrawLcd( void )
|
||||
{
|
||||
Address addr = mod_status.hdw.lcd_base_addr;
|
||||
int y, x;
|
||||
Nibble v;
|
||||
|
||||
debug1( DEBUG_C_TRACE, X11_I_CALLED, "DrawLcd" );
|
||||
|
||||
/* If the debug class DEBUG_C_DISPLAY is enabled, print the display
|
||||
parameters
|
||||
*/
|
||||
debug2( DEBUG_C_DISPLAY, X11_I_LCD_PAR, "_base_addr", ( int )mod_status.hdw.lcd_base_addr );
|
||||
|
||||
debug2( DEBUG_C_DISPLAY, X11_I_LCD_PAR, "_on", ( int )mod_status.hdw.lcd_on );
|
||||
|
||||
debug2( DEBUG_C_DISPLAY, X11_I_LCD_PAR, "_contrast", ( int )mod_status.hdw.lcd_contrast );
|
||||
|
||||
debug2( DEBUG_C_DISPLAY, X11_I_LCD_PAR, "_vlc", ( int )mod_status.hdw.lcd_vlc );
|
||||
|
||||
debug2( DEBUG_C_DISPLAY, X11_I_LCD_PAR, "_offset", ( int )mod_status.hdw.lcd_offset );
|
||||
|
||||
debug2( DEBUG_C_DISPLAY, X11_I_LCD_PAR, "_line_offset", ( int )mod_status.hdw.lcd_line_offset );
|
||||
|
||||
debug2( DEBUG_C_DISPLAY, X11_I_LCD_PAR, "_menu_addr", ( int )mod_status.hdw.lcd_menu_addr );
|
||||
|
||||
debug2( DEBUG_C_DISPLAY, X11_I_LCD_PAR, "_ann", ( int )mod_status.hdw.lcd_ann );
|
||||
|
||||
/* Check if display is on */
|
||||
if ( !mod_status.hdw.lcd_on ) {
|
||||
/* Display is off; clear lcd if necessary */
|
||||
if ( !clean ) {
|
||||
/* Set the 'display is clean' flag and clear the screen */
|
||||
clean = 1;
|
||||
ClearLcd();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* The display is on and will be no longer clean */
|
||||
clean = 0;
|
||||
|
||||
/* Scan active display rows */
|
||||
for ( y = 0; y <= mod_status.hdw.lcd_vlc; y++ ) {
|
||||
/* Scan columns */
|
||||
for ( x = 0; x < NIBBLES_PER_ROW; x++ ) {
|
||||
v = FetchNibble( addr++ );
|
||||
if ( v != lcd_buffer[ y ][ x ] ) {
|
||||
lcd_buffer[ y ][ x ] = v;
|
||||
|
||||
XCopyArea( display, nibble_pixmap[ ( int )v ], window, gc, 0, 0, /* src_x, src_y */
|
||||
4 * LCD_MAG, LCD_MAG, /* width, height */
|
||||
x * 4 * LCD_MAG + LCD_X_ORIGIN, y * LCD_MAG + LCD_Y_ORIGIN );
|
||||
}
|
||||
}
|
||||
|
||||
addr += mod_status.hdw.lcd_line_offset;
|
||||
}
|
||||
|
||||
/* Scan menu display rows */
|
||||
addr = mod_status.hdw.lcd_menu_addr;
|
||||
for ( ; y < MAX_ROWS; y++ ) {
|
||||
/* Scan columns */
|
||||
for ( x = 0; x < NIBBLES_PER_ROW; x++ ) {
|
||||
v = FetchNibble( addr++ );
|
||||
if ( v != lcd_buffer[ y ][ x ] ) {
|
||||
lcd_buffer[ y ][ x ] = v;
|
||||
|
||||
XCopyArea( display, nibble_pixmap[ ( int )v ], window, gc, 0, 0, /* src_x, src_y */
|
||||
4 * LCD_MAG, LCD_MAG, /* width, height */
|
||||
x * 4 * LCD_MAG + LCD_X_ORIGIN, y * LCD_MAG + LCD_Y_ORIGIN );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan annunciators */
|
||||
if ( mod_status.hdw.lcd_ann != ann_buffer ) {
|
||||
ann_buffer = mod_status.hdw.lcd_ann;
|
||||
|
||||
for ( y = 0; y < N_ANN; y++ ) {
|
||||
if ( ( ann_buffer & ann_data[ y ].mask ) == ann_data[ y ].mask ) {
|
||||
XCopyArea( display, ann_pixmap[ y ], window, gc, 0, 0, /* src_x, src_y */
|
||||
ann_data[ y ].w, ann_data[ y ].h, /* width, height */
|
||||
ann_data[ y ].x, ann_data[ y ].y );
|
||||
} else {
|
||||
XClearArea( display, window, ann_data[ y ].x, ann_data[ y ].y, ann_data[ y ].w, ann_data[ y ].h, False /* No exposures */
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Flush display */
|
||||
XFlush( display );
|
||||
}
|
||||
|
||||
/* .+
|
||||
|
||||
.title : RefreshLcd
|
||||
.kind : C function
|
||||
.creation : 17-Feb-1998
|
||||
.description :
|
||||
This function refreshes the Lcd screen after a X Window Expose event.
|
||||
|
||||
.call :
|
||||
RefreshLcd();
|
||||
.input :
|
||||
void
|
||||
.output :
|
||||
void
|
||||
.status_codes :
|
||||
X11_I_CALLED
|
||||
.notes :
|
||||
1.1, 17-Feb-1998, creation
|
||||
|
||||
.- */
|
||||
void RefreshLcd( void )
|
||||
{
|
||||
debug1( DEBUG_C_TRACE, X11_I_CALLED, "RefreshLcd" );
|
||||
|
||||
ClearLcd();
|
||||
DrawLcd();
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
#ifndef _DISPLAY_H
|
||||
#define _DISPLAY_H 1
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
saturn - A poor-man's emulator of some HP calculators
|
||||
Copyright (C) 1998-2000 Ivan Cibrario Bertolotti
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the documentation of this program; if not, write to
|
||||
the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
For more information, please contact the author, preferably by email,
|
||||
at the following address:
|
||||
|
||||
Ivan Cibrario Bertolotti
|
||||
IRITI - National Research Council
|
||||
c/o IEN "Galileo Ferraris"
|
||||
Strada delle Cacce, 91
|
||||
10135 - Torino (ITALY)
|
||||
|
||||
email: cibrario@iriti.cnr.it
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* +-+ */
|
||||
|
||||
/* .+
|
||||
|
||||
.identifier : $Id: display.h,v 4.1 2000/12/11 09:54:19 cibrario Rel $
|
||||
.context : SATURN, Saturn CPU / HP48 emulator
|
||||
.title : $RCSfile: display.h,v $
|
||||
.kind : C header
|
||||
.author : Ivan Cibrario B.
|
||||
.site : CSTV-CNR
|
||||
.creation : 28-Jan-1998
|
||||
.keywords : *
|
||||
.description :
|
||||
This header contains all definitions and declarations related to the
|
||||
HP48's LCD display emulator. References:
|
||||
|
||||
SASM.DOC by HP (HORN disk 4)
|
||||
Guide to the Saturn Processor Rev. 0.00f by Matthew Mastracci
|
||||
entries.srt by Mika Heiskanen (mheiskan@vipunen.hut.fi)
|
||||
x48 source code by Eddie C. Dost (ecd@dressler.de)
|
||||
|
||||
.include : config.h, machdep.h, cpu.h, modules.h, X11/Xlib.h
|
||||
|
||||
.notes :
|
||||
$Log: display.h,v $
|
||||
Revision 4.1 2000/12/11 09:54:19 cibrario
|
||||
Public release.
|
||||
|
||||
Revision 3.10 2000/10/24 16:14:38 cibrario
|
||||
Added/Replaced GPL header
|
||||
|
||||
Revision 1.1 1998/02/17 11:51:31 cibrario
|
||||
Initial revision
|
||||
|
||||
|
||||
.- */
|
||||
|
||||
#include <X11/Xlib.h> /* for InitLcd ( Display* ; Window ) */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Data type definitions - require config.h, machdep.h, cpu.h
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Macros
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Global variables
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Function prototypes
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
void InitLcd( Display* lcd_display, Window lcd_window, unsigned long lcd_fg_pixel, unsigned long lcd_bg_pixel ); /* used in x11.c */
|
||||
|
||||
void DrawLcd( void ); /* used in emulator.c */
|
||||
void RefreshLcd( void ); /* used in x11.c */
|
||||
|
||||
#endif /*!_DISPLAY_H*/
|
|
@ -1,286 +0,0 @@
|
|||
/* -------------------------------------------------------------------------
|
||||
saturn - A poor-man's emulator of some HP calculators
|
||||
Copyright (C) 1998-2000 Ivan Cibrario Bertolotti
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the documentation of this program; if not, write to
|
||||
the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
For more information, please contact the author, preferably by email,
|
||||
at the following address:
|
||||
|
||||
Ivan Cibrario Bertolotti
|
||||
IRITI - National Research Council
|
||||
c/o IEN "Galileo Ferraris"
|
||||
Strada delle Cacce, 91
|
||||
10135 - Torino (ITALY)
|
||||
|
||||
email: cibrario@iriti.cnr.it
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* +-+ */
|
||||
|
||||
/* .+
|
||||
|
||||
.identifier : $Id: saturn.c,v 4.1 2000/12/11 09:54:19 cibrario Rel $
|
||||
.context : SATURN, Saturn CPU / HP48 emulator
|
||||
.title : $RCSfile: saturn.c,v $
|
||||
.kind : C source
|
||||
.author : Ivan Cibrario B.
|
||||
.site : CSTV-CNR
|
||||
.creation : 8-Sep-2000
|
||||
.keywords : *
|
||||
.description :
|
||||
This file contains the main program of the Saturn CPU / HP4x emulator
|
||||
|
||||
.include : *
|
||||
|
||||
.notes :
|
||||
$Log: saturn.c,v $
|
||||
Revision 4.1 2000/12/11 09:54:19 cibrario
|
||||
Public release.
|
||||
|
||||
Revision 3.15 2000/11/15 14:07:53 cibrario
|
||||
GUI enhancements and assorted bug fixes:
|
||||
|
||||
- made Chf initialization more robust with respect to incorrect
|
||||
locale settings
|
||||
|
||||
- made stand-alone messages conforming to Chf standard format
|
||||
|
||||
- the copyright notice is now output through the GUI, too, if stdout
|
||||
is not a tty
|
||||
|
||||
Revision 3.14 2000/11/13 11:31:16 cibrario
|
||||
Implemented fast load/save; improved keyboard interface emulation at
|
||||
high emulated CPU speed:
|
||||
|
||||
- Revision number bump with no changes
|
||||
|
||||
Revision 3.11 2000/10/25 11:14:35 cibrario
|
||||
*** empty log message ***
|
||||
|
||||
Revision 3.10 2000/10/24 16:14:56 cibrario
|
||||
Added/Replaced GPL header
|
||||
|
||||
Revision 3.9 2000/10/24 16:11:20 cibrario
|
||||
The main program now has its own set of condition codes;
|
||||
added printf of MAIN_M_COPYRIGHT and MAIN_M_LICENSE as suggested by GPL
|
||||
|
||||
Revision 3.8 2000/10/23 13:16:49 cibrario
|
||||
Bug fix:
|
||||
Improper use of sizeof() in main() could give a segmentation fault.
|
||||
|
||||
Revision 3.1 2000/09/20 13:58:41 cibrario
|
||||
Minor updates and fixes to avoid gcc compiler warnings on Solaris
|
||||
when -ansi -pedantic -Wall options are selected.
|
||||
|
||||
* Revision 2.5 2000/09/14 15:32:07 cibrario
|
||||
* Added invotation of SerialInit() in main program, to initialize
|
||||
* the serial port emulation module.
|
||||
*
|
||||
* Revision 2.1 2000/09/08 15:46:02 cibrario
|
||||
* *** empty log message ***
|
||||
*
|
||||
|
||||
.- */
|
||||
|
||||
#ifndef lint
|
||||
static char rcs_id[] = "$Id: saturn.c,v 4.1 2000/12/11 09:54:19 cibrario Rel $";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
// #include <setjmp.h>
|
||||
#include <string.h> /* 3.1: strcpy(), strcat() */
|
||||
#include <unistd.h> /* isatty() */
|
||||
|
||||
#include "config.h"
|
||||
#include "machdep.h"
|
||||
#include "cpu.h"
|
||||
#include "x11.h"
|
||||
#include "serial.h"
|
||||
#include "debug.h"
|
||||
#include "monitor.h"
|
||||
|
||||
/* Chf condition codes (main program only) */
|
||||
|
||||
#define CHF_MODULE_ID MAIN_CHF_MODULE_ID
|
||||
#include "libChf/src/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" );
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Public functions
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/* .+
|
||||
|
||||
.title : main
|
||||
.kind : C function
|
||||
.creation : 8-Sep-2000
|
||||
.description :
|
||||
Main program.
|
||||
|
||||
.notes :
|
||||
2.1, 6-Sep-2000, creation
|
||||
2.5, 14-Sep-2000, update
|
||||
- added invotation of SerialInit().
|
||||
3.9, 23-Oct-2000, update
|
||||
- main() now has its own set of condition codes
|
||||
3.15, 15-Nov-2000, update
|
||||
- made Chf initialization more robust with respect to bad locales
|
||||
|
||||
.- */
|
||||
int main( int argc, char* 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;
|
||||
|
||||
/* 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, "" ) ); */
|
||||
|
||||
/* Initialize GUI and associated lcd display emulation module */
|
||||
InitializeGui( argc, argv );
|
||||
|
||||
/* Initialize serial port emulation.
|
||||
This function returns the name of the slave side of the pty;
|
||||
it is unused here, because the GUI condition handler intercepts
|
||||
a condition containing the same information and displays the pty name
|
||||
on the main emulator's window.
|
||||
*/
|
||||
( void )SerialInit();
|
||||
|
||||
/* Initialize emulator proper */
|
||||
EmulatorInit();
|
||||
|
||||
/* 3.15: Repeat copyright message on GUI if stdout is not a tty */
|
||||
if ( !isatty( fileno( stdout ) ) ) {
|
||||
ChfCondition MAIN_M_LICENSE, CHF_INFO ChfEnd;
|
||||
ChfCondition MAIN_M_COPYRIGHT, CHF_INFO, "$Revision: 4.1 $" ChfEnd;
|
||||
|
||||
ChfSignal();
|
||||
}
|
||||
|
||||
if ( args.monitor )
|
||||
/* Invoke Monitor */
|
||||
Monitor();
|
||||
else
|
||||
/* Call Emulator directly */
|
||||
Emulator();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in a new issue