repo
string | commit
string | message
string | diff
string |
---|---|---|---|
bcd/exec09
|
4bd5b781ce6138c078935778808cc22128459cd2
|
Write timing results to log file when LOG6809 environment variable is set. The value indicates the filename to use.
|
diff --git a/6809.c b/6809.c
index eb16312..fd66bbd 100644
--- a/6809.c
+++ b/6809.c
@@ -1,663 +1,676 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include "monitor.h"
#include <stdarg.h>
unsigned X, Y, S, U, PC;
unsigned A, B, DP;
unsigned H, N, Z, OV, C;
unsigned EFI;
#ifdef H6309
unsigned E, F, V, MD;
#define MD_NATIVE 0x1 /* if 1, execute in 6309 mode */
#define MD_FIRQ_LIKE_IRQ 0x2 /* if 1, FIRQ acts like IRQ */
#define MD_ILL 0x40 /* illegal instruction */
#define MD_DBZ 0x80 /* divide by zero */
#endif /* H6309 */
unsigned iPC;
unsigned long irq_start_time;
unsigned ea = 0;
long cpu_clk = 0;
long cpu_period = 0;
int cpu_quit = 1;
unsigned int irqs_pending = 0;
unsigned int firqs_pending = 0;
unsigned int cc_changed = 0;
unsigned *index_regs[4] = { &X, &Y, &U, &S };
extern int dump_cycles_on_success;
extern int trace_enabled;
extern void irq (void);
extern void firq (void);
void request_irq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
irqs_pending |= (1 << source);
if (!(EFI & I_FLAG))
irq ();
}
void release_irq (unsigned int source)
{
irqs_pending &= ~(1 << source);
}
void request_firq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
firqs_pending |= (1 << source);
if (!(EFI & F_FLAG))
firq ();
}
void release_firq (unsigned int source)
{
firqs_pending &= ~(1 << source);
}
static inline void
check_pc (void)
{
/* TODO */
}
static inline void
check_stack (void)
{
/* TODO */
}
void
sim_error (const char *format, ...)
{
va_list ap;
va_start (ap, format);
fprintf (stderr, "m6809-run: (at PC=%04X) ", iPC);
vfprintf (stderr, format, ap);
va_end (ap);
if (debug_enabled)
monitor_on = 1;
else
exit (2);
}
unsigned long
get_cycles (void)
{
return total + cpu_period - cpu_clk;
}
void
sim_exit (uint8_t exit_code)
{
+ char *s;
/* On a nonzero exit, always print an error message. */
if (exit_code != 0)
{
printf ("m6809-run: program exited with %d\n", exit_code);
if (exit_code)
monitor_backtrace ();
}
/* If a cycle count should be printed, do that last. */
if (dump_cycles_on_success)
{
- printf ("Simulated time : %ld cycles\n", get_cycles ());
+ printf ("%s : %ld cycles, %ld ms\n", prog_name, get_cycles (),
+ get_elapsed_realtime ());
+ }
+
+ if ((s = getenv ("LOG6809")) != NULL)
+ {
+ FILE *fp = fopen (s, "a");
+ if (fp)
+ {
+ fprintf (fp, "%s : %ld cycles, %ld ms\n", prog_name, get_cycles (),
+ get_elapsed_realtime ());
+ fclose (fp);
+ }
}
exit (exit_code);
}
static inline void
change_pc (unsigned newPC)
{
#if 0
/* TODO - will let some RAM execute for trampolines */
if ((newPC < 0x1C00) || (newPC > 0xFFFF))
{
fprintf (stderr, "m6809-run: invalid PC = %04X, previous was %s\n",
newPC, monitor_addr_name (PC));
exit (2);
}
if (trace_enabled)
{
fprintf (stderr, "PC : %s ", monitor_addr_name (PC));
fprintf (stderr, "-> %s\n", monitor_addr_name (newPC));
}
#endif
PC = newPC;
}
static inline unsigned
imm_byte (void)
{
unsigned val = read8 (PC);
PC++;
return val;
}
static inline unsigned
imm_word (void)
{
unsigned val = read16 (PC);
PC += 2;
return val;
}
#define WRMEM(addr, data) write8 (addr, data)
static void
WRMEM16 (unsigned addr, unsigned data)
{
WRMEM (addr, data >> 8);
cpu_clk--;
WRMEM ((addr + 1) & 0xffff, data & 0xff);
}
#define RDMEM(addr) read8 (addr)
static unsigned
RDMEM16 (unsigned addr)
{
unsigned val = RDMEM (addr) << 8;
cpu_clk--;
val |= RDMEM ((addr + 1) & 0xffff);
return val;
}
#define write_stack WRMEM
#define read_stack RDMEM
static void
write_stack16 (unsigned addr, unsigned data)
{
write_stack ((addr + 1) & 0xffff, data & 0xff);
write_stack (addr, data >> 8);
}
static unsigned
read_stack16 (unsigned addr)
{
return (read_stack (addr) << 8) | read_stack ((addr + 1) & 0xffff);
}
static void
direct (void)
{
unsigned val = read8 (PC) | DP;
PC++;
ea = val;
}
static void
indexed (void) /* note take 1 extra cycle */
{
unsigned post = imm_byte ();
unsigned *R = index_regs[(post >> 5) & 0x3];
if (post & 0x80)
{
switch (post & 0x1f)
{
case 0x00:
ea = *R;
*R = (*R + 1) & 0xffff;
cpu_clk -= 6;
break;
case 0x01:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
break;
case 0x02:
*R = (*R - 1) & 0xffff;
ea = *R;
cpu_clk -= 6;
break;
case 0x03:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
break;
case 0x04:
ea = *R;
cpu_clk -= 4;
break;
case 0x05:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
break;
case 0x06:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
break;
case 0x08:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
break;
case 0x09:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
break;
case 0x0d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
break;
case 0x11:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x13:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x14:
ea = *R;
cpu_clk -= 4;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x15:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x16:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x18:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x19:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1f:
ea = imm_word ();
cpu_clk -= 6;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
default:
ea = 0;
sim_error ("invalid index post $%02X\n", post);
break;
}
}
else
{
if (post & 0x10)
post |= 0xfff0;
else
post &= 0x000f;
ea = (*R + post) & 0xffff;
cpu_clk -= 5;
}
}
static void
extended (void)
{
unsigned val = read16 (PC);
PC += 2;
ea = val;
}
/* external register functions */
unsigned
get_a (void)
{
return A;
}
unsigned
get_b (void)
{
return B;
}
unsigned
get_dp (void)
{
return DP >> 8;
}
unsigned
get_x (void)
{
return X;
}
unsigned
get_y (void)
{
return Y;
}
unsigned
get_s (void)
{
return S;
}
unsigned
get_u (void)
{
return U;
}
unsigned
get_pc (void)
{
return PC & 0xffff;
}
unsigned
get_d (void)
{
return (A << 8) | B;
}
unsigned
get_flags (void)
{
return EFI;
}
#ifdef H6309
unsigned
get_e (void)
{
return E;
}
unsigned
get_f (void)
{
return F;
}
unsigned
get_w (void)
{
return (E << 8) | F;
}
unsigned
get_q (void)
{
return (get_w () << 16) | get_d ();
}
unsigned
get_v (void)
{
return V;
}
unsigned
get_zero (void)
{
return 0;
}
unsigned
get_md (void)
{
return MD;
}
#endif
void
set_a (unsigned val)
{
A = val & 0xff;
}
void
set_b (unsigned val)
{
B = val & 0xff;
}
void
set_dp (unsigned val)
{
DP = (val & 0xff) << 8;
}
void
set_x (unsigned val)
{
X = val & 0xffff;
}
void
set_y (unsigned val)
{
Y = val & 0xffff;
}
void
set_s (unsigned val)
{
S = val & 0xffff;
check_stack ();
}
void
set_u (unsigned val)
{
U = val & 0xffff;
}
void
set_pc (unsigned val)
{
PC = val & 0xffff;
check_pc ();
}
void
set_d (unsigned val)
{
A = (val >> 8) & 0xff;
B = val & 0xff;
}
#ifdef H6309
void
set_e (unsigned val)
{
E = val & 0xff;
}
void
set_f (unsigned val)
{
F = val & 0xff;
}
void
set_w (unsigned val)
{
E = (val >> 8) & 0xff;
F = val & 0xff;
}
void
set_q (unsigned val)
{
set_w ((val >> 16) & 0xffff);
set_d (val & 0xffff);
}
void
set_v (unsigned val)
{
V = val & 0xff;
}
void
set_zero (unsigned val)
{
}
void
set_md (unsigned val)
{
MD = val & 0xff;
}
#endif
/* handle condition code register */
unsigned
get_cc (void)
{
unsigned res = EFI & (E_FLAG | F_FLAG | I_FLAG);
if (H & 0x10)
res |= H_FLAG;
if (N & 0x80)
res |= N_FLAG;
if (Z == 0)
res |= Z_FLAG;
if (OV & 0x80)
res |= V_FLAG;
if (C != 0)
res |= C_FLAG;
return res;
}
void
set_cc (unsigned arg)
{
EFI = arg & (E_FLAG | F_FLAG | I_FLAG);
H = (arg & H_FLAG ? 0x10 : 0);
N = (arg & N_FLAG ? 0x80 : 0);
Z = (~arg) & Z_FLAG;
OV = (arg & V_FLAG ? 0x80 : 0);
C = arg & C_FLAG;
cc_changed = 1;
}
void
cc_modified (void)
{
/* Check for pending interrupts */
if (firqs_pending && !(EFI & F_FLAG))
firq ();
else if (irqs_pending && !(EFI & I_FLAG))
irq ();
cc_changed = 0;
}
unsigned
get_reg (unsigned nro)
{
unsigned val = 0xff;
switch (nro)
{
case 0:
val = (A << 8) | B;
break;
diff --git a/6809.h b/6809.h
index d738c06..5e737c0 100644
--- a/6809.h
+++ b/6809.h
@@ -1,244 +1,243 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_H
#define M6809_H
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#else
#error
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
#error
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#else
#error
#endif
typedef uint8_t UINT8;
typedef signed char INT8;
typedef uint16_t UINT16;
typedef signed short INT16;
typedef uint32_t UINT32;
typedef signed int INT32;
typedef uint16_t target_addr_t;
#include "machine.h"
#define E_FLAG 0x80
#define F_FLAG 0x40
#define H_FLAG 0x20
#define I_FLAG 0x10
#define N_FLAG 0x08
#define Z_FLAG 0x04
#define V_FLAG 0x02
#define C_FLAG 0x01
extern int debug_enabled;
extern int need_flush;
extern unsigned long total;
extern int dump_cycles_on_success;
+extern const char *prog_name;
-#ifdef OLDSYS
-extern UINT8 *memory;
-#endif
+long get_elapsed_realtime (void);
/* Primitive read/write macros */
#define read8(addr) cpu_read8 (addr)
#define write8(addr,val) do { cpu_write8 (addr, val); } while (0)
/* 16-bit versions */
#define read16(addr) cpu_read16(addr)
#define write16(addr,val) do { write8(addr+1, val & 0xFF); write8(addr, (val >> 8) & 0xFF); } while (0)
/* Fetch macros */
#define abs_read16(addr) ((abs_read8(addr) << 8) | abs_read8(addr+1))
#define fetch8() abs_read8 (pc++)
#define fetch16() (pc += 2, abs_read16(pc-2))
/* 6809.c */
extern int cpu_quit;
extern int cpu_execute (int);
extern void cpu_reset (void);
extern unsigned get_a (void);
extern unsigned get_b (void);
extern unsigned get_cc (void);
extern unsigned get_dp (void);
extern unsigned get_x (void);
extern unsigned get_y (void);
extern unsigned get_s (void);
extern unsigned get_u (void);
extern unsigned get_pc (void);
extern unsigned get_d (void);
extern unsigned get_flags (void);
extern void set_a (unsigned);
extern void set_b (unsigned);
extern void set_cc (unsigned);
extern void set_dp (unsigned);
extern void set_x (unsigned);
extern void set_y (unsigned);
extern void set_s (unsigned);
extern void set_u (unsigned);
extern void set_pc (unsigned);
extern void set_d (unsigned);
/* fileio.c */
struct pathlist
{
int count;
char *entry[32];
};
void path_init (struct pathlist *path);
void path_add (struct pathlist *path, const char *dir);
FILE * file_open (struct pathlist *path, const char *filename, const char *mode);
FILE * file_require_open (struct pathlist *path, const char *filename, const char *mode);
void file_close (FILE *fp);
/* monitor.c */
extern int monitor_on;
extern int check_break (void);
extern void monitor_init (void);
extern int monitor6809 (void);
extern int dasm (char *, absolute_address_t);
extern int load_hex (char *);
extern int load_s19 (char *);
extern int load_bin (char *,int);
#define MAX_STRINGSPACE 32000
#define MAX_SYMBOL_HASH 1009
#define SYM_DEFAULT 0
#define SYM_AUTO 1
typedef struct
{
unsigned char format;
unsigned int size;
} datatype_t;
/* symtab.c */
struct stringspace
{
char space[32000];
unsigned int used;
};
struct symbol
{
char *name;
unsigned long value;
datatype_t ty;
unsigned int type;
struct symbol *name_chain;
struct symbol *value_chain;
};
struct symtab
{
struct symbol *syms_by_name[MAX_SYMBOL_HASH];
struct symbol *syms_by_value[MAX_SYMBOL_HASH];
struct symtab *parent;
};
extern struct symtab program_symtab;
extern struct symtab internal_symtab;
extern struct symtab auto_symtab;
void sym_add (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
void sym_set (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
int sym_find (struct symtab *symtab, const char *name, unsigned long *value, unsigned int type);
const char *sym_lookup (struct symtab *symtab, unsigned long value);
typedef void (*command_handler_t) (void);
typedef void (*virtual_handler_t) (unsigned long *val, int writep);
typedef unsigned int thread_id_t;
typedef struct
{
unsigned int id : 8;
unsigned int used : 1;
unsigned int enabled : 1;
unsigned int conditional : 1;
unsigned int threaded : 1;
unsigned int on_read : 1;
unsigned int on_write : 1;
unsigned int on_execute : 1;
unsigned int size : 4;
unsigned int keep_running : 1;
unsigned int temp : 1;
unsigned int last_write : 16;
unsigned int write_mask : 16;
absolute_address_t addr;
char condition[128];
thread_id_t tid;
unsigned int pass_count;
unsigned int ignore_count;
} breakpoint_t;
typedef struct
{
int used : 1;
datatype_t type;
char expr[128];
} display_t;
typedef struct
{
int id : 8;
thread_id_t tid;
} thread_t;
#define MAX_BREAKS 32
#define MAX_DISPLAYS 32
#define MAX_HISTORY 10
#define MAX_THREADS 64
void command_irq_hook (unsigned long cycles);
#endif /* M6809_H */
diff --git a/main.c b/main.c
index e778eb5..90e962c 100644
--- a/main.c
+++ b/main.c
@@ -1,408 +1,432 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/time.h>
#include "6809.h"
enum
{ HEX, S19, BIN };
/* The total number of cycles that have executed */
unsigned long total = 0;
/* The frequency of the emulated CPU, in megahertz */
unsigned int mhz = 1;
/* When nonzero, indicates that the IRQ should be triggered periodically,
every so many cycles. By default no periodic IRQ is generated. */
unsigned int cycles_per_irq = 0;
/* When nonzero, indicates that the FIRQ should be triggered periodically,
every so many cycles. By default no periodic FIRQ is generated. */
unsigned int cycles_per_firq = 0;
/* Nonzero if debugging support is turned on */
int debug_enabled = 0;
/* Nonzero if tracing is enabled */
int trace_enabled = 0;
/* When nonzero, causes the program to print the total number of cycles
on a successful exit. */
int dump_cycles_on_success = 0;
/* When nonzero, indicates the total number of cycles before an automated
exit. This is to help speed through test cases that never finish. */
int max_cycles = 100000000;
static int type = S19;
char *exename;
const char *machine_name = "simple";
const char *prog_name = NULL;
FILE *stat_file = NULL;
+struct timeval time_started;
+
+
+/**
+ * Return elapsed real time in milliseconds.
+ */
+long
+time_diff (struct timeval *old, struct timeval *new)
+{
+ long ms = (new->tv_usec - old->tv_usec) / 1000;
+ ms += (new->tv_sec - old->tv_sec) * 1000;
+ return ms;
+}
+
+
+long
+get_elapsed_realtime (void)
+{
+ struct timeval now;
+ gettimeofday (&now, NULL);
+ return time_diff (&time_started, &now);
+}
+
+
void
idle_loop (void)
{
struct timeval now;
static struct timeval last = { 0, 0 };
int real_ms;
static unsigned long last_cycles = 0;
unsigned long cycles;
int sim_ms;
const int cycles_per_ms = 2000;
- static int period = 100;
- static int count = 100;
+ static int period = 30;
+ static int count = 30;
int delay;
static int total_ms_elapsed = 0;
+ static int cumulative_delay = 0;
if (--count > 0)
return;
- if (last.tv_usec == 0)
+ if (last.tv_sec == 0 && last.tv_usec == 0)
gettimeofday (&last, NULL);
gettimeofday (&now, NULL);
- real_ms = (now.tv_usec - last.tv_usec) / 1000;
- if (real_ms < 0)
- real_ms += 1000;
+ real_ms = time_diff (&last, &now);
last = now;
cycles = get_cycles ();
sim_ms = (cycles - last_cycles) / cycles_per_ms;
if (sim_ms < 0)
sim_ms += cycles_per_ms;
last_cycles = cycles;
total_ms_elapsed += sim_ms;
if (total_ms_elapsed > 100)
{
total_ms_elapsed -= 100;
wpc_periodic ();
command_periodic ();
}
delay = sim_ms - real_ms;
- if (delay > 0)
+ cumulative_delay += delay;
+ if (cumulative_delay > 0)
{
- if (delay > 60)
- period -= 5;
- else if (delay < 20)
- period += 5;
- usleep (delay * 1000UL);
+ usleep (50 * 1000UL);
+ cumulative_delay -= 50;
}
count = period;
}
int do_help (const char *arg __attribute__((unused)));
#define NO_NEG 0
#define HAS_NEG 1
#define NO_ARG 0
#define HAS_ARG 1
struct option
{
char o_short;
const char *o_long;
const char *help;
unsigned int can_negate : 1;
unsigned int takes_arg : 1;
int *int_value;
int default_value;
const char **string_value;
int (*handler) (const char *arg);
} option_table[] = {
{ 'd', "debug", "Enter the monitor immediately",
HAS_NEG, NO_ARG, &debug_enabled, 1, NULL, NULL },
{ 'h', "help", NULL,
NO_NEG, NO_ARG, NULL, NULL, 0, do_help },
{ 'b', "binary", "",
NO_NEG, NO_ARG, &type, BIN, NULL, NULL },
{ 'M', "mhz", "", NO_NEG, HAS_ARG },
{ '-', "68a09", "Emulate the 68A09 variation (1.5Mhz)" },
{ '-', "68b09", "Emulate the 68B09 variation (2Mhz)" },
{ 'R', "realtime", "Limit simulation speed to match realtime" },
{ 'I', "irqfreq", "Asserts an IRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_irq, 0, NULL, NULL },
{ 'F', "firqfreq", "Asserts an FIRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_firq, 0, NULL, NULL },
{ 'C', "cycledump", "",
HAS_NEG, NO_ARG, &dump_cycles_on_success, 1, NULL, NULL},
{ 't', "loadmap", "" },
{ 'T', "trace", "",
NO_NEG, NO_ARG, &trace_enabled, 1, NULL, NULL },
{ 'm', "maxcycles", "Sets maximum number of cycles to run",
NO_NEG, HAS_ARG, &max_cycles, 0, NULL, NULL },
{ 's', "machine", "Specify the machine (exact hardware) to emulate",
NO_NEG, HAS_ARG, NULL, 0, &machine_name, NULL },
{ '\0', NULL },
};
int
do_help (const char *arg __attribute__((unused)))
{
struct option *opt = option_table;
printf ("Motorola 6809 Simulator Version %s\n", PACKAGE_VERSION);
printf ("m6809-run [options] [program]\n\n");
printf ("Options:\n");
while (opt->o_long != NULL)
{
if (opt->help)
{
if (opt->o_short == '-')
printf (" --%-16.16s %s\n", opt->o_long, opt->help);
else
printf (" -%c, --%-16.16s%s\n", opt->o_short, opt->o_long, opt->help);
}
opt++;
}
return -1;
}
void usage (void)
{
do_help (NULL);
}
/**
* Returns positive if an argument was taken.
* Returns zero if no argument was taken.
* Returns negative on error.
*/
int
process_option (struct option *opt, const char *arg)
{
int rc;
//printf ("Processing option '%s'\n", opt->o_long);
if (opt->takes_arg)
{
if (!arg)
{
//printf (" Takes argument but none given.\n");
rc = 0;
}
else
{
if (opt->int_value)
{
*(opt->int_value) = strtoul (arg, NULL, 0);
//printf (" Integer argument '%d' taken.\n", *(opt->int_value));
}
else if (opt->string_value)
{
*(opt->string_value) = arg;
//printf (" String argument '%s' taken.\n", *(opt->string_value));
}
rc = 1;
}
}
else
{
if (arg)
//printf (" Takes no argument but one given, ignored.\n");
if (opt->int_value)
{
*(opt->int_value) = opt->default_value;
//printf (" Integer argument 1 implied.\n");
}
rc = 0;
}
if (opt->handler)
{
rc = opt->handler (arg);
//printf (" Handler called, rc=%d\n", rc);
}
if (rc < 0)
- exit (0);
+ sim_exit (0x70);
return rc;
}
int
process_plain_argument (const char *arg)
{
//printf ("plain argument '%s'\n", arg);
if (!prog_name)
prog_name = arg;
}
int
parse_args (int argc, char *argv[])
{
int argn = 1;
struct option *opt;
next_arg:
while (argn < argc)
{
char *arg = argv[argn];
if (arg[0] == '-')
{
if (arg[1] == '-')
{
char *rest = strchr (arg+2, '=');
if (rest)
*rest++ = '\0';
opt = option_table;
while (opt->o_long != NULL)
{
if (!strcmp (opt->o_long, arg+2))
{
argn++;
(void)process_option (opt, rest);
goto next_arg;
}
opt++;
}
printf ("long option '%s' not recognized.\n", arg+2);
}
else
{
opt = option_table;
while (opt->o_long != NULL)
{
if (opt->o_short == arg[1])
{
argn++;
if (process_option (opt, argv[argn]))
argn++;
goto next_arg;
}
opt++;
}
printf ("short option '%c' not recognized.\n", arg[1]);
}
argn++;
}
else
{
process_plain_argument (argv[argn++]);
}
}
}
int
main (int argc, char *argv[])
{
int off = 0;
int i, j, n;
int argn = 1;
unsigned int loops = 0;
+ gettimeofday (&time_started, NULL);
+
exename = argv[0];
/* TODO - enable different options by default
based on the executable name. */
parse_args (argc, argv);
sym_init ();
switch (type)
{
case HEX:
if (prog_name && load_hex (prog_name))
usage ();
break;
case S19:
machine_init (machine_name, NULL);
if (prog_name && load_s19 (prog_name))
usage ();
break;
default:
machine_init (machine_name, prog_name);
break;
}
/* Try to load a map file */
if (prog_name)
load_map_file (prog_name);
/* Enable debugging if no executable given yet. */
if (!prog_name)
debug_enabled = 1;
else
/* OK, ready to run. Reset the CPU first. */
cpu_reset ();
monitor_init ();
command_init ();
keybuffering (0);
/* Now, iterate through the instructions.
* If no IRQs or FIRQs are enabled, we can just call cpu_execute()
* and let it run for a long time; otherwise, we need to come back
* here periodically and do the interrupt handling. */
for (cpu_quit = 1; cpu_quit != 0;)
{
if ((cycles_per_irq == 0) && (cycles_per_firq == 0))
{
total += cpu_execute (max_cycles ? max_cycles-1 : 500000);
}
else
{
total += cpu_execute (cycles_per_irq);
request_irq (0);
{
/* TODO - FIRQ frequency not handled yet */
static int firq_freq = 0;
if (++firq_freq == 8)
{
request_firq (0);
firq_freq = 0;
}
}
}
idle_loop ();
/* Check for a rogue program that won't end */
if ((max_cycles > 0) && (total > max_cycles))
{
sim_error ("maximum cycle count exceeded at %s\n",
monitor_addr_name (get_pc ()));
}
}
- printf ("m6809-run stopped after %d cycles\n", total);
+
+ sim_exit (0);
return 0;
}
|
bcd/exec09
|
9adac9fb10670adb7d95341d6e6c185f70d6dc16
|
Remove more old code.
|
diff --git a/wpc.c b/wpc.c
index c91b66e..32246bd 100644
--- a/wpc.c
+++ b/wpc.c
@@ -1,693 +1,671 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#else
#error
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/errno.h>
#include "wpclib.h"
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3c00
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
/**
* The 'wpc_asic' struct holds all of the state
* of the ASIC. There is a single instance of this,
* named 'the_wpc', and it is pointed to by the
* global 'wpc'. Only one ASIC can be defined at
* a time.
*/
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
struct hw_device *dmd_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
U8 opto_mx[8];
U8 dmd_maps[2];
unsigned int dmd_phase;
U8 dmd_visibles[3];
U8 dmd_last_visibles[3];
int curr_sw;
int curr_sw_time;
int wdog_timer;
} the_wpc;
struct wpc_asic *wpc = NULL;
int wpc_sock;
void wpc_asic_reset (struct hw_device *dev)
{
memset (wpc, 0, sizeof (struct wpc_asic));
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
#if 1
return rc;
#endif
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
rc |= WPC_DEBUG_READ_READY;
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
unsigned int wpc_read_switch (int num)
{
unsigned int val;
val = wpc->switch_mx[num / 8] & (1 << (num % 8));
return val ? 1 : 0;
}
void wpc_write_switch (int num, int flag)
{
unsigned int col, val;
col = num / 8;
val = 1 << (num % 8);
if (wpc->opto_mx[col] & val)
flag = !flag;
wpc->switch_mx[col] &= ~val;
if (flag)
wpc->switch_mx[col] |= val;
}
void wpc_press_switch (int num, int delay)
{
wpc_write_switch (num, 1);
wpc->curr_sw = num;
wpc->curr_sw_time = delay;
}
unsigned int wpc_read_switch_column (int col)
{
unsigned int val = 0;
int row;
for (row = 0; row < 8; row++)
if (wpc_read_switch (col * 8 + row))
val |= (1 << row);
return val;
}
-void wpc_write_lamp (int num, int flag)
-{
-}
-
-
-void wpc_write_sol (int num, int flag)
-{
-}
-
void wpc_dmd_set_visible (U8 val)
{
-#if 0
- FILE *fp;
-#endif
char *p;
struct wpc_message msg;
int rc;
int i, n;
-#if 0
- fp = fopen ("dmd", "wb");
- if (!fp)
- {
- fprintf (stderr, "could not write to DMD!!!\n");
- return;
- }
- fclose (fp);
-#endif
-
wpc->dmd_visibles[wpc->dmd_phase++] = val;
if (wpc->dmd_phase == 3)
wpc->dmd_phase = 0;
if (!memcmp (wpc->dmd_visibles, wpc->dmd_last_visibles, 3))
return;
memcpy (wpc->dmd_last_visibles, wpc->dmd_visibles, 3);
/* Send updated page contents */
wpc_msg_init (CODE_DMD_PAGE, &msg);
for (i=0; i < 3; i++)
{
p = wpc->dmd_dev->priv + wpc->dmd_visibles[i] * 512;
msg.u.dmdpage.phases[i].page = wpc->dmd_visibles[i];
memcpy (&msg.u.dmdpage.phases[i].data, p, 512);
}
msg.len = sizeof (struct _dmdpage_info);
wpc_msg_send (wpc_sock, 9000 ^ 1, &msg);
/* Send status of which pages are visible now */
wpc_msg_init (CODE_DMD_VISIBLE, &msg);
for (i=0; i < 3; i++)
msg.u.dmdvisible.phases[i] = wpc->dmd_visibles[i];
msg.len = sizeof (struct _dmdvisible_info);
wpc_msg_send (wpc_sock, 9000 ^ 1, &msg);
}
void wpc_keypoll (void)
{
fd_set fds;
struct timeval timeout;
int rc;
unsigned char c;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
{
rc = read (0, &c, 1);
switch (c)
{
case '7':
wpc_press_switch (4, 200);
break;
case '8':
wpc_press_switch (5, 200);
break;
case '9':
wpc_press_switch (6, 200);
break;
case '0':
wpc_press_switch (7, 200);
break;
default:
break;
}
}
}
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit / 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
case WPC_SW_ROW_INPUT:
val = wpc_read_switch_column (1 + scanbit (wpc->switch_strobe));
break;
case WPC_SW_JUMPER_INPUT:
val = 0x55;
break;
case WPC_SW_CABINET_INPUT:
val = wpc_read_switch_column (0);
break;
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (void)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_set_rom_page (unsigned char val)
{
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
}
void wpc_set_dmd_page (unsigned int map, unsigned char val)
{
wpc->dmd_maps[map] = val;
bus_map (0x3800 + map * 0x200, 3, val * 0x200, 0x200, MAP_READWRITE);
}
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
switch (addr + WPC_ASIC_BASE)
{
case WPC_DMD_LOW_PAGE:
wpc_set_dmd_page (0, val);
break;
case WPC_DMD_HIGH_PAGE:
wpc_set_dmd_page (1, val);
break;
case WPC_DMD_FIRQ_ROW_VALUE:
break;
case WPC_DMD_ACTIVE_PAGE:
wpc_dmd_set_visible (val);
break;
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
wpc->wdog_timer++;
break;
case WPC_ROM_BANK:
wpc->rombank = val;
wpc_set_rom_page (val);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram ();
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram ();
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
case WPC_SW_COL_STROBE:
wpc->switch_strobe = val;
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
wpc_keypoll ();
wpc->wdog_timer -= 50;
if (wpc->wdog_timer <= 0)
{
}
if (wpc->curr_sw_time > 0)
{
wpc->curr_sw_time -= 100;
if (wpc->curr_sw_time <= 0)
{
wpc->curr_sw_time = 0;
wpc_write_switch (wpc->curr_sw, 0);
}
}
}
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
if (wpc)
{
fprintf (stderr, "WPC ASIC already created\n");
return NULL;
}
wpc = &the_wpc;
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
void io_sym_add (const char *name, unsigned long cpuaddr)
{
sym_add (&program_symtab, name, to_absolute (cpuaddr), 0);
}
#define IO_SYM_ADD(name) io_sym_add (#name, name)
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
int rc;
struct sockaddr_in myaddr;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
device_define ( dev = ram_create (16 * 512), 0,
0x3800, 0x200 * 2, MAP_READWRITE );
wpc->dmd_dev = dev;
wpc_update_ram ();
wpc_sock = udp_socket_create (9000);
if (wpc_sock < 0)
fprintf (stderr, "could not open output socket\n");
IO_SYM_ADD(WPC_DMD_LOW_BASE);
IO_SYM_ADD(WPC_DMD_HIGH_BASE);
IO_SYM_ADD(WPC_DMD_HIGH_PAGE);
IO_SYM_ADD(WPC_DMD_FIRQ_ROW_VALUE);
IO_SYM_ADD(WPC_DMD_LOW_PAGE);
IO_SYM_ADD(WPC_DMD_ACTIVE_PAGE);
IO_SYM_ADD(WPC_SERIAL_STATUS_PORT);
IO_SYM_ADD(WPC_PARALLEL_DATA_PORT);
IO_SYM_ADD(WPC_PARALLEL_STROBE_PORT);
IO_SYM_ADD(WPC_SERIAL_DATA_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_CONTROL_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_BAUD_SELECT);
IO_SYM_ADD(WPC_TICKET_DISPENSE);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_OUT);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_IN);
IO_SYM_ADD(WPC_DCS_SOUND_RESET);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_READY);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_A);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_B);
IO_SYM_ADD(WPCS_DATA);
IO_SYM_ADD(WPCS_CONTROL_STATUS);
IO_SYM_ADD(WPC_SOL_FLASH2_OUTPUT);
IO_SYM_ADD(WPC_SOL_HIGHPOWER_OUTPUT);
IO_SYM_ADD(WPC_SOL_FLASH1_OUTPUT);
IO_SYM_ADD(WPC_SOL_LOWPOWER_OUTPUT);
IO_SYM_ADD(WPC_LAMP_ROW_OUTPUT);
IO_SYM_ADD(WPC_LAMP_COL_STROBE);
IO_SYM_ADD(WPC_GI_TRIAC);
IO_SYM_ADD(WPC_SW_JUMPER_INPUT);
IO_SYM_ADD(WPC_SW_CABINET_INPUT);
IO_SYM_ADD(WPC_SW_ROW_INPUT);
IO_SYM_ADD(WPC_SW_COL_STROBE);
IO_SYM_ADD(WPC_LEDS);
IO_SYM_ADD(WPC_RAM_BANK);
IO_SYM_ADD(WPC_SHIFTADDR);
IO_SYM_ADD(WPC_SHIFTBIT);
IO_SYM_ADD(WPC_SHIFTBIT2);
IO_SYM_ADD(WPC_PERIPHERAL_TIMER_FIRQ_CLEAR);
IO_SYM_ADD(WPC_ROM_LOCK);
IO_SYM_ADD(WPC_CLK_HOURS_DAYS);
IO_SYM_ADD(WPC_CLK_MINS);
IO_SYM_ADD(WPC_ROM_BANK);
IO_SYM_ADD(WPC_RAM_LOCK);
IO_SYM_ADD(WPC_RAM_LOCKSIZE);
}
struct machine wpc_machine =
{
.name = "wpc",
.fault = wpc_fault,
.init = wpc_init,
};
|
bcd/exec09
|
ead90cf3baea3956f06dba5c2053df62627bacc7
|
Delete OLDSYS code.
|
diff --git a/6809.h b/6809.h
index dc2eec4..2b0f742 100644
--- a/6809.h
+++ b/6809.h
@@ -1,243 +1,240 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_H
#define M6809_H
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#else
#error
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
#error
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#else
#error
#endif
typedef uint8_t UINT8;
typedef signed char INT8;
typedef uint16_t UINT16;
typedef signed short INT16;
typedef uint32_t UINT32;
typedef signed int INT32;
typedef uint16_t target_addr_t;
#include "machine.h"
#define E_FLAG 0x80
#define F_FLAG 0x40
#define H_FLAG 0x20
#define I_FLAG 0x10
#define N_FLAG 0x08
#define Z_FLAG 0x04
#define V_FLAG 0x02
#define C_FLAG 0x01
extern int debug_enabled;
extern int need_flush;
extern unsigned long total;
extern int dump_cycles_on_success;
-#ifdef OLDSYS
-extern UINT8 *memory;
-#endif
/* Primitive read/write macros */
#define read8(addr) cpu_read8 (addr)
#define write8(addr,val) do { cpu_write8 (addr, val); } while (0)
/* 16-bit versions */
#define read16(addr) cpu_read16(addr)
#define write16(addr,val) do { write8(addr+1, val & 0xFF); write8(addr, (val >> 8) & 0xFF); } while (0)
/* Fetch macros */
#define abs_read16(addr) ((abs_read8(addr) << 8) | abs_read8(addr+1))
#define fetch8() abs_read8 (pc++)
#define fetch16() (pc += 2, abs_read16(pc-2))
/* 6809.c */
extern int cpu_quit;
extern int cpu_execute (int);
extern void cpu_reset (void);
extern unsigned get_a (void);
extern unsigned get_b (void);
extern unsigned get_cc (void);
extern unsigned get_dp (void);
extern unsigned get_x (void);
extern unsigned get_y (void);
extern unsigned get_s (void);
extern unsigned get_u (void);
extern unsigned get_pc (void);
extern unsigned get_d (void);
extern void set_a (unsigned);
extern void set_b (unsigned);
extern void set_cc (unsigned);
extern void set_dp (unsigned);
extern void set_x (unsigned);
extern void set_y (unsigned);
extern void set_s (unsigned);
extern void set_u (unsigned);
extern void set_pc (unsigned);
extern void set_d (unsigned);
/* fileio.c */
struct pathlist
{
int count;
char *entry[32];
};
void path_init (struct pathlist *path);
void path_add (struct pathlist *path, const char *dir);
FILE * file_open (struct pathlist *path, const char *filename, const char *mode);
FILE * file_require_open (struct pathlist *path, const char *filename, const char *mode);
void file_close (FILE *fp);
/* monitor.c */
extern int monitor_on;
extern int check_break (void);
extern void monitor_init (void);
extern int monitor6809 (void);
extern int dasm (char *, absolute_address_t);
extern int load_hex (char *);
extern int load_s19 (char *);
extern int load_bin (char *,int);
#define MAX_STRINGSPACE 32000
#define MAX_SYMBOL_HASH 1009
#define SYM_DEFAULT 0
#define SYM_AUTO 1
typedef struct
{
unsigned char format;
unsigned int size;
} datatype_t;
/* symtab.c */
struct stringspace
{
char space[32000];
unsigned int used;
};
struct symbol
{
char *name;
unsigned long value;
datatype_t ty;
unsigned int type;
struct symbol *name_chain;
struct symbol *value_chain;
};
struct symtab
{
struct symbol *syms_by_name[MAX_SYMBOL_HASH];
struct symbol *syms_by_value[MAX_SYMBOL_HASH];
struct symtab *parent;
};
extern struct symtab program_symtab;
extern struct symtab internal_symtab;
extern struct symtab auto_symtab;
void sym_add (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
void sym_set (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
int sym_find (struct symtab *symtab, const char *name, unsigned long *value, unsigned int type);
const char *sym_lookup (struct symtab *symtab, unsigned long value);
typedef void (*command_handler_t) (void);
typedef void (*virtual_handler_t) (unsigned long *val, int writep);
typedef unsigned int thread_id_t;
typedef struct
{
unsigned int id : 8;
unsigned int used : 1;
unsigned int enabled : 1;
unsigned int conditional : 1;
unsigned int threaded : 1;
unsigned int on_read : 1;
unsigned int on_write : 1;
unsigned int on_execute : 1;
unsigned int size : 4;
unsigned int keep_running : 1;
unsigned int temp : 1;
unsigned int last_write : 16;
unsigned int write_mask : 16;
absolute_address_t addr;
char condition[128];
thread_id_t tid;
unsigned int pass_count;
unsigned int ignore_count;
} breakpoint_t;
typedef struct
{
int used : 1;
datatype_t type;
char expr[128];
} display_t;
typedef struct
{
int id : 8;
thread_id_t tid;
} thread_t;
#define MAX_BREAKS 32
#define MAX_DISPLAYS 32
#define MAX_HISTORY 10
#define MAX_THREADS 64
void command_irq_hook (unsigned long cycles);
#endif /* M6809_H */
|
bcd/exec09
|
861e3d81699e4b08e9c3cbaf081851b0d4e2d934
|
Improve DMD handling for mono images with no page flipping.
|
diff --git a/wpc.c b/wpc.c
index c91b66e..1fe120f 100644
--- a/wpc.c
+++ b/wpc.c
@@ -1,693 +1,720 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#else
#error
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/errno.h>
#include "wpclib.h"
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3c00
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
-#define WPC_SW_ROW_INPUT 0x3FE9
-#define WPC_SW_COL_STROBE 0x3FEA
-#if (MACHINE_PIC == 1)
-#define WPCS_PIC_READ 0x3FE9
-#define WPCS_PIC_WRITE 0x3FEA
-#endif
+#define WPC_SW_ROW_INPUT 0x3FE9 /* WPC */
+#define WPC_SW_COL_STROBE 0x3FEA /* WPC */
+#define WPCS_PIC_READ 0x3FE9 /* WPCS, WPC95 */
+#define WPCS_PIC_WRITE 0x3FEA /* WPCS, WPC95 */
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
-#if (MACHINE_WPC95 == 1)
-#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
-#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
-#else
-#endif
+#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE /* WPC95 */
+#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF /* WPC95 */
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
-#define WPC_RAM_BANK 0x3FF3
+#define WPC_RAM_BANK 0x3FF3 /* WPC95 */
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
/**
* The 'wpc_asic' struct holds all of the state
* of the ASIC. There is a single instance of this,
* named 'the_wpc', and it is pointed to by the
* global 'wpc'. Only one ASIC can be defined at
* a time.
*/
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
struct hw_device *dmd_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
U8 opto_mx[8];
U8 dmd_maps[2];
unsigned int dmd_phase;
U8 dmd_visibles[3];
U8 dmd_last_visibles[3];
int curr_sw;
int curr_sw_time;
int wdog_timer;
} the_wpc;
struct wpc_asic *wpc = NULL;
int wpc_sock;
void wpc_asic_reset (struct hw_device *dev)
{
memset (wpc, 0, sizeof (struct wpc_asic));
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
#if 1
return rc;
#endif
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
rc |= WPC_DEBUG_READ_READY;
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
unsigned int wpc_read_switch (int num)
{
unsigned int val;
val = wpc->switch_mx[num / 8] & (1 << (num % 8));
return val ? 1 : 0;
}
void wpc_write_switch (int num, int flag)
{
unsigned int col, val;
col = num / 8;
val = 1 << (num % 8);
if (wpc->opto_mx[col] & val)
flag = !flag;
wpc->switch_mx[col] &= ~val;
if (flag)
wpc->switch_mx[col] |= val;
}
void wpc_press_switch (int num, int delay)
{
wpc_write_switch (num, 1);
wpc->curr_sw = num;
wpc->curr_sw_time = delay;
}
unsigned int wpc_read_switch_column (int col)
{
unsigned int val = 0;
int row;
for (row = 0; row < 8; row++)
if (wpc_read_switch (col * 8 + row))
val |= (1 << row);
return val;
}
void wpc_write_lamp (int num, int flag)
{
}
void wpc_write_sol (int num, int flag)
{
}
void wpc_dmd_set_visible (U8 val)
{
-#if 0
- FILE *fp;
-#endif
char *p;
struct wpc_message msg;
int rc;
int i, n;
+ static unsigned long last_firq_time = 0;
+ unsigned long now;
+ static int no_change_count = 0;
-#if 0
- fp = fopen ("dmd", "wb");
- if (!fp)
+ now = get_cycles ();
+ if (now - last_firq_time <= 1850 * 8)
{
- fprintf (stderr, "could not write to DMD!!!\n");
+ //printf ("%02X ignored.\n", val);
return;
}
- fclose (fp);
+ else if (now - last_firq_time >= 1850 * 8 * 5)
+ {
+ memset (wpc->dmd_visibles, val, 3);
+ wpc->dmd_phase = 0;
+ }
+ else
+ {
+ wpc->dmd_visibles[wpc->dmd_phase++] = val;
+ if (wpc->dmd_phase == 3)
+ wpc->dmd_phase = 0;
+ }
+
+ last_firq_time = now;
+
+#if 0
+ printf ("%02X %f\n", val, get_cycles () / 1952.0);
#endif
- wpc->dmd_visibles[wpc->dmd_phase++] = val;
- if (wpc->dmd_phase == 3)
- wpc->dmd_phase = 0;
- if (!memcmp (wpc->dmd_visibles, wpc->dmd_last_visibles, 3))
+ if (!memcmp (wpc->dmd_visibles, wpc->dmd_last_visibles, 3)
+ && (++no_change_count < 100))
return;
+ no_change_count = 0;
+#if 0
+ printf ("%02X %02X %02X\n",
+ wpc->dmd_visibles[0],
+ wpc->dmd_visibles[1],
+ wpc->dmd_visibles[2]);
+#endif
memcpy (wpc->dmd_last_visibles, wpc->dmd_visibles, 3);
/* Send updated page contents */
wpc_msg_init (CODE_DMD_PAGE, &msg);
for (i=0; i < 3; i++)
{
p = wpc->dmd_dev->priv + wpc->dmd_visibles[i] * 512;
msg.u.dmdpage.phases[i].page = wpc->dmd_visibles[i];
memcpy (&msg.u.dmdpage.phases[i].data, p, 512);
}
msg.len = sizeof (struct _dmdpage_info);
wpc_msg_send (wpc_sock, 9000 ^ 1, &msg);
/* Send status of which pages are visible now */
wpc_msg_init (CODE_DMD_VISIBLE, &msg);
for (i=0; i < 3; i++)
msg.u.dmdvisible.phases[i] = wpc->dmd_visibles[i];
msg.len = sizeof (struct _dmdvisible_info);
wpc_msg_send (wpc_sock, 9000 ^ 1, &msg);
}
void wpc_keypoll (void)
{
fd_set fds;
struct timeval timeout;
int rc;
unsigned char c;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
{
rc = read (0, &c, 1);
switch (c)
{
case '7':
wpc_press_switch (4, 200);
break;
case '8':
wpc_press_switch (5, 200);
break;
case '9':
wpc_press_switch (6, 200);
break;
case '0':
wpc_press_switch (7, 200);
break;
default:
break;
}
}
}
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit / 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
case WPC_SW_ROW_INPUT:
val = wpc_read_switch_column (1 + scanbit (wpc->switch_strobe));
break;
case WPC_SW_JUMPER_INPUT:
val = 0x55;
break;
case WPC_SW_CABINET_INPUT:
val = wpc_read_switch_column (0);
break;
+ case WPC_FLIPTRONIC_PORT_A:
+ case WPC_FLIPTRONIC_PORT_B:
+ case WPC95_FLIPPER_SWITCH_INPUT:
+ return 0xFF;
+
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (void)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_set_rom_page (unsigned char val)
{
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
}
void wpc_set_dmd_page (unsigned int map, unsigned char val)
{
wpc->dmd_maps[map] = val;
bus_map (0x3800 + map * 0x200, 3, val * 0x200, 0x200, MAP_READWRITE);
}
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
switch (addr + WPC_ASIC_BASE)
{
case WPC_DMD_LOW_PAGE:
wpc_set_dmd_page (0, val);
break;
case WPC_DMD_HIGH_PAGE:
wpc_set_dmd_page (1, val);
break;
case WPC_DMD_FIRQ_ROW_VALUE:
break;
case WPC_DMD_ACTIVE_PAGE:
wpc_dmd_set_visible (val);
break;
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
wpc->wdog_timer++;
break;
case WPC_ROM_BANK:
wpc->rombank = val;
wpc_set_rom_page (val);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram ();
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram ();
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
case WPC_SW_COL_STROBE:
wpc->switch_strobe = val;
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
wpc_keypoll ();
wpc->wdog_timer -= 50;
if (wpc->wdog_timer <= 0)
{
}
if (wpc->curr_sw_time > 0)
{
wpc->curr_sw_time -= 100;
if (wpc->curr_sw_time <= 0)
{
wpc->curr_sw_time = 0;
wpc_write_switch (wpc->curr_sw, 0);
}
}
}
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
if (wpc)
{
fprintf (stderr, "WPC ASIC already created\n");
return NULL;
}
wpc = &the_wpc;
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
void io_sym_add (const char *name, unsigned long cpuaddr)
{
sym_add (&program_symtab, name, to_absolute (cpuaddr), 0);
}
#define IO_SYM_ADD(name) io_sym_add (#name, name)
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
int rc;
struct sockaddr_in myaddr;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
device_define ( dev = ram_create (16 * 512), 0,
0x3800, 0x200 * 2, MAP_READWRITE );
wpc->dmd_dev = dev;
wpc_update_ram ();
wpc_sock = udp_socket_create (9000);
if (wpc_sock < 0)
fprintf (stderr, "could not open output socket\n");
IO_SYM_ADD(WPC_DMD_LOW_BASE);
IO_SYM_ADD(WPC_DMD_HIGH_BASE);
IO_SYM_ADD(WPC_DMD_HIGH_PAGE);
IO_SYM_ADD(WPC_DMD_FIRQ_ROW_VALUE);
IO_SYM_ADD(WPC_DMD_LOW_PAGE);
IO_SYM_ADD(WPC_DMD_ACTIVE_PAGE);
IO_SYM_ADD(WPC_SERIAL_STATUS_PORT);
IO_SYM_ADD(WPC_PARALLEL_DATA_PORT);
IO_SYM_ADD(WPC_PARALLEL_STROBE_PORT);
IO_SYM_ADD(WPC_SERIAL_DATA_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_CONTROL_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_BAUD_SELECT);
IO_SYM_ADD(WPC_TICKET_DISPENSE);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_OUT);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_IN);
IO_SYM_ADD(WPC_DCS_SOUND_RESET);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_READY);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_A);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_B);
IO_SYM_ADD(WPCS_DATA);
IO_SYM_ADD(WPCS_CONTROL_STATUS);
IO_SYM_ADD(WPC_SOL_FLASH2_OUTPUT);
IO_SYM_ADD(WPC_SOL_HIGHPOWER_OUTPUT);
IO_SYM_ADD(WPC_SOL_FLASH1_OUTPUT);
IO_SYM_ADD(WPC_SOL_LOWPOWER_OUTPUT);
IO_SYM_ADD(WPC_LAMP_ROW_OUTPUT);
IO_SYM_ADD(WPC_LAMP_COL_STROBE);
IO_SYM_ADD(WPC_GI_TRIAC);
IO_SYM_ADD(WPC_SW_JUMPER_INPUT);
IO_SYM_ADD(WPC_SW_CABINET_INPUT);
IO_SYM_ADD(WPC_SW_ROW_INPUT);
IO_SYM_ADD(WPC_SW_COL_STROBE);
IO_SYM_ADD(WPC_LEDS);
IO_SYM_ADD(WPC_RAM_BANK);
IO_SYM_ADD(WPC_SHIFTADDR);
IO_SYM_ADD(WPC_SHIFTBIT);
IO_SYM_ADD(WPC_SHIFTBIT2);
IO_SYM_ADD(WPC_PERIPHERAL_TIMER_FIRQ_CLEAR);
IO_SYM_ADD(WPC_ROM_LOCK);
IO_SYM_ADD(WPC_CLK_HOURS_DAYS);
IO_SYM_ADD(WPC_CLK_MINS);
IO_SYM_ADD(WPC_ROM_BANK);
IO_SYM_ADD(WPC_RAM_LOCK);
IO_SYM_ADD(WPC_RAM_LOCKSIZE);
}
struct machine wpc_machine =
{
.name = "wpc",
.fault = wpc_fault,
.init = wpc_init,
};
+
+struct machine wpc95_machine =
+{
+ .name = "wpc95",
+ .fault = wpc_fault,
+ .init = wpc_init,
+};
+
|
bcd/exec09
|
6571e6952b9e1c88b510a450a90f903167ad0b91
|
Add get_flags().
|
diff --git a/6809.c b/6809.c
index 248b8e0..eb16312 100644
--- a/6809.c
+++ b/6809.c
@@ -1,968 +1,974 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include "monitor.h"
#include <stdarg.h>
unsigned X, Y, S, U, PC;
unsigned A, B, DP;
unsigned H, N, Z, OV, C;
unsigned EFI;
#ifdef H6309
unsigned E, F, V, MD;
#define MD_NATIVE 0x1 /* if 1, execute in 6309 mode */
#define MD_FIRQ_LIKE_IRQ 0x2 /* if 1, FIRQ acts like IRQ */
#define MD_ILL 0x40 /* illegal instruction */
#define MD_DBZ 0x80 /* divide by zero */
#endif /* H6309 */
unsigned iPC;
unsigned long irq_start_time;
unsigned ea = 0;
long cpu_clk = 0;
long cpu_period = 0;
int cpu_quit = 1;
unsigned int irqs_pending = 0;
unsigned int firqs_pending = 0;
unsigned int cc_changed = 0;
unsigned *index_regs[4] = { &X, &Y, &U, &S };
extern int dump_cycles_on_success;
extern int trace_enabled;
extern void irq (void);
extern void firq (void);
void request_irq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
irqs_pending |= (1 << source);
if (!(EFI & I_FLAG))
irq ();
}
void release_irq (unsigned int source)
{
irqs_pending &= ~(1 << source);
}
void request_firq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
firqs_pending |= (1 << source);
if (!(EFI & F_FLAG))
firq ();
}
void release_firq (unsigned int source)
{
firqs_pending &= ~(1 << source);
}
static inline void
check_pc (void)
{
/* TODO */
}
static inline void
check_stack (void)
{
/* TODO */
}
void
sim_error (const char *format, ...)
{
va_list ap;
va_start (ap, format);
fprintf (stderr, "m6809-run: (at PC=%04X) ", iPC);
vfprintf (stderr, format, ap);
va_end (ap);
if (debug_enabled)
monitor_on = 1;
else
exit (2);
}
unsigned long
get_cycles (void)
{
return total + cpu_period - cpu_clk;
}
void
sim_exit (uint8_t exit_code)
{
/* On a nonzero exit, always print an error message. */
if (exit_code != 0)
{
printf ("m6809-run: program exited with %d\n", exit_code);
if (exit_code)
monitor_backtrace ();
}
/* If a cycle count should be printed, do that last. */
if (dump_cycles_on_success)
{
printf ("Simulated time : %ld cycles\n", get_cycles ());
}
exit (exit_code);
}
static inline void
change_pc (unsigned newPC)
{
#if 0
/* TODO - will let some RAM execute for trampolines */
if ((newPC < 0x1C00) || (newPC > 0xFFFF))
{
fprintf (stderr, "m6809-run: invalid PC = %04X, previous was %s\n",
newPC, monitor_addr_name (PC));
exit (2);
}
if (trace_enabled)
{
fprintf (stderr, "PC : %s ", monitor_addr_name (PC));
fprintf (stderr, "-> %s\n", monitor_addr_name (newPC));
}
#endif
PC = newPC;
}
static inline unsigned
imm_byte (void)
{
unsigned val = read8 (PC);
PC++;
return val;
}
static inline unsigned
imm_word (void)
{
unsigned val = read16 (PC);
PC += 2;
return val;
}
#define WRMEM(addr, data) write8 (addr, data)
static void
WRMEM16 (unsigned addr, unsigned data)
{
WRMEM (addr, data >> 8);
cpu_clk--;
WRMEM ((addr + 1) & 0xffff, data & 0xff);
}
#define RDMEM(addr) read8 (addr)
static unsigned
RDMEM16 (unsigned addr)
{
unsigned val = RDMEM (addr) << 8;
cpu_clk--;
val |= RDMEM ((addr + 1) & 0xffff);
return val;
}
#define write_stack WRMEM
#define read_stack RDMEM
static void
write_stack16 (unsigned addr, unsigned data)
{
write_stack ((addr + 1) & 0xffff, data & 0xff);
write_stack (addr, data >> 8);
}
static unsigned
read_stack16 (unsigned addr)
{
return (read_stack (addr) << 8) | read_stack ((addr + 1) & 0xffff);
}
static void
direct (void)
{
unsigned val = read8 (PC) | DP;
PC++;
ea = val;
}
static void
indexed (void) /* note take 1 extra cycle */
{
unsigned post = imm_byte ();
unsigned *R = index_regs[(post >> 5) & 0x3];
if (post & 0x80)
{
switch (post & 0x1f)
{
case 0x00:
ea = *R;
*R = (*R + 1) & 0xffff;
cpu_clk -= 6;
break;
case 0x01:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
break;
case 0x02:
*R = (*R - 1) & 0xffff;
ea = *R;
cpu_clk -= 6;
break;
case 0x03:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
break;
case 0x04:
ea = *R;
cpu_clk -= 4;
break;
case 0x05:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
break;
case 0x06:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
break;
case 0x08:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
break;
case 0x09:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
break;
case 0x0d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
break;
case 0x11:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x13:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x14:
ea = *R;
cpu_clk -= 4;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x15:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x16:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x18:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x19:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1f:
ea = imm_word ();
cpu_clk -= 6;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
default:
ea = 0;
sim_error ("invalid index post $%02X\n", post);
break;
}
}
else
{
if (post & 0x10)
post |= 0xfff0;
else
post &= 0x000f;
ea = (*R + post) & 0xffff;
cpu_clk -= 5;
}
}
static void
extended (void)
{
unsigned val = read16 (PC);
PC += 2;
ea = val;
}
/* external register functions */
unsigned
get_a (void)
{
return A;
}
unsigned
get_b (void)
{
return B;
}
unsigned
get_dp (void)
{
return DP >> 8;
}
unsigned
get_x (void)
{
return X;
}
unsigned
get_y (void)
{
return Y;
}
unsigned
get_s (void)
{
return S;
}
unsigned
get_u (void)
{
return U;
}
unsigned
get_pc (void)
{
return PC & 0xffff;
}
unsigned
get_d (void)
{
return (A << 8) | B;
}
+unsigned
+get_flags (void)
+{
+ return EFI;
+}
+
#ifdef H6309
unsigned
get_e (void)
{
return E;
}
unsigned
get_f (void)
{
return F;
}
unsigned
get_w (void)
{
return (E << 8) | F;
}
unsigned
get_q (void)
{
return (get_w () << 16) | get_d ();
}
unsigned
get_v (void)
{
return V;
}
unsigned
get_zero (void)
{
return 0;
}
unsigned
get_md (void)
{
return MD;
}
#endif
void
set_a (unsigned val)
{
A = val & 0xff;
}
void
set_b (unsigned val)
{
B = val & 0xff;
}
void
set_dp (unsigned val)
{
DP = (val & 0xff) << 8;
}
void
set_x (unsigned val)
{
X = val & 0xffff;
}
void
set_y (unsigned val)
{
Y = val & 0xffff;
}
void
set_s (unsigned val)
{
S = val & 0xffff;
check_stack ();
}
void
set_u (unsigned val)
{
U = val & 0xffff;
}
void
set_pc (unsigned val)
{
PC = val & 0xffff;
check_pc ();
}
void
set_d (unsigned val)
{
A = (val >> 8) & 0xff;
B = val & 0xff;
}
#ifdef H6309
void
set_e (unsigned val)
{
E = val & 0xff;
}
void
set_f (unsigned val)
{
F = val & 0xff;
}
void
set_w (unsigned val)
{
E = (val >> 8) & 0xff;
F = val & 0xff;
}
void
set_q (unsigned val)
{
set_w ((val >> 16) & 0xffff);
set_d (val & 0xffff);
}
void
set_v (unsigned val)
{
V = val & 0xff;
}
void
set_zero (unsigned val)
{
}
void
set_md (unsigned val)
{
MD = val & 0xff;
}
#endif
/* handle condition code register */
unsigned
get_cc (void)
{
unsigned res = EFI & (E_FLAG | F_FLAG | I_FLAG);
if (H & 0x10)
res |= H_FLAG;
if (N & 0x80)
res |= N_FLAG;
if (Z == 0)
res |= Z_FLAG;
if (OV & 0x80)
res |= V_FLAG;
if (C != 0)
res |= C_FLAG;
return res;
}
void
set_cc (unsigned arg)
{
EFI = arg & (E_FLAG | F_FLAG | I_FLAG);
H = (arg & H_FLAG ? 0x10 : 0);
N = (arg & N_FLAG ? 0x80 : 0);
Z = (~arg) & Z_FLAG;
OV = (arg & V_FLAG ? 0x80 : 0);
C = arg & C_FLAG;
cc_changed = 1;
}
void
cc_modified (void)
{
/* Check for pending interrupts */
if (firqs_pending && !(EFI & F_FLAG))
firq ();
else if (irqs_pending && !(EFI & I_FLAG))
irq ();
cc_changed = 0;
}
unsigned
get_reg (unsigned nro)
{
unsigned val = 0xff;
switch (nro)
{
case 0:
val = (A << 8) | B;
break;
case 1:
val = X;
break;
case 2:
val = Y;
break;
case 3:
val = U;
break;
case 4:
val = S;
break;
case 5:
val = PC & 0xffff;
break;
#ifdef H6309
case 6:
val = (E << 8) | F;
break;
case 7:
val = V;
break;
#endif
case 8:
val = A;
break;
case 9:
val = B;
break;
case 10:
val = get_cc ();
break;
case 11:
val = DP >> 8;
break;
#ifdef H6309
case 14:
val = E;
break;
case 15:
val = F;
break;
#endif
}
return val;
}
void
set_reg (unsigned nro, unsigned val)
{
switch (nro)
{
case 0:
A = val >> 8;
B = val & 0xff;
break;
case 1:
X = val;
break;
case 2:
Y = val;
break;
case 3:
U = val;
break;
case 4:
S = val;
break;
case 5:
PC = val;
check_pc ();
break;
#ifdef H6309
case 6:
E = val >> 8;
F = val & 0xff;
break;
case 7:
V = val;
break;
#endif
case 8:
A = val;
break;
case 9:
B = val;
break;
case 10:
set_cc (val);
break;
case 11:
DP = val << 8;
break;
#ifdef H6309
case 14:
E = val;
break;
case 15:
F = val;
break;
#endif
}
}
/* 8-Bit Accumulator and Memory Instructions */
static unsigned
adc (unsigned arg, unsigned val)
{
unsigned res = arg + val + (C != 0);
C = (res >> 1) & 0x80;
N = Z = res &= 0xff;
OV = H = arg ^ val ^ res ^ C;
return res;
}
static unsigned
add (unsigned arg, unsigned val)
{
unsigned res = arg + val;
C = (res >> 1) & 0x80;
N = Z = res &= 0xff;
OV = H = arg ^ val ^ res ^ C;
return res;
}
static unsigned
and (unsigned arg, unsigned val)
{
unsigned res = arg & val;
N = Z = res;
OV = 0;
return res;
}
static unsigned
asl (unsigned arg) /* same as lsl */
{
unsigned res = arg << 1;
C = res & 0x100;
N = Z = res &= 0xff;
OV = arg ^ res;
cpu_clk -= 2;
return res;
}
static unsigned
asr (unsigned arg)
{
unsigned res = (INT8) arg;
C = res & 1;
N = Z = res = (res >> 1) & 0xff;
cpu_clk -= 2;
return res;
}
static void
bit (unsigned arg, unsigned val)
{
unsigned res = arg & val;
N = Z = res;
OV = 0;
}
static unsigned
clr (unsigned arg)
{
C = N = Z = OV = arg = 0;
cpu_clk -= 2;
return arg;
}
static void
cmp (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
}
static unsigned
com (unsigned arg)
{
unsigned res = arg ^ 0xff;
N = Z = res;
OV = 0;
C = 1;
cpu_clk -= 2;
return res;
}
static void
daa (void)
{
unsigned res = A;
unsigned msn = res & 0xf0;
unsigned lsn = res & 0x0f;
if (lsn > 0x09 || (H & 0x10))
res += 0x06;
if (msn > 0x80 && lsn > 0x09)
res += 0x60;
if (msn > 0x90 || (C != 0))
res += 0x60;
C |= (res & 0x100);
A = N = Z = res &= 0xff;
OV = 0; /* fix this */
cpu_clk -= 2;
}
static unsigned
dec (unsigned arg)
{
unsigned res = (arg - 1) & 0xff;
N = Z = res;
OV = arg & ~res;
cpu_clk -= 2;
return res;
}
unsigned
eor (unsigned arg, unsigned val)
{
unsigned res = arg ^ val;
N = Z = res;
OV = 0;
return res;
}
static void
exg (void)
{
unsigned tmp1 = 0xff;
unsigned tmp2 = 0xff;
unsigned post = imm_byte ();
if (((post ^ (post << 4)) & 0x80) == 0)
{
tmp1 = get_reg (post >> 4);
tmp2 = get_reg (post & 15);
}
set_reg (post & 15, tmp1);
set_reg (post >> 4, tmp2);
cpu_clk -= 8;
}
static unsigned
inc (unsigned arg)
{
unsigned res = (arg + 1) & 0xff;
N = Z = res;
OV = ~arg & res;
cpu_clk -= 2;
return res;
}
static unsigned
ld (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
return res;
}
static unsigned
lsr (unsigned arg)
{
unsigned res = arg >> 1;
N = 0;
Z = res;
C = arg & 1;
cpu_clk -= 2;
return res;
}
static void
mul (void)
{
unsigned res = (A * B) & 0xffff;
diff --git a/6809.h b/6809.h
index dc2eec4..d738c06 100644
--- a/6809.h
+++ b/6809.h
@@ -1,243 +1,244 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_H
#define M6809_H
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#else
#error
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
#error
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#else
#error
#endif
typedef uint8_t UINT8;
typedef signed char INT8;
typedef uint16_t UINT16;
typedef signed short INT16;
typedef uint32_t UINT32;
typedef signed int INT32;
typedef uint16_t target_addr_t;
#include "machine.h"
#define E_FLAG 0x80
#define F_FLAG 0x40
#define H_FLAG 0x20
#define I_FLAG 0x10
#define N_FLAG 0x08
#define Z_FLAG 0x04
#define V_FLAG 0x02
#define C_FLAG 0x01
extern int debug_enabled;
extern int need_flush;
extern unsigned long total;
extern int dump_cycles_on_success;
#ifdef OLDSYS
extern UINT8 *memory;
#endif
/* Primitive read/write macros */
#define read8(addr) cpu_read8 (addr)
#define write8(addr,val) do { cpu_write8 (addr, val); } while (0)
/* 16-bit versions */
#define read16(addr) cpu_read16(addr)
#define write16(addr,val) do { write8(addr+1, val & 0xFF); write8(addr, (val >> 8) & 0xFF); } while (0)
/* Fetch macros */
#define abs_read16(addr) ((abs_read8(addr) << 8) | abs_read8(addr+1))
#define fetch8() abs_read8 (pc++)
#define fetch16() (pc += 2, abs_read16(pc-2))
/* 6809.c */
extern int cpu_quit;
extern int cpu_execute (int);
extern void cpu_reset (void);
extern unsigned get_a (void);
extern unsigned get_b (void);
extern unsigned get_cc (void);
extern unsigned get_dp (void);
extern unsigned get_x (void);
extern unsigned get_y (void);
extern unsigned get_s (void);
extern unsigned get_u (void);
extern unsigned get_pc (void);
extern unsigned get_d (void);
+extern unsigned get_flags (void);
extern void set_a (unsigned);
extern void set_b (unsigned);
extern void set_cc (unsigned);
extern void set_dp (unsigned);
extern void set_x (unsigned);
extern void set_y (unsigned);
extern void set_s (unsigned);
extern void set_u (unsigned);
extern void set_pc (unsigned);
extern void set_d (unsigned);
/* fileio.c */
struct pathlist
{
int count;
char *entry[32];
};
void path_init (struct pathlist *path);
void path_add (struct pathlist *path, const char *dir);
FILE * file_open (struct pathlist *path, const char *filename, const char *mode);
FILE * file_require_open (struct pathlist *path, const char *filename, const char *mode);
void file_close (FILE *fp);
/* monitor.c */
extern int monitor_on;
extern int check_break (void);
extern void monitor_init (void);
extern int monitor6809 (void);
extern int dasm (char *, absolute_address_t);
extern int load_hex (char *);
extern int load_s19 (char *);
extern int load_bin (char *,int);
#define MAX_STRINGSPACE 32000
#define MAX_SYMBOL_HASH 1009
#define SYM_DEFAULT 0
#define SYM_AUTO 1
typedef struct
{
unsigned char format;
unsigned int size;
} datatype_t;
/* symtab.c */
struct stringspace
{
char space[32000];
unsigned int used;
};
struct symbol
{
char *name;
unsigned long value;
datatype_t ty;
unsigned int type;
struct symbol *name_chain;
struct symbol *value_chain;
};
struct symtab
{
struct symbol *syms_by_name[MAX_SYMBOL_HASH];
struct symbol *syms_by_value[MAX_SYMBOL_HASH];
struct symtab *parent;
};
extern struct symtab program_symtab;
extern struct symtab internal_symtab;
extern struct symtab auto_symtab;
void sym_add (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
void sym_set (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
int sym_find (struct symtab *symtab, const char *name, unsigned long *value, unsigned int type);
const char *sym_lookup (struct symtab *symtab, unsigned long value);
typedef void (*command_handler_t) (void);
typedef void (*virtual_handler_t) (unsigned long *val, int writep);
typedef unsigned int thread_id_t;
typedef struct
{
unsigned int id : 8;
unsigned int used : 1;
unsigned int enabled : 1;
unsigned int conditional : 1;
unsigned int threaded : 1;
unsigned int on_read : 1;
unsigned int on_write : 1;
unsigned int on_execute : 1;
unsigned int size : 4;
unsigned int keep_running : 1;
unsigned int temp : 1;
unsigned int last_write : 16;
unsigned int write_mask : 16;
absolute_address_t addr;
char condition[128];
thread_id_t tid;
unsigned int pass_count;
unsigned int ignore_count;
} breakpoint_t;
typedef struct
{
int used : 1;
datatype_t type;
char expr[128];
} display_t;
typedef struct
{
int id : 8;
thread_id_t tid;
} thread_t;
#define MAX_BREAKS 32
#define MAX_DISPLAYS 32
#define MAX_HISTORY 10
#define MAX_THREADS 64
void command_irq_hook (unsigned long cycles);
#endif /* M6809_H */
|
bcd/exec09
|
5a2edae42da825020cfb5544b012ae35cd1459ce
|
Exit with sim_error() on invalid post code.
|
diff --git a/6809.c b/6809.c
index 3084e61..248b8e0 100644
--- a/6809.c
+++ b/6809.c
@@ -1,898 +1,890 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include "monitor.h"
#include <stdarg.h>
unsigned X, Y, S, U, PC;
unsigned A, B, DP;
unsigned H, N, Z, OV, C;
unsigned EFI;
#ifdef H6309
unsigned E, F, V, MD;
#define MD_NATIVE 0x1 /* if 1, execute in 6309 mode */
#define MD_FIRQ_LIKE_IRQ 0x2 /* if 1, FIRQ acts like IRQ */
#define MD_ILL 0x40 /* illegal instruction */
#define MD_DBZ 0x80 /* divide by zero */
#endif /* H6309 */
unsigned iPC;
unsigned long irq_start_time;
unsigned ea = 0;
long cpu_clk = 0;
long cpu_period = 0;
int cpu_quit = 1;
unsigned int irqs_pending = 0;
unsigned int firqs_pending = 0;
unsigned int cc_changed = 0;
unsigned *index_regs[4] = { &X, &Y, &U, &S };
extern int dump_cycles_on_success;
extern int trace_enabled;
extern void irq (void);
extern void firq (void);
void request_irq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
irqs_pending |= (1 << source);
if (!(EFI & I_FLAG))
irq ();
}
void release_irq (unsigned int source)
{
irqs_pending &= ~(1 << source);
}
void request_firq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
firqs_pending |= (1 << source);
if (!(EFI & F_FLAG))
firq ();
}
void release_firq (unsigned int source)
{
firqs_pending &= ~(1 << source);
}
static inline void
check_pc (void)
{
/* TODO */
}
static inline void
check_stack (void)
{
/* TODO */
}
void
sim_error (const char *format, ...)
{
va_list ap;
va_start (ap, format);
fprintf (stderr, "m6809-run: (at PC=%04X) ", iPC);
vfprintf (stderr, format, ap);
va_end (ap);
if (debug_enabled)
monitor_on = 1;
else
exit (2);
}
unsigned long
get_cycles (void)
{
return total + cpu_period - cpu_clk;
}
void
sim_exit (uint8_t exit_code)
{
/* On a nonzero exit, always print an error message. */
if (exit_code != 0)
{
printf ("m6809-run: program exited with %d\n", exit_code);
if (exit_code)
monitor_backtrace ();
}
/* If a cycle count should be printed, do that last. */
if (dump_cycles_on_success)
{
printf ("Simulated time : %ld cycles\n", get_cycles ());
}
exit (exit_code);
}
static inline void
change_pc (unsigned newPC)
{
#if 0
/* TODO - will let some RAM execute for trampolines */
if ((newPC < 0x1C00) || (newPC > 0xFFFF))
{
fprintf (stderr, "m6809-run: invalid PC = %04X, previous was %s\n",
newPC, monitor_addr_name (PC));
exit (2);
}
if (trace_enabled)
{
fprintf (stderr, "PC : %s ", monitor_addr_name (PC));
fprintf (stderr, "-> %s\n", monitor_addr_name (newPC));
}
#endif
PC = newPC;
}
static inline unsigned
imm_byte (void)
{
unsigned val = read8 (PC);
PC++;
return val;
}
static inline unsigned
imm_word (void)
{
unsigned val = read16 (PC);
PC += 2;
return val;
}
#define WRMEM(addr, data) write8 (addr, data)
static void
WRMEM16 (unsigned addr, unsigned data)
{
WRMEM (addr, data >> 8);
cpu_clk--;
WRMEM ((addr + 1) & 0xffff, data & 0xff);
}
#define RDMEM(addr) read8 (addr)
static unsigned
RDMEM16 (unsigned addr)
{
unsigned val = RDMEM (addr) << 8;
cpu_clk--;
val |= RDMEM ((addr + 1) & 0xffff);
return val;
}
#define write_stack WRMEM
#define read_stack RDMEM
static void
write_stack16 (unsigned addr, unsigned data)
{
write_stack ((addr + 1) & 0xffff, data & 0xff);
write_stack (addr, data >> 8);
}
static unsigned
read_stack16 (unsigned addr)
{
return (read_stack (addr) << 8) | read_stack ((addr + 1) & 0xffff);
}
static void
direct (void)
{
unsigned val = read8 (PC) | DP;
PC++;
ea = val;
}
static void
indexed (void) /* note take 1 extra cycle */
{
unsigned post = imm_byte ();
unsigned *R = index_regs[(post >> 5) & 0x3];
if (post & 0x80)
{
switch (post & 0x1f)
{
case 0x00:
ea = *R;
*R = (*R + 1) & 0xffff;
cpu_clk -= 6;
break;
case 0x01:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
break;
case 0x02:
*R = (*R - 1) & 0xffff;
ea = *R;
cpu_clk -= 6;
break;
case 0x03:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
break;
case 0x04:
ea = *R;
cpu_clk -= 4;
break;
case 0x05:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
break;
case 0x06:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
break;
case 0x08:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
break;
case 0x09:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
break;
case 0x0d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
break;
case 0x11:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x13:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x14:
ea = *R;
cpu_clk -= 4;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x15:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x16:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x18:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x19:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1f:
ea = imm_word ();
cpu_clk -= 6;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
default:
ea = 0;
- printf ("%X: invalid index post $%02X\n", iPC, post);
- if (debug_enabled)
- {
- monitor_on = 1;
- }
- else
- {
- exit (1);
- }
+ sim_error ("invalid index post $%02X\n", post);
break;
}
}
else
{
if (post & 0x10)
post |= 0xfff0;
else
post &= 0x000f;
ea = (*R + post) & 0xffff;
cpu_clk -= 5;
}
}
static void
extended (void)
{
unsigned val = read16 (PC);
PC += 2;
ea = val;
}
/* external register functions */
unsigned
get_a (void)
{
return A;
}
unsigned
get_b (void)
{
return B;
}
unsigned
get_dp (void)
{
return DP >> 8;
}
unsigned
get_x (void)
{
return X;
}
unsigned
get_y (void)
{
return Y;
}
unsigned
get_s (void)
{
return S;
}
unsigned
get_u (void)
{
return U;
}
unsigned
get_pc (void)
{
return PC & 0xffff;
}
unsigned
get_d (void)
{
return (A << 8) | B;
}
#ifdef H6309
unsigned
get_e (void)
{
return E;
}
unsigned
get_f (void)
{
return F;
}
unsigned
get_w (void)
{
return (E << 8) | F;
}
unsigned
get_q (void)
{
return (get_w () << 16) | get_d ();
}
unsigned
get_v (void)
{
return V;
}
unsigned
get_zero (void)
{
return 0;
}
unsigned
get_md (void)
{
return MD;
}
#endif
void
set_a (unsigned val)
{
A = val & 0xff;
}
void
set_b (unsigned val)
{
B = val & 0xff;
}
void
set_dp (unsigned val)
{
DP = (val & 0xff) << 8;
}
void
set_x (unsigned val)
{
X = val & 0xffff;
}
void
set_y (unsigned val)
{
Y = val & 0xffff;
}
void
set_s (unsigned val)
{
S = val & 0xffff;
check_stack ();
}
void
set_u (unsigned val)
{
U = val & 0xffff;
}
void
set_pc (unsigned val)
{
PC = val & 0xffff;
check_pc ();
}
void
set_d (unsigned val)
{
A = (val >> 8) & 0xff;
B = val & 0xff;
}
#ifdef H6309
void
set_e (unsigned val)
{
E = val & 0xff;
}
void
set_f (unsigned val)
{
F = val & 0xff;
}
void
set_w (unsigned val)
{
E = (val >> 8) & 0xff;
F = val & 0xff;
}
void
set_q (unsigned val)
{
set_w ((val >> 16) & 0xffff);
set_d (val & 0xffff);
}
void
set_v (unsigned val)
{
V = val & 0xff;
}
void
set_zero (unsigned val)
{
}
void
set_md (unsigned val)
{
MD = val & 0xff;
}
#endif
/* handle condition code register */
unsigned
get_cc (void)
{
unsigned res = EFI & (E_FLAG | F_FLAG | I_FLAG);
if (H & 0x10)
res |= H_FLAG;
if (N & 0x80)
res |= N_FLAG;
if (Z == 0)
res |= Z_FLAG;
if (OV & 0x80)
res |= V_FLAG;
if (C != 0)
res |= C_FLAG;
return res;
}
void
set_cc (unsigned arg)
{
EFI = arg & (E_FLAG | F_FLAG | I_FLAG);
H = (arg & H_FLAG ? 0x10 : 0);
N = (arg & N_FLAG ? 0x80 : 0);
Z = (~arg) & Z_FLAG;
OV = (arg & V_FLAG ? 0x80 : 0);
C = arg & C_FLAG;
cc_changed = 1;
}
void
cc_modified (void)
{
/* Check for pending interrupts */
if (firqs_pending && !(EFI & F_FLAG))
firq ();
else if (irqs_pending && !(EFI & I_FLAG))
irq ();
cc_changed = 0;
}
unsigned
get_reg (unsigned nro)
{
unsigned val = 0xff;
switch (nro)
{
case 0:
val = (A << 8) | B;
break;
case 1:
val = X;
break;
case 2:
val = Y;
break;
case 3:
val = U;
break;
case 4:
val = S;
break;
case 5:
val = PC & 0xffff;
break;
#ifdef H6309
case 6:
val = (E << 8) | F;
break;
case 7:
val = V;
break;
#endif
case 8:
val = A;
break;
case 9:
val = B;
break;
case 10:
val = get_cc ();
break;
case 11:
val = DP >> 8;
break;
#ifdef H6309
case 14:
val = E;
break;
case 15:
val = F;
break;
#endif
}
return val;
}
void
set_reg (unsigned nro, unsigned val)
{
switch (nro)
{
case 0:
A = val >> 8;
B = val & 0xff;
break;
case 1:
X = val;
break;
case 2:
Y = val;
break;
case 3:
U = val;
break;
case 4:
S = val;
break;
case 5:
PC = val;
check_pc ();
break;
#ifdef H6309
case 6:
E = val >> 8;
F = val & 0xff;
break;
case 7:
V = val;
break;
#endif
case 8:
A = val;
break;
case 9:
B = val;
break;
case 10:
set_cc (val);
break;
case 11:
DP = val << 8;
break;
#ifdef H6309
case 14:
E = val;
break;
case 15:
F = val;
break;
#endif
}
}
/* 8-Bit Accumulator and Memory Instructions */
static unsigned
adc (unsigned arg, unsigned val)
{
unsigned res = arg + val + (C != 0);
C = (res >> 1) & 0x80;
N = Z = res &= 0xff;
OV = H = arg ^ val ^ res ^ C;
return res;
}
static unsigned
add (unsigned arg, unsigned val)
{
unsigned res = arg + val;
C = (res >> 1) & 0x80;
N = Z = res &= 0xff;
OV = H = arg ^ val ^ res ^ C;
return res;
}
static unsigned
and (unsigned arg, unsigned val)
{
unsigned res = arg & val;
N = Z = res;
OV = 0;
return res;
}
static unsigned
asl (unsigned arg) /* same as lsl */
{
unsigned res = arg << 1;
C = res & 0x100;
N = Z = res &= 0xff;
OV = arg ^ res;
cpu_clk -= 2;
return res;
}
static unsigned
asr (unsigned arg)
{
unsigned res = (INT8) arg;
C = res & 1;
N = Z = res = (res >> 1) & 0xff;
cpu_clk -= 2;
return res;
}
static void
bit (unsigned arg, unsigned val)
{
unsigned res = arg & val;
N = Z = res;
OV = 0;
}
static unsigned
clr (unsigned arg)
{
C = N = Z = OV = arg = 0;
cpu_clk -= 2;
return arg;
}
static void
cmp (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
}
static unsigned
com (unsigned arg)
{
unsigned res = arg ^ 0xff;
N = Z = res;
OV = 0;
C = 1;
cpu_clk -= 2;
return res;
}
static void
daa (void)
{
unsigned res = A;
unsigned msn = res & 0xf0;
unsigned lsn = res & 0x0f;
if (lsn > 0x09 || (H & 0x10))
res += 0x06;
if (msn > 0x80 && lsn > 0x09)
res += 0x60;
if (msn > 0x90 || (C != 0))
res += 0x60;
C |= (res & 0x100);
A = N = Z = res &= 0xff;
OV = 0; /* fix this */
cpu_clk -= 2;
}
static unsigned
dec (unsigned arg)
{
unsigned res = (arg - 1) & 0xff;
|
bcd/exec09
|
11ff0f8fa870d11b22ff19d3e9d332c599c42819
|
Exit with sim_error() on cwai, sync opcodes.
|
diff --git a/6809.c b/6809.c
index 03e0a33..3084e61 100644
--- a/6809.c
+++ b/6809.c
@@ -1104,1034 +1104,1032 @@ abx (void)
static void
addd (unsigned val)
{
unsigned arg = (A << 8) | B;
unsigned res = arg + val;
C = res & 0x10000;
Z = res &= 0xffff;
OV = ((arg ^ res) & (val ^ res)) >> 8;
A = N = res >> 8;
B = res & 0xff;
}
static void
cmp16 (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x10000;
Z = res &= 0xffff;
N = res >> 8;
OV = ((arg ^ val) & (arg ^ res)) >> 8;
}
static void
ldd (unsigned arg)
{
unsigned res = arg;
Z = res;
A = N = res >> 8;
B = res & 0xff;
OV = 0;
}
static unsigned
ld16 (unsigned arg)
{
unsigned res = arg;
Z = res;
N = res >> 8;
OV = 0;
return res;
}
static void
sex (void)
{
unsigned res = B;
Z = res;
N = res &= 0x80;
if (res != 0)
res = 0xff;
A = res;
cpu_clk -= 2;
}
static void
std (void)
{
unsigned res = (A << 8) | B;
Z = res;
N = A;
OV = 0;
WRMEM16 (ea, res);
}
static void
st16 (unsigned arg)
{
unsigned res = arg;
Z = res;
N = res >> 8;
OV = 0;
WRMEM16 (ea, res);
}
static void
subd (unsigned val)
{
unsigned arg = (A << 8) | B;
unsigned res = arg - val;
C = res & 0x10000;
Z = res &= 0xffff;
OV = ((arg ^ val) & (arg ^ res)) >> 8;
A = N = res >> 8;
B = res & 0xff;
}
/* stack instructions */
static void
pshs (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x80)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
}
if (post & 0x40)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, U);
}
if (post & 0x20)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
}
if (post & 0x10)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
}
}
static void
pshu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x80)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, PC & 0xffff);
}
if (post & 0x40)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, S);
}
if (post & 0x20)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, Y);
}
if (post & 0x10)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, get_cc ());
}
}
static void
puls (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
}
static void
pulu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (U));
U = (U + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (U) << 8;
U = (U + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
S = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (U);
check_pc ();
U = (U + 2) & 0xffff;
}
}
/* Miscellaneous Instructions */
static void
nop (void)
{
cpu_clk -= 2;
}
static void
jsr (void)
{
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
change_pc (ea);
monitor_call (0);
}
static void
rti (void)
{
monitor_return ();
cpu_clk -= 6;
command_exit_irq_hook (get_cycles () - irq_start_time);
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
if ((EFI & E_FLAG) != 0)
{
cpu_clk -= 9;
A = read_stack (S);
S = (S + 1) & 0xffff;
B = read_stack (S);
S = (S + 1) & 0xffff;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
static void
rts (void)
{
monitor_return ();
cpu_clk -= 5;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
void
irq (void)
{
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= I_FLAG;
irq_start_time = get_cycles ();
change_pc (read16 (0xfff8));
#if 1
irqs_pending = 0;
#endif
}
void
firq (void)
{
EFI &= ~E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
change_pc (read16 (0xfff6));
#if 1
firqs_pending = 0;
#endif
}
void
swi (void)
{
cpu_clk -= 19;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
change_pc (read16 (0xfffa));
}
void
swi2 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff4));
}
void
swi3 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff2));
}
void
cwai (void)
{
- puts ("CWAI - not supported yet!");
- exit (100);
+ sim_error ("CWAI - not supported yet!");
}
void
sync (void)
{
- puts ("SYNC - not supported yet!");
- exit (100);
cpu_clk -= 4;
+ sim_error ("SYNC - not supported yet!");
}
static void
orcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () | tmp);
cpu_clk -= 3;
}
static void
andcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () & tmp);
cpu_clk -= 3;
}
/* Branch Instructions */
#define cond_HI() ((Z != 0) && (C == 0))
#define cond_LS() ((Z == 0) || (C != 0))
#define cond_HS() (C == 0)
#define cond_LO() (C != 0)
#define cond_NE() (Z != 0)
#define cond_EQ() (Z == 0)
#define cond_VC() ((OV & 0x80) == 0)
#define cond_VS() ((OV & 0x80) != 0)
#define cond_PL() ((N & 0x80) == 0)
#define cond_MI() ((N & 0x80) != 0)
#define cond_GE() (((N^OV) & 0x80) == 0)
#define cond_LT() (((N^OV) & 0x80) != 0)
#define cond_GT() ((((N^OV) & 0x80) == 0) && (Z != 0))
#define cond_LE() ((((N^OV) & 0x80) != 0) || (Z == 0))
static void
bra (void)
{
INT8 tmp = (INT8) imm_byte ();
change_pc (PC + tmp);
}
static void
branch (unsigned cond)
{
if (cond)
bra ();
else
change_pc (PC+1);
cpu_clk -= 3;
}
static void
long_bra (void)
{
INT16 tmp = (INT16) imm_word ();
change_pc (PC + tmp);
}
static void
long_branch (unsigned cond)
{
if (cond)
{
long_bra ();
cpu_clk -= 6;
}
else
{
change_pc (PC + 2);
cpu_clk -= 5;
}
}
static void
long_bsr (void)
{
INT16 tmp = (INT16) imm_word ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 9;
change_pc (ea);
monitor_call (0);
}
static void
bsr (void)
{
INT8 tmp = (INT8) imm_byte ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 7;
change_pc (ea);
monitor_call (0);
}
/* execute 6809 code */
int
cpu_execute (int cycles)
{
unsigned opcode;
cpu_period = cpu_clk = cycles;
do
{
command_insn_hook ();
if (check_break () != 0)
monitor_on = 1;
if (monitor_on != 0)
if (monitor6809 () != 0)
goto cpu_exit;
iPC = PC;
opcode = imm_byte ();
switch (opcode)
{
case 0x00:
direct ();
cpu_clk -= 4;
WRMEM (ea, neg (RDMEM (ea)));
break; /* NEG direct */
#ifdef H6309
case 0x01: /* OIM */
break;
case 0x02: /* AIM */
break;
#endif
case 0x03:
direct ();
cpu_clk -= 4;
WRMEM (ea, com (RDMEM (ea)));
break; /* COM direct */
case 0x04:
direct ();
cpu_clk -= 4;
WRMEM (ea, lsr (RDMEM (ea)));
break; /* LSR direct */
#ifdef H6309
case 0x05: /* EIM */
break;
#endif
case 0x06:
direct ();
cpu_clk -= 4;
WRMEM (ea, ror (RDMEM (ea)));
break; /* ROR direct */
case 0x07:
direct ();
cpu_clk -= 4;
WRMEM (ea, asr (RDMEM (ea)));
break; /* ASR direct */
case 0x08:
direct ();
cpu_clk -= 4;
WRMEM (ea, asl (RDMEM (ea)));
break; /* ASL direct */
case 0x09:
direct ();
cpu_clk -= 4;
WRMEM (ea, rol (RDMEM (ea)));
break; /* ROL direct */
case 0x0a:
direct ();
cpu_clk -= 4;
WRMEM (ea, dec (RDMEM (ea)));
break; /* DEC direct */
#ifdef H6309
case 0x0B: /* TIM */
break;
#endif
case 0x0c:
direct ();
cpu_clk -= 4;
WRMEM (ea, inc (RDMEM (ea)));
break; /* INC direct */
case 0x0d:
direct ();
cpu_clk -= 4;
tst (RDMEM (ea));
break; /* TST direct */
case 0x0e:
direct ();
cpu_clk -= 3;
PC = ea;
check_pc ();
monitor_call (FC_TAIL_CALL);
break; /* JMP direct */
case 0x0f:
direct ();
cpu_clk -= 4;
WRMEM (ea, clr (RDMEM (ea)));
break; /* CLR direct */
case 0x10:
{
opcode = imm_byte ();
switch (opcode)
{
case 0x21:
cpu_clk -= 5;
PC += 2;
break;
case 0x22:
long_branch (cond_HI ());
break;
case 0x23:
long_branch (cond_LS ());
break;
case 0x24:
long_branch (cond_HS ());
break;
case 0x25:
long_branch (cond_LO ());
break;
case 0x26:
long_branch (cond_NE ());
break;
case 0x27:
long_branch (cond_EQ ());
break;
case 0x28:
long_branch (cond_VC ());
break;
case 0x29:
long_branch (cond_VS ());
break;
case 0x2a:
long_branch (cond_PL ());
break;
case 0x2b:
long_branch (cond_MI ());
break;
case 0x2c:
long_branch (cond_GE ());
break;
case 0x2d:
long_branch (cond_LT ());
break;
case 0x2e:
long_branch (cond_GT ());
break;
case 0x2f:
long_branch (cond_LE ());
break;
#ifdef H6309
case 0x30: /* ADDR */
break;
case 0x31: /* ADCR */
break;
case 0x32: /* SUBR */
break;
case 0x33: /* SBCR */
break;
case 0x34: /* ANDR */
break;
case 0x35: /* ORR */
break;
case 0x36: /* EORR */
break;
case 0x37: /* CMPR */
break;
case 0x38: /* PSHSW */
break;
case 0x39: /* PULSW */
break;
case 0x3a: /* PSHUW */
break;
case 0x3b: /* PULUW */
break;
#endif
case 0x3f:
swi2 ();
break;
#ifdef H6309
case 0x40: /* NEGD */
break;
case 0x43: /* COMD */
break;
case 0x44: /* LSRD */
break;
case 0x46: /* RORD */
break;
case 0x47: /* ASRD */
break;
case 0x48: /* ASLD/LSLD */
break;
case 0x49: /* ROLD */
break;
case 0x4a: /* DECD */
break;
case 0x4c: /* INCD */
break;
case 0x4d: /* TSTD */
break;
case 0x4f: /* CLRD */
break;
case 0x53: /* COMW */
break;
case 0x54: /* LSRW */
break;
case 0x56: /* ??RORW */
break;
case 0x59: /* ROLW */
break;
case 0x5a: /* DECW */
break;
case 0x5c: /* INCW */
break;
case 0x5d: /* TSTW */
break;
case 0x5f: /* CLRW */
break;
case 0x80: /* SUBW */
break;
case 0x81: /* CMPW */
break;
case 0x82: /* SBCD */
break;
#endif
case 0x83:
cpu_clk -= 5;
cmp16 (get_d (), imm_word ());
break;
#ifdef H6309
case 0x84: /* ANDD */
break;
case 0x85: /* BITD */
break;
case 0x86: /* LDW */
break;
case 0x88: /* EORD */
break;
case 0x89: /* ADCD */
break;
case 0x8a: /* ORD */
break;
case 0x8b: /* ADDW */
break;
#endif
case 0x8c:
cpu_clk -= 5;
cmp16 (Y, imm_word ());
break;
case 0x8e:
cpu_clk -= 4;
Y = ld16 (imm_word ());
break;
#ifdef H6309
case 0x90: /* SUBW */
break;
case 0x91: /* CMPW */
break;
case 0x92: /* SBCD */
break;
#endif
case 0x93:
direct ();
cpu_clk -= 5;
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0x9c:
direct ();
cpu_clk -= 5;
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0x9e:
direct ();
cpu_clk -= 5;
Y = ld16 (RDMEM16 (ea));
break;
case 0x9f:
direct ();
cpu_clk -= 5;
st16 (Y);
break;
case 0xa3:
cpu_clk--;
indexed ();
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0xac:
cpu_clk--;
indexed ();
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0xae:
cpu_clk--;
indexed ();
Y = ld16 (RDMEM16 (ea));
break;
case 0xaf:
cpu_clk--;
indexed ();
st16 (Y);
break;
case 0xb3:
extended ();
cpu_clk -= 6;
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0xbc:
extended ();
cpu_clk -= 6;
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0xbe:
extended ();
cpu_clk -= 6;
Y = ld16 (RDMEM16 (ea));
break;
case 0xbf:
extended ();
cpu_clk -= 6;
st16 (Y);
break;
case 0xce:
cpu_clk -= 4;
S = ld16 (imm_word ());
break;
case 0xde:
direct ();
cpu_clk -= 5;
S = ld16 (RDMEM16 (ea));
break;
case 0xdf:
direct ();
cpu_clk -= 5;
st16 (S);
break;
case 0xee:
cpu_clk--;
indexed ();
S = ld16 (RDMEM16 (ea));
break;
case 0xef:
cpu_clk--;
indexed ();
st16 (S);
break;
case 0xfe:
extended ();
cpu_clk -= 6;
S = ld16 (RDMEM16 (ea));
break;
case 0xff:
extended ();
cpu_clk -= 6;
st16 (S);
break;
default:
sim_error ("invalid opcode (1) at %s\n", monitor_addr_name (iPC));
break;
}
}
break;
case 0x11:
{
opcode = imm_byte ();
switch (opcode)
{
case 0x3f:
swi3 ();
break;
case 0x83:
cpu_clk -= 5;
cmp16 (U, imm_word ());
break;
case 0x8c:
cpu_clk -= 5;
cmp16 (S, imm_word ());
break;
case 0x93:
direct ();
cpu_clk -= 5;
cmp16 (U, RDMEM16 (ea));
cpu_clk--;
break;
case 0x9c:
direct ();
cpu_clk -= 5;
cmp16 (S, RDMEM16 (ea));
cpu_clk--;
break;
case 0xa3:
cpu_clk--;
indexed ();
cmp16 (U, RDMEM16 (ea));
cpu_clk--;
break;
case 0xac:
cpu_clk--;
indexed ();
cmp16 (S, RDMEM16 (ea));
cpu_clk--;
break;
case 0xb3:
|
bcd/exec09
|
d41b20660e84b2e3c5169364baaa1f436056b671
|
Bump version to 0.92
|
diff --git a/configure b/configure
index ebb5c23..066c191 100755
--- a/configure
+++ b/configure
@@ -1,2558 +1,2558 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for m6809-run 0.91.
+# Generated by GNU Autoconf 2.61 for m6809-run 0.92.
#
# Report bugs to <brian@oddchange.com>.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in
*posix*) set -o posix ;;
esac
fi
# PATH needs CR
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
as_nl='
'
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
{ (exit 1); exit 1; }
fi
# Work around bugs in pre-3.0 UWIN ksh.
for as_var in ENV MAIL MAILPATH
do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# CDPATH.
$as_unset CDPATH
if test "x$CONFIG_SHELL" = x; then
if (eval ":") 2>/dev/null; then
as_have_required=yes
else
as_have_required=no
fi
if test $as_have_required = yes && (eval ":
(as_func_return () {
(exit \$1)
}
as_func_success () {
as_func_return 0
}
as_func_failure () {
as_func_return 1
}
as_func_ret_success () {
return 0
}
as_func_ret_failure () {
return 1
}
exitcode=0
if as_func_success; then
:
else
exitcode=1
echo as_func_success failed.
fi
if as_func_failure; then
exitcode=1
echo as_func_failure succeeded.
fi
if as_func_ret_success; then
:
else
exitcode=1
echo as_func_ret_success failed.
fi
if as_func_ret_failure; then
exitcode=1
echo as_func_ret_failure succeeded.
fi
if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
:
else
exitcode=1
echo positional parameters were not saved.
fi
test \$exitcode = 0) || { (exit 1); exit 1; }
(
as_lineno_1=\$LINENO
as_lineno_2=\$LINENO
test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
") 2> /dev/null; then
:
else
as_candidate_shells=
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
case $as_dir in
/*)
for as_base in sh bash ksh sh5; do
as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
done;;
esac
done
IFS=$as_save_IFS
for as_shell in $as_candidate_shells $SHELL; do
# Try only shells that exist, to save several forks.
if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
{ ("$as_shell") 2> /dev/null <<\_ASEOF
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in
*posix*) set -o posix ;;
esac
fi
:
_ASEOF
}; then
CONFIG_SHELL=$as_shell
as_have_required=yes
if { "$as_shell" 2> /dev/null <<\_ASEOF
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in
*posix*) set -o posix ;;
esac
fi
:
(as_func_return () {
(exit $1)
}
as_func_success () {
as_func_return 0
}
as_func_failure () {
as_func_return 1
}
as_func_ret_success () {
return 0
}
as_func_ret_failure () {
return 1
}
exitcode=0
if as_func_success; then
:
else
exitcode=1
echo as_func_success failed.
fi
if as_func_failure; then
exitcode=1
echo as_func_failure succeeded.
fi
if as_func_ret_success; then
:
else
exitcode=1
echo as_func_ret_success failed.
fi
if as_func_ret_failure; then
exitcode=1
echo as_func_ret_failure succeeded.
fi
if ( set x; as_func_ret_success y && test x = "$1" ); then
:
else
exitcode=1
echo positional parameters were not saved.
fi
test $exitcode = 0) || { (exit 1); exit 1; }
(
as_lineno_1=$LINENO
as_lineno_2=$LINENO
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
_ASEOF
}; then
break
fi
fi
done
if test "x$CONFIG_SHELL" != x; then
for as_var in BASH_ENV ENV
do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
done
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
fi
if test $as_have_required = no; then
echo This script requires a shell more modern than all the
echo shells that I found on your system. Please install a
echo modern shell, or manually run the script under such a
echo shell if you do have one.
{ (exit 1); exit 1; }
fi
fi
fi
(eval "as_func_return () {
(exit \$1)
}
as_func_success () {
as_func_return 0
}
as_func_failure () {
as_func_return 1
}
as_func_ret_success () {
return 0
}
as_func_ret_failure () {
return 1
}
exitcode=0
if as_func_success; then
:
else
exitcode=1
echo as_func_success failed.
fi
if as_func_failure; then
exitcode=1
echo as_func_failure succeeded.
fi
if as_func_ret_success; then
:
else
exitcode=1
echo as_func_ret_success failed.
fi
if as_func_ret_failure; then
exitcode=1
echo as_func_ret_failure succeeded.
fi
if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
:
else
exitcode=1
echo positional parameters were not saved.
fi
test \$exitcode = 0") || {
echo No shell found that supports shell functions.
echo Please tell autoconf@gnu.org about your system,
echo including any error possibly output before this
echo message
}
as_lineno_1=$LINENO
as_lineno_2=$LINENO
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line after each line using $LINENO; the second 'sed'
# does the real work. The second script uses 'N' to pair each
# line-number line with the line containing $LINENO, and appends
# trailing '-' during substitution so that $LINENO is not a special
# case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# scripts with optimization help from Paolo Bonzini. Blame Lee
# E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in
-n*)
case `echo 'x\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
*) ECHO_C='\c';;
esac;;
*)
ECHO_N='-n';;
esac
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir
fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -p'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 7<&0 </dev/null 6>&1
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='m6809-run'
PACKAGE_TARNAME='m6809-run'
-PACKAGE_VERSION='0.91'
-PACKAGE_STRING='m6809-run 0.91'
+PACKAGE_VERSION='0.92'
+PACKAGE_STRING='m6809-run 0.92'
PACKAGE_BUGREPORT='brian@oddchange.com'
ac_unique_file="6809.c"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif"
ac_subst_vars='SHELL
PATH_SEPARATOR
PACKAGE_NAME
PACKAGE_TARNAME
PACKAGE_VERSION
PACKAGE_STRING
PACKAGE_BUGREPORT
exec_prefix
prefix
program_transform_name
bindir
sbindir
libexecdir
datarootdir
datadir
sysconfdir
sharedstatedir
localstatedir
includedir
oldincludedir
docdir
infodir
htmldir
dvidir
pdfdir
psdir
libdir
localedir
mandir
DEFS
ECHO_C
ECHO_N
ECHO_T
LIBS
build_alias
host_alias
target_alias
INSTALL_PROGRAM
INSTALL_SCRIPT
INSTALL_DATA
CYGPATH_W
PACKAGE
VERSION
ACLOCAL
AUTOCONF
AUTOMAKE
AUTOHEADER
MAKEINFO
install_sh
STRIP
INSTALL_STRIP_PROGRAM
mkdir_p
AWK
SET_MAKE
am__leading_dot
AMTAR
am__tar
am__untar
CC
CFLAGS
LDFLAGS
CPPFLAGS
ac_ct_CC
EXEEXT
OBJEXT
DEPDIR
am__include
am__quote
AMDEP_TRUE
AMDEP_FALSE
AMDEPBACKSLASH
CCDEPMODE
am__fastdepCC_TRUE
am__fastdepCC_FALSE
CPP
GREP
EGREP
LIBOBJS
LTLIBOBJS'
ac_subst_files=''
ac_precious_vars='build_alias
host_alias
target_alias
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CPP'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'
ac_prev=
ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval $ac_prev=\$ac_option
ac_prev=
continue
fi
case $ac_option in
*=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
*) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_dashdash$ac_option in
--)
ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
-datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
| --dataroo | --dataro | --datar)
ac_prev=datarootdir ;;
-datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
eval enable_$ac_feature=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
-docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
docdir=$ac_optarg ;;
-dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
ac_prev=dvidir ;;
-dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
eval enable_$ac_feature=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
ac_prev=htmldir ;;
-htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
| --ht=*)
htmldir=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localedir | --localedir | --localedi | --localed | --locale)
ac_prev=localedir ;;
-localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
localedir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
ac_prev=pdfdir ;;
-pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
pdfdir=$ac_optarg ;;
-psdir | --psdir | --psdi | --psd | --ps)
ac_prev=psdir ;;
-psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
psdir=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
eval with_$ac_package=\$ac_optarg ;;
-without-* | --without-*)
ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
eval with_$ac_package=no ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) { echo "$as_me: error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; }
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid variable name: $ac_envvar" >&2
{ (exit 1); exit 1; }; }
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
{ echo "$as_me: error: missing argument to $ac_option" >&2
{ (exit 1); exit 1; }; }
fi
# Be sure to have absolute directory names.
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
do
eval ac_val=\$$ac_var
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
{ echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; }
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
{ echo "$as_me: error: Working directory cannot be determined" >&2
{ (exit 1); exit 1; }; }
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
{ echo "$as_me: error: pwd does not report name of working directory" >&2
{ (exit 1); exit 1; }; }
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then the parent directory.
ac_confdir=`$as_dirname -- "$0" ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$0" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
{ (exit 1); exit 1; }; }
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
{ (exit 1); exit 1; }; }
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
srcdir=.
fi
# Remove unnecessary trailing slashes from srcdir.
# Double slashes in file names in object file debugging info
# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
for ac_var in $ac_precious_vars; do
eval ac_env_${ac_var}_set=\${${ac_var}+set}
eval ac_env_${ac_var}_value=\$${ac_var}
eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
eval ac_cv_env_${ac_var}_value=\$${ac_var}
done
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures m6809-run 0.91 to adapt to many kinds of systems.
+\`configure' configures m6809-run 0.92 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print \`checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/m6809-run]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of m6809-run 0.91:";;
+ short | recursive ) echo "Configuration of m6809-run 0.92:";;
esac
cat <<\_ACEOF
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
--enable-wpc Enable WPC address map
--enable-6309 Enable 6309 extensions
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to <brian@oddchange.com>.
_ACEOF
ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d "$ac_dir" || continue
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
cd "$ac_dir" || { ac_status=$?; continue; }
# Check for guested configure.
if test -f "$ac_srcdir/configure.gnu"; then
echo &&
$SHELL "$ac_srcdir/configure.gnu" --help=recursive
elif test -f "$ac_srcdir/configure"; then
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-m6809-run configure 0.91
+m6809-run configure 0.92
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit
fi
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by m6809-run $as_me 0.91, which was
+It was created by m6809-run $as_me 0.92, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
_ACEOF
exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
echo "PATH: $as_dir"
done
IFS=$as_save_IFS
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
2)
ac_configure_args1="$ac_configure_args1 '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
ac_configure_args="$ac_configure_args '$ac_arg'"
;;
esac
done
done
$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Use '\'' to represent an apostrophe within the trap.
# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
echo
cat <<\_ASBOX
## ---------------- ##
## Cache variables. ##
## ---------------- ##
_ASBOX
echo
# The following way of writing the cache mishandles newlines in values,
(
for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
*) $as_unset $ac_var ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
sed -n \
"s/'\''/'\''\\\\'\'''\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
;; #(
*)
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
)
echo
cat <<\_ASBOX
## ----------------- ##
## Output variables. ##
## ----------------- ##
_ASBOX
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
cat <<\_ASBOX
## ------------------- ##
## File substitutions. ##
## ------------------- ##
_ASBOX
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
cat <<\_ASBOX
## ----------- ##
## confdefs.h. ##
## ----------- ##
_ASBOX
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core core.conftest.* &&
rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -n "$CONFIG_SITE"; then
set x "$CONFIG_SITE"
elif test "x$prefix" != xNONE; then
set x "$prefix/share/config.site" "$prefix/etc/config.site"
else
set x "$ac_default_prefix/share/config.site" \
"$ac_default_prefix/etc/config.site"
fi
shift
for ac_site_file
do
if test -r "$ac_site_file"; then
{ echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special
# files actually), so we avoid doing that.
if test -f "$cache_file"; then
{ echo "$as_me:$LINENO: loading cache $cache_file" >&5
echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
{ echo "$as_me:$LINENO: creating cache $cache_file" >&5
echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val=\$ac_cv_env_${ac_var}_value
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
{ echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
{ echo "$as_me:$LINENO: former value: $ac_old_val" >&5
echo "$as_me: former value: $ac_old_val" >&2;}
{ echo "$as_me:$LINENO: current value: $ac_new_val" >&5
echo "$as_me: current value: $ac_new_val" >&2;}
ac_cache_corrupted=:
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
{ echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
echo "$as_me: error: changes in the environment can compromise the build" >&2;}
{ { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
am__api_version="1.9"
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
{ { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
{ (exit 1); exit 1; }; }
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AmigaOS /C/install, which installs bootblocks on floppy discs
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
if test -z "$INSTALL"; then
if test "${ac_cv_path_install+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
# Account for people who put trailing slashes in PATH elements.
case $as_dir/ in
./ | .// | /cC/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
break 3
fi
fi
done
done
;;
esac
done
IFS=$as_save_IFS
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
# As a last resort, use the slow shell script. Don't cache a
# value for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
INSTALL=$ac_install_sh
fi
fi
{ echo "$as_me:$LINENO: result: $INSTALL" >&5
echo "${ECHO_T}$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$*" != "X $srcdir/configure conftest.file" \
&& test "$*" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
{ { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
alias in your environment" >&5
echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
alias in your environment" >&2;}
{ (exit 1); exit 1; }; }
fi
test "$2" = conftest.file
)
then
# Ok.
:
else
{ { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
Check your system clock" >&5
echo "$as_me: error: newly created file is older than distributed files!
Check your system clock" >&2;}
{ (exit 1); exit 1; }; }
fi
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
test "$program_prefix" != NONE &&
program_transform_name="s&^&$program_prefix&;$program_transform_name"
# Use a double $ so make ignores it.
test "$program_suffix" != NONE &&
program_transform_name="s&\$&$program_suffix&;$program_transform_name"
# Double any \ or $. echo might interpret backslashes.
# By default was `s,x,x', remove it if useless.
cat <<\_ACEOF >conftest.sed
s/[\\$]/&&/g;s/;s,x,x,$//
_ACEOF
program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
rm -f conftest.sed
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
{ echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
fi
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
# We used to keeping the `.' as first argument, in order to
# allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
# where $(somedir) is conditionally defined. However this is wrong
# for two reasons:
# 1. if the package is installed by a user who cannot write `.'
# make install will fail,
# 2. the above comment should most certainly read
# $(mkdir_p) $(DESTDIR)$(somedir)
# so it does not work when $(somedir) is undefined and
# $(DESTDIR) is not.
# To support the latter case, we have to write
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
# so the `.' trick is pointless.
mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
for d in ./-p ./--version;
do
test -d $d && rmdir $d
done
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
if test -f "$ac_aux_dir/mkinstalldirs"; then
mkdir_p='$(mkinstalldirs)'
else
mkdir_p='$(install_sh) -d'
fi
fi
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_AWK+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$AWK"; then
ac_cv_prog_AWK="$AWK" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_AWK="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
{ echo "$as_me:$LINENO: result: $AWK" >&5
echo "${ECHO_T}$AWK" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
test -n "$AWK" && break
done
{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.make <<\_ACEOF
SHELL = /bin/sh
all:
@echo '@@@%%%=$(MAKE)=@@@%%%'
_ACEOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
case `${MAKE-make} -f conftest.make 2>/dev/null` in
*@@@%%%=?*=@@@%%%*)
eval ac_cv_prog_make_${ac_make}_set=yes;;
*)
eval ac_cv_prog_make_${ac_make}_set=no;;
esac
rm -f conftest.make
fi
if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
SET_MAKE=
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
{ { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
{ (exit 1); exit 1; }; }
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
# Define the identity of the package.
PACKAGE='m6809-run'
- VERSION='0.91'
+ VERSION='0.92'
cat >>confdefs.h <<_ACEOF
#define PACKAGE "$PACKAGE"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define VERSION "$VERSION"
_ACEOF
# Some tools Automake needs.
ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
install_sh=${install_sh-"$am_aux_dir/install-sh"}
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
if test "$cross_compiling" != no; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$STRIP"; then
ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
{ echo "$as_me:$LINENO: result: $STRIP" >&5
echo "${ECHO_T}$STRIP" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_STRIP"; then
ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_STRIP="strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
{ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
echo "${ECHO_T}$ac_ct_STRIP" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
if test "x$ac_ct_STRIP" = x; then
STRIP=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&5
echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
STRIP=$ac_ct_STRIP
fi
else
STRIP="$ac_cv_prog_STRIP"
fi
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# Always define AMTAR for backward compatibility.
AMTAR=${AMTAR-"${am_missing_run}tar"}
am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
ac_config_headers="$ac_config_headers config.h"
# Checks for programs.
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&5
echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
test -n "$ac_ct_CC" && break
done
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&5
echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
fi
fi
test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&5
echo "$as_me: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
# Provide some information about the compiler.
echo "$as_me:$LINENO: checking for C compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (ac_try="$ac_compiler --version >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compiler --version >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (ac_try="$ac_compiler -v >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compiler -v >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (ac_try="$ac_compiler -V >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compiler -V >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.exe b.out"
@@ -5582,1078 +5582,1078 @@ cat >>conftest.$ac_ext <<_ACEOF
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval echo '${'$as_ac_var'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
# Check whether --enable-wpc was given.
if test "${enable_wpc+set}" = set; then
enableval=$enable_wpc; wpc=$enableval
else
wpc=no
fi
if test $wpc = yes; then
cat >>confdefs.h <<\_ACEOF
#define CONFIG_WPC 1
_ACEOF
fi
# Check whether --enable-6309 was given.
if test "${enable_6309+set}" = set; then
enableval=$enable_6309; h6309=$enableval
else
h6309=no
fi
if test $h6309 = yes; then
cat >>confdefs.h <<\_ACEOF
#define H6309 1
_ACEOF
fi
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(
for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
*) $as_unset $ac_var ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
) |
sed '
/^ac_cv_env_/b end
t clear
:clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
test "x$cache_file" != "x/dev/null" &&
{ echo "$as_me:$LINENO: updating cache $cache_file" >&5
echo "$as_me: updating cache $cache_file" >&6;}
cat confcache >$cache_file
else
{ echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
ac_i=`echo "$ac_i" | sed "$ac_script"`
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
echo "$as_me: error: conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
echo "$as_me: creating $CONFIG_STATUS" >&6;}
cat >$CONFIG_STATUS <<_ACEOF
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in
*posix*) set -o posix ;;
esac
fi
# PATH needs CR
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
as_nl='
'
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
{ (exit 1); exit 1; }
fi
# Work around bugs in pre-3.0 UWIN ksh.
for as_var in ENV MAIL MAILPATH
do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# CDPATH.
$as_unset CDPATH
as_lineno_1=$LINENO
as_lineno_2=$LINENO
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line after each line using $LINENO; the second 'sed'
# does the real work. The second script uses 'N' to pair each
# line-number line with the line containing $LINENO, and appends
# trailing '-' during substitution so that $LINENO is not a special
# case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# scripts with optimization help from Paolo Bonzini. Blame Lee
# E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in
-n*)
case `echo 'x\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
*) ECHO_C='\c';;
esac;;
*)
ECHO_N='-n';;
esac
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir
fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -p'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
# Save the log message, to keep $[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by m6809-run $as_me 0.91, which was
+This file was extended by m6809-run $as_me 0.92, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
config_commands="$ac_config_commands"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.
Usage: $0 [OPTIONS] [FILE]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Configuration commands:
$config_commands
Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-m6809-run config.status 0.91
+m6809-run config.status 0.92
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
Copyright (C) 2006 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# If no file are specified by the user, then we need to provide default
# value. By we need to know if files were specified by the user.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
esac
case $ac_option in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
echo "$ac_cs_version"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
CONFIG_FILES="$CONFIG_FILES $ac_optarg"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
{ echo "$as_me: error: ambiguous option: $1
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; };;
--help | --hel | -h )
echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) { echo "$as_me: error: unrecognized option: $1
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; } ;;
*) ac_config_targets="$ac_config_targets $1"
ac_need_defaults=false ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
if \$ac_cs_recheck; then
echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
CONFIG_SHELL=$SHELL
export CONFIG_SHELL
exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
echo "$ac_log"
} >&5
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
#
# INIT-COMMANDS
#
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
tmp=
trap 'exit_status=$?
{ test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
' 0
trap '{ (exit 1); exit 1; }' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} ||
{
echo "$me: cannot create a temporary directory in ." >&2
{ (exit 1); exit 1; }
}
#
# Set up the sed scripts for CONFIG_FILES section.
#
# No need to generate the scripts if there are no CONFIG_FILES.
# This happens for instance when ./config.status config.h
if test -n "$CONFIG_FILES"; then
_ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
SHELL!$SHELL$ac_delim
PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
PACKAGE_NAME!$PACKAGE_NAME$ac_delim
PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
PACKAGE_STRING!$PACKAGE_STRING$ac_delim
PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
exec_prefix!$exec_prefix$ac_delim
prefix!$prefix$ac_delim
program_transform_name!$program_transform_name$ac_delim
bindir!$bindir$ac_delim
sbindir!$sbindir$ac_delim
libexecdir!$libexecdir$ac_delim
datarootdir!$datarootdir$ac_delim
datadir!$datadir$ac_delim
sysconfdir!$sysconfdir$ac_delim
sharedstatedir!$sharedstatedir$ac_delim
localstatedir!$localstatedir$ac_delim
includedir!$includedir$ac_delim
oldincludedir!$oldincludedir$ac_delim
docdir!$docdir$ac_delim
infodir!$infodir$ac_delim
htmldir!$htmldir$ac_delim
dvidir!$dvidir$ac_delim
pdfdir!$pdfdir$ac_delim
psdir!$psdir$ac_delim
libdir!$libdir$ac_delim
localedir!$localedir$ac_delim
mandir!$mandir$ac_delim
DEFS!$DEFS$ac_delim
ECHO_C!$ECHO_C$ac_delim
ECHO_N!$ECHO_N$ac_delim
ECHO_T!$ECHO_T$ac_delim
LIBS!$LIBS$ac_delim
build_alias!$build_alias$ac_delim
host_alias!$host_alias$ac_delim
target_alias!$target_alias$ac_delim
INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
INSTALL_DATA!$INSTALL_DATA$ac_delim
CYGPATH_W!$CYGPATH_W$ac_delim
PACKAGE!$PACKAGE$ac_delim
VERSION!$VERSION$ac_delim
ACLOCAL!$ACLOCAL$ac_delim
AUTOCONF!$AUTOCONF$ac_delim
AUTOMAKE!$AUTOMAKE$ac_delim
AUTOHEADER!$AUTOHEADER$ac_delim
MAKEINFO!$MAKEINFO$ac_delim
install_sh!$install_sh$ac_delim
STRIP!$STRIP$ac_delim
INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
mkdir_p!$mkdir_p$ac_delim
AWK!$AWK$ac_delim
SET_MAKE!$SET_MAKE$ac_delim
am__leading_dot!$am__leading_dot$ac_delim
AMTAR!$AMTAR$ac_delim
am__tar!$am__tar$ac_delim
am__untar!$am__untar$ac_delim
CC!$CC$ac_delim
CFLAGS!$CFLAGS$ac_delim
LDFLAGS!$LDFLAGS$ac_delim
CPPFLAGS!$CPPFLAGS$ac_delim
ac_ct_CC!$ac_ct_CC$ac_delim
EXEEXT!$EXEEXT$ac_delim
OBJEXT!$OBJEXT$ac_delim
DEPDIR!$DEPDIR$ac_delim
am__include!$am__include$ac_delim
am__quote!$am__quote$ac_delim
AMDEP_TRUE!$AMDEP_TRUE$ac_delim
AMDEP_FALSE!$AMDEP_FALSE$ac_delim
AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
CCDEPMODE!$CCDEPMODE$ac_delim
am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
CPP!$CPP$ac_delim
GREP!$GREP$ac_delim
EGREP!$EGREP$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 79; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
{ (exit 1); exit 1; }; }
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
if test -n "$ac_eof"; then
ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
ac_eof=`expr $ac_eof + 1`
fi
cat >>$CONFIG_STATUS <<_ACEOF
cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
_ACEOF
sed '
s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
s/^/s,@/; s/!/@,|#_!!_#|/
:n
t n
s/'"$ac_delim"'$/,g/; t
s/$/\\/; p
N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
' >>$CONFIG_STATUS <conf$$subs.sed
rm -f conf$$subs.sed
cat >>$CONFIG_STATUS <<_ACEOF
:end
s/|#_!!_#|//g
CEOF$ac_eof
_ACEOF
# VPATH may cause trouble with some makes, so we remove $(srcdir),
# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=/{
s/:*\$(srcdir):*/:/
s/:*\${srcdir}:*/:/
s/:*@srcdir@:*/:/
s/^\([^=]*=[ ]*\):*/\1/
s/:*$//
s/^[^=]*=[ ]*$//
}'
fi
cat >>$CONFIG_STATUS <<\_ACEOF
fi # test -n "$CONFIG_FILES"
for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
:L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
echo "$as_me: error: Invalid tag $ac_tag." >&2;}
{ (exit 1); exit 1; }; };;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
ac_save_IFS=$IFS
IFS=:
set x $ac_tag
IFS=$ac_save_IFS
shift
ac_file=$1
shift
case $ac_mode in
:L) ac_source=$1;;
:[FH])
ac_file_inputs=
for ac_f
do
case $ac_f in
-) ac_f="$tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
test -f "$ac_f" ||
case $ac_f in
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
{ { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
echo "$as_me: error: cannot find input file: $ac_f" >&2;}
{ (exit 1); exit 1; }; };;
esac
ac_file_inputs="$ac_file_inputs $ac_f"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
configure_input="Generated from "`IFS=:
echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
{ echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
fi
case $ac_tag in
*:-:* | *:-) cat >"$tmp/stdin";;
esac
;;
esac
ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
{ as_dir="$ac_dir"
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
echo "$as_me: error: cannot create directory $as_dir" >&2;}
{ (exit 1); exit 1; }; }; }
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
case $ac_mode in
:F)
#
# CONFIG_FILE
#
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
esac
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
case `sed -n '/datarootdir/ {
p
q
}
/@datadir@/p
/@docdir@/p
/@infodir@/p
/@localedir@/p
/@mandir@/p
' $ac_file_inputs` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
{ echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_datarootdir_hack='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
diff --git a/configure.ac b/configure.ac
index e7ab4e1..17f9ac8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,47 +1,47 @@
AC_PREREQ(2.61)
-AC_INIT(m6809-run, 0.91, brian@oddchange.com)
+AC_INIT(m6809-run, 0.92, brian@oddchange.com)
AC_CONFIG_SRCDIR([6809.c])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h termios.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
AC_C_VOLATILE
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([gettimeofday memset select strchr strstr strtoul socket])
AC_ARG_ENABLE([wpc],
AC_HELP_STRING([--enable-wpc], [Enable WPC address map]),
[wpc=$enableval], [wpc=no])
if test $wpc = yes; then
AC_DEFINE(CONFIG_WPC, 1, [Use WPC address map])
fi
AC_ARG_ENABLE([6309],
AC_HELP_STRING([--enable-6309], [Enable 6309 extensions]),
[h6309=$enableval], [h6309=no])
if test $h6309 = yes; then
AC_DEFINE(H6309, 1, [Use 6309 extensions])
fi
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
|
bcd/exec09
|
919256ad16943f5a1ffb75a9f370b6dcd69d661a
|
Add includes to SOURCES so they are distributed.
|
diff --git a/Makefile.am b/Makefile.am
index 43fdca0..b937dc1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,2 +1,6 @@
-m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c fileio.c wpclib.c
+m6809_run_SOURCES = \
+ 6809.c main.c monitor.c machine.c eon.c wpc.c \
+ symtab.c command.c fileio.c wpclib.c \
+ 6809.h config.h eon.h machine.h monitor.h wpclib.h
+
bin_PROGRAMS = m6809-run
diff --git a/Makefile.in b/Makefile.in
index 0a05e0e..b4043d9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,547 +1,551 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
bin_PROGRAMS = m6809-run$(EXEEXT)
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure COPYING depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_m6809_run_OBJECTS = 6809.$(OBJEXT) main.$(OBJEXT) monitor.$(OBJEXT) \
machine.$(OBJEXT) eon.$(OBJEXT) wpc.$(OBJEXT) symtab.$(OBJEXT) \
command.$(OBJEXT) fileio.$(OBJEXT) wpclib.$(OBJEXT)
m6809_run_OBJECTS = $(am_m6809_run_OBJECTS)
m6809_run_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(m6809_run_SOURCES)
DIST_SOURCES = $(m6809_run_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c fileio.c wpclib.c
+m6809_run_SOURCES = \
+ 6809.c main.c monitor.c machine.c eon.c wpc.c \
+ symtab.c command.c fileio.c wpclib.c \
+ 6809.h config.h eon.h machine.h monitor.h wpclib.h
+
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
m6809-run$(EXEEXT): $(m6809_run_OBJECTS) $(m6809_run_DEPENDENCIES)
@rm -f m6809-run$(EXEEXT)
$(LINK) $(m6809_run_LDFLAGS) $(m6809_run_OBJECTS) $(m6809_run_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/6809.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/machine.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symtab.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wpc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wpclib.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) config.h
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
|
bcd/exec09
|
5564c72bc6b1bb343ea8826d08df4db5e894adcb
|
Modify WPC backend to send DMD date to a remote client.
|
diff --git a/Makefile.am b/Makefile.am
index daf5acd..43fdca0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,2 +1,2 @@
-m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c fileio.c
+m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c fileio.c wpclib.c
bin_PROGRAMS = m6809-run
diff --git a/Makefile.in b/Makefile.in
index 53b1791..0a05e0e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,546 +1,547 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
bin_PROGRAMS = m6809-run$(EXEEXT)
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure COPYING depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_m6809_run_OBJECTS = 6809.$(OBJEXT) main.$(OBJEXT) monitor.$(OBJEXT) \
machine.$(OBJEXT) eon.$(OBJEXT) wpc.$(OBJEXT) symtab.$(OBJEXT) \
- command.$(OBJEXT) fileio.$(OBJEXT)
+ command.$(OBJEXT) fileio.$(OBJEXT) wpclib.$(OBJEXT)
m6809_run_OBJECTS = $(am_m6809_run_OBJECTS)
m6809_run_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(m6809_run_SOURCES)
DIST_SOURCES = $(m6809_run_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c fileio.c
+m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c fileio.c wpclib.c
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
m6809-run$(EXEEXT): $(m6809_run_OBJECTS) $(m6809_run_DEPENDENCIES)
@rm -f m6809-run$(EXEEXT)
$(LINK) $(m6809_run_LDFLAGS) $(m6809_run_OBJECTS) $(m6809_run_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/6809.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/machine.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symtab.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wpc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wpclib.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) config.h
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/wpc.c b/wpc.c
index c22cb69..c91b66e 100644
--- a/wpc.c
+++ b/wpc.c
@@ -1,648 +1,693 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#else
#error
#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <sys/errno.h>
+#include "wpclib.h"
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3c00
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
/**
* The 'wpc_asic' struct holds all of the state
* of the ASIC. There is a single instance of this,
* named 'the_wpc', and it is pointed to by the
* global 'wpc'. Only one ASIC can be defined at
* a time.
*/
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
struct hw_device *dmd_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
U8 opto_mx[8];
U8 dmd_maps[2];
- U8 dmd_active_page;
+
+ unsigned int dmd_phase;
+ U8 dmd_visibles[3];
+ U8 dmd_last_visibles[3];
int curr_sw;
int curr_sw_time;
int wdog_timer;
} the_wpc;
+
struct wpc_asic *wpc = NULL;
+int wpc_sock;
+
void wpc_asic_reset (struct hw_device *dev)
{
- wpc->curr_sw_time = 0;
- wpc->wdog_timer = 0;
+ memset (wpc, 0, sizeof (struct wpc_asic));
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
#if 1
return rc;
#endif
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
rc |= WPC_DEBUG_READ_READY;
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
unsigned int wpc_read_switch (int num)
{
unsigned int val;
val = wpc->switch_mx[num / 8] & (1 << (num % 8));
return val ? 1 : 0;
}
void wpc_write_switch (int num, int flag)
{
unsigned int col, val;
col = num / 8;
val = 1 << (num % 8);
if (wpc->opto_mx[col] & val)
flag = !flag;
wpc->switch_mx[col] &= ~val;
if (flag)
wpc->switch_mx[col] |= val;
}
void wpc_press_switch (int num, int delay)
{
wpc_write_switch (num, 1);
wpc->curr_sw = num;
wpc->curr_sw_time = delay;
}
unsigned int wpc_read_switch_column (int col)
{
unsigned int val = 0;
int row;
for (row = 0; row < 8; row++)
if (wpc_read_switch (col * 8 + row))
val |= (1 << row);
return val;
}
void wpc_write_lamp (int num, int flag)
{
}
void wpc_write_sol (int num, int flag)
{
}
-void wpc_print_display (void)
+void wpc_dmd_set_visible (U8 val)
{
+#if 0
FILE *fp;
- char *p = wpc->dmd_dev->priv + wpc->dmd_active_page * 512;
+#endif
+ char *p;
+ struct wpc_message msg;
+ int rc;
+ int i, n;
+#if 0
fp = fopen ("dmd", "wb");
if (!fp)
{
fprintf (stderr, "could not write to DMD!!!\n");
return;
}
- fwrite (p, 512, 1, fp);
fclose (fp);
+#endif
+
+ wpc->dmd_visibles[wpc->dmd_phase++] = val;
+ if (wpc->dmd_phase == 3)
+ wpc->dmd_phase = 0;
+
+ if (!memcmp (wpc->dmd_visibles, wpc->dmd_last_visibles, 3))
+ return;
+
+ memcpy (wpc->dmd_last_visibles, wpc->dmd_visibles, 3);
+
+ /* Send updated page contents */
+ wpc_msg_init (CODE_DMD_PAGE, &msg);
+ for (i=0; i < 3; i++)
+ {
+ p = wpc->dmd_dev->priv + wpc->dmd_visibles[i] * 512;
+ msg.u.dmdpage.phases[i].page = wpc->dmd_visibles[i];
+ memcpy (&msg.u.dmdpage.phases[i].data, p, 512);
+ }
+ msg.len = sizeof (struct _dmdpage_info);
+ wpc_msg_send (wpc_sock, 9000 ^ 1, &msg);
+
+ /* Send status of which pages are visible now */
+ wpc_msg_init (CODE_DMD_VISIBLE, &msg);
+ for (i=0; i < 3; i++)
+ msg.u.dmdvisible.phases[i] = wpc->dmd_visibles[i];
+ msg.len = sizeof (struct _dmdvisible_info);
+ wpc_msg_send (wpc_sock, 9000 ^ 1, &msg);
}
void wpc_keypoll (void)
{
fd_set fds;
struct timeval timeout;
int rc;
unsigned char c;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
{
rc = read (0, &c, 1);
switch (c)
{
case '7':
wpc_press_switch (4, 200);
break;
case '8':
wpc_press_switch (5, 200);
break;
case '9':
wpc_press_switch (6, 200);
break;
case '0':
wpc_press_switch (7, 200);
break;
- case 'd':
- wpc_print_display ();
- break;
default:
break;
}
}
}
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit / 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
case WPC_SW_ROW_INPUT:
val = wpc_read_switch_column (1 + scanbit (wpc->switch_strobe));
break;
case WPC_SW_JUMPER_INPUT:
val = 0x55;
break;
case WPC_SW_CABINET_INPUT:
val = wpc_read_switch_column (0);
break;
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (void)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_set_rom_page (unsigned char val)
{
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
}
void wpc_set_dmd_page (unsigned int map, unsigned char val)
{
wpc->dmd_maps[map] = val;
bus_map (0x3800 + map * 0x200, 3, val * 0x200, 0x200, MAP_READWRITE);
}
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
switch (addr + WPC_ASIC_BASE)
{
case WPC_DMD_LOW_PAGE:
wpc_set_dmd_page (0, val);
break;
case WPC_DMD_HIGH_PAGE:
wpc_set_dmd_page (1, val);
break;
case WPC_DMD_FIRQ_ROW_VALUE:
break;
case WPC_DMD_ACTIVE_PAGE:
- wpc->dmd_active_page = val;
- wpc_print_display ();
+ wpc_dmd_set_visible (val);
break;
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
wpc->wdog_timer++;
break;
case WPC_ROM_BANK:
wpc->rombank = val;
wpc_set_rom_page (val);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram ();
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram ();
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
case WPC_SW_COL_STROBE:
wpc->switch_strobe = val;
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
wpc_keypoll ();
wpc->wdog_timer -= 50;
if (wpc->wdog_timer <= 0)
{
}
if (wpc->curr_sw_time > 0)
{
wpc->curr_sw_time -= 100;
if (wpc->curr_sw_time <= 0)
{
wpc->curr_sw_time = 0;
wpc_write_switch (wpc->curr_sw, 0);
}
}
}
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
if (wpc)
{
fprintf (stderr, "WPC ASIC already created\n");
return NULL;
}
wpc = &the_wpc;
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
void io_sym_add (const char *name, unsigned long cpuaddr)
{
sym_add (&program_symtab, name, to_absolute (cpuaddr), 0);
}
#define IO_SYM_ADD(name) io_sym_add (#name, name)
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
+ int rc;
+ struct sockaddr_in myaddr;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
device_define ( dev = ram_create (16 * 512), 0,
0x3800, 0x200 * 2, MAP_READWRITE );
wpc->dmd_dev = dev;
wpc_update_ram ();
+ wpc_sock = udp_socket_create (9000);
+ if (wpc_sock < 0)
+ fprintf (stderr, "could not open output socket\n");
+
IO_SYM_ADD(WPC_DMD_LOW_BASE);
IO_SYM_ADD(WPC_DMD_HIGH_BASE);
IO_SYM_ADD(WPC_DMD_HIGH_PAGE);
IO_SYM_ADD(WPC_DMD_FIRQ_ROW_VALUE);
IO_SYM_ADD(WPC_DMD_LOW_PAGE);
IO_SYM_ADD(WPC_DMD_ACTIVE_PAGE);
IO_SYM_ADD(WPC_SERIAL_STATUS_PORT);
IO_SYM_ADD(WPC_PARALLEL_DATA_PORT);
IO_SYM_ADD(WPC_PARALLEL_STROBE_PORT);
IO_SYM_ADD(WPC_SERIAL_DATA_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_CONTROL_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_BAUD_SELECT);
IO_SYM_ADD(WPC_TICKET_DISPENSE);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_OUT);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_IN);
IO_SYM_ADD(WPC_DCS_SOUND_RESET);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_READY);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_A);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_B);
IO_SYM_ADD(WPCS_DATA);
IO_SYM_ADD(WPCS_CONTROL_STATUS);
IO_SYM_ADD(WPC_SOL_FLASH2_OUTPUT);
IO_SYM_ADD(WPC_SOL_HIGHPOWER_OUTPUT);
IO_SYM_ADD(WPC_SOL_FLASH1_OUTPUT);
IO_SYM_ADD(WPC_SOL_LOWPOWER_OUTPUT);
IO_SYM_ADD(WPC_LAMP_ROW_OUTPUT);
IO_SYM_ADD(WPC_LAMP_COL_STROBE);
IO_SYM_ADD(WPC_GI_TRIAC);
IO_SYM_ADD(WPC_SW_JUMPER_INPUT);
IO_SYM_ADD(WPC_SW_CABINET_INPUT);
IO_SYM_ADD(WPC_SW_ROW_INPUT);
IO_SYM_ADD(WPC_SW_COL_STROBE);
IO_SYM_ADD(WPC_LEDS);
IO_SYM_ADD(WPC_RAM_BANK);
IO_SYM_ADD(WPC_SHIFTADDR);
IO_SYM_ADD(WPC_SHIFTBIT);
IO_SYM_ADD(WPC_SHIFTBIT2);
IO_SYM_ADD(WPC_PERIPHERAL_TIMER_FIRQ_CLEAR);
IO_SYM_ADD(WPC_ROM_LOCK);
IO_SYM_ADD(WPC_CLK_HOURS_DAYS);
IO_SYM_ADD(WPC_CLK_MINS);
IO_SYM_ADD(WPC_ROM_BANK);
IO_SYM_ADD(WPC_RAM_LOCK);
IO_SYM_ADD(WPC_RAM_LOCKSIZE);
}
struct machine wpc_machine =
{
.name = "wpc",
.fault = wpc_fault,
.init = wpc_init,
};
diff --git a/wpclib.c b/wpclib.c
new file mode 100644
index 0000000..526c65e
--- /dev/null
+++ b/wpclib.c
@@ -0,0 +1,149 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <errno.h>
+#include <netinet/in.h>
+#include "wpclib.h"
+
+#define UDP_PORT 7400
+
+#define CLIENT_PORT_OFFSET 0
+#define SERVER_PORT_OFFSET 1
+
+int client_port = UDP_PORT + CLIENT_PORT_OFFSET;
+int server_port = UDP_PORT + SERVER_PORT_OFFSET;
+
+void udp_socket_error (void)
+{
+ abort ();
+}
+
+int udp_socket_create (int port)
+{
+ int rc;
+ int s;
+ struct sockaddr_in myaddr;
+
+ s = socket (PF_INET, SOCK_DGRAM, 0);
+ if (s < 0)
+ {
+ fprintf (stderr, "could not open socket, errno=%d\n", errno);
+ udp_socket_error ();
+ return s;
+ }
+
+ rc = fcntl (s, F_SETFL, O_NONBLOCK);
+ if (rc < 0)
+ {
+ fprintf (stderr, "could not set nonblocking, errno=%d\n", errno);
+ udp_socket_error ();
+ return rc;
+ }
+
+ myaddr.sin_family = AF_INET;
+ myaddr.sin_port = htons (port);
+ myaddr.sin_addr.s_addr = INADDR_ANY;
+ rc = bind (s, (struct sockaddr *)&myaddr, sizeof (myaddr));
+ if (rc < 0)
+ {
+ fprintf (stderr, "could not bind socket, errno=%d\n", errno);
+ udp_socket_error ();
+ return rc;
+ }
+
+ return s;
+}
+
+int udp_socket_send (int s, int dstport, const void *data, int len)
+{
+ int rc;
+ struct sockaddr_in to;
+
+ to.sin_family = AF_INET;
+ to.sin_port = htons (dstport);
+ to.sin_addr.s_addr = inet_addr ("127.0.0.1");
+ rc = sendto (s, data, len, 0, (struct sockaddr *)&to, sizeof (to));
+ if ((rc < 0) && (errno != EAGAIN))
+ {
+ fprintf (stderr, "could not send, errno=%d\n", errno);
+ udp_socket_error ();
+ }
+ return rc;
+}
+
+int udp_socket_receive (int s, int dstport, void *data, int len)
+{
+ int rc;
+ struct sockaddr_in from;
+ int fromlen;
+
+ rc = recvfrom (s, data, len, 0, (struct sockaddr *)&from, &len);
+ if ((rc < 0) && (errno != EAGAIN))
+ {
+ fprintf (stderr, "could not receive, errno=%d\n", errno);
+ udp_socket_error ();
+ }
+ return rc;
+}
+
+int wpc_msg_init (int code, struct wpc_message *msg)
+{
+ msg->code = code;
+ msg->timestamp = 0;
+ msg->len = 0;
+ return 0;
+}
+
+int wpc_msg_insert (struct wpc_message *msg, const void *p, int len)
+{
+ memcpy (msg->u.data + msg->len, p, len);
+ msg->len += len;
+}
+
+int wpc_msg_send (int s, int dstport, struct wpc_message *msg)
+{
+ int rc = udp_socket_send (s, dstport, msg, msg->len + sizeof (struct wpc_message) - 1000);
+ if (rc < 0)
+ {
+ fprintf (stderr, "error: could not send!\n");
+ }
+ return rc;
+}
+
+int udp_socket_close (int s)
+{
+ close (s);
+ return 0;
+}
+
+
+#ifdef STANDALONE
+int main (int argc, char *argv[])
+{
+ int server, client;
+ char sendbuf[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
+ char recvbuf[8];
+
+ server = udp_socket_create (server_port);
+ client = udp_socket_create (client_port);
+ printf ("Server = %d, Client = %d\n", server, client);
+
+ getchar ();
+ printf ("Sending data\n");
+ udp_socket_send (client, server_port, sendbuf, sizeof (sendbuf));
+ printf ("Receiving data\n");
+ udp_socket_receive (server, client_port, recvbuf, sizeof (recvbuf));
+
+ if (memcmp (sendbuf, recvbuf, sizeof (sendbuf)))
+ {
+ printf ("Buffers differ.\n");
+ }
+
+ udp_socket_close (server);
+ udp_socket_close (client);
+}
+#endif
diff --git a/wpclib.h b/wpclib.h
new file mode 100644
index 0000000..84c9316
--- /dev/null
+++ b/wpclib.h
@@ -0,0 +1,46 @@
+
+#ifndef _WPCLIB_H
+#define _WPCLIB_H
+
+int udp_socket_create (int port);
+int udp_socket_send (int s, int dstport, const void *data, int len);
+int udp_socket_receive (int s, int dstport, void *data, int len);
+int udp_socket_close (int s);
+
+#define NUM_DMD_PHASES 3
+
+struct wpc_message
+{
+ unsigned char code;
+ unsigned int timestamp;
+ unsigned int len;
+ union {
+ unsigned char data[1600];
+ struct _dmdpage_info
+ {
+ struct
+ {
+ unsigned int page;
+ unsigned char data[512];
+ } phases[NUM_DMD_PHASES];
+ } dmdpage;
+
+ struct _dmdvisible_info
+ {
+ unsigned int phases[NUM_DMD_PHASES];
+ } dmdvisible;
+ } u;
+};
+
+int wpc_msg_init (int code, struct wpc_message *msg);
+int wpc_msg_insert (struct wpc_message *msg, const void *p, int len);
+int wpc_msg_send (int s, int dstport, struct wpc_message *msg);
+
+#define CODE_DMD_PAGE 0
+#define CODE_LAMPS 1
+#define CODE_SWITCHES 2
+#define CODE_DMD_VISIBLE 3
+#define CODE_COILS 4
+#define CODE_GEN_ILLUMS 5
+
+#endif
|
bcd/exec09
|
83406a7206ae800907218b8bccfec401b8f0b912
|
Remove change_pc() runtime check for goodness.
|
diff --git a/6809.c b/6809.c
index ad1c616..03e0a33 100644
--- a/6809.c
+++ b/6809.c
@@ -1,685 +1,687 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include "monitor.h"
#include <stdarg.h>
unsigned X, Y, S, U, PC;
unsigned A, B, DP;
unsigned H, N, Z, OV, C;
unsigned EFI;
#ifdef H6309
unsigned E, F, V, MD;
#define MD_NATIVE 0x1 /* if 1, execute in 6309 mode */
#define MD_FIRQ_LIKE_IRQ 0x2 /* if 1, FIRQ acts like IRQ */
#define MD_ILL 0x40 /* illegal instruction */
#define MD_DBZ 0x80 /* divide by zero */
#endif /* H6309 */
unsigned iPC;
unsigned long irq_start_time;
unsigned ea = 0;
long cpu_clk = 0;
long cpu_period = 0;
int cpu_quit = 1;
unsigned int irqs_pending = 0;
unsigned int firqs_pending = 0;
unsigned int cc_changed = 0;
unsigned *index_regs[4] = { &X, &Y, &U, &S };
extern int dump_cycles_on_success;
extern int trace_enabled;
extern void irq (void);
extern void firq (void);
void request_irq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
irqs_pending |= (1 << source);
if (!(EFI & I_FLAG))
irq ();
}
void release_irq (unsigned int source)
{
irqs_pending &= ~(1 << source);
}
void request_firq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
firqs_pending |= (1 << source);
if (!(EFI & F_FLAG))
firq ();
}
void release_firq (unsigned int source)
{
firqs_pending &= ~(1 << source);
}
static inline void
check_pc (void)
{
/* TODO */
}
static inline void
check_stack (void)
{
/* TODO */
}
void
sim_error (const char *format, ...)
{
va_list ap;
va_start (ap, format);
fprintf (stderr, "m6809-run: (at PC=%04X) ", iPC);
vfprintf (stderr, format, ap);
va_end (ap);
if (debug_enabled)
monitor_on = 1;
else
exit (2);
}
unsigned long
get_cycles (void)
{
return total + cpu_period - cpu_clk;
}
void
sim_exit (uint8_t exit_code)
{
/* On a nonzero exit, always print an error message. */
if (exit_code != 0)
{
printf ("m6809-run: program exited with %d\n", exit_code);
if (exit_code)
monitor_backtrace ();
}
/* If a cycle count should be printed, do that last. */
if (dump_cycles_on_success)
{
printf ("Simulated time : %ld cycles\n", get_cycles ());
}
exit (exit_code);
}
static inline void
change_pc (unsigned newPC)
{
+#if 0
/* TODO - will let some RAM execute for trampolines */
if ((newPC < 0x1C00) || (newPC > 0xFFFF))
{
fprintf (stderr, "m6809-run: invalid PC = %04X, previous was %s\n",
newPC, monitor_addr_name (PC));
exit (2);
}
if (trace_enabled)
{
fprintf (stderr, "PC : %s ", monitor_addr_name (PC));
fprintf (stderr, "-> %s\n", monitor_addr_name (newPC));
}
+#endif
PC = newPC;
}
static inline unsigned
imm_byte (void)
{
unsigned val = read8 (PC);
PC++;
return val;
}
static inline unsigned
imm_word (void)
{
unsigned val = read16 (PC);
PC += 2;
return val;
}
#define WRMEM(addr, data) write8 (addr, data)
static void
WRMEM16 (unsigned addr, unsigned data)
{
WRMEM (addr, data >> 8);
cpu_clk--;
WRMEM ((addr + 1) & 0xffff, data & 0xff);
}
#define RDMEM(addr) read8 (addr)
static unsigned
RDMEM16 (unsigned addr)
{
unsigned val = RDMEM (addr) << 8;
cpu_clk--;
val |= RDMEM ((addr + 1) & 0xffff);
return val;
}
#define write_stack WRMEM
#define read_stack RDMEM
static void
write_stack16 (unsigned addr, unsigned data)
{
write_stack ((addr + 1) & 0xffff, data & 0xff);
write_stack (addr, data >> 8);
}
static unsigned
read_stack16 (unsigned addr)
{
return (read_stack (addr) << 8) | read_stack ((addr + 1) & 0xffff);
}
static void
direct (void)
{
unsigned val = read8 (PC) | DP;
PC++;
ea = val;
}
static void
indexed (void) /* note take 1 extra cycle */
{
unsigned post = imm_byte ();
unsigned *R = index_regs[(post >> 5) & 0x3];
if (post & 0x80)
{
switch (post & 0x1f)
{
case 0x00:
ea = *R;
*R = (*R + 1) & 0xffff;
cpu_clk -= 6;
break;
case 0x01:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
break;
case 0x02:
*R = (*R - 1) & 0xffff;
ea = *R;
cpu_clk -= 6;
break;
case 0x03:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
break;
case 0x04:
ea = *R;
cpu_clk -= 4;
break;
case 0x05:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
break;
case 0x06:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
break;
case 0x08:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
break;
case 0x09:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
break;
case 0x0d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
break;
case 0x11:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x13:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x14:
ea = *R;
cpu_clk -= 4;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x15:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x16:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x18:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x19:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1f:
ea = imm_word ();
cpu_clk -= 6;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
default:
ea = 0;
printf ("%X: invalid index post $%02X\n", iPC, post);
if (debug_enabled)
{
monitor_on = 1;
}
else
{
exit (1);
}
break;
}
}
else
{
if (post & 0x10)
post |= 0xfff0;
else
post &= 0x000f;
ea = (*R + post) & 0xffff;
cpu_clk -= 5;
}
}
static void
extended (void)
{
unsigned val = read16 (PC);
PC += 2;
ea = val;
}
/* external register functions */
unsigned
get_a (void)
{
return A;
}
unsigned
get_b (void)
{
return B;
}
unsigned
get_dp (void)
{
return DP >> 8;
}
unsigned
get_x (void)
{
return X;
}
unsigned
get_y (void)
{
return Y;
}
unsigned
get_s (void)
{
return S;
}
unsigned
get_u (void)
{
return U;
}
unsigned
get_pc (void)
{
return PC & 0xffff;
}
unsigned
get_d (void)
{
return (A << 8) | B;
}
#ifdef H6309
unsigned
get_e (void)
{
return E;
}
unsigned
get_f (void)
{
return F;
}
unsigned
get_w (void)
{
return (E << 8) | F;
}
unsigned
get_q (void)
{
return (get_w () << 16) | get_d ();
}
unsigned
get_v (void)
{
return V;
}
unsigned
get_zero (void)
{
return 0;
}
unsigned
get_md (void)
{
return MD;
}
#endif
void
set_a (unsigned val)
{
A = val & 0xff;
}
void
set_b (unsigned val)
{
B = val & 0xff;
}
void
set_dp (unsigned val)
{
DP = (val & 0xff) << 8;
}
void
set_x (unsigned val)
{
X = val & 0xffff;
}
void
set_y (unsigned val)
{
Y = val & 0xffff;
}
void
set_s (unsigned val)
{
S = val & 0xffff;
check_stack ();
}
void
set_u (unsigned val)
{
U = val & 0xffff;
}
void
set_pc (unsigned val)
{
PC = val & 0xffff;
check_pc ();
}
void
set_d (unsigned val)
{
A = (val >> 8) & 0xff;
B = val & 0xff;
}
#ifdef H6309
void
set_e (unsigned val)
{
E = val & 0xff;
}
void
set_f (unsigned val)
{
F = val & 0xff;
}
void
set_w (unsigned val)
{
E = (val >> 8) & 0xff;
F = val & 0xff;
}
void
set_q (unsigned val)
{
set_w ((val >> 16) & 0xffff);
set_d (val & 0xffff);
}
void
set_v (unsigned val)
{
V = val & 0xff;
}
void
set_zero (unsigned val)
{
}
void
set_md (unsigned val)
{
MD = val & 0xff;
}
#endif
/* handle condition code register */
unsigned
get_cc (void)
{
unsigned res = EFI & (E_FLAG | F_FLAG | I_FLAG);
if (H & 0x10)
res |= H_FLAG;
if (N & 0x80)
res |= N_FLAG;
if (Z == 0)
res |= Z_FLAG;
if (OV & 0x80)
res |= V_FLAG;
if (C != 0)
res |= C_FLAG;
return res;
}
void
set_cc (unsigned arg)
{
EFI = arg & (E_FLAG | F_FLAG | I_FLAG);
H = (arg & H_FLAG ? 0x10 : 0);
N = (arg & N_FLAG ? 0x80 : 0);
Z = (~arg) & Z_FLAG;
OV = (arg & V_FLAG ? 0x80 : 0);
C = arg & C_FLAG;
cc_changed = 1;
}
void
cc_modified (void)
{
/* Check for pending interrupts */
if (firqs_pending && !(EFI & F_FLAG))
firq ();
else if (irqs_pending && !(EFI & I_FLAG))
irq ();
cc_changed = 0;
}
unsigned
get_reg (unsigned nro)
{
unsigned val = 0xff;
switch (nro)
{
case 0:
val = (A << 8) | B;
break;
case 1:
val = X;
break;
case 2:
val = Y;
break;
case 3:
val = U;
break;
case 4:
val = S;
break;
case 5:
val = PC & 0xffff;
break;
#ifdef H6309
case 6:
val = (E << 8) | F;
break;
case 7:
val = V;
break;
|
bcd/exec09
|
0cf2cf0f56c66a0b7eb48f13d430ac2f6fd37566
|
Remove sym_lookup on function call for performance.
|
diff --git a/monitor.c b/monitor.c
index 531b32f..2fd38a1 100644
--- a/monitor.c
+++ b/monitor.c
@@ -787,639 +787,641 @@ opcode_t codes11[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal}
};
char *reg[] = {
"D", "X", "Y", "U", "S", "PC", "??", "??",
"A", "B", "CC", "DP", "??", "??", "??", "??"
};
char index_reg[] = { 'X', 'Y', 'U', 'S' };
char *off4[] = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15",
"-16", "-15", "-14", "-13", "-12", "-11", "-10", "-9",
"-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"
};
/* Disassemble the current instruction. Returns the number of bytes that
compose it. */
int
dasm (char *buf, absolute_address_t opc)
{
UINT8 op, am;
char *op_str;
absolute_address_t pc = opc;
char R;
int fetch1; /* the first (MSB) fetched byte, used in macro RDWORD */
op = fetch8 ();
if (op == 0x10)
{
op = fetch8 ();
am = codes10[op].mode;
op = codes10[op].code;
}
else if (op == 0x11)
{
op = fetch8 ();
am = codes11[op].mode;
op = codes11[op].code;
}
else
{
am = codes[op].mode;
op = codes[op].code;
}
op_str = (char *) mne[op];
buf += sprintf (buf, "%-6.6s", op_str);
switch (am)
{
case _illegal:
sprintf (buf, "???");
break;
case _implied:
break;
case _imm_byte:
sprintf (buf, "#$%02X", fetch8 ());
break;
case _imm_word:
sprintf (buf, "#$%04X", fetch16 ());
break;
case _direct:
sprintf (buf, "<%s", monitor_addr_name (fetch8 ()));
break;
case _extended:
sprintf (buf, "%s", monitor_addr_name (fetch16 ()));
break;
case _indexed:
op = fetch8 ();
R = index_reg[(op >> 5) & 0x3];
if ((op & 0x80) == 0)
{
sprintf (buf, "%s,%c", off4[op & 0x1f], R);
break;
}
switch (op & 0x1f)
{
case 0x00:
sprintf (buf, ",%c+", R);
break;
case 0x01:
sprintf (buf, ",%c++", R);
break;
case 0x02:
sprintf (buf, ",-%c", R);
break;
case 0x03:
sprintf (buf, ",--%c", R);
break;
case 0x04:
sprintf (buf, ",%c", R);
break;
case 0x05:
sprintf (buf, "B,%c", R);
break;
case 0x06:
sprintf (buf, "A,%c", R);
break;
case 0x08:
sprintf (buf, "$%02X,%c", fetch8 (), R);
break;
case 0x09:
sprintf (buf, "$%04X,%c", fetch16 (), R);
break;
case 0x0B:
sprintf (buf, "D,%c", R);
break;
case 0x0C:
sprintf (buf, "$%02X,PC", fetch8 ());
break;
case 0x0D:
sprintf (buf, "$%04X,PC", fetch16 ());
break;
case 0x11:
sprintf (buf, "[,%c++]", R);
break;
case 0x13:
sprintf (buf, "[,--%c]", R);
break;
case 0x14:
sprintf (buf, "[,%c]", R);
break;
case 0x15:
sprintf (buf, "[B,%c]", R);
break;
case 0x16:
sprintf (buf, "[A,%c]", R);
break;
case 0x18:
sprintf (buf, "[$%02X,%c]", fetch8 (), R);
break;
case 0x19:
sprintf (buf, "[$%04X,%c]", fetch16 (), R);
break;
case 0x1B:
sprintf (buf, "[D,%c]", R);
break;
case 0x1C:
sprintf (buf, "[$%02X,PC]", fetch8 ());
break;
case 0x1D:
sprintf (buf, "[$%04X,PC]", fetch16 ());
break;
case 0x1F:
sprintf (buf, "[%s]", monitor_addr_name (fetch16 ()));
break;
default:
sprintf (buf, "???");
break;
}
break;
case _rel_byte:
fetch1 = ((INT8) fetch8 ());
sprintf (buf, "%s", absolute_addr_name (fetch1 + pc));
break;
case _rel_word:
sprintf (buf, "%s", absolute_addr_name (fetch16 () + pc));
break;
case _reg_post:
op = fetch8 ();
sprintf (buf, "%s,%s", reg[op >> 4], reg[op & 15]);
break;
case _usr_post:
case _sys_post:
op = fetch8 ();
if (op & 0x80)
strcat (buf, "PC,");
if (op & 0x40)
strcat (buf, am == _usr_post ? "S," : "U,");
if (op & 0x20)
strcat (buf, "Y,");
if (op & 0x10)
strcat (buf, "X,");
if (op & 0x08)
strcat (buf, "DP,");
if ((op & 0x06) == 0x06)
strcat (buf, "D,");
else
{
if (op & 0x04)
strcat (buf, "B,");
if (op & 0x02)
strcat (buf, "A,");
}
if (op & 0x01)
strcat (buf, "CC,");
buf[strlen (buf) - 1] = '\0';
break;
}
return pc - opc;
}
int
sizeof_file (FILE * file)
{
int size;
fseek (file, 0, SEEK_END);
size = ftell (file);
rewind (file);
return size;
}
int
load_map_file (const char *name)
{
FILE *fp;
char map_filename[256];
char buf[256];
char *value_ptr, *id_ptr;
target_addr_t value;
char *file_ptr;
sprintf (map_filename, "%s.map", name);
fp = file_open (NULL, map_filename, "r");
if (!fp)
return -1;
for (;;)
{
fgets (buf, sizeof(buf)-1, fp);
if (feof (fp))
break;
value_ptr = buf;
if (!strncmp (value_ptr, "page", 4))
{
unsigned char page = strtoul (value_ptr+4, NULL, 10);
wpc_set_rom_page (page);
continue;
}
if (strncmp (value_ptr, " ", 6))
continue;
while (*value_ptr == ' ')
value_ptr++;
value = strtoul (value_ptr, &id_ptr, 16);
if (id_ptr == value_ptr)
continue;
while (*id_ptr == ' ')
id_ptr++;
id_ptr = strtok (id_ptr, " \t\n");
if (((*id_ptr == 'l') || (*id_ptr == 's')) && (id_ptr[1] == '_'))
continue;
++id_ptr;
file_ptr = strtok (NULL, " \t\n");
sym_add (&program_symtab, id_ptr, to_absolute (value), 0); /* file_ptr? */
}
fclose (fp);
return 0;
}
int
load_hex (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = file_open (NULL, name, "r");
if (fp == NULL)
{
printf ("failed to open hex record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, ":%2x%4x%2x", &count, &addr, &type) != 3)
{
printf ("line %d: invalid hex record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff) + type;
switch (type)
{
case 0:
for (; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid hex record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 1:
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid hex record checksum \n", line);
done = 0;
break;
case 2:
default:
printf ("line %d: not supported hex type %d.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
int
load_s19 (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = file_open (NULL, name, "r");
if (fp == NULL)
{
printf ("failed to open S-record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, "S%1x%2x%4x", &type, &count, &addr) != 3)
{
printf ("line %d: invalid S record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff);
switch (type)
{
case 1:
for (count -= 3; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 9:
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
default:
printf ("line %d: S%d not supported.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
void
monitor_call (unsigned int flags)
{
#ifdef CALL_STACK
if (current_function_call <= &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call++;
current_function_call->entry_point = get_pc ();
current_function_call->flags = flags;
}
#endif
+#if 0
const char *id = sym_lookup (&program_symtab, to_absolute (get_pc ()));
if (id)
{
// printf ("In %s now\n", id);
}
+#endif
}
void
monitor_return (void)
{
#ifdef CALL_STACK
if (current_function_call > &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call--;
return;
}
while ((current_function_call->flags & FC_TAIL_CALL) &&
(current_function_call > fctab))
{
current_function_call--;
}
if (current_function_call > fctab)
current_function_call--;
#endif
}
const char *
absolute_addr_name (absolute_address_t addr)
{
static char buf[256], *bufptr;
const char *name;
bufptr = buf;
bufptr += sprintf (bufptr, "%02X:0x%04X", addr >> 28, addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
bufptr += sprintf (bufptr, " <%-16.16s>", name);
return buf;
}
const char *
monitor_addr_name (target_addr_t target_addr)
{
static char buf[256], *bufptr;
const char *name;
absolute_address_t addr = to_absolute (target_addr);
bufptr = buf;
bufptr += sprintf (bufptr, "0x%04X", target_addr);
name = sym_lookup (&program_symtab, addr);
if (name)
bufptr += sprintf (bufptr, " <%s>", name);
return buf;
}
static void
monitor_signal (int sigtype)
{
(void) sigtype;
putchar ('\n');
monitor_on = 1;
}
void
monitor_init (void)
{
int tmp;
extern int debug_enabled;
target_addr_t a;
fctab[0].entry_point = read16 (0xfffe);
memset (&fctab[0].entry_regs, 0, sizeof (struct cpu_regs));
current_function_call = &fctab[0];
auto_break_insn_count = 0;
monitor_on = debug_enabled;
signal (SIGINT, monitor_signal);
}
int
check_break (void)
{
if (dump_every_insn)
print_current_insn ();
if (auto_break_insn_count > 0)
if (--auto_break_insn_count == 0)
return 1;
return 0;
}
void
monitor_backtrace (void)
{
struct function_call *fc = current_function_call;
while (fc >= &fctab[0]) {
printf ("%s\n", monitor_addr_name (fc->entry_point));
fc--;
}
}
int
monitor6809 (void)
{
int rc;
signal (SIGINT, monitor_signal);
rc = command_loop ();
monitor_on = 0;
return rc;
}
|
bcd/exec09
|
7902d886280a21f3dc678899f46ddb91dba7d43d
|
Remove redundant include.
|
diff --git a/fileio.c b/fileio.c
index 2aef61e..ac0e681 100644
--- a/fileio.c
+++ b/fileio.c
@@ -1,62 +1,61 @@
-#include <stdio.h>
#include "6809.h"
void
path_init (struct pathlist *path)
{
path->count = 0;
}
void
path_add (struct pathlist *path, const char *dir)
{
char *dir2;
dir2 = path->entry[path->count++] = malloc (strlen (dir) + 1);
strcpy (dir2, dir);
}
FILE *
file_open (struct pathlist *path, const char *filename, const char *mode)
{
FILE *fp;
char fqname[128];
int count;
const char dirsep = '/';
fp = fopen (filename, mode);
if (fp)
return fp;
if (!path || strchr (filename, dirsep) || *mode == 'w')
return NULL;
for (count = 0; count < path->count; count++)
{
sprintf (fqname, "%s%c%s", path->entry[count], dirsep, filename);
fp = fopen (fqname, mode);
if (fp)
return fp;
}
return NULL;
}
FILE *
file_require_open (struct pathlist *path, const char *filename, const char *mode)
{
FILE *fp = file_open (path, filename, mode);
if (!fp)
fprintf (stderr, "error: could not open '%s'\n", filename);
return fp;
}
void
file_close (FILE *fp)
{
fclose (fp);
}
|
bcd/exec09
|
a3d1551cdabd833306e7b753ec5f35b20f57129b
|
Honor autoconf macros for including termios.h
|
diff --git a/command.c b/command.c
index 086711d..e0d68e8 100644
--- a/command.c
+++ b/command.c
@@ -1,521 +1,522 @@
#include "6809.h"
#include "monitor.h"
#include "machine.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/errno.h>
-#include <termios.h>
+#ifdef HAVE_TERMIOS_H
+# include <termios.h>
+#else
+#error
+#endif
typedef struct
{
unsigned int size;
unsigned int count;
char **strings;
} cmdqueue_t;
/**********************************************************/
/********************* Global Data ************************/
/**********************************************************/
unsigned int break_count = 0;
breakpoint_t breaktab[MAX_BREAKS];
unsigned int active_break_count = 0;
unsigned int display_count = 0;
display_t displaytab[MAX_DISPLAYS];
unsigned int history_count = 0;
unsigned long historytab[MAX_HISTORY];
absolute_address_t examine_addr = 0;
unsigned int examine_repeat = 1;
datatype_t examine_type;
unsigned int thread_id_size = 2;
absolute_address_t thread_current;
absolute_address_t thread_id = 0;
thread_t threadtab[MAX_THREADS];
#define MAX_CMD_QUEUES 8
int command_stack_depth = -1;
cmdqueue_t command_stack[MAX_CMD_QUEUES];
#define MAX_TRACE 256
target_addr_t trace_buffer[MAX_TRACE];
unsigned int trace_offset = 0;
int stop_after_ms = 0;
datatype_t print_type;
char *command_flags;
int exit_command_loop;
#define IRQ_CYCLE_COUNTS 128
unsigned int irq_cycle_tab[IRQ_CYCLE_COUNTS] = { 0, };
unsigned int irq_cycle_entry = 0;
unsigned long irq_cycles = 0;
unsigned long eval (char *expr);
unsigned long eval_mem (char *expr);
extern int auto_break_insn_count;
FILE *command_input;
/**********************************************************/
/******************** 6809 Functions **********************/
/**********************************************************/
void
print_addr (absolute_address_t addr)
{
const char *name;
print_device_name (addr >> 28);
putchar (':');
printf ("0x%04X", addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
printf (" <%-16.16s>", name);
else
printf ("%-20.20s", "");
}
/**********************************************************/
/*********************** Functions ************************/
/**********************************************************/
void
syntax_error (const char *string)
{
fprintf (stderr, "error: %s\n", string);
}
void
save_value (unsigned long val)
{
historytab[history_count++ % MAX_HISTORY] = val;
}
unsigned long
eval_historical (unsigned int id)
{
return historytab[id % MAX_HISTORY];
}
void
assign_virtual (const char *name, unsigned long val)
{
unsigned long v_val;
if (!sym_find (&auto_symtab, name, &v_val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)v_val;
virtual (&val, 1);
return;
}
sym_set (&internal_symtab, name, val, 0);
if (!strcmp (name, "thread_current"))
{
printf ("Thread pointer initialized to ");
print_addr (val);
putchar ('\n');
thread_current = val;
}
}
unsigned long
eval_virtual (const char *name)
{
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
if (!sym_find (&auto_symtab, name, &val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)val;
virtual (&val, 0);
}
else if (!sym_find (&internal_symtab, name, &val, 0))
{
}
else
{
return 0;
}
return val;
}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
else
{
absolute_address_t dst = eval_mem (expr);
//printf ("Setting %X to %02X\n", dst, val);
abs_write8 (dst, val);
}
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
case 'o':
case 'a':
case 's':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
char *
match_binary (char *expr, const char *op, char **secondp)
{
char *p;
p = strstr (expr, op);
if (!p)
return NULL;
*p = '\0';
p += strlen (op);
*secondp = p;
return expr;
}
int
fold_comparisons (char *expr, unsigned long *value)
{
char *p;
if (match_binary (expr, "==", &p))
*value = (eval (expr) == eval (p));
else if (match_binary (expr, "!=", &p))
*value = (eval (expr) != eval (p));
else
return 0;
return 1;
}
int
fold_binary (char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
eval_mem (char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
/* TODO - if expr is already in absolute form,
this explodes ! */
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
eval (char *expr)
{
char *p;
unsigned long val;
if (fold_comparisons (expr, &val));
else if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
unsigned int size = 1;
expr++;
if (*expr == '*')
{
expr++;
size = 2;
}
absolute_address_t addr = eval_mem (expr);
return target_read (addr, size);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
br->keep_running = 0;
br->ignore_count = 0;
br->temp = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
void
brkfree_temps (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].used && breaktab[n].temp)
{
brkfree (&breaktab[n]);
}
}
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
if (brkpt->keep_running)
printf (", print-only");
if (brkpt->temp)
printf (", temp");
if (brkpt->ignore_count)
printf (", ignore %d times\n", brkpt->ignore_count);
if (brkpt->write_mask)
printf (", mask %02X\n", brkpt->write_mask);
putchar ('\n');
}
display_t *
display_alloc (void)
{
unsigned int n;
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (!ds->used)
{
ds->used = 1;
return ds;
}
}
}
void
display_free (display_t *ds)
{
}
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
switch (typep->format)
{
case 'a':
print_addr (val);
return;
case 's':
{
absolute_address_t addr = (absolute_address_t)val;
char c;
putchar ('"');
while ((c = abs_read8 (addr++)) != '\0')
|
bcd/exec09
|
5f3c01ada61a89e34282f6d021f2c5976289fafd
|
Remove includes not needed.
|
diff --git a/symtab.c b/symtab.c
index 6a905a2..f7058ce 100644
--- a/symtab.c
+++ b/symtab.c
@@ -1,237 +1,233 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of the Portable 6809 Simulator.
*
* The Simulator 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.
*
* The Simulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
/* A pointer to the current stringspace */
struct stringspace *current_stringspace;
/* Symbol table for program variables (taken from symbol file) */
struct symtab program_symtab;
/* Symbol table for internal variables. Works identically to the
above but in a different namespace */
struct symtab internal_symtab;
/* Symbol table for the 'autocomputed virtuals'. The values
kept in the table are pointers to functions that compute the
values, allowing for dynamic variables. */
struct symtab auto_symtab;
/**
* Create a new stringspace, which is just a buffer that
* holds strings.
*/
struct stringspace *stringspace_create (void)
{
struct stringspace *ss = malloc (sizeof (struct stringspace));
ss->used = 0;
return ss;
}
/**
* Copy a string into the stringspace. This keeps it around
* permanently; the caller is allowed to free the string
* afterwards.
*/
char *stringspace_copy (const char *string)
{
unsigned int len = strlen (string) + 1;
char *result;
if (current_stringspace->used + len > MAX_STRINGSPACE)
current_stringspace = stringspace_create ();
result = current_stringspace->space + current_stringspace->used;
strcpy (result, string);
current_stringspace->used += len;
return result;
}
unsigned int sym_hash_name (const char *name)
{
unsigned int hash = *name & 0x1F;
if (*name++ != '\0')
{
hash = (hash << 11) + (544 * *name);
if (*name++ != '\0')
{
hash = (hash << 5) + (17 * *name);
}
}
return hash % MAX_SYMBOL_HASH;
}
unsigned int sym_hash_value (unsigned long value)
{
return value % MAX_SYMBOL_HASH;
}
/**
* Lookup the symbol table entry for 'name'.
* Returns NULL if the symbol is not defined.
* If VALUE is not-null, the value is also copied there.
*/
struct symbol *sym_find1 (struct symtab *symtab,
const char *name, unsigned long *value,
unsigned int type)
{
unsigned int hash = sym_hash_name (name);
/* Search starting in the current symbol table, and if that fails,
* try its parent tables. */
while (symtab != NULL)
{
/* Find the list of elements that hashed to this string. */
struct symbol *chain = symtab->syms_by_name[hash];
/* Scan the list for an exact match, and return it. */
while (chain != NULL)
{
if (!strcmp (name, chain->name))
{
if (type && (chain->type != type))
return NULL;
if (value)
*value = chain->value;
return chain;
}
chain = chain->name_chain;
}
symtab = symtab->parent;
}
return NULL;
}
/**
* Lookup the symbol 'name'.
* Returns 0 if the symbol exists (and optionally stores its value
* in *value if not NULL), or -1 if it does not exist.
*/
int sym_find (struct symtab *symtab,
const char *name, unsigned long *value, unsigned int type)
{
return sym_find1 (symtab, name, value, type) ? 0 : -1;
}
const char *sym_lookup (struct symtab *symtab, unsigned long value)
{
unsigned int hash = sym_hash_value (value);
while (symtab != NULL)
{
struct symbol *chain = symtab->syms_by_value[hash];
while (chain != NULL)
{
if (value == chain->value)
return chain->name;
chain = chain->value_chain;
}
symtab = symtab->parent;
}
return NULL;
}
void sym_add (struct symtab *symtab,
const char *name, unsigned long value, unsigned int type)
{
unsigned int hash;
struct symbol *s, *chain;
s = malloc (sizeof (struct symbol));
s->name = stringspace_copy (name);
s->value = value;
s->type = type;
hash = sym_hash_name (name);
chain = symtab->syms_by_name[hash];
s->name_chain = chain;
symtab->syms_by_name[hash] = s;
hash = sym_hash_value (value);
chain = symtab->syms_by_value[hash];
s->value_chain = chain;
symtab->syms_by_value[hash] = s;
}
void sym_set (struct symtab *symtab,
const char *name, unsigned long value, unsigned int type)
{
struct symbol * s = sym_find1 (symtab, name, NULL, type);
if (s)
s->value = value;
else
sym_add (symtab, name, value, type);
}
void for_each_var (void (*cb) (struct symbol *, unsigned int size))
{
struct symtab *symtab = &program_symtab;
absolute_address_t addr;
const char *sym;
unsigned int devid = 1;
for (addr = devid << 28; addr < (devid << 28) + 0x2000; addr++)
{
sym = sym_lookup (symtab, addr);
if (sym)
{
printf ("%s = %X\n", sym, addr);
}
}
}
void symtab_init (struct symtab *symtab)
{
memset (symtab, 0, sizeof (struct symtab));
}
void symtab_reset (struct symtab *symtab)
{
/* TODO */
symtab_init (symtab);
}
void sym_init (void)
{
current_stringspace = stringspace_create ();
symtab_init (&program_symtab);
symtab_init (&internal_symtab);
symtab_init (&auto_symtab);
}
|
bcd/exec09
|
3a141f91182fe09c9328992a9f68070df8396afd
|
Initialize input to stdin by default.
|
diff --git a/command.c b/command.c
index 62de1aa..086711d 100644
--- a/command.c
+++ b/command.c
@@ -1013,517 +1013,518 @@ void cmd_measure (void)
if (!arg)
return;
addr = eval_mem (arg);
printf ("Measuring ");
print_addr (addr);
printf (" back to ");
print_addr (to_absolute (retaddr));
putchar ('\n');
/* Push the current PC onto the stack for the
duration of the measurement. */
set_s (get_s () - 2);
write16 (get_s (), retaddr);
/* Set a temp breakpoint at the current PC, so that
the measurement will halt. */
br = brkalloc ();
br->addr = to_absolute (retaddr);
br->on_execute = 1;
br->temp = 1;
/* Interrupts must be disabled for this to work ! */
set_cc (get_cc () | 0x50);
/* Change the PC to the function-under-test. */
set_pc (addr);
/* Go! */
exit_command_loop = 0;
}
void cmd_dump (void)
{
extern int dump_every_insn;
char *arg = getarg ();
if (arg)
dump_every_insn = strtoul (arg, NULL, 0);
printf ("Instruction dump is %s\n",
dump_every_insn ? "on" : "off");
}
void
cmd_trace_dump (void)
{
unsigned int off = (trace_offset + 1) % MAX_TRACE;
do {
target_addr_t pc = trace_buffer[off];
absolute_address_t addr = to_absolute (pc);
//const char *name = sym_lookup (&program_symtab, addr);
//printf ("%04X ", pc);
print_addr (addr);
putchar (':');
print_insn (addr);
putchar ('\n');
//putchar (name ? '\n' : ' ');
off = (off + 1) % MAX_TRACE;
} while (off != trace_offset);
fflush (stdout);
}
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
{ "s", "step", cmd_step,
"Step one instruction" },
{ "n", "next", cmd_next,
"Break at the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
{ "wa", "watch", cmd_watch,
"Add a watchpoint on write" },
{ "rwa", "rwatch", cmd_rwatch,
"Add a watchpoint on read" },
{ "awa", "awatch", cmd_awatch,
"Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
{ "l", "list", cmd_list },
{ "sym", "symbol-file", cmd_symbol_file,
"Open a symbol table file" },
{ "di", "display", cmd_display,
"Add a display expression" },
{ "so", "source", cmd_source,
"Run a command script" },
{ "regs", "regs", cmd_regs,
"Show all CPU registers" },
{ "vars", "vars", cmd_vars,
"Show all program variables" },
{ "runfor", "runfor", cmd_runfor,
"Run for a certain amount of time" },
{ "me", "measure", cmd_measure,
"Measure time that a function takes" },
{ "dump", "dump", cmd_dump,
"Set dump-instruction flag" },
{ "td", "tracedump", cmd_trace_dump,
"Dump the trace buffer" },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
{ "f", "file", cmd_file,
"Choose the program to be debugged" },
{ "exe", "exec-file", cmd_exec_file,
"Open an executable" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
/* TODO - look for a match anywhere between
* the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
void
print_current_insn (void)
{
absolute_address_t addr = to_absolute (get_pc ());
print_addr (addr);
printf (" : ");
print_insn (addr);
putchar ('\n');
}
int
command_exec (FILE *infile)
{
char buffer[256];
static char prev_buffer[256];
char *cmd;
command_handler_t handler;
int rc;
do {
errno = 0;
fgets (buffer, 255, infile);
if (feof (infile))
return -1;
} while (errno != 0);
/* In terminal mode, a blank line means to execute
the previous command. */
if (buffer[0] == '\n')
strcpy (buffer, prev_buffer);
/* Skip comments */
if (*buffer == '#')
return 0;
cmd = strtok (buffer, " \t\n");
if (!cmd)
return 0;
strcpy (prev_buffer, cmd);
handler = command_lookup (cmd);
if (!handler)
{
syntax_error ("no such command");
return 0;
}
(*handler) ();
return 0;
}
void
keybuffering (int flag)
{
struct termios tio;
tcgetattr (0, &tio);
if (!flag) /* 0 = no buffering = not default */
tio.c_lflag &= ~ICANON;
else /* 1 = buffering = default */
tio.c_lflag |= ICANON;
tcsetattr (0, TCSANOW, &tio);
}
int
command_loop (void)
{
keybuffering (1);
brkfree_temps ();
restart:
if (command_input == stdin)
{
display_print ();
print_current_insn ();
}
exit_command_loop = -1;
while (exit_command_loop < 0)
{
if (command_input == stdin)
command_prompt ();
if (command_exec (command_input) < 0)
break;
}
if (exit_command_loop == 0)
keybuffering (0);
if (feof (command_input) && command_input != stdin)
{
fclose (command_input);
command_input = stdin;
goto restart;
}
return (exit_command_loop);
}
void
breakpoint_hit (breakpoint_t *br)
{
if (br->threaded && (thread_id != br->tid))
return;
if (br->conditional)
{
if (eval (br->condition) == 0)
return;
}
if (br->ignore_count)
{
--br->ignore_count;
return;
}
monitor_on = !br->keep_running;
}
void
command_trace_insn (target_addr_t addr)
{
trace_buffer[trace_offset++] = addr;
trace_offset %= MAX_TRACE;
}
void
command_insn_hook (void)
{
target_addr_t pc;
absolute_address_t abspc;
breakpoint_t *br;
pc = get_pc ();
command_trace_insn (pc);
if (active_break_count == 0)
return;
abspc = to_absolute (pc);
br = brkfind_by_addr (abspc);
if (br && br->enabled && br->on_execute)
{
breakpoint_hit (br);
if (monitor_on == 0)
return;
if (br->temp)
brkfree (br);
else
printf ("Breakpoint %d reached.\n", br->id);
}
}
void
command_read_hook (absolute_address_t addr)
{
breakpoint_t *br;
if (active_break_count == 0)
return;
br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_read)
{
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf ("]\n");
breakpoint_hit (br);
}
}
void
command_write_hook (absolute_address_t addr, U8 val)
{
breakpoint_t *br;
if (active_break_count != 0)
{
br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_write)
{
if (br->write_mask)
{
int mask_ok = ((br->last_write & br->write_mask) !=
(val & br->write_mask));
br->last_write = val;
if (!mask_ok)
return;
}
breakpoint_hit (br);
if (monitor_on == 0)
return;
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf (" = 0x%02X", val);
printf ("]\n");
}
}
if (thread_id_size && (addr == thread_current + thread_id_size - 1))
{
command_change_thread ();
}
}
void
command_periodic (void)
{
if (stop_after_ms)
{
stop_after_ms -= 100;
if (stop_after_ms <= 0)
{
monitor_on = 1;
stop_after_ms = 0;
printf ("Stopping after time elapsed.\n");
}
}
}
void pc_virtual (unsigned long *val, int writep) {
writep ? set_pc (*val) : (*val = get_pc ());
}
void x_virtual (unsigned long *val, int writep) {
writep ? set_x (*val) : (*val = get_x ());
}
void y_virtual (unsigned long *val, int writep) {
writep ? set_y (*val) : (*val = get_y ());
}
void u_virtual (unsigned long *val, int writep) {
writep ? set_u (*val) : (*val = get_u ());
}
void s_virtual (unsigned long *val, int writep) {
writep ? set_s (*val) : (*val = get_s ());
}
void d_virtual (unsigned long *val, int writep) {
writep ? set_d (*val) : (*val = get_d ());
}
void a_virtual (unsigned long *val, int writep) {
writep ? set_a (*val) : (*val = get_a ());
}
void b_virtual (unsigned long *val, int writep) {
writep ? set_b (*val) : (*val = get_b ());
}
void dp_virtual (unsigned long *val, int writep) {
writep ? set_dp (*val) : (*val = get_dp ());
}
void cc_virtual (unsigned long *val, int writep) {
writep ? set_cc (*val) : (*val = get_cc ());
}
void irq_load_virtual (unsigned long *val, int writep) {
if (!writep)
*val = irq_cycles / IRQ_CYCLE_COUNTS;
}
void cycles_virtual (unsigned long *val, int writep)
{
if (!writep)
*val = get_cycles ();
}
void et_virtual (unsigned long *val, int writep)
{
static unsigned long last_cycles = 0;
if (!writep)
*val = get_cycles () - last_cycles;
last_cycles = get_cycles ();
}
void
command_exit_irq_hook (unsigned long cycles)
{
irq_cycles -= irq_cycle_tab[irq_cycle_entry];
irq_cycles += cycles;
irq_cycle_tab[irq_cycle_entry] = cycles;
irq_cycle_entry = (irq_cycle_entry + 1) % IRQ_CYCLE_COUNTS;
//printf ("IRQ took %lu cycles\n", cycles);
//printf ("Average = %d\n", irq_cycles / IRQ_CYCLE_COUNTS);
}
void
command_init (void)
{
int rc;
sym_add (&auto_symtab, "pc", (unsigned long)pc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "x", (unsigned long)x_virtual, SYM_AUTO);
sym_add (&auto_symtab, "y", (unsigned long)y_virtual, SYM_AUTO);
sym_add (&auto_symtab, "u", (unsigned long)u_virtual, SYM_AUTO);
sym_add (&auto_symtab, "s", (unsigned long)s_virtual, SYM_AUTO);
sym_add (&auto_symtab, "d", (unsigned long)d_virtual, SYM_AUTO);
sym_add (&auto_symtab, "a", (unsigned long)a_virtual, SYM_AUTO);
sym_add (&auto_symtab, "b", (unsigned long)b_virtual, SYM_AUTO);
sym_add (&auto_symtab, "dp", (unsigned long)dp_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cc", (unsigned long)cc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cycles", (unsigned long)cycles_virtual, SYM_AUTO);
sym_add (&auto_symtab, "et", (unsigned long)et_virtual, SYM_AUTO);
sym_add (&auto_symtab, "irqload", (unsigned long)irq_load_virtual, SYM_AUTO);
examine_type.format = 'x';
examine_type.size = 1;
print_type.format = 'x';
print_type.size = 1;
+ command_input = stdin;
(void)command_exec_file (".dbinit");
}
/* vim: set ts=3: */
/* vim: set expandtab: */
|
bcd/exec09
|
a6b8b2b494d48e826d45731c1d7e8d91d5a9f70c
|
Print cycles correctly on exit.
|
diff --git a/6809.c b/6809.c
index 2ee7e27..ad1c616 100644
--- a/6809.c
+++ b/6809.c
@@ -1,662 +1,664 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include "monitor.h"
#include <stdarg.h>
unsigned X, Y, S, U, PC;
unsigned A, B, DP;
unsigned H, N, Z, OV, C;
unsigned EFI;
#ifdef H6309
unsigned E, F, V, MD;
#define MD_NATIVE 0x1 /* if 1, execute in 6309 mode */
#define MD_FIRQ_LIKE_IRQ 0x2 /* if 1, FIRQ acts like IRQ */
#define MD_ILL 0x40 /* illegal instruction */
#define MD_DBZ 0x80 /* divide by zero */
#endif /* H6309 */
unsigned iPC;
unsigned long irq_start_time;
unsigned ea = 0;
long cpu_clk = 0;
long cpu_period = 0;
int cpu_quit = 1;
unsigned int irqs_pending = 0;
unsigned int firqs_pending = 0;
unsigned int cc_changed = 0;
unsigned *index_regs[4] = { &X, &Y, &U, &S };
extern int dump_cycles_on_success;
extern int trace_enabled;
extern void irq (void);
extern void firq (void);
void request_irq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
irqs_pending |= (1 << source);
if (!(EFI & I_FLAG))
irq ();
}
void release_irq (unsigned int source)
{
irqs_pending &= ~(1 << source);
}
void request_firq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
firqs_pending |= (1 << source);
if (!(EFI & F_FLAG))
firq ();
}
void release_firq (unsigned int source)
{
firqs_pending &= ~(1 << source);
}
static inline void
check_pc (void)
{
/* TODO */
}
static inline void
check_stack (void)
{
/* TODO */
}
void
sim_error (const char *format, ...)
{
va_list ap;
va_start (ap, format);
fprintf (stderr, "m6809-run: (at PC=%04X) ", iPC);
vfprintf (stderr, format, ap);
va_end (ap);
if (debug_enabled)
monitor_on = 1;
else
exit (2);
}
unsigned long
get_cycles (void)
{
return total + cpu_period - cpu_clk;
}
void
sim_exit (uint8_t exit_code)
{
/* On a nonzero exit, always print an error message. */
if (exit_code != 0)
{
printf ("m6809-run: program exited with %d\n", exit_code);
if (exit_code)
monitor_backtrace ();
}
/* If a cycle count should be printed, do that last. */
if (dump_cycles_on_success)
- printf ("Finished in %d cycles\n", get_cycles ());
+ {
+ printf ("Simulated time : %ld cycles\n", get_cycles ());
+ }
exit (exit_code);
}
static inline void
change_pc (unsigned newPC)
{
/* TODO - will let some RAM execute for trampolines */
if ((newPC < 0x1C00) || (newPC > 0xFFFF))
{
fprintf (stderr, "m6809-run: invalid PC = %04X, previous was %s\n",
newPC, monitor_addr_name (PC));
exit (2);
}
if (trace_enabled)
{
fprintf (stderr, "PC : %s ", monitor_addr_name (PC));
fprintf (stderr, "-> %s\n", monitor_addr_name (newPC));
}
PC = newPC;
}
static inline unsigned
imm_byte (void)
{
unsigned val = read8 (PC);
PC++;
return val;
}
static inline unsigned
imm_word (void)
{
unsigned val = read16 (PC);
PC += 2;
return val;
}
#define WRMEM(addr, data) write8 (addr, data)
static void
WRMEM16 (unsigned addr, unsigned data)
{
WRMEM (addr, data >> 8);
cpu_clk--;
WRMEM ((addr + 1) & 0xffff, data & 0xff);
}
#define RDMEM(addr) read8 (addr)
static unsigned
RDMEM16 (unsigned addr)
{
unsigned val = RDMEM (addr) << 8;
cpu_clk--;
val |= RDMEM ((addr + 1) & 0xffff);
return val;
}
#define write_stack WRMEM
#define read_stack RDMEM
static void
write_stack16 (unsigned addr, unsigned data)
{
write_stack ((addr + 1) & 0xffff, data & 0xff);
write_stack (addr, data >> 8);
}
static unsigned
read_stack16 (unsigned addr)
{
return (read_stack (addr) << 8) | read_stack ((addr + 1) & 0xffff);
}
static void
direct (void)
{
unsigned val = read8 (PC) | DP;
PC++;
ea = val;
}
static void
indexed (void) /* note take 1 extra cycle */
{
unsigned post = imm_byte ();
unsigned *R = index_regs[(post >> 5) & 0x3];
if (post & 0x80)
{
switch (post & 0x1f)
{
case 0x00:
ea = *R;
*R = (*R + 1) & 0xffff;
cpu_clk -= 6;
break;
case 0x01:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
break;
case 0x02:
*R = (*R - 1) & 0xffff;
ea = *R;
cpu_clk -= 6;
break;
case 0x03:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
break;
case 0x04:
ea = *R;
cpu_clk -= 4;
break;
case 0x05:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
break;
case 0x06:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
break;
case 0x08:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
break;
case 0x09:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
break;
case 0x0d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
break;
case 0x11:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x13:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x14:
ea = *R;
cpu_clk -= 4;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x15:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x16:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x18:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x19:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1f:
ea = imm_word ();
cpu_clk -= 6;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
default:
ea = 0;
printf ("%X: invalid index post $%02X\n", iPC, post);
if (debug_enabled)
{
monitor_on = 1;
}
else
{
exit (1);
}
break;
}
}
else
{
if (post & 0x10)
post |= 0xfff0;
else
post &= 0x000f;
ea = (*R + post) & 0xffff;
cpu_clk -= 5;
}
}
static void
extended (void)
{
unsigned val = read16 (PC);
PC += 2;
ea = val;
}
/* external register functions */
unsigned
get_a (void)
{
return A;
}
unsigned
get_b (void)
{
return B;
}
unsigned
get_dp (void)
{
return DP >> 8;
}
unsigned
get_x (void)
{
return X;
}
unsigned
get_y (void)
{
return Y;
}
unsigned
get_s (void)
{
return S;
}
unsigned
get_u (void)
{
return U;
}
unsigned
get_pc (void)
{
return PC & 0xffff;
}
unsigned
get_d (void)
{
return (A << 8) | B;
}
#ifdef H6309
unsigned
get_e (void)
{
return E;
}
unsigned
get_f (void)
{
return F;
}
unsigned
get_w (void)
{
return (E << 8) | F;
}
unsigned
get_q (void)
{
return (get_w () << 16) | get_d ();
}
unsigned
get_v (void)
{
return V;
}
unsigned
get_zero (void)
{
return 0;
}
unsigned
get_md (void)
{
return MD;
}
#endif
void
set_a (unsigned val)
{
A = val & 0xff;
}
void
set_b (unsigned val)
{
B = val & 0xff;
}
void
set_dp (unsigned val)
{
DP = (val & 0xff) << 8;
}
void
set_x (unsigned val)
{
X = val & 0xffff;
}
void
set_y (unsigned val)
{
Y = val & 0xffff;
}
void
set_s (unsigned val)
{
S = val & 0xffff;
check_stack ();
}
void
set_u (unsigned val)
{
U = val & 0xffff;
}
void
set_pc (unsigned val)
{
PC = val & 0xffff;
check_pc ();
}
void
set_d (unsigned val)
{
A = (val >> 8) & 0xff;
B = val & 0xff;
}
#ifdef H6309
void
set_e (unsigned val)
{
E = val & 0xff;
}
void
set_f (unsigned val)
{
F = val & 0xff;
}
void
set_w (unsigned val)
{
E = (val >> 8) & 0xff;
F = val & 0xff;
}
void
set_q (unsigned val)
{
set_w ((val >> 16) & 0xffff);
set_d (val & 0xffff);
}
void
set_v (unsigned val)
{
V = val & 0xff;
}
void
set_zero (unsigned val)
{
}
void
set_md (unsigned val)
{
MD = val & 0xff;
}
#endif
/* handle condition code register */
unsigned
get_cc (void)
{
unsigned res = EFI & (E_FLAG | F_FLAG | I_FLAG);
if (H & 0x10)
res |= H_FLAG;
if (N & 0x80)
res |= N_FLAG;
if (Z == 0)
res |= Z_FLAG;
if (OV & 0x80)
res |= V_FLAG;
if (C != 0)
res |= C_FLAG;
return res;
}
void
set_cc (unsigned arg)
{
EFI = arg & (E_FLAG | F_FLAG | I_FLAG);
H = (arg & H_FLAG ? 0x10 : 0);
N = (arg & N_FLAG ? 0x80 : 0);
Z = (~arg) & Z_FLAG;
OV = (arg & V_FLAG ? 0x80 : 0);
C = arg & C_FLAG;
cc_changed = 1;
}
void
cc_modified (void)
{
/* Check for pending interrupts */
if (firqs_pending && !(EFI & F_FLAG))
firq ();
else if (irqs_pending && !(EFI & I_FLAG))
irq ();
cc_changed = 0;
}
unsigned
get_reg (unsigned nro)
{
unsigned val = 0xff;
switch (nro)
{
case 0:
val = (A << 8) | B;
break;
case 1:
|
bcd/exec09
|
98659eed7d7e9250a523295ad15c64880f709252
|
Clean up help.
|
diff --git a/main.c b/main.c
index cf95380..e778eb5 100644
--- a/main.c
+++ b/main.c
@@ -1,407 +1,408 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/time.h>
#include "6809.h"
enum
{ HEX, S19, BIN };
/* The total number of cycles that have executed */
unsigned long total = 0;
/* The frequency of the emulated CPU, in megahertz */
unsigned int mhz = 1;
/* When nonzero, indicates that the IRQ should be triggered periodically,
every so many cycles. By default no periodic IRQ is generated. */
unsigned int cycles_per_irq = 0;
/* When nonzero, indicates that the FIRQ should be triggered periodically,
every so many cycles. By default no periodic FIRQ is generated. */
unsigned int cycles_per_firq = 0;
/* Nonzero if debugging support is turned on */
int debug_enabled = 0;
/* Nonzero if tracing is enabled */
int trace_enabled = 0;
/* When nonzero, causes the program to print the total number of cycles
on a successful exit. */
int dump_cycles_on_success = 0;
/* When nonzero, indicates the total number of cycles before an automated
exit. This is to help speed through test cases that never finish. */
int max_cycles = 100000000;
static int type = S19;
char *exename;
const char *machine_name = "simple";
const char *prog_name = NULL;
-static void usage (void)
-{
- printf ("Usage: %s <options> filename\n", exename);
- printf ("Options are:\n");
- printf ("-hex - load intel hex file\n");
- printf ("-s19 - load motorola s record file\n");
- printf ("-bin - load binary file\n");
- printf ("-s addr - specify binary load address hexadecimal (default 0)\n");
- printf ("default format is motorola s record\n");
- exit (1);
-}
-
+FILE *stat_file = NULL;
void
idle_loop (void)
{
struct timeval now;
static struct timeval last = { 0, 0 };
int real_ms;
static unsigned long last_cycles = 0;
unsigned long cycles;
int sim_ms;
const int cycles_per_ms = 2000;
static int period = 100;
static int count = 100;
int delay;
static int total_ms_elapsed = 0;
if (--count > 0)
return;
if (last.tv_usec == 0)
gettimeofday (&last, NULL);
gettimeofday (&now, NULL);
real_ms = (now.tv_usec - last.tv_usec) / 1000;
if (real_ms < 0)
real_ms += 1000;
last = now;
cycles = get_cycles ();
sim_ms = (cycles - last_cycles) / cycles_per_ms;
if (sim_ms < 0)
sim_ms += cycles_per_ms;
last_cycles = cycles;
total_ms_elapsed += sim_ms;
if (total_ms_elapsed > 100)
{
total_ms_elapsed -= 100;
wpc_periodic ();
command_periodic ();
}
delay = sim_ms - real_ms;
if (delay > 0)
{
if (delay > 60)
period -= 5;
else if (delay < 20)
period += 5;
usleep (delay * 1000UL);
}
count = period;
}
int do_help (const char *arg __attribute__((unused)));
#define NO_NEG 0
#define HAS_NEG 1
#define NO_ARG 0
#define HAS_ARG 1
struct option
{
char o_short;
const char *o_long;
const char *help;
unsigned int can_negate : 1;
unsigned int takes_arg : 1;
int *int_value;
int default_value;
const char **string_value;
int (*handler) (const char *arg);
} option_table[] = {
{ 'd', "debug", "Enter the monitor immediately",
HAS_NEG, NO_ARG, &debug_enabled, 1, NULL, NULL },
{ 'h', "help", NULL,
NO_NEG, NO_ARG, NULL, NULL, 0, do_help },
{ 'b', "binary", "",
NO_NEG, NO_ARG, &type, BIN, NULL, NULL },
{ 'M', "mhz", "", NO_NEG, HAS_ARG },
{ '-', "68a09", "Emulate the 68A09 variation (1.5Mhz)" },
{ '-', "68b09", "Emulate the 68B09 variation (2Mhz)" },
{ 'R', "realtime", "Limit simulation speed to match realtime" },
{ 'I', "irqfreq", "Asserts an IRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_irq, 0, NULL, NULL },
{ 'F', "firqfreq", "Asserts an FIRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_firq, 0, NULL, NULL },
{ 'C', "cycledump", "",
HAS_NEG, NO_ARG, &dump_cycles_on_success, 1, NULL, NULL},
{ 't', "loadmap", "" },
{ 'T', "trace", "",
NO_NEG, NO_ARG, &trace_enabled, 1, NULL, NULL },
{ 'm', "maxcycles", "Sets maximum number of cycles to run",
NO_NEG, HAS_ARG, &max_cycles, 0, NULL, NULL },
{ 's', "machine", "Specify the machine (exact hardware) to emulate",
NO_NEG, HAS_ARG, NULL, 0, &machine_name, NULL },
{ '\0', NULL },
};
int
do_help (const char *arg __attribute__((unused)))
{
struct option *opt = option_table;
+
+ printf ("Motorola 6809 Simulator Version %s\n", PACKAGE_VERSION);
+ printf ("m6809-run [options] [program]\n\n");
+ printf ("Options:\n");
while (opt->o_long != NULL)
{
if (opt->help)
{
- printf ("-%c,--%s %s\n",
- opt->o_short, opt->o_long, opt->help);
+ if (opt->o_short == '-')
+ printf (" --%-16.16s %s\n", opt->o_long, opt->help);
+ else
+ printf (" -%c, --%-16.16s%s\n", opt->o_short, opt->o_long, opt->help);
}
opt++;
}
return -1;
}
+void usage (void)
+{
+ do_help (NULL);
+}
+
+
/**
* Returns positive if an argument was taken.
* Returns zero if no argument was taken.
* Returns negative on error.
*/
int
process_option (struct option *opt, const char *arg)
{
int rc;
//printf ("Processing option '%s'\n", opt->o_long);
if (opt->takes_arg)
{
if (!arg)
{
//printf (" Takes argument but none given.\n");
rc = 0;
}
else
{
if (opt->int_value)
{
*(opt->int_value) = strtoul (arg, NULL, 0);
//printf (" Integer argument '%d' taken.\n", *(opt->int_value));
}
else if (opt->string_value)
{
*(opt->string_value) = arg;
//printf (" String argument '%s' taken.\n", *(opt->string_value));
}
rc = 1;
}
}
else
{
if (arg)
//printf (" Takes no argument but one given, ignored.\n");
if (opt->int_value)
{
*(opt->int_value) = opt->default_value;
//printf (" Integer argument 1 implied.\n");
}
rc = 0;
}
if (opt->handler)
{
rc = opt->handler (arg);
//printf (" Handler called, rc=%d\n", rc);
}
if (rc < 0)
exit (0);
return rc;
}
int
process_plain_argument (const char *arg)
{
//printf ("plain argument '%s'\n", arg);
if (!prog_name)
prog_name = arg;
}
int
parse_args (int argc, char *argv[])
{
int argn = 1;
struct option *opt;
next_arg:
while (argn < argc)
{
char *arg = argv[argn];
if (arg[0] == '-')
{
if (arg[1] == '-')
{
char *rest = strchr (arg+2, '=');
if (rest)
*rest++ = '\0';
opt = option_table;
while (opt->o_long != NULL)
{
if (!strcmp (opt->o_long, arg+2))
{
argn++;
(void)process_option (opt, rest);
goto next_arg;
}
opt++;
}
printf ("long option '%s' not recognized.\n", arg+2);
}
else
{
opt = option_table;
while (opt->o_long != NULL)
{
if (opt->o_short == arg[1])
{
argn++;
if (process_option (opt, argv[argn]))
argn++;
goto next_arg;
}
opt++;
}
printf ("short option '%c' not recognized.\n", arg[1]);
}
argn++;
}
else
{
process_plain_argument (argv[argn++]);
}
}
}
int
main (int argc, char *argv[])
{
int off = 0;
int i, j, n;
int argn = 1;
unsigned int loops = 0;
exename = argv[0];
/* TODO - enable different options by default
based on the executable name. */
parse_args (argc, argv);
sym_init ();
switch (type)
{
case HEX:
if (prog_name && load_hex (prog_name))
usage ();
break;
case S19:
machine_init (machine_name, NULL);
if (prog_name && load_s19 (prog_name))
usage ();
break;
default:
machine_init (machine_name, prog_name);
break;
}
/* Try to load a map file */
if (prog_name)
load_map_file (prog_name);
/* Enable debugging if no executable given yet. */
if (!prog_name)
debug_enabled = 1;
else
/* OK, ready to run. Reset the CPU first. */
cpu_reset ();
monitor_init ();
command_init ();
keybuffering (0);
/* Now, iterate through the instructions.
* If no IRQs or FIRQs are enabled, we can just call cpu_execute()
* and let it run for a long time; otherwise, we need to come back
* here periodically and do the interrupt handling. */
for (cpu_quit = 1; cpu_quit != 0;)
{
if ((cycles_per_irq == 0) && (cycles_per_firq == 0))
{
total += cpu_execute (max_cycles ? max_cycles-1 : 500000);
}
else
{
total += cpu_execute (cycles_per_irq);
request_irq (0);
{
/* TODO - FIRQ frequency not handled yet */
static int firq_freq = 0;
if (++firq_freq == 8)
{
request_firq (0);
firq_freq = 0;
}
}
}
idle_loop ();
/* Check for a rogue program that won't end */
if ((max_cycles > 0) && (total > max_cycles))
{
sim_error ("maximum cycle count exceeded at %s\n",
monitor_addr_name (get_pc ()));
}
}
printf ("m6809-run stopped after %d cycles\n", total);
return 0;
}
|
bcd/exec09
|
0f6e797c7eab379c2732ca829a5d959df8230c40
|
Add shell commands to the README.
|
diff --git a/README b/README
index 7882b94..2ae16b0 100644
--- a/README
+++ b/README
@@ -1,78 +1,154 @@
This is a rewrite of Arto Salmi's 6809 simulator. Many changes
have been made to it. This program remains licensed under the
GNU General Public License.
Input Files
Machines
The simulator now has the notion of different 'machines':
which says what types of I/O devices are mapped into the 6809's
address space and how they can be accessed. Adding support for
a new machine is fairly easy.
There are 3 builtin machine types at present. The default,
called 'simple', assumes that you have a full 64KB of RAM,
minus some input/output functions mapped at $FF00 (see I/O below).
If you compile a program with gcc6809 with no special linker
option, you'll get an S-record file that is suitable for running
on this machine. The S-record file will include a vector table
at $FFF0, with a reset vector that points to a _start function,
which will call your main() function. When main returns,
_start writes to an 'exit register' at $FF01, which the simulator
interprets and causes it to stop.
gcc6809 also has a builtin notion of which addresses are used
for text and data. The simple machine enforces this and will
"fault" on invalid accesses.
The second machine is 'wpc', and is an emulation of the
Williams Pinball Controller which was the impetus for me
working on the compiler in the first place.
The third machine, still in development, is called 'eon'
(for Eight-O-Nine). It is similar to simple but has some
more advanced I/O capabilities, like a larger memory space
that can be paged in/out, and a disk emulation for programs
that wants to have persistence.
TODO : Would anyone be interested in a CoCo machine type?
Faults
+Debugging
+
+The simulator supports interactive debugging similar to that
+provided by 'gdb'.
+
+b <expr>
+ Set a breakpoint at the given address.
+
+bl
+ List all breakpoints.
+
+c
+ Continue running.
+
+d <num>
+ Delete a breakpoint/watchpoint.
+
+di <expr>
+ Add a display expression. The value of the expression
+ is display anytime the CPU breaks.
+
+h
+ Display help.
+
+l <expr>
+ List CPU instructions.
+
+me <expr>
+ Measure the amount of time that a function named by
+ <expr> takes.
+
+n
+ Continue until the next instruction is reached.
+ If the current instruction is a call, then
+ the debugger resumes after control returns.
+
+p <expr>
+ Print the value of an expression. See "Expressions" below.
+
+q
+ Quit the simulator.
+
+re
+ Reset the CPU/machine.
+
+runfor <expr>
+ Continue but break after a certain period of (simulated) time.
+
+s
+ Step one CPU instruction.
+
+set <expr>
+ Sets the value of an internal variable or target memory.
+ See "Expressions" below for details on the syntax.
+
+so <file>
+ Run a set of debugger commands from another file.
+ The commands may start/stop the CPU. When the commands
+ are finished, control returns to the previous input
+ source (the file that called it, or the keyboard.)
+
+sym <file>
+ Load a symbol table file. Currently, the only format
+ supported is an aslink map file.
+
+td
+ Dump the last 256 instructions that were executed.
+
+wa <expr>
+ Add a watchpoint. The CPU will break when the
+ memory given by <expr> is modified.
+
+x <expr>
+ Examine target memory at the address given.
+
+
-----------------------------------------------------------------
Original README text from Arto:
simple 6809 simulator under GPL licence
NOTE! this software is beta stage, and has bugs.
To compile it you should have 32-bit ANSI C complier.
This simulator is missing all interrupt related SYNC, NMI Etc...
I am currently busy with school, thus this is relased.
if you have guestion or found something funny in my code please mail me.
have fun!
arto salmi asalmi@ratol.fi
history:
2001-01-28 V1.0 original version
2001-02-15 V1.1 fixed str_scan function, fixed dasm _rel_???? code.
2001-06-19 V1.2 Added changes made by Joze Fabcic:
- 6809's memory is initialized to zero
- function dasm() had two bugs when using vc6.0 complier:
- RDWORD macro used two ++ in same variable
- _rel_byte address was wrong by 1.
- after EXIT command, if invalid instruction is encountered, monitor is activated again
- default file format is motorola S-record
- monitor formatting
|
bcd/exec09
|
ab5081f5cf87ecfdab45454ed28ade87610775b0
|
Allow only one WPC ASIC at a time, kept in the global 'wpc'.
|
diff --git a/wpc.c b/wpc.c
index 13cdebb..c22cb69 100644
--- a/wpc.c
+++ b/wpc.c
@@ -1,640 +1,648 @@
/*
- * Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
+ * Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
- *
+ *
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
-#include <sys/time.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#else
+#error
+#endif
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3c00
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
-
+/**
+ * The 'wpc_asic' struct holds all of the state
+ * of the ASIC. There is a single instance of this,
+ * named 'the_wpc', and it is pointed to by the
+ * global 'wpc'. Only one ASIC can be defined at
+ * a time.
+ */
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
struct hw_device *dmd_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
U8 opto_mx[8];
U8 dmd_maps[2];
U8 dmd_active_page;
int curr_sw;
int curr_sw_time;
int wdog_timer;
-};
+} the_wpc;
-struct wpc_asic *global_wpc;
+struct wpc_asic *wpc = NULL;
void wpc_asic_reset (struct hw_device *dev)
{
- struct wpc_asic *wpc = dev->priv;
- global_wpc = wpc;
wpc->curr_sw_time = 0;
wpc->wdog_timer = 0;
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
#if 1
return rc;
#endif
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
rc |= WPC_DEBUG_READ_READY;
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
-unsigned int wpc_read_switch (struct wpc_asic *wpc, int num)
+unsigned int wpc_read_switch (int num)
{
unsigned int val;
val = wpc->switch_mx[num / 8] & (1 << (num % 8));
return val ? 1 : 0;
}
-void wpc_write_switch (struct wpc_asic *wpc, int num, int flag)
+void wpc_write_switch (int num, int flag)
{
unsigned int col, val;
col = num / 8;
val = 1 << (num % 8);
if (wpc->opto_mx[col] & val)
flag = !flag;
wpc->switch_mx[col] &= ~val;
if (flag)
wpc->switch_mx[col] |= val;
}
-void wpc_press_switch (struct wpc_asic *wpc, int num, int delay)
+void wpc_press_switch (int num, int delay)
{
- wpc_write_switch (wpc, num, 1);
+ wpc_write_switch (num, 1);
wpc->curr_sw = num;
wpc->curr_sw_time = delay;
}
-unsigned int wpc_read_switch_column (struct wpc_asic *wpc, int col)
+unsigned int wpc_read_switch_column (int col)
{
unsigned int val = 0;
int row;
for (row = 0; row < 8; row++)
- if (wpc_read_switch (wpc, col * 8 + row))
+ if (wpc_read_switch (col * 8 + row))
val |= (1 << row);
return val;
}
void wpc_write_lamp (int num, int flag)
{
}
void wpc_write_sol (int num, int flag)
{
}
-void wpc_print_display (struct wpc_asic *wpc)
+void wpc_print_display (void)
{
FILE *fp;
char *p = wpc->dmd_dev->priv + wpc->dmd_active_page * 512;
fp = fopen ("dmd", "wb");
if (!fp)
{
fprintf (stderr, "could not write to DMD!!!\n");
return;
}
fwrite (p, 512, 1, fp);
fclose (fp);
}
-void wpc_keypoll (struct wpc_asic *wpc)
+void wpc_keypoll (void)
{
fd_set fds;
struct timeval timeout;
int rc;
unsigned char c;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
{
rc = read (0, &c, 1);
switch (c)
{
case '7':
- wpc_press_switch (wpc, 4, 200);
+ wpc_press_switch (4, 200);
break;
case '8':
- wpc_press_switch (wpc, 5, 200);
+ wpc_press_switch (5, 200);
break;
case '9':
- wpc_press_switch (wpc, 6, 200);
+ wpc_press_switch (6, 200);
break;
case '0':
- wpc_press_switch (wpc, 7, 200);
+ wpc_press_switch (7, 200);
break;
case 'd':
- wpc_print_display (wpc);
+ wpc_print_display ();
break;
default:
break;
}
}
}
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
- struct wpc_asic *wpc = dev->priv;
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit / 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
case WPC_SW_ROW_INPUT:
- val = wpc_read_switch_column (wpc, 1 + scanbit (wpc->switch_strobe));
+ val = wpc_read_switch_column (1 + scanbit (wpc->switch_strobe));
break;
case WPC_SW_JUMPER_INPUT:
val = 0x55;
break;
case WPC_SW_CABINET_INPUT:
- val = wpc_read_switch_column (wpc, 0);
+ val = wpc_read_switch_column (0);
break;
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
-void wpc_update_ram (struct wpc_asic *wpc)
+void wpc_update_ram (void)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_set_rom_page (unsigned char val)
{
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
}
-void wpc_set_dmd_page (struct wpc_asic *wpc, unsigned int map, unsigned char val)
+void wpc_set_dmd_page (unsigned int map, unsigned char val)
{
wpc->dmd_maps[map] = val;
bus_map (0x3800 + map * 0x200, 3, val * 0x200, 0x200, MAP_READWRITE);
}
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
- struct wpc_asic *wpc = dev->priv;
switch (addr + WPC_ASIC_BASE)
{
case WPC_DMD_LOW_PAGE:
- wpc_set_dmd_page (wpc, 0, val);
+ wpc_set_dmd_page (0, val);
break;
case WPC_DMD_HIGH_PAGE:
- wpc_set_dmd_page (wpc, 1, val);
+ wpc_set_dmd_page (1, val);
break;
case WPC_DMD_FIRQ_ROW_VALUE:
break;
case WPC_DMD_ACTIVE_PAGE:
wpc->dmd_active_page = val;
- wpc_print_display (wpc);
+ wpc_print_display ();
break;
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
wpc->wdog_timer++;
break;
case WPC_ROM_BANK:
wpc->rombank = val;
wpc_set_rom_page (val);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
- wpc_update_ram (wpc);
+ wpc_update_ram ();
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
- wpc_update_ram (wpc);
+ wpc_update_ram ();
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
case WPC_SW_COL_STROBE:
wpc->switch_strobe = val;
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
- struct wpc_asic *wpc = global_wpc;
-
- wpc_keypoll (wpc);
+ wpc_keypoll ();
wpc->wdog_timer -= 50;
if (wpc->wdog_timer <= 0)
{
}
if (wpc->curr_sw_time > 0)
{
wpc->curr_sw_time -= 100;
if (wpc->curr_sw_time <= 0)
{
wpc->curr_sw_time = 0;
- wpc_write_switch (wpc, wpc->curr_sw, 0);
+ wpc_write_switch (wpc->curr_sw, 0);
}
}
}
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
- struct wpc_asic *wpc = calloc (sizeof (struct wpc_asic), 1);
+ if (wpc)
+ {
+ fprintf (stderr, "WPC ASIC already created\n");
+ return NULL;
+ }
+
+ wpc = &the_wpc;
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
void io_sym_add (const char *name, unsigned long cpuaddr)
{
sym_add (&program_symtab, name, to_absolute (cpuaddr), 0);
}
#define IO_SYM_ADD(name) io_sym_add (#name, name)
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
- struct wpc_asic *wpc;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
- wpc = dev->priv;
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
device_define ( dev = ram_create (16 * 512), 0,
0x3800, 0x200 * 2, MAP_READWRITE );
wpc->dmd_dev = dev;
- wpc_update_ram (wpc);
+ wpc_update_ram ();
IO_SYM_ADD(WPC_DMD_LOW_BASE);
IO_SYM_ADD(WPC_DMD_HIGH_BASE);
IO_SYM_ADD(WPC_DMD_HIGH_PAGE);
IO_SYM_ADD(WPC_DMD_FIRQ_ROW_VALUE);
IO_SYM_ADD(WPC_DMD_LOW_PAGE);
IO_SYM_ADD(WPC_DMD_ACTIVE_PAGE);
IO_SYM_ADD(WPC_SERIAL_STATUS_PORT);
IO_SYM_ADD(WPC_PARALLEL_DATA_PORT);
IO_SYM_ADD(WPC_PARALLEL_STROBE_PORT);
IO_SYM_ADD(WPC_SERIAL_DATA_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_CONTROL_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_BAUD_SELECT);
IO_SYM_ADD(WPC_TICKET_DISPENSE);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_OUT);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_IN);
IO_SYM_ADD(WPC_DCS_SOUND_RESET);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_READY);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_A);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_B);
IO_SYM_ADD(WPCS_DATA);
IO_SYM_ADD(WPCS_CONTROL_STATUS);
IO_SYM_ADD(WPC_SOL_FLASH2_OUTPUT);
IO_SYM_ADD(WPC_SOL_HIGHPOWER_OUTPUT);
IO_SYM_ADD(WPC_SOL_FLASH1_OUTPUT);
IO_SYM_ADD(WPC_SOL_LOWPOWER_OUTPUT);
IO_SYM_ADD(WPC_LAMP_ROW_OUTPUT);
IO_SYM_ADD(WPC_LAMP_COL_STROBE);
IO_SYM_ADD(WPC_GI_TRIAC);
IO_SYM_ADD(WPC_SW_JUMPER_INPUT);
IO_SYM_ADD(WPC_SW_CABINET_INPUT);
IO_SYM_ADD(WPC_SW_ROW_INPUT);
IO_SYM_ADD(WPC_SW_COL_STROBE);
IO_SYM_ADD(WPC_LEDS);
IO_SYM_ADD(WPC_RAM_BANK);
IO_SYM_ADD(WPC_SHIFTADDR);
IO_SYM_ADD(WPC_SHIFTBIT);
IO_SYM_ADD(WPC_SHIFTBIT2);
IO_SYM_ADD(WPC_PERIPHERAL_TIMER_FIRQ_CLEAR);
IO_SYM_ADD(WPC_ROM_LOCK);
IO_SYM_ADD(WPC_CLK_HOURS_DAYS);
IO_SYM_ADD(WPC_CLK_MINS);
IO_SYM_ADD(WPC_ROM_BANK);
IO_SYM_ADD(WPC_RAM_LOCK);
IO_SYM_ADD(WPC_RAM_LOCKSIZE);
}
struct machine wpc_machine =
{
.name = "wpc",
.fault = wpc_fault,
.init = wpc_init,
};
|
bcd/exec09
|
e6464804b79ef702dffecc1c55b3fbe4023cd0fa
|
Add cpu_read16(), a faster way to read 16-bits at once. This is only a slight optimization, but it gets exercised a lot.
|
diff --git a/6809.h b/6809.h
index 0e50849..dc2eec4 100644
--- a/6809.h
+++ b/6809.h
@@ -1,243 +1,243 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_H
#define M6809_H
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#else
#error
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
#error
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#else
#error
#endif
typedef uint8_t UINT8;
typedef signed char INT8;
typedef uint16_t UINT16;
typedef signed short INT16;
typedef uint32_t UINT32;
typedef signed int INT32;
typedef uint16_t target_addr_t;
#include "machine.h"
#define E_FLAG 0x80
#define F_FLAG 0x40
#define H_FLAG 0x20
#define I_FLAG 0x10
#define N_FLAG 0x08
#define Z_FLAG 0x04
#define V_FLAG 0x02
#define C_FLAG 0x01
extern int debug_enabled;
extern int need_flush;
extern unsigned long total;
extern int dump_cycles_on_success;
#ifdef OLDSYS
extern UINT8 *memory;
#endif
/* Primitive read/write macros */
#define read8(addr) cpu_read8 (addr)
#define write8(addr,val) do { cpu_write8 (addr, val); } while (0)
/* 16-bit versions */
-#define read16(addr) (read8(addr) << 8 | read8(addr+1))
+#define read16(addr) cpu_read16(addr)
#define write16(addr,val) do { write8(addr+1, val & 0xFF); write8(addr, (val >> 8) & 0xFF); } while (0)
/* Fetch macros */
#define abs_read16(addr) ((abs_read8(addr) << 8) | abs_read8(addr+1))
#define fetch8() abs_read8 (pc++)
#define fetch16() (pc += 2, abs_read16(pc-2))
/* 6809.c */
extern int cpu_quit;
extern int cpu_execute (int);
extern void cpu_reset (void);
extern unsigned get_a (void);
extern unsigned get_b (void);
extern unsigned get_cc (void);
extern unsigned get_dp (void);
extern unsigned get_x (void);
extern unsigned get_y (void);
extern unsigned get_s (void);
extern unsigned get_u (void);
extern unsigned get_pc (void);
extern unsigned get_d (void);
extern void set_a (unsigned);
extern void set_b (unsigned);
extern void set_cc (unsigned);
extern void set_dp (unsigned);
extern void set_x (unsigned);
extern void set_y (unsigned);
extern void set_s (unsigned);
extern void set_u (unsigned);
extern void set_pc (unsigned);
extern void set_d (unsigned);
/* fileio.c */
struct pathlist
{
int count;
char *entry[32];
};
void path_init (struct pathlist *path);
void path_add (struct pathlist *path, const char *dir);
FILE * file_open (struct pathlist *path, const char *filename, const char *mode);
FILE * file_require_open (struct pathlist *path, const char *filename, const char *mode);
void file_close (FILE *fp);
/* monitor.c */
extern int monitor_on;
extern int check_break (void);
extern void monitor_init (void);
extern int monitor6809 (void);
extern int dasm (char *, absolute_address_t);
extern int load_hex (char *);
extern int load_s19 (char *);
extern int load_bin (char *,int);
#define MAX_STRINGSPACE 32000
#define MAX_SYMBOL_HASH 1009
#define SYM_DEFAULT 0
#define SYM_AUTO 1
typedef struct
{
unsigned char format;
unsigned int size;
} datatype_t;
/* symtab.c */
struct stringspace
{
char space[32000];
unsigned int used;
};
struct symbol
{
char *name;
unsigned long value;
datatype_t ty;
unsigned int type;
struct symbol *name_chain;
struct symbol *value_chain;
};
struct symtab
{
struct symbol *syms_by_name[MAX_SYMBOL_HASH];
struct symbol *syms_by_value[MAX_SYMBOL_HASH];
struct symtab *parent;
};
extern struct symtab program_symtab;
extern struct symtab internal_symtab;
extern struct symtab auto_symtab;
void sym_add (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
void sym_set (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
int sym_find (struct symtab *symtab, const char *name, unsigned long *value, unsigned int type);
const char *sym_lookup (struct symtab *symtab, unsigned long value);
typedef void (*command_handler_t) (void);
typedef void (*virtual_handler_t) (unsigned long *val, int writep);
typedef unsigned int thread_id_t;
typedef struct
{
unsigned int id : 8;
unsigned int used : 1;
unsigned int enabled : 1;
unsigned int conditional : 1;
unsigned int threaded : 1;
unsigned int on_read : 1;
unsigned int on_write : 1;
unsigned int on_execute : 1;
unsigned int size : 4;
unsigned int keep_running : 1;
unsigned int temp : 1;
unsigned int last_write : 16;
unsigned int write_mask : 16;
absolute_address_t addr;
char condition[128];
thread_id_t tid;
unsigned int pass_count;
unsigned int ignore_count;
} breakpoint_t;
typedef struct
{
int used : 1;
datatype_t type;
char expr[128];
} display_t;
typedef struct
{
int id : 8;
thread_id_t tid;
} thread_t;
#define MAX_BREAKS 32
#define MAX_DISPLAYS 32
#define MAX_HISTORY 10
#define MAX_THREADS 64
void command_irq_hook (unsigned long cycles);
#endif /* M6809_H */
diff --git a/machine.c b/machine.c
index ac234ad..a4d7ded 100644
--- a/machine.c
+++ b/machine.c
@@ -1,647 +1,662 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "machine.h"
#include "eon.h"
#define CONFIG_LEGACY
#define MISSING 0xff
#define mmu_device (device_table[0])
extern void eon_init (const char *);
extern void wpc_init (const char *);
struct machine *machine;
unsigned int device_count = 0;
struct hw_device *device_table[MAX_BUS_DEVICES];
struct bus_map busmaps[NUM_BUS_MAPS];
struct bus_map default_busmaps[NUM_BUS_MAPS];
U16 fault_addr;
U8 fault_type;
int system_running = 0;
void cpu_is_running (void)
{
system_running = 1;
}
/**
* Attach a new device to the bus. Only called during init.
*/
struct hw_device *device_attach (struct hw_class *class_ptr, unsigned int size, void *priv)
{
struct hw_device *dev = malloc (sizeof (struct hw_device));
dev->class_ptr = class_ptr;
dev->devid = device_count;
dev->size = size;
dev->priv = priv;
device_table[device_count++] = dev;
/* Attach implies reset */
class_ptr->reset (dev);
return dev;
};
/**
* Map a portion of a device into the CPU's address space.
*/
void bus_map (unsigned int addr,
unsigned int devid,
unsigned long offset,
unsigned int len,
unsigned int flags)
{
struct bus_map *map;
unsigned int start, count;
/* Warn if trying to map too much */
if (addr + len > MAX_CPU_ADDR)
{
fprintf (stderr, "warning: mapping %04X bytes into %04X causes overflow\n",
len, addr);
}
/* Round address and length to be multiples of the map unit size. */
addr = ((addr + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
len = ((len + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
offset = ((offset + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
/* Convert from byte addresses to unit counts */
start = addr / BUS_MAP_SIZE;
count = len / BUS_MAP_SIZE;
/* Initialize the maps. This will let the CPU access the device. */
map = &busmaps[start];
while (count > 0)
{
if (!(map->flags & MAP_FIXED))
{
map->devid = devid;
map->offset = offset;
map->flags = flags;
}
count--;
map++;
offset += BUS_MAP_SIZE;
}
}
void device_define (struct hw_device *dev,
unsigned long offset,
unsigned int addr,
unsigned int len,
unsigned int flags)
{
bus_map (addr, dev->devid, offset, len, flags);
}
void bus_unmap (unsigned int addr, unsigned int len)
{
struct bus_map *map;
unsigned int start, count;
/* Round address and length to be multiples of the map unit size. */
addr = ((addr + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
len = ((len + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
/* Convert from byte addresses to unit counts */
start = addr / BUS_MAP_SIZE;
count = len / BUS_MAP_SIZE;
/* Set the maps to their defaults. */
memcpy (&busmaps[start], &default_busmaps[start],
sizeof (struct bus_map) * count);
}
/**
* Generate a page fault. ADDR says which address was accessed
* incorrectly. TYPE says what kind of violation occurred.
*/
static struct bus_map *find_map (unsigned int addr)
{
return &busmaps[addr / BUS_MAP_SIZE];
}
static struct hw_device *find_device (unsigned int addr, unsigned char id)
{
/* Fault if any invalid device is accessed */
if ((id == INVALID_DEVID) || (id >= device_count))
machine->fault (addr, FAULT_NO_RESPONSE);
return device_table[id];
}
void
print_device_name (unsigned int devno)
{
struct hw_device *dev = device_table[devno];
printf ("%02X", devno);
}
absolute_address_t
absolute_from_reladdr (unsigned int device, unsigned long reladdr)
{
return (device * 0x10000000L) + reladdr;
}
U8 abs_read8 (absolute_address_t addr)
{
unsigned int id = addr >> 28;
unsigned long phy_addr = addr & 0xFFFFFFF;
struct hw_device *dev = device_table[id];
struct hw_class *class_ptr = dev->class_ptr;
return (*class_ptr->read) (dev, phy_addr);
}
/**
* Called by the CPU to read a byte.
+ * This is the bottleneck in terms of performance. Consider
+ * a caching scheme that cuts down on some of this...
+ * Also consider a native 16-bit read that doesn't require
+ * 2 separate calls here...
*/
U8 cpu_read8 (unsigned int addr)
{
struct bus_map *map = find_map (addr);
struct hw_device *dev = find_device (addr, map->devid);
struct hw_class *class_ptr = dev->class_ptr;
unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE;
command_read_hook (absolute_from_reladdr (map->devid, phy_addr));
return (*class_ptr->read) (dev, phy_addr);
}
+U16 cpu_read16 (unsigned int addr)
+{
+ struct bus_map *map = find_map (addr);
+ struct hw_device *dev = find_device (addr, map->devid);
+ struct hw_class *class_ptr = dev->class_ptr;
+ unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE;
+ command_read_hook (absolute_from_reladdr (map->devid, phy_addr));
+ return ((*class_ptr->read) (dev, phy_addr) << 8)
+ | (*class_ptr->read) (dev, phy_addr+1);
+}
+
/**
* Called by the CPU to write a byte.
*/
void cpu_write8 (unsigned int addr, U8 val)
{
struct bus_map *map = find_map (addr);
struct hw_device *dev = find_device (addr, map->devid);
struct hw_class *class_ptr = dev->class_ptr;
unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE;
/* This can fail if the area is read-only */
if (system_running && (map->flags & MAP_READONLY))
machine->fault (addr, FAULT_NOT_WRITABLE);
else
(*class_ptr->write) (dev, phy_addr, val);
command_write_hook (absolute_from_reladdr (map->devid, phy_addr), val);
}
void abs_write8 (absolute_address_t addr, U8 val)
{
unsigned int id = addr >> 28;
unsigned long phy_addr = addr & 0xFFFFFFF;
struct hw_device *dev = device_table[id];
struct hw_class *class_ptr = dev->class_ptr;
class_ptr->write (dev, phy_addr, val);
}
absolute_address_t
to_absolute (unsigned long cpuaddr)
{
struct bus_map *map = find_map (cpuaddr);
struct hw_device *dev = find_device (cpuaddr, map->devid);
unsigned long phy_addr = map->offset + cpuaddr % BUS_MAP_SIZE;
return absolute_from_reladdr (map->devid, phy_addr);
}
void dump_machine (void)
{
unsigned int mapno;
unsigned int n;
for (mapno = 0; mapno < NUM_BUS_MAPS; mapno++)
{
struct bus_map *map = &busmaps[mapno];
printf ("Map %d addr=%04X dev=%d offset=%04X size=%06X\n",
mapno, mapno * BUS_MAP_SIZE, map->devid, map->offset,
0 /* device_table[map->devid]->size */);
#if 0
for (n = 0; n < BUS_MAP_SIZE; n++)
printf ("%02X ", cpu_read8 (mapno * BUS_MAP_SIZE + n));
printf ("\n");
#endif
}
}
/**********************************************************/
void null_reset (struct hw_device *dev)
{
}
U8 null_read (struct hw_device *dev, unsigned long addr)
{
return 0;
}
void null_write (struct hw_device *dev, unsigned long addr, U8 val)
{
}
/**********************************************************/
void ram_reset (struct hw_device *dev)
{
memset (dev->priv, 0, dev->size);
}
U8 ram_read (struct hw_device *dev, unsigned long addr)
{
char *buf = dev->priv;
return buf[addr];
}
void ram_write (struct hw_device *dev, unsigned long addr, U8 val)
{
char *buf = dev->priv;
buf[addr] = val;
}
struct hw_class ram_class =
{
.readonly = 0,
.reset = ram_reset,
.read = ram_read,
.write = ram_write,
};
struct hw_device *ram_create (unsigned long size)
{
void *buf = malloc (size);
return device_attach (&ram_class, size, buf);
}
/**********************************************************/
struct hw_class rom_class =
{
.readonly = 1,
.reset = null_reset,
.read = ram_read,
.write = ram_write,
};
struct hw_device *rom_create (const char *filename, unsigned int maxsize)
{
FILE *fp;
struct hw_device *dev;
unsigned int image_size;
char *buf;
if (filename)
{
fp = file_open (NULL, filename, "rb");
if (!fp)
return NULL;
image_size = sizeof_file (fp);
}
buf = malloc (maxsize);
dev = device_attach (&rom_class, maxsize, buf);
if (filename)
{
fread (buf, image_size, 1, fp);
fclose (fp);
maxsize -= image_size;
while (maxsize > 0)
{
memcpy (buf + image_size, buf, image_size);
buf += image_size;
maxsize -= image_size;
}
}
return dev;
}
/**********************************************************/
U8 console_read (struct hw_device *dev, unsigned long addr)
{
switch (addr)
{
case CON_IN:
return getchar ();
default:
return MISSING;
}
}
void console_write (struct hw_device *dev, unsigned long addr, U8 val)
{
switch (addr)
{
case CON_OUT:
putchar (val);
break;
case CON_EXIT:
sim_exit (val);
break;
default:
break;
}
}
struct hw_class console_class =
{
.readonly = 0,
.reset = null_reset,
.read = console_read,
.write = console_write,
};
struct hw_device *console_create (void)
{
return device_attach (&console_class, BUS_MAP_SIZE, NULL);
}
/**********************************************************/
U8 mmu_regs[MMU_PAGECOUNT][MMU_PAGEREGS];
U8 mmu_read (struct hw_device *dev, unsigned long addr)
{
switch (addr)
{
case 0x60:
return fault_addr >> 8;
case 0x61:
return fault_addr & 0xFF;
case 0x62:
return fault_type;
default:
{
unsigned int page = (addr / MMU_PAGEREGS) % MMU_PAGECOUNT;
unsigned int reg = addr % MMU_PAGEREGS;
U8 val = mmu_regs[page][reg];
//printf ("\n%02X, %02X = %02X\n", page, reg, val);
return val;
}
}
}
void mmu_write (struct hw_device *dev, unsigned long addr, U8 val)
{
unsigned int page = (addr / MMU_PAGEREGS) % MMU_PAGECOUNT;
unsigned int reg = addr % MMU_PAGEREGS;
mmu_regs[page][reg] = val;
bus_map (page * MMU_PAGESIZE,
mmu_regs[page][0],
mmu_regs[page][1] * MMU_PAGESIZE,
MMU_PAGESIZE,
mmu_regs[page][2] & 0x1);
}
void mmu_reset (struct hw_device *dev)
{
unsigned int page;
for (page = 0; page < MMU_PAGECOUNT; page++)
{
mmu_write (dev, page * MMU_PAGEREGS + 0, 0);
mmu_write (dev, page * MMU_PAGEREGS + 1, 0);
mmu_write (dev, page * MMU_PAGEREGS + 2, 0);
}
}
void mmu_reset_complete (struct hw_device *dev)
{
unsigned int page;
const struct bus_map *map;
/* Examine all of the bus_maps in place now, and
sync with the MMU registers. */
for (page = 0; page < MMU_PAGECOUNT; page++)
{
map = &busmaps[4 + page * (MMU_PAGESIZE / BUS_MAP_SIZE)];
mmu_regs[page][0] = map->devid;
mmu_regs[page][1] = map->offset / MMU_PAGESIZE;
mmu_regs[page][2] = map->flags & 0x1;
/* printf ("%02X %02X %02X\n",
map->devid, map->offset / MMU_PAGESIZE,
map->flags); */
}
}
struct hw_class mmu_class =
{
.readonly = 0,
.reset = mmu_reset,
.read = mmu_read,
.write = mmu_write,
};
struct hw_device *mmu_create (void)
{
return device_attach (&mmu_class, BUS_MAP_SIZE, NULL);
}
/**********************************************************/
/* The disk drive is emulated as follows:
* The disk is capable of "bus-mastering" and is able to dump data directly
* into the RAM, without CPU-involvement. (The pages do not even need to
* be mapped.) A transaction is initiated with the following parameters:
*
* - address of RAM, aligned to 512 bytes, must reside in lower 32KB.
* Thus there are 64 possible sector locations.
* - address of disk sector, given as a 16-bit value. This allows for up to
* a 32MB disk.
* - direction, either to disk or from disk.
*
* Emulation is synchronous with respect to the CPU.
*/
struct disk_priv
{
FILE *fp;
struct hw_device *dev;
unsigned long offset;
struct hw_device *ramdev;
unsigned int sectors;
char *ram;
};
U8 disk_read (struct hw_device *dev, unsigned long addr)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
}
void disk_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
switch (addr)
{
case DSK_ADDR:
disk->ram = disk->ramdev->priv + val * SECTOR_SIZE;
break;
case DSK_SECTOR:
disk->offset = val; /* high byte */
break;
case DSK_SECTOR+1:
disk->offset = (disk->offset << 8) | val;
disk->offset *= SECTOR_SIZE;
fseek (disk->fp, disk->offset, SEEK_SET);
break;
case DSK_CTRL:
if (val & DSK_READ)
{
fread (disk->ram, SECTOR_SIZE, 1, disk->fp);
}
else if (val & DSK_WRITE)
{
fwrite (disk->ram, SECTOR_SIZE, 1, disk->fp);
}
else if (val & DSK_ERASE)
{
char empty_sector[SECTOR_SIZE];
memset (empty_sector, 0xff, SECTOR_SIZE);
fwrite (empty_sector, SECTOR_SIZE, 1, disk->fp);
}
if (val & DSK_FLUSH)
{
fflush (disk->fp);
}
break;
}
}
void disk_reset (struct hw_device *dev)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
disk_write (dev, DSK_ADDR, 0);
disk_write (dev, DSK_SECTOR, 0);
disk_write (dev, DSK_SECTOR+1, 0);
disk_write (dev, DSK_CTRL, DSK_FLUSH);
}
void disk_format (struct hw_device *dev)
{
unsigned int sector;
struct disk_priv *disk = (struct disk_priv *)dev->priv;
for (sector = 0; sector < disk->sectors; sector++)
{
disk_write (dev, DSK_SECTOR, sector >> 8);
disk_write (dev, DSK_SECTOR+1, sector & 0xFF);
disk_write (dev, DSK_CTRL, DSK_ERASE);
}
disk_write (dev, DSK_CTRL, DSK_FLUSH);
}
struct hw_class disk_class =
{
.readonly = 0,
.reset = disk_reset,
.read = disk_read,
.write = disk_write,
};
struct hw_device *disk_create (const char *backing_file)
{
struct disk_priv *disk = malloc (sizeof (struct disk_priv));
int newdisk = 0;
disk->fp = file_open (NULL, backing_file, "r+b");
if (disk->fp == NULL)
{
printf ("warning: disk does not exist, creating\n");
disk->fp = file_open (NULL, backing_file, "w+b");
newdisk = 1;
if (disk->fp == NULL)
{
printf ("warning: disk not created\n");
}
}
disk->ram = 0;
disk->ramdev = device_table[1];
disk->dev = device_attach (&disk_class, BUS_MAP_SIZE, disk);
disk->sectors = DISK_SECTOR_COUNT;
if (newdisk)
disk_format (disk->dev);
return disk->dev;
}
/**********************************************************/
int machine_match (const char *machine_name, const char *boot_rom_file, struct machine *m)
{
if (!strcmp (m->name, machine_name))
{
machine = m;
m->init (boot_rom_file);
return 1;
}
return 0;
}
void machine_init (const char *machine_name, const char *boot_rom_file)
{
extern struct machine simple_machine;
extern struct machine eon_machine;
extern struct machine wpc_machine;
memset (busmaps, 0, sizeof (busmaps));
if (machine_match (machine_name, boot_rom_file, &simple_machine));
else if (machine_match (machine_name, boot_rom_file, &eon_machine));
else if (machine_match (machine_name, boot_rom_file, &wpc_machine));
else exit (1);
/* Save the default busmap configuration, before the
CPU begins to run, so that it can be restored if
necessary. */
memcpy (default_busmaps, busmaps, sizeof (busmaps));
if (!strcmp (machine_name, "eon"))
mmu_reset_complete (mmu_device);
}
|
bcd/exec09
|
f15e70c0af03e913e8663ed35a84ac60843e2cb8
|
Change the read/write hooks to return immediately if there are no active breakpoints. This makes things run much faster.
|
diff --git a/command.c b/command.c
index 9c609c7..62de1aa 100644
--- a/command.c
+++ b/command.c
@@ -115,1407 +115,1415 @@ eval_historical (unsigned int id)
void
assign_virtual (const char *name, unsigned long val)
{
unsigned long v_val;
if (!sym_find (&auto_symtab, name, &v_val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)v_val;
virtual (&val, 1);
return;
}
sym_set (&internal_symtab, name, val, 0);
if (!strcmp (name, "thread_current"))
{
printf ("Thread pointer initialized to ");
print_addr (val);
putchar ('\n');
thread_current = val;
}
}
unsigned long
eval_virtual (const char *name)
{
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
if (!sym_find (&auto_symtab, name, &val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)val;
virtual (&val, 0);
}
else if (!sym_find (&internal_symtab, name, &val, 0))
{
}
else
{
return 0;
}
return val;
}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
else
{
absolute_address_t dst = eval_mem (expr);
//printf ("Setting %X to %02X\n", dst, val);
abs_write8 (dst, val);
}
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
case 'o':
case 'a':
case 's':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
char *
match_binary (char *expr, const char *op, char **secondp)
{
char *p;
p = strstr (expr, op);
if (!p)
return NULL;
*p = '\0';
p += strlen (op);
*secondp = p;
return expr;
}
int
fold_comparisons (char *expr, unsigned long *value)
{
char *p;
if (match_binary (expr, "==", &p))
*value = (eval (expr) == eval (p));
else if (match_binary (expr, "!=", &p))
*value = (eval (expr) != eval (p));
else
return 0;
return 1;
}
int
fold_binary (char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
eval_mem (char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
/* TODO - if expr is already in absolute form,
this explodes ! */
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
eval (char *expr)
{
char *p;
unsigned long val;
if (fold_comparisons (expr, &val));
else if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
unsigned int size = 1;
expr++;
if (*expr == '*')
{
expr++;
size = 2;
}
absolute_address_t addr = eval_mem (expr);
return target_read (addr, size);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
br->keep_running = 0;
br->ignore_count = 0;
br->temp = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
void
brkfree_temps (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].used && breaktab[n].temp)
{
brkfree (&breaktab[n]);
}
}
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
if (brkpt->keep_running)
printf (", print-only");
if (brkpt->temp)
printf (", temp");
if (brkpt->ignore_count)
printf (", ignore %d times\n", brkpt->ignore_count);
if (brkpt->write_mask)
printf (", mask %02X\n", brkpt->write_mask);
putchar ('\n');
}
display_t *
display_alloc (void)
{
unsigned int n;
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (!ds->used)
{
ds->used = 1;
return ds;
}
}
}
void
display_free (display_t *ds)
{
}
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
switch (typep->format)
{
case 'a':
print_addr (val);
return;
case 's':
{
absolute_address_t addr = (absolute_address_t)val;
char c;
putchar ('"');
while ((c = abs_read8 (addr++)) != '\0')
putchar (c);
putchar ('"');
return;
}
}
if (typep->format == 'x')
{
printf ("0x");
sprintf (f, "%%0%d%c", typep->size * 2, typep->format);
}
else if (typep->format == 'o')
{
printf ("0");
sprintf (f, "%%%c", typep->format);
}
else
sprintf (f, "%%%c", typep->format);
printf (f, val);
}
void
display_print (void)
{
unsigned int n;
char comma = '\0';
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (ds->used)
{
char expr[256];
strcpy (expr, ds->expr);
printf ("%c %s = ", comma, expr);
print_value (eval (expr), &ds->type);
comma = ',';
}
}
if (comma)
putchar ('\n');
}
int
print_insn (absolute_address_t addr)
{
char buf[64];
int size = dasm (buf, addr);
printf ("%s", buf);
return size;
}
void
do_examine (void)
{
unsigned int n;
unsigned int objs_per_line = 16;
if (isdigit (*command_flags))
examine_repeat = strtoul (command_flags, &command_flags, 0);
if (*command_flags == 'i')
examine_type.format = *command_flags;
else
parse_format_flag (command_flags, &examine_type.format);
parse_size_flag (command_flags, &examine_type.size);
switch (examine_type.format)
{
case 'i':
objs_per_line = 1;
break;
case 'w':
objs_per_line = 8;
break;
}
for (n = 0; n < examine_repeat; n++)
{
if ((n % objs_per_line) == 0)
{
putchar ('\n');
print_addr (examine_addr);
printf (": ");
}
switch (examine_type.format)
{
case 's': /* string */
break;
case 'i': /* instruction */
examine_addr += print_insn (examine_addr);
break;
default:
print_value (target_read (examine_addr, examine_type.size),
&examine_type);
putchar (' ');
- examine_addr += examine_type.size;
+ examine_addr += examine_type.size;
}
}
putchar ('\n');
}
void
do_print (char *expr)
{
unsigned long val = eval (expr);
printf ("$%d = ", history_count);
parse_format_flag (command_flags, &print_type.format);
parse_size_flag (command_flags, &print_type.size);
print_value (val, &print_type);
putchar ('\n');
save_value (val);
}
void
do_set (char *expr)
{
unsigned long val = eval (expr);
save_value (val);
}
#define THREAD_DATA_PC 3
#define THREAD_DATA_ROMBANK 9
void
print_thread_data (absolute_address_t th)
{
U8 b;
U16 w;
absolute_address_t pc;
w = abs_read16 (th + THREAD_DATA_PC);
b = abs_read8 (th + THREAD_DATA_ROMBANK);
printf ("{ PC = %04X, BANK = %02X }", w, b);
}
void
command_change_thread (void)
{
target_addr_t addr = target_read (thread_current, thread_id_size);
absolute_address_t th = to_absolute (addr);
if (th == thread_id)
return;
thread_id = th;
if (machine->dump_thread && eval ("$thread_debug"))
{
if (addr)
{
printf ("[Current thread = ");
print_addr (thread_id);
machine->dump_thread (thread_id);
print_thread_data (thread_id);
printf ("]\n");
}
else
{
printf ("[ No thread ]\n");
}
}
}
void
command_stack_push (unsigned int reason)
{
cmdqueue_t *q = &command_stack[++command_stack_depth];
}
void
command_stack_pop (void)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
--command_stack_depth;
}
void
command_stack_add (const char *cmd)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
}
char *
getarg (void)
{
return strtok (NULL, " \t\n");
}
/****************** Command Handlers ************************/
void cmd_print (void)
{
char *arg = getarg ();
if (arg)
do_print (arg);
else
do_print ("$");
}
void cmd_set (void)
{
char *arg = getarg ();
if (arg)
do_set (arg);
else
do_set ("$");
}
void cmd_examine (void)
{
char *arg = getarg ();
if (arg)
examine_addr = eval_mem (arg);
do_examine ();
}
void cmd_break (void)
{
char *arg = getarg ();
if (!arg)
return;
unsigned long val = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = val;
br->on_execute = 1;
arg = getarg ();
if (!arg);
else if (!strcmp (arg, "if"))
{
br->conditional = 1;
arg = getarg ();
strcpy (br->condition, arg);
}
else if (!strcmp (arg, "ignore"))
{
br->ignore_count = atoi (getarg ());
}
brkprint (br);
}
void cmd_watch1 (int on_read, int on_write)
{
char *arg;
arg = getarg ();
if (!arg)
return;
absolute_address_t addr = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = addr;
br->on_read = on_read;
br->on_write = on_write;
for (;;)
{
arg = getarg ();
if (!arg)
return;
if (!strcmp (arg, "print"))
br->keep_running = 1;
else if (!strcmp (arg, "mask"))
{
arg = getarg ();
br->write_mask = strtoul (arg, NULL, 0);
}
else if (!strcmp (arg, "if"))
{
arg = getarg ();
br->conditional = 1;
strcpy (br->condition, arg);
}
}
brkprint (br);
}
void cmd_watch (void)
{
cmd_watch1 (0, 1);
}
void cmd_rwatch (void)
{
cmd_watch1 (1, 0);
}
void cmd_awatch (void)
{
cmd_watch1 (1, 1);
}
void cmd_break_list (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
brkprint (&breaktab[n]);
}
void cmd_step (void)
{
auto_break_insn_count = 1;
exit_command_loop = 0;
}
void cmd_next (void)
{
char buf[128];
breakpoint_t *br;
unsigned long addr = to_absolute (get_pc ());
addr += dasm (buf, addr);
br = brkalloc ();
br->addr = addr;
br->on_execute = 1;
br->temp = 1;
/* TODO - for conditional branches, should also set a
temp breakpoint at the branch target */
exit_command_loop = 0;
}
void cmd_continue (void)
{
exit_command_loop = 0;
}
void cmd_quit (void)
{
cpu_quit = 0;
exit_command_loop = 1;
}
void cmd_delete (void)
{
const char *arg = getarg ();
unsigned int id;
if (!arg)
{
int n;
printf ("Deleting all breakpoints.\n");
for (id = 0; id < MAX_BREAKS; id++)
{
breakpoint_t *br = brkfind_by_id (id);
brkfree (br);
}
return;
}
id = atoi (arg);
breakpoint_t *br = brkfind_by_id (id);
if (br->used)
{
printf ("Deleting breakpoint %d\n", id);
brkfree (br);
}
}
void cmd_list (void)
{
char *arg;
static absolute_address_t lastpc = 0;
static absolute_address_t lastaddr = 0;
absolute_address_t addr;
int n;
arg = getarg ();
if (arg)
addr = eval_mem (arg);
else
{
addr = to_absolute (get_pc ());
if (addr == lastpc)
addr = lastaddr;
else
lastaddr = lastpc = addr;
}
for (n = 0; n < 10; n++)
{
print_addr (addr);
printf (" : ");
addr += print_insn (addr);
putchar ('\n');
}
lastaddr = addr;
}
void cmd_symbol_file (void)
{
char *arg = getarg ();
if (arg)
load_map_file (arg);
}
void cmd_display (void)
{
char *arg;
while ((arg = getarg ()) != NULL)
{
display_t *ds = display_alloc ();
strcpy (ds->expr, arg);
ds->type = print_type;
parse_format_flag (command_flags, &ds->type.format);
parse_size_flag (command_flags, &ds->type.size);
}
}
int command_exec_file (const char *filename)
{
FILE *infile;
extern int command_exec (FILE *);
infile = file_open (NULL, filename, "r");
if (!infile)
return 0;
command_input = infile;
return 1;
}
void cmd_source (void)
{
char *arg = getarg ();
if (!arg)
return;
if (command_exec_file (arg) == 0)
fprintf (stderr, "can't open %s\n", arg);
}
void cmd_regs (void)
{
}
void cmd_vars (void)
{
for_each_var (NULL);
}
void cmd_runfor (void)
{
char *arg = getarg ();
int secs = atoi (arg);
stop_after_ms = secs * 1000;
}
void cmd_measure (void)
{
absolute_address_t addr;
target_addr_t retaddr = get_pc ();
breakpoint_t *br;
/* Get the address of the function to be measured. */
char *arg = getarg ();
if (!arg)
return;
addr = eval_mem (arg);
printf ("Measuring ");
print_addr (addr);
printf (" back to ");
print_addr (to_absolute (retaddr));
putchar ('\n');
/* Push the current PC onto the stack for the
duration of the measurement. */
set_s (get_s () - 2);
write16 (get_s (), retaddr);
/* Set a temp breakpoint at the current PC, so that
the measurement will halt. */
br = brkalloc ();
br->addr = to_absolute (retaddr);
br->on_execute = 1;
br->temp = 1;
/* Interrupts must be disabled for this to work ! */
set_cc (get_cc () | 0x50);
/* Change the PC to the function-under-test. */
set_pc (addr);
/* Go! */
exit_command_loop = 0;
}
void cmd_dump (void)
{
extern int dump_every_insn;
char *arg = getarg ();
if (arg)
dump_every_insn = strtoul (arg, NULL, 0);
printf ("Instruction dump is %s\n",
dump_every_insn ? "on" : "off");
}
void
cmd_trace_dump (void)
{
unsigned int off = (trace_offset + 1) % MAX_TRACE;
do {
target_addr_t pc = trace_buffer[off];
absolute_address_t addr = to_absolute (pc);
//const char *name = sym_lookup (&program_symtab, addr);
//printf ("%04X ", pc);
print_addr (addr);
putchar (':');
print_insn (addr);
putchar ('\n');
//putchar (name ? '\n' : ' ');
off = (off + 1) % MAX_TRACE;
} while (off != trace_offset);
fflush (stdout);
}
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
{ "s", "step", cmd_step,
"Step one instruction" },
{ "n", "next", cmd_next,
"Break at the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
{ "wa", "watch", cmd_watch,
"Add a watchpoint on write" },
{ "rwa", "rwatch", cmd_rwatch,
"Add a watchpoint on read" },
{ "awa", "awatch", cmd_awatch,
"Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
{ "l", "list", cmd_list },
{ "sym", "symbol-file", cmd_symbol_file,
"Open a symbol table file" },
{ "di", "display", cmd_display,
"Add a display expression" },
{ "so", "source", cmd_source,
"Run a command script" },
{ "regs", "regs", cmd_regs,
"Show all CPU registers" },
{ "vars", "vars", cmd_vars,
"Show all program variables" },
{ "runfor", "runfor", cmd_runfor,
"Run for a certain amount of time" },
{ "me", "measure", cmd_measure,
"Measure time that a function takes" },
{ "dump", "dump", cmd_dump,
"Set dump-instruction flag" },
{ "td", "tracedump", cmd_trace_dump,
"Dump the trace buffer" },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
{ "f", "file", cmd_file,
"Choose the program to be debugged" },
{ "exe", "exec-file", cmd_exec_file,
"Open an executable" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
/* TODO - look for a match anywhere between
* the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
void
print_current_insn (void)
{
absolute_address_t addr = to_absolute (get_pc ());
print_addr (addr);
printf (" : ");
print_insn (addr);
putchar ('\n');
}
int
command_exec (FILE *infile)
{
char buffer[256];
static char prev_buffer[256];
char *cmd;
command_handler_t handler;
int rc;
do {
errno = 0;
fgets (buffer, 255, infile);
if (feof (infile))
return -1;
} while (errno != 0);
/* In terminal mode, a blank line means to execute
the previous command. */
if (buffer[0] == '\n')
strcpy (buffer, prev_buffer);
/* Skip comments */
if (*buffer == '#')
return 0;
cmd = strtok (buffer, " \t\n");
if (!cmd)
return 0;
strcpy (prev_buffer, cmd);
handler = command_lookup (cmd);
if (!handler)
{
syntax_error ("no such command");
return 0;
}
(*handler) ();
return 0;
}
void
keybuffering (int flag)
{
struct termios tio;
tcgetattr (0, &tio);
if (!flag) /* 0 = no buffering = not default */
tio.c_lflag &= ~ICANON;
else /* 1 = buffering = default */
tio.c_lflag |= ICANON;
tcsetattr (0, TCSANOW, &tio);
}
int
command_loop (void)
{
keybuffering (1);
brkfree_temps ();
restart:
if (command_input == stdin)
{
display_print ();
print_current_insn ();
}
exit_command_loop = -1;
while (exit_command_loop < 0)
{
if (command_input == stdin)
command_prompt ();
if (command_exec (command_input) < 0)
break;
}
if (exit_command_loop == 0)
keybuffering (0);
if (feof (command_input) && command_input != stdin)
{
fclose (command_input);
command_input = stdin;
goto restart;
}
return (exit_command_loop);
}
void
breakpoint_hit (breakpoint_t *br)
{
if (br->threaded && (thread_id != br->tid))
return;
if (br->conditional)
{
if (eval (br->condition) == 0)
return;
}
if (br->ignore_count)
{
--br->ignore_count;
return;
}
monitor_on = !br->keep_running;
}
void
command_trace_insn (target_addr_t addr)
{
trace_buffer[trace_offset++] = addr;
trace_offset %= MAX_TRACE;
}
void
command_insn_hook (void)
{
target_addr_t pc;
absolute_address_t abspc;
breakpoint_t *br;
pc = get_pc ();
command_trace_insn (pc);
if (active_break_count == 0)
return;
abspc = to_absolute (pc);
br = brkfind_by_addr (abspc);
if (br && br->enabled && br->on_execute)
{
breakpoint_hit (br);
if (monitor_on == 0)
return;
if (br->temp)
brkfree (br);
else
printf ("Breakpoint %d reached.\n", br->id);
}
}
void
command_read_hook (absolute_address_t addr)
{
- breakpoint_t *br = brkfind_by_addr (addr);
+ breakpoint_t *br;
+
+ if (active_break_count == 0)
+ return;
+
+ br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_read)
{
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf ("]\n");
breakpoint_hit (br);
}
}
void
command_write_hook (absolute_address_t addr, U8 val)
{
breakpoint_t *br;
-
- br = brkfind_by_addr (addr);
- if (br && br->enabled && br->on_write)
+
+ if (active_break_count != 0)
{
- if (br->write_mask)
+ br = brkfind_by_addr (addr);
+ if (br && br->enabled && br->on_write)
{
- int mask_ok = ((br->last_write & br->write_mask) !=
- (val & br->write_mask));
-
- br->last_write = val;
- if (!mask_ok)
+ if (br->write_mask)
+ {
+ int mask_ok = ((br->last_write & br->write_mask) !=
+ (val & br->write_mask));
+
+ br->last_write = val;
+ if (!mask_ok)
+ return;
+ }
+
+ breakpoint_hit (br);
+ if (monitor_on == 0)
return;
+ printf ("Watchpoint %d triggered. [", br->id);
+ print_addr (addr);
+ printf (" = 0x%02X", val);
+ printf ("]\n");
}
-
- breakpoint_hit (br);
- if (monitor_on == 0)
- return;
- printf ("Watchpoint %d triggered. [", br->id);
- print_addr (addr);
- printf (" = 0x%02X", val);
- printf ("]\n");
}
if (thread_id_size && (addr == thread_current + thread_id_size - 1))
{
command_change_thread ();
}
}
void
command_periodic (void)
{
if (stop_after_ms)
{
stop_after_ms -= 100;
if (stop_after_ms <= 0)
{
monitor_on = 1;
stop_after_ms = 0;
printf ("Stopping after time elapsed.\n");
}
}
}
void pc_virtual (unsigned long *val, int writep) {
writep ? set_pc (*val) : (*val = get_pc ());
}
void x_virtual (unsigned long *val, int writep) {
writep ? set_x (*val) : (*val = get_x ());
}
void y_virtual (unsigned long *val, int writep) {
writep ? set_y (*val) : (*val = get_y ());
}
void u_virtual (unsigned long *val, int writep) {
writep ? set_u (*val) : (*val = get_u ());
}
void s_virtual (unsigned long *val, int writep) {
writep ? set_s (*val) : (*val = get_s ());
}
void d_virtual (unsigned long *val, int writep) {
writep ? set_d (*val) : (*val = get_d ());
}
void a_virtual (unsigned long *val, int writep) {
writep ? set_a (*val) : (*val = get_a ());
}
void b_virtual (unsigned long *val, int writep) {
writep ? set_b (*val) : (*val = get_b ());
}
void dp_virtual (unsigned long *val, int writep) {
writep ? set_dp (*val) : (*val = get_dp ());
}
void cc_virtual (unsigned long *val, int writep) {
writep ? set_cc (*val) : (*val = get_cc ());
}
void irq_load_virtual (unsigned long *val, int writep) {
if (!writep)
*val = irq_cycles / IRQ_CYCLE_COUNTS;
}
void cycles_virtual (unsigned long *val, int writep)
{
if (!writep)
*val = get_cycles ();
}
void et_virtual (unsigned long *val, int writep)
{
static unsigned long last_cycles = 0;
if (!writep)
*val = get_cycles () - last_cycles;
last_cycles = get_cycles ();
}
void
command_exit_irq_hook (unsigned long cycles)
{
irq_cycles -= irq_cycle_tab[irq_cycle_entry];
irq_cycles += cycles;
irq_cycle_tab[irq_cycle_entry] = cycles;
irq_cycle_entry = (irq_cycle_entry + 1) % IRQ_CYCLE_COUNTS;
//printf ("IRQ took %lu cycles\n", cycles);
//printf ("Average = %d\n", irq_cycles / IRQ_CYCLE_COUNTS);
}
void
command_init (void)
{
int rc;
sym_add (&auto_symtab, "pc", (unsigned long)pc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "x", (unsigned long)x_virtual, SYM_AUTO);
sym_add (&auto_symtab, "y", (unsigned long)y_virtual, SYM_AUTO);
sym_add (&auto_symtab, "u", (unsigned long)u_virtual, SYM_AUTO);
sym_add (&auto_symtab, "s", (unsigned long)s_virtual, SYM_AUTO);
sym_add (&auto_symtab, "d", (unsigned long)d_virtual, SYM_AUTO);
sym_add (&auto_symtab, "a", (unsigned long)a_virtual, SYM_AUTO);
sym_add (&auto_symtab, "b", (unsigned long)b_virtual, SYM_AUTO);
sym_add (&auto_symtab, "dp", (unsigned long)dp_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cc", (unsigned long)cc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cycles", (unsigned long)cycles_virtual, SYM_AUTO);
sym_add (&auto_symtab, "et", (unsigned long)et_virtual, SYM_AUTO);
sym_add (&auto_symtab, "irqload", (unsigned long)irq_load_virtual, SYM_AUTO);
examine_type.format = 'x';
examine_type.size = 1;
print_type.format = 'x';
print_type.size = 1;
(void)command_exec_file (".dbinit");
}
/* vim: set ts=3: */
/* vim: set expandtab: */
|
bcd/exec09
|
d4a28b85dc0b7796fe57d77c2ffa5aaffdfb1fa4
|
Throw FIRQ every 8ms now.
|
diff --git a/main.c b/main.c
index 2415577..cf95380 100644
--- a/main.c
+++ b/main.c
@@ -1,400 +1,407 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/time.h>
#include "6809.h"
enum
{ HEX, S19, BIN };
/* The total number of cycles that have executed */
unsigned long total = 0;
/* The frequency of the emulated CPU, in megahertz */
unsigned int mhz = 1;
/* When nonzero, indicates that the IRQ should be triggered periodically,
every so many cycles. By default no periodic IRQ is generated. */
unsigned int cycles_per_irq = 0;
/* When nonzero, indicates that the FIRQ should be triggered periodically,
every so many cycles. By default no periodic FIRQ is generated. */
unsigned int cycles_per_firq = 0;
/* Nonzero if debugging support is turned on */
int debug_enabled = 0;
/* Nonzero if tracing is enabled */
int trace_enabled = 0;
/* When nonzero, causes the program to print the total number of cycles
on a successful exit. */
int dump_cycles_on_success = 0;
/* When nonzero, indicates the total number of cycles before an automated
exit. This is to help speed through test cases that never finish. */
int max_cycles = 100000000;
static int type = S19;
char *exename;
const char *machine_name = "simple";
const char *prog_name = NULL;
static void usage (void)
{
printf ("Usage: %s <options> filename\n", exename);
printf ("Options are:\n");
printf ("-hex - load intel hex file\n");
printf ("-s19 - load motorola s record file\n");
printf ("-bin - load binary file\n");
printf ("-s addr - specify binary load address hexadecimal (default 0)\n");
printf ("default format is motorola s record\n");
exit (1);
}
void
idle_loop (void)
{
struct timeval now;
static struct timeval last = { 0, 0 };
int real_ms;
static unsigned long last_cycles = 0;
unsigned long cycles;
int sim_ms;
const int cycles_per_ms = 2000;
static int period = 100;
static int count = 100;
int delay;
static int total_ms_elapsed = 0;
if (--count > 0)
return;
if (last.tv_usec == 0)
gettimeofday (&last, NULL);
gettimeofday (&now, NULL);
real_ms = (now.tv_usec - last.tv_usec) / 1000;
if (real_ms < 0)
real_ms += 1000;
last = now;
cycles = get_cycles ();
sim_ms = (cycles - last_cycles) / cycles_per_ms;
if (sim_ms < 0)
sim_ms += cycles_per_ms;
last_cycles = cycles;
total_ms_elapsed += sim_ms;
if (total_ms_elapsed > 100)
{
total_ms_elapsed -= 100;
wpc_periodic ();
command_periodic ();
}
delay = sim_ms - real_ms;
if (delay > 0)
{
if (delay > 60)
period -= 5;
else if (delay < 20)
period += 5;
usleep (delay * 1000UL);
}
count = period;
}
int do_help (const char *arg __attribute__((unused)));
#define NO_NEG 0
#define HAS_NEG 1
#define NO_ARG 0
#define HAS_ARG 1
struct option
{
char o_short;
const char *o_long;
const char *help;
unsigned int can_negate : 1;
unsigned int takes_arg : 1;
int *int_value;
int default_value;
const char **string_value;
int (*handler) (const char *arg);
} option_table[] = {
{ 'd', "debug", "Enter the monitor immediately",
HAS_NEG, NO_ARG, &debug_enabled, 1, NULL, NULL },
{ 'h', "help", NULL,
NO_NEG, NO_ARG, NULL, NULL, 0, do_help },
{ 'b', "binary", "",
NO_NEG, NO_ARG, &type, BIN, NULL, NULL },
{ 'M', "mhz", "", NO_NEG, HAS_ARG },
{ '-', "68a09", "Emulate the 68A09 variation (1.5Mhz)" },
{ '-', "68b09", "Emulate the 68B09 variation (2Mhz)" },
{ 'R', "realtime", "Limit simulation speed to match realtime" },
{ 'I', "irqfreq", "Asserts an IRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_irq, 0, NULL, NULL },
{ 'F', "firqfreq", "Asserts an FIRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_firq, 0, NULL, NULL },
{ 'C', "cycledump", "",
HAS_NEG, NO_ARG, &dump_cycles_on_success, 1, NULL, NULL},
{ 't', "loadmap", "" },
{ 'T', "trace", "",
NO_NEG, NO_ARG, &trace_enabled, 1, NULL, NULL },
{ 'm', "maxcycles", "Sets maximum number of cycles to run",
NO_NEG, HAS_ARG, &max_cycles, 0, NULL, NULL },
{ 's', "machine", "Specify the machine (exact hardware) to emulate",
NO_NEG, HAS_ARG, NULL, 0, &machine_name, NULL },
{ '\0', NULL },
};
int
do_help (const char *arg __attribute__((unused)))
{
struct option *opt = option_table;
while (opt->o_long != NULL)
{
if (opt->help)
{
printf ("-%c,--%s %s\n",
opt->o_short, opt->o_long, opt->help);
}
opt++;
}
return -1;
}
/**
* Returns positive if an argument was taken.
* Returns zero if no argument was taken.
* Returns negative on error.
*/
int
process_option (struct option *opt, const char *arg)
{
int rc;
//printf ("Processing option '%s'\n", opt->o_long);
if (opt->takes_arg)
{
if (!arg)
{
//printf (" Takes argument but none given.\n");
rc = 0;
}
else
{
if (opt->int_value)
{
*(opt->int_value) = strtoul (arg, NULL, 0);
//printf (" Integer argument '%d' taken.\n", *(opt->int_value));
}
else if (opt->string_value)
{
*(opt->string_value) = arg;
//printf (" String argument '%s' taken.\n", *(opt->string_value));
}
rc = 1;
}
}
else
{
if (arg)
//printf (" Takes no argument but one given, ignored.\n");
if (opt->int_value)
{
*(opt->int_value) = opt->default_value;
//printf (" Integer argument 1 implied.\n");
}
rc = 0;
}
if (opt->handler)
{
rc = opt->handler (arg);
//printf (" Handler called, rc=%d\n", rc);
}
if (rc < 0)
exit (0);
return rc;
}
int
process_plain_argument (const char *arg)
{
//printf ("plain argument '%s'\n", arg);
if (!prog_name)
prog_name = arg;
}
int
parse_args (int argc, char *argv[])
{
int argn = 1;
struct option *opt;
next_arg:
while (argn < argc)
{
char *arg = argv[argn];
if (arg[0] == '-')
{
if (arg[1] == '-')
{
char *rest = strchr (arg+2, '=');
if (rest)
*rest++ = '\0';
opt = option_table;
while (opt->o_long != NULL)
{
if (!strcmp (opt->o_long, arg+2))
{
argn++;
(void)process_option (opt, rest);
goto next_arg;
}
opt++;
}
printf ("long option '%s' not recognized.\n", arg+2);
}
else
{
opt = option_table;
while (opt->o_long != NULL)
{
if (opt->o_short == arg[1])
{
argn++;
if (process_option (opt, argv[argn]))
argn++;
goto next_arg;
}
opt++;
}
printf ("short option '%c' not recognized.\n", arg[1]);
}
argn++;
}
else
{
process_plain_argument (argv[argn++]);
}
}
}
int
main (int argc, char *argv[])
{
int off = 0;
int i, j, n;
int argn = 1;
unsigned int loops = 0;
exename = argv[0];
/* TODO - enable different options by default
based on the executable name. */
parse_args (argc, argv);
sym_init ();
switch (type)
{
case HEX:
if (prog_name && load_hex (prog_name))
usage ();
break;
case S19:
machine_init (machine_name, NULL);
if (prog_name && load_s19 (prog_name))
usage ();
break;
default:
machine_init (machine_name, prog_name);
break;
}
/* Try to load a map file */
if (prog_name)
load_map_file (prog_name);
/* Enable debugging if no executable given yet. */
if (!prog_name)
debug_enabled = 1;
else
/* OK, ready to run. Reset the CPU first. */
cpu_reset ();
monitor_init ();
command_init ();
keybuffering (0);
/* Now, iterate through the instructions.
* If no IRQs or FIRQs are enabled, we can just call cpu_execute()
* and let it run for a long time; otherwise, we need to come back
* here periodically and do the interrupt handling. */
for (cpu_quit = 1; cpu_quit != 0;)
{
if ((cycles_per_irq == 0) && (cycles_per_firq == 0))
{
total += cpu_execute (max_cycles ? max_cycles-1 : 500000);
}
else
{
total += cpu_execute (cycles_per_irq);
request_irq (0);
- /* TODO - FIRQ not handled yet */
- request_firq (0);
+ {
+ /* TODO - FIRQ frequency not handled yet */
+ static int firq_freq = 0;
+ if (++firq_freq == 8)
+ {
+ request_firq (0);
+ firq_freq = 0;
+ }
+ }
}
idle_loop ();
/* Check for a rogue program that won't end */
if ((max_cycles > 0) && (total > max_cycles))
{
sim_error ("maximum cycle count exceeded at %s\n",
monitor_addr_name (get_pc ()));
}
}
printf ("m6809-run stopped after %d cycles\n", total);
return 0;
}
|
bcd/exec09
|
eabd3c1c5bb6f2ad27e1c919f8d1bbb74579a4b8
|
Remove hack from WPC DMD update.
|
diff --git a/wpc.c b/wpc.c
index 1a6eda7..13cdebb 100644
--- a/wpc.c
+++ b/wpc.c
@@ -1,643 +1,640 @@
/*
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include <sys/time.h>
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3c00
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
struct hw_device *dmd_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
U8 opto_mx[8];
U8 dmd_maps[2];
U8 dmd_active_page;
int curr_sw;
int curr_sw_time;
int wdog_timer;
};
struct wpc_asic *global_wpc;
void wpc_asic_reset (struct hw_device *dev)
{
struct wpc_asic *wpc = dev->priv;
global_wpc = wpc;
wpc->curr_sw_time = 0;
wpc->wdog_timer = 0;
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
#if 1
return rc;
#endif
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
rc |= WPC_DEBUG_READ_READY;
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
unsigned int wpc_read_switch (struct wpc_asic *wpc, int num)
{
unsigned int val;
val = wpc->switch_mx[num / 8] & (1 << (num % 8));
return val ? 1 : 0;
}
void wpc_write_switch (struct wpc_asic *wpc, int num, int flag)
{
unsigned int col, val;
col = num / 8;
val = 1 << (num % 8);
if (wpc->opto_mx[col] & val)
flag = !flag;
wpc->switch_mx[col] &= ~val;
if (flag)
wpc->switch_mx[col] |= val;
}
void wpc_press_switch (struct wpc_asic *wpc, int num, int delay)
{
wpc_write_switch (wpc, num, 1);
wpc->curr_sw = num;
wpc->curr_sw_time = delay;
}
unsigned int wpc_read_switch_column (struct wpc_asic *wpc, int col)
{
unsigned int val = 0;
int row;
for (row = 0; row < 8; row++)
if (wpc_read_switch (wpc, col * 8 + row))
val |= (1 << row);
return val;
}
void wpc_write_lamp (int num, int flag)
{
}
void wpc_write_sol (int num, int flag)
{
}
void wpc_print_display (struct wpc_asic *wpc)
{
FILE *fp;
char *p = wpc->dmd_dev->priv + wpc->dmd_active_page * 512;
- if (wpc->dmd_active_page >= 14)
- return;
-
fp = fopen ("dmd", "wb");
if (!fp)
{
fprintf (stderr, "could not write to DMD!!!\n");
return;
}
fwrite (p, 512, 1, fp);
fclose (fp);
}
void wpc_keypoll (struct wpc_asic *wpc)
{
fd_set fds;
struct timeval timeout;
int rc;
unsigned char c;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
{
rc = read (0, &c, 1);
switch (c)
{
case '7':
wpc_press_switch (wpc, 4, 200);
break;
case '8':
wpc_press_switch (wpc, 5, 200);
break;
case '9':
wpc_press_switch (wpc, 6, 200);
break;
case '0':
wpc_press_switch (wpc, 7, 200);
break;
case 'd':
wpc_print_display (wpc);
break;
default:
break;
}
}
}
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
struct wpc_asic *wpc = dev->priv;
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit / 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
case WPC_SW_ROW_INPUT:
val = wpc_read_switch_column (wpc, 1 + scanbit (wpc->switch_strobe));
break;
case WPC_SW_JUMPER_INPUT:
val = 0x55;
break;
case WPC_SW_CABINET_INPUT:
val = wpc_read_switch_column (wpc, 0);
break;
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (struct wpc_asic *wpc)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_set_rom_page (unsigned char val)
{
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
}
void wpc_set_dmd_page (struct wpc_asic *wpc, unsigned int map, unsigned char val)
{
wpc->dmd_maps[map] = val;
bus_map (0x3800 + map * 0x200, 3, val * 0x200, 0x200, MAP_READWRITE);
}
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct wpc_asic *wpc = dev->priv;
switch (addr + WPC_ASIC_BASE)
{
case WPC_DMD_LOW_PAGE:
wpc_set_dmd_page (wpc, 0, val);
break;
case WPC_DMD_HIGH_PAGE:
wpc_set_dmd_page (wpc, 1, val);
break;
case WPC_DMD_FIRQ_ROW_VALUE:
break;
case WPC_DMD_ACTIVE_PAGE:
wpc->dmd_active_page = val;
wpc_print_display (wpc);
break;
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
wpc->wdog_timer++;
break;
case WPC_ROM_BANK:
wpc->rombank = val;
wpc_set_rom_page (val);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram (wpc);
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram (wpc);
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
case WPC_SW_COL_STROBE:
wpc->switch_strobe = val;
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
struct wpc_asic *wpc = global_wpc;
wpc_keypoll (wpc);
wpc->wdog_timer -= 50;
if (wpc->wdog_timer <= 0)
{
}
if (wpc->curr_sw_time > 0)
{
wpc->curr_sw_time -= 100;
if (wpc->curr_sw_time <= 0)
{
wpc->curr_sw_time = 0;
wpc_write_switch (wpc, wpc->curr_sw, 0);
}
}
}
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
struct wpc_asic *wpc = calloc (sizeof (struct wpc_asic), 1);
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
void io_sym_add (const char *name, unsigned long cpuaddr)
{
sym_add (&program_symtab, name, to_absolute (cpuaddr), 0);
}
#define IO_SYM_ADD(name) io_sym_add (#name, name)
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
struct wpc_asic *wpc;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
wpc = dev->priv;
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
device_define ( dev = ram_create (16 * 512), 0,
0x3800, 0x200 * 2, MAP_READWRITE );
wpc->dmd_dev = dev;
wpc_update_ram (wpc);
IO_SYM_ADD(WPC_DMD_LOW_BASE);
IO_SYM_ADD(WPC_DMD_HIGH_BASE);
IO_SYM_ADD(WPC_DMD_HIGH_PAGE);
IO_SYM_ADD(WPC_DMD_FIRQ_ROW_VALUE);
IO_SYM_ADD(WPC_DMD_LOW_PAGE);
IO_SYM_ADD(WPC_DMD_ACTIVE_PAGE);
IO_SYM_ADD(WPC_SERIAL_STATUS_PORT);
IO_SYM_ADD(WPC_PARALLEL_DATA_PORT);
IO_SYM_ADD(WPC_PARALLEL_STROBE_PORT);
IO_SYM_ADD(WPC_SERIAL_DATA_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_CONTROL_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_BAUD_SELECT);
IO_SYM_ADD(WPC_TICKET_DISPENSE);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_OUT);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_IN);
IO_SYM_ADD(WPC_DCS_SOUND_RESET);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_READY);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_A);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_B);
IO_SYM_ADD(WPCS_DATA);
IO_SYM_ADD(WPCS_CONTROL_STATUS);
IO_SYM_ADD(WPC_SOL_FLASH2_OUTPUT);
IO_SYM_ADD(WPC_SOL_HIGHPOWER_OUTPUT);
IO_SYM_ADD(WPC_SOL_FLASH1_OUTPUT);
IO_SYM_ADD(WPC_SOL_LOWPOWER_OUTPUT);
IO_SYM_ADD(WPC_LAMP_ROW_OUTPUT);
IO_SYM_ADD(WPC_LAMP_COL_STROBE);
IO_SYM_ADD(WPC_GI_TRIAC);
IO_SYM_ADD(WPC_SW_JUMPER_INPUT);
IO_SYM_ADD(WPC_SW_CABINET_INPUT);
IO_SYM_ADD(WPC_SW_ROW_INPUT);
IO_SYM_ADD(WPC_SW_COL_STROBE);
IO_SYM_ADD(WPC_LEDS);
IO_SYM_ADD(WPC_RAM_BANK);
IO_SYM_ADD(WPC_SHIFTADDR);
IO_SYM_ADD(WPC_SHIFTBIT);
IO_SYM_ADD(WPC_SHIFTBIT2);
IO_SYM_ADD(WPC_PERIPHERAL_TIMER_FIRQ_CLEAR);
IO_SYM_ADD(WPC_ROM_LOCK);
IO_SYM_ADD(WPC_CLK_HOURS_DAYS);
IO_SYM_ADD(WPC_CLK_MINS);
IO_SYM_ADD(WPC_ROM_BANK);
IO_SYM_ADD(WPC_RAM_LOCK);
IO_SYM_ADD(WPC_RAM_LOCKSIZE);
}
struct machine wpc_machine =
{
.name = "wpc",
.fault = wpc_fault,
.init = wpc_init,
};
|
bcd/exec09
|
51b85edef9072da1aa67c746fe28439c273f1a21
|
CHange check_break() not to take a parameter.
|
diff --git a/6809.c b/6809.c
index d5abb98..2ee7e27 100644
--- a/6809.c
+++ b/6809.c
@@ -1223,1025 +1223,1025 @@ pshs (void)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
}
}
static void
pshu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x80)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, PC & 0xffff);
}
if (post & 0x40)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, S);
}
if (post & 0x20)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, Y);
}
if (post & 0x10)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, get_cc ());
}
}
static void
puls (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
}
static void
pulu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (U));
U = (U + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (U) << 8;
U = (U + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
S = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (U);
check_pc ();
U = (U + 2) & 0xffff;
}
}
/* Miscellaneous Instructions */
static void
nop (void)
{
cpu_clk -= 2;
}
static void
jsr (void)
{
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
change_pc (ea);
monitor_call (0);
}
static void
rti (void)
{
monitor_return ();
cpu_clk -= 6;
command_exit_irq_hook (get_cycles () - irq_start_time);
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
if ((EFI & E_FLAG) != 0)
{
cpu_clk -= 9;
A = read_stack (S);
S = (S + 1) & 0xffff;
B = read_stack (S);
S = (S + 1) & 0xffff;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
static void
rts (void)
{
monitor_return ();
cpu_clk -= 5;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
void
irq (void)
{
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= I_FLAG;
irq_start_time = get_cycles ();
change_pc (read16 (0xfff8));
#if 1
irqs_pending = 0;
#endif
}
void
firq (void)
{
EFI &= ~E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
change_pc (read16 (0xfff6));
#if 1
firqs_pending = 0;
#endif
}
void
swi (void)
{
cpu_clk -= 19;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
change_pc (read16 (0xfffa));
}
void
swi2 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff4));
}
void
swi3 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff2));
}
void
cwai (void)
{
puts ("CWAI - not supported yet!");
exit (100);
}
void
sync (void)
{
puts ("SYNC - not supported yet!");
exit (100);
cpu_clk -= 4;
}
static void
orcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () | tmp);
cpu_clk -= 3;
}
static void
andcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () & tmp);
cpu_clk -= 3;
}
/* Branch Instructions */
#define cond_HI() ((Z != 0) && (C == 0))
#define cond_LS() ((Z == 0) || (C != 0))
#define cond_HS() (C == 0)
#define cond_LO() (C != 0)
#define cond_NE() (Z != 0)
#define cond_EQ() (Z == 0)
#define cond_VC() ((OV & 0x80) == 0)
#define cond_VS() ((OV & 0x80) != 0)
#define cond_PL() ((N & 0x80) == 0)
#define cond_MI() ((N & 0x80) != 0)
#define cond_GE() (((N^OV) & 0x80) == 0)
#define cond_LT() (((N^OV) & 0x80) != 0)
#define cond_GT() ((((N^OV) & 0x80) == 0) && (Z != 0))
#define cond_LE() ((((N^OV) & 0x80) != 0) || (Z == 0))
static void
bra (void)
{
INT8 tmp = (INT8) imm_byte ();
change_pc (PC + tmp);
}
static void
branch (unsigned cond)
{
if (cond)
bra ();
else
change_pc (PC+1);
cpu_clk -= 3;
}
static void
long_bra (void)
{
INT16 tmp = (INT16) imm_word ();
change_pc (PC + tmp);
}
static void
long_branch (unsigned cond)
{
if (cond)
{
long_bra ();
cpu_clk -= 6;
}
else
{
change_pc (PC + 2);
cpu_clk -= 5;
}
}
static void
long_bsr (void)
{
INT16 tmp = (INT16) imm_word ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 9;
change_pc (ea);
monitor_call (0);
}
static void
bsr (void)
{
INT8 tmp = (INT8) imm_byte ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 7;
change_pc (ea);
monitor_call (0);
}
/* execute 6809 code */
int
cpu_execute (int cycles)
{
unsigned opcode;
cpu_period = cpu_clk = cycles;
do
{
command_insn_hook ();
- if (check_break (PC) != 0)
+ if (check_break () != 0)
monitor_on = 1;
if (monitor_on != 0)
if (monitor6809 () != 0)
goto cpu_exit;
iPC = PC;
opcode = imm_byte ();
switch (opcode)
{
case 0x00:
direct ();
cpu_clk -= 4;
WRMEM (ea, neg (RDMEM (ea)));
break; /* NEG direct */
#ifdef H6309
case 0x01: /* OIM */
break;
case 0x02: /* AIM */
break;
#endif
case 0x03:
direct ();
cpu_clk -= 4;
WRMEM (ea, com (RDMEM (ea)));
break; /* COM direct */
case 0x04:
direct ();
cpu_clk -= 4;
WRMEM (ea, lsr (RDMEM (ea)));
break; /* LSR direct */
#ifdef H6309
case 0x05: /* EIM */
break;
#endif
case 0x06:
direct ();
cpu_clk -= 4;
WRMEM (ea, ror (RDMEM (ea)));
break; /* ROR direct */
case 0x07:
direct ();
cpu_clk -= 4;
WRMEM (ea, asr (RDMEM (ea)));
break; /* ASR direct */
case 0x08:
direct ();
cpu_clk -= 4;
WRMEM (ea, asl (RDMEM (ea)));
break; /* ASL direct */
case 0x09:
direct ();
cpu_clk -= 4;
WRMEM (ea, rol (RDMEM (ea)));
break; /* ROL direct */
case 0x0a:
direct ();
cpu_clk -= 4;
WRMEM (ea, dec (RDMEM (ea)));
break; /* DEC direct */
#ifdef H6309
case 0x0B: /* TIM */
break;
#endif
case 0x0c:
direct ();
cpu_clk -= 4;
WRMEM (ea, inc (RDMEM (ea)));
break; /* INC direct */
case 0x0d:
direct ();
cpu_clk -= 4;
tst (RDMEM (ea));
break; /* TST direct */
case 0x0e:
direct ();
cpu_clk -= 3;
PC = ea;
check_pc ();
monitor_call (FC_TAIL_CALL);
break; /* JMP direct */
case 0x0f:
direct ();
cpu_clk -= 4;
WRMEM (ea, clr (RDMEM (ea)));
break; /* CLR direct */
case 0x10:
{
opcode = imm_byte ();
switch (opcode)
{
case 0x21:
cpu_clk -= 5;
PC += 2;
break;
case 0x22:
long_branch (cond_HI ());
break;
case 0x23:
long_branch (cond_LS ());
break;
case 0x24:
long_branch (cond_HS ());
break;
case 0x25:
long_branch (cond_LO ());
break;
case 0x26:
long_branch (cond_NE ());
break;
case 0x27:
long_branch (cond_EQ ());
break;
case 0x28:
long_branch (cond_VC ());
break;
case 0x29:
long_branch (cond_VS ());
break;
case 0x2a:
long_branch (cond_PL ());
break;
case 0x2b:
long_branch (cond_MI ());
break;
case 0x2c:
long_branch (cond_GE ());
break;
case 0x2d:
long_branch (cond_LT ());
break;
case 0x2e:
long_branch (cond_GT ());
break;
case 0x2f:
long_branch (cond_LE ());
break;
#ifdef H6309
case 0x30: /* ADDR */
break;
case 0x31: /* ADCR */
break;
case 0x32: /* SUBR */
break;
case 0x33: /* SBCR */
break;
case 0x34: /* ANDR */
break;
case 0x35: /* ORR */
break;
case 0x36: /* EORR */
break;
case 0x37: /* CMPR */
break;
case 0x38: /* PSHSW */
break;
case 0x39: /* PULSW */
break;
case 0x3a: /* PSHUW */
break;
case 0x3b: /* PULUW */
break;
#endif
case 0x3f:
swi2 ();
break;
#ifdef H6309
case 0x40: /* NEGD */
break;
case 0x43: /* COMD */
break;
case 0x44: /* LSRD */
break;
case 0x46: /* RORD */
break;
case 0x47: /* ASRD */
break;
case 0x48: /* ASLD/LSLD */
break;
case 0x49: /* ROLD */
break;
case 0x4a: /* DECD */
break;
case 0x4c: /* INCD */
break;
case 0x4d: /* TSTD */
break;
case 0x4f: /* CLRD */
break;
case 0x53: /* COMW */
break;
case 0x54: /* LSRW */
break;
case 0x56: /* ??RORW */
break;
case 0x59: /* ROLW */
break;
case 0x5a: /* DECW */
break;
case 0x5c: /* INCW */
break;
case 0x5d: /* TSTW */
break;
case 0x5f: /* CLRW */
break;
case 0x80: /* SUBW */
break;
case 0x81: /* CMPW */
break;
case 0x82: /* SBCD */
break;
#endif
case 0x83:
cpu_clk -= 5;
cmp16 (get_d (), imm_word ());
break;
#ifdef H6309
case 0x84: /* ANDD */
break;
case 0x85: /* BITD */
break;
case 0x86: /* LDW */
break;
case 0x88: /* EORD */
break;
case 0x89: /* ADCD */
break;
case 0x8a: /* ORD */
break;
case 0x8b: /* ADDW */
break;
#endif
case 0x8c:
cpu_clk -= 5;
cmp16 (Y, imm_word ());
break;
case 0x8e:
cpu_clk -= 4;
Y = ld16 (imm_word ());
break;
#ifdef H6309
case 0x90: /* SUBW */
break;
case 0x91: /* CMPW */
break;
case 0x92: /* SBCD */
break;
#endif
case 0x93:
direct ();
cpu_clk -= 5;
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0x9c:
direct ();
cpu_clk -= 5;
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0x9e:
direct ();
cpu_clk -= 5;
Y = ld16 (RDMEM16 (ea));
break;
case 0x9f:
direct ();
cpu_clk -= 5;
st16 (Y);
break;
case 0xa3:
cpu_clk--;
indexed ();
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0xac:
cpu_clk--;
indexed ();
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0xae:
cpu_clk--;
indexed ();
Y = ld16 (RDMEM16 (ea));
break;
case 0xaf:
cpu_clk--;
indexed ();
st16 (Y);
break;
case 0xb3:
extended ();
cpu_clk -= 6;
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0xbc:
extended ();
cpu_clk -= 6;
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0xbe:
extended ();
cpu_clk -= 6;
Y = ld16 (RDMEM16 (ea));
break;
case 0xbf:
extended ();
cpu_clk -= 6;
st16 (Y);
break;
case 0xce:
cpu_clk -= 4;
S = ld16 (imm_word ());
break;
case 0xde:
direct ();
cpu_clk -= 5;
S = ld16 (RDMEM16 (ea));
break;
case 0xdf:
direct ();
cpu_clk -= 5;
st16 (S);
break;
case 0xee:
cpu_clk--;
indexed ();
S = ld16 (RDMEM16 (ea));
break;
case 0xef:
cpu_clk--;
indexed ();
st16 (S);
break;
case 0xfe:
extended ();
cpu_clk -= 6;
S = ld16 (RDMEM16 (ea));
break;
case 0xff:
extended ();
cpu_clk -= 6;
st16 (S);
break;
default:
sim_error ("invalid opcode (1) at %s\n", monitor_addr_name (iPC));
break;
}
}
break;
case 0x11:
{
opcode = imm_byte ();
switch (opcode)
{
case 0x3f:
swi3 ();
break;
case 0x83:
cpu_clk -= 5;
cmp16 (U, imm_word ());
break;
case 0x8c:
cpu_clk -= 5;
cmp16 (S, imm_word ());
break;
case 0x93:
direct ();
cpu_clk -= 5;
cmp16 (U, RDMEM16 (ea));
cpu_clk--;
break;
case 0x9c:
direct ();
cpu_clk -= 5;
cmp16 (S, RDMEM16 (ea));
cpu_clk--;
break;
case 0xa3:
cpu_clk--;
indexed ();
cmp16 (U, RDMEM16 (ea));
cpu_clk--;
break;
case 0xac:
cpu_clk--;
indexed ();
cmp16 (S, RDMEM16 (ea));
cpu_clk--;
break;
case 0xb3:
extended ();
cpu_clk -= 6;
cmp16 (U, RDMEM16 (ea));
cpu_clk--;
break;
case 0xbc:
extended ();
cpu_clk -= 6;
cmp16 (S, RDMEM16 (ea));
cpu_clk--;
break;
default:
sim_error ("invalid opcode (2) at %s\n", monitor_addr_name (iPC));
break;
}
}
break;
case 0x12:
nop ();
break;
case 0x13:
sync ();
break;
#ifdef H6309
case 0x14: /* SEXW */
break;
#endif
case 0x16:
long_bra ();
cpu_clk -= 5;
break;
case 0x17:
long_bsr ();
break;
case 0x19:
daa ();
break;
case 0x1a:
orcc ();
break;
case 0x1c:
andcc ();
break;
case 0x1d:
sex ();
break;
case 0x1e:
exg ();
break;
case 0x1f:
tfr ();
break;
case 0x20:
bra ();
cpu_clk -= 3;
break;
case 0x21:
PC++;
cpu_clk -= 3;
break;
case 0x22:
branch (cond_HI ());
break;
case 0x23:
branch (cond_LS ());
break;
case 0x24:
branch (cond_HS ());
break;
case 0x25:
branch (cond_LO ());
break;
case 0x26:
branch (cond_NE ());
break;
case 0x27:
branch (cond_EQ ());
break;
case 0x28:
branch (cond_VC ());
break;
case 0x29:
branch (cond_VS ());
break;
case 0x2a:
branch (cond_PL ());
break;
case 0x2b:
branch (cond_MI ());
break;
case 0x2c:
branch (cond_GE ());
break;
case 0x2d:
branch (cond_LT ());
break;
case 0x2e:
branch (cond_GT ());
break;
case 0x2f:
branch (cond_LE ());
break;
case 0x30:
indexed ();
Z = X = ea;
break; /* LEAX indexed */
case 0x31:
indexed ();
Z = Y = ea;
break; /* LEAY indexed */
case 0x32:
diff --git a/6809.h b/6809.h
index a6d0baa..0e50849 100644
--- a/6809.h
+++ b/6809.h
@@ -1,243 +1,243 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_H
#define M6809_H
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#else
#error
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
#error
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#else
#error
#endif
typedef uint8_t UINT8;
typedef signed char INT8;
typedef uint16_t UINT16;
typedef signed short INT16;
typedef uint32_t UINT32;
typedef signed int INT32;
typedef uint16_t target_addr_t;
#include "machine.h"
#define E_FLAG 0x80
#define F_FLAG 0x40
#define H_FLAG 0x20
#define I_FLAG 0x10
#define N_FLAG 0x08
#define Z_FLAG 0x04
#define V_FLAG 0x02
#define C_FLAG 0x01
extern int debug_enabled;
extern int need_flush;
extern unsigned long total;
extern int dump_cycles_on_success;
#ifdef OLDSYS
extern UINT8 *memory;
#endif
/* Primitive read/write macros */
#define read8(addr) cpu_read8 (addr)
#define write8(addr,val) do { cpu_write8 (addr, val); } while (0)
/* 16-bit versions */
#define read16(addr) (read8(addr) << 8 | read8(addr+1))
#define write16(addr,val) do { write8(addr+1, val & 0xFF); write8(addr, (val >> 8) & 0xFF); } while (0)
/* Fetch macros */
#define abs_read16(addr) ((abs_read8(addr) << 8) | abs_read8(addr+1))
#define fetch8() abs_read8 (pc++)
#define fetch16() (pc += 2, abs_read16(pc-2))
/* 6809.c */
extern int cpu_quit;
extern int cpu_execute (int);
extern void cpu_reset (void);
extern unsigned get_a (void);
extern unsigned get_b (void);
extern unsigned get_cc (void);
extern unsigned get_dp (void);
extern unsigned get_x (void);
extern unsigned get_y (void);
extern unsigned get_s (void);
extern unsigned get_u (void);
extern unsigned get_pc (void);
extern unsigned get_d (void);
extern void set_a (unsigned);
extern void set_b (unsigned);
extern void set_cc (unsigned);
extern void set_dp (unsigned);
extern void set_x (unsigned);
extern void set_y (unsigned);
extern void set_s (unsigned);
extern void set_u (unsigned);
extern void set_pc (unsigned);
extern void set_d (unsigned);
/* fileio.c */
struct pathlist
{
int count;
char *entry[32];
};
void path_init (struct pathlist *path);
void path_add (struct pathlist *path, const char *dir);
FILE * file_open (struct pathlist *path, const char *filename, const char *mode);
FILE * file_require_open (struct pathlist *path, const char *filename, const char *mode);
void file_close (FILE *fp);
/* monitor.c */
extern int monitor_on;
-extern int check_break (unsigned);
+extern int check_break (void);
extern void monitor_init (void);
extern int monitor6809 (void);
extern int dasm (char *, absolute_address_t);
extern int load_hex (char *);
extern int load_s19 (char *);
extern int load_bin (char *,int);
#define MAX_STRINGSPACE 32000
#define MAX_SYMBOL_HASH 1009
#define SYM_DEFAULT 0
#define SYM_AUTO 1
typedef struct
{
unsigned char format;
unsigned int size;
} datatype_t;
/* symtab.c */
struct stringspace
{
char space[32000];
unsigned int used;
};
struct symbol
{
char *name;
unsigned long value;
datatype_t ty;
unsigned int type;
struct symbol *name_chain;
struct symbol *value_chain;
};
struct symtab
{
struct symbol *syms_by_name[MAX_SYMBOL_HASH];
struct symbol *syms_by_value[MAX_SYMBOL_HASH];
struct symtab *parent;
};
extern struct symtab program_symtab;
extern struct symtab internal_symtab;
extern struct symtab auto_symtab;
void sym_add (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
void sym_set (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
int sym_find (struct symtab *symtab, const char *name, unsigned long *value, unsigned int type);
const char *sym_lookup (struct symtab *symtab, unsigned long value);
typedef void (*command_handler_t) (void);
typedef void (*virtual_handler_t) (unsigned long *val, int writep);
typedef unsigned int thread_id_t;
typedef struct
{
unsigned int id : 8;
unsigned int used : 1;
unsigned int enabled : 1;
unsigned int conditional : 1;
unsigned int threaded : 1;
unsigned int on_read : 1;
unsigned int on_write : 1;
unsigned int on_execute : 1;
unsigned int size : 4;
unsigned int keep_running : 1;
unsigned int temp : 1;
unsigned int last_write : 16;
unsigned int write_mask : 16;
absolute_address_t addr;
char condition[128];
thread_id_t tid;
unsigned int pass_count;
unsigned int ignore_count;
} breakpoint_t;
typedef struct
{
int used : 1;
datatype_t type;
char expr[128];
} display_t;
typedef struct
{
int id : 8;
thread_id_t tid;
} thread_t;
#define MAX_BREAKS 32
#define MAX_DISPLAYS 32
#define MAX_HISTORY 10
#define MAX_THREADS 64
void command_irq_hook (unsigned long cycles);
#endif /* M6809_H */
diff --git a/monitor.c b/monitor.c
index 6324cd6..531b32f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -882,544 +882,544 @@ char *reg[] = {
char index_reg[] = { 'X', 'Y', 'U', 'S' };
char *off4[] = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15",
"-16", "-15", "-14", "-13", "-12", "-11", "-10", "-9",
"-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"
};
/* Disassemble the current instruction. Returns the number of bytes that
compose it. */
int
dasm (char *buf, absolute_address_t opc)
{
UINT8 op, am;
char *op_str;
absolute_address_t pc = opc;
char R;
int fetch1; /* the first (MSB) fetched byte, used in macro RDWORD */
op = fetch8 ();
if (op == 0x10)
{
op = fetch8 ();
am = codes10[op].mode;
op = codes10[op].code;
}
else if (op == 0x11)
{
op = fetch8 ();
am = codes11[op].mode;
op = codes11[op].code;
}
else
{
am = codes[op].mode;
op = codes[op].code;
}
op_str = (char *) mne[op];
buf += sprintf (buf, "%-6.6s", op_str);
switch (am)
{
case _illegal:
sprintf (buf, "???");
break;
case _implied:
break;
case _imm_byte:
sprintf (buf, "#$%02X", fetch8 ());
break;
case _imm_word:
sprintf (buf, "#$%04X", fetch16 ());
break;
case _direct:
sprintf (buf, "<%s", monitor_addr_name (fetch8 ()));
break;
case _extended:
sprintf (buf, "%s", monitor_addr_name (fetch16 ()));
break;
case _indexed:
op = fetch8 ();
R = index_reg[(op >> 5) & 0x3];
if ((op & 0x80) == 0)
{
sprintf (buf, "%s,%c", off4[op & 0x1f], R);
break;
}
switch (op & 0x1f)
{
case 0x00:
sprintf (buf, ",%c+", R);
break;
case 0x01:
sprintf (buf, ",%c++", R);
break;
case 0x02:
sprintf (buf, ",-%c", R);
break;
case 0x03:
sprintf (buf, ",--%c", R);
break;
case 0x04:
sprintf (buf, ",%c", R);
break;
case 0x05:
sprintf (buf, "B,%c", R);
break;
case 0x06:
sprintf (buf, "A,%c", R);
break;
case 0x08:
sprintf (buf, "$%02X,%c", fetch8 (), R);
break;
case 0x09:
sprintf (buf, "$%04X,%c", fetch16 (), R);
break;
case 0x0B:
sprintf (buf, "D,%c", R);
break;
case 0x0C:
sprintf (buf, "$%02X,PC", fetch8 ());
break;
case 0x0D:
sprintf (buf, "$%04X,PC", fetch16 ());
break;
case 0x11:
sprintf (buf, "[,%c++]", R);
break;
case 0x13:
sprintf (buf, "[,--%c]", R);
break;
case 0x14:
sprintf (buf, "[,%c]", R);
break;
case 0x15:
sprintf (buf, "[B,%c]", R);
break;
case 0x16:
sprintf (buf, "[A,%c]", R);
break;
case 0x18:
sprintf (buf, "[$%02X,%c]", fetch8 (), R);
break;
case 0x19:
sprintf (buf, "[$%04X,%c]", fetch16 (), R);
break;
case 0x1B:
sprintf (buf, "[D,%c]", R);
break;
case 0x1C:
sprintf (buf, "[$%02X,PC]", fetch8 ());
break;
case 0x1D:
sprintf (buf, "[$%04X,PC]", fetch16 ());
break;
case 0x1F:
sprintf (buf, "[%s]", monitor_addr_name (fetch16 ()));
break;
default:
sprintf (buf, "???");
break;
}
break;
case _rel_byte:
fetch1 = ((INT8) fetch8 ());
sprintf (buf, "%s", absolute_addr_name (fetch1 + pc));
break;
case _rel_word:
sprintf (buf, "%s", absolute_addr_name (fetch16 () + pc));
break;
case _reg_post:
op = fetch8 ();
sprintf (buf, "%s,%s", reg[op >> 4], reg[op & 15]);
break;
case _usr_post:
case _sys_post:
op = fetch8 ();
if (op & 0x80)
strcat (buf, "PC,");
if (op & 0x40)
strcat (buf, am == _usr_post ? "S," : "U,");
if (op & 0x20)
strcat (buf, "Y,");
if (op & 0x10)
strcat (buf, "X,");
if (op & 0x08)
strcat (buf, "DP,");
if ((op & 0x06) == 0x06)
strcat (buf, "D,");
else
{
if (op & 0x04)
strcat (buf, "B,");
if (op & 0x02)
strcat (buf, "A,");
}
if (op & 0x01)
strcat (buf, "CC,");
buf[strlen (buf) - 1] = '\0';
break;
}
return pc - opc;
}
int
sizeof_file (FILE * file)
{
int size;
fseek (file, 0, SEEK_END);
size = ftell (file);
rewind (file);
return size;
}
int
load_map_file (const char *name)
{
FILE *fp;
char map_filename[256];
char buf[256];
char *value_ptr, *id_ptr;
target_addr_t value;
char *file_ptr;
sprintf (map_filename, "%s.map", name);
fp = file_open (NULL, map_filename, "r");
if (!fp)
return -1;
for (;;)
{
fgets (buf, sizeof(buf)-1, fp);
if (feof (fp))
break;
value_ptr = buf;
if (!strncmp (value_ptr, "page", 4))
{
unsigned char page = strtoul (value_ptr+4, NULL, 10);
wpc_set_rom_page (page);
continue;
}
if (strncmp (value_ptr, " ", 6))
continue;
while (*value_ptr == ' ')
value_ptr++;
value = strtoul (value_ptr, &id_ptr, 16);
if (id_ptr == value_ptr)
continue;
while (*id_ptr == ' ')
id_ptr++;
id_ptr = strtok (id_ptr, " \t\n");
if (((*id_ptr == 'l') || (*id_ptr == 's')) && (id_ptr[1] == '_'))
continue;
++id_ptr;
file_ptr = strtok (NULL, " \t\n");
sym_add (&program_symtab, id_ptr, to_absolute (value), 0); /* file_ptr? */
}
fclose (fp);
return 0;
}
int
load_hex (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = file_open (NULL, name, "r");
if (fp == NULL)
{
printf ("failed to open hex record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, ":%2x%4x%2x", &count, &addr, &type) != 3)
{
printf ("line %d: invalid hex record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff) + type;
switch (type)
{
case 0:
for (; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid hex record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 1:
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid hex record checksum \n", line);
done = 0;
break;
case 2:
default:
printf ("line %d: not supported hex type %d.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
int
load_s19 (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = file_open (NULL, name, "r");
if (fp == NULL)
{
printf ("failed to open S-record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, "S%1x%2x%4x", &type, &count, &addr) != 3)
{
printf ("line %d: invalid S record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff);
switch (type)
{
case 1:
for (count -= 3; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 9:
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
default:
printf ("line %d: S%d not supported.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
void
monitor_call (unsigned int flags)
{
#ifdef CALL_STACK
if (current_function_call <= &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call++;
current_function_call->entry_point = get_pc ();
current_function_call->flags = flags;
}
#endif
const char *id = sym_lookup (&program_symtab, to_absolute (get_pc ()));
if (id)
{
// printf ("In %s now\n", id);
}
}
void
monitor_return (void)
{
#ifdef CALL_STACK
if (current_function_call > &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call--;
return;
}
while ((current_function_call->flags & FC_TAIL_CALL) &&
(current_function_call > fctab))
{
current_function_call--;
}
if (current_function_call > fctab)
current_function_call--;
#endif
}
const char *
absolute_addr_name (absolute_address_t addr)
{
static char buf[256], *bufptr;
const char *name;
bufptr = buf;
bufptr += sprintf (bufptr, "%02X:0x%04X", addr >> 28, addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
bufptr += sprintf (bufptr, " <%-16.16s>", name);
return buf;
}
const char *
monitor_addr_name (target_addr_t target_addr)
{
static char buf[256], *bufptr;
const char *name;
absolute_address_t addr = to_absolute (target_addr);
bufptr = buf;
bufptr += sprintf (bufptr, "0x%04X", target_addr);
name = sym_lookup (&program_symtab, addr);
if (name)
bufptr += sprintf (bufptr, " <%s>", name);
return buf;
}
static void
monitor_signal (int sigtype)
{
(void) sigtype;
putchar ('\n');
monitor_on = 1;
}
void
monitor_init (void)
{
int tmp;
extern int debug_enabled;
target_addr_t a;
fctab[0].entry_point = read16 (0xfffe);
memset (&fctab[0].entry_regs, 0, sizeof (struct cpu_regs));
current_function_call = &fctab[0];
auto_break_insn_count = 0;
monitor_on = debug_enabled;
signal (SIGINT, monitor_signal);
}
int
-check_break (unsigned break_pc)
+check_break (void)
{
if (dump_every_insn)
print_current_insn ();
if (auto_break_insn_count > 0)
if (--auto_break_insn_count == 0)
return 1;
return 0;
}
void
monitor_backtrace (void)
{
struct function_call *fc = current_function_call;
while (fc >= &fctab[0]) {
printf ("%s\n", monitor_addr_name (fc->entry_point));
fc--;
}
}
int
monitor6809 (void)
{
int rc;
signal (SIGINT, monitor_signal);
rc = command_loop ();
monitor_on = 0;
return rc;
}
|
bcd/exec09
|
790779370ff9b13117e0ad3901fa34bc48e456c6
|
Remove debug prints about command-line parsing.
|
diff --git a/main.c b/main.c
index 159b02c..2415577 100644
--- a/main.c
+++ b/main.c
@@ -1,400 +1,400 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/time.h>
#include "6809.h"
enum
{ HEX, S19, BIN };
/* The total number of cycles that have executed */
unsigned long total = 0;
/* The frequency of the emulated CPU, in megahertz */
unsigned int mhz = 1;
/* When nonzero, indicates that the IRQ should be triggered periodically,
every so many cycles. By default no periodic IRQ is generated. */
unsigned int cycles_per_irq = 0;
/* When nonzero, indicates that the FIRQ should be triggered periodically,
every so many cycles. By default no periodic FIRQ is generated. */
unsigned int cycles_per_firq = 0;
/* Nonzero if debugging support is turned on */
int debug_enabled = 0;
/* Nonzero if tracing is enabled */
int trace_enabled = 0;
/* When nonzero, causes the program to print the total number of cycles
on a successful exit. */
int dump_cycles_on_success = 0;
/* When nonzero, indicates the total number of cycles before an automated
exit. This is to help speed through test cases that never finish. */
int max_cycles = 100000000;
static int type = S19;
char *exename;
const char *machine_name = "simple";
const char *prog_name = NULL;
static void usage (void)
{
printf ("Usage: %s <options> filename\n", exename);
printf ("Options are:\n");
printf ("-hex - load intel hex file\n");
printf ("-s19 - load motorola s record file\n");
printf ("-bin - load binary file\n");
printf ("-s addr - specify binary load address hexadecimal (default 0)\n");
printf ("default format is motorola s record\n");
exit (1);
}
void
idle_loop (void)
{
struct timeval now;
static struct timeval last = { 0, 0 };
int real_ms;
static unsigned long last_cycles = 0;
unsigned long cycles;
int sim_ms;
const int cycles_per_ms = 2000;
static int period = 100;
static int count = 100;
int delay;
static int total_ms_elapsed = 0;
if (--count > 0)
return;
if (last.tv_usec == 0)
gettimeofday (&last, NULL);
gettimeofday (&now, NULL);
real_ms = (now.tv_usec - last.tv_usec) / 1000;
if (real_ms < 0)
real_ms += 1000;
last = now;
cycles = get_cycles ();
sim_ms = (cycles - last_cycles) / cycles_per_ms;
if (sim_ms < 0)
sim_ms += cycles_per_ms;
last_cycles = cycles;
total_ms_elapsed += sim_ms;
if (total_ms_elapsed > 100)
{
total_ms_elapsed -= 100;
wpc_periodic ();
command_periodic ();
}
delay = sim_ms - real_ms;
if (delay > 0)
{
if (delay > 60)
period -= 5;
else if (delay < 20)
period += 5;
usleep (delay * 1000UL);
}
count = period;
}
int do_help (const char *arg __attribute__((unused)));
#define NO_NEG 0
#define HAS_NEG 1
#define NO_ARG 0
#define HAS_ARG 1
struct option
{
char o_short;
const char *o_long;
const char *help;
unsigned int can_negate : 1;
unsigned int takes_arg : 1;
int *int_value;
int default_value;
const char **string_value;
int (*handler) (const char *arg);
} option_table[] = {
{ 'd', "debug", "Enter the monitor immediately",
HAS_NEG, NO_ARG, &debug_enabled, 1, NULL, NULL },
{ 'h', "help", NULL,
NO_NEG, NO_ARG, NULL, NULL, 0, do_help },
{ 'b', "binary", "",
NO_NEG, NO_ARG, &type, BIN, NULL, NULL },
{ 'M', "mhz", "", NO_NEG, HAS_ARG },
{ '-', "68a09", "Emulate the 68A09 variation (1.5Mhz)" },
{ '-', "68b09", "Emulate the 68B09 variation (2Mhz)" },
{ 'R', "realtime", "Limit simulation speed to match realtime" },
{ 'I', "irqfreq", "Asserts an IRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_irq, 0, NULL, NULL },
{ 'F', "firqfreq", "Asserts an FIRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_firq, 0, NULL, NULL },
{ 'C', "cycledump", "",
HAS_NEG, NO_ARG, &dump_cycles_on_success, 1, NULL, NULL},
{ 't', "loadmap", "" },
{ 'T', "trace", "",
NO_NEG, NO_ARG, &trace_enabled, 1, NULL, NULL },
{ 'm', "maxcycles", "Sets maximum number of cycles to run",
NO_NEG, HAS_ARG, &max_cycles, 0, NULL, NULL },
{ 's', "machine", "Specify the machine (exact hardware) to emulate",
NO_NEG, HAS_ARG, NULL, 0, &machine_name, NULL },
{ '\0', NULL },
};
int
do_help (const char *arg __attribute__((unused)))
{
struct option *opt = option_table;
while (opt->o_long != NULL)
{
if (opt->help)
{
printf ("-%c,--%s %s\n",
opt->o_short, opt->o_long, opt->help);
}
opt++;
}
return -1;
}
/**
* Returns positive if an argument was taken.
* Returns zero if no argument was taken.
* Returns negative on error.
*/
int
process_option (struct option *opt, const char *arg)
{
int rc;
- printf ("Processing option '%s'\n", opt->o_long);
+ //printf ("Processing option '%s'\n", opt->o_long);
if (opt->takes_arg)
{
if (!arg)
{
- printf (" Takes argument but none given.\n");
+ //printf (" Takes argument but none given.\n");
rc = 0;
}
else
{
if (opt->int_value)
{
*(opt->int_value) = strtoul (arg, NULL, 0);
- printf (" Integer argument '%d' taken.\n", *(opt->int_value));
+ //printf (" Integer argument '%d' taken.\n", *(opt->int_value));
}
else if (opt->string_value)
{
*(opt->string_value) = arg;
- printf (" String argument '%s' taken.\n", *(opt->string_value));
+ //printf (" String argument '%s' taken.\n", *(opt->string_value));
}
rc = 1;
}
}
else
{
if (arg)
- printf (" Takes no argument but one given, ignored.\n");
+ //printf (" Takes no argument but one given, ignored.\n");
if (opt->int_value)
{
*(opt->int_value) = opt->default_value;
- printf (" Integer argument 1 implied.\n");
+ //printf (" Integer argument 1 implied.\n");
}
rc = 0;
}
if (opt->handler)
{
rc = opt->handler (arg);
- printf (" Handler called, rc=%d\n", rc);
+ //printf (" Handler called, rc=%d\n", rc);
}
if (rc < 0)
exit (0);
return rc;
}
int
process_plain_argument (const char *arg)
{
- printf ("plain argument '%s'\n", arg);
+ //printf ("plain argument '%s'\n", arg);
if (!prog_name)
prog_name = arg;
}
int
parse_args (int argc, char *argv[])
{
int argn = 1;
struct option *opt;
next_arg:
while (argn < argc)
{
char *arg = argv[argn];
if (arg[0] == '-')
{
if (arg[1] == '-')
{
char *rest = strchr (arg+2, '=');
if (rest)
*rest++ = '\0';
opt = option_table;
while (opt->o_long != NULL)
{
if (!strcmp (opt->o_long, arg+2))
{
argn++;
(void)process_option (opt, rest);
goto next_arg;
}
opt++;
}
printf ("long option '%s' not recognized.\n", arg+2);
}
else
{
opt = option_table;
while (opt->o_long != NULL)
{
if (opt->o_short == arg[1])
{
argn++;
if (process_option (opt, argv[argn]))
argn++;
goto next_arg;
}
opt++;
}
printf ("short option '%c' not recognized.\n", arg[1]);
}
argn++;
}
else
{
process_plain_argument (argv[argn++]);
}
}
}
int
main (int argc, char *argv[])
{
int off = 0;
int i, j, n;
int argn = 1;
unsigned int loops = 0;
exename = argv[0];
/* TODO - enable different options by default
based on the executable name. */
parse_args (argc, argv);
sym_init ();
switch (type)
{
case HEX:
if (prog_name && load_hex (prog_name))
usage ();
break;
case S19:
machine_init (machine_name, NULL);
if (prog_name && load_s19 (prog_name))
usage ();
break;
default:
machine_init (machine_name, prog_name);
break;
}
/* Try to load a map file */
if (prog_name)
load_map_file (prog_name);
/* Enable debugging if no executable given yet. */
if (!prog_name)
debug_enabled = 1;
else
/* OK, ready to run. Reset the CPU first. */
cpu_reset ();
monitor_init ();
command_init ();
keybuffering (0);
/* Now, iterate through the instructions.
* If no IRQs or FIRQs are enabled, we can just call cpu_execute()
* and let it run for a long time; otherwise, we need to come back
* here periodically and do the interrupt handling. */
for (cpu_quit = 1; cpu_quit != 0;)
{
if ((cycles_per_irq == 0) && (cycles_per_firq == 0))
{
total += cpu_execute (max_cycles ? max_cycles-1 : 500000);
}
else
{
total += cpu_execute (cycles_per_irq);
request_irq (0);
/* TODO - FIRQ not handled yet */
request_firq (0);
}
idle_loop ();
/* Check for a rogue program that won't end */
if ((max_cycles > 0) && (total > max_cycles))
{
sim_error ("maximum cycle count exceeded at %s\n",
monitor_addr_name (get_pc ()));
}
}
printf ("m6809-run stopped after %d cycles\n", total);
return 0;
}
|
bcd/exec09
|
d06e899f783426517ab437cdf93e349e6a695729
|
Implement FIRQ. It is currently asserted anytime IRQ is, wrong I know.
|
diff --git a/6809.c b/6809.c
index 3fa82d5..d5abb98 100644
--- a/6809.c
+++ b/6809.c
@@ -1,2030 +1,2038 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include "monitor.h"
#include <stdarg.h>
unsigned X, Y, S, U, PC;
unsigned A, B, DP;
unsigned H, N, Z, OV, C;
unsigned EFI;
#ifdef H6309
unsigned E, F, V, MD;
#define MD_NATIVE 0x1 /* if 1, execute in 6309 mode */
#define MD_FIRQ_LIKE_IRQ 0x2 /* if 1, FIRQ acts like IRQ */
#define MD_ILL 0x40 /* illegal instruction */
#define MD_DBZ 0x80 /* divide by zero */
#endif /* H6309 */
unsigned iPC;
unsigned long irq_start_time;
unsigned ea = 0;
long cpu_clk = 0;
long cpu_period = 0;
int cpu_quit = 1;
unsigned int irqs_pending = 0;
unsigned int firqs_pending = 0;
+unsigned int cc_changed = 0;
unsigned *index_regs[4] = { &X, &Y, &U, &S };
extern int dump_cycles_on_success;
extern int trace_enabled;
extern void irq (void);
extern void firq (void);
void request_irq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
irqs_pending |= (1 << source);
if (!(EFI & I_FLAG))
irq ();
}
void release_irq (unsigned int source)
{
irqs_pending &= ~(1 << source);
}
void request_firq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
firqs_pending |= (1 << source);
- if (!(EFI & I_FLAG))
+ if (!(EFI & F_FLAG))
firq ();
}
void release_firq (unsigned int source)
{
firqs_pending &= ~(1 << source);
}
static inline void
check_pc (void)
{
/* TODO */
}
static inline void
check_stack (void)
{
/* TODO */
}
void
sim_error (const char *format, ...)
{
va_list ap;
va_start (ap, format);
fprintf (stderr, "m6809-run: (at PC=%04X) ", iPC);
vfprintf (stderr, format, ap);
va_end (ap);
if (debug_enabled)
monitor_on = 1;
else
exit (2);
}
unsigned long
get_cycles (void)
{
return total + cpu_period - cpu_clk;
}
void
sim_exit (uint8_t exit_code)
{
/* On a nonzero exit, always print an error message. */
if (exit_code != 0)
{
printf ("m6809-run: program exited with %d\n", exit_code);
if (exit_code)
monitor_backtrace ();
}
/* If a cycle count should be printed, do that last. */
if (dump_cycles_on_success)
printf ("Finished in %d cycles\n", get_cycles ());
exit (exit_code);
}
static inline void
change_pc (unsigned newPC)
{
/* TODO - will let some RAM execute for trampolines */
if ((newPC < 0x1C00) || (newPC > 0xFFFF))
{
fprintf (stderr, "m6809-run: invalid PC = %04X, previous was %s\n",
newPC, monitor_addr_name (PC));
exit (2);
}
if (trace_enabled)
{
fprintf (stderr, "PC : %s ", monitor_addr_name (PC));
fprintf (stderr, "-> %s\n", monitor_addr_name (newPC));
}
PC = newPC;
}
static inline unsigned
imm_byte (void)
{
unsigned val = read8 (PC);
PC++;
return val;
}
static inline unsigned
imm_word (void)
{
unsigned val = read16 (PC);
PC += 2;
return val;
}
#define WRMEM(addr, data) write8 (addr, data)
static void
WRMEM16 (unsigned addr, unsigned data)
{
WRMEM (addr, data >> 8);
cpu_clk--;
WRMEM ((addr + 1) & 0xffff, data & 0xff);
}
#define RDMEM(addr) read8 (addr)
static unsigned
RDMEM16 (unsigned addr)
{
unsigned val = RDMEM (addr) << 8;
cpu_clk--;
val |= RDMEM ((addr + 1) & 0xffff);
return val;
}
#define write_stack WRMEM
#define read_stack RDMEM
static void
write_stack16 (unsigned addr, unsigned data)
{
write_stack ((addr + 1) & 0xffff, data & 0xff);
write_stack (addr, data >> 8);
}
static unsigned
read_stack16 (unsigned addr)
{
return (read_stack (addr) << 8) | read_stack ((addr + 1) & 0xffff);
}
static void
direct (void)
{
unsigned val = read8 (PC) | DP;
PC++;
ea = val;
}
static void
indexed (void) /* note take 1 extra cycle */
{
unsigned post = imm_byte ();
unsigned *R = index_regs[(post >> 5) & 0x3];
if (post & 0x80)
{
switch (post & 0x1f)
{
case 0x00:
ea = *R;
*R = (*R + 1) & 0xffff;
cpu_clk -= 6;
break;
case 0x01:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
break;
case 0x02:
*R = (*R - 1) & 0xffff;
ea = *R;
cpu_clk -= 6;
break;
case 0x03:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
break;
case 0x04:
ea = *R;
cpu_clk -= 4;
break;
case 0x05:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
break;
case 0x06:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
break;
case 0x08:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
break;
case 0x09:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
break;
case 0x0d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
break;
case 0x11:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x13:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x14:
ea = *R;
cpu_clk -= 4;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x15:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x16:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x18:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x19:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1f:
ea = imm_word ();
cpu_clk -= 6;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
default:
ea = 0;
printf ("%X: invalid index post $%02X\n", iPC, post);
if (debug_enabled)
{
monitor_on = 1;
}
else
{
exit (1);
}
break;
}
}
else
{
if (post & 0x10)
post |= 0xfff0;
else
post &= 0x000f;
ea = (*R + post) & 0xffff;
cpu_clk -= 5;
}
}
static void
extended (void)
{
unsigned val = read16 (PC);
PC += 2;
ea = val;
}
/* external register functions */
unsigned
get_a (void)
{
return A;
}
unsigned
get_b (void)
{
return B;
}
unsigned
get_dp (void)
{
return DP >> 8;
}
unsigned
get_x (void)
{
return X;
}
unsigned
get_y (void)
{
return Y;
}
unsigned
get_s (void)
{
return S;
}
unsigned
get_u (void)
{
return U;
}
unsigned
get_pc (void)
{
return PC & 0xffff;
}
unsigned
get_d (void)
{
return (A << 8) | B;
}
#ifdef H6309
unsigned
get_e (void)
{
return E;
}
unsigned
get_f (void)
{
return F;
}
unsigned
get_w (void)
{
return (E << 8) | F;
}
unsigned
get_q (void)
{
return (get_w () << 16) | get_d ();
}
unsigned
get_v (void)
{
return V;
}
unsigned
get_zero (void)
{
return 0;
}
unsigned
get_md (void)
{
return MD;
}
#endif
void
set_a (unsigned val)
{
A = val & 0xff;
}
void
set_b (unsigned val)
{
B = val & 0xff;
}
void
set_dp (unsigned val)
{
DP = (val & 0xff) << 8;
}
void
set_x (unsigned val)
{
X = val & 0xffff;
}
void
set_y (unsigned val)
{
Y = val & 0xffff;
}
void
set_s (unsigned val)
{
S = val & 0xffff;
check_stack ();
}
void
set_u (unsigned val)
{
U = val & 0xffff;
}
void
set_pc (unsigned val)
{
PC = val & 0xffff;
check_pc ();
}
void
set_d (unsigned val)
{
A = (val >> 8) & 0xff;
B = val & 0xff;
}
#ifdef H6309
void
set_e (unsigned val)
{
E = val & 0xff;
}
void
set_f (unsigned val)
{
F = val & 0xff;
}
void
set_w (unsigned val)
{
E = (val >> 8) & 0xff;
F = val & 0xff;
}
void
set_q (unsigned val)
{
set_w ((val >> 16) & 0xffff);
set_d (val & 0xffff);
}
void
set_v (unsigned val)
{
V = val & 0xff;
}
void
set_zero (unsigned val)
{
}
void
set_md (unsigned val)
{
MD = val & 0xff;
}
#endif
/* handle condition code register */
unsigned
get_cc (void)
{
unsigned res = EFI & (E_FLAG | F_FLAG | I_FLAG);
if (H & 0x10)
res |= H_FLAG;
if (N & 0x80)
res |= N_FLAG;
if (Z == 0)
res |= Z_FLAG;
if (OV & 0x80)
res |= V_FLAG;
if (C != 0)
res |= C_FLAG;
return res;
}
void
set_cc (unsigned arg)
{
EFI = arg & (E_FLAG | F_FLAG | I_FLAG);
H = (arg & H_FLAG ? 0x10 : 0);
N = (arg & N_FLAG ? 0x80 : 0);
Z = (~arg) & Z_FLAG;
OV = (arg & V_FLAG ? 0x80 : 0);
C = arg & C_FLAG;
+ cc_changed = 1;
+}
+
+void
+cc_modified (void)
+{
/* Check for pending interrupts */
if (firqs_pending && !(EFI & F_FLAG))
firq ();
else if (irqs_pending && !(EFI & I_FLAG))
irq ();
+ cc_changed = 0;
}
unsigned
get_reg (unsigned nro)
{
unsigned val = 0xff;
switch (nro)
{
case 0:
val = (A << 8) | B;
break;
case 1:
val = X;
break;
case 2:
val = Y;
break;
case 3:
val = U;
break;
case 4:
val = S;
break;
case 5:
val = PC & 0xffff;
break;
#ifdef H6309
case 6:
val = (E << 8) | F;
break;
case 7:
val = V;
break;
#endif
case 8:
val = A;
break;
case 9:
val = B;
break;
case 10:
val = get_cc ();
break;
case 11:
val = DP >> 8;
break;
#ifdef H6309
case 14:
val = E;
break;
case 15:
val = F;
break;
#endif
}
return val;
}
void
set_reg (unsigned nro, unsigned val)
{
switch (nro)
{
case 0:
A = val >> 8;
B = val & 0xff;
break;
case 1:
X = val;
break;
case 2:
Y = val;
break;
case 3:
U = val;
break;
case 4:
S = val;
break;
case 5:
PC = val;
check_pc ();
break;
#ifdef H6309
case 6:
E = val >> 8;
F = val & 0xff;
break;
case 7:
V = val;
break;
#endif
case 8:
A = val;
break;
case 9:
B = val;
break;
case 10:
set_cc (val);
break;
case 11:
DP = val << 8;
break;
#ifdef H6309
case 14:
E = val;
break;
case 15:
F = val;
break;
#endif
}
}
/* 8-Bit Accumulator and Memory Instructions */
static unsigned
adc (unsigned arg, unsigned val)
{
unsigned res = arg + val + (C != 0);
C = (res >> 1) & 0x80;
N = Z = res &= 0xff;
OV = H = arg ^ val ^ res ^ C;
return res;
}
static unsigned
add (unsigned arg, unsigned val)
{
unsigned res = arg + val;
C = (res >> 1) & 0x80;
N = Z = res &= 0xff;
OV = H = arg ^ val ^ res ^ C;
return res;
}
static unsigned
and (unsigned arg, unsigned val)
{
unsigned res = arg & val;
N = Z = res;
OV = 0;
return res;
}
static unsigned
asl (unsigned arg) /* same as lsl */
{
unsigned res = arg << 1;
C = res & 0x100;
N = Z = res &= 0xff;
OV = arg ^ res;
cpu_clk -= 2;
return res;
}
static unsigned
asr (unsigned arg)
{
unsigned res = (INT8) arg;
C = res & 1;
N = Z = res = (res >> 1) & 0xff;
cpu_clk -= 2;
return res;
}
static void
bit (unsigned arg, unsigned val)
{
unsigned res = arg & val;
N = Z = res;
OV = 0;
}
static unsigned
clr (unsigned arg)
{
C = N = Z = OV = arg = 0;
cpu_clk -= 2;
return arg;
}
static void
cmp (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
}
static unsigned
com (unsigned arg)
{
unsigned res = arg ^ 0xff;
N = Z = res;
OV = 0;
C = 1;
cpu_clk -= 2;
return res;
}
static void
daa (void)
{
unsigned res = A;
unsigned msn = res & 0xf0;
unsigned lsn = res & 0x0f;
if (lsn > 0x09 || (H & 0x10))
res += 0x06;
if (msn > 0x80 && lsn > 0x09)
res += 0x60;
if (msn > 0x90 || (C != 0))
res += 0x60;
C |= (res & 0x100);
A = N = Z = res &= 0xff;
OV = 0; /* fix this */
cpu_clk -= 2;
}
static unsigned
dec (unsigned arg)
{
unsigned res = (arg - 1) & 0xff;
N = Z = res;
OV = arg & ~res;
cpu_clk -= 2;
return res;
}
unsigned
eor (unsigned arg, unsigned val)
{
unsigned res = arg ^ val;
N = Z = res;
OV = 0;
return res;
}
static void
exg (void)
{
unsigned tmp1 = 0xff;
unsigned tmp2 = 0xff;
unsigned post = imm_byte ();
if (((post ^ (post << 4)) & 0x80) == 0)
{
tmp1 = get_reg (post >> 4);
tmp2 = get_reg (post & 15);
}
set_reg (post & 15, tmp1);
set_reg (post >> 4, tmp2);
cpu_clk -= 8;
}
static unsigned
inc (unsigned arg)
{
unsigned res = (arg + 1) & 0xff;
N = Z = res;
OV = ~arg & res;
cpu_clk -= 2;
return res;
}
static unsigned
ld (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
return res;
}
static unsigned
lsr (unsigned arg)
{
unsigned res = arg >> 1;
N = 0;
Z = res;
C = arg & 1;
cpu_clk -= 2;
return res;
}
static void
mul (void)
{
unsigned res = (A * B) & 0xffff;
Z = res;
C = res & 0x80;
A = res >> 8;
B = res & 0xff;
cpu_clk -= 11;
}
static unsigned
neg (int arg)
{
unsigned res = (-arg) & 0xff;
C = N = Z = res;
OV = res & arg;
cpu_clk -= 2;
return res;
}
static unsigned
or (unsigned arg, unsigned val)
{
unsigned res = arg | val;
N = Z = res;
OV = 0;
return res;
}
static unsigned
rol (unsigned arg)
{
unsigned res = (arg << 1) + (C != 0);
C = res & 0x100;
N = Z = res &= 0xff;
OV = arg ^ res;
cpu_clk -= 2;
return res;
}
static unsigned
ror (unsigned arg)
{
unsigned res = arg;
if (C != 0)
res |= 0x100;
C = res & 1;
N = Z = res >>= 1;
cpu_clk -= 2;
return res;
}
static unsigned
sbc (unsigned arg, unsigned val)
{
unsigned res = arg - val - (C != 0);
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
return res;
}
static void
st (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
WRMEM (ea, res);
}
static unsigned
sub (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
return res;
}
static void
tst (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
cpu_clk -= 2;
}
static void
tfr (void)
{
unsigned tmp1 = 0xff;
unsigned post = imm_byte ();
if (((post ^ (post << 4)) & 0x80) == 0)
tmp1 = get_reg (post >> 4);
set_reg (post & 15, tmp1);
cpu_clk -= 6;
}
/* 16-Bit Accumulator Instructions */
static void
abx (void)
{
X = (X + B) & 0xffff;
cpu_clk -= 3;
}
static void
addd (unsigned val)
{
unsigned arg = (A << 8) | B;
unsigned res = arg + val;
C = res & 0x10000;
Z = res &= 0xffff;
OV = ((arg ^ res) & (val ^ res)) >> 8;
A = N = res >> 8;
B = res & 0xff;
}
static void
cmp16 (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x10000;
Z = res &= 0xffff;
N = res >> 8;
OV = ((arg ^ val) & (arg ^ res)) >> 8;
}
static void
ldd (unsigned arg)
{
unsigned res = arg;
Z = res;
A = N = res >> 8;
B = res & 0xff;
OV = 0;
}
static unsigned
ld16 (unsigned arg)
{
unsigned res = arg;
Z = res;
N = res >> 8;
OV = 0;
return res;
}
static void
sex (void)
{
unsigned res = B;
Z = res;
N = res &= 0x80;
if (res != 0)
res = 0xff;
A = res;
cpu_clk -= 2;
}
static void
std (void)
{
unsigned res = (A << 8) | B;
Z = res;
N = A;
OV = 0;
WRMEM16 (ea, res);
}
static void
st16 (unsigned arg)
{
unsigned res = arg;
Z = res;
N = res >> 8;
OV = 0;
WRMEM16 (ea, res);
}
static void
subd (unsigned val)
{
unsigned arg = (A << 8) | B;
unsigned res = arg - val;
C = res & 0x10000;
Z = res &= 0xffff;
OV = ((arg ^ val) & (arg ^ res)) >> 8;
A = N = res >> 8;
B = res & 0xff;
}
/* stack instructions */
static void
pshs (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x80)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
}
if (post & 0x40)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, U);
}
if (post & 0x20)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
}
if (post & 0x10)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
}
}
static void
pshu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x80)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, PC & 0xffff);
}
if (post & 0x40)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, S);
}
if (post & 0x20)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, Y);
}
if (post & 0x10)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, get_cc ());
}
}
static void
puls (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
}
static void
pulu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (U));
U = (U + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (U) << 8;
U = (U + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
S = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (U);
check_pc ();
U = (U + 2) & 0xffff;
}
}
/* Miscellaneous Instructions */
static void
nop (void)
{
cpu_clk -= 2;
}
static void
jsr (void)
{
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
change_pc (ea);
monitor_call (0);
}
static void
rti (void)
{
monitor_return ();
cpu_clk -= 6;
command_exit_irq_hook (get_cycles () - irq_start_time);
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
if ((EFI & E_FLAG) != 0)
{
cpu_clk -= 9;
A = read_stack (S);
S = (S + 1) & 0xffff;
B = read_stack (S);
S = (S + 1) & 0xffff;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
static void
rts (void)
{
monitor_return ();
cpu_clk -= 5;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
void
irq (void)
{
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
- EFI |= (I_FLAG | F_FLAG);
+ EFI |= I_FLAG;
irq_start_time = get_cycles ();
change_pc (read16 (0xfff8));
#if 1
irqs_pending = 0;
#endif
}
void
firq (void)
{
- EFI |= E_FLAG;
+ EFI &= ~E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
- change_pc (read16 (0xfffc));
+ change_pc (read16 (0xfff6));
#if 1
firqs_pending = 0;
#endif
}
void
swi (void)
{
cpu_clk -= 19;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
change_pc (read16 (0xfffa));
}
void
swi2 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff4));
}
void
swi3 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff2));
}
void
cwai (void)
{
puts ("CWAI - not supported yet!");
exit (100);
}
void
sync (void)
{
puts ("SYNC - not supported yet!");
exit (100);
cpu_clk -= 4;
}
static void
orcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () | tmp);
cpu_clk -= 3;
}
static void
andcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () & tmp);
cpu_clk -= 3;
}
/* Branch Instructions */
#define cond_HI() ((Z != 0) && (C == 0))
#define cond_LS() ((Z == 0) || (C != 0))
#define cond_HS() (C == 0)
#define cond_LO() (C != 0)
#define cond_NE() (Z != 0)
#define cond_EQ() (Z == 0)
#define cond_VC() ((OV & 0x80) == 0)
#define cond_VS() ((OV & 0x80) != 0)
#define cond_PL() ((N & 0x80) == 0)
#define cond_MI() ((N & 0x80) != 0)
#define cond_GE() (((N^OV) & 0x80) == 0)
#define cond_LT() (((N^OV) & 0x80) != 0)
#define cond_GT() ((((N^OV) & 0x80) == 0) && (Z != 0))
#define cond_LE() ((((N^OV) & 0x80) != 0) || (Z == 0))
static void
bra (void)
{
INT8 tmp = (INT8) imm_byte ();
change_pc (PC + tmp);
}
static void
branch (unsigned cond)
{
if (cond)
bra ();
else
change_pc (PC+1);
cpu_clk -= 3;
}
static void
long_bra (void)
{
INT16 tmp = (INT16) imm_word ();
change_pc (PC + tmp);
}
static void
long_branch (unsigned cond)
{
if (cond)
{
long_bra ();
cpu_clk -= 6;
}
else
{
change_pc (PC + 2);
cpu_clk -= 5;
}
}
static void
long_bsr (void)
{
INT16 tmp = (INT16) imm_word ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 9;
change_pc (ea);
monitor_call (0);
}
static void
bsr (void)
{
INT8 tmp = (INT8) imm_byte ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 7;
change_pc (ea);
monitor_call (0);
}
/* execute 6809 code */
int
cpu_execute (int cycles)
{
unsigned opcode;
cpu_period = cpu_clk = cycles;
do
{
command_insn_hook ();
if (check_break (PC) != 0)
monitor_on = 1;
if (monitor_on != 0)
if (monitor6809 () != 0)
goto cpu_exit;
iPC = PC;
opcode = imm_byte ();
switch (opcode)
{
case 0x00:
direct ();
cpu_clk -= 4;
WRMEM (ea, neg (RDMEM (ea)));
break; /* NEG direct */
#ifdef H6309
case 0x01: /* OIM */
break;
case 0x02: /* AIM */
break;
#endif
case 0x03:
direct ();
cpu_clk -= 4;
WRMEM (ea, com (RDMEM (ea)));
break; /* COM direct */
case 0x04:
direct ();
cpu_clk -= 4;
WRMEM (ea, lsr (RDMEM (ea)));
break; /* LSR direct */
#ifdef H6309
case 0x05: /* EIM */
break;
#endif
case 0x06:
direct ();
cpu_clk -= 4;
WRMEM (ea, ror (RDMEM (ea)));
break; /* ROR direct */
case 0x07:
direct ();
cpu_clk -= 4;
WRMEM (ea, asr (RDMEM (ea)));
break; /* ASR direct */
case 0x08:
direct ();
cpu_clk -= 4;
WRMEM (ea, asl (RDMEM (ea)));
break; /* ASL direct */
case 0x09:
direct ();
cpu_clk -= 4;
WRMEM (ea, rol (RDMEM (ea)));
break; /* ROL direct */
case 0x0a:
direct ();
cpu_clk -= 4;
WRMEM (ea, dec (RDMEM (ea)));
break; /* DEC direct */
#ifdef H6309
case 0x0B: /* TIM */
break;
#endif
case 0x0c:
direct ();
cpu_clk -= 4;
WRMEM (ea, inc (RDMEM (ea)));
break; /* INC direct */
case 0x0d:
direct ();
cpu_clk -= 4;
tst (RDMEM (ea));
break; /* TST direct */
case 0x0e:
direct ();
cpu_clk -= 3;
PC = ea;
check_pc ();
monitor_call (FC_TAIL_CALL);
break; /* JMP direct */
case 0x0f:
direct ();
cpu_clk -= 4;
WRMEM (ea, clr (RDMEM (ea)));
break; /* CLR direct */
case 0x10:
{
opcode = imm_byte ();
switch (opcode)
{
case 0x21:
cpu_clk -= 5;
PC += 2;
break;
case 0x22:
long_branch (cond_HI ());
break;
case 0x23:
long_branch (cond_LS ());
break;
case 0x24:
long_branch (cond_HS ());
break;
case 0x25:
long_branch (cond_LO ());
break;
case 0x26:
long_branch (cond_NE ());
break;
case 0x27:
long_branch (cond_EQ ());
break;
case 0x28:
long_branch (cond_VC ());
break;
case 0x29:
long_branch (cond_VS ());
break;
case 0x2a:
long_branch (cond_PL ());
break;
case 0x2b:
long_branch (cond_MI ());
break;
case 0x2c:
long_branch (cond_GE ());
break;
case 0x2d:
long_branch (cond_LT ());
break;
case 0x2e:
long_branch (cond_GT ());
break;
case 0x2f:
long_branch (cond_LE ());
break;
#ifdef H6309
case 0x30: /* ADDR */
break;
case 0x31: /* ADCR */
break;
case 0x32: /* SUBR */
break;
case 0x33: /* SBCR */
break;
case 0x34: /* ANDR */
break;
case 0x35: /* ORR */
break;
case 0x36: /* EORR */
break;
case 0x37: /* CMPR */
break;
case 0x38: /* PSHSW */
break;
case 0x39: /* PULSW */
break;
case 0x3a: /* PSHUW */
break;
case 0x3b: /* PULUW */
break;
#endif
case 0x3f:
swi2 ();
break;
#ifdef H6309
case 0x40: /* NEGD */
break;
case 0x43: /* COMD */
break;
case 0x44: /* LSRD */
break;
case 0x46: /* RORD */
break;
case 0x47: /* ASRD */
break;
case 0x48: /* ASLD/LSLD */
break;
case 0x49: /* ROLD */
break;
case 0x4a: /* DECD */
break;
case 0x4c: /* INCD */
break;
case 0x4d: /* TSTD */
break;
case 0x4f: /* CLRD */
break;
case 0x53: /* COMW */
break;
case 0x54: /* LSRW */
break;
case 0x56: /* ??RORW */
break;
case 0x59: /* ROLW */
break;
case 0x5a: /* DECW */
break;
case 0x5c: /* INCW */
break;
case 0x5d: /* TSTW */
break;
case 0x5f: /* CLRW */
break;
case 0x80: /* SUBW */
break;
case 0x81: /* CMPW */
break;
case 0x82: /* SBCD */
break;
#endif
case 0x83:
cpu_clk -= 5;
cmp16 (get_d (), imm_word ());
break;
#ifdef H6309
case 0x84: /* ANDD */
break;
case 0x85: /* BITD */
break;
case 0x86: /* LDW */
break;
case 0x88: /* EORD */
break;
case 0x89: /* ADCD */
break;
case 0x8a: /* ORD */
break;
case 0x8b: /* ADDW */
break;
#endif
case 0x8c:
cpu_clk -= 5;
cmp16 (Y, imm_word ());
break;
case 0x8e:
cpu_clk -= 4;
Y = ld16 (imm_word ());
break;
#ifdef H6309
case 0x90: /* SUBW */
break;
case 0x91: /* CMPW */
break;
case 0x92: /* SBCD */
break;
#endif
case 0x93:
direct ();
cpu_clk -= 5;
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0x9c:
direct ();
cpu_clk -= 5;
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0x9e:
direct ();
cpu_clk -= 5;
Y = ld16 (RDMEM16 (ea));
break;
case 0x9f:
direct ();
cpu_clk -= 5;
st16 (Y);
break;
case 0xa3:
cpu_clk--;
indexed ();
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0xac:
cpu_clk--;
indexed ();
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0xae:
cpu_clk--;
indexed ();
Y = ld16 (RDMEM16 (ea));
break;
case 0xaf:
cpu_clk--;
indexed ();
st16 (Y);
break;
case 0xb3:
extended ();
cpu_clk -= 6;
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0xbc:
extended ();
cpu_clk -= 6;
cmp16 (Y, RDMEM16 (ea));
@@ -2557,535 +2565,538 @@ cpu_execute (int cycles)
case 0x93:
direct ();
cpu_clk -= 4;
subd (RDMEM16 (ea));
cpu_clk--;
break;
case 0x94:
direct ();
cpu_clk -= 4;
A = and (A, RDMEM (ea));
break;
case 0x95:
direct ();
cpu_clk -= 4;
bit (A, RDMEM (ea));
break;
case 0x96:
direct ();
cpu_clk -= 4;
A = ld (RDMEM (ea));
break;
case 0x97:
direct ();
cpu_clk -= 4;
st (A);
break;
case 0x98:
direct ();
cpu_clk -= 4;
A = eor (A, RDMEM (ea));
break;
case 0x99:
direct ();
cpu_clk -= 4;
A = adc (A, RDMEM (ea));
break;
case 0x9a:
direct ();
cpu_clk -= 4;
A = or (A, RDMEM (ea));
break;
case 0x9b:
direct ();
cpu_clk -= 4;
A = add (A, RDMEM (ea));
break;
case 0x9c:
direct ();
cpu_clk -= 4;
cmp16 (X, RDMEM16 (ea));
cpu_clk--;
break;
case 0x9d:
direct ();
cpu_clk -= 7;
jsr ();
break;
case 0x9e:
direct ();
cpu_clk -= 4;
X = ld16 (RDMEM16 (ea));
break;
case 0x9f:
direct ();
cpu_clk -= 4;
st16 (X);
break;
case 0xa0:
indexed ();
A = sub (A, RDMEM (ea));
break;
case 0xa1:
indexed ();
cmp (A, RDMEM (ea));
break;
case 0xa2:
indexed ();
A = sbc (A, RDMEM (ea));
break;
case 0xa3:
indexed ();
subd (RDMEM16 (ea));
cpu_clk--;
break;
case 0xa4:
indexed ();
A = and (A, RDMEM (ea));
break;
case 0xa5:
indexed ();
bit (A, RDMEM (ea));
break;
case 0xa6:
indexed ();
A = ld (RDMEM (ea));
break;
case 0xa7:
indexed ();
st (A);
break;
case 0xa8:
indexed ();
A = eor (A, RDMEM (ea));
break;
case 0xa9:
indexed ();
A = adc (A, RDMEM (ea));
break;
case 0xaa:
indexed ();
A = or (A, RDMEM (ea));
break;
case 0xab:
indexed ();
A = add (A, RDMEM (ea));
break;
case 0xac:
indexed ();
cmp16 (X, RDMEM16 (ea));
cpu_clk--;
break;
case 0xad:
indexed ();
cpu_clk -= 3;
jsr ();
break;
case 0xae:
indexed ();
X = ld16 (RDMEM16 (ea));
break;
case 0xaf:
indexed ();
st16 (X);
break;
case 0xb0:
extended ();
cpu_clk -= 5;
A = sub (A, RDMEM (ea));
break;
case 0xb1:
extended ();
cpu_clk -= 5;
cmp (A, RDMEM (ea));
break;
case 0xb2:
extended ();
cpu_clk -= 5;
A = sbc (A, RDMEM (ea));
break;
case 0xb3:
extended ();
cpu_clk -= 5;
subd (RDMEM16 (ea));
cpu_clk--;
break;
case 0xb4:
extended ();
cpu_clk -= 5;
A = and (A, RDMEM (ea));
break;
case 0xb5:
extended ();
cpu_clk -= 5;
bit (A, RDMEM (ea));
break;
case 0xb6:
extended ();
cpu_clk -= 5;
A = ld (RDMEM (ea));
break;
case 0xb7:
extended ();
cpu_clk -= 5;
st (A);
break;
case 0xb8:
extended ();
cpu_clk -= 5;
A = eor (A, RDMEM (ea));
break;
case 0xb9:
extended ();
cpu_clk -= 5;
A = adc (A, RDMEM (ea));
break;
case 0xba:
extended ();
cpu_clk -= 5;
A = or (A, RDMEM (ea));
break;
case 0xbb:
extended ();
cpu_clk -= 5;
A = add (A, RDMEM (ea));
break;
case 0xbc:
extended ();
cpu_clk -= 5;
cmp16 (X, RDMEM16 (ea));
cpu_clk--;
break;
case 0xbd:
extended ();
cpu_clk -= 8;
jsr ();
break;
case 0xbe:
extended ();
cpu_clk -= 5;
X = ld16 (RDMEM16 (ea));
break;
case 0xbf:
extended ();
cpu_clk -= 5;
st16 (X);
break;
case 0xc0:
cpu_clk -= 2;
B = sub (B, imm_byte ());
break;
case 0xc1:
cpu_clk -= 2;
cmp (B, imm_byte ());
break;
case 0xc2:
cpu_clk -= 2;
B = sbc (B, imm_byte ());
break;
case 0xc3:
cpu_clk -= 4;
addd (imm_word ());
break;
case 0xc4:
cpu_clk -= 2;
B = and (B, imm_byte ());
break;
case 0xc5:
cpu_clk -= 2;
bit (B, imm_byte ());
break;
case 0xc6:
cpu_clk -= 2;
B = ld (imm_byte ());
break;
case 0xc8:
cpu_clk -= 2;
B = eor (B, imm_byte ());
break;
case 0xc9:
cpu_clk -= 2;
B = adc (B, imm_byte ());
break;
case 0xca:
cpu_clk -= 2;
B = or (B, imm_byte ());
break;
case 0xcb:
cpu_clk -= 2;
B = add (B, imm_byte ());
break;
case 0xcc:
cpu_clk -= 3;
ldd (imm_word ());
break;
#ifdef H6309
case 0xcd: /* LDQ immed */
break;
#endif
case 0xce:
cpu_clk -= 3;
U = ld16 (imm_word ());
break;
case 0xd0:
direct ();
cpu_clk -= 4;
B = sub (B, RDMEM (ea));
break;
case 0xd1:
direct ();
cpu_clk -= 4;
cmp (B, RDMEM (ea));
break;
case 0xd2:
direct ();
cpu_clk -= 4;
B = sbc (B, RDMEM (ea));
break;
case 0xd3:
direct ();
cpu_clk -= 4;
addd (RDMEM16 (ea));
cpu_clk--;
break;
case 0xd4:
direct ();
cpu_clk -= 4;
B = and (B, RDMEM (ea));
break;
case 0xd5:
direct ();
cpu_clk -= 4;
bit (B, RDMEM (ea));
break;
case 0xd6:
direct ();
cpu_clk -= 4;
B = ld (RDMEM (ea));
break;
case 0xd7:
direct ();
cpu_clk -= 4;
st (B);
break;
case 0xd8:
direct ();
cpu_clk -= 4;
B = eor (B, RDMEM (ea));
break;
case 0xd9:
direct ();
cpu_clk -= 4;
B = adc (B, RDMEM (ea));
break;
case 0xda:
direct ();
cpu_clk -= 4;
B = or (B, RDMEM (ea));
break;
case 0xdb:
direct ();
cpu_clk -= 4;
B = add (B, RDMEM (ea));
break;
case 0xdc:
direct ();
cpu_clk -= 4;
ldd (RDMEM16 (ea));
break;
case 0xdd:
direct ();
cpu_clk -= 4;
std ();
break;
case 0xde:
direct ();
cpu_clk -= 4;
U = ld16 (RDMEM16 (ea));
break;
case 0xdf:
direct ();
cpu_clk -= 4;
st16 (U);
break;
case 0xe0:
indexed ();
B = sub (B, RDMEM (ea));
break;
case 0xe1:
indexed ();
cmp (B, RDMEM (ea));
break;
case 0xe2:
indexed ();
B = sbc (B, RDMEM (ea));
break;
case 0xe3:
indexed ();
addd (RDMEM16 (ea));
cpu_clk--;
break;
case 0xe4:
indexed ();
B = and (B, RDMEM (ea));
break;
case 0xe5:
indexed ();
bit (B, RDMEM (ea));
break;
case 0xe6:
indexed ();
B = ld (RDMEM (ea));
break;
case 0xe7:
indexed ();
st (B);
break;
case 0xe8:
indexed ();
B = eor (B, RDMEM (ea));
break;
case 0xe9:
indexed ();
B = adc (B, RDMEM (ea));
break;
case 0xea:
indexed ();
B = or (B, RDMEM (ea));
break;
case 0xeb:
indexed ();
B = add (B, RDMEM (ea));
break;
case 0xec:
indexed ();
ldd (RDMEM16 (ea));
break;
case 0xed:
indexed ();
std ();
break;
case 0xee:
indexed ();
U = ld16 (RDMEM16 (ea));
break;
case 0xef:
indexed ();
st16 (U);
break;
case 0xf0:
extended ();
cpu_clk -= 5;
B = sub (B, RDMEM (ea));
break;
case 0xf1:
extended ();
cpu_clk -= 5;
cmp (B, RDMEM (ea));
break;
case 0xf2:
extended ();
cpu_clk -= 5;
B = sbc (B, RDMEM (ea));
break;
case 0xf3:
extended ();
cpu_clk -= 5;
addd (RDMEM16 (ea));
cpu_clk--;
break;
case 0xf4:
extended ();
cpu_clk -= 5;
B = and (B, RDMEM (ea));
break;
case 0xf5:
extended ();
cpu_clk -= 5;
bit (B, RDMEM (ea));
break;
case 0xf6:
extended ();
cpu_clk -= 5;
B = ld (RDMEM (ea));
break;
case 0xf7:
extended ();
cpu_clk -= 5;
st (B);
break;
case 0xf8:
extended ();
cpu_clk -= 5;
B = eor (B, RDMEM (ea));
break;
case 0xf9:
extended ();
cpu_clk -= 5;
B = adc (B, RDMEM (ea));
break;
case 0xfa:
extended ();
cpu_clk -= 5;
B = or (B, RDMEM (ea));
break;
case 0xfb:
extended ();
cpu_clk -= 5;
B = add (B, RDMEM (ea));
break;
case 0xfc:
extended ();
cpu_clk -= 5;
ldd (RDMEM16 (ea));
break;
case 0xfd:
extended ();
cpu_clk -= 5;
std ();
break;
case 0xfe:
extended ();
cpu_clk -= 5;
U = ld16 (RDMEM16 (ea));
break;
case 0xff:
extended ();
cpu_clk -= 5;
st16 (U);
break;
default:
cpu_clk -= 2;
sim_error ("invalid opcode '%02X'\n", opcode);
PC = iPC;
break;
}
+
+ if (cc_changed)
+ cc_modified ();
}
while (cpu_clk > 0);
cpu_exit:
cpu_period -= cpu_clk;
cpu_clk = cpu_period;
return cpu_period;
}
void
cpu_reset (void)
{
X = Y = S = U = A = B = DP = 0;
H = N = OV = C = 0;
Z = 1;
EFI = F_FLAG | I_FLAG;
#ifdef H6309
MD = E = F = V = 0;
#endif
change_pc (read16 (0xfffe));
cpu_is_running ();
}
diff --git a/main.c b/main.c
index 9a8241d..159b02c 100644
--- a/main.c
+++ b/main.c
@@ -1,399 +1,400 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/time.h>
#include "6809.h"
enum
{ HEX, S19, BIN };
/* The total number of cycles that have executed */
unsigned long total = 0;
/* The frequency of the emulated CPU, in megahertz */
unsigned int mhz = 1;
/* When nonzero, indicates that the IRQ should be triggered periodically,
every so many cycles. By default no periodic IRQ is generated. */
unsigned int cycles_per_irq = 0;
/* When nonzero, indicates that the FIRQ should be triggered periodically,
every so many cycles. By default no periodic FIRQ is generated. */
unsigned int cycles_per_firq = 0;
/* Nonzero if debugging support is turned on */
int debug_enabled = 0;
/* Nonzero if tracing is enabled */
int trace_enabled = 0;
/* When nonzero, causes the program to print the total number of cycles
on a successful exit. */
int dump_cycles_on_success = 0;
/* When nonzero, indicates the total number of cycles before an automated
exit. This is to help speed through test cases that never finish. */
int max_cycles = 100000000;
static int type = S19;
char *exename;
const char *machine_name = "simple";
const char *prog_name = NULL;
static void usage (void)
{
printf ("Usage: %s <options> filename\n", exename);
printf ("Options are:\n");
printf ("-hex - load intel hex file\n");
printf ("-s19 - load motorola s record file\n");
printf ("-bin - load binary file\n");
printf ("-s addr - specify binary load address hexadecimal (default 0)\n");
printf ("default format is motorola s record\n");
exit (1);
}
void
idle_loop (void)
{
struct timeval now;
static struct timeval last = { 0, 0 };
int real_ms;
static unsigned long last_cycles = 0;
unsigned long cycles;
int sim_ms;
const int cycles_per_ms = 2000;
static int period = 100;
static int count = 100;
int delay;
static int total_ms_elapsed = 0;
if (--count > 0)
return;
if (last.tv_usec == 0)
gettimeofday (&last, NULL);
gettimeofday (&now, NULL);
real_ms = (now.tv_usec - last.tv_usec) / 1000;
if (real_ms < 0)
real_ms += 1000;
last = now;
cycles = get_cycles ();
sim_ms = (cycles - last_cycles) / cycles_per_ms;
if (sim_ms < 0)
sim_ms += cycles_per_ms;
last_cycles = cycles;
total_ms_elapsed += sim_ms;
if (total_ms_elapsed > 100)
{
total_ms_elapsed -= 100;
wpc_periodic ();
command_periodic ();
}
delay = sim_ms - real_ms;
if (delay > 0)
{
if (delay > 60)
period -= 5;
else if (delay < 20)
period += 5;
usleep (delay * 1000UL);
}
count = period;
}
int do_help (const char *arg __attribute__((unused)));
#define NO_NEG 0
#define HAS_NEG 1
#define NO_ARG 0
#define HAS_ARG 1
struct option
{
char o_short;
const char *o_long;
const char *help;
unsigned int can_negate : 1;
unsigned int takes_arg : 1;
int *int_value;
int default_value;
const char **string_value;
int (*handler) (const char *arg);
} option_table[] = {
{ 'd', "debug", "Enter the monitor immediately",
HAS_NEG, NO_ARG, &debug_enabled, 1, NULL, NULL },
{ 'h', "help", NULL,
NO_NEG, NO_ARG, NULL, NULL, 0, do_help },
{ 'b', "binary", "",
NO_NEG, NO_ARG, &type, BIN, NULL, NULL },
{ 'M', "mhz", "", NO_NEG, HAS_ARG },
{ '-', "68a09", "Emulate the 68A09 variation (1.5Mhz)" },
{ '-', "68b09", "Emulate the 68B09 variation (2Mhz)" },
{ 'R', "realtime", "Limit simulation speed to match realtime" },
{ 'I', "irqfreq", "Asserts an IRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_irq, 0, NULL, NULL },
{ 'F', "firqfreq", "Asserts an FIRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_firq, 0, NULL, NULL },
{ 'C', "cycledump", "",
HAS_NEG, NO_ARG, &dump_cycles_on_success, 1, NULL, NULL},
{ 't', "loadmap", "" },
{ 'T', "trace", "",
NO_NEG, NO_ARG, &trace_enabled, 1, NULL, NULL },
{ 'm', "maxcycles", "Sets maximum number of cycles to run",
NO_NEG, HAS_ARG, &max_cycles, 0, NULL, NULL },
{ 's', "machine", "Specify the machine (exact hardware) to emulate",
NO_NEG, HAS_ARG, NULL, 0, &machine_name, NULL },
{ '\0', NULL },
};
int
do_help (const char *arg __attribute__((unused)))
{
struct option *opt = option_table;
while (opt->o_long != NULL)
{
if (opt->help)
{
printf ("-%c,--%s %s\n",
opt->o_short, opt->o_long, opt->help);
}
opt++;
}
return -1;
}
/**
* Returns positive if an argument was taken.
* Returns zero if no argument was taken.
* Returns negative on error.
*/
int
process_option (struct option *opt, const char *arg)
{
int rc;
printf ("Processing option '%s'\n", opt->o_long);
if (opt->takes_arg)
{
if (!arg)
{
printf (" Takes argument but none given.\n");
rc = 0;
}
else
{
if (opt->int_value)
{
*(opt->int_value) = strtoul (arg, NULL, 0);
printf (" Integer argument '%d' taken.\n", *(opt->int_value));
}
else if (opt->string_value)
{
*(opt->string_value) = arg;
printf (" String argument '%s' taken.\n", *(opt->string_value));
}
rc = 1;
}
}
else
{
if (arg)
printf (" Takes no argument but one given, ignored.\n");
if (opt->int_value)
{
*(opt->int_value) = opt->default_value;
printf (" Integer argument 1 implied.\n");
}
rc = 0;
}
if (opt->handler)
{
rc = opt->handler (arg);
printf (" Handler called, rc=%d\n", rc);
}
if (rc < 0)
exit (0);
return rc;
}
int
process_plain_argument (const char *arg)
{
printf ("plain argument '%s'\n", arg);
if (!prog_name)
prog_name = arg;
}
int
parse_args (int argc, char *argv[])
{
int argn = 1;
struct option *opt;
next_arg:
while (argn < argc)
{
char *arg = argv[argn];
if (arg[0] == '-')
{
if (arg[1] == '-')
{
char *rest = strchr (arg+2, '=');
if (rest)
*rest++ = '\0';
opt = option_table;
while (opt->o_long != NULL)
{
if (!strcmp (opt->o_long, arg+2))
{
argn++;
(void)process_option (opt, rest);
goto next_arg;
}
opt++;
}
printf ("long option '%s' not recognized.\n", arg+2);
}
else
{
opt = option_table;
while (opt->o_long != NULL)
{
if (opt->o_short == arg[1])
{
argn++;
if (process_option (opt, argv[argn]))
argn++;
goto next_arg;
}
opt++;
}
printf ("short option '%c' not recognized.\n", arg[1]);
}
argn++;
}
else
{
process_plain_argument (argv[argn++]);
}
}
}
int
main (int argc, char *argv[])
{
int off = 0;
int i, j, n;
int argn = 1;
unsigned int loops = 0;
exename = argv[0];
/* TODO - enable different options by default
based on the executable name. */
parse_args (argc, argv);
sym_init ();
switch (type)
{
case HEX:
if (prog_name && load_hex (prog_name))
usage ();
break;
case S19:
machine_init (machine_name, NULL);
if (prog_name && load_s19 (prog_name))
usage ();
break;
default:
machine_init (machine_name, prog_name);
break;
}
/* Try to load a map file */
if (prog_name)
load_map_file (prog_name);
/* Enable debugging if no executable given yet. */
if (!prog_name)
debug_enabled = 1;
else
/* OK, ready to run. Reset the CPU first. */
cpu_reset ();
monitor_init ();
command_init ();
keybuffering (0);
/* Now, iterate through the instructions.
* If no IRQs or FIRQs are enabled, we can just call cpu_execute()
* and let it run for a long time; otherwise, we need to come back
* here periodically and do the interrupt handling. */
for (cpu_quit = 1; cpu_quit != 0;)
{
if ((cycles_per_irq == 0) && (cycles_per_firq == 0))
{
total += cpu_execute (max_cycles ? max_cycles-1 : 500000);
}
else
{
- /* TODO - FIRQ not handled yet */
total += cpu_execute (cycles_per_irq);
request_irq (0);
+ /* TODO - FIRQ not handled yet */
+ request_firq (0);
}
idle_loop ();
/* Check for a rogue program that won't end */
if ((max_cycles > 0) && (total > max_cycles))
{
sim_error ("maximum cycle count exceeded at %s\n",
monitor_addr_name (get_pc ()));
}
}
printf ("m6809-run stopped after %d cycles\n", total);
return 0;
}
|
bcd/exec09
|
41421a0a42d12c2d3e718cccd6f5f2f0816a3047
|
Fix some compiler warnings.
|
diff --git a/machine.c b/machine.c
index 4e0547b..ac234ad 100644
--- a/machine.c
+++ b/machine.c
@@ -1,648 +1,647 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "machine.h"
#include "eon.h"
#define CONFIG_LEGACY
#define MISSING 0xff
#define mmu_device (device_table[0])
extern void eon_init (const char *);
extern void wpc_init (const char *);
struct machine *machine;
unsigned int device_count = 0;
struct hw_device *device_table[MAX_BUS_DEVICES];
struct bus_map busmaps[NUM_BUS_MAPS];
struct bus_map default_busmaps[NUM_BUS_MAPS];
U16 fault_addr;
U8 fault_type;
int system_running = 0;
void cpu_is_running (void)
{
system_running = 1;
}
/**
* Attach a new device to the bus. Only called during init.
*/
struct hw_device *device_attach (struct hw_class *class_ptr, unsigned int size, void *priv)
{
struct hw_device *dev = malloc (sizeof (struct hw_device));
dev->class_ptr = class_ptr;
dev->devid = device_count;
dev->size = size;
dev->priv = priv;
device_table[device_count++] = dev;
/* Attach implies reset */
class_ptr->reset (dev);
return dev;
};
/**
* Map a portion of a device into the CPU's address space.
*/
void bus_map (unsigned int addr,
unsigned int devid,
unsigned long offset,
unsigned int len,
unsigned int flags)
{
struct bus_map *map;
unsigned int start, count;
/* Warn if trying to map too much */
if (addr + len > MAX_CPU_ADDR)
{
fprintf (stderr, "warning: mapping %04X bytes into %04X causes overflow\n",
len, addr);
}
/* Round address and length to be multiples of the map unit size. */
addr = ((addr + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
len = ((len + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
offset = ((offset + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
/* Convert from byte addresses to unit counts */
start = addr / BUS_MAP_SIZE;
count = len / BUS_MAP_SIZE;
/* Initialize the maps. This will let the CPU access the device. */
map = &busmaps[start];
while (count > 0)
{
if (!(map->flags & MAP_FIXED))
{
map->devid = devid;
map->offset = offset;
map->flags = flags;
}
count--;
map++;
offset += BUS_MAP_SIZE;
}
}
void device_define (struct hw_device *dev,
unsigned long offset,
unsigned int addr,
unsigned int len,
unsigned int flags)
{
bus_map (addr, dev->devid, offset, len, flags);
}
void bus_unmap (unsigned int addr, unsigned int len)
{
struct bus_map *map;
unsigned int start, count;
/* Round address and length to be multiples of the map unit size. */
addr = ((addr + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
len = ((len + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
/* Convert from byte addresses to unit counts */
start = addr / BUS_MAP_SIZE;
count = len / BUS_MAP_SIZE;
/* Set the maps to their defaults. */
memcpy (&busmaps[start], &default_busmaps[start],
sizeof (struct bus_map) * count);
}
/**
* Generate a page fault. ADDR says which address was accessed
* incorrectly. TYPE says what kind of violation occurred.
*/
static struct bus_map *find_map (unsigned int addr)
{
return &busmaps[addr / BUS_MAP_SIZE];
}
static struct hw_device *find_device (unsigned int addr, unsigned char id)
{
/* Fault if any invalid device is accessed */
if ((id == INVALID_DEVID) || (id >= device_count))
machine->fault (addr, FAULT_NO_RESPONSE);
return device_table[id];
}
void
print_device_name (unsigned int devno)
{
struct hw_device *dev = device_table[devno];
printf ("%02X", devno);
}
absolute_address_t
absolute_from_reladdr (unsigned int device, unsigned long reladdr)
{
return (device * 0x10000000L) + reladdr;
}
U8 abs_read8 (absolute_address_t addr)
{
unsigned int id = addr >> 28;
unsigned long phy_addr = addr & 0xFFFFFFF;
struct hw_device *dev = device_table[id];
struct hw_class *class_ptr = dev->class_ptr;
return (*class_ptr->read) (dev, phy_addr);
}
/**
* Called by the CPU to read a byte.
*/
U8 cpu_read8 (unsigned int addr)
{
struct bus_map *map = find_map (addr);
struct hw_device *dev = find_device (addr, map->devid);
struct hw_class *class_ptr = dev->class_ptr;
unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE;
command_read_hook (absolute_from_reladdr (map->devid, phy_addr));
return (*class_ptr->read) (dev, phy_addr);
}
/**
* Called by the CPU to write a byte.
*/
void cpu_write8 (unsigned int addr, U8 val)
{
struct bus_map *map = find_map (addr);
struct hw_device *dev = find_device (addr, map->devid);
struct hw_class *class_ptr = dev->class_ptr;
unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE;
- U8 oldval;
/* This can fail if the area is read-only */
if (system_running && (map->flags & MAP_READONLY))
machine->fault (addr, FAULT_NOT_WRITABLE);
else
(*class_ptr->write) (dev, phy_addr, val);
command_write_hook (absolute_from_reladdr (map->devid, phy_addr), val);
}
void abs_write8 (absolute_address_t addr, U8 val)
{
unsigned int id = addr >> 28;
unsigned long phy_addr = addr & 0xFFFFFFF;
struct hw_device *dev = device_table[id];
struct hw_class *class_ptr = dev->class_ptr;
class_ptr->write (dev, phy_addr, val);
}
absolute_address_t
to_absolute (unsigned long cpuaddr)
{
struct bus_map *map = find_map (cpuaddr);
struct hw_device *dev = find_device (cpuaddr, map->devid);
unsigned long phy_addr = map->offset + cpuaddr % BUS_MAP_SIZE;
return absolute_from_reladdr (map->devid, phy_addr);
}
void dump_machine (void)
{
unsigned int mapno;
unsigned int n;
for (mapno = 0; mapno < NUM_BUS_MAPS; mapno++)
{
struct bus_map *map = &busmaps[mapno];
printf ("Map %d addr=%04X dev=%d offset=%04X size=%06X\n",
mapno, mapno * BUS_MAP_SIZE, map->devid, map->offset,
0 /* device_table[map->devid]->size */);
#if 0
for (n = 0; n < BUS_MAP_SIZE; n++)
printf ("%02X ", cpu_read8 (mapno * BUS_MAP_SIZE + n));
printf ("\n");
#endif
}
}
/**********************************************************/
void null_reset (struct hw_device *dev)
{
}
U8 null_read (struct hw_device *dev, unsigned long addr)
{
return 0;
}
void null_write (struct hw_device *dev, unsigned long addr, U8 val)
{
}
/**********************************************************/
void ram_reset (struct hw_device *dev)
{
memset (dev->priv, 0, dev->size);
}
U8 ram_read (struct hw_device *dev, unsigned long addr)
{
char *buf = dev->priv;
return buf[addr];
}
void ram_write (struct hw_device *dev, unsigned long addr, U8 val)
{
char *buf = dev->priv;
buf[addr] = val;
}
struct hw_class ram_class =
{
.readonly = 0,
.reset = ram_reset,
.read = ram_read,
.write = ram_write,
};
struct hw_device *ram_create (unsigned long size)
{
void *buf = malloc (size);
return device_attach (&ram_class, size, buf);
}
/**********************************************************/
struct hw_class rom_class =
{
.readonly = 1,
.reset = null_reset,
.read = ram_read,
.write = ram_write,
};
struct hw_device *rom_create (const char *filename, unsigned int maxsize)
{
FILE *fp;
struct hw_device *dev;
unsigned int image_size;
char *buf;
if (filename)
{
fp = file_open (NULL, filename, "rb");
if (!fp)
return NULL;
image_size = sizeof_file (fp);
}
buf = malloc (maxsize);
dev = device_attach (&rom_class, maxsize, buf);
if (filename)
{
fread (buf, image_size, 1, fp);
fclose (fp);
maxsize -= image_size;
while (maxsize > 0)
{
memcpy (buf + image_size, buf, image_size);
buf += image_size;
maxsize -= image_size;
}
}
return dev;
}
/**********************************************************/
U8 console_read (struct hw_device *dev, unsigned long addr)
{
switch (addr)
{
case CON_IN:
return getchar ();
default:
return MISSING;
}
}
void console_write (struct hw_device *dev, unsigned long addr, U8 val)
{
switch (addr)
{
case CON_OUT:
putchar (val);
break;
case CON_EXIT:
sim_exit (val);
break;
default:
break;
}
}
struct hw_class console_class =
{
.readonly = 0,
.reset = null_reset,
.read = console_read,
.write = console_write,
};
struct hw_device *console_create (void)
{
return device_attach (&console_class, BUS_MAP_SIZE, NULL);
}
/**********************************************************/
U8 mmu_regs[MMU_PAGECOUNT][MMU_PAGEREGS];
U8 mmu_read (struct hw_device *dev, unsigned long addr)
{
switch (addr)
{
case 0x60:
return fault_addr >> 8;
case 0x61:
return fault_addr & 0xFF;
case 0x62:
return fault_type;
default:
{
unsigned int page = (addr / MMU_PAGEREGS) % MMU_PAGECOUNT;
unsigned int reg = addr % MMU_PAGEREGS;
U8 val = mmu_regs[page][reg];
//printf ("\n%02X, %02X = %02X\n", page, reg, val);
return val;
}
}
}
void mmu_write (struct hw_device *dev, unsigned long addr, U8 val)
{
unsigned int page = (addr / MMU_PAGEREGS) % MMU_PAGECOUNT;
unsigned int reg = addr % MMU_PAGEREGS;
mmu_regs[page][reg] = val;
bus_map (page * MMU_PAGESIZE,
mmu_regs[page][0],
mmu_regs[page][1] * MMU_PAGESIZE,
MMU_PAGESIZE,
mmu_regs[page][2] & 0x1);
}
void mmu_reset (struct hw_device *dev)
{
unsigned int page;
for (page = 0; page < MMU_PAGECOUNT; page++)
{
mmu_write (dev, page * MMU_PAGEREGS + 0, 0);
mmu_write (dev, page * MMU_PAGEREGS + 1, 0);
mmu_write (dev, page * MMU_PAGEREGS + 2, 0);
}
}
void mmu_reset_complete (struct hw_device *dev)
{
unsigned int page;
const struct bus_map *map;
/* Examine all of the bus_maps in place now, and
sync with the MMU registers. */
for (page = 0; page < MMU_PAGECOUNT; page++)
{
map = &busmaps[4 + page * (MMU_PAGESIZE / BUS_MAP_SIZE)];
mmu_regs[page][0] = map->devid;
mmu_regs[page][1] = map->offset / MMU_PAGESIZE;
mmu_regs[page][2] = map->flags & 0x1;
/* printf ("%02X %02X %02X\n",
map->devid, map->offset / MMU_PAGESIZE,
map->flags); */
}
}
struct hw_class mmu_class =
{
.readonly = 0,
.reset = mmu_reset,
.read = mmu_read,
.write = mmu_write,
};
struct hw_device *mmu_create (void)
{
return device_attach (&mmu_class, BUS_MAP_SIZE, NULL);
}
/**********************************************************/
/* The disk drive is emulated as follows:
* The disk is capable of "bus-mastering" and is able to dump data directly
* into the RAM, without CPU-involvement. (The pages do not even need to
* be mapped.) A transaction is initiated with the following parameters:
*
* - address of RAM, aligned to 512 bytes, must reside in lower 32KB.
* Thus there are 64 possible sector locations.
* - address of disk sector, given as a 16-bit value. This allows for up to
* a 32MB disk.
* - direction, either to disk or from disk.
*
* Emulation is synchronous with respect to the CPU.
*/
struct disk_priv
{
FILE *fp;
struct hw_device *dev;
unsigned long offset;
struct hw_device *ramdev;
unsigned int sectors;
char *ram;
};
U8 disk_read (struct hw_device *dev, unsigned long addr)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
}
void disk_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
switch (addr)
{
case DSK_ADDR:
disk->ram = disk->ramdev->priv + val * SECTOR_SIZE;
break;
case DSK_SECTOR:
disk->offset = val; /* high byte */
break;
case DSK_SECTOR+1:
disk->offset = (disk->offset << 8) | val;
disk->offset *= SECTOR_SIZE;
fseek (disk->fp, disk->offset, SEEK_SET);
break;
case DSK_CTRL:
if (val & DSK_READ)
{
fread (disk->ram, SECTOR_SIZE, 1, disk->fp);
}
else if (val & DSK_WRITE)
{
fwrite (disk->ram, SECTOR_SIZE, 1, disk->fp);
}
else if (val & DSK_ERASE)
{
char empty_sector[SECTOR_SIZE];
memset (empty_sector, 0xff, SECTOR_SIZE);
fwrite (empty_sector, SECTOR_SIZE, 1, disk->fp);
}
if (val & DSK_FLUSH)
{
fflush (disk->fp);
}
break;
}
}
void disk_reset (struct hw_device *dev)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
disk_write (dev, DSK_ADDR, 0);
disk_write (dev, DSK_SECTOR, 0);
disk_write (dev, DSK_SECTOR+1, 0);
disk_write (dev, DSK_CTRL, DSK_FLUSH);
}
void disk_format (struct hw_device *dev)
{
unsigned int sector;
struct disk_priv *disk = (struct disk_priv *)dev->priv;
for (sector = 0; sector < disk->sectors; sector++)
{
disk_write (dev, DSK_SECTOR, sector >> 8);
disk_write (dev, DSK_SECTOR+1, sector & 0xFF);
disk_write (dev, DSK_CTRL, DSK_ERASE);
}
disk_write (dev, DSK_CTRL, DSK_FLUSH);
}
struct hw_class disk_class =
{
.readonly = 0,
.reset = disk_reset,
.read = disk_read,
.write = disk_write,
};
struct hw_device *disk_create (const char *backing_file)
{
struct disk_priv *disk = malloc (sizeof (struct disk_priv));
int newdisk = 0;
disk->fp = file_open (NULL, backing_file, "r+b");
if (disk->fp == NULL)
{
printf ("warning: disk does not exist, creating\n");
disk->fp = file_open (NULL, backing_file, "w+b");
newdisk = 1;
if (disk->fp == NULL)
{
printf ("warning: disk not created\n");
}
}
disk->ram = 0;
disk->ramdev = device_table[1];
disk->dev = device_attach (&disk_class, BUS_MAP_SIZE, disk);
disk->sectors = DISK_SECTOR_COUNT;
if (newdisk)
disk_format (disk->dev);
return disk->dev;
}
/**********************************************************/
int machine_match (const char *machine_name, const char *boot_rom_file, struct machine *m)
{
if (!strcmp (m->name, machine_name))
{
machine = m;
m->init (boot_rom_file);
return 1;
}
return 0;
}
void machine_init (const char *machine_name, const char *boot_rom_file)
{
extern struct machine simple_machine;
extern struct machine eon_machine;
extern struct machine wpc_machine;
memset (busmaps, 0, sizeof (busmaps));
if (machine_match (machine_name, boot_rom_file, &simple_machine));
else if (machine_match (machine_name, boot_rom_file, &eon_machine));
else if (machine_match (machine_name, boot_rom_file, &wpc_machine));
else exit (1);
/* Save the default busmap configuration, before the
CPU begins to run, so that it can be restored if
necessary. */
memcpy (default_busmaps, busmaps, sizeof (busmaps));
if (!strcmp (machine_name, "eon"))
mmu_reset_complete (mmu_device);
}
diff --git a/machine.h b/machine.h
index 6490d27..edbd643 100644
--- a/machine.h
+++ b/machine.h
@@ -1,130 +1,133 @@
/*
* Copyright 2006, 2007, 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_MACHINE_H
#define M6809_MACHINE_H
/* This file defines structures used to build generic machines on a 6809. */
typedef unsigned char U8;
typedef unsigned short U16;
typedef unsigned long absolute_address_t;
#define MAX_CPU_ADDR 65536
/* The generic bus architecture. */
/* Up to 32 devices may be connected. Each device is addressed by a 32-bit physical address */
#define MAX_BUS_DEVICES 32
#define INVALID_DEVID 0xff
/* Say whether or not the mapping is RO or RW. */
#define MAP_READWRITE 0x0
#define MAP_READONLY 0x1
/* A fixed map cannot be reprogrammed. Attempts to
bus_map something differently will silently be
ignored. */
#define MAP_FIXED 0x2
#define FAULT_NONE 0
#define FAULT_NOT_WRITABLE 1
#define FAULT_NO_RESPONSE 2
/* A bus map is assocated with part of the 6809 address space
and says what device and which part of it is mapped into that
area. It also has associated flags which say how it is allowed
to be accessed.
A single bus map defines 128 bytes of address space; for a 64KB CPU,
that requires a total of 512 such structures.
Note that the bus map need not correspond to the page size that can
be configured by the MMU. It allows for more granularity and is
needed in some *hardcoded* mapping cases. */
#define BUS_MAP_SIZE 128
struct bus_map
{
unsigned int devid; /* The devid mapped here */
unsigned long offset; /* The offset within the device */
unsigned char flags;
};
#define NUM_BUS_MAPS (MAX_CPU_ADDR / BUS_MAP_SIZE)
/* A hardware device structure exists for each physical device
in the machine */
struct hw_device;
/* A hardware class structure exists for each type of device.
It defines the operations that are allowed on that device.
For example, if there are multiple ROM chips, then there is
a single "ROM" class and multiple ROM device objects. */
struct hw_class
{
/* Nonzero if the device is readonly */
int readonly;
/* Resets the device */
void (*reset) (struct hw_device *dev);
/* Reads a byte at a given offset from the beginning of the device. */
U8 (*read) (struct hw_device *dev, unsigned long phy_addr);
/* Writes a byte at a given offset from the beginning of the device. */
void (*write) (struct hw_device *dev, unsigned long phy_addr, U8 val);
};
struct hw_device
{
/* A pointer to the class object. This says what kind of device it is. */
struct hw_class *class_ptr;
/* The device ID assigned to it. This is filled in automatically
by the simulator. */
unsigned int devid;
/* The total size of the device in bytes. */
unsigned long size;
/* The private pointer, which is interpreted differently for each type
(hw_class) of device. */
void *priv;
};
extern struct machine *machine;
struct machine
{
const char *name;
void (*init) (char *boot_rom_file);
void (*fault) (unsigned int addr, unsigned char type);
void (*dump_thread) (unsigned int thread_id);
};
+struct hw_device *ram_create (unsigned long size);
+struct hw_device *rom_create (const char *filename, unsigned int maxsize);
+
#endif /* _M6809_MACHINE_H */
|
bcd/exec09
|
adb908889ed6f88795319ee7b77d8f1f8dfd4204
|
Remove old-style command-line parsing.
|
diff --git a/main.c b/main.c
index b55be0d..9a8241d 100644
--- a/main.c
+++ b/main.c
@@ -1,460 +1,399 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/time.h>
#include "6809.h"
enum
{ HEX, S19, BIN };
/* The total number of cycles that have executed */
unsigned long total = 0;
/* The frequency of the emulated CPU, in megahertz */
unsigned int mhz = 1;
/* When nonzero, indicates that the IRQ should be triggered periodically,
every so many cycles. By default no periodic IRQ is generated. */
unsigned int cycles_per_irq = 0;
/* When nonzero, indicates that the FIRQ should be triggered periodically,
every so many cycles. By default no periodic FIRQ is generated. */
unsigned int cycles_per_firq = 0;
/* Nonzero if debugging support is turned on */
int debug_enabled = 0;
/* Nonzero if tracing is enabled */
int trace_enabled = 0;
/* When nonzero, causes the program to print the total number of cycles
on a successful exit. */
int dump_cycles_on_success = 0;
/* When nonzero, indicates the total number of cycles before an automated
exit. This is to help speed through test cases that never finish. */
int max_cycles = 100000000;
static int type = S19;
char *exename;
const char *machine_name = "simple";
const char *prog_name = NULL;
static void usage (void)
{
printf ("Usage: %s <options> filename\n", exename);
printf ("Options are:\n");
printf ("-hex - load intel hex file\n");
printf ("-s19 - load motorola s record file\n");
printf ("-bin - load binary file\n");
printf ("-s addr - specify binary load address hexadecimal (default 0)\n");
printf ("default format is motorola s record\n");
exit (1);
}
void
idle_loop (void)
{
struct timeval now;
static struct timeval last = { 0, 0 };
int real_ms;
static unsigned long last_cycles = 0;
unsigned long cycles;
int sim_ms;
const int cycles_per_ms = 2000;
static int period = 100;
static int count = 100;
int delay;
static int total_ms_elapsed = 0;
if (--count > 0)
return;
if (last.tv_usec == 0)
gettimeofday (&last, NULL);
gettimeofday (&now, NULL);
real_ms = (now.tv_usec - last.tv_usec) / 1000;
if (real_ms < 0)
real_ms += 1000;
last = now;
cycles = get_cycles ();
sim_ms = (cycles - last_cycles) / cycles_per_ms;
if (sim_ms < 0)
sim_ms += cycles_per_ms;
last_cycles = cycles;
total_ms_elapsed += sim_ms;
if (total_ms_elapsed > 100)
{
total_ms_elapsed -= 100;
wpc_periodic ();
command_periodic ();
}
delay = sim_ms - real_ms;
if (delay > 0)
{
if (delay > 60)
period -= 5;
else if (delay < 20)
period += 5;
usleep (delay * 1000UL);
}
count = period;
}
int do_help (const char *arg __attribute__((unused)));
#define NO_NEG 0
#define HAS_NEG 1
#define NO_ARG 0
#define HAS_ARG 1
struct option
{
char o_short;
const char *o_long;
const char *help;
unsigned int can_negate : 1;
unsigned int takes_arg : 1;
int *int_value;
int default_value;
const char **string_value;
int (*handler) (const char *arg);
} option_table[] = {
{ 'd', "debug", "Enter the monitor immediately",
HAS_NEG, NO_ARG, &debug_enabled, 1, NULL, NULL },
{ 'h', "help", NULL,
NO_NEG, NO_ARG, NULL, NULL, 0, do_help },
{ 'b', "binary", "",
NO_NEG, NO_ARG, &type, BIN, NULL, NULL },
{ 'M', "mhz", "", NO_NEG, HAS_ARG },
{ '-', "68a09", "Emulate the 68A09 variation (1.5Mhz)" },
{ '-', "68b09", "Emulate the 68B09 variation (2Mhz)" },
{ 'R', "realtime", "Limit simulation speed to match realtime" },
{ 'I', "irqfreq", "Asserts an IRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_irq, 0, NULL, NULL },
{ 'F', "firqfreq", "Asserts an FIRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_firq, 0, NULL, NULL },
{ 'C', "cycledump", "",
HAS_NEG, NO_ARG, &dump_cycles_on_success, 1, NULL, NULL},
{ 't', "loadmap", "" },
{ 'T', "trace", "",
NO_NEG, NO_ARG, &trace_enabled, 1, NULL, NULL },
{ 'm', "maxcycles", "Sets maximum number of cycles to run",
NO_NEG, HAS_ARG, &max_cycles, 0, NULL, NULL },
{ 's', "machine", "Specify the machine (exact hardware) to emulate",
NO_NEG, HAS_ARG, NULL, 0, &machine_name, NULL },
{ '\0', NULL },
};
int
do_help (const char *arg __attribute__((unused)))
{
struct option *opt = option_table;
while (opt->o_long != NULL)
{
if (opt->help)
{
printf ("-%c,--%s %s\n",
opt->o_short, opt->o_long, opt->help);
}
opt++;
}
return -1;
}
/**
* Returns positive if an argument was taken.
* Returns zero if no argument was taken.
* Returns negative on error.
*/
int
process_option (struct option *opt, const char *arg)
{
int rc;
printf ("Processing option '%s'\n", opt->o_long);
if (opt->takes_arg)
{
if (!arg)
{
printf (" Takes argument but none given.\n");
rc = 0;
}
else
{
if (opt->int_value)
{
*(opt->int_value) = strtoul (arg, NULL, 0);
printf (" Integer argument '%d' taken.\n", *(opt->int_value));
}
else if (opt->string_value)
{
*(opt->string_value) = arg;
printf (" String argument '%s' taken.\n", *(opt->string_value));
}
rc = 1;
}
}
else
{
if (arg)
printf (" Takes no argument but one given, ignored.\n");
if (opt->int_value)
{
*(opt->int_value) = opt->default_value;
printf (" Integer argument 1 implied.\n");
}
rc = 0;
}
if (opt->handler)
{
rc = opt->handler (arg);
printf (" Handler called, rc=%d\n", rc);
}
if (rc < 0)
exit (0);
return rc;
}
int
process_plain_argument (const char *arg)
{
printf ("plain argument '%s'\n", arg);
if (!prog_name)
prog_name = arg;
}
int
parse_args (int argc, char *argv[])
{
int argn = 1;
struct option *opt;
next_arg:
while (argn < argc)
{
char *arg = argv[argn];
if (arg[0] == '-')
{
if (arg[1] == '-')
{
char *rest = strchr (arg+2, '=');
if (rest)
*rest++ = '\0';
opt = option_table;
while (opt->o_long != NULL)
{
if (!strcmp (opt->o_long, arg+2))
{
argn++;
(void)process_option (opt, rest);
goto next_arg;
}
opt++;
}
printf ("long option '%s' not recognized.\n", arg+2);
}
else
{
opt = option_table;
while (opt->o_long != NULL)
{
if (opt->o_short == arg[1])
{
argn++;
if (process_option (opt, argv[argn]))
argn++;
goto next_arg;
}
opt++;
}
printf ("short option '%c' not recognized.\n", arg[1]);
}
argn++;
}
else
{
process_plain_argument (argv[argn++]);
}
}
}
int
main (int argc, char *argv[])
{
int off = 0;
int i, j, n;
int argn = 1;
unsigned int loops = 0;
exename = argv[0];
/* TODO - enable different options by default
based on the executable name. */
-#if 1
parse_args (argc, argv);
-#else
- while (argn < argc)
- {
- if (argv[argn][0] == '-')
- {
- int argpos = 1;
- next_arg:
- switch (argv[argn][argpos++])
- {
- case 'd':
- debug_enabled = 1;
- goto next_arg;
- case 'h':
- type = HEX;
- goto next_arg;
- case 'b':
- type = BIN;
- goto next_arg;
- case 'M':
- mhz = strtoul (argv[++argn], NULL, 16);
- break;
- case 'o':
- off = strtoul (argv[++argn], NULL, 16);
- type = BIN;
- break;
- case 'I':
- cycles_per_irq = strtoul (argv[++argn], NULL, 0);
- break;
- case 'F':
- cycles_per_firq = strtoul (argv[++argn], NULL, 0);
- break;
- case 'C':
- dump_cycles_on_success = 1;
- goto next_arg;
- case 'T':
- trace_enabled = 1;
- goto next_arg;
- case 'm':
- max_cycles = strtoul (argv[++argn], NULL, 16);
- break;
- case 's':
- machine_name = argv[++argn];
- break;
- case '\0':
- break;
- default:
- usage ();
- }
- }
- else if (!prog_name)
- {
- prog_name = argv[argn];
- }
- else
- {
- usage ();
- }
- argn++;
- }
-#endif
sym_init ();
switch (type)
{
case HEX:
if (prog_name && load_hex (prog_name))
usage ();
break;
case S19:
machine_init (machine_name, NULL);
if (prog_name && load_s19 (prog_name))
usage ();
break;
default:
machine_init (machine_name, prog_name);
break;
}
/* Try to load a map file */
if (prog_name)
load_map_file (prog_name);
/* Enable debugging if no executable given yet. */
if (!prog_name)
debug_enabled = 1;
else
/* OK, ready to run. Reset the CPU first. */
cpu_reset ();
monitor_init ();
command_init ();
keybuffering (0);
/* Now, iterate through the instructions.
* If no IRQs or FIRQs are enabled, we can just call cpu_execute()
* and let it run for a long time; otherwise, we need to come back
* here periodically and do the interrupt handling. */
for (cpu_quit = 1; cpu_quit != 0;)
{
if ((cycles_per_irq == 0) && (cycles_per_firq == 0))
{
total += cpu_execute (max_cycles ? max_cycles-1 : 500000);
}
else
{
/* TODO - FIRQ not handled yet */
total += cpu_execute (cycles_per_irq);
request_irq (0);
}
idle_loop ();
/* Check for a rogue program that won't end */
if ((max_cycles > 0) && (total > max_cycles))
{
sim_error ("maximum cycle count exceeded at %s\n",
monitor_addr_name (get_pc ()));
}
}
printf ("m6809-run stopped after %d cycles\n", total);
return 0;
}
|
bcd/exec09
|
8bf7279aecc13a8c948c948aa029b0a221ae1a1e
|
Initial DMD paging implementation.
|
diff --git a/wpc.c b/wpc.c
index bcfdc2a..1a6eda7 100644
--- a/wpc.c
+++ b/wpc.c
@@ -1,593 +1,643 @@
/*
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include <sys/time.h>
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
-#define WPC_ASIC_BASE 0x3800
+#define WPC_ASIC_BASE 0x3c00
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
+ struct hw_device *dmd_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
U8 opto_mx[8];
+ U8 dmd_maps[2];
+ U8 dmd_active_page;
int curr_sw;
int curr_sw_time;
int wdog_timer;
};
struct wpc_asic *global_wpc;
void wpc_asic_reset (struct hw_device *dev)
{
struct wpc_asic *wpc = dev->priv;
global_wpc = wpc;
wpc->curr_sw_time = 0;
wpc->wdog_timer = 0;
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
#if 1
return rc;
#endif
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
rc |= WPC_DEBUG_READ_READY;
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
unsigned int wpc_read_switch (struct wpc_asic *wpc, int num)
{
unsigned int val;
val = wpc->switch_mx[num / 8] & (1 << (num % 8));
- // printf ("SW %d = %d\n", num, val);
return val ? 1 : 0;
}
void wpc_write_switch (struct wpc_asic *wpc, int num, int flag)
{
unsigned int col, val;
col = num / 8;
val = 1 << (num % 8);
if (wpc->opto_mx[col] & val)
flag = !flag;
wpc->switch_mx[col] &= ~val;
if (flag)
wpc->switch_mx[col] |= val;
}
void wpc_press_switch (struct wpc_asic *wpc, int num, int delay)
{
wpc_write_switch (wpc, num, 1);
wpc->curr_sw = num;
wpc->curr_sw_time = delay;
}
unsigned int wpc_read_switch_column (struct wpc_asic *wpc, int col)
{
unsigned int val = 0;
int row;
for (row = 0; row < 8; row++)
if (wpc_read_switch (wpc, col * 8 + row))
val |= (1 << row);
return val;
}
void wpc_write_lamp (int num, int flag)
{
}
void wpc_write_sol (int num, int flag)
{
}
+void wpc_print_display (struct wpc_asic *wpc)
+{
+ FILE *fp;
+ char *p = wpc->dmd_dev->priv + wpc->dmd_active_page * 512;
+
+ if (wpc->dmd_active_page >= 14)
+ return;
+
+ fp = fopen ("dmd", "wb");
+ if (!fp)
+ {
+ fprintf (stderr, "could not write to DMD!!!\n");
+ return;
+ }
+ fwrite (p, 512, 1, fp);
+ fclose (fp);
+}
+
+
void wpc_keypoll (struct wpc_asic *wpc)
{
fd_set fds;
struct timeval timeout;
int rc;
unsigned char c;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
{
rc = read (0, &c, 1);
- //printf ("%c pressed\n", c);
switch (c)
{
case '7':
wpc_press_switch (wpc, 4, 200);
break;
case '8':
wpc_press_switch (wpc, 5, 200);
break;
case '9':
wpc_press_switch (wpc, 6, 200);
break;
case '0':
wpc_press_switch (wpc, 7, 200);
break;
+ case 'd':
+ wpc_print_display (wpc);
+ break;
default:
break;
}
}
}
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
struct wpc_asic *wpc = dev->priv;
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit / 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
case WPC_SW_ROW_INPUT:
val = wpc_read_switch_column (wpc, 1 + scanbit (wpc->switch_strobe));
break;
case WPC_SW_JUMPER_INPUT:
val = 0x55;
break;
case WPC_SW_CABINET_INPUT:
val = wpc_read_switch_column (wpc, 0);
break;
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (struct wpc_asic *wpc)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_set_rom_page (unsigned char val)
{
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
}
+void wpc_set_dmd_page (struct wpc_asic *wpc, unsigned int map, unsigned char val)
+{
+ wpc->dmd_maps[map] = val;
+ bus_map (0x3800 + map * 0x200, 3, val * 0x200, 0x200, MAP_READWRITE);
+}
+
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct wpc_asic *wpc = dev->priv;
switch (addr + WPC_ASIC_BASE)
{
+ case WPC_DMD_LOW_PAGE:
+ wpc_set_dmd_page (wpc, 0, val);
+ break;
+
+ case WPC_DMD_HIGH_PAGE:
+ wpc_set_dmd_page (wpc, 1, val);
+ break;
+
+ case WPC_DMD_FIRQ_ROW_VALUE:
+ break;
+
+ case WPC_DMD_ACTIVE_PAGE:
+ wpc->dmd_active_page = val;
+ wpc_print_display (wpc);
+ break;
+
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
wpc->wdog_timer++;
break;
case WPC_ROM_BANK:
wpc->rombank = val;
wpc_set_rom_page (val);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram (wpc);
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram (wpc);
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
case WPC_SW_COL_STROBE:
wpc->switch_strobe = val;
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
struct wpc_asic *wpc = global_wpc;
wpc_keypoll (wpc);
wpc->wdog_timer -= 50;
if (wpc->wdog_timer <= 0)
{
}
if (wpc->curr_sw_time > 0)
{
wpc->curr_sw_time -= 100;
if (wpc->curr_sw_time <= 0)
{
wpc->curr_sw_time = 0;
wpc_write_switch (wpc, wpc->curr_sw, 0);
}
}
}
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
struct wpc_asic *wpc = calloc (sizeof (struct wpc_asic), 1);
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
void io_sym_add (const char *name, unsigned long cpuaddr)
{
sym_add (&program_symtab, name, to_absolute (cpuaddr), 0);
}
#define IO_SYM_ADD(name) io_sym_add (#name, name)
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
struct wpc_asic *wpc;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
wpc = dev->priv;
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
+
+ device_define ( dev = ram_create (16 * 512), 0,
+ 0x3800, 0x200 * 2, MAP_READWRITE );
+ wpc->dmd_dev = dev;
+
wpc_update_ram (wpc);
+ IO_SYM_ADD(WPC_DMD_LOW_BASE);
+ IO_SYM_ADD(WPC_DMD_HIGH_BASE);
IO_SYM_ADD(WPC_DMD_HIGH_PAGE);
IO_SYM_ADD(WPC_DMD_FIRQ_ROW_VALUE);
IO_SYM_ADD(WPC_DMD_LOW_PAGE);
IO_SYM_ADD(WPC_DMD_ACTIVE_PAGE);
IO_SYM_ADD(WPC_SERIAL_STATUS_PORT);
IO_SYM_ADD(WPC_PARALLEL_DATA_PORT);
IO_SYM_ADD(WPC_PARALLEL_STROBE_PORT);
IO_SYM_ADD(WPC_SERIAL_DATA_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_CONTROL_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_BAUD_SELECT);
IO_SYM_ADD(WPC_TICKET_DISPENSE);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_OUT);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_IN);
IO_SYM_ADD(WPC_DCS_SOUND_RESET);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_READY);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_A);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_B);
IO_SYM_ADD(WPCS_DATA);
IO_SYM_ADD(WPCS_CONTROL_STATUS);
IO_SYM_ADD(WPC_SOL_FLASH2_OUTPUT);
IO_SYM_ADD(WPC_SOL_HIGHPOWER_OUTPUT);
IO_SYM_ADD(WPC_SOL_FLASH1_OUTPUT);
IO_SYM_ADD(WPC_SOL_LOWPOWER_OUTPUT);
IO_SYM_ADD(WPC_LAMP_ROW_OUTPUT);
IO_SYM_ADD(WPC_LAMP_COL_STROBE);
IO_SYM_ADD(WPC_GI_TRIAC);
IO_SYM_ADD(WPC_SW_JUMPER_INPUT);
IO_SYM_ADD(WPC_SW_CABINET_INPUT);
IO_SYM_ADD(WPC_SW_ROW_INPUT);
IO_SYM_ADD(WPC_SW_COL_STROBE);
IO_SYM_ADD(WPC_LEDS);
IO_SYM_ADD(WPC_RAM_BANK);
IO_SYM_ADD(WPC_SHIFTADDR);
IO_SYM_ADD(WPC_SHIFTBIT);
IO_SYM_ADD(WPC_SHIFTBIT2);
IO_SYM_ADD(WPC_PERIPHERAL_TIMER_FIRQ_CLEAR);
IO_SYM_ADD(WPC_ROM_LOCK);
IO_SYM_ADD(WPC_CLK_HOURS_DAYS);
IO_SYM_ADD(WPC_CLK_MINS);
IO_SYM_ADD(WPC_ROM_BANK);
IO_SYM_ADD(WPC_RAM_LOCK);
IO_SYM_ADD(WPC_RAM_LOCKSIZE);
}
struct machine wpc_machine =
{
.name = "wpc",
.fault = wpc_fault,
.init = wpc_init,
};
-
-
|
bcd/exec09
|
3165a5190f3f4dbd3e2298116c67ab10a1169fd4
|
Add the tracedump (td) command.
|
diff --git a/command.c b/command.c
index 5d1b323..9c609c7 100644
--- a/command.c
+++ b/command.c
@@ -1,1484 +1,1521 @@
#include "6809.h"
#include "monitor.h"
#include "machine.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/errno.h>
#include <termios.h>
typedef struct
{
unsigned int size;
unsigned int count;
char **strings;
} cmdqueue_t;
/**********************************************************/
/********************* Global Data ************************/
/**********************************************************/
unsigned int break_count = 0;
breakpoint_t breaktab[MAX_BREAKS];
unsigned int active_break_count = 0;
unsigned int display_count = 0;
display_t displaytab[MAX_DISPLAYS];
unsigned int history_count = 0;
unsigned long historytab[MAX_HISTORY];
absolute_address_t examine_addr = 0;
unsigned int examine_repeat = 1;
datatype_t examine_type;
unsigned int thread_id_size = 2;
absolute_address_t thread_current;
absolute_address_t thread_id = 0;
thread_t threadtab[MAX_THREADS];
#define MAX_CMD_QUEUES 8
int command_stack_depth = -1;
cmdqueue_t command_stack[MAX_CMD_QUEUES];
+#define MAX_TRACE 256
+target_addr_t trace_buffer[MAX_TRACE];
+unsigned int trace_offset = 0;
+
int stop_after_ms = 0;
datatype_t print_type;
char *command_flags;
int exit_command_loop;
#define IRQ_CYCLE_COUNTS 128
unsigned int irq_cycle_tab[IRQ_CYCLE_COUNTS] = { 0, };
unsigned int irq_cycle_entry = 0;
unsigned long irq_cycles = 0;
unsigned long eval (char *expr);
unsigned long eval_mem (char *expr);
extern int auto_break_insn_count;
FILE *command_input;
/**********************************************************/
/******************** 6809 Functions **********************/
/**********************************************************/
void
print_addr (absolute_address_t addr)
{
const char *name;
print_device_name (addr >> 28);
putchar (':');
printf ("0x%04X", addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
printf (" <%-16.16s>", name);
else
printf ("%-20.20s", "");
}
/**********************************************************/
/*********************** Functions ************************/
/**********************************************************/
void
syntax_error (const char *string)
{
fprintf (stderr, "error: %s\n", string);
}
void
save_value (unsigned long val)
{
historytab[history_count++ % MAX_HISTORY] = val;
}
unsigned long
eval_historical (unsigned int id)
{
return historytab[id % MAX_HISTORY];
}
void
assign_virtual (const char *name, unsigned long val)
{
unsigned long v_val;
if (!sym_find (&auto_symtab, name, &v_val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)v_val;
virtual (&val, 1);
return;
}
sym_set (&internal_symtab, name, val, 0);
if (!strcmp (name, "thread_current"))
{
printf ("Thread pointer initialized to ");
print_addr (val);
putchar ('\n');
thread_current = val;
}
}
unsigned long
eval_virtual (const char *name)
{
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
if (!sym_find (&auto_symtab, name, &val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)val;
virtual (&val, 0);
}
else if (!sym_find (&internal_symtab, name, &val, 0))
{
}
else
{
return 0;
}
return val;
}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
else
{
absolute_address_t dst = eval_mem (expr);
//printf ("Setting %X to %02X\n", dst, val);
abs_write8 (dst, val);
}
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
case 'o':
case 'a':
case 's':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
char *
match_binary (char *expr, const char *op, char **secondp)
{
char *p;
p = strstr (expr, op);
if (!p)
return NULL;
*p = '\0';
p += strlen (op);
*secondp = p;
return expr;
}
int
fold_comparisons (char *expr, unsigned long *value)
{
char *p;
if (match_binary (expr, "==", &p))
*value = (eval (expr) == eval (p));
else if (match_binary (expr, "!=", &p))
*value = (eval (expr) != eval (p));
else
return 0;
return 1;
}
int
fold_binary (char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
eval_mem (char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
/* TODO - if expr is already in absolute form,
this explodes ! */
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
eval (char *expr)
{
char *p;
unsigned long val;
if (fold_comparisons (expr, &val));
else if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
unsigned int size = 1;
expr++;
if (*expr == '*')
{
expr++;
size = 2;
}
absolute_address_t addr = eval_mem (expr);
return target_read (addr, size);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
br->keep_running = 0;
br->ignore_count = 0;
br->temp = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
void
brkfree_temps (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].used && breaktab[n].temp)
{
brkfree (&breaktab[n]);
}
}
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
if (brkpt->keep_running)
printf (", print-only");
if (brkpt->temp)
printf (", temp");
if (brkpt->ignore_count)
printf (", ignore %d times\n", brkpt->ignore_count);
if (brkpt->write_mask)
printf (", mask %02X\n", brkpt->write_mask);
putchar ('\n');
}
display_t *
display_alloc (void)
{
unsigned int n;
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (!ds->used)
{
ds->used = 1;
return ds;
}
}
}
void
display_free (display_t *ds)
{
}
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
switch (typep->format)
{
case 'a':
print_addr (val);
return;
case 's':
{
absolute_address_t addr = (absolute_address_t)val;
char c;
putchar ('"');
while ((c = abs_read8 (addr++)) != '\0')
putchar (c);
putchar ('"');
return;
}
}
if (typep->format == 'x')
{
printf ("0x");
sprintf (f, "%%0%d%c", typep->size * 2, typep->format);
}
else if (typep->format == 'o')
{
printf ("0");
sprintf (f, "%%%c", typep->format);
}
else
sprintf (f, "%%%c", typep->format);
printf (f, val);
}
void
display_print (void)
{
unsigned int n;
char comma = '\0';
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (ds->used)
{
char expr[256];
strcpy (expr, ds->expr);
printf ("%c %s = ", comma, expr);
print_value (eval (expr), &ds->type);
comma = ',';
}
}
if (comma)
putchar ('\n');
}
int
print_insn (absolute_address_t addr)
{
char buf[64];
int size = dasm (buf, addr);
printf ("%s", buf);
return size;
}
void
do_examine (void)
{
unsigned int n;
unsigned int objs_per_line = 16;
if (isdigit (*command_flags))
examine_repeat = strtoul (command_flags, &command_flags, 0);
if (*command_flags == 'i')
examine_type.format = *command_flags;
else
parse_format_flag (command_flags, &examine_type.format);
parse_size_flag (command_flags, &examine_type.size);
switch (examine_type.format)
{
case 'i':
objs_per_line = 1;
break;
case 'w':
objs_per_line = 8;
break;
}
for (n = 0; n < examine_repeat; n++)
{
if ((n % objs_per_line) == 0)
{
putchar ('\n');
print_addr (examine_addr);
printf (": ");
}
switch (examine_type.format)
{
case 's': /* string */
break;
case 'i': /* instruction */
examine_addr += print_insn (examine_addr);
break;
default:
print_value (target_read (examine_addr, examine_type.size),
&examine_type);
putchar (' ');
examine_addr += examine_type.size;
}
}
putchar ('\n');
}
void
do_print (char *expr)
{
unsigned long val = eval (expr);
printf ("$%d = ", history_count);
parse_format_flag (command_flags, &print_type.format);
parse_size_flag (command_flags, &print_type.size);
print_value (val, &print_type);
putchar ('\n');
save_value (val);
}
void
do_set (char *expr)
{
unsigned long val = eval (expr);
save_value (val);
}
#define THREAD_DATA_PC 3
#define THREAD_DATA_ROMBANK 9
void
print_thread_data (absolute_address_t th)
{
U8 b;
U16 w;
absolute_address_t pc;
w = abs_read16 (th + THREAD_DATA_PC);
b = abs_read8 (th + THREAD_DATA_ROMBANK);
printf ("{ PC = %04X, BANK = %02X }", w, b);
}
void
command_change_thread (void)
{
target_addr_t addr = target_read (thread_current, thread_id_size);
absolute_address_t th = to_absolute (addr);
if (th == thread_id)
return;
thread_id = th;
if (machine->dump_thread && eval ("$thread_debug"))
{
if (addr)
{
printf ("[Current thread = ");
print_addr (thread_id);
machine->dump_thread (thread_id);
print_thread_data (thread_id);
printf ("]\n");
}
else
{
printf ("[ No thread ]\n");
}
}
}
void
command_stack_push (unsigned int reason)
{
cmdqueue_t *q = &command_stack[++command_stack_depth];
}
void
command_stack_pop (void)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
--command_stack_depth;
}
void
command_stack_add (const char *cmd)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
}
char *
getarg (void)
{
return strtok (NULL, " \t\n");
}
/****************** Command Handlers ************************/
void cmd_print (void)
{
char *arg = getarg ();
if (arg)
do_print (arg);
else
do_print ("$");
}
void cmd_set (void)
{
char *arg = getarg ();
if (arg)
do_set (arg);
else
do_set ("$");
}
void cmd_examine (void)
{
char *arg = getarg ();
if (arg)
examine_addr = eval_mem (arg);
do_examine ();
}
void cmd_break (void)
{
char *arg = getarg ();
if (!arg)
return;
unsigned long val = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = val;
br->on_execute = 1;
arg = getarg ();
if (!arg);
else if (!strcmp (arg, "if"))
{
br->conditional = 1;
arg = getarg ();
strcpy (br->condition, arg);
}
else if (!strcmp (arg, "ignore"))
{
br->ignore_count = atoi (getarg ());
}
brkprint (br);
}
void cmd_watch1 (int on_read, int on_write)
{
char *arg;
arg = getarg ();
if (!arg)
return;
absolute_address_t addr = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = addr;
br->on_read = on_read;
br->on_write = on_write;
for (;;)
{
arg = getarg ();
if (!arg)
return;
if (!strcmp (arg, "print"))
br->keep_running = 1;
else if (!strcmp (arg, "mask"))
{
arg = getarg ();
br->write_mask = strtoul (arg, NULL, 0);
}
else if (!strcmp (arg, "if"))
{
arg = getarg ();
br->conditional = 1;
strcpy (br->condition, arg);
}
}
brkprint (br);
}
void cmd_watch (void)
{
cmd_watch1 (0, 1);
}
void cmd_rwatch (void)
{
cmd_watch1 (1, 0);
}
void cmd_awatch (void)
{
cmd_watch1 (1, 1);
}
void cmd_break_list (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
brkprint (&breaktab[n]);
}
void cmd_step (void)
{
auto_break_insn_count = 1;
exit_command_loop = 0;
}
void cmd_next (void)
{
char buf[128];
breakpoint_t *br;
unsigned long addr = to_absolute (get_pc ());
addr += dasm (buf, addr);
br = brkalloc ();
br->addr = addr;
br->on_execute = 1;
br->temp = 1;
/* TODO - for conditional branches, should also set a
temp breakpoint at the branch target */
exit_command_loop = 0;
}
void cmd_continue (void)
{
exit_command_loop = 0;
}
void cmd_quit (void)
{
cpu_quit = 0;
exit_command_loop = 1;
}
void cmd_delete (void)
{
const char *arg = getarg ();
unsigned int id;
if (!arg)
{
int n;
printf ("Deleting all breakpoints.\n");
for (id = 0; id < MAX_BREAKS; id++)
{
breakpoint_t *br = brkfind_by_id (id);
brkfree (br);
}
return;
}
id = atoi (arg);
breakpoint_t *br = brkfind_by_id (id);
if (br->used)
{
printf ("Deleting breakpoint %d\n", id);
brkfree (br);
}
}
void cmd_list (void)
{
char *arg;
static absolute_address_t lastpc = 0;
static absolute_address_t lastaddr = 0;
absolute_address_t addr;
int n;
arg = getarg ();
if (arg)
addr = eval_mem (arg);
else
{
addr = to_absolute (get_pc ());
if (addr == lastpc)
addr = lastaddr;
else
lastaddr = lastpc = addr;
}
for (n = 0; n < 10; n++)
{
print_addr (addr);
printf (" : ");
addr += print_insn (addr);
putchar ('\n');
}
lastaddr = addr;
}
void cmd_symbol_file (void)
{
char *arg = getarg ();
if (arg)
load_map_file (arg);
}
void cmd_display (void)
{
char *arg;
while ((arg = getarg ()) != NULL)
{
display_t *ds = display_alloc ();
strcpy (ds->expr, arg);
ds->type = print_type;
parse_format_flag (command_flags, &ds->type.format);
parse_size_flag (command_flags, &ds->type.size);
}
}
int command_exec_file (const char *filename)
{
FILE *infile;
extern int command_exec (FILE *);
infile = file_open (NULL, filename, "r");
if (!infile)
return 0;
command_input = infile;
return 1;
}
void cmd_source (void)
{
char *arg = getarg ();
if (!arg)
return;
if (command_exec_file (arg) == 0)
fprintf (stderr, "can't open %s\n", arg);
}
void cmd_regs (void)
{
}
void cmd_vars (void)
{
for_each_var (NULL);
}
void cmd_runfor (void)
{
char *arg = getarg ();
int secs = atoi (arg);
stop_after_ms = secs * 1000;
}
void cmd_measure (void)
{
absolute_address_t addr;
target_addr_t retaddr = get_pc ();
breakpoint_t *br;
/* Get the address of the function to be measured. */
char *arg = getarg ();
if (!arg)
return;
addr = eval_mem (arg);
printf ("Measuring ");
print_addr (addr);
printf (" back to ");
print_addr (to_absolute (retaddr));
putchar ('\n');
/* Push the current PC onto the stack for the
duration of the measurement. */
set_s (get_s () - 2);
write16 (get_s (), retaddr);
/* Set a temp breakpoint at the current PC, so that
the measurement will halt. */
br = brkalloc ();
br->addr = to_absolute (retaddr);
br->on_execute = 1;
br->temp = 1;
/* Interrupts must be disabled for this to work ! */
set_cc (get_cc () | 0x50);
/* Change the PC to the function-under-test. */
set_pc (addr);
/* Go! */
exit_command_loop = 0;
}
void cmd_dump (void)
{
extern int dump_every_insn;
char *arg = getarg ();
if (arg)
dump_every_insn = strtoul (arg, NULL, 0);
printf ("Instruction dump is %s\n",
dump_every_insn ? "on" : "off");
}
+void
+cmd_trace_dump (void)
+{
+ unsigned int off = (trace_offset + 1) % MAX_TRACE;
+ do {
+ target_addr_t pc = trace_buffer[off];
+ absolute_address_t addr = to_absolute (pc);
+ //const char *name = sym_lookup (&program_symtab, addr);
+ //printf ("%04X ", pc);
+ print_addr (addr);
+ putchar (':');
+ print_insn (addr);
+ putchar ('\n');
+ //putchar (name ? '\n' : ' ');
+ off = (off + 1) % MAX_TRACE;
+ } while (off != trace_offset);
+ fflush (stdout);
+}
+
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
{ "s", "step", cmd_step,
"Step one instruction" },
{ "n", "next", cmd_next,
"Break at the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
{ "wa", "watch", cmd_watch,
"Add a watchpoint on write" },
{ "rwa", "rwatch", cmd_rwatch,
"Add a watchpoint on read" },
{ "awa", "awatch", cmd_awatch,
"Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
{ "l", "list", cmd_list },
{ "sym", "symbol-file", cmd_symbol_file,
"Open a symbol table file" },
{ "di", "display", cmd_display,
"Add a display expression" },
{ "so", "source", cmd_source,
"Run a command script" },
{ "regs", "regs", cmd_regs,
"Show all CPU registers" },
{ "vars", "vars", cmd_vars,
"Show all program variables" },
{ "runfor", "runfor", cmd_runfor,
"Run for a certain amount of time" },
{ "me", "measure", cmd_measure,
"Measure time that a function takes" },
{ "dump", "dump", cmd_dump,
"Set dump-instruction flag" },
+ { "td", "tracedump", cmd_trace_dump,
+ "Dump the trace buffer" },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
{ "f", "file", cmd_file,
"Choose the program to be debugged" },
{ "exe", "exec-file", cmd_exec_file,
"Open an executable" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
/* TODO - look for a match anywhere between
* the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
void
print_current_insn (void)
{
absolute_address_t addr = to_absolute (get_pc ());
print_addr (addr);
printf (" : ");
print_insn (addr);
putchar ('\n');
}
int
command_exec (FILE *infile)
{
char buffer[256];
static char prev_buffer[256];
char *cmd;
command_handler_t handler;
int rc;
do {
errno = 0;
fgets (buffer, 255, infile);
if (feof (infile))
return -1;
} while (errno != 0);
/* In terminal mode, a blank line means to execute
the previous command. */
if (buffer[0] == '\n')
strcpy (buffer, prev_buffer);
/* Skip comments */
if (*buffer == '#')
return 0;
cmd = strtok (buffer, " \t\n");
if (!cmd)
return 0;
strcpy (prev_buffer, cmd);
handler = command_lookup (cmd);
if (!handler)
{
syntax_error ("no such command");
return 0;
}
(*handler) ();
return 0;
}
void
keybuffering (int flag)
{
struct termios tio;
tcgetattr (0, &tio);
if (!flag) /* 0 = no buffering = not default */
tio.c_lflag &= ~ICANON;
else /* 1 = buffering = default */
tio.c_lflag |= ICANON;
tcsetattr (0, TCSANOW, &tio);
}
int
command_loop (void)
{
keybuffering (1);
brkfree_temps ();
restart:
if (command_input == stdin)
{
display_print ();
print_current_insn ();
}
exit_command_loop = -1;
while (exit_command_loop < 0)
{
if (command_input == stdin)
command_prompt ();
if (command_exec (command_input) < 0)
break;
}
if (exit_command_loop == 0)
keybuffering (0);
if (feof (command_input) && command_input != stdin)
{
fclose (command_input);
command_input = stdin;
goto restart;
}
return (exit_command_loop);
}
void
breakpoint_hit (breakpoint_t *br)
{
if (br->threaded && (thread_id != br->tid))
return;
if (br->conditional)
{
if (eval (br->condition) == 0)
return;
}
if (br->ignore_count)
{
--br->ignore_count;
return;
}
monitor_on = !br->keep_running;
}
+void
+command_trace_insn (target_addr_t addr)
+{
+ trace_buffer[trace_offset++] = addr;
+ trace_offset %= MAX_TRACE;
+}
+
+
void
command_insn_hook (void)
{
+ target_addr_t pc;
absolute_address_t abspc;
breakpoint_t *br;
+ pc = get_pc ();
+ command_trace_insn (pc);
+
if (active_break_count == 0)
return;
- abspc = to_absolute (get_pc ());
+ abspc = to_absolute (pc);
br = brkfind_by_addr (abspc);
if (br && br->enabled && br->on_execute)
{
breakpoint_hit (br);
if (monitor_on == 0)
return;
if (br->temp)
brkfree (br);
else
printf ("Breakpoint %d reached.\n", br->id);
}
}
void
command_read_hook (absolute_address_t addr)
{
breakpoint_t *br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_read)
{
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf ("]\n");
breakpoint_hit (br);
}
}
void
command_write_hook (absolute_address_t addr, U8 val)
{
breakpoint_t *br;
br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_write)
{
if (br->write_mask)
{
int mask_ok = ((br->last_write & br->write_mask) !=
(val & br->write_mask));
br->last_write = val;
if (!mask_ok)
return;
}
breakpoint_hit (br);
if (monitor_on == 0)
return;
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf (" = 0x%02X", val);
printf ("]\n");
}
if (thread_id_size && (addr == thread_current + thread_id_size - 1))
{
command_change_thread ();
}
}
void
command_periodic (void)
{
if (stop_after_ms)
{
stop_after_ms -= 100;
if (stop_after_ms <= 0)
{
monitor_on = 1;
stop_after_ms = 0;
printf ("Stopping after time elapsed.\n");
}
}
}
void pc_virtual (unsigned long *val, int writep) {
writep ? set_pc (*val) : (*val = get_pc ());
}
void x_virtual (unsigned long *val, int writep) {
writep ? set_x (*val) : (*val = get_x ());
}
void y_virtual (unsigned long *val, int writep) {
writep ? set_y (*val) : (*val = get_y ());
}
void u_virtual (unsigned long *val, int writep) {
writep ? set_u (*val) : (*val = get_u ());
}
void s_virtual (unsigned long *val, int writep) {
writep ? set_s (*val) : (*val = get_s ());
}
void d_virtual (unsigned long *val, int writep) {
writep ? set_d (*val) : (*val = get_d ());
}
void a_virtual (unsigned long *val, int writep) {
writep ? set_a (*val) : (*val = get_a ());
}
void b_virtual (unsigned long *val, int writep) {
writep ? set_b (*val) : (*val = get_b ());
}
void dp_virtual (unsigned long *val, int writep) {
writep ? set_dp (*val) : (*val = get_dp ());
}
void cc_virtual (unsigned long *val, int writep) {
writep ? set_cc (*val) : (*val = get_cc ());
}
void irq_load_virtual (unsigned long *val, int writep) {
if (!writep)
*val = irq_cycles / IRQ_CYCLE_COUNTS;
}
void cycles_virtual (unsigned long *val, int writep)
{
if (!writep)
*val = get_cycles ();
}
void et_virtual (unsigned long *val, int writep)
{
static unsigned long last_cycles = 0;
if (!writep)
*val = get_cycles () - last_cycles;
last_cycles = get_cycles ();
}
void
command_exit_irq_hook (unsigned long cycles)
{
irq_cycles -= irq_cycle_tab[irq_cycle_entry];
irq_cycles += cycles;
irq_cycle_tab[irq_cycle_entry] = cycles;
irq_cycle_entry = (irq_cycle_entry + 1) % IRQ_CYCLE_COUNTS;
//printf ("IRQ took %lu cycles\n", cycles);
//printf ("Average = %d\n", irq_cycles / IRQ_CYCLE_COUNTS);
}
void
command_init (void)
{
int rc;
sym_add (&auto_symtab, "pc", (unsigned long)pc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "x", (unsigned long)x_virtual, SYM_AUTO);
sym_add (&auto_symtab, "y", (unsigned long)y_virtual, SYM_AUTO);
sym_add (&auto_symtab, "u", (unsigned long)u_virtual, SYM_AUTO);
sym_add (&auto_symtab, "s", (unsigned long)s_virtual, SYM_AUTO);
sym_add (&auto_symtab, "d", (unsigned long)d_virtual, SYM_AUTO);
sym_add (&auto_symtab, "a", (unsigned long)a_virtual, SYM_AUTO);
sym_add (&auto_symtab, "b", (unsigned long)b_virtual, SYM_AUTO);
sym_add (&auto_symtab, "dp", (unsigned long)dp_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cc", (unsigned long)cc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cycles", (unsigned long)cycles_virtual, SYM_AUTO);
sym_add (&auto_symtab, "et", (unsigned long)et_virtual, SYM_AUTO);
sym_add (&auto_symtab, "irqload", (unsigned long)irq_load_virtual, SYM_AUTO);
examine_type.format = 'x';
examine_type.size = 1;
print_type.format = 'x';
print_type.size = 1;
(void)command_exec_file (".dbinit");
}
/* vim: set ts=3: */
/* vim: set expandtab: */
|
bcd/exec09
|
1cc7e35be82ab119b87c9c36ecf206631020787b
|
Fix so that script files can start/stop the CPU OK.
|
diff --git a/Makefile.in b/Makefile.in
index 53b1791..5303319 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,546 +1,547 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
+LIBOBJDIR =
bin_PROGRAMS = m6809-run$(EXEEXT)
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure COPYING depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_m6809_run_OBJECTS = 6809.$(OBJEXT) main.$(OBJEXT) monitor.$(OBJEXT) \
machine.$(OBJEXT) eon.$(OBJEXT) wpc.$(OBJEXT) symtab.$(OBJEXT) \
command.$(OBJEXT) fileio.$(OBJEXT)
m6809_run_OBJECTS = $(am_m6809_run_OBJECTS)
m6809_run_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(m6809_run_SOURCES)
DIST_SOURCES = $(m6809_run_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c fileio.c
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
m6809-run$(EXEEXT): $(m6809_run_OBJECTS) $(m6809_run_DEPENDENCIES)
@rm -f m6809-run$(EXEEXT)
$(LINK) $(m6809_run_LDFLAGS) $(m6809_run_OBJECTS) $(m6809_run_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/6809.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/machine.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symtab.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wpc.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) config.h
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/command.c b/command.c
index f285768..5d1b323 100644
--- a/command.c
+++ b/command.c
@@ -1,1469 +1,1484 @@
#include "6809.h"
#include "monitor.h"
#include "machine.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/errno.h>
#include <termios.h>
typedef struct
{
unsigned int size;
unsigned int count;
char **strings;
} cmdqueue_t;
/**********************************************************/
/********************* Global Data ************************/
/**********************************************************/
unsigned int break_count = 0;
breakpoint_t breaktab[MAX_BREAKS];
unsigned int active_break_count = 0;
unsigned int display_count = 0;
display_t displaytab[MAX_DISPLAYS];
unsigned int history_count = 0;
unsigned long historytab[MAX_HISTORY];
absolute_address_t examine_addr = 0;
unsigned int examine_repeat = 1;
datatype_t examine_type;
unsigned int thread_id_size = 2;
absolute_address_t thread_current;
absolute_address_t thread_id = 0;
thread_t threadtab[MAX_THREADS];
#define MAX_CMD_QUEUES 8
int command_stack_depth = -1;
cmdqueue_t command_stack[MAX_CMD_QUEUES];
int stop_after_ms = 0;
datatype_t print_type;
char *command_flags;
int exit_command_loop;
#define IRQ_CYCLE_COUNTS 128
unsigned int irq_cycle_tab[IRQ_CYCLE_COUNTS] = { 0, };
unsigned int irq_cycle_entry = 0;
unsigned long irq_cycles = 0;
unsigned long eval (char *expr);
unsigned long eval_mem (char *expr);
extern int auto_break_insn_count;
+FILE *command_input;
/**********************************************************/
/******************** 6809 Functions **********************/
/**********************************************************/
void
print_addr (absolute_address_t addr)
{
const char *name;
print_device_name (addr >> 28);
putchar (':');
printf ("0x%04X", addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
printf (" <%-16.16s>", name);
else
printf ("%-20.20s", "");
}
/**********************************************************/
/*********************** Functions ************************/
/**********************************************************/
void
syntax_error (const char *string)
{
fprintf (stderr, "error: %s\n", string);
}
void
save_value (unsigned long val)
{
historytab[history_count++ % MAX_HISTORY] = val;
}
unsigned long
eval_historical (unsigned int id)
{
return historytab[id % MAX_HISTORY];
}
void
assign_virtual (const char *name, unsigned long val)
{
unsigned long v_val;
if (!sym_find (&auto_symtab, name, &v_val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)v_val;
virtual (&val, 1);
return;
}
sym_set (&internal_symtab, name, val, 0);
if (!strcmp (name, "thread_current"))
{
printf ("Thread pointer initialized to ");
print_addr (val);
putchar ('\n');
thread_current = val;
}
}
unsigned long
eval_virtual (const char *name)
{
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
if (!sym_find (&auto_symtab, name, &val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)val;
virtual (&val, 0);
}
else if (!sym_find (&internal_symtab, name, &val, 0))
{
}
else
{
return 0;
}
return val;
}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
else
{
absolute_address_t dst = eval_mem (expr);
- printf ("Setting %X to %02X\n", dst, val);
+ //printf ("Setting %X to %02X\n", dst, val);
abs_write8 (dst, val);
}
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
case 'o':
case 'a':
case 's':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
char *
match_binary (char *expr, const char *op, char **secondp)
{
char *p;
p = strstr (expr, op);
if (!p)
return NULL;
*p = '\0';
p += strlen (op);
*secondp = p;
return expr;
}
int
fold_comparisons (char *expr, unsigned long *value)
{
char *p;
if (match_binary (expr, "==", &p))
*value = (eval (expr) == eval (p));
else if (match_binary (expr, "!=", &p))
*value = (eval (expr) != eval (p));
else
return 0;
return 1;
}
int
fold_binary (char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
eval_mem (char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
/* TODO - if expr is already in absolute form,
this explodes ! */
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
eval (char *expr)
{
char *p;
unsigned long val;
if (fold_comparisons (expr, &val));
else if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
unsigned int size = 1;
expr++;
if (*expr == '*')
{
expr++;
size = 2;
}
absolute_address_t addr = eval_mem (expr);
return target_read (addr, size);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
br->keep_running = 0;
br->ignore_count = 0;
br->temp = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
void
brkfree_temps (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].used && breaktab[n].temp)
{
brkfree (&breaktab[n]);
}
}
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
if (brkpt->keep_running)
printf (", print-only");
if (brkpt->temp)
printf (", temp");
if (brkpt->ignore_count)
printf (", ignore %d times\n", brkpt->ignore_count);
if (brkpt->write_mask)
printf (", mask %02X\n", brkpt->write_mask);
putchar ('\n');
}
display_t *
display_alloc (void)
{
unsigned int n;
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (!ds->used)
{
ds->used = 1;
return ds;
}
}
}
void
display_free (display_t *ds)
{
}
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
switch (typep->format)
{
case 'a':
print_addr (val);
return;
case 's':
{
absolute_address_t addr = (absolute_address_t)val;
char c;
putchar ('"');
while ((c = abs_read8 (addr++)) != '\0')
putchar (c);
putchar ('"');
return;
}
}
if (typep->format == 'x')
{
printf ("0x");
sprintf (f, "%%0%d%c", typep->size * 2, typep->format);
}
else if (typep->format == 'o')
{
printf ("0");
sprintf (f, "%%%c", typep->format);
}
else
sprintf (f, "%%%c", typep->format);
printf (f, val);
}
void
display_print (void)
{
unsigned int n;
char comma = '\0';
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (ds->used)
{
char expr[256];
strcpy (expr, ds->expr);
printf ("%c %s = ", comma, expr);
print_value (eval (expr), &ds->type);
comma = ',';
}
}
if (comma)
putchar ('\n');
}
int
print_insn (absolute_address_t addr)
{
char buf[64];
int size = dasm (buf, addr);
printf ("%s", buf);
return size;
}
void
do_examine (void)
{
unsigned int n;
unsigned int objs_per_line = 16;
if (isdigit (*command_flags))
examine_repeat = strtoul (command_flags, &command_flags, 0);
if (*command_flags == 'i')
examine_type.format = *command_flags;
else
parse_format_flag (command_flags, &examine_type.format);
parse_size_flag (command_flags, &examine_type.size);
switch (examine_type.format)
{
case 'i':
objs_per_line = 1;
break;
case 'w':
objs_per_line = 8;
break;
}
for (n = 0; n < examine_repeat; n++)
{
if ((n % objs_per_line) == 0)
{
putchar ('\n');
print_addr (examine_addr);
printf (": ");
}
switch (examine_type.format)
{
case 's': /* string */
break;
case 'i': /* instruction */
examine_addr += print_insn (examine_addr);
break;
default:
print_value (target_read (examine_addr, examine_type.size),
&examine_type);
putchar (' ');
examine_addr += examine_type.size;
}
}
putchar ('\n');
}
void
do_print (char *expr)
{
unsigned long val = eval (expr);
printf ("$%d = ", history_count);
parse_format_flag (command_flags, &print_type.format);
parse_size_flag (command_flags, &print_type.size);
print_value (val, &print_type);
putchar ('\n');
save_value (val);
}
void
do_set (char *expr)
{
unsigned long val = eval (expr);
save_value (val);
}
#define THREAD_DATA_PC 3
#define THREAD_DATA_ROMBANK 9
void
print_thread_data (absolute_address_t th)
{
U8 b;
U16 w;
absolute_address_t pc;
w = abs_read16 (th + THREAD_DATA_PC);
b = abs_read8 (th + THREAD_DATA_ROMBANK);
printf ("{ PC = %04X, BANK = %02X }", w, b);
}
void
command_change_thread (void)
{
target_addr_t addr = target_read (thread_current, thread_id_size);
absolute_address_t th = to_absolute (addr);
if (th == thread_id)
return;
thread_id = th;
if (machine->dump_thread && eval ("$thread_debug"))
{
if (addr)
{
printf ("[Current thread = ");
print_addr (thread_id);
machine->dump_thread (thread_id);
print_thread_data (thread_id);
printf ("]\n");
}
else
{
printf ("[ No thread ]\n");
}
}
}
void
command_stack_push (unsigned int reason)
{
cmdqueue_t *q = &command_stack[++command_stack_depth];
}
void
command_stack_pop (void)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
--command_stack_depth;
}
void
command_stack_add (const char *cmd)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
}
char *
getarg (void)
{
return strtok (NULL, " \t\n");
}
/****************** Command Handlers ************************/
void cmd_print (void)
{
char *arg = getarg ();
if (arg)
do_print (arg);
else
do_print ("$");
}
void cmd_set (void)
{
char *arg = getarg ();
if (arg)
do_set (arg);
else
do_set ("$");
}
void cmd_examine (void)
{
char *arg = getarg ();
if (arg)
examine_addr = eval_mem (arg);
do_examine ();
}
void cmd_break (void)
{
char *arg = getarg ();
if (!arg)
return;
unsigned long val = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = val;
br->on_execute = 1;
arg = getarg ();
if (!arg);
else if (!strcmp (arg, "if"))
{
br->conditional = 1;
arg = getarg ();
strcpy (br->condition, arg);
}
else if (!strcmp (arg, "ignore"))
{
br->ignore_count = atoi (getarg ());
}
brkprint (br);
}
void cmd_watch1 (int on_read, int on_write)
{
char *arg;
arg = getarg ();
if (!arg)
return;
absolute_address_t addr = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = addr;
br->on_read = on_read;
br->on_write = on_write;
for (;;)
{
arg = getarg ();
if (!arg)
return;
if (!strcmp (arg, "print"))
br->keep_running = 1;
else if (!strcmp (arg, "mask"))
{
arg = getarg ();
br->write_mask = strtoul (arg, NULL, 0);
}
else if (!strcmp (arg, "if"))
{
arg = getarg ();
br->conditional = 1;
strcpy (br->condition, arg);
}
}
brkprint (br);
}
void cmd_watch (void)
{
cmd_watch1 (0, 1);
}
void cmd_rwatch (void)
{
cmd_watch1 (1, 0);
}
void cmd_awatch (void)
{
cmd_watch1 (1, 1);
}
void cmd_break_list (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
brkprint (&breaktab[n]);
}
void cmd_step (void)
{
auto_break_insn_count = 1;
exit_command_loop = 0;
}
void cmd_next (void)
{
char buf[128];
breakpoint_t *br;
unsigned long addr = to_absolute (get_pc ());
addr += dasm (buf, addr);
br = brkalloc ();
br->addr = addr;
br->on_execute = 1;
br->temp = 1;
/* TODO - for conditional branches, should also set a
temp breakpoint at the branch target */
exit_command_loop = 0;
}
void cmd_continue (void)
{
exit_command_loop = 0;
}
void cmd_quit (void)
{
cpu_quit = 0;
exit_command_loop = 1;
}
void cmd_delete (void)
{
const char *arg = getarg ();
unsigned int id;
if (!arg)
{
int n;
printf ("Deleting all breakpoints.\n");
for (id = 0; id < MAX_BREAKS; id++)
{
breakpoint_t *br = brkfind_by_id (id);
brkfree (br);
}
return;
}
id = atoi (arg);
breakpoint_t *br = brkfind_by_id (id);
if (br->used)
{
printf ("Deleting breakpoint %d\n", id);
brkfree (br);
}
}
void cmd_list (void)
{
char *arg;
static absolute_address_t lastpc = 0;
static absolute_address_t lastaddr = 0;
absolute_address_t addr;
int n;
arg = getarg ();
if (arg)
addr = eval_mem (arg);
else
{
addr = to_absolute (get_pc ());
if (addr == lastpc)
addr = lastaddr;
else
lastaddr = lastpc = addr;
}
for (n = 0; n < 10; n++)
{
print_addr (addr);
printf (" : ");
addr += print_insn (addr);
putchar ('\n');
}
lastaddr = addr;
}
void cmd_symbol_file (void)
{
char *arg = getarg ();
if (arg)
load_map_file (arg);
}
void cmd_display (void)
{
char *arg;
while ((arg = getarg ()) != NULL)
{
display_t *ds = display_alloc ();
strcpy (ds->expr, arg);
ds->type = print_type;
parse_format_flag (command_flags, &ds->type.format);
parse_size_flag (command_flags, &ds->type.size);
}
}
int command_exec_file (const char *filename)
{
FILE *infile;
extern int command_exec (FILE *);
infile = file_open (NULL, filename, "r");
if (!infile)
return 0;
- while (command_exec (infile) >= 0);
- fclose (infile);
+ command_input = infile;
return 1;
}
void cmd_source (void)
{
char *arg = getarg ();
if (!arg)
return;
if (command_exec_file (arg) == 0)
fprintf (stderr, "can't open %s\n", arg);
}
void cmd_regs (void)
{
}
void cmd_vars (void)
{
for_each_var (NULL);
}
void cmd_runfor (void)
{
char *arg = getarg ();
int secs = atoi (arg);
stop_after_ms = secs * 1000;
}
void cmd_measure (void)
{
absolute_address_t addr;
target_addr_t retaddr = get_pc ();
breakpoint_t *br;
/* Get the address of the function to be measured. */
char *arg = getarg ();
if (!arg)
return;
addr = eval_mem (arg);
printf ("Measuring ");
print_addr (addr);
printf (" back to ");
print_addr (to_absolute (retaddr));
putchar ('\n');
/* Push the current PC onto the stack for the
duration of the measurement. */
set_s (get_s () - 2);
write16 (get_s (), retaddr);
/* Set a temp breakpoint at the current PC, so that
the measurement will halt. */
br = brkalloc ();
br->addr = to_absolute (retaddr);
br->on_execute = 1;
br->temp = 1;
/* Interrupts must be disabled for this to work ! */
set_cc (get_cc () | 0x50);
/* Change the PC to the function-under-test. */
set_pc (addr);
/* Go! */
exit_command_loop = 0;
}
void cmd_dump (void)
{
extern int dump_every_insn;
char *arg = getarg ();
if (arg)
dump_every_insn = strtoul (arg, NULL, 0);
printf ("Instruction dump is %s\n",
dump_every_insn ? "on" : "off");
}
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
{ "s", "step", cmd_step,
"Step one instruction" },
{ "n", "next", cmd_next,
"Break at the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
{ "wa", "watch", cmd_watch,
"Add a watchpoint on write" },
{ "rwa", "rwatch", cmd_rwatch,
"Add a watchpoint on read" },
{ "awa", "awatch", cmd_awatch,
"Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
{ "l", "list", cmd_list },
{ "sym", "symbol-file", cmd_symbol_file,
"Open a symbol table file" },
{ "di", "display", cmd_display,
"Add a display expression" },
{ "so", "source", cmd_source,
"Run a command script" },
{ "regs", "regs", cmd_regs,
"Show all CPU registers" },
{ "vars", "vars", cmd_vars,
"Show all program variables" },
{ "runfor", "runfor", cmd_runfor,
"Run for a certain amount of time" },
{ "me", "measure", cmd_measure,
"Measure time that a function takes" },
{ "dump", "dump", cmd_dump,
"Set dump-instruction flag" },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
{ "f", "file", cmd_file,
"Choose the program to be debugged" },
{ "exe", "exec-file", cmd_exec_file,
"Open an executable" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
/* TODO - look for a match anywhere between
* the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
void
print_current_insn (void)
{
absolute_address_t addr = to_absolute (get_pc ());
print_addr (addr);
printf (" : ");
print_insn (addr);
putchar ('\n');
}
int
command_exec (FILE *infile)
{
char buffer[256];
static char prev_buffer[256];
char *cmd;
command_handler_t handler;
int rc;
do {
errno = 0;
fgets (buffer, 255, infile);
if (feof (infile))
return -1;
} while (errno != 0);
/* In terminal mode, a blank line means to execute
the previous command. */
if (buffer[0] == '\n')
strcpy (buffer, prev_buffer);
/* Skip comments */
if (*buffer == '#')
return 0;
cmd = strtok (buffer, " \t\n");
if (!cmd)
return 0;
strcpy (prev_buffer, cmd);
handler = command_lookup (cmd);
if (!handler)
{
syntax_error ("no such command");
return 0;
}
(*handler) ();
return 0;
}
void
keybuffering (int flag)
{
struct termios tio;
tcgetattr (0, &tio);
if (!flag) /* 0 = no buffering = not default */
tio.c_lflag &= ~ICANON;
else /* 1 = buffering = default */
tio.c_lflag |= ICANON;
tcsetattr (0, TCSANOW, &tio);
}
int
command_loop (void)
{
keybuffering (1);
brkfree_temps ();
- display_print ();
- print_current_insn ();
+
+restart:
+ if (command_input == stdin)
+ {
+ display_print ();
+ print_current_insn ();
+ }
+
exit_command_loop = -1;
while (exit_command_loop < 0)
{
- command_prompt ();
- if (command_exec (stdin) < 0)
+ if (command_input == stdin)
+ command_prompt ();
+ if (command_exec (command_input) < 0)
break;
}
if (exit_command_loop == 0)
keybuffering (0);
+
+ if (feof (command_input) && command_input != stdin)
+ {
+ fclose (command_input);
+ command_input = stdin;
+ goto restart;
+ }
+
return (exit_command_loop);
}
void
breakpoint_hit (breakpoint_t *br)
{
if (br->threaded && (thread_id != br->tid))
return;
if (br->conditional)
{
if (eval (br->condition) == 0)
return;
}
if (br->ignore_count)
{
--br->ignore_count;
return;
}
monitor_on = !br->keep_running;
}
void
command_insn_hook (void)
{
absolute_address_t abspc;
breakpoint_t *br;
if (active_break_count == 0)
return;
abspc = to_absolute (get_pc ());
br = brkfind_by_addr (abspc);
if (br && br->enabled && br->on_execute)
{
breakpoint_hit (br);
if (monitor_on == 0)
return;
if (br->temp)
brkfree (br);
else
printf ("Breakpoint %d reached.\n", br->id);
}
}
void
command_read_hook (absolute_address_t addr)
{
breakpoint_t *br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_read)
{
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf ("]\n");
breakpoint_hit (br);
}
}
void
command_write_hook (absolute_address_t addr, U8 val)
{
breakpoint_t *br;
br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_write)
{
if (br->write_mask)
{
int mask_ok = ((br->last_write & br->write_mask) !=
(val & br->write_mask));
br->last_write = val;
if (!mask_ok)
return;
}
breakpoint_hit (br);
if (monitor_on == 0)
return;
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf (" = 0x%02X", val);
printf ("]\n");
}
if (thread_id_size && (addr == thread_current + thread_id_size - 1))
{
command_change_thread ();
}
}
void
command_periodic (void)
{
if (stop_after_ms)
{
stop_after_ms -= 100;
if (stop_after_ms <= 0)
{
monitor_on = 1;
stop_after_ms = 0;
printf ("Stopping after time elapsed.\n");
}
}
}
void pc_virtual (unsigned long *val, int writep) {
writep ? set_pc (*val) : (*val = get_pc ());
}
void x_virtual (unsigned long *val, int writep) {
writep ? set_x (*val) : (*val = get_x ());
}
void y_virtual (unsigned long *val, int writep) {
writep ? set_y (*val) : (*val = get_y ());
}
void u_virtual (unsigned long *val, int writep) {
writep ? set_u (*val) : (*val = get_u ());
}
void s_virtual (unsigned long *val, int writep) {
writep ? set_s (*val) : (*val = get_s ());
}
void d_virtual (unsigned long *val, int writep) {
writep ? set_d (*val) : (*val = get_d ());
}
void a_virtual (unsigned long *val, int writep) {
writep ? set_a (*val) : (*val = get_a ());
}
void b_virtual (unsigned long *val, int writep) {
writep ? set_b (*val) : (*val = get_b ());
}
void dp_virtual (unsigned long *val, int writep) {
writep ? set_dp (*val) : (*val = get_dp ());
}
void cc_virtual (unsigned long *val, int writep) {
writep ? set_cc (*val) : (*val = get_cc ());
}
void irq_load_virtual (unsigned long *val, int writep) {
if (!writep)
*val = irq_cycles / IRQ_CYCLE_COUNTS;
}
void cycles_virtual (unsigned long *val, int writep)
{
if (!writep)
*val = get_cycles ();
}
void et_virtual (unsigned long *val, int writep)
{
static unsigned long last_cycles = 0;
if (!writep)
*val = get_cycles () - last_cycles;
last_cycles = get_cycles ();
}
void
command_exit_irq_hook (unsigned long cycles)
{
irq_cycles -= irq_cycle_tab[irq_cycle_entry];
irq_cycles += cycles;
irq_cycle_tab[irq_cycle_entry] = cycles;
irq_cycle_entry = (irq_cycle_entry + 1) % IRQ_CYCLE_COUNTS;
//printf ("IRQ took %lu cycles\n", cycles);
//printf ("Average = %d\n", irq_cycles / IRQ_CYCLE_COUNTS);
}
void
command_init (void)
{
int rc;
sym_add (&auto_symtab, "pc", (unsigned long)pc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "x", (unsigned long)x_virtual, SYM_AUTO);
sym_add (&auto_symtab, "y", (unsigned long)y_virtual, SYM_AUTO);
sym_add (&auto_symtab, "u", (unsigned long)u_virtual, SYM_AUTO);
sym_add (&auto_symtab, "s", (unsigned long)s_virtual, SYM_AUTO);
sym_add (&auto_symtab, "d", (unsigned long)d_virtual, SYM_AUTO);
sym_add (&auto_symtab, "a", (unsigned long)a_virtual, SYM_AUTO);
sym_add (&auto_symtab, "b", (unsigned long)b_virtual, SYM_AUTO);
sym_add (&auto_symtab, "dp", (unsigned long)dp_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cc", (unsigned long)cc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cycles", (unsigned long)cycles_virtual, SYM_AUTO);
sym_add (&auto_symtab, "et", (unsigned long)et_virtual, SYM_AUTO);
sym_add (&auto_symtab, "irqload", (unsigned long)irq_load_virtual, SYM_AUTO);
examine_type.format = 'x';
examine_type.size = 1;
print_type.format = 'x';
print_type.size = 1;
(void)command_exec_file (".dbinit");
}
/* vim: set ts=3: */
/* vim: set expandtab: */
|
bcd/exec09
|
ed53d9108a6e9df09d9f4f9a95ffaff338242e52
|
Bump to version 0.91.
|
diff --git a/configure b/configure
index b03c0fe..bababb8 100755
--- a/configure
+++ b/configure
@@ -1,2558 +1,2558 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for m6809-run 0.90.
+# Generated by GNU Autoconf 2.61 for m6809-run 0.91.
#
# Report bugs to <brian@oddchange.com>.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in
*posix*) set -o posix ;;
esac
fi
# PATH needs CR
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
as_nl='
'
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
{ (exit 1); exit 1; }
fi
# Work around bugs in pre-3.0 UWIN ksh.
for as_var in ENV MAIL MAILPATH
do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# CDPATH.
$as_unset CDPATH
if test "x$CONFIG_SHELL" = x; then
if (eval ":") 2>/dev/null; then
as_have_required=yes
else
as_have_required=no
fi
if test $as_have_required = yes && (eval ":
(as_func_return () {
(exit \$1)
}
as_func_success () {
as_func_return 0
}
as_func_failure () {
as_func_return 1
}
as_func_ret_success () {
return 0
}
as_func_ret_failure () {
return 1
}
exitcode=0
if as_func_success; then
:
else
exitcode=1
echo as_func_success failed.
fi
if as_func_failure; then
exitcode=1
echo as_func_failure succeeded.
fi
if as_func_ret_success; then
:
else
exitcode=1
echo as_func_ret_success failed.
fi
if as_func_ret_failure; then
exitcode=1
echo as_func_ret_failure succeeded.
fi
if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
:
else
exitcode=1
echo positional parameters were not saved.
fi
test \$exitcode = 0) || { (exit 1); exit 1; }
(
as_lineno_1=\$LINENO
as_lineno_2=\$LINENO
test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
") 2> /dev/null; then
:
else
as_candidate_shells=
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
case $as_dir in
/*)
for as_base in sh bash ksh sh5; do
as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
done;;
esac
done
IFS=$as_save_IFS
for as_shell in $as_candidate_shells $SHELL; do
# Try only shells that exist, to save several forks.
if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
{ ("$as_shell") 2> /dev/null <<\_ASEOF
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in
*posix*) set -o posix ;;
esac
fi
:
_ASEOF
}; then
CONFIG_SHELL=$as_shell
as_have_required=yes
if { "$as_shell" 2> /dev/null <<\_ASEOF
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in
*posix*) set -o posix ;;
esac
fi
:
(as_func_return () {
(exit $1)
}
as_func_success () {
as_func_return 0
}
as_func_failure () {
as_func_return 1
}
as_func_ret_success () {
return 0
}
as_func_ret_failure () {
return 1
}
exitcode=0
if as_func_success; then
:
else
exitcode=1
echo as_func_success failed.
fi
if as_func_failure; then
exitcode=1
echo as_func_failure succeeded.
fi
if as_func_ret_success; then
:
else
exitcode=1
echo as_func_ret_success failed.
fi
if as_func_ret_failure; then
exitcode=1
echo as_func_ret_failure succeeded.
fi
if ( set x; as_func_ret_success y && test x = "$1" ); then
:
else
exitcode=1
echo positional parameters were not saved.
fi
test $exitcode = 0) || { (exit 1); exit 1; }
(
as_lineno_1=$LINENO
as_lineno_2=$LINENO
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
_ASEOF
}; then
break
fi
fi
done
if test "x$CONFIG_SHELL" != x; then
for as_var in BASH_ENV ENV
do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
done
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
fi
if test $as_have_required = no; then
echo This script requires a shell more modern than all the
echo shells that I found on your system. Please install a
echo modern shell, or manually run the script under such a
echo shell if you do have one.
{ (exit 1); exit 1; }
fi
fi
fi
(eval "as_func_return () {
(exit \$1)
}
as_func_success () {
as_func_return 0
}
as_func_failure () {
as_func_return 1
}
as_func_ret_success () {
return 0
}
as_func_ret_failure () {
return 1
}
exitcode=0
if as_func_success; then
:
else
exitcode=1
echo as_func_success failed.
fi
if as_func_failure; then
exitcode=1
echo as_func_failure succeeded.
fi
if as_func_ret_success; then
:
else
exitcode=1
echo as_func_ret_success failed.
fi
if as_func_ret_failure; then
exitcode=1
echo as_func_ret_failure succeeded.
fi
if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
:
else
exitcode=1
echo positional parameters were not saved.
fi
test \$exitcode = 0") || {
echo No shell found that supports shell functions.
echo Please tell autoconf@gnu.org about your system,
echo including any error possibly output before this
echo message
}
as_lineno_1=$LINENO
as_lineno_2=$LINENO
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line after each line using $LINENO; the second 'sed'
# does the real work. The second script uses 'N' to pair each
# line-number line with the line containing $LINENO, and appends
# trailing '-' during substitution so that $LINENO is not a special
# case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# scripts with optimization help from Paolo Bonzini. Blame Lee
# E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in
-n*)
case `echo 'x\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
*) ECHO_C='\c';;
esac;;
*)
ECHO_N='-n';;
esac
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir
fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -p'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 7<&0 </dev/null 6>&1
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='m6809-run'
PACKAGE_TARNAME='m6809-run'
-PACKAGE_VERSION='0.90'
-PACKAGE_STRING='m6809-run 0.90'
+PACKAGE_VERSION='0.91'
+PACKAGE_STRING='m6809-run 0.91'
PACKAGE_BUGREPORT='brian@oddchange.com'
ac_unique_file="6809.c"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif"
ac_subst_vars='SHELL
PATH_SEPARATOR
PACKAGE_NAME
PACKAGE_TARNAME
PACKAGE_VERSION
PACKAGE_STRING
PACKAGE_BUGREPORT
exec_prefix
prefix
program_transform_name
bindir
sbindir
libexecdir
datarootdir
datadir
sysconfdir
sharedstatedir
localstatedir
includedir
oldincludedir
docdir
infodir
htmldir
dvidir
pdfdir
psdir
libdir
localedir
mandir
DEFS
ECHO_C
ECHO_N
ECHO_T
LIBS
build_alias
host_alias
target_alias
INSTALL_PROGRAM
INSTALL_SCRIPT
INSTALL_DATA
CYGPATH_W
PACKAGE
VERSION
ACLOCAL
AUTOCONF
AUTOMAKE
AUTOHEADER
MAKEINFO
install_sh
STRIP
INSTALL_STRIP_PROGRAM
mkdir_p
AWK
SET_MAKE
am__leading_dot
AMTAR
am__tar
am__untar
CC
CFLAGS
LDFLAGS
CPPFLAGS
ac_ct_CC
EXEEXT
OBJEXT
DEPDIR
am__include
am__quote
AMDEP_TRUE
AMDEP_FALSE
AMDEPBACKSLASH
CCDEPMODE
am__fastdepCC_TRUE
am__fastdepCC_FALSE
CPP
GREP
EGREP
LIBOBJS
LTLIBOBJS'
ac_subst_files=''
ac_precious_vars='build_alias
host_alias
target_alias
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CPP'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'
ac_prev=
ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval $ac_prev=\$ac_option
ac_prev=
continue
fi
case $ac_option in
*=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
*) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_dashdash$ac_option in
--)
ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
-datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
| --dataroo | --dataro | --datar)
ac_prev=datarootdir ;;
-datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
eval enable_$ac_feature=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
-docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
docdir=$ac_optarg ;;
-dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
ac_prev=dvidir ;;
-dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
eval enable_$ac_feature=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
ac_prev=htmldir ;;
-htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
| --ht=*)
htmldir=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localedir | --localedir | --localedi | --localed | --locale)
ac_prev=localedir ;;
-localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
localedir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
ac_prev=pdfdir ;;
-pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
pdfdir=$ac_optarg ;;
-psdir | --psdir | --psdi | --psd | --ps)
ac_prev=psdir ;;
-psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
psdir=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
eval with_$ac_package=\$ac_optarg ;;
-without-* | --without-*)
ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
eval with_$ac_package=no ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) { echo "$as_me: error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; }
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid variable name: $ac_envvar" >&2
{ (exit 1); exit 1; }; }
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
{ echo "$as_me: error: missing argument to $ac_option" >&2
{ (exit 1); exit 1; }; }
fi
# Be sure to have absolute directory names.
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
do
eval ac_val=\$$ac_var
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
{ echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; }
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
{ echo "$as_me: error: Working directory cannot be determined" >&2
{ (exit 1); exit 1; }; }
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
{ echo "$as_me: error: pwd does not report name of working directory" >&2
{ (exit 1); exit 1; }; }
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then the parent directory.
ac_confdir=`$as_dirname -- "$0" ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$0" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
{ (exit 1); exit 1; }; }
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
{ (exit 1); exit 1; }; }
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
srcdir=.
fi
# Remove unnecessary trailing slashes from srcdir.
# Double slashes in file names in object file debugging info
# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
for ac_var in $ac_precious_vars; do
eval ac_env_${ac_var}_set=\${${ac_var}+set}
eval ac_env_${ac_var}_value=\$${ac_var}
eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
eval ac_cv_env_${ac_var}_value=\$${ac_var}
done
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures m6809-run 0.90 to adapt to many kinds of systems.
+\`configure' configures m6809-run 0.91 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print \`checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/m6809-run]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of m6809-run 0.90:";;
+ short | recursive ) echo "Configuration of m6809-run 0.91:";;
esac
cat <<\_ACEOF
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
--enable-wpc Enable WPC address map
--enable-6309 Enable 6309 extensions
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to <brian@oddchange.com>.
_ACEOF
ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d "$ac_dir" || continue
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
cd "$ac_dir" || { ac_status=$?; continue; }
# Check for guested configure.
if test -f "$ac_srcdir/configure.gnu"; then
echo &&
$SHELL "$ac_srcdir/configure.gnu" --help=recursive
elif test -f "$ac_srcdir/configure"; then
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-m6809-run configure 0.90
+m6809-run configure 0.91
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit
fi
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by m6809-run $as_me 0.90, which was
+It was created by m6809-run $as_me 0.91, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
_ACEOF
exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
echo "PATH: $as_dir"
done
IFS=$as_save_IFS
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
2)
ac_configure_args1="$ac_configure_args1 '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
ac_configure_args="$ac_configure_args '$ac_arg'"
;;
esac
done
done
$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Use '\'' to represent an apostrophe within the trap.
# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
echo
cat <<\_ASBOX
## ---------------- ##
## Cache variables. ##
## ---------------- ##
_ASBOX
echo
# The following way of writing the cache mishandles newlines in values,
(
for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
*) $as_unset $ac_var ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
sed -n \
"s/'\''/'\''\\\\'\'''\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
;; #(
*)
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
)
echo
cat <<\_ASBOX
## ----------------- ##
## Output variables. ##
## ----------------- ##
_ASBOX
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
cat <<\_ASBOX
## ------------------- ##
## File substitutions. ##
## ------------------- ##
_ASBOX
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
cat <<\_ASBOX
## ----------- ##
## confdefs.h. ##
## ----------- ##
_ASBOX
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core core.conftest.* &&
rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -n "$CONFIG_SITE"; then
set x "$CONFIG_SITE"
elif test "x$prefix" != xNONE; then
set x "$prefix/share/config.site" "$prefix/etc/config.site"
else
set x "$ac_default_prefix/share/config.site" \
"$ac_default_prefix/etc/config.site"
fi
shift
for ac_site_file
do
if test -r "$ac_site_file"; then
{ echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special
# files actually), so we avoid doing that.
if test -f "$cache_file"; then
{ echo "$as_me:$LINENO: loading cache $cache_file" >&5
echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
{ echo "$as_me:$LINENO: creating cache $cache_file" >&5
echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val=\$ac_cv_env_${ac_var}_value
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
{ echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
{ echo "$as_me:$LINENO: former value: $ac_old_val" >&5
echo "$as_me: former value: $ac_old_val" >&2;}
{ echo "$as_me:$LINENO: current value: $ac_new_val" >&5
echo "$as_me: current value: $ac_new_val" >&2;}
ac_cache_corrupted=:
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
{ echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
echo "$as_me: error: changes in the environment can compromise the build" >&2;}
{ { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
am__api_version="1.9"
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
{ { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
{ (exit 1); exit 1; }; }
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AmigaOS /C/install, which installs bootblocks on floppy discs
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
if test -z "$INSTALL"; then
if test "${ac_cv_path_install+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
# Account for people who put trailing slashes in PATH elements.
case $as_dir/ in
./ | .// | /cC/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
break 3
fi
fi
done
done
;;
esac
done
IFS=$as_save_IFS
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
# As a last resort, use the slow shell script. Don't cache a
# value for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
INSTALL=$ac_install_sh
fi
fi
{ echo "$as_me:$LINENO: result: $INSTALL" >&5
echo "${ECHO_T}$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$*" != "X $srcdir/configure conftest.file" \
&& test "$*" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
{ { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
alias in your environment" >&5
echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
alias in your environment" >&2;}
{ (exit 1); exit 1; }; }
fi
test "$2" = conftest.file
)
then
# Ok.
:
else
{ { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
Check your system clock" >&5
echo "$as_me: error: newly created file is older than distributed files!
Check your system clock" >&2;}
{ (exit 1); exit 1; }; }
fi
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
test "$program_prefix" != NONE &&
program_transform_name="s&^&$program_prefix&;$program_transform_name"
# Use a double $ so make ignores it.
test "$program_suffix" != NONE &&
program_transform_name="s&\$&$program_suffix&;$program_transform_name"
# Double any \ or $. echo might interpret backslashes.
# By default was `s,x,x', remove it if useless.
cat <<\_ACEOF >conftest.sed
s/[\\$]/&&/g;s/;s,x,x,$//
_ACEOF
program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
rm -f conftest.sed
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
{ echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
fi
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
# We used to keeping the `.' as first argument, in order to
# allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
# where $(somedir) is conditionally defined. However this is wrong
# for two reasons:
# 1. if the package is installed by a user who cannot write `.'
# make install will fail,
# 2. the above comment should most certainly read
# $(mkdir_p) $(DESTDIR)$(somedir)
# so it does not work when $(somedir) is undefined and
# $(DESTDIR) is not.
# To support the latter case, we have to write
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
# so the `.' trick is pointless.
mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
for d in ./-p ./--version;
do
test -d $d && rmdir $d
done
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
if test -f "$ac_aux_dir/mkinstalldirs"; then
mkdir_p='$(mkinstalldirs)'
else
mkdir_p='$(install_sh) -d'
fi
fi
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_AWK+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$AWK"; then
ac_cv_prog_AWK="$AWK" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_AWK="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
{ echo "$as_me:$LINENO: result: $AWK" >&5
echo "${ECHO_T}$AWK" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
test -n "$AWK" && break
done
{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.make <<\_ACEOF
SHELL = /bin/sh
all:
@echo '@@@%%%=$(MAKE)=@@@%%%'
_ACEOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
case `${MAKE-make} -f conftest.make 2>/dev/null` in
*@@@%%%=?*=@@@%%%*)
eval ac_cv_prog_make_${ac_make}_set=yes;;
*)
eval ac_cv_prog_make_${ac_make}_set=no;;
esac
rm -f conftest.make
fi
if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
SET_MAKE=
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
{ { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
{ (exit 1); exit 1; }; }
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
# Define the identity of the package.
PACKAGE='m6809-run'
- VERSION='0.90'
+ VERSION='0.91'
cat >>confdefs.h <<_ACEOF
#define PACKAGE "$PACKAGE"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define VERSION "$VERSION"
_ACEOF
# Some tools Automake needs.
ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
install_sh=${install_sh-"$am_aux_dir/install-sh"}
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
if test "$cross_compiling" != no; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$STRIP"; then
ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
{ echo "$as_me:$LINENO: result: $STRIP" >&5
echo "${ECHO_T}$STRIP" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_STRIP"; then
ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_STRIP="strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
{ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
echo "${ECHO_T}$ac_ct_STRIP" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
if test "x$ac_ct_STRIP" = x; then
STRIP=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&5
echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
STRIP=$ac_ct_STRIP
fi
else
STRIP="$ac_cv_prog_STRIP"
fi
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# Always define AMTAR for backward compatibility.
AMTAR=${AMTAR-"${am_missing_run}tar"}
am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
ac_config_headers="$ac_config_headers config.h"
# Checks for programs.
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&5
echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
test -n "$ac_ct_CC" && break
done
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&5
echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
fi
fi
test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&5
echo "$as_me: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
# Provide some information about the compiler.
echo "$as_me:$LINENO: checking for C compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (ac_try="$ac_compiler --version >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compiler --version >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (ac_try="$ac_compiler -v >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compiler -v >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (ac_try="$ac_compiler -V >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compiler -V >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.exe b.out"
@@ -5076,1078 +5076,1078 @@ choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval echo '${'$as_ac_var'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
# Template:
# AC_DEFINE will place in config.h; AC_SUBST updates the makefiles
#AC_DEFINE(VAR, value, [Doc string])
#AC_SUBST([VAR])
# Template for --enable options
#AC_ARG_ENABLE([name],
# AC_HELP_STRING([--enable-name], [doc string for option]),
# [enable_name=$enableval], [enable_name=default value])
#if test $enable_name = yes; then
# AC_DEFINE(CONFIG_NAME, 1, [doc string when enabled])
#fi
# Check whether --enable-wpc was given.
if test "${enable_wpc+set}" = set; then
enableval=$enable_wpc; wpc=$enableval
else
wpc=no
fi
if test $wpc = yes; then
cat >>confdefs.h <<\_ACEOF
#define CONFIG_WPC 1
_ACEOF
fi
# Check whether --enable-6309 was given.
if test "${enable_6309+set}" = set; then
enableval=$enable_6309; h6309=$enableval
else
h6309=no
fi
if test $h6309 = yes; then
cat >>confdefs.h <<\_ACEOF
#define H6309 1
_ACEOF
fi
# Template for --with options
#AC_ARG_WITH([name],
# AC_HELP_STRING([--with-name=<parameter-name>], [doc string]),
# [with_name=$withval], [with_name=default value])
#CONFIG_NAME="$with_name" etc.
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(
for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
*) $as_unset $ac_var ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
) |
sed '
/^ac_cv_env_/b end
t clear
:clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
test "x$cache_file" != "x/dev/null" &&
{ echo "$as_me:$LINENO: updating cache $cache_file" >&5
echo "$as_me: updating cache $cache_file" >&6;}
cat confcache >$cache_file
else
{ echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
ac_i=`echo "$ac_i" | sed "$ac_script"`
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
echo "$as_me: error: conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
echo "$as_me: creating $CONFIG_STATUS" >&6;}
cat >$CONFIG_STATUS <<_ACEOF
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in
*posix*) set -o posix ;;
esac
fi
# PATH needs CR
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
as_nl='
'
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
{ (exit 1); exit 1; }
fi
# Work around bugs in pre-3.0 UWIN ksh.
for as_var in ENV MAIL MAILPATH
do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# CDPATH.
$as_unset CDPATH
as_lineno_1=$LINENO
as_lineno_2=$LINENO
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line after each line using $LINENO; the second 'sed'
# does the real work. The second script uses 'N' to pair each
# line-number line with the line containing $LINENO, and appends
# trailing '-' during substitution so that $LINENO is not a special
# case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# scripts with optimization help from Paolo Bonzini. Blame Lee
# E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in
-n*)
case `echo 'x\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
*) ECHO_C='\c';;
esac;;
*)
ECHO_N='-n';;
esac
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir
fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -p'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
# Save the log message, to keep $[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by m6809-run $as_me 0.90, which was
+This file was extended by m6809-run $as_me 0.91, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
config_commands="$ac_config_commands"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.
Usage: $0 [OPTIONS] [FILE]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Configuration commands:
$config_commands
Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-m6809-run config.status 0.90
+m6809-run config.status 0.91
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
Copyright (C) 2006 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# If no file are specified by the user, then we need to provide default
# value. By we need to know if files were specified by the user.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
esac
case $ac_option in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
echo "$ac_cs_version"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
CONFIG_FILES="$CONFIG_FILES $ac_optarg"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
{ echo "$as_me: error: ambiguous option: $1
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; };;
--help | --hel | -h )
echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) { echo "$as_me: error: unrecognized option: $1
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; } ;;
*) ac_config_targets="$ac_config_targets $1"
ac_need_defaults=false ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
if \$ac_cs_recheck; then
echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
CONFIG_SHELL=$SHELL
export CONFIG_SHELL
exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
echo "$ac_log"
} >&5
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
#
# INIT-COMMANDS
#
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
tmp=
trap 'exit_status=$?
{ test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
' 0
trap '{ (exit 1); exit 1; }' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} ||
{
echo "$me: cannot create a temporary directory in ." >&2
{ (exit 1); exit 1; }
}
#
# Set up the sed scripts for CONFIG_FILES section.
#
# No need to generate the scripts if there are no CONFIG_FILES.
# This happens for instance when ./config.status config.h
if test -n "$CONFIG_FILES"; then
_ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
SHELL!$SHELL$ac_delim
PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
PACKAGE_NAME!$PACKAGE_NAME$ac_delim
PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
PACKAGE_STRING!$PACKAGE_STRING$ac_delim
PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
exec_prefix!$exec_prefix$ac_delim
prefix!$prefix$ac_delim
program_transform_name!$program_transform_name$ac_delim
bindir!$bindir$ac_delim
sbindir!$sbindir$ac_delim
libexecdir!$libexecdir$ac_delim
datarootdir!$datarootdir$ac_delim
datadir!$datadir$ac_delim
sysconfdir!$sysconfdir$ac_delim
sharedstatedir!$sharedstatedir$ac_delim
localstatedir!$localstatedir$ac_delim
includedir!$includedir$ac_delim
oldincludedir!$oldincludedir$ac_delim
docdir!$docdir$ac_delim
infodir!$infodir$ac_delim
htmldir!$htmldir$ac_delim
dvidir!$dvidir$ac_delim
pdfdir!$pdfdir$ac_delim
psdir!$psdir$ac_delim
libdir!$libdir$ac_delim
localedir!$localedir$ac_delim
mandir!$mandir$ac_delim
DEFS!$DEFS$ac_delim
ECHO_C!$ECHO_C$ac_delim
ECHO_N!$ECHO_N$ac_delim
ECHO_T!$ECHO_T$ac_delim
LIBS!$LIBS$ac_delim
build_alias!$build_alias$ac_delim
host_alias!$host_alias$ac_delim
target_alias!$target_alias$ac_delim
INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
INSTALL_DATA!$INSTALL_DATA$ac_delim
CYGPATH_W!$CYGPATH_W$ac_delim
PACKAGE!$PACKAGE$ac_delim
VERSION!$VERSION$ac_delim
ACLOCAL!$ACLOCAL$ac_delim
AUTOCONF!$AUTOCONF$ac_delim
AUTOMAKE!$AUTOMAKE$ac_delim
AUTOHEADER!$AUTOHEADER$ac_delim
MAKEINFO!$MAKEINFO$ac_delim
install_sh!$install_sh$ac_delim
STRIP!$STRIP$ac_delim
INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
mkdir_p!$mkdir_p$ac_delim
AWK!$AWK$ac_delim
SET_MAKE!$SET_MAKE$ac_delim
am__leading_dot!$am__leading_dot$ac_delim
AMTAR!$AMTAR$ac_delim
am__tar!$am__tar$ac_delim
am__untar!$am__untar$ac_delim
CC!$CC$ac_delim
CFLAGS!$CFLAGS$ac_delim
LDFLAGS!$LDFLAGS$ac_delim
CPPFLAGS!$CPPFLAGS$ac_delim
ac_ct_CC!$ac_ct_CC$ac_delim
EXEEXT!$EXEEXT$ac_delim
OBJEXT!$OBJEXT$ac_delim
DEPDIR!$DEPDIR$ac_delim
am__include!$am__include$ac_delim
am__quote!$am__quote$ac_delim
AMDEP_TRUE!$AMDEP_TRUE$ac_delim
AMDEP_FALSE!$AMDEP_FALSE$ac_delim
AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
CCDEPMODE!$CCDEPMODE$ac_delim
am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
CPP!$CPP$ac_delim
GREP!$GREP$ac_delim
EGREP!$EGREP$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 79; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
{ (exit 1); exit 1; }; }
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
if test -n "$ac_eof"; then
ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
ac_eof=`expr $ac_eof + 1`
fi
cat >>$CONFIG_STATUS <<_ACEOF
cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
_ACEOF
sed '
s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
s/^/s,@/; s/!/@,|#_!!_#|/
:n
t n
s/'"$ac_delim"'$/,g/; t
s/$/\\/; p
N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
' >>$CONFIG_STATUS <conf$$subs.sed
rm -f conf$$subs.sed
cat >>$CONFIG_STATUS <<_ACEOF
:end
s/|#_!!_#|//g
CEOF$ac_eof
_ACEOF
# VPATH may cause trouble with some makes, so we remove $(srcdir),
# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=/{
s/:*\$(srcdir):*/:/
s/:*\${srcdir}:*/:/
s/:*@srcdir@:*/:/
s/^\([^=]*=[ ]*\):*/\1/
s/:*$//
s/^[^=]*=[ ]*$//
}'
fi
cat >>$CONFIG_STATUS <<\_ACEOF
fi # test -n "$CONFIG_FILES"
for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
:L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
echo "$as_me: error: Invalid tag $ac_tag." >&2;}
{ (exit 1); exit 1; }; };;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
ac_save_IFS=$IFS
IFS=:
set x $ac_tag
IFS=$ac_save_IFS
shift
ac_file=$1
shift
case $ac_mode in
:L) ac_source=$1;;
:[FH])
ac_file_inputs=
for ac_f
do
case $ac_f in
-) ac_f="$tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
test -f "$ac_f" ||
case $ac_f in
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
{ { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
echo "$as_me: error: cannot find input file: $ac_f" >&2;}
{ (exit 1); exit 1; }; };;
esac
ac_file_inputs="$ac_file_inputs $ac_f"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
configure_input="Generated from "`IFS=:
echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
{ echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
fi
case $ac_tag in
*:-:* | *:-) cat >"$tmp/stdin";;
esac
;;
esac
ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
{ as_dir="$ac_dir"
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
echo "$as_me: error: cannot create directory $as_dir" >&2;}
{ (exit 1); exit 1; }; }; }
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
case $ac_mode in
:F)
#
# CONFIG_FILE
#
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
esac
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
case `sed -n '/datarootdir/ {
p
q
}
/@datadir@/p
/@docdir@/p
/@infodir@/p
/@localedir@/p
/@mandir@/p
' $ac_file_inputs` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
{ echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_datarootdir_hack='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
diff --git a/configure.ac b/configure.ac
index 467c58b..79b7972 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,62 +1,62 @@
AC_PREREQ(2.57)
-AC_INIT(m6809-run, 0.90, brian@oddchange.com)
+AC_INIT(m6809-run, 0.91, brian@oddchange.com)
AC_CONFIG_SRCDIR([6809.c])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_C_VOLATILE
# Checks for library functions.
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([memset socket strtoul])
# Template:
# AC_DEFINE will place in config.h; AC_SUBST updates the makefiles
#AC_DEFINE(VAR, value, [Doc string])
#AC_SUBST([VAR])
# Template for --enable options
#AC_ARG_ENABLE([name],
# AC_HELP_STRING([--enable-name], [doc string for option]),
# [enable_name=$enableval], [enable_name=default value])
#if test $enable_name = yes; then
# AC_DEFINE(CONFIG_NAME, 1, [doc string when enabled])
#fi
AC_ARG_ENABLE([wpc],
AC_HELP_STRING([--enable-wpc], [Enable WPC address map]),
[wpc=$enableval], [wpc=no])
if test $wpc = yes; then
AC_DEFINE(CONFIG_WPC, 1, [Use WPC address map])
fi
AC_ARG_ENABLE([6309],
AC_HELP_STRING([--enable-6309], [Enable 6309 extensions]),
[h6309=$enableval], [h6309=no])
if test $h6309 = yes; then
AC_DEFINE(H6309, 1, [Use 6309 extensions])
fi
# Template for --with options
#AC_ARG_WITH([name],
# AC_HELP_STRING([--with-name=<parameter-name>], [doc string]),
# [with_name=$withval], [with_name=default value])
#CONFIG_NAME="$with_name" etc.
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
|
bcd/exec09
|
dd523b354af2f318965d8f8e990a4b965f24ae27
|
Misc. enhancements:
|
diff --git a/6809.h b/6809.h
index f4c3cdc..a6d0baa 100644
--- a/6809.h
+++ b/6809.h
@@ -1,241 +1,243 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_H
#define M6809_H
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#else
#error
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
#error
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#else
#error
#endif
typedef uint8_t UINT8;
typedef signed char INT8;
typedef uint16_t UINT16;
typedef signed short INT16;
typedef uint32_t UINT32;
typedef signed int INT32;
typedef uint16_t target_addr_t;
#include "machine.h"
#define E_FLAG 0x80
#define F_FLAG 0x40
#define H_FLAG 0x20
#define I_FLAG 0x10
#define N_FLAG 0x08
#define Z_FLAG 0x04
#define V_FLAG 0x02
#define C_FLAG 0x01
extern int debug_enabled;
extern int need_flush;
extern unsigned long total;
extern int dump_cycles_on_success;
#ifdef OLDSYS
extern UINT8 *memory;
#endif
/* Primitive read/write macros */
#define read8(addr) cpu_read8 (addr)
#define write8(addr,val) do { cpu_write8 (addr, val); } while (0)
/* 16-bit versions */
#define read16(addr) (read8(addr) << 8 | read8(addr+1))
-#define write16(addr,val) do { write8(addr, val & 0xFF); write8(addr+1, (val >> 8) & 0xFF) } while (0)
+#define write16(addr,val) do { write8(addr+1, val & 0xFF); write8(addr, (val >> 8) & 0xFF); } while (0)
/* Fetch macros */
#define abs_read16(addr) ((abs_read8(addr) << 8) | abs_read8(addr+1))
#define fetch8() abs_read8 (pc++)
#define fetch16() (pc += 2, abs_read16(pc-2))
/* 6809.c */
extern int cpu_quit;
extern int cpu_execute (int);
extern void cpu_reset (void);
extern unsigned get_a (void);
extern unsigned get_b (void);
extern unsigned get_cc (void);
extern unsigned get_dp (void);
extern unsigned get_x (void);
extern unsigned get_y (void);
extern unsigned get_s (void);
extern unsigned get_u (void);
extern unsigned get_pc (void);
extern unsigned get_d (void);
extern void set_a (unsigned);
extern void set_b (unsigned);
extern void set_cc (unsigned);
extern void set_dp (unsigned);
extern void set_x (unsigned);
extern void set_y (unsigned);
extern void set_s (unsigned);
extern void set_u (unsigned);
extern void set_pc (unsigned);
extern void set_d (unsigned);
/* fileio.c */
struct pathlist
{
int count;
char *entry[32];
};
void path_init (struct pathlist *path);
void path_add (struct pathlist *path, const char *dir);
FILE * file_open (struct pathlist *path, const char *filename, const char *mode);
FILE * file_require_open (struct pathlist *path, const char *filename, const char *mode);
void file_close (FILE *fp);
/* monitor.c */
extern int monitor_on;
extern int check_break (unsigned);
extern void monitor_init (void);
extern int monitor6809 (void);
extern int dasm (char *, absolute_address_t);
extern int load_hex (char *);
extern int load_s19 (char *);
extern int load_bin (char *,int);
#define MAX_STRINGSPACE 32000
#define MAX_SYMBOL_HASH 1009
#define SYM_DEFAULT 0
#define SYM_AUTO 1
typedef struct
{
unsigned char format;
unsigned int size;
} datatype_t;
/* symtab.c */
struct stringspace
{
char space[32000];
unsigned int used;
};
struct symbol
{
char *name;
unsigned long value;
datatype_t ty;
unsigned int type;
struct symbol *name_chain;
struct symbol *value_chain;
};
struct symtab
{
struct symbol *syms_by_name[MAX_SYMBOL_HASH];
struct symbol *syms_by_value[MAX_SYMBOL_HASH];
struct symtab *parent;
};
extern struct symtab program_symtab;
extern struct symtab internal_symtab;
extern struct symtab auto_symtab;
void sym_add (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
void sym_set (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
int sym_find (struct symtab *symtab, const char *name, unsigned long *value, unsigned int type);
const char *sym_lookup (struct symtab *symtab, unsigned long value);
typedef void (*command_handler_t) (void);
typedef void (*virtual_handler_t) (unsigned long *val, int writep);
typedef unsigned int thread_id_t;
typedef struct
{
unsigned int id : 8;
unsigned int used : 1;
unsigned int enabled : 1;
unsigned int conditional : 1;
unsigned int threaded : 1;
unsigned int on_read : 1;
unsigned int on_write : 1;
unsigned int on_execute : 1;
unsigned int size : 4;
unsigned int keep_running : 1;
unsigned int temp : 1;
+ unsigned int last_write : 16;
+ unsigned int write_mask : 16;
absolute_address_t addr;
char condition[128];
thread_id_t tid;
unsigned int pass_count;
unsigned int ignore_count;
} breakpoint_t;
typedef struct
{
int used : 1;
datatype_t type;
char expr[128];
} display_t;
typedef struct
{
int id : 8;
thread_id_t tid;
} thread_t;
#define MAX_BREAKS 32
#define MAX_DISPLAYS 32
#define MAX_HISTORY 10
#define MAX_THREADS 64
void command_irq_hook (unsigned long cycles);
#endif /* M6809_H */
diff --git a/command.c b/command.c
index 6d3e534..3449d21 100644
--- a/command.c
+++ b/command.c
@@ -1,1341 +1,1433 @@
#include "6809.h"
#include "monitor.h"
#include "machine.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/errno.h>
#include <termios.h>
typedef struct
{
unsigned int size;
unsigned int count;
char **strings;
} cmdqueue_t;
/**********************************************************/
/********************* Global Data ************************/
/**********************************************************/
unsigned int break_count = 0;
breakpoint_t breaktab[MAX_BREAKS];
unsigned int active_break_count = 0;
unsigned int display_count = 0;
display_t displaytab[MAX_DISPLAYS];
unsigned int history_count = 0;
unsigned long historytab[MAX_HISTORY];
absolute_address_t examine_addr = 0;
unsigned int examine_repeat = 1;
datatype_t examine_type;
unsigned int thread_id_size = 2;
absolute_address_t thread_current;
absolute_address_t thread_id = 0;
thread_t threadtab[MAX_THREADS];
#define MAX_CMD_QUEUES 8
int command_stack_depth = -1;
cmdqueue_t command_stack[MAX_CMD_QUEUES];
datatype_t print_type;
char *command_flags;
int exit_command_loop;
#define IRQ_CYCLE_COUNTS 128
unsigned int irq_cycle_tab[IRQ_CYCLE_COUNTS] = { 0, };
unsigned int irq_cycle_entry = 0;
unsigned long irq_cycles = 0;
unsigned long eval (char *expr);
+unsigned long eval_mem (char *expr);
extern int auto_break_insn_count;
/**********************************************************/
/******************** 6809 Functions **********************/
/**********************************************************/
void
print_addr (absolute_address_t addr)
{
const char *name;
print_device_name (addr >> 28);
putchar (':');
printf ("0x%04X", addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
printf (" <%-16.16s>", name);
else
printf ("%-20.20s", "");
}
/**********************************************************/
/*********************** Functions ************************/
/**********************************************************/
void
syntax_error (const char *string)
{
fprintf (stderr, "error: %s\n", string);
}
void
save_value (unsigned long val)
{
historytab[history_count++ % MAX_HISTORY] = val;
}
unsigned long
eval_historical (unsigned int id)
{
return historytab[id % MAX_HISTORY];
}
void
assign_virtual (const char *name, unsigned long val)
{
unsigned long v_val;
if (!sym_find (&auto_symtab, name, &v_val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)v_val;
virtual (&val, 1);
return;
}
sym_set (&internal_symtab, name, val, 0);
if (!strcmp (name, "thread_current"))
{
printf ("Thread pointer initialized to ");
print_addr (val);
putchar ('\n');
thread_current = val;
}
}
unsigned long
eval_virtual (const char *name)
{
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
if (!sym_find (&auto_symtab, name, &val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)val;
virtual (&val, 0);
}
else if (!sym_find (&internal_symtab, name, &val, 0))
{
}
else
{
return 0;
}
return val;
}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
+ else
+ {
+ absolute_address_t dst = eval_mem (expr);
+ printf ("Setting %X to %02X\n", dst, val);
+ abs_write8 (dst, val);
+ }
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
case 'o':
case 'a':
case 's':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
char *
match_binary (char *expr, const char *op, char **secondp)
{
char *p;
p = strstr (expr, op);
if (!p)
return NULL;
*p = '\0';
p += strlen (op);
*secondp = p;
return expr;
}
int
fold_comparisons (char *expr, unsigned long *value)
{
char *p;
if (match_binary (expr, "==", &p))
*value = (eval (expr) == eval (p));
else if (match_binary (expr, "!=", &p))
*value = (eval (expr) != eval (p));
else
return 0;
return 1;
}
int
fold_binary (char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
eval_mem (char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
/* TODO - if expr is already in absolute form,
this explodes ! */
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
eval (char *expr)
{
char *p;
unsigned long val;
if (fold_comparisons (expr, &val));
else if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
unsigned int size = 1;
expr++;
if (*expr == '*')
{
expr++;
size = 2;
}
absolute_address_t addr = eval_mem (expr);
return target_read (addr, size);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
br->keep_running = 0;
br->ignore_count = 0;
br->temp = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
void
brkfree_temps (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].used && breaktab[n].temp)
{
brkfree (&breaktab[n]);
}
}
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
if (brkpt->keep_running)
printf (", print-only");
if (brkpt->temp)
printf (", temp");
+ if (brkpt->write_mask)
+ printf (", mask %02X\n", brkpt->write_mask);
putchar ('\n');
}
display_t *
display_alloc (void)
{
unsigned int n;
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (!ds->used)
{
ds->used = 1;
return ds;
}
}
}
void
display_free (display_t *ds)
{
}
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
switch (typep->format)
{
case 'a':
print_addr (val);
return;
case 's':
{
absolute_address_t addr = (absolute_address_t)val;
char c;
putchar ('"');
while ((c = abs_read8 (addr++)) != '\0')
putchar (c);
putchar ('"');
return;
}
}
if (typep->format == 'x')
{
printf ("0x");
sprintf (f, "%%0%d%c", typep->size * 2, typep->format);
}
else if (typep->format == 'o')
{
printf ("0");
sprintf (f, "%%%c", typep->format);
}
else
sprintf (f, "%%%c", typep->format);
printf (f, val);
}
void
display_print (void)
{
unsigned int n;
char comma = '\0';
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (ds->used)
{
char expr[256];
strcpy (expr, ds->expr);
printf ("%c %s = ", comma, expr);
print_value (eval (expr), &ds->type);
comma = ',';
}
}
if (comma)
putchar ('\n');
}
int
print_insn (absolute_address_t addr)
{
char buf[64];
int size = dasm (buf, addr);
printf ("%s", buf);
return size;
}
void
do_examine (void)
{
unsigned int n;
unsigned int objs_per_line = 16;
if (isdigit (*command_flags))
examine_repeat = strtoul (command_flags, &command_flags, 0);
if (*command_flags == 'i')
examine_type.format = *command_flags;
else
parse_format_flag (command_flags, &examine_type.format);
parse_size_flag (command_flags, &examine_type.size);
switch (examine_type.format)
{
case 'i':
objs_per_line = 1;
break;
case 'w':
objs_per_line = 8;
break;
}
for (n = 0; n < examine_repeat; n++)
{
if ((n % objs_per_line) == 0)
{
putchar ('\n');
print_addr (examine_addr);
printf (": ");
}
switch (examine_type.format)
{
case 's': /* string */
break;
case 'i': /* instruction */
examine_addr += print_insn (examine_addr);
break;
default:
print_value (target_read (examine_addr, examine_type.size),
&examine_type);
putchar (' ');
examine_addr += examine_type.size;
}
}
putchar ('\n');
}
void
do_print (char *expr)
{
unsigned long val = eval (expr);
printf ("$%d = ", history_count);
parse_format_flag (command_flags, &print_type.format);
parse_size_flag (command_flags, &print_type.size);
print_value (val, &print_type);
putchar ('\n');
save_value (val);
}
void
do_set (char *expr)
{
unsigned long val = eval (expr);
save_value (val);
}
#define THREAD_DATA_PC 3
#define THREAD_DATA_ROMBANK 9
void
print_thread_data (absolute_address_t th)
{
U8 b;
U16 w;
absolute_address_t pc;
w = abs_read16 (th + THREAD_DATA_PC);
b = abs_read8 (th + THREAD_DATA_ROMBANK);
printf ("{ PC = %04X, BANK = %02X }", w, b);
}
void
command_change_thread (void)
{
target_addr_t addr = target_read (thread_current, thread_id_size);
absolute_address_t th = to_absolute (addr);
if (th == thread_id)
return;
thread_id = th;
if (machine->dump_thread && eval ("$thread_debug"))
{
if (addr)
{
printf ("[Current thread = ");
print_addr (thread_id);
machine->dump_thread (thread_id);
print_thread_data (thread_id);
printf ("]\n");
}
else
{
printf ("[ No thread ]\n");
}
}
}
void
command_stack_push (unsigned int reason)
{
cmdqueue_t *q = &command_stack[++command_stack_depth];
}
void
command_stack_pop (void)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
--command_stack_depth;
}
void
command_stack_add (const char *cmd)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
}
char *
getarg (void)
{
return strtok (NULL, " \t\n");
}
/****************** Command Handlers ************************/
void cmd_print (void)
{
char *arg = getarg ();
if (arg)
do_print (arg);
else
do_print ("$");
}
void cmd_set (void)
{
char *arg = getarg ();
if (arg)
do_set (arg);
else
do_set ("$");
}
void cmd_examine (void)
{
char *arg = getarg ();
if (arg)
examine_addr = eval_mem (arg);
do_examine ();
}
void cmd_break (void)
{
char *arg = getarg ();
if (!arg)
return;
unsigned long val = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = val;
br->on_execute = 1;
if ((arg = getarg()) && !strcmp (arg, "if"))
{
br->conditional = 1;
arg = getarg ();
strcpy (br->condition, arg);
}
brkprint (br);
}
void cmd_watch1 (int on_read, int on_write)
{
char *arg;
arg = getarg ();
if (!arg)
return;
absolute_address_t addr = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = addr;
br->on_read = on_read;
br->on_write = on_write;
- arg = getarg ();
- if (!arg)
- return;
-
- if (!strcmp (arg, "print"))
- br->keep_running = 1;
- else if (!strcmp (arg, "if"))
+ for (;;)
{
arg = getarg ();
- br->conditional = 1;
- strcpy (br->condition, arg);
+ if (!arg)
+ return;
+
+ if (!strcmp (arg, "print"))
+ br->keep_running = 1;
+ else if (!strcmp (arg, "mask"))
+ {
+ arg = getarg ();
+ br->write_mask = strtoul (arg, NULL, 0);
+ }
+ else if (!strcmp (arg, "if"))
+ {
+ arg = getarg ();
+ br->conditional = 1;
+ strcpy (br->condition, arg);
+ }
}
brkprint (br);
}
void cmd_watch (void)
{
cmd_watch1 (0, 1);
}
void cmd_rwatch (void)
{
cmd_watch1 (1, 0);
}
void cmd_awatch (void)
{
cmd_watch1 (1, 1);
}
void cmd_break_list (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
brkprint (&breaktab[n]);
}
void cmd_step (void)
{
auto_break_insn_count = 1;
exit_command_loop = 0;
}
void cmd_next (void)
{
char buf[128];
breakpoint_t *br;
unsigned long addr = to_absolute (get_pc ());
addr += dasm (buf, addr);
br = brkalloc ();
br->addr = addr;
br->on_execute = 1;
br->temp = 1;
/* TODO - for conditional branches, should also set a
temp breakpoint at the branch target */
exit_command_loop = 0;
}
void cmd_continue (void)
{
exit_command_loop = 0;
}
void cmd_quit (void)
{
cpu_quit = 0;
exit_command_loop = 1;
}
void cmd_delete (void)
{
const char *arg = getarg ();
unsigned int id;
if (!arg)
{
int n;
printf ("Deleting all breakpoints.\n");
for (id = 0; id < MAX_BREAKS; id++)
{
breakpoint_t *br = brkfind_by_id (id);
brkfree (br);
}
return;
}
id = atoi (arg);
breakpoint_t *br = brkfind_by_id (id);
if (br->used)
{
printf ("Deleting breakpoint %d\n", id);
brkfree (br);
}
}
void cmd_list (void)
{
char *arg;
static absolute_address_t lastpc = 0;
static absolute_address_t lastaddr = 0;
absolute_address_t addr;
int n;
arg = getarg ();
if (arg)
addr = eval_mem (arg);
else
{
addr = to_absolute (get_pc ());
if (addr == lastpc)
addr = lastaddr;
else
lastaddr = lastpc = addr;
}
for (n = 0; n < 10; n++)
{
print_addr (addr);
printf (" : ");
addr += print_insn (addr);
putchar ('\n');
}
lastaddr = addr;
}
void cmd_symbol_file (void)
{
char *arg = getarg ();
if (arg)
load_map_file (arg);
}
void cmd_display (void)
{
char *arg;
while ((arg = getarg ()) != NULL)
{
display_t *ds = display_alloc ();
strcpy (ds->expr, arg);
ds->type = print_type;
parse_format_flag (command_flags, &ds->type.format);
parse_size_flag (command_flags, &ds->type.size);
}
}
int command_exec_file (const char *filename)
{
FILE *infile;
extern int command_exec (FILE *);
infile = file_open (NULL, filename, "r");
if (!infile)
return 0;
while (command_exec (infile) >= 0);
fclose (infile);
return 1;
}
void cmd_source (void)
{
char *arg = getarg ();
if (!arg)
return;
if (command_exec_file (arg) == 0)
fprintf (stderr, "can't open %s\n", arg);
}
void cmd_regs (void)
{
}
void cmd_vars (void)
{
for_each_var (NULL);
}
+void cmd_measure (void)
+{
+ absolute_address_t addr;
+ target_addr_t retaddr = get_pc ();
+ breakpoint_t *br;
+
+ /* Get the address of the function to be measured. */
+ char *arg = getarg ();
+ if (!arg)
+ return;
+ addr = eval_mem (arg);
+ printf ("Measuring ");
+ print_addr (addr);
+ printf (" back to ");
+ print_addr (to_absolute (retaddr));
+ putchar ('\n');
+
+ /* Push the current PC onto the stack for the
+ duration of the measurement. */
+ set_s (get_s () - 2);
+ write16 (get_s (), retaddr);
+
+ /* Set a temp breakpoint at the current PC, so that
+ the measurement will halt. */
+ br = brkalloc ();
+ br->addr = to_absolute (retaddr);
+ br->on_execute = 1;
+ br->temp = 1;
+
+ /* Interrupts must be disabled for this to work ! */
+ set_cc (get_cc () | 0x50);
+
+ /* Change the PC to the function-under-test. */
+ set_pc (addr);
+
+ /* Go! */
+ exit_command_loop = 0;
+}
+
+
+void cmd_dump (void)
+{
+ extern int dump_every_insn;
+
+ char *arg = getarg ();
+ if (arg)
+ dump_every_insn = strtoul (arg, NULL, 0);
+ printf ("Instruction dump is %s\n",
+ dump_every_insn ? "on" : "off");
+}
+
+
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
{ "s", "step", cmd_step,
"Step one instruction" },
{ "n", "next", cmd_next,
"Break at the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
{ "wa", "watch", cmd_watch,
"Add a watchpoint on write" },
{ "rwa", "rwatch", cmd_rwatch,
"Add a watchpoint on read" },
{ "awa", "awatch", cmd_awatch,
"Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
{ "l", "list", cmd_list },
{ "sym", "symbol-file", cmd_symbol_file,
"Open a symbol table file" },
{ "di", "display", cmd_display,
"Add a display expression" },
{ "so", "source", cmd_source,
"Run a command script" },
{ "regs", "regs", cmd_regs,
"Show all CPU registers" },
{ "vars", "vars", cmd_vars,
"Show all program variables" },
+ { "me", "measure", cmd_measure,
+ "Measure time that a function takes" },
+ { "dump", "dump", cmd_dump,
+ "Set dump-instruction flag" },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
{ "f", "file", cmd_file,
"Choose the program to be debugged" },
{ "exe", "exec-file", cmd_exec_file,
"Open an executable" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
/* TODO - look for a match anywhere between
* the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
void
print_current_insn (void)
{
absolute_address_t addr = to_absolute (get_pc ());
print_addr (addr);
printf (" : ");
print_insn (addr);
putchar ('\n');
}
int
command_exec (FILE *infile)
{
char buffer[256];
static char prev_buffer[256];
char *cmd;
command_handler_t handler;
int rc;
do {
errno = 0;
fgets (buffer, 255, infile);
if (feof (infile))
return -1;
} while (errno != 0);
/* In terminal mode, a blank line means to execute
the previous command. */
if (buffer[0] == '\n')
strcpy (buffer, prev_buffer);
/* Skip comments */
if (*buffer == '#')
return 0;
cmd = strtok (buffer, " \t\n");
if (!cmd)
return 0;
strcpy (prev_buffer, cmd);
handler = command_lookup (cmd);
if (!handler)
{
syntax_error ("no such command");
return 0;
}
(*handler) ();
return 0;
}
void
keybuffering (int flag)
{
struct termios tio;
tcgetattr (0, &tio);
if (!flag) /* 0 = no buffering = not default */
tio.c_lflag &= ~ICANON;
else /* 1 = buffering = default */
tio.c_lflag |= ICANON;
tcsetattr (0, TCSANOW, &tio);
}
int
command_loop (void)
{
keybuffering (1);
brkfree_temps ();
display_print ();
print_current_insn ();
exit_command_loop = -1;
while (exit_command_loop < 0)
{
command_prompt ();
if (command_exec (stdin) < 0)
break;
}
if (exit_command_loop == 0)
keybuffering (0);
return (exit_command_loop);
}
void
breakpoint_hit (breakpoint_t *br)
{
if (br->threaded && (thread_id != br->tid))
return;
if (br->conditional)
{
if (eval (br->condition) == 0)
return;
}
if (br->ignore_count)
{
--br->ignore_count;
return;
}
monitor_on = !br->keep_running;
}
void
command_insn_hook (void)
{
absolute_address_t abspc;
breakpoint_t *br;
if (active_break_count == 0)
return;
abspc = to_absolute (get_pc ());
br = brkfind_by_addr (abspc);
if (br && br->enabled && br->on_execute)
{
breakpoint_hit (br);
if (monitor_on == 0)
return;
if (br->temp)
brkfree (br);
else
printf ("Breakpoint %d reached.\n", br->id);
}
}
void
command_read_hook (absolute_address_t addr)
{
breakpoint_t *br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_read)
{
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf ("]\n");
breakpoint_hit (br);
}
}
void
command_write_hook (absolute_address_t addr, U8 val)
{
breakpoint_t *br;
br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_write)
{
+ if (br->write_mask)
+ {
+ int mask_ok = ((br->last_write & br->write_mask) !=
+ (val & br->write_mask));
+
+ br->last_write = val;
+ if (!mask_ok)
+ return;
+ }
+
breakpoint_hit (br);
if (monitor_on == 0)
return;
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf (" = 0x%02X", val);
printf ("]\n");
}
if (thread_id_size && (addr == thread_current + thread_id_size - 1))
{
command_change_thread ();
}
}
void pc_virtual (unsigned long *val, int writep) {
writep ? set_pc (*val) : (*val = get_pc ());
}
void x_virtual (unsigned long *val, int writep) {
writep ? set_x (*val) : (*val = get_x ());
}
void y_virtual (unsigned long *val, int writep) {
writep ? set_y (*val) : (*val = get_y ());
}
void u_virtual (unsigned long *val, int writep) {
writep ? set_u (*val) : (*val = get_u ());
}
void s_virtual (unsigned long *val, int writep) {
writep ? set_s (*val) : (*val = get_s ());
}
void d_virtual (unsigned long *val, int writep) {
writep ? set_d (*val) : (*val = get_d ());
}
void a_virtual (unsigned long *val, int writep) {
writep ? set_a (*val) : (*val = get_a ());
}
void b_virtual (unsigned long *val, int writep) {
writep ? set_b (*val) : (*val = get_b ());
}
void dp_virtual (unsigned long *val, int writep) {
writep ? set_dp (*val) : (*val = get_dp ());
}
void cc_virtual (unsigned long *val, int writep) {
writep ? set_cc (*val) : (*val = get_cc ());
}
void irq_load_virtual (unsigned long *val, int writep) {
if (!writep)
*val = irq_cycles / IRQ_CYCLE_COUNTS;
}
void cycles_virtual (unsigned long *val, int writep)
{
if (!writep)
*val = get_cycles ();
}
+void et_virtual (unsigned long *val, int writep)
+{
+ static unsigned long last_cycles = 0;
+ if (!writep)
+ *val = get_cycles () - last_cycles;
+ last_cycles = get_cycles ();
+}
+
void
command_exit_irq_hook (unsigned long cycles)
{
irq_cycles -= irq_cycle_tab[irq_cycle_entry];
irq_cycles += cycles;
irq_cycle_tab[irq_cycle_entry] = cycles;
irq_cycle_entry = (irq_cycle_entry + 1) % IRQ_CYCLE_COUNTS;
//printf ("IRQ took %lu cycles\n", cycles);
//printf ("Average = %d\n", irq_cycles / IRQ_CYCLE_COUNTS);
}
void
command_init (void)
{
int rc;
sym_add (&auto_symtab, "pc", (unsigned long)pc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "x", (unsigned long)x_virtual, SYM_AUTO);
sym_add (&auto_symtab, "y", (unsigned long)y_virtual, SYM_AUTO);
sym_add (&auto_symtab, "u", (unsigned long)u_virtual, SYM_AUTO);
sym_add (&auto_symtab, "s", (unsigned long)s_virtual, SYM_AUTO);
sym_add (&auto_symtab, "d", (unsigned long)d_virtual, SYM_AUTO);
sym_add (&auto_symtab, "a", (unsigned long)a_virtual, SYM_AUTO);
sym_add (&auto_symtab, "b", (unsigned long)b_virtual, SYM_AUTO);
sym_add (&auto_symtab, "dp", (unsigned long)dp_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cc", (unsigned long)cc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cycles", (unsigned long)cycles_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "et", (unsigned long)et_virtual, SYM_AUTO);
sym_add (&auto_symtab, "irqload", (unsigned long)irq_load_virtual, SYM_AUTO);
examine_type.format = 'x';
examine_type.size = 1;
print_type.format = 'x';
print_type.size = 1;
(void)command_exec_file (".dbinit");
}
/* vim: set ts=3: */
/* vim: set expandtab: */
diff --git a/machine.c b/machine.c
index ff850e3..4e0547b 100644
--- a/machine.c
+++ b/machine.c
@@ -1,637 +1,648 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "machine.h"
#include "eon.h"
#define CONFIG_LEGACY
#define MISSING 0xff
#define mmu_device (device_table[0])
extern void eon_init (const char *);
extern void wpc_init (const char *);
struct machine *machine;
unsigned int device_count = 0;
struct hw_device *device_table[MAX_BUS_DEVICES];
struct bus_map busmaps[NUM_BUS_MAPS];
struct bus_map default_busmaps[NUM_BUS_MAPS];
U16 fault_addr;
U8 fault_type;
int system_running = 0;
void cpu_is_running (void)
{
system_running = 1;
}
/**
* Attach a new device to the bus. Only called during init.
*/
struct hw_device *device_attach (struct hw_class *class_ptr, unsigned int size, void *priv)
{
struct hw_device *dev = malloc (sizeof (struct hw_device));
dev->class_ptr = class_ptr;
dev->devid = device_count;
dev->size = size;
dev->priv = priv;
device_table[device_count++] = dev;
/* Attach implies reset */
class_ptr->reset (dev);
return dev;
};
/**
* Map a portion of a device into the CPU's address space.
*/
void bus_map (unsigned int addr,
unsigned int devid,
unsigned long offset,
unsigned int len,
unsigned int flags)
{
struct bus_map *map;
unsigned int start, count;
/* Warn if trying to map too much */
if (addr + len > MAX_CPU_ADDR)
{
fprintf (stderr, "warning: mapping %04X bytes into %04X causes overflow\n",
len, addr);
}
/* Round address and length to be multiples of the map unit size. */
addr = ((addr + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
len = ((len + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
offset = ((offset + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
/* Convert from byte addresses to unit counts */
start = addr / BUS_MAP_SIZE;
count = len / BUS_MAP_SIZE;
/* Initialize the maps. This will let the CPU access the device. */
map = &busmaps[start];
while (count > 0)
{
if (!(map->flags & MAP_FIXED))
{
map->devid = devid;
map->offset = offset;
map->flags = flags;
}
count--;
map++;
offset += BUS_MAP_SIZE;
}
}
void device_define (struct hw_device *dev,
unsigned long offset,
unsigned int addr,
unsigned int len,
unsigned int flags)
{
bus_map (addr, dev->devid, offset, len, flags);
}
void bus_unmap (unsigned int addr, unsigned int len)
{
struct bus_map *map;
unsigned int start, count;
/* Round address and length to be multiples of the map unit size. */
addr = ((addr + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
len = ((len + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
/* Convert from byte addresses to unit counts */
start = addr / BUS_MAP_SIZE;
count = len / BUS_MAP_SIZE;
/* Set the maps to their defaults. */
memcpy (&busmaps[start], &default_busmaps[start],
sizeof (struct bus_map) * count);
}
/**
* Generate a page fault. ADDR says which address was accessed
* incorrectly. TYPE says what kind of violation occurred.
*/
static struct bus_map *find_map (unsigned int addr)
{
return &busmaps[addr / BUS_MAP_SIZE];
}
static struct hw_device *find_device (unsigned int addr, unsigned char id)
{
/* Fault if any invalid device is accessed */
if ((id == INVALID_DEVID) || (id >= device_count))
machine->fault (addr, FAULT_NO_RESPONSE);
return device_table[id];
}
void
print_device_name (unsigned int devno)
{
struct hw_device *dev = device_table[devno];
printf ("%02X", devno);
}
absolute_address_t
absolute_from_reladdr (unsigned int device, unsigned long reladdr)
{
return (device * 0x10000000L) + reladdr;
}
U8 abs_read8 (absolute_address_t addr)
{
unsigned int id = addr >> 28;
unsigned long phy_addr = addr & 0xFFFFFFF;
struct hw_device *dev = device_table[id];
struct hw_class *class_ptr = dev->class_ptr;
return (*class_ptr->read) (dev, phy_addr);
}
/**
* Called by the CPU to read a byte.
*/
U8 cpu_read8 (unsigned int addr)
{
struct bus_map *map = find_map (addr);
struct hw_device *dev = find_device (addr, map->devid);
struct hw_class *class_ptr = dev->class_ptr;
unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE;
command_read_hook (absolute_from_reladdr (map->devid, phy_addr));
return (*class_ptr->read) (dev, phy_addr);
}
/**
* Called by the CPU to write a byte.
*/
void cpu_write8 (unsigned int addr, U8 val)
{
struct bus_map *map = find_map (addr);
struct hw_device *dev = find_device (addr, map->devid);
struct hw_class *class_ptr = dev->class_ptr;
unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE;
+ U8 oldval;
/* This can fail if the area is read-only */
if (system_running && (map->flags & MAP_READONLY))
machine->fault (addr, FAULT_NOT_WRITABLE);
else
(*class_ptr->write) (dev, phy_addr, val);
command_write_hook (absolute_from_reladdr (map->devid, phy_addr), val);
}
+void abs_write8 (absolute_address_t addr, U8 val)
+{
+ unsigned int id = addr >> 28;
+ unsigned long phy_addr = addr & 0xFFFFFFF;
+ struct hw_device *dev = device_table[id];
+ struct hw_class *class_ptr = dev->class_ptr;
+ class_ptr->write (dev, phy_addr, val);
+}
+
+
absolute_address_t
to_absolute (unsigned long cpuaddr)
{
struct bus_map *map = find_map (cpuaddr);
struct hw_device *dev = find_device (cpuaddr, map->devid);
unsigned long phy_addr = map->offset + cpuaddr % BUS_MAP_SIZE;
return absolute_from_reladdr (map->devid, phy_addr);
}
void dump_machine (void)
{
unsigned int mapno;
unsigned int n;
for (mapno = 0; mapno < NUM_BUS_MAPS; mapno++)
{
struct bus_map *map = &busmaps[mapno];
printf ("Map %d addr=%04X dev=%d offset=%04X size=%06X\n",
mapno, mapno * BUS_MAP_SIZE, map->devid, map->offset,
0 /* device_table[map->devid]->size */);
#if 0
for (n = 0; n < BUS_MAP_SIZE; n++)
printf ("%02X ", cpu_read8 (mapno * BUS_MAP_SIZE + n));
printf ("\n");
#endif
}
}
/**********************************************************/
void null_reset (struct hw_device *dev)
{
}
U8 null_read (struct hw_device *dev, unsigned long addr)
{
return 0;
}
void null_write (struct hw_device *dev, unsigned long addr, U8 val)
{
}
/**********************************************************/
void ram_reset (struct hw_device *dev)
{
memset (dev->priv, 0, dev->size);
}
U8 ram_read (struct hw_device *dev, unsigned long addr)
{
char *buf = dev->priv;
return buf[addr];
}
void ram_write (struct hw_device *dev, unsigned long addr, U8 val)
{
char *buf = dev->priv;
buf[addr] = val;
}
struct hw_class ram_class =
{
.readonly = 0,
.reset = ram_reset,
.read = ram_read,
.write = ram_write,
};
struct hw_device *ram_create (unsigned long size)
{
void *buf = malloc (size);
return device_attach (&ram_class, size, buf);
}
/**********************************************************/
struct hw_class rom_class =
{
.readonly = 1,
.reset = null_reset,
.read = ram_read,
.write = ram_write,
};
struct hw_device *rom_create (const char *filename, unsigned int maxsize)
{
FILE *fp;
struct hw_device *dev;
unsigned int image_size;
char *buf;
if (filename)
{
fp = file_open (NULL, filename, "rb");
if (!fp)
return NULL;
image_size = sizeof_file (fp);
}
buf = malloc (maxsize);
dev = device_attach (&rom_class, maxsize, buf);
if (filename)
{
fread (buf, image_size, 1, fp);
fclose (fp);
maxsize -= image_size;
while (maxsize > 0)
{
memcpy (buf + image_size, buf, image_size);
buf += image_size;
maxsize -= image_size;
}
}
return dev;
}
/**********************************************************/
U8 console_read (struct hw_device *dev, unsigned long addr)
{
switch (addr)
{
case CON_IN:
return getchar ();
default:
return MISSING;
}
}
void console_write (struct hw_device *dev, unsigned long addr, U8 val)
{
switch (addr)
{
case CON_OUT:
putchar (val);
break;
case CON_EXIT:
sim_exit (val);
break;
default:
break;
}
}
struct hw_class console_class =
{
.readonly = 0,
.reset = null_reset,
.read = console_read,
.write = console_write,
};
struct hw_device *console_create (void)
{
return device_attach (&console_class, BUS_MAP_SIZE, NULL);
}
/**********************************************************/
U8 mmu_regs[MMU_PAGECOUNT][MMU_PAGEREGS];
U8 mmu_read (struct hw_device *dev, unsigned long addr)
{
switch (addr)
{
case 0x60:
return fault_addr >> 8;
case 0x61:
return fault_addr & 0xFF;
case 0x62:
return fault_type;
default:
{
unsigned int page = (addr / MMU_PAGEREGS) % MMU_PAGECOUNT;
unsigned int reg = addr % MMU_PAGEREGS;
U8 val = mmu_regs[page][reg];
//printf ("\n%02X, %02X = %02X\n", page, reg, val);
return val;
}
}
}
void mmu_write (struct hw_device *dev, unsigned long addr, U8 val)
{
unsigned int page = (addr / MMU_PAGEREGS) % MMU_PAGECOUNT;
unsigned int reg = addr % MMU_PAGEREGS;
mmu_regs[page][reg] = val;
bus_map (page * MMU_PAGESIZE,
mmu_regs[page][0],
mmu_regs[page][1] * MMU_PAGESIZE,
MMU_PAGESIZE,
mmu_regs[page][2] & 0x1);
}
void mmu_reset (struct hw_device *dev)
{
unsigned int page;
for (page = 0; page < MMU_PAGECOUNT; page++)
{
mmu_write (dev, page * MMU_PAGEREGS + 0, 0);
mmu_write (dev, page * MMU_PAGEREGS + 1, 0);
mmu_write (dev, page * MMU_PAGEREGS + 2, 0);
}
}
void mmu_reset_complete (struct hw_device *dev)
{
unsigned int page;
const struct bus_map *map;
/* Examine all of the bus_maps in place now, and
sync with the MMU registers. */
for (page = 0; page < MMU_PAGECOUNT; page++)
{
map = &busmaps[4 + page * (MMU_PAGESIZE / BUS_MAP_SIZE)];
mmu_regs[page][0] = map->devid;
mmu_regs[page][1] = map->offset / MMU_PAGESIZE;
mmu_regs[page][2] = map->flags & 0x1;
/* printf ("%02X %02X %02X\n",
map->devid, map->offset / MMU_PAGESIZE,
map->flags); */
}
}
struct hw_class mmu_class =
{
.readonly = 0,
.reset = mmu_reset,
.read = mmu_read,
.write = mmu_write,
};
struct hw_device *mmu_create (void)
{
return device_attach (&mmu_class, BUS_MAP_SIZE, NULL);
}
/**********************************************************/
/* The disk drive is emulated as follows:
* The disk is capable of "bus-mastering" and is able to dump data directly
* into the RAM, without CPU-involvement. (The pages do not even need to
* be mapped.) A transaction is initiated with the following parameters:
*
* - address of RAM, aligned to 512 bytes, must reside in lower 32KB.
* Thus there are 64 possible sector locations.
* - address of disk sector, given as a 16-bit value. This allows for up to
* a 32MB disk.
* - direction, either to disk or from disk.
*
* Emulation is synchronous with respect to the CPU.
*/
struct disk_priv
{
FILE *fp;
struct hw_device *dev;
unsigned long offset;
struct hw_device *ramdev;
unsigned int sectors;
char *ram;
};
U8 disk_read (struct hw_device *dev, unsigned long addr)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
}
void disk_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
switch (addr)
{
case DSK_ADDR:
disk->ram = disk->ramdev->priv + val * SECTOR_SIZE;
break;
case DSK_SECTOR:
disk->offset = val; /* high byte */
break;
case DSK_SECTOR+1:
disk->offset = (disk->offset << 8) | val;
disk->offset *= SECTOR_SIZE;
fseek (disk->fp, disk->offset, SEEK_SET);
break;
case DSK_CTRL:
if (val & DSK_READ)
{
fread (disk->ram, SECTOR_SIZE, 1, disk->fp);
}
else if (val & DSK_WRITE)
{
fwrite (disk->ram, SECTOR_SIZE, 1, disk->fp);
}
else if (val & DSK_ERASE)
{
char empty_sector[SECTOR_SIZE];
memset (empty_sector, 0xff, SECTOR_SIZE);
fwrite (empty_sector, SECTOR_SIZE, 1, disk->fp);
}
if (val & DSK_FLUSH)
{
fflush (disk->fp);
}
break;
}
}
void disk_reset (struct hw_device *dev)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
disk_write (dev, DSK_ADDR, 0);
disk_write (dev, DSK_SECTOR, 0);
disk_write (dev, DSK_SECTOR+1, 0);
disk_write (dev, DSK_CTRL, DSK_FLUSH);
}
void disk_format (struct hw_device *dev)
{
unsigned int sector;
struct disk_priv *disk = (struct disk_priv *)dev->priv;
for (sector = 0; sector < disk->sectors; sector++)
{
disk_write (dev, DSK_SECTOR, sector >> 8);
disk_write (dev, DSK_SECTOR+1, sector & 0xFF);
disk_write (dev, DSK_CTRL, DSK_ERASE);
}
disk_write (dev, DSK_CTRL, DSK_FLUSH);
}
struct hw_class disk_class =
{
.readonly = 0,
.reset = disk_reset,
.read = disk_read,
.write = disk_write,
};
struct hw_device *disk_create (const char *backing_file)
{
struct disk_priv *disk = malloc (sizeof (struct disk_priv));
int newdisk = 0;
disk->fp = file_open (NULL, backing_file, "r+b");
if (disk->fp == NULL)
{
printf ("warning: disk does not exist, creating\n");
disk->fp = file_open (NULL, backing_file, "w+b");
newdisk = 1;
if (disk->fp == NULL)
{
printf ("warning: disk not created\n");
}
}
disk->ram = 0;
disk->ramdev = device_table[1];
disk->dev = device_attach (&disk_class, BUS_MAP_SIZE, disk);
disk->sectors = DISK_SECTOR_COUNT;
if (newdisk)
disk_format (disk->dev);
return disk->dev;
}
/**********************************************************/
int machine_match (const char *machine_name, const char *boot_rom_file, struct machine *m)
{
if (!strcmp (m->name, machine_name))
{
machine = m;
m->init (boot_rom_file);
return 1;
}
return 0;
}
void machine_init (const char *machine_name, const char *boot_rom_file)
{
extern struct machine simple_machine;
extern struct machine eon_machine;
extern struct machine wpc_machine;
memset (busmaps, 0, sizeof (busmaps));
if (machine_match (machine_name, boot_rom_file, &simple_machine));
else if (machine_match (machine_name, boot_rom_file, &eon_machine));
else if (machine_match (machine_name, boot_rom_file, &wpc_machine));
else exit (1);
/* Save the default busmap configuration, before the
CPU begins to run, so that it can be restored if
necessary. */
memcpy (default_busmaps, busmaps, sizeof (busmaps));
if (!strcmp (machine_name, "eon"))
mmu_reset_complete (mmu_device);
}
diff --git a/monitor.c b/monitor.c
index a328151..6324cd6 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,551 +1,552 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include "monitor.h"
#include <ctype.h>
#include <signal.h>
/* The function call stack */
struct function_call fctab[MAX_FUNCTION_CALLS];
/* The top of the function call stack */
struct function_call *current_function_call;
/* Automatically break after executing this many instructions */
int auto_break_insn_count = 0;
int monitor_on = 0;
+int dump_every_insn = 0;
enum addr_mode
{
_illegal, _implied, _imm_byte, _imm_word, _direct, _extended,
_indexed, _rel_byte, _rel_word, _reg_post, _sys_post, _usr_post
};
enum opcode
{
_undoc, _abx, _adca, _adcb, _adda, _addb, _addd, _anda, _andb,
_andcc, _asla, _aslb, _asl, _asra, _asrb, _asr, _bcc, _lbcc,
_bcs, _lbcs, _beq, _lbeq, _bge, _lbge, _bgt, _lbgt, _bhi,
_lbhi, _bita, _bitb, _ble, _lble, _bls, _lbls, _blt, _lblt,
_bmi, _lbmi, _bne, _lbne, _bpl, _lbpl, _bra, _lbra, _brn,
_lbrn, _bsr, _lbsr, _bvc, _lbvc, _bvs, _lbvs, _clra, _clrb,
_clr, _cmpa, _cmpb, _cmpd, _cmps, _cmpu, _cmpx, _cmpy, _coma,
_comb, _com, _cwai, _daa, _deca, _decb, _dec, _eora, _eorb,
_exg, _inca, _incb, _inc, _jmp, _jsr, _lda, _ldb, _ldd,
_lds, _ldu, _ldx, _ldy, _leas, _leau, _leax, _leay, _lsra,
_lsrb, _lsr, _mul, _nega, _negb, _neg, _nop, _ora, _orb,
_orcc, _pshs, _pshu, _puls, _pulu, _rola, _rolb, _rol, _rora,
_rorb, _ror, _rti, _rts, _sbca, _sbcb, _sex, _sta, _stb,
_std, _sts, _stu, _stx, _sty, _suba, _subb, _subd, _swi,
_swi2, _swi3, _sync, _tfr, _tsta, _tstb, _tst, _reset,
#ifdef H6309
_negd, _comd, _lsrd, _rord, _asrd, _rold, _decd, _incd, _tstd,
_clrd
#endif
};
char *mne[] = {
"???", "ABX", "ADCA", "ADCB", "ADDA", "ADDB", "ADDD", "ANDA", "ANDB",
"ANDCC", "ASLA", "ASLB", "ASL", "ASRA", "ASRB", "ASR", "BCC", "LBCC",
"BCS", "LBCS", "BEQ", "LBEQ", "BGE", "LBGE", "BGT", "LBGT", "BHI",
"LBHI", "BITA", "BITB", "BLE", "LBLE", "BLS", "LBLS", "BLT", "LBLT",
"BMI", "LBMI", "BNE", "LBNE", "BPL", "LBPL", "BRA", "LBRA", "BRN",
"LBRN", "BSR", "LBSR", "BVC", "LBVC", "BVS", "LBVS", "CLRA", "CLRB",
"CLR", "CMPA", "CMPB", "CMPD", "CMPS", "CMPU", "CMPX", "CMPY", "COMA",
"COMB", "COM", "CWAI", "DAA", "DECA", "DECB", "DEC", "EORA", "EORB",
"EXG", "INCA", "INCB", "INC", "JMP", "JSR", "LDA", "LDB", "LDD",
"LDS", "LDU", "LDX", "LDY", "LEAS", "LEAU", "LEAX", "LEAY", "LSRA",
"LSRB", "LSR", "MUL", "NEGA", "NEGB", "NEG", "NOP", "ORA", "ORB",
"ORCC", "PSHS", "PSHU", "PULS", "PULU", "ROLA", "ROLB", "ROL", "RORA",
"RORB", "ROR", "RTI", "RTS", "SBCA", "SBCB", "SEX", "STA", "STB",
"STD", "STS", "STU", "STX", "STY", "SUBA", "SUBB", "SUBD", "SWI",
"SWI2", "SWI3", "SYNC", "TFR", "TSTA", "TSTB", "TST", "RESET",
#ifdef H6309
"NEGD", "COMD", "LSRD", "RORD", "ASRD", "ROLD", "DECD",
"INCD", "TSTD", "CLRD",
#endif
};
typedef struct
{
UINT8 code;
UINT8 mode;
} opcode_t;
opcode_t codes[256] = {
{_neg, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_com, _direct},
{_lsr, _direct},
{_undoc, _illegal},
{_ror, _direct},
{_asr, _direct},
{_asl, _direct},
{_rol, _direct},
{_dec, _direct},
{_undoc, _illegal},
{_inc, _direct},
{_tst, _direct},
{_jmp, _direct},
{_clr, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_nop, _implied},
{_sync, _implied},
{_undoc, _illegal},
{_undoc, _illegal},
{_lbra, _rel_word},
{_lbsr, _rel_word},
{_undoc, _illegal},
{_daa, _implied},
{_orcc, _imm_byte},
{_undoc, _illegal},
{_andcc, _imm_byte},
{_sex, _implied},
{_exg, _reg_post},
{_tfr, _reg_post},
{_bra, _rel_byte},
{_brn, _rel_byte},
{_bhi, _rel_byte},
{_bls, _rel_byte},
{_bcc, _rel_byte},
{_bcs, _rel_byte},
{_bne, _rel_byte},
{_beq, _rel_byte},
{_bvc, _rel_byte},
{_bvs, _rel_byte},
{_bpl, _rel_byte},
{_bmi, _rel_byte},
{_bge, _rel_byte},
{_blt, _rel_byte},
{_bgt, _rel_byte},
{_ble, _rel_byte},
{_leax, _indexed},
{_leay, _indexed},
{_leas, _indexed},
{_leau, _indexed},
{_pshs, _sys_post},
{_puls, _sys_post},
{_pshu, _usr_post},
{_pulu, _usr_post},
{_undoc, _illegal},
{_rts, _implied},
{_abx, _implied},
{_rti, _implied},
{_cwai, _imm_byte},
{_mul, _implied},
{_reset, _implied},
{_swi, _implied},
{_nega, _implied},
{_undoc, _illegal},
{_undoc, _illegal},
{_coma, _implied},
{_lsra, _implied},
{_undoc, _illegal},
{_rora, _implied},
{_asra, _implied},
{_asla, _implied},
{_rola, _implied},
{_deca, _implied},
{_undoc, _illegal},
{_inca, _implied},
{_tsta, _implied},
{_undoc, _illegal},
{_clra, _implied},
{_negb, _implied},
{_undoc, _illegal},
{_undoc, _illegal},
{_comb, _implied},
{_lsrb, _implied},
{_undoc, _illegal},
{_rorb, _implied},
{_asrb, _implied},
{_aslb, _implied},
{_rolb, _implied},
{_decb, _implied},
{_undoc, _illegal},
{_incb, _implied},
{_tstb, _implied},
{_undoc, _illegal},
{_clrb, _implied},
{_neg, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_com, _indexed},
{_lsr, _indexed},
{_undoc, _illegal},
{_ror, _indexed},
{_asr, _indexed},
{_asl, _indexed},
{_rol, _indexed},
{_dec, _indexed},
{_undoc, _illegal},
{_inc, _indexed},
{_tst, _indexed},
{_jmp, _indexed},
{_clr, _indexed},
{_neg, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_com, _extended},
{_lsr, _extended},
{_undoc, _illegal},
{_ror, _extended},
{_asr, _extended},
{_asl, _extended},
{_rol, _extended},
{_dec, _extended},
{_undoc, _illegal},
{_inc, _extended},
{_tst, _extended},
{_jmp, _extended},
{_clr, _extended},
{_suba, _imm_byte},
{_cmpa, _imm_byte},
{_sbca, _imm_byte},
{_subd, _imm_word},
{_anda, _imm_byte},
{_bita, _imm_byte},
{_lda, _imm_byte},
{_undoc, _illegal},
{_eora, _imm_byte},
{_adca, _imm_byte},
{_ora, _imm_byte},
{_adda, _imm_byte},
{_cmpx, _imm_word},
{_bsr, _rel_byte},
{_ldx, _imm_word},
{_undoc, _illegal},
{_suba, _direct},
{_cmpa, _direct},
{_sbca, _direct},
{_subd, _direct},
{_anda, _direct},
{_bita, _direct},
{_lda, _direct},
{_sta, _direct},
{_eora, _direct},
{_adca, _direct},
{_ora, _direct},
{_adda, _direct},
{_cmpx, _direct},
{_jsr, _direct},
{_ldx, _direct},
{_stx, _direct},
{_suba, _indexed},
{_cmpa, _indexed},
{_sbca, _indexed},
{_subd, _indexed},
{_anda, _indexed},
{_bita, _indexed},
{_lda, _indexed},
{_sta, _indexed},
{_eora, _indexed},
{_adca, _indexed},
{_ora, _indexed},
{_adda, _indexed},
{_cmpx, _indexed},
{_jsr, _indexed},
{_ldx, _indexed},
{_stx, _indexed},
{_suba, _extended},
{_cmpa, _extended},
{_sbca, _extended},
{_subd, _extended},
{_anda, _extended},
{_bita, _extended},
{_lda, _extended},
{_sta, _extended},
{_eora, _extended},
{_adca, _extended},
{_ora, _extended},
{_adda, _extended},
{_cmpx, _extended},
{_jsr, _extended},
{_ldx, _extended},
{_stx, _extended},
{_subb, _imm_byte},
{_cmpb, _imm_byte},
{_sbcb, _imm_byte},
{_addd, _imm_word},
{_andb, _imm_byte},
{_bitb, _imm_byte},
{_ldb, _imm_byte},
{_undoc, _illegal},
{_eorb, _imm_byte},
{_adcb, _imm_byte},
{_orb, _imm_byte},
{_addb, _imm_byte},
{_ldd, _imm_word},
{_undoc, _illegal},
{_ldu, _imm_word},
{_undoc, _illegal},
{_subb, _direct},
{_cmpb, _direct},
{_sbcb, _direct},
{_addd, _direct},
{_andb, _direct},
{_bitb, _direct},
{_ldb, _direct},
{_stb, _direct},
{_eorb, _direct},
{_adcb, _direct},
{_orb, _direct},
{_addb, _direct},
{_ldd, _direct},
{_std, _direct},
{_ldu, _direct},
{_stu, _direct},
{_subb, _indexed},
{_cmpb, _indexed},
{_sbcb, _indexed},
{_addd, _indexed},
{_andb, _indexed},
{_bitb, _indexed},
{_ldb, _indexed},
{_stb, _indexed},
{_eorb, _indexed},
{_adcb, _indexed},
{_orb, _indexed},
{_addb, _indexed},
{_ldd, _indexed},
{_std, _indexed},
{_ldu, _indexed},
{_stu, _indexed},
{_subb, _extended},
{_cmpb, _extended},
{_sbcb, _extended},
{_addd, _extended},
{_andb, _extended},
{_bitb, _extended},
{_ldb, _extended},
{_stb, _extended},
{_eorb, _extended},
{_adcb, _extended},
{_orb, _extended},
{_addb, _extended},
{_ldd, _extended},
{_std, _extended},
{_ldu, _extended},
{_stu, _extended}
};
opcode_t codes10[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lbrn, _rel_word},
{_lbhi, _rel_word},
{_lbls, _rel_word},
{_lbcc, _rel_word},
{_lbcs, _rel_word},
{_lbne, _rel_word},
{_lbeq, _rel_word},
{_lbvc, _rel_word},
{_lbvs, _rel_word},
{_lbpl, _rel_word},
{_lbmi, _rel_word},
{_lbge, _rel_word},
{_lblt, _rel_word},
{_lbgt, _rel_word},
{_lble, _rel_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_swi2, _implied},
{_undoc, _illegal}, /* 10 40 */
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _imm_word},
{_undoc, _illegal},
{_ldy, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _direct},
{_undoc, _illegal},
{_ldy, _direct},
{_sty, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _indexed},
{_undoc, _illegal},
{_ldy, _indexed},
{_sty, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _extended},
{_undoc, _illegal},
{_ldy, _extended},
{_sty, _extended},
{_undoc, _illegal},
@@ -883,539 +884,542 @@ char index_reg[] = { 'X', 'Y', 'U', 'S' };
char *off4[] = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15",
"-16", "-15", "-14", "-13", "-12", "-11", "-10", "-9",
"-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"
};
/* Disassemble the current instruction. Returns the number of bytes that
compose it. */
int
dasm (char *buf, absolute_address_t opc)
{
UINT8 op, am;
char *op_str;
absolute_address_t pc = opc;
char R;
int fetch1; /* the first (MSB) fetched byte, used in macro RDWORD */
op = fetch8 ();
if (op == 0x10)
{
op = fetch8 ();
am = codes10[op].mode;
op = codes10[op].code;
}
else if (op == 0x11)
{
op = fetch8 ();
am = codes11[op].mode;
op = codes11[op].code;
}
else
{
am = codes[op].mode;
op = codes[op].code;
}
op_str = (char *) mne[op];
buf += sprintf (buf, "%-6.6s", op_str);
switch (am)
{
case _illegal:
sprintf (buf, "???");
break;
case _implied:
break;
case _imm_byte:
sprintf (buf, "#$%02X", fetch8 ());
break;
case _imm_word:
sprintf (buf, "#$%04X", fetch16 ());
break;
case _direct:
sprintf (buf, "<%s", monitor_addr_name (fetch8 ()));
break;
case _extended:
sprintf (buf, "%s", monitor_addr_name (fetch16 ()));
break;
case _indexed:
op = fetch8 ();
R = index_reg[(op >> 5) & 0x3];
if ((op & 0x80) == 0)
{
sprintf (buf, "%s,%c", off4[op & 0x1f], R);
break;
}
switch (op & 0x1f)
{
case 0x00:
sprintf (buf, ",%c+", R);
break;
case 0x01:
sprintf (buf, ",%c++", R);
break;
case 0x02:
sprintf (buf, ",-%c", R);
break;
case 0x03:
sprintf (buf, ",--%c", R);
break;
case 0x04:
sprintf (buf, ",%c", R);
break;
case 0x05:
sprintf (buf, "B,%c", R);
break;
case 0x06:
sprintf (buf, "A,%c", R);
break;
case 0x08:
sprintf (buf, "$%02X,%c", fetch8 (), R);
break;
case 0x09:
sprintf (buf, "$%04X,%c", fetch16 (), R);
break;
case 0x0B:
sprintf (buf, "D,%c", R);
break;
case 0x0C:
sprintf (buf, "$%02X,PC", fetch8 ());
break;
case 0x0D:
sprintf (buf, "$%04X,PC", fetch16 ());
break;
case 0x11:
sprintf (buf, "[,%c++]", R);
break;
case 0x13:
sprintf (buf, "[,--%c]", R);
break;
case 0x14:
sprintf (buf, "[,%c]", R);
break;
case 0x15:
sprintf (buf, "[B,%c]", R);
break;
case 0x16:
sprintf (buf, "[A,%c]", R);
break;
case 0x18:
sprintf (buf, "[$%02X,%c]", fetch8 (), R);
break;
case 0x19:
sprintf (buf, "[$%04X,%c]", fetch16 (), R);
break;
case 0x1B:
sprintf (buf, "[D,%c]", R);
break;
case 0x1C:
sprintf (buf, "[$%02X,PC]", fetch8 ());
break;
case 0x1D:
sprintf (buf, "[$%04X,PC]", fetch16 ());
break;
case 0x1F:
sprintf (buf, "[%s]", monitor_addr_name (fetch16 ()));
break;
default:
sprintf (buf, "???");
break;
}
break;
case _rel_byte:
fetch1 = ((INT8) fetch8 ());
sprintf (buf, "%s", absolute_addr_name (fetch1 + pc));
break;
case _rel_word:
sprintf (buf, "%s", absolute_addr_name (fetch16 () + pc));
break;
case _reg_post:
op = fetch8 ();
sprintf (buf, "%s,%s", reg[op >> 4], reg[op & 15]);
break;
case _usr_post:
case _sys_post:
op = fetch8 ();
if (op & 0x80)
strcat (buf, "PC,");
if (op & 0x40)
strcat (buf, am == _usr_post ? "S," : "U,");
if (op & 0x20)
strcat (buf, "Y,");
if (op & 0x10)
strcat (buf, "X,");
if (op & 0x08)
strcat (buf, "DP,");
if ((op & 0x06) == 0x06)
strcat (buf, "D,");
else
{
if (op & 0x04)
strcat (buf, "B,");
if (op & 0x02)
strcat (buf, "A,");
}
if (op & 0x01)
strcat (buf, "CC,");
buf[strlen (buf) - 1] = '\0';
break;
}
return pc - opc;
}
int
sizeof_file (FILE * file)
{
int size;
fseek (file, 0, SEEK_END);
size = ftell (file);
rewind (file);
return size;
}
int
load_map_file (const char *name)
{
FILE *fp;
char map_filename[256];
char buf[256];
char *value_ptr, *id_ptr;
target_addr_t value;
char *file_ptr;
sprintf (map_filename, "%s.map", name);
fp = file_open (NULL, map_filename, "r");
if (!fp)
return -1;
for (;;)
{
fgets (buf, sizeof(buf)-1, fp);
if (feof (fp))
break;
value_ptr = buf;
if (!strncmp (value_ptr, "page", 4))
{
unsigned char page = strtoul (value_ptr+4, NULL, 10);
wpc_set_rom_page (page);
continue;
}
if (strncmp (value_ptr, " ", 6))
continue;
while (*value_ptr == ' ')
value_ptr++;
value = strtoul (value_ptr, &id_ptr, 16);
if (id_ptr == value_ptr)
continue;
while (*id_ptr == ' ')
id_ptr++;
id_ptr = strtok (id_ptr, " \t\n");
if (((*id_ptr == 'l') || (*id_ptr == 's')) && (id_ptr[1] == '_'))
continue;
++id_ptr;
file_ptr = strtok (NULL, " \t\n");
sym_add (&program_symtab, id_ptr, to_absolute (value), 0); /* file_ptr? */
}
fclose (fp);
return 0;
}
int
load_hex (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = file_open (NULL, name, "r");
if (fp == NULL)
{
printf ("failed to open hex record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, ":%2x%4x%2x", &count, &addr, &type) != 3)
{
printf ("line %d: invalid hex record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff) + type;
switch (type)
{
case 0:
for (; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid hex record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 1:
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid hex record checksum \n", line);
done = 0;
break;
case 2:
default:
printf ("line %d: not supported hex type %d.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
int
load_s19 (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = file_open (NULL, name, "r");
if (fp == NULL)
{
printf ("failed to open S-record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, "S%1x%2x%4x", &type, &count, &addr) != 3)
{
printf ("line %d: invalid S record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff);
switch (type)
{
case 1:
for (count -= 3; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 9:
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
default:
printf ("line %d: S%d not supported.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
void
monitor_call (unsigned int flags)
{
#ifdef CALL_STACK
if (current_function_call <= &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call++;
current_function_call->entry_point = get_pc ();
current_function_call->flags = flags;
}
#endif
const char *id = sym_lookup (&program_symtab, to_absolute (get_pc ()));
if (id)
{
// printf ("In %s now\n", id);
}
}
void
monitor_return (void)
{
#ifdef CALL_STACK
if (current_function_call > &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call--;
return;
}
while ((current_function_call->flags & FC_TAIL_CALL) &&
(current_function_call > fctab))
{
current_function_call--;
}
if (current_function_call > fctab)
current_function_call--;
#endif
}
const char *
absolute_addr_name (absolute_address_t addr)
{
static char buf[256], *bufptr;
const char *name;
bufptr = buf;
bufptr += sprintf (bufptr, "%02X:0x%04X", addr >> 28, addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
bufptr += sprintf (bufptr, " <%-16.16s>", name);
return buf;
}
const char *
monitor_addr_name (target_addr_t target_addr)
{
static char buf[256], *bufptr;
const char *name;
absolute_address_t addr = to_absolute (target_addr);
bufptr = buf;
bufptr += sprintf (bufptr, "0x%04X", target_addr);
name = sym_lookup (&program_symtab, addr);
if (name)
bufptr += sprintf (bufptr, " <%s>", name);
return buf;
}
static void
monitor_signal (int sigtype)
{
(void) sigtype;
putchar ('\n');
monitor_on = 1;
}
void
monitor_init (void)
{
int tmp;
extern int debug_enabled;
target_addr_t a;
fctab[0].entry_point = read16 (0xfffe);
memset (&fctab[0].entry_regs, 0, sizeof (struct cpu_regs));
current_function_call = &fctab[0];
auto_break_insn_count = 0;
monitor_on = debug_enabled;
signal (SIGINT, monitor_signal);
}
int
check_break (unsigned break_pc)
{
+ if (dump_every_insn)
+ print_current_insn ();
+
if (auto_break_insn_count > 0)
if (--auto_break_insn_count == 0)
return 1;
return 0;
}
void
monitor_backtrace (void)
{
struct function_call *fc = current_function_call;
while (fc >= &fctab[0]) {
printf ("%s\n", monitor_addr_name (fc->entry_point));
fc--;
}
}
int
monitor6809 (void)
{
int rc;
signal (SIGINT, monitor_signal);
rc = command_loop ();
monitor_on = 0;
return rc;
}
|
bcd/exec09
|
94992fc8f9e4e4fbd22f337da8d9f795150c9546
|
Add the runfor command.
|
diff --git a/Makefile.in b/Makefile.in
index 5303319..53b1791 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,547 +1,546 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-LIBOBJDIR =
bin_PROGRAMS = m6809-run$(EXEEXT)
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure COPYING depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_m6809_run_OBJECTS = 6809.$(OBJEXT) main.$(OBJEXT) monitor.$(OBJEXT) \
machine.$(OBJEXT) eon.$(OBJEXT) wpc.$(OBJEXT) symtab.$(OBJEXT) \
command.$(OBJEXT) fileio.$(OBJEXT)
m6809_run_OBJECTS = $(am_m6809_run_OBJECTS)
m6809_run_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(m6809_run_SOURCES)
DIST_SOURCES = $(m6809_run_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c fileio.c
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
m6809-run$(EXEEXT): $(m6809_run_OBJECTS) $(m6809_run_DEPENDENCIES)
@rm -f m6809-run$(EXEEXT)
$(LINK) $(m6809_run_LDFLAGS) $(m6809_run_OBJECTS) $(m6809_run_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/6809.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/machine.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symtab.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wpc.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) config.h
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/command.c b/command.c
index 6d3e534..4dfae6e 100644
--- a/command.c
+++ b/command.c
@@ -1,1341 +1,1378 @@
#include "6809.h"
#include "monitor.h"
#include "machine.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/errno.h>
#include <termios.h>
typedef struct
{
unsigned int size;
unsigned int count;
char **strings;
} cmdqueue_t;
/**********************************************************/
/********************* Global Data ************************/
/**********************************************************/
unsigned int break_count = 0;
breakpoint_t breaktab[MAX_BREAKS];
unsigned int active_break_count = 0;
unsigned int display_count = 0;
display_t displaytab[MAX_DISPLAYS];
unsigned int history_count = 0;
unsigned long historytab[MAX_HISTORY];
absolute_address_t examine_addr = 0;
unsigned int examine_repeat = 1;
datatype_t examine_type;
unsigned int thread_id_size = 2;
absolute_address_t thread_current;
absolute_address_t thread_id = 0;
thread_t threadtab[MAX_THREADS];
#define MAX_CMD_QUEUES 8
int command_stack_depth = -1;
cmdqueue_t command_stack[MAX_CMD_QUEUES];
+int stop_after_ms = 0;
+
datatype_t print_type;
char *command_flags;
int exit_command_loop;
#define IRQ_CYCLE_COUNTS 128
unsigned int irq_cycle_tab[IRQ_CYCLE_COUNTS] = { 0, };
unsigned int irq_cycle_entry = 0;
unsigned long irq_cycles = 0;
unsigned long eval (char *expr);
extern int auto_break_insn_count;
/**********************************************************/
/******************** 6809 Functions **********************/
/**********************************************************/
void
print_addr (absolute_address_t addr)
{
const char *name;
print_device_name (addr >> 28);
putchar (':');
printf ("0x%04X", addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
printf (" <%-16.16s>", name);
else
printf ("%-20.20s", "");
}
/**********************************************************/
/*********************** Functions ************************/
/**********************************************************/
void
syntax_error (const char *string)
{
fprintf (stderr, "error: %s\n", string);
}
void
save_value (unsigned long val)
{
historytab[history_count++ % MAX_HISTORY] = val;
}
unsigned long
eval_historical (unsigned int id)
{
return historytab[id % MAX_HISTORY];
}
void
assign_virtual (const char *name, unsigned long val)
{
unsigned long v_val;
if (!sym_find (&auto_symtab, name, &v_val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)v_val;
virtual (&val, 1);
return;
}
sym_set (&internal_symtab, name, val, 0);
if (!strcmp (name, "thread_current"))
{
printf ("Thread pointer initialized to ");
print_addr (val);
putchar ('\n');
thread_current = val;
}
}
unsigned long
eval_virtual (const char *name)
{
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
if (!sym_find (&auto_symtab, name, &val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)val;
virtual (&val, 0);
}
else if (!sym_find (&internal_symtab, name, &val, 0))
{
}
else
{
return 0;
}
return val;
}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
case 'o':
case 'a':
case 's':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
char *
match_binary (char *expr, const char *op, char **secondp)
{
char *p;
p = strstr (expr, op);
if (!p)
return NULL;
*p = '\0';
p += strlen (op);
*secondp = p;
return expr;
}
int
fold_comparisons (char *expr, unsigned long *value)
{
char *p;
if (match_binary (expr, "==", &p))
*value = (eval (expr) == eval (p));
else if (match_binary (expr, "!=", &p))
*value = (eval (expr) != eval (p));
else
return 0;
return 1;
}
int
fold_binary (char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
eval_mem (char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
/* TODO - if expr is already in absolute form,
this explodes ! */
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
eval (char *expr)
{
char *p;
unsigned long val;
if (fold_comparisons (expr, &val));
else if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
unsigned int size = 1;
expr++;
if (*expr == '*')
{
expr++;
size = 2;
}
absolute_address_t addr = eval_mem (expr);
return target_read (addr, size);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
br->keep_running = 0;
br->ignore_count = 0;
br->temp = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
void
brkfree_temps (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].used && breaktab[n].temp)
{
brkfree (&breaktab[n]);
}
}
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
if (brkpt->keep_running)
printf (", print-only");
if (brkpt->temp)
printf (", temp");
+ if (brkpt->ignore_count)
+ printf (", ignore %d times\n", brkpt->ignore_count);
putchar ('\n');
}
display_t *
display_alloc (void)
{
unsigned int n;
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (!ds->used)
{
ds->used = 1;
return ds;
}
}
}
void
display_free (display_t *ds)
{
}
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
switch (typep->format)
{
case 'a':
print_addr (val);
return;
case 's':
{
absolute_address_t addr = (absolute_address_t)val;
char c;
putchar ('"');
while ((c = abs_read8 (addr++)) != '\0')
putchar (c);
putchar ('"');
return;
}
}
if (typep->format == 'x')
{
printf ("0x");
sprintf (f, "%%0%d%c", typep->size * 2, typep->format);
}
else if (typep->format == 'o')
{
printf ("0");
sprintf (f, "%%%c", typep->format);
}
else
sprintf (f, "%%%c", typep->format);
printf (f, val);
}
void
display_print (void)
{
unsigned int n;
char comma = '\0';
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (ds->used)
{
char expr[256];
strcpy (expr, ds->expr);
printf ("%c %s = ", comma, expr);
print_value (eval (expr), &ds->type);
comma = ',';
}
}
if (comma)
putchar ('\n');
}
int
print_insn (absolute_address_t addr)
{
char buf[64];
int size = dasm (buf, addr);
printf ("%s", buf);
return size;
}
void
do_examine (void)
{
unsigned int n;
unsigned int objs_per_line = 16;
if (isdigit (*command_flags))
examine_repeat = strtoul (command_flags, &command_flags, 0);
if (*command_flags == 'i')
examine_type.format = *command_flags;
else
parse_format_flag (command_flags, &examine_type.format);
parse_size_flag (command_flags, &examine_type.size);
switch (examine_type.format)
{
case 'i':
objs_per_line = 1;
break;
case 'w':
objs_per_line = 8;
break;
}
for (n = 0; n < examine_repeat; n++)
{
if ((n % objs_per_line) == 0)
{
putchar ('\n');
print_addr (examine_addr);
printf (": ");
}
switch (examine_type.format)
{
case 's': /* string */
break;
case 'i': /* instruction */
examine_addr += print_insn (examine_addr);
break;
default:
print_value (target_read (examine_addr, examine_type.size),
&examine_type);
putchar (' ');
examine_addr += examine_type.size;
}
}
putchar ('\n');
}
void
do_print (char *expr)
{
unsigned long val = eval (expr);
printf ("$%d = ", history_count);
parse_format_flag (command_flags, &print_type.format);
parse_size_flag (command_flags, &print_type.size);
print_value (val, &print_type);
putchar ('\n');
save_value (val);
}
void
do_set (char *expr)
{
unsigned long val = eval (expr);
save_value (val);
}
#define THREAD_DATA_PC 3
#define THREAD_DATA_ROMBANK 9
void
print_thread_data (absolute_address_t th)
{
U8 b;
U16 w;
absolute_address_t pc;
w = abs_read16 (th + THREAD_DATA_PC);
b = abs_read8 (th + THREAD_DATA_ROMBANK);
printf ("{ PC = %04X, BANK = %02X }", w, b);
}
void
command_change_thread (void)
{
target_addr_t addr = target_read (thread_current, thread_id_size);
absolute_address_t th = to_absolute (addr);
if (th == thread_id)
return;
thread_id = th;
if (machine->dump_thread && eval ("$thread_debug"))
{
if (addr)
{
printf ("[Current thread = ");
print_addr (thread_id);
machine->dump_thread (thread_id);
print_thread_data (thread_id);
printf ("]\n");
}
else
{
printf ("[ No thread ]\n");
}
}
}
void
command_stack_push (unsigned int reason)
{
cmdqueue_t *q = &command_stack[++command_stack_depth];
}
void
command_stack_pop (void)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
--command_stack_depth;
}
void
command_stack_add (const char *cmd)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
}
char *
getarg (void)
{
return strtok (NULL, " \t\n");
}
/****************** Command Handlers ************************/
void cmd_print (void)
{
char *arg = getarg ();
if (arg)
do_print (arg);
else
do_print ("$");
}
void cmd_set (void)
{
char *arg = getarg ();
if (arg)
do_set (arg);
else
do_set ("$");
}
void cmd_examine (void)
{
char *arg = getarg ();
if (arg)
examine_addr = eval_mem (arg);
do_examine ();
}
void cmd_break (void)
{
char *arg = getarg ();
if (!arg)
return;
unsigned long val = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = val;
br->on_execute = 1;
- if ((arg = getarg()) && !strcmp (arg, "if"))
+ arg = getarg ();
+ if (!arg);
+ else if (!strcmp (arg, "if"))
{
br->conditional = 1;
arg = getarg ();
strcpy (br->condition, arg);
}
+ else if (!strcmp (arg, "ignore"))
+ {
+ br->ignore_count = atoi (getarg ());
+ }
brkprint (br);
}
void cmd_watch1 (int on_read, int on_write)
{
char *arg;
arg = getarg ();
if (!arg)
return;
absolute_address_t addr = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = addr;
br->on_read = on_read;
br->on_write = on_write;
arg = getarg ();
if (!arg)
return;
if (!strcmp (arg, "print"))
br->keep_running = 1;
else if (!strcmp (arg, "if"))
{
arg = getarg ();
br->conditional = 1;
strcpy (br->condition, arg);
}
brkprint (br);
}
void cmd_watch (void)
{
cmd_watch1 (0, 1);
}
void cmd_rwatch (void)
{
cmd_watch1 (1, 0);
}
void cmd_awatch (void)
{
cmd_watch1 (1, 1);
}
void cmd_break_list (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
brkprint (&breaktab[n]);
}
void cmd_step (void)
{
auto_break_insn_count = 1;
exit_command_loop = 0;
}
void cmd_next (void)
{
char buf[128];
breakpoint_t *br;
unsigned long addr = to_absolute (get_pc ());
addr += dasm (buf, addr);
br = brkalloc ();
br->addr = addr;
br->on_execute = 1;
br->temp = 1;
/* TODO - for conditional branches, should also set a
temp breakpoint at the branch target */
exit_command_loop = 0;
}
void cmd_continue (void)
{
exit_command_loop = 0;
}
void cmd_quit (void)
{
cpu_quit = 0;
exit_command_loop = 1;
}
void cmd_delete (void)
{
const char *arg = getarg ();
unsigned int id;
if (!arg)
{
int n;
printf ("Deleting all breakpoints.\n");
for (id = 0; id < MAX_BREAKS; id++)
{
breakpoint_t *br = brkfind_by_id (id);
brkfree (br);
}
return;
}
id = atoi (arg);
breakpoint_t *br = brkfind_by_id (id);
if (br->used)
{
printf ("Deleting breakpoint %d\n", id);
brkfree (br);
}
}
void cmd_list (void)
{
char *arg;
static absolute_address_t lastpc = 0;
static absolute_address_t lastaddr = 0;
absolute_address_t addr;
int n;
arg = getarg ();
if (arg)
addr = eval_mem (arg);
else
{
addr = to_absolute (get_pc ());
if (addr == lastpc)
addr = lastaddr;
else
lastaddr = lastpc = addr;
}
for (n = 0; n < 10; n++)
{
print_addr (addr);
printf (" : ");
addr += print_insn (addr);
putchar ('\n');
}
lastaddr = addr;
}
void cmd_symbol_file (void)
{
char *arg = getarg ();
if (arg)
load_map_file (arg);
}
void cmd_display (void)
{
char *arg;
while ((arg = getarg ()) != NULL)
{
display_t *ds = display_alloc ();
strcpy (ds->expr, arg);
ds->type = print_type;
parse_format_flag (command_flags, &ds->type.format);
parse_size_flag (command_flags, &ds->type.size);
}
}
int command_exec_file (const char *filename)
{
FILE *infile;
extern int command_exec (FILE *);
infile = file_open (NULL, filename, "r");
if (!infile)
return 0;
while (command_exec (infile) >= 0);
fclose (infile);
return 1;
}
void cmd_source (void)
{
char *arg = getarg ();
if (!arg)
return;
if (command_exec_file (arg) == 0)
fprintf (stderr, "can't open %s\n", arg);
}
void cmd_regs (void)
{
}
void cmd_vars (void)
{
for_each_var (NULL);
}
+void cmd_runfor (void)
+{
+ char *arg = getarg ();
+ int secs = atoi (arg);
+ stop_after_ms = secs * 1000;
+ exit_command_loop = 0;
+}
+
+
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
{ "s", "step", cmd_step,
"Step one instruction" },
{ "n", "next", cmd_next,
"Break at the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
{ "wa", "watch", cmd_watch,
"Add a watchpoint on write" },
{ "rwa", "rwatch", cmd_rwatch,
"Add a watchpoint on read" },
{ "awa", "awatch", cmd_awatch,
"Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
{ "l", "list", cmd_list },
{ "sym", "symbol-file", cmd_symbol_file,
"Open a symbol table file" },
{ "di", "display", cmd_display,
"Add a display expression" },
{ "so", "source", cmd_source,
"Run a command script" },
{ "regs", "regs", cmd_regs,
"Show all CPU registers" },
{ "vars", "vars", cmd_vars,
"Show all program variables" },
+ { "runfor", "runfor", cmd_runfor,
+ "Run for a certain amount of time" },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
{ "f", "file", cmd_file,
"Choose the program to be debugged" },
{ "exe", "exec-file", cmd_exec_file,
"Open an executable" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
/* TODO - look for a match anywhere between
* the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
void
print_current_insn (void)
{
absolute_address_t addr = to_absolute (get_pc ());
print_addr (addr);
printf (" : ");
print_insn (addr);
putchar ('\n');
}
int
command_exec (FILE *infile)
{
char buffer[256];
static char prev_buffer[256];
char *cmd;
command_handler_t handler;
int rc;
do {
errno = 0;
fgets (buffer, 255, infile);
if (feof (infile))
return -1;
} while (errno != 0);
/* In terminal mode, a blank line means to execute
the previous command. */
if (buffer[0] == '\n')
strcpy (buffer, prev_buffer);
/* Skip comments */
if (*buffer == '#')
return 0;
cmd = strtok (buffer, " \t\n");
if (!cmd)
return 0;
strcpy (prev_buffer, cmd);
handler = command_lookup (cmd);
if (!handler)
{
syntax_error ("no such command");
return 0;
}
(*handler) ();
return 0;
}
void
keybuffering (int flag)
{
struct termios tio;
tcgetattr (0, &tio);
if (!flag) /* 0 = no buffering = not default */
tio.c_lflag &= ~ICANON;
else /* 1 = buffering = default */
tio.c_lflag |= ICANON;
tcsetattr (0, TCSANOW, &tio);
}
int
command_loop (void)
{
keybuffering (1);
brkfree_temps ();
display_print ();
print_current_insn ();
exit_command_loop = -1;
while (exit_command_loop < 0)
{
command_prompt ();
if (command_exec (stdin) < 0)
break;
}
if (exit_command_loop == 0)
keybuffering (0);
return (exit_command_loop);
}
void
breakpoint_hit (breakpoint_t *br)
{
if (br->threaded && (thread_id != br->tid))
return;
if (br->conditional)
{
if (eval (br->condition) == 0)
return;
}
if (br->ignore_count)
{
--br->ignore_count;
return;
}
monitor_on = !br->keep_running;
}
void
command_insn_hook (void)
{
absolute_address_t abspc;
breakpoint_t *br;
if (active_break_count == 0)
return;
abspc = to_absolute (get_pc ());
br = brkfind_by_addr (abspc);
if (br && br->enabled && br->on_execute)
{
breakpoint_hit (br);
if (monitor_on == 0)
return;
if (br->temp)
brkfree (br);
else
printf ("Breakpoint %d reached.\n", br->id);
}
}
void
command_read_hook (absolute_address_t addr)
{
breakpoint_t *br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_read)
{
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf ("]\n");
breakpoint_hit (br);
}
}
void
command_write_hook (absolute_address_t addr, U8 val)
{
breakpoint_t *br;
br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_write)
{
breakpoint_hit (br);
if (monitor_on == 0)
return;
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf (" = 0x%02X", val);
printf ("]\n");
}
if (thread_id_size && (addr == thread_current + thread_id_size - 1))
{
command_change_thread ();
}
}
+void
+command_periodic (void)
+{
+ if (stop_after_ms)
+ {
+ stop_after_ms -= 100;
+ if (stop_after_ms <= 0)
+ {
+ monitor_on = 1;
+ stop_after_ms = 0;
+ printf ("Stopping after time elapsed.\n");
+ }
+ }
+}
+
+
void pc_virtual (unsigned long *val, int writep) {
writep ? set_pc (*val) : (*val = get_pc ());
}
void x_virtual (unsigned long *val, int writep) {
writep ? set_x (*val) : (*val = get_x ());
}
void y_virtual (unsigned long *val, int writep) {
writep ? set_y (*val) : (*val = get_y ());
}
void u_virtual (unsigned long *val, int writep) {
writep ? set_u (*val) : (*val = get_u ());
}
void s_virtual (unsigned long *val, int writep) {
writep ? set_s (*val) : (*val = get_s ());
}
void d_virtual (unsigned long *val, int writep) {
writep ? set_d (*val) : (*val = get_d ());
}
void a_virtual (unsigned long *val, int writep) {
writep ? set_a (*val) : (*val = get_a ());
}
void b_virtual (unsigned long *val, int writep) {
writep ? set_b (*val) : (*val = get_b ());
}
void dp_virtual (unsigned long *val, int writep) {
writep ? set_dp (*val) : (*val = get_dp ());
}
void cc_virtual (unsigned long *val, int writep) {
writep ? set_cc (*val) : (*val = get_cc ());
}
void irq_load_virtual (unsigned long *val, int writep) {
if (!writep)
*val = irq_cycles / IRQ_CYCLE_COUNTS;
}
void cycles_virtual (unsigned long *val, int writep)
{
if (!writep)
*val = get_cycles ();
}
void
command_exit_irq_hook (unsigned long cycles)
{
irq_cycles -= irq_cycle_tab[irq_cycle_entry];
irq_cycles += cycles;
irq_cycle_tab[irq_cycle_entry] = cycles;
irq_cycle_entry = (irq_cycle_entry + 1) % IRQ_CYCLE_COUNTS;
//printf ("IRQ took %lu cycles\n", cycles);
//printf ("Average = %d\n", irq_cycles / IRQ_CYCLE_COUNTS);
}
void
command_init (void)
{
int rc;
sym_add (&auto_symtab, "pc", (unsigned long)pc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "x", (unsigned long)x_virtual, SYM_AUTO);
sym_add (&auto_symtab, "y", (unsigned long)y_virtual, SYM_AUTO);
sym_add (&auto_symtab, "u", (unsigned long)u_virtual, SYM_AUTO);
sym_add (&auto_symtab, "s", (unsigned long)s_virtual, SYM_AUTO);
sym_add (&auto_symtab, "d", (unsigned long)d_virtual, SYM_AUTO);
sym_add (&auto_symtab, "a", (unsigned long)a_virtual, SYM_AUTO);
sym_add (&auto_symtab, "b", (unsigned long)b_virtual, SYM_AUTO);
sym_add (&auto_symtab, "dp", (unsigned long)dp_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cc", (unsigned long)cc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cycles", (unsigned long)cycles_virtual, SYM_AUTO);
sym_add (&auto_symtab, "irqload", (unsigned long)irq_load_virtual, SYM_AUTO);
examine_type.format = 'x';
examine_type.size = 1;
print_type.format = 'x';
print_type.size = 1;
(void)command_exec_file (".dbinit");
}
/* vim: set ts=3: */
/* vim: set expandtab: */
diff --git a/main.c b/main.c
index 6621345..b55be0d 100644
--- a/main.c
+++ b/main.c
@@ -1,461 +1,460 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/time.h>
#include "6809.h"
enum
{ HEX, S19, BIN };
/* The total number of cycles that have executed */
unsigned long total = 0;
/* The frequency of the emulated CPU, in megahertz */
unsigned int mhz = 1;
/* When nonzero, indicates that the IRQ should be triggered periodically,
every so many cycles. By default no periodic IRQ is generated. */
unsigned int cycles_per_irq = 0;
/* When nonzero, indicates that the FIRQ should be triggered periodically,
every so many cycles. By default no periodic FIRQ is generated. */
unsigned int cycles_per_firq = 0;
/* Nonzero if debugging support is turned on */
int debug_enabled = 0;
/* Nonzero if tracing is enabled */
int trace_enabled = 0;
/* When nonzero, causes the program to print the total number of cycles
on a successful exit. */
int dump_cycles_on_success = 0;
/* When nonzero, indicates the total number of cycles before an automated
exit. This is to help speed through test cases that never finish. */
int max_cycles = 100000000;
static int type = S19;
char *exename;
const char *machine_name = "simple";
const char *prog_name = NULL;
static void usage (void)
{
printf ("Usage: %s <options> filename\n", exename);
printf ("Options are:\n");
printf ("-hex - load intel hex file\n");
printf ("-s19 - load motorola s record file\n");
printf ("-bin - load binary file\n");
printf ("-s addr - specify binary load address hexadecimal (default 0)\n");
printf ("default format is motorola s record\n");
exit (1);
}
void
idle_loop (void)
{
struct timeval now;
static struct timeval last = { 0, 0 };
int real_ms;
static unsigned long last_cycles = 0;
unsigned long cycles;
int sim_ms;
const int cycles_per_ms = 2000;
static int period = 100;
static int count = 100;
int delay;
static int total_ms_elapsed = 0;
if (--count > 0)
return;
if (last.tv_usec == 0)
gettimeofday (&last, NULL);
gettimeofday (&now, NULL);
real_ms = (now.tv_usec - last.tv_usec) / 1000;
if (real_ms < 0)
real_ms += 1000;
last = now;
cycles = get_cycles ();
sim_ms = (cycles - last_cycles) / cycles_per_ms;
if (sim_ms < 0)
sim_ms += cycles_per_ms;
last_cycles = cycles;
-
- /* Minimum sleep time is usually around 10ms. */
- delay = sim_ms - real_ms;
- total_ms_elapsed += delay;
+ total_ms_elapsed += sim_ms;
if (total_ms_elapsed > 100)
{
total_ms_elapsed -= 100;
wpc_periodic ();
+ command_periodic ();
}
+ delay = sim_ms - real_ms;
if (delay > 0)
{
if (delay > 60)
period -= 5;
else if (delay < 20)
period += 5;
usleep (delay * 1000UL);
}
count = period;
}
int do_help (const char *arg __attribute__((unused)));
#define NO_NEG 0
#define HAS_NEG 1
#define NO_ARG 0
#define HAS_ARG 1
struct option
{
char o_short;
const char *o_long;
const char *help;
unsigned int can_negate : 1;
unsigned int takes_arg : 1;
int *int_value;
int default_value;
const char **string_value;
int (*handler) (const char *arg);
} option_table[] = {
{ 'd', "debug", "Enter the monitor immediately",
HAS_NEG, NO_ARG, &debug_enabled, 1, NULL, NULL },
{ 'h', "help", NULL,
NO_NEG, NO_ARG, NULL, NULL, 0, do_help },
{ 'b', "binary", "",
NO_NEG, NO_ARG, &type, BIN, NULL, NULL },
{ 'M', "mhz", "", NO_NEG, HAS_ARG },
{ '-', "68a09", "Emulate the 68A09 variation (1.5Mhz)" },
{ '-', "68b09", "Emulate the 68B09 variation (2Mhz)" },
{ 'R', "realtime", "Limit simulation speed to match realtime" },
{ 'I', "irqfreq", "Asserts an IRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_irq, 0, NULL, NULL },
{ 'F', "firqfreq", "Asserts an FIRQ every so many cycles automatically",
NO_NEG, HAS_ARG, &cycles_per_firq, 0, NULL, NULL },
{ 'C', "cycledump", "",
HAS_NEG, NO_ARG, &dump_cycles_on_success, 1, NULL, NULL},
{ 't', "loadmap", "" },
{ 'T', "trace", "",
NO_NEG, NO_ARG, &trace_enabled, 1, NULL, NULL },
{ 'm', "maxcycles", "Sets maximum number of cycles to run",
NO_NEG, HAS_ARG, &max_cycles, 0, NULL, NULL },
{ 's', "machine", "Specify the machine (exact hardware) to emulate",
NO_NEG, HAS_ARG, NULL, 0, &machine_name, NULL },
{ '\0', NULL },
};
int
do_help (const char *arg __attribute__((unused)))
{
struct option *opt = option_table;
while (opt->o_long != NULL)
{
if (opt->help)
{
printf ("-%c,--%s %s\n",
opt->o_short, opt->o_long, opt->help);
}
opt++;
}
return -1;
}
/**
* Returns positive if an argument was taken.
* Returns zero if no argument was taken.
* Returns negative on error.
*/
int
process_option (struct option *opt, const char *arg)
{
int rc;
printf ("Processing option '%s'\n", opt->o_long);
if (opt->takes_arg)
{
if (!arg)
{
printf (" Takes argument but none given.\n");
rc = 0;
}
else
{
if (opt->int_value)
{
*(opt->int_value) = strtoul (arg, NULL, 0);
printf (" Integer argument '%d' taken.\n", *(opt->int_value));
}
else if (opt->string_value)
{
*(opt->string_value) = arg;
printf (" String argument '%s' taken.\n", *(opt->string_value));
}
rc = 1;
}
}
else
{
if (arg)
printf (" Takes no argument but one given, ignored.\n");
if (opt->int_value)
{
*(opt->int_value) = opt->default_value;
printf (" Integer argument 1 implied.\n");
}
rc = 0;
}
if (opt->handler)
{
rc = opt->handler (arg);
printf (" Handler called, rc=%d\n", rc);
}
if (rc < 0)
exit (0);
return rc;
}
int
process_plain_argument (const char *arg)
{
printf ("plain argument '%s'\n", arg);
if (!prog_name)
prog_name = arg;
}
int
parse_args (int argc, char *argv[])
{
int argn = 1;
struct option *opt;
next_arg:
while (argn < argc)
{
char *arg = argv[argn];
if (arg[0] == '-')
{
if (arg[1] == '-')
{
char *rest = strchr (arg+2, '=');
if (rest)
*rest++ = '\0';
opt = option_table;
while (opt->o_long != NULL)
{
if (!strcmp (opt->o_long, arg+2))
{
argn++;
(void)process_option (opt, rest);
goto next_arg;
}
opt++;
}
printf ("long option '%s' not recognized.\n", arg+2);
}
else
{
opt = option_table;
while (opt->o_long != NULL)
{
if (opt->o_short == arg[1])
{
argn++;
if (process_option (opt, argv[argn]))
argn++;
goto next_arg;
}
opt++;
}
printf ("short option '%c' not recognized.\n", arg[1]);
}
argn++;
}
else
{
process_plain_argument (argv[argn++]);
}
}
}
int
main (int argc, char *argv[])
{
int off = 0;
int i, j, n;
int argn = 1;
unsigned int loops = 0;
exename = argv[0];
/* TODO - enable different options by default
based on the executable name. */
#if 1
parse_args (argc, argv);
#else
while (argn < argc)
{
if (argv[argn][0] == '-')
{
int argpos = 1;
next_arg:
switch (argv[argn][argpos++])
{
case 'd':
debug_enabled = 1;
goto next_arg;
case 'h':
type = HEX;
goto next_arg;
case 'b':
type = BIN;
goto next_arg;
case 'M':
mhz = strtoul (argv[++argn], NULL, 16);
break;
case 'o':
off = strtoul (argv[++argn], NULL, 16);
type = BIN;
break;
case 'I':
cycles_per_irq = strtoul (argv[++argn], NULL, 0);
break;
case 'F':
cycles_per_firq = strtoul (argv[++argn], NULL, 0);
break;
case 'C':
dump_cycles_on_success = 1;
goto next_arg;
case 'T':
trace_enabled = 1;
goto next_arg;
case 'm':
max_cycles = strtoul (argv[++argn], NULL, 16);
break;
case 's':
machine_name = argv[++argn];
break;
case '\0':
break;
default:
usage ();
}
}
else if (!prog_name)
{
prog_name = argv[argn];
}
else
{
usage ();
}
argn++;
}
#endif
sym_init ();
switch (type)
{
case HEX:
if (prog_name && load_hex (prog_name))
usage ();
break;
case S19:
machine_init (machine_name, NULL);
if (prog_name && load_s19 (prog_name))
usage ();
break;
default:
machine_init (machine_name, prog_name);
break;
}
/* Try to load a map file */
if (prog_name)
load_map_file (prog_name);
/* Enable debugging if no executable given yet. */
if (!prog_name)
debug_enabled = 1;
else
/* OK, ready to run. Reset the CPU first. */
cpu_reset ();
monitor_init ();
command_init ();
keybuffering (0);
/* Now, iterate through the instructions.
* If no IRQs or FIRQs are enabled, we can just call cpu_execute()
* and let it run for a long time; otherwise, we need to come back
* here periodically and do the interrupt handling. */
for (cpu_quit = 1; cpu_quit != 0;)
{
if ((cycles_per_irq == 0) && (cycles_per_firq == 0))
{
total += cpu_execute (max_cycles ? max_cycles-1 : 500000);
}
else
{
/* TODO - FIRQ not handled yet */
total += cpu_execute (cycles_per_irq);
request_irq (0);
}
idle_loop ();
/* Check for a rogue program that won't end */
if ((max_cycles > 0) && (total > max_cycles))
{
sim_error ("maximum cycle count exceeded at %s\n",
monitor_addr_name (get_pc ()));
}
}
printf ("m6809-run stopped after %d cycles\n", total);
return 0;
}
|
bcd/exec09
|
388134422f01037d921760ae22910d41960a4228
|
Fix executable permissions on text files again.
|
diff --git a/6809.c b/6809.c
old mode 100755
new mode 100644
diff --git a/command.c b/command.c
old mode 100755
new mode 100644
diff --git a/machine.c b/machine.c
old mode 100755
new mode 100644
diff --git a/main.c b/main.c
old mode 100755
new mode 100644
diff --git a/monitor.c b/monitor.c
old mode 100755
new mode 100644
diff --git a/symtab.c b/symtab.c
old mode 100755
new mode 100644
|
bcd/exec09
|
f290a98494a3ec0aa0dc46bb20294f205bacf424
|
Remove old comment.
|
diff --git a/wpc.c b/wpc.c
old mode 100755
new mode 100644
index 4545165..01f3c7b
--- a/wpc.c
+++ b/wpc.c
@@ -1,537 +1,536 @@
/*
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include <sys/time.h>
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3800
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
U8 opto_mx[8];
int curr_sw;
int curr_sw_time;
};
struct wpc_asic *global_wpc;
void wpc_asic_reset (struct hw_device *dev)
{
struct wpc_asic *wpc = dev->priv;
global_wpc = wpc;
wpc->curr_sw_time = 0;
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
#if 1
return rc;
#endif
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
rc |= WPC_DEBUG_READ_READY;
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
unsigned int wpc_read_switch (struct wpc_asic *wpc, int num)
{
unsigned int val;
val = wpc->switch_mx[num / 8] & (1 << (num % 8));
// printf ("SW %d = %d\n", num, val);
return val ? 1 : 0;
}
void wpc_write_switch (struct wpc_asic *wpc, int num, int flag)
{
unsigned int col, val;
col = num / 8;
val = 1 << (num % 8);
if (wpc->opto_mx[col] & val)
flag = !flag;
wpc->switch_mx[col] &= ~val;
if (flag)
wpc->switch_mx[col] |= val;
}
void wpc_press_switch (struct wpc_asic *wpc, int num, int delay)
{
wpc_write_switch (wpc, num, 1);
wpc->curr_sw = num;
wpc->curr_sw_time = delay;
}
unsigned int wpc_read_switch_column (struct wpc_asic *wpc, int col)
{
unsigned int val = 0;
int row;
for (row = 0; row < 8; row++)
if (wpc_read_switch (wpc, col * 8 + row))
val |= (1 << row);
return val;
}
void wpc_write_lamp (int num, int flag)
{
}
void wpc_write_sol (int num, int flag)
{
}
void wpc_keypoll (struct wpc_asic *wpc)
{
fd_set fds;
struct timeval timeout;
int rc;
unsigned char c;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
{
rc = read (0, &c, 1);
//printf ("%c pressed\n", c);
switch (c)
{
case '7':
wpc_press_switch (wpc, 4, 200);
break;
case '8':
wpc_press_switch (wpc, 5, 200);
break;
case '9':
wpc_press_switch (wpc, 6, 200);
break;
case '0':
wpc_press_switch (wpc, 7, 200);
break;
default:
break;
}
}
}
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
struct wpc_asic *wpc = dev->priv;
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit / 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
case WPC_SW_ROW_INPUT:
val = wpc_read_switch_column (wpc, 1 + scanbit (wpc->switch_strobe));
break;
case WPC_SW_JUMPER_INPUT:
val = 0x55;
break;
case WPC_SW_CABINET_INPUT:
val = wpc_read_switch_column (wpc, 0);
break;
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (struct wpc_asic *wpc)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_set_rom_page (unsigned char val)
{
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
}
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct wpc_asic *wpc = dev->priv;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
/* ignore for now */
break;
case WPC_ROM_BANK:
wpc->rombank = val;
wpc_set_rom_page (val);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram (wpc);
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram (wpc);
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
case WPC_SW_COL_STROBE:
wpc->switch_strobe = val;
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
struct wpc_asic *wpc = global_wpc;
- //printf ("WPC 100ms periodic\n");
wpc_keypoll (wpc);
if (wpc->curr_sw_time > 0)
{
wpc->curr_sw_time -= 100;
if (wpc->curr_sw_time <= 0)
{
wpc->curr_sw_time = 0;
wpc_write_switch (wpc, wpc->curr_sw, 0);
}
}
}
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
struct wpc_asic *wpc = calloc (sizeof (struct wpc_asic), 1);
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
struct machine wpc_machine =
{
.fault = wpc_fault,
};
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
struct wpc_asic *wpc;
machine = &wpc_machine;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
wpc = dev->priv;
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
wpc_update_ram (wpc);
sym_add (&program_symtab, "WPC_ROM_BANK", to_absolute (WPC_ROM_BANK), 0);
}
|
bcd/exec09
|
0456e858bcb2c344f0cd81c658583b9f8f2ad1b9
|
Further updates:
|
diff --git a/6809.c b/6809.c
index 14046e1..3fa82d5 100644
--- a/6809.c
+++ b/6809.c
@@ -1,1998 +1,2036 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include "monitor.h"
#include <stdarg.h>
unsigned X, Y, S, U, PC;
unsigned A, B, DP;
unsigned H, N, Z, OV, C;
unsigned EFI;
#ifdef H6309
unsigned E, F, V, MD;
#define MD_NATIVE 0x1 /* if 1, execute in 6309 mode */
#define MD_FIRQ_LIKE_IRQ 0x2 /* if 1, FIRQ acts like IRQ */
#define MD_ILL 0x40 /* illegal instruction */
#define MD_DBZ 0x80 /* divide by zero */
#endif /* H6309 */
unsigned iPC;
unsigned long irq_start_time;
unsigned ea = 0;
long cpu_clk = 0;
long cpu_period = 0;
int cpu_quit = 1;
unsigned int irqs_pending = 0;
unsigned int firqs_pending = 0;
unsigned *index_regs[4] = { &X, &Y, &U, &S };
extern int dump_cycles_on_success;
extern int trace_enabled;
extern void irq (void);
+extern void firq (void);
void request_irq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
- //printf ("request IRQ : pending=%02X flags=%02X\n", irqs_pending, EFI);
irqs_pending |= (1 << source);
if (!(EFI & I_FLAG))
irq ();
}
void release_irq (unsigned int source)
{
irqs_pending &= ~(1 << source);
}
+void request_firq (unsigned int source)
+{
+ /* If the interrupt is not masked, generate
+ * IRQ immediately. Else, mark it pending and
+ * we'll check it later when the flags change.
+ */
+ firqs_pending |= (1 << source);
+ if (!(EFI & I_FLAG))
+ firq ();
+}
+
+void release_firq (unsigned int source)
+{
+ firqs_pending &= ~(1 << source);
+}
+
+
+
static inline void
check_pc (void)
{
/* TODO */
}
static inline void
check_stack (void)
{
/* TODO */
}
void
sim_error (const char *format, ...)
{
va_list ap;
va_start (ap, format);
fprintf (stderr, "m6809-run: (at PC=%04X) ", iPC);
vfprintf (stderr, format, ap);
va_end (ap);
if (debug_enabled)
monitor_on = 1;
else
exit (2);
}
unsigned long
get_cycles (void)
{
return total + cpu_period - cpu_clk;
}
void
sim_exit (uint8_t exit_code)
{
/* On a nonzero exit, always print an error message. */
if (exit_code != 0)
{
printf ("m6809-run: program exited with %d\n", exit_code);
if (exit_code)
monitor_backtrace ();
}
/* If a cycle count should be printed, do that last. */
if (dump_cycles_on_success)
printf ("Finished in %d cycles\n", get_cycles ());
exit (exit_code);
}
static inline void
change_pc (unsigned newPC)
{
/* TODO - will let some RAM execute for trampolines */
if ((newPC < 0x1C00) || (newPC > 0xFFFF))
{
fprintf (stderr, "m6809-run: invalid PC = %04X, previous was %s\n",
newPC, monitor_addr_name (PC));
exit (2);
}
if (trace_enabled)
{
fprintf (stderr, "PC : %s ", monitor_addr_name (PC));
fprintf (stderr, "-> %s\n", monitor_addr_name (newPC));
}
PC = newPC;
}
static inline unsigned
imm_byte (void)
{
unsigned val = read8 (PC);
PC++;
return val;
}
static inline unsigned
imm_word (void)
{
unsigned val = read16 (PC);
PC += 2;
return val;
}
#define WRMEM(addr, data) write8 (addr, data)
static void
WRMEM16 (unsigned addr, unsigned data)
{
WRMEM (addr, data >> 8);
cpu_clk--;
WRMEM ((addr + 1) & 0xffff, data & 0xff);
}
#define RDMEM(addr) read8 (addr)
static unsigned
RDMEM16 (unsigned addr)
{
unsigned val = RDMEM (addr) << 8;
cpu_clk--;
val |= RDMEM ((addr + 1) & 0xffff);
return val;
}
#define write_stack WRMEM
#define read_stack RDMEM
static void
write_stack16 (unsigned addr, unsigned data)
{
write_stack ((addr + 1) & 0xffff, data & 0xff);
write_stack (addr, data >> 8);
}
static unsigned
read_stack16 (unsigned addr)
{
return (read_stack (addr) << 8) | read_stack ((addr + 1) & 0xffff);
}
static void
direct (void)
{
unsigned val = read8 (PC) | DP;
PC++;
ea = val;
}
static void
indexed (void) /* note take 1 extra cycle */
{
unsigned post = imm_byte ();
unsigned *R = index_regs[(post >> 5) & 0x3];
if (post & 0x80)
{
switch (post & 0x1f)
{
case 0x00:
ea = *R;
*R = (*R + 1) & 0xffff;
cpu_clk -= 6;
break;
case 0x01:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
break;
case 0x02:
*R = (*R - 1) & 0xffff;
ea = *R;
cpu_clk -= 6;
break;
case 0x03:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
break;
case 0x04:
ea = *R;
cpu_clk -= 4;
break;
case 0x05:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
break;
case 0x06:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
break;
case 0x08:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
break;
case 0x09:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
break;
case 0x0d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
break;
case 0x11:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x13:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x14:
ea = *R;
cpu_clk -= 4;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x15:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x16:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x18:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x19:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1f:
ea = imm_word ();
cpu_clk -= 6;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
default:
ea = 0;
printf ("%X: invalid index post $%02X\n", iPC, post);
if (debug_enabled)
{
monitor_on = 1;
}
else
{
exit (1);
}
break;
}
}
else
{
if (post & 0x10)
post |= 0xfff0;
else
post &= 0x000f;
ea = (*R + post) & 0xffff;
cpu_clk -= 5;
}
}
static void
extended (void)
{
unsigned val = read16 (PC);
PC += 2;
ea = val;
}
/* external register functions */
unsigned
get_a (void)
{
return A;
}
unsigned
get_b (void)
{
return B;
}
unsigned
get_dp (void)
{
return DP >> 8;
}
unsigned
get_x (void)
{
return X;
}
unsigned
get_y (void)
{
return Y;
}
unsigned
get_s (void)
{
return S;
}
unsigned
get_u (void)
{
return U;
}
unsigned
get_pc (void)
{
return PC & 0xffff;
}
unsigned
get_d (void)
{
return (A << 8) | B;
}
#ifdef H6309
unsigned
get_e (void)
{
return E;
}
unsigned
get_f (void)
{
return F;
}
unsigned
get_w (void)
{
return (E << 8) | F;
}
unsigned
get_q (void)
{
return (get_w () << 16) | get_d ();
}
unsigned
get_v (void)
{
return V;
}
unsigned
get_zero (void)
{
return 0;
}
unsigned
get_md (void)
{
return MD;
}
#endif
void
set_a (unsigned val)
{
A = val & 0xff;
}
void
set_b (unsigned val)
{
B = val & 0xff;
}
void
set_dp (unsigned val)
{
DP = (val & 0xff) << 8;
}
void
set_x (unsigned val)
{
X = val & 0xffff;
}
void
set_y (unsigned val)
{
Y = val & 0xffff;
}
void
set_s (unsigned val)
{
S = val & 0xffff;
check_stack ();
}
void
set_u (unsigned val)
{
U = val & 0xffff;
}
void
set_pc (unsigned val)
{
PC = val & 0xffff;
check_pc ();
}
void
set_d (unsigned val)
{
A = (val >> 8) & 0xff;
B = val & 0xff;
}
#ifdef H6309
void
set_e (unsigned val)
{
E = val & 0xff;
}
void
set_f (unsigned val)
{
F = val & 0xff;
}
void
set_w (unsigned val)
{
E = (val >> 8) & 0xff;
F = val & 0xff;
}
void
set_q (unsigned val)
{
set_w ((val >> 16) & 0xffff);
set_d (val & 0xffff);
}
void
set_v (unsigned val)
{
V = val & 0xff;
}
void
set_zero (unsigned val)
{
}
void
set_md (unsigned val)
{
MD = val & 0xff;
}
#endif
/* handle condition code register */
unsigned
get_cc (void)
{
unsigned res = EFI & (E_FLAG | F_FLAG | I_FLAG);
if (H & 0x10)
res |= H_FLAG;
if (N & 0x80)
res |= N_FLAG;
if (Z == 0)
res |= Z_FLAG;
if (OV & 0x80)
res |= V_FLAG;
if (C != 0)
res |= C_FLAG;
return res;
}
void
set_cc (unsigned arg)
{
EFI = arg & (E_FLAG | F_FLAG | I_FLAG);
H = (arg & H_FLAG ? 0x10 : 0);
N = (arg & N_FLAG ? 0x80 : 0);
Z = (~arg) & Z_FLAG;
OV = (arg & V_FLAG ? 0x80 : 0);
C = arg & C_FLAG;
/* Check for pending interrupts */
- if (irqs_pending && !(EFI & I_FLAG))
+ if (firqs_pending && !(EFI & F_FLAG))
+ firq ();
+ else if (irqs_pending && !(EFI & I_FLAG))
irq ();
}
unsigned
get_reg (unsigned nro)
{
unsigned val = 0xff;
switch (nro)
{
case 0:
val = (A << 8) | B;
break;
case 1:
val = X;
break;
case 2:
val = Y;
break;
case 3:
val = U;
break;
case 4:
val = S;
break;
case 5:
val = PC & 0xffff;
break;
#ifdef H6309
case 6:
val = (E << 8) | F;
break;
case 7:
val = V;
break;
#endif
case 8:
val = A;
break;
case 9:
val = B;
break;
case 10:
val = get_cc ();
break;
case 11:
val = DP >> 8;
break;
#ifdef H6309
case 14:
val = E;
break;
case 15:
val = F;
break;
#endif
}
return val;
}
void
set_reg (unsigned nro, unsigned val)
{
switch (nro)
{
case 0:
A = val >> 8;
B = val & 0xff;
break;
case 1:
X = val;
break;
case 2:
Y = val;
break;
case 3:
U = val;
break;
case 4:
S = val;
break;
case 5:
PC = val;
check_pc ();
break;
#ifdef H6309
case 6:
E = val >> 8;
F = val & 0xff;
break;
case 7:
V = val;
break;
#endif
case 8:
A = val;
break;
case 9:
B = val;
break;
case 10:
set_cc (val);
break;
case 11:
DP = val << 8;
break;
#ifdef H6309
case 14:
E = val;
break;
case 15:
F = val;
break;
#endif
}
}
/* 8-Bit Accumulator and Memory Instructions */
static unsigned
adc (unsigned arg, unsigned val)
{
unsigned res = arg + val + (C != 0);
C = (res >> 1) & 0x80;
N = Z = res &= 0xff;
OV = H = arg ^ val ^ res ^ C;
return res;
}
static unsigned
add (unsigned arg, unsigned val)
{
unsigned res = arg + val;
C = (res >> 1) & 0x80;
N = Z = res &= 0xff;
OV = H = arg ^ val ^ res ^ C;
return res;
}
static unsigned
and (unsigned arg, unsigned val)
{
unsigned res = arg & val;
N = Z = res;
OV = 0;
return res;
}
static unsigned
asl (unsigned arg) /* same as lsl */
{
unsigned res = arg << 1;
C = res & 0x100;
N = Z = res &= 0xff;
OV = arg ^ res;
cpu_clk -= 2;
return res;
}
static unsigned
asr (unsigned arg)
{
unsigned res = (INT8) arg;
C = res & 1;
N = Z = res = (res >> 1) & 0xff;
cpu_clk -= 2;
return res;
}
static void
bit (unsigned arg, unsigned val)
{
unsigned res = arg & val;
N = Z = res;
OV = 0;
}
static unsigned
clr (unsigned arg)
{
C = N = Z = OV = arg = 0;
cpu_clk -= 2;
return arg;
}
static void
cmp (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
}
static unsigned
com (unsigned arg)
{
unsigned res = arg ^ 0xff;
N = Z = res;
OV = 0;
C = 1;
cpu_clk -= 2;
return res;
}
static void
daa (void)
{
unsigned res = A;
unsigned msn = res & 0xf0;
unsigned lsn = res & 0x0f;
if (lsn > 0x09 || (H & 0x10))
res += 0x06;
if (msn > 0x80 && lsn > 0x09)
res += 0x60;
if (msn > 0x90 || (C != 0))
res += 0x60;
C |= (res & 0x100);
A = N = Z = res &= 0xff;
OV = 0; /* fix this */
cpu_clk -= 2;
}
static unsigned
dec (unsigned arg)
{
unsigned res = (arg - 1) & 0xff;
N = Z = res;
OV = arg & ~res;
cpu_clk -= 2;
return res;
}
unsigned
eor (unsigned arg, unsigned val)
{
unsigned res = arg ^ val;
N = Z = res;
OV = 0;
return res;
}
static void
exg (void)
{
unsigned tmp1 = 0xff;
unsigned tmp2 = 0xff;
unsigned post = imm_byte ();
if (((post ^ (post << 4)) & 0x80) == 0)
{
tmp1 = get_reg (post >> 4);
tmp2 = get_reg (post & 15);
}
set_reg (post & 15, tmp1);
set_reg (post >> 4, tmp2);
cpu_clk -= 8;
}
static unsigned
inc (unsigned arg)
{
unsigned res = (arg + 1) & 0xff;
N = Z = res;
OV = ~arg & res;
cpu_clk -= 2;
return res;
}
static unsigned
ld (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
return res;
}
static unsigned
lsr (unsigned arg)
{
unsigned res = arg >> 1;
N = 0;
Z = res;
C = arg & 1;
cpu_clk -= 2;
return res;
}
static void
mul (void)
{
unsigned res = (A * B) & 0xffff;
Z = res;
C = res & 0x80;
A = res >> 8;
B = res & 0xff;
cpu_clk -= 11;
}
static unsigned
neg (int arg)
{
unsigned res = (-arg) & 0xff;
C = N = Z = res;
OV = res & arg;
cpu_clk -= 2;
return res;
}
static unsigned
or (unsigned arg, unsigned val)
{
unsigned res = arg | val;
N = Z = res;
OV = 0;
return res;
}
static unsigned
rol (unsigned arg)
{
unsigned res = (arg << 1) + (C != 0);
C = res & 0x100;
N = Z = res &= 0xff;
OV = arg ^ res;
cpu_clk -= 2;
return res;
}
static unsigned
ror (unsigned arg)
{
unsigned res = arg;
if (C != 0)
res |= 0x100;
C = res & 1;
N = Z = res >>= 1;
cpu_clk -= 2;
return res;
}
static unsigned
sbc (unsigned arg, unsigned val)
{
unsigned res = arg - val - (C != 0);
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
return res;
}
static void
st (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
WRMEM (ea, res);
}
static unsigned
sub (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
return res;
}
static void
tst (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
cpu_clk -= 2;
}
static void
tfr (void)
{
unsigned tmp1 = 0xff;
unsigned post = imm_byte ();
if (((post ^ (post << 4)) & 0x80) == 0)
tmp1 = get_reg (post >> 4);
set_reg (post & 15, tmp1);
cpu_clk -= 6;
}
/* 16-Bit Accumulator Instructions */
static void
abx (void)
{
X = (X + B) & 0xffff;
cpu_clk -= 3;
}
static void
addd (unsigned val)
{
unsigned arg = (A << 8) | B;
unsigned res = arg + val;
C = res & 0x10000;
Z = res &= 0xffff;
OV = ((arg ^ res) & (val ^ res)) >> 8;
A = N = res >> 8;
B = res & 0xff;
}
static void
cmp16 (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x10000;
Z = res &= 0xffff;
N = res >> 8;
OV = ((arg ^ val) & (arg ^ res)) >> 8;
}
static void
ldd (unsigned arg)
{
unsigned res = arg;
Z = res;
A = N = res >> 8;
B = res & 0xff;
OV = 0;
}
static unsigned
ld16 (unsigned arg)
{
unsigned res = arg;
Z = res;
N = res >> 8;
OV = 0;
return res;
}
static void
sex (void)
{
unsigned res = B;
Z = res;
N = res &= 0x80;
if (res != 0)
res = 0xff;
A = res;
cpu_clk -= 2;
}
static void
std (void)
{
unsigned res = (A << 8) | B;
Z = res;
N = A;
OV = 0;
WRMEM16 (ea, res);
}
static void
st16 (unsigned arg)
{
unsigned res = arg;
Z = res;
N = res >> 8;
OV = 0;
WRMEM16 (ea, res);
}
static void
subd (unsigned val)
{
unsigned arg = (A << 8) | B;
unsigned res = arg - val;
C = res & 0x10000;
Z = res &= 0xffff;
OV = ((arg ^ val) & (arg ^ res)) >> 8;
A = N = res >> 8;
B = res & 0xff;
}
/* stack instructions */
static void
pshs (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x80)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
}
if (post & 0x40)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, U);
}
if (post & 0x20)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
}
if (post & 0x10)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
}
}
static void
pshu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x80)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, PC & 0xffff);
}
if (post & 0x40)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, S);
}
if (post & 0x20)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, Y);
}
if (post & 0x10)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, get_cc ());
}
}
static void
puls (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
}
static void
pulu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (U));
U = (U + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (U) << 8;
U = (U + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
S = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (U);
check_pc ();
U = (U + 2) & 0xffff;
}
}
/* Miscellaneous Instructions */
static void
nop (void)
{
cpu_clk -= 2;
}
static void
jsr (void)
{
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
change_pc (ea);
monitor_call (0);
}
static void
rti (void)
{
monitor_return ();
cpu_clk -= 6;
command_exit_irq_hook (get_cycles () - irq_start_time);
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
if ((EFI & E_FLAG) != 0)
{
cpu_clk -= 9;
A = read_stack (S);
S = (S + 1) & 0xffff;
B = read_stack (S);
S = (S + 1) & 0xffff;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
static void
rts (void)
{
monitor_return ();
cpu_clk -= 5;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
void
irq (void)
{
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
irq_start_time = get_cycles ();
change_pc (read16 (0xfff8));
#if 1
irqs_pending = 0;
#endif
}
+
+void
+firq (void)
+{
+ EFI |= E_FLAG;
+ S = (S - 2) & 0xffff;
+ write_stack16 (S, PC & 0xffff);
+ S = (S - 1) & 0xffff;
+ write_stack (S, get_cc ());
+ EFI |= (I_FLAG | F_FLAG);
+
+ change_pc (read16 (0xfffc));
+#if 1
+ firqs_pending = 0;
+#endif
+}
+
+
void
swi (void)
{
cpu_clk -= 19;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
change_pc (read16 (0xfffa));
}
void
swi2 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff4));
}
void
swi3 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff2));
}
void
cwai (void)
{
puts ("CWAI - not supported yet!");
exit (100);
}
void
sync (void)
{
puts ("SYNC - not supported yet!");
exit (100);
cpu_clk -= 4;
}
static void
orcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () | tmp);
cpu_clk -= 3;
}
static void
andcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () & tmp);
cpu_clk -= 3;
}
/* Branch Instructions */
#define cond_HI() ((Z != 0) && (C == 0))
#define cond_LS() ((Z == 0) || (C != 0))
#define cond_HS() (C == 0)
#define cond_LO() (C != 0)
#define cond_NE() (Z != 0)
#define cond_EQ() (Z == 0)
#define cond_VC() ((OV & 0x80) == 0)
#define cond_VS() ((OV & 0x80) != 0)
#define cond_PL() ((N & 0x80) == 0)
#define cond_MI() ((N & 0x80) != 0)
#define cond_GE() (((N^OV) & 0x80) == 0)
#define cond_LT() (((N^OV) & 0x80) != 0)
#define cond_GT() ((((N^OV) & 0x80) == 0) && (Z != 0))
#define cond_LE() ((((N^OV) & 0x80) != 0) || (Z == 0))
static void
bra (void)
{
INT8 tmp = (INT8) imm_byte ();
change_pc (PC + tmp);
}
static void
branch (unsigned cond)
{
if (cond)
bra ();
else
change_pc (PC+1);
cpu_clk -= 3;
}
static void
long_bra (void)
{
INT16 tmp = (INT16) imm_word ();
change_pc (PC + tmp);
}
static void
long_branch (unsigned cond)
{
if (cond)
{
long_bra ();
cpu_clk -= 6;
}
else
{
change_pc (PC + 2);
cpu_clk -= 5;
}
}
static void
long_bsr (void)
{
INT16 tmp = (INT16) imm_word ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 9;
change_pc (ea);
monitor_call (0);
}
static void
bsr (void)
{
INT8 tmp = (INT8) imm_byte ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 7;
change_pc (ea);
monitor_call (0);
}
/* execute 6809 code */
int
cpu_execute (int cycles)
{
unsigned opcode;
cpu_period = cpu_clk = cycles;
do
{
command_insn_hook ();
if (check_break (PC) != 0)
monitor_on = 1;
if (monitor_on != 0)
if (monitor6809 () != 0)
goto cpu_exit;
iPC = PC;
opcode = imm_byte ();
switch (opcode)
{
case 0x00:
direct ();
cpu_clk -= 4;
WRMEM (ea, neg (RDMEM (ea)));
break; /* NEG direct */
#ifdef H6309
case 0x01: /* OIM */
break;
case 0x02: /* AIM */
break;
#endif
case 0x03:
direct ();
cpu_clk -= 4;
WRMEM (ea, com (RDMEM (ea)));
break; /* COM direct */
case 0x04:
direct ();
cpu_clk -= 4;
WRMEM (ea, lsr (RDMEM (ea)));
break; /* LSR direct */
#ifdef H6309
case 0x05: /* EIM */
break;
#endif
case 0x06:
direct ();
cpu_clk -= 4;
WRMEM (ea, ror (RDMEM (ea)));
break; /* ROR direct */
case 0x07:
direct ();
cpu_clk -= 4;
WRMEM (ea, asr (RDMEM (ea)));
break; /* ASR direct */
case 0x08:
direct ();
cpu_clk -= 4;
WRMEM (ea, asl (RDMEM (ea)));
break; /* ASL direct */
case 0x09:
direct ();
cpu_clk -= 4;
WRMEM (ea, rol (RDMEM (ea)));
break; /* ROL direct */
case 0x0a:
direct ();
cpu_clk -= 4;
WRMEM (ea, dec (RDMEM (ea)));
break; /* DEC direct */
#ifdef H6309
case 0x0B: /* TIM */
break;
#endif
case 0x0c:
direct ();
cpu_clk -= 4;
WRMEM (ea, inc (RDMEM (ea)));
break; /* INC direct */
case 0x0d:
direct ();
cpu_clk -= 4;
tst (RDMEM (ea));
break; /* TST direct */
case 0x0e:
direct ();
cpu_clk -= 3;
PC = ea;
check_pc ();
monitor_call (FC_TAIL_CALL);
break; /* JMP direct */
case 0x0f:
direct ();
cpu_clk -= 4;
WRMEM (ea, clr (RDMEM (ea)));
break; /* CLR direct */
case 0x10:
{
opcode = imm_byte ();
switch (opcode)
{
case 0x21:
cpu_clk -= 5;
PC += 2;
break;
case 0x22:
long_branch (cond_HI ());
break;
case 0x23:
long_branch (cond_LS ());
break;
case 0x24:
long_branch (cond_HS ());
break;
case 0x25:
long_branch (cond_LO ());
break;
case 0x26:
long_branch (cond_NE ());
break;
case 0x27:
long_branch (cond_EQ ());
break;
case 0x28:
long_branch (cond_VC ());
break;
case 0x29:
long_branch (cond_VS ());
break;
case 0x2a:
long_branch (cond_PL ());
break;
case 0x2b:
long_branch (cond_MI ());
break;
case 0x2c:
long_branch (cond_GE ());
break;
case 0x2d:
long_branch (cond_LT ());
break;
case 0x2e:
long_branch (cond_GT ());
break;
case 0x2f:
long_branch (cond_LE ());
break;
#ifdef H6309
case 0x30: /* ADDR */
break;
case 0x31: /* ADCR */
break;
case 0x32: /* SUBR */
break;
case 0x33: /* SBCR */
break;
case 0x34: /* ANDR */
break;
case 0x35: /* ORR */
break;
case 0x36: /* EORR */
break;
case 0x37: /* CMPR */
break;
case 0x38: /* PSHSW */
break;
case 0x39: /* PULSW */
break;
case 0x3a: /* PSHUW */
break;
case 0x3b: /* PULUW */
break;
#endif
case 0x3f:
swi2 ();
break;
#ifdef H6309
case 0x40: /* NEGD */
break;
case 0x43: /* COMD */
break;
case 0x44: /* LSRD */
break;
case 0x46: /* RORD */
break;
case 0x47: /* ASRD */
break;
case 0x48: /* ASLD/LSLD */
break;
case 0x49: /* ROLD */
break;
case 0x4a: /* DECD */
break;
case 0x4c: /* INCD */
break;
case 0x4d: /* TSTD */
break;
case 0x4f: /* CLRD */
break;
case 0x53: /* COMW */
break;
case 0x54: /* LSRW */
break;
case 0x56: /* ??RORW */
break;
case 0x59: /* ROLW */
break;
case 0x5a: /* DECW */
break;
case 0x5c: /* INCW */
break;
case 0x5d: /* TSTW */
break;
case 0x5f: /* CLRW */
break;
case 0x80: /* SUBW */
break;
case 0x81: /* CMPW */
break;
case 0x82: /* SBCD */
break;
#endif
case 0x83:
cpu_clk -= 5;
cmp16 (get_d (), imm_word ());
break;
#ifdef H6309
case 0x84: /* ANDD */
break;
case 0x85: /* BITD */
break;
case 0x86: /* LDW */
break;
case 0x88: /* EORD */
break;
case 0x89: /* ADCD */
break;
case 0x8a: /* ORD */
break;
case 0x8b: /* ADDW */
break;
#endif
case 0x8c:
cpu_clk -= 5;
cmp16 (Y, imm_word ());
break;
case 0x8e:
cpu_clk -= 4;
Y = ld16 (imm_word ());
break;
#ifdef H6309
case 0x90: /* SUBW */
break;
case 0x91: /* CMPW */
break;
case 0x92: /* SBCD */
break;
#endif
case 0x93:
direct ();
cpu_clk -= 5;
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0x9c:
direct ();
cpu_clk -= 5;
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0x9e:
direct ();
cpu_clk -= 5;
Y = ld16 (RDMEM16 (ea));
break;
case 0x9f:
direct ();
cpu_clk -= 5;
st16 (Y);
break;
case 0xa3:
cpu_clk--;
indexed ();
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0xac:
cpu_clk--;
indexed ();
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0xae:
cpu_clk--;
indexed ();
Y = ld16 (RDMEM16 (ea));
break;
case 0xaf:
cpu_clk--;
indexed ();
st16 (Y);
break;
case 0xb3:
extended ();
cpu_clk -= 6;
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0xbc:
extended ();
cpu_clk -= 6;
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0xbe:
extended ();
cpu_clk -= 6;
Y = ld16 (RDMEM16 (ea));
diff --git a/command.c b/command.c
index cd1784f..6d3e534 100644
--- a/command.c
+++ b/command.c
@@ -1,1063 +1,1082 @@
#include "6809.h"
#include "monitor.h"
#include "machine.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/errno.h>
#include <termios.h>
typedef struct
{
unsigned int size;
unsigned int count;
char **strings;
} cmdqueue_t;
/**********************************************************/
/********************* Global Data ************************/
/**********************************************************/
unsigned int break_count = 0;
breakpoint_t breaktab[MAX_BREAKS];
unsigned int active_break_count = 0;
unsigned int display_count = 0;
display_t displaytab[MAX_DISPLAYS];
unsigned int history_count = 0;
unsigned long historytab[MAX_HISTORY];
absolute_address_t examine_addr = 0;
unsigned int examine_repeat = 1;
datatype_t examine_type;
unsigned int thread_id_size = 2;
absolute_address_t thread_current;
absolute_address_t thread_id = 0;
thread_t threadtab[MAX_THREADS];
#define MAX_CMD_QUEUES 8
int command_stack_depth = -1;
cmdqueue_t command_stack[MAX_CMD_QUEUES];
datatype_t print_type;
char *command_flags;
int exit_command_loop;
#define IRQ_CYCLE_COUNTS 128
unsigned int irq_cycle_tab[IRQ_CYCLE_COUNTS] = { 0, };
unsigned int irq_cycle_entry = 0;
unsigned long irq_cycles = 0;
unsigned long eval (char *expr);
extern int auto_break_insn_count;
/**********************************************************/
/******************** 6809 Functions **********************/
/**********************************************************/
void
print_addr (absolute_address_t addr)
{
const char *name;
print_device_name (addr >> 28);
putchar (':');
printf ("0x%04X", addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
printf (" <%-16.16s>", name);
else
printf ("%-20.20s", "");
}
/**********************************************************/
/*********************** Functions ************************/
/**********************************************************/
void
syntax_error (const char *string)
{
fprintf (stderr, "error: %s\n", string);
}
void
save_value (unsigned long val)
{
historytab[history_count++ % MAX_HISTORY] = val;
}
unsigned long
eval_historical (unsigned int id)
{
return historytab[id % MAX_HISTORY];
}
void
assign_virtual (const char *name, unsigned long val)
{
unsigned long v_val;
if (!sym_find (&auto_symtab, name, &v_val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)v_val;
virtual (&val, 1);
return;
}
sym_set (&internal_symtab, name, val, 0);
if (!strcmp (name, "thread_current"))
{
printf ("Thread pointer initialized to ");
print_addr (val);
putchar ('\n');
thread_current = val;
}
}
unsigned long
eval_virtual (const char *name)
{
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
if (!sym_find (&auto_symtab, name, &val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)val;
virtual (&val, 0);
}
else if (!sym_find (&internal_symtab, name, &val, 0))
{
}
else
{
return 0;
}
return val;
}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
case 'o':
case 'a':
+ case 's':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
char *
match_binary (char *expr, const char *op, char **secondp)
{
char *p;
p = strstr (expr, op);
if (!p)
return NULL;
*p = '\0';
p += strlen (op);
*secondp = p;
return expr;
}
int
fold_comparisons (char *expr, unsigned long *value)
{
char *p;
if (match_binary (expr, "==", &p))
*value = (eval (expr) == eval (p));
else if (match_binary (expr, "!=", &p))
*value = (eval (expr) != eval (p));
else
return 0;
return 1;
}
int
fold_binary (char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
eval_mem (char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
/* TODO - if expr is already in absolute form,
this explodes ! */
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
eval (char *expr)
{
char *p;
unsigned long val;
if (fold_comparisons (expr, &val));
else if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
unsigned int size = 1;
expr++;
if (*expr == '*')
{
expr++;
size = 2;
}
absolute_address_t addr = eval_mem (expr);
return target_read (addr, size);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
br->keep_running = 0;
br->ignore_count = 0;
br->temp = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
void
brkfree_temps (void)
{
+ unsigned int n;
+ for (n = 0; n < MAX_BREAKS; n++)
+ if (breaktab[n].used && breaktab[n].temp)
+ {
+ brkfree (&breaktab[n]);
+ }
}
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
if (brkpt->keep_running)
printf (", print-only");
if (brkpt->temp)
printf (", temp");
putchar ('\n');
}
display_t *
display_alloc (void)
{
unsigned int n;
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (!ds->used)
{
ds->used = 1;
return ds;
}
}
}
void
display_free (display_t *ds)
{
}
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
switch (typep->format)
{
case 'a':
print_addr (val);
return;
+
+ case 's':
+ {
+ absolute_address_t addr = (absolute_address_t)val;
+ char c;
+
+ putchar ('"');
+ while ((c = abs_read8 (addr++)) != '\0')
+ putchar (c);
+ putchar ('"');
+ return;
+ }
}
if (typep->format == 'x')
{
printf ("0x");
sprintf (f, "%%0%d%c", typep->size * 2, typep->format);
}
else if (typep->format == 'o')
{
printf ("0");
sprintf (f, "%%%c", typep->format);
}
else
sprintf (f, "%%%c", typep->format);
printf (f, val);
}
void
display_print (void)
{
unsigned int n;
char comma = '\0';
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (ds->used)
{
char expr[256];
strcpy (expr, ds->expr);
printf ("%c %s = ", comma, expr);
print_value (eval (expr), &ds->type);
comma = ',';
}
}
if (comma)
putchar ('\n');
}
int
print_insn (absolute_address_t addr)
{
char buf[64];
int size = dasm (buf, addr);
printf ("%s", buf);
return size;
}
void
do_examine (void)
{
unsigned int n;
unsigned int objs_per_line = 16;
if (isdigit (*command_flags))
examine_repeat = strtoul (command_flags, &command_flags, 0);
- if (*command_flags == 's' || *command_flags == 'i')
+ if (*command_flags == 'i')
examine_type.format = *command_flags;
else
parse_format_flag (command_flags, &examine_type.format);
parse_size_flag (command_flags, &examine_type.size);
switch (examine_type.format)
{
case 'i':
objs_per_line = 1;
break;
case 'w':
objs_per_line = 8;
break;
}
for (n = 0; n < examine_repeat; n++)
{
if ((n % objs_per_line) == 0)
{
putchar ('\n');
print_addr (examine_addr);
printf (": ");
}
switch (examine_type.format)
{
case 's': /* string */
break;
case 'i': /* instruction */
examine_addr += print_insn (examine_addr);
break;
default:
print_value (target_read (examine_addr, examine_type.size),
&examine_type);
putchar (' ');
examine_addr += examine_type.size;
}
}
putchar ('\n');
}
void
do_print (char *expr)
{
unsigned long val = eval (expr);
printf ("$%d = ", history_count);
parse_format_flag (command_flags, &print_type.format);
parse_size_flag (command_flags, &print_type.size);
print_value (val, &print_type);
putchar ('\n');
save_value (val);
}
void
do_set (char *expr)
{
unsigned long val = eval (expr);
save_value (val);
}
#define THREAD_DATA_PC 3
#define THREAD_DATA_ROMBANK 9
void
print_thread_data (absolute_address_t th)
{
U8 b;
U16 w;
absolute_address_t pc;
w = abs_read16 (th + THREAD_DATA_PC);
b = abs_read8 (th + THREAD_DATA_ROMBANK);
printf ("{ PC = %04X, BANK = %02X }", w, b);
}
void
command_change_thread (void)
{
target_addr_t addr = target_read (thread_current, thread_id_size);
absolute_address_t th = to_absolute (addr);
if (th == thread_id)
return;
thread_id = th;
if (machine->dump_thread && eval ("$thread_debug"))
{
if (addr)
{
printf ("[Current thread = ");
print_addr (thread_id);
machine->dump_thread (thread_id);
print_thread_data (thread_id);
printf ("]\n");
}
else
{
printf ("[ No thread ]\n");
}
}
}
void
command_stack_push (unsigned int reason)
{
cmdqueue_t *q = &command_stack[++command_stack_depth];
}
void
command_stack_pop (void)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
--command_stack_depth;
}
void
command_stack_add (const char *cmd)
{
cmdqueue_t *q = &command_stack[command_stack_depth];
}
char *
getarg (void)
{
return strtok (NULL, " \t\n");
}
/****************** Command Handlers ************************/
void cmd_print (void)
{
char *arg = getarg ();
if (arg)
do_print (arg);
else
do_print ("$");
}
void cmd_set (void)
{
char *arg = getarg ();
if (arg)
do_set (arg);
else
do_set ("$");
}
void cmd_examine (void)
{
char *arg = getarg ();
if (arg)
examine_addr = eval_mem (arg);
do_examine ();
}
void cmd_break (void)
{
char *arg = getarg ();
if (!arg)
return;
unsigned long val = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = val;
br->on_execute = 1;
if ((arg = getarg()) && !strcmp (arg, "if"))
{
br->conditional = 1;
arg = getarg ();
strcpy (br->condition, arg);
}
brkprint (br);
}
void cmd_watch1 (int on_read, int on_write)
{
char *arg;
arg = getarg ();
if (!arg)
return;
absolute_address_t addr = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = addr;
br->on_read = on_read;
br->on_write = on_write;
arg = getarg ();
if (!arg)
return;
if (!strcmp (arg, "print"))
br->keep_running = 1;
else if (!strcmp (arg, "if"))
{
arg = getarg ();
br->conditional = 1;
strcpy (br->condition, arg);
}
brkprint (br);
}
void cmd_watch (void)
{
cmd_watch1 (0, 1);
}
void cmd_rwatch (void)
{
cmd_watch1 (1, 0);
}
void cmd_awatch (void)
{
cmd_watch1 (1, 1);
}
void cmd_break_list (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
brkprint (&breaktab[n]);
}
void cmd_step (void)
{
auto_break_insn_count = 1;
exit_command_loop = 0;
}
void cmd_next (void)
{
char buf[128];
breakpoint_t *br;
unsigned long addr = to_absolute (get_pc ());
addr += dasm (buf, addr);
br = brkalloc ();
br->addr = addr;
br->on_execute = 1;
br->temp = 1;
/* TODO - for conditional branches, should also set a
temp breakpoint at the branch target */
exit_command_loop = 0;
}
void cmd_continue (void)
{
exit_command_loop = 0;
}
void cmd_quit (void)
{
cpu_quit = 0;
exit_command_loop = 1;
}
void cmd_delete (void)
{
const char *arg = getarg ();
unsigned int id;
if (!arg)
{
int n;
printf ("Deleting all breakpoints.\n");
for (id = 0; id < MAX_BREAKS; id++)
{
breakpoint_t *br = brkfind_by_id (id);
brkfree (br);
}
return;
}
id = atoi (arg);
breakpoint_t *br = brkfind_by_id (id);
if (br->used)
{
printf ("Deleting breakpoint %d\n", id);
brkfree (br);
}
}
void cmd_list (void)
{
char *arg;
static absolute_address_t lastpc = 0;
static absolute_address_t lastaddr = 0;
absolute_address_t addr;
int n;
arg = getarg ();
if (arg)
addr = eval_mem (arg);
else
{
addr = to_absolute (get_pc ());
if (addr == lastpc)
addr = lastaddr;
else
lastaddr = lastpc = addr;
}
for (n = 0; n < 10; n++)
{
print_addr (addr);
printf (" : ");
addr += print_insn (addr);
putchar ('\n');
}
lastaddr = addr;
}
void cmd_symbol_file (void)
{
char *arg = getarg ();
if (arg)
load_map_file (arg);
}
void cmd_display (void)
{
char *arg;
while ((arg = getarg ()) != NULL)
{
display_t *ds = display_alloc ();
strcpy (ds->expr, arg);
ds->type = print_type;
parse_format_flag (command_flags, &ds->type.format);
parse_size_flag (command_flags, &ds->type.size);
}
}
int command_exec_file (const char *filename)
{
FILE *infile;
extern int command_exec (FILE *);
infile = file_open (NULL, filename, "r");
if (!infile)
return 0;
while (command_exec (infile) >= 0);
fclose (infile);
return 1;
}
void cmd_source (void)
{
char *arg = getarg ();
if (!arg)
return;
if (command_exec_file (arg) == 0)
fprintf (stderr, "can't open %s\n", arg);
}
void cmd_regs (void)
{
}
void cmd_vars (void)
{
for_each_var (NULL);
}
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
{ "s", "step", cmd_step,
"Step one instruction" },
{ "n", "next", cmd_next,
"Break at the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
{ "wa", "watch", cmd_watch,
"Add a watchpoint on write" },
{ "rwa", "rwatch", cmd_rwatch,
"Add a watchpoint on read" },
{ "awa", "awatch", cmd_awatch,
"Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
{ "l", "list", cmd_list },
{ "sym", "symbol-file", cmd_symbol_file,
"Open a symbol table file" },
{ "di", "display", cmd_display,
"Add a display expression" },
{ "so", "source", cmd_source,
"Run a command script" },
{ "regs", "regs", cmd_regs,
"Show all CPU registers" },
{ "vars", "vars", cmd_vars,
"Show all program variables" },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
{ "f", "file", cmd_file,
"Choose the program to be debugged" },
{ "exe", "exec-file", cmd_exec_file,
"Open an executable" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
/* TODO - look for a match anywhere between
* the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
diff --git a/main.c b/main.c
index 68fa794..6621345 100644
--- a/main.c
+++ b/main.c
@@ -1,364 +1,461 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/time.h>
#include "6809.h"
enum
{ HEX, S19, BIN };
/* The total number of cycles that have executed */
unsigned long total = 0;
/* The frequency of the emulated CPU, in megahertz */
unsigned int mhz = 1;
/* When nonzero, indicates that the IRQ should be triggered periodically,
every so many cycles. By default no periodic IRQ is generated. */
unsigned int cycles_per_irq = 0;
/* When nonzero, indicates that the FIRQ should be triggered periodically,
every so many cycles. By default no periodic FIRQ is generated. */
unsigned int cycles_per_firq = 0;
/* Nonzero if debugging support is turned on */
int debug_enabled = 0;
/* Nonzero if tracing is enabled */
int trace_enabled = 0;
/* When nonzero, causes the program to print the total number of cycles
on a successful exit. */
int dump_cycles_on_success = 0;
/* When nonzero, indicates the total number of cycles before an automated
exit. This is to help speed through test cases that never finish. */
int max_cycles = 100000000;
+static int type = S19;
+
char *exename;
const char *machine_name = "simple";
+const char *prog_name = NULL;
static void usage (void)
{
printf ("Usage: %s <options> filename\n", exename);
printf ("Options are:\n");
printf ("-hex - load intel hex file\n");
printf ("-s19 - load motorola s record file\n");
printf ("-bin - load binary file\n");
printf ("-s addr - specify binary load address hexadecimal (default 0)\n");
printf ("default format is motorola s record\n");
exit (1);
}
void
idle_loop (void)
{
struct timeval now;
static struct timeval last = { 0, 0 };
int real_ms;
static unsigned long last_cycles = 0;
unsigned long cycles;
int sim_ms;
const int cycles_per_ms = 2000;
static int period = 100;
static int count = 100;
int delay;
static int total_ms_elapsed = 0;
if (--count > 0)
return;
if (last.tv_usec == 0)
gettimeofday (&last, NULL);
gettimeofday (&now, NULL);
real_ms = (now.tv_usec - last.tv_usec) / 1000;
if (real_ms < 0)
real_ms += 1000;
last = now;
cycles = get_cycles ();
sim_ms = (cycles - last_cycles) / cycles_per_ms;
if (sim_ms < 0)
sim_ms += cycles_per_ms;
last_cycles = cycles;
/* Minimum sleep time is usually around 10ms. */
delay = sim_ms - real_ms;
total_ms_elapsed += delay;
if (total_ms_elapsed > 100)
{
total_ms_elapsed -= 100;
wpc_periodic ();
}
if (delay > 0)
{
if (delay > 60)
period -= 5;
else if (delay < 20)
period += 5;
usleep (delay * 1000UL);
}
count = period;
}
+int do_help (const char *arg __attribute__((unused)));
+
+#define NO_NEG 0
+#define HAS_NEG 1
+
+#define NO_ARG 0
+#define HAS_ARG 1
struct option
{
char o_short;
const char *o_long;
const char *help;
unsigned int can_negate : 1;
unsigned int takes_arg : 1;
int *int_value;
- char *string_value;
+ int default_value;
+ const char **string_value;
+ int (*handler) (const char *arg);
} option_table[] = {
- { 'd', "debug" },
- { 'h', "help" },
- { 'b', "binary" },
- { 'M', "mhz" },
- { '-', "68a09" },
- { '-', "68b09" },
- { 'R', "realtime" },
- { 'I', "irqfreq" },
- { 'F', "firqfreq" },
- { 'C', "cycledump" },
- { 't', "loadmap" },
- { 'T', "trace" },
- { 'm', "maxcycles" },
- { 's', "machine" },
+ { 'd', "debug", "Enter the monitor immediately",
+ HAS_NEG, NO_ARG, &debug_enabled, 1, NULL, NULL },
+ { 'h', "help", NULL,
+ NO_NEG, NO_ARG, NULL, NULL, 0, do_help },
+ { 'b', "binary", "",
+ NO_NEG, NO_ARG, &type, BIN, NULL, NULL },
+ { 'M', "mhz", "", NO_NEG, HAS_ARG },
+ { '-', "68a09", "Emulate the 68A09 variation (1.5Mhz)" },
+ { '-', "68b09", "Emulate the 68B09 variation (2Mhz)" },
+ { 'R', "realtime", "Limit simulation speed to match realtime" },
+ { 'I', "irqfreq", "Asserts an IRQ every so many cycles automatically",
+ NO_NEG, HAS_ARG, &cycles_per_irq, 0, NULL, NULL },
+ { 'F', "firqfreq", "Asserts an FIRQ every so many cycles automatically",
+ NO_NEG, HAS_ARG, &cycles_per_firq, 0, NULL, NULL },
+ { 'C', "cycledump", "",
+ HAS_NEG, NO_ARG, &dump_cycles_on_success, 1, NULL, NULL},
+ { 't', "loadmap", "" },
+ { 'T', "trace", "",
+ NO_NEG, NO_ARG, &trace_enabled, 1, NULL, NULL },
+ { 'm', "maxcycles", "Sets maximum number of cycles to run",
+ NO_NEG, HAS_ARG, &max_cycles, 0, NULL, NULL },
+ { 's', "machine", "Specify the machine (exact hardware) to emulate",
+ NO_NEG, HAS_ARG, NULL, 0, &machine_name, NULL },
{ '\0', NULL },
};
+int
+do_help (const char *arg __attribute__((unused)))
+{
+ struct option *opt = option_table;
+ while (opt->o_long != NULL)
+ {
+ if (opt->help)
+ {
+ printf ("-%c,--%s %s\n",
+ opt->o_short, opt->o_long, opt->help);
+ }
+ opt++;
+ }
+ return -1;
+}
+
+
+/**
+ * Returns positive if an argument was taken.
+ * Returns zero if no argument was taken.
+ * Returns negative on error.
+ */
int
process_option (struct option *opt, const char *arg)
{
- return 0;
+ int rc;
+ printf ("Processing option '%s'\n", opt->o_long);
+ if (opt->takes_arg)
+ {
+ if (!arg)
+ {
+ printf (" Takes argument but none given.\n");
+ rc = 0;
+ }
+ else
+ {
+ if (opt->int_value)
+ {
+ *(opt->int_value) = strtoul (arg, NULL, 0);
+ printf (" Integer argument '%d' taken.\n", *(opt->int_value));
+ }
+ else if (opt->string_value)
+ {
+ *(opt->string_value) = arg;
+ printf (" String argument '%s' taken.\n", *(opt->string_value));
+ }
+ rc = 1;
+ }
+ }
+ else
+ {
+ if (arg)
+ printf (" Takes no argument but one given, ignored.\n");
+
+ if (opt->int_value)
+ {
+ *(opt->int_value) = opt->default_value;
+ printf (" Integer argument 1 implied.\n");
+ }
+ rc = 0;
+ }
+
+ if (opt->handler)
+ {
+ rc = opt->handler (arg);
+ printf (" Handler called, rc=%d\n", rc);
+ }
+
+ if (rc < 0)
+ exit (0);
+ return rc;
+}
+
+
+int
+process_plain_argument (const char *arg)
+{
+ printf ("plain argument '%s'\n", arg);
+ if (!prog_name)
+ prog_name = arg;
}
int
parse_args (int argc, char *argv[])
{
int argn = 1;
struct option *opt;
next_arg:
while (argn < argc)
{
char *arg = argv[argn];
if (arg[0] == '-')
{
if (arg[1] == '-')
{
char *rest = strchr (arg+2, '=');
if (rest)
*rest++ = '\0';
opt = option_table;
while (opt->o_long != NULL)
{
if (!strcmp (opt->o_long, arg+2))
{
- if (process_option (opt, rest))
- argn++;
+ argn++;
+ (void)process_option (opt, rest);
goto next_arg;
}
opt++;
}
+ printf ("long option '%s' not recognized.\n", arg+2);
}
else
{
opt = option_table;
while (opt->o_long != NULL)
{
if (opt->o_short == arg[1])
{
+ argn++;
if (process_option (opt, argv[argn]))
argn++;
goto next_arg;
}
opt++;
}
+ printf ("short option '%c' not recognized.\n", arg[1]);
}
+ argn++;
}
else
{
- return argn;
+ process_plain_argument (argv[argn++]);
}
}
}
int
main (int argc, char *argv[])
{
- char *name = NULL;
- int type = S19;
int off = 0;
int i, j, n;
int argn = 1;
- int load_tmp_map = 0;
unsigned int loops = 0;
exename = argv[0];
/* TODO - enable different options by default
based on the executable name. */
+#if 1
+ parse_args (argc, argv);
+#else
while (argn < argc)
{
if (argv[argn][0] == '-')
{
int argpos = 1;
next_arg:
switch (argv[argn][argpos++])
{
case 'd':
debug_enabled = 1;
goto next_arg;
case 'h':
type = HEX;
goto next_arg;
case 'b':
type = BIN;
goto next_arg;
case 'M':
mhz = strtoul (argv[++argn], NULL, 16);
break;
case 'o':
off = strtoul (argv[++argn], NULL, 16);
type = BIN;
break;
case 'I':
cycles_per_irq = strtoul (argv[++argn], NULL, 0);
break;
case 'F':
cycles_per_firq = strtoul (argv[++argn], NULL, 0);
break;
case 'C':
dump_cycles_on_success = 1;
goto next_arg;
- case 't':
- load_tmp_map = 1;
- break;
case 'T':
trace_enabled = 1;
goto next_arg;
case 'm':
max_cycles = strtoul (argv[++argn], NULL, 16);
break;
case 's':
machine_name = argv[++argn];
break;
case '\0':
break;
default:
usage ();
}
}
- else if (!name)
+ else if (!prog_name)
{
- name = argv[argn];
+ prog_name = argv[argn];
}
else
{
usage ();
}
argn++;
}
+#endif
sym_init ();
switch (type)
{
case HEX:
- if (name && load_hex (name))
+ if (prog_name && load_hex (prog_name))
usage ();
break;
case S19:
machine_init (machine_name, NULL);
- if (name && load_s19 (name))
+ if (prog_name && load_s19 (prog_name))
usage ();
break;
default:
- machine_init (machine_name, name);
+ machine_init (machine_name, prog_name);
break;
}
/* Try to load a map file */
- if (load_tmp_map)
- load_map_file ("tmp");
- else if (name)
- load_map_file (name);
+ if (prog_name)
+ load_map_file (prog_name);
/* Enable debugging if no executable given yet. */
- if (!name)
+ if (!prog_name)
debug_enabled = 1;
else
/* OK, ready to run. Reset the CPU first. */
cpu_reset ();
monitor_init ();
command_init ();
keybuffering (0);
/* Now, iterate through the instructions.
* If no IRQs or FIRQs are enabled, we can just call cpu_execute()
* and let it run for a long time; otherwise, we need to come back
* here periodically and do the interrupt handling. */
for (cpu_quit = 1; cpu_quit != 0;)
{
if ((cycles_per_irq == 0) && (cycles_per_firq == 0))
{
total += cpu_execute (max_cycles ? max_cycles-1 : 500000);
}
else
{
/* TODO - FIRQ not handled yet */
total += cpu_execute (cycles_per_irq);
request_irq (0);
}
idle_loop ();
/* Check for a rogue program that won't end */
if ((max_cycles > 0) && (total > max_cycles))
{
sim_error ("maximum cycle count exceeded at %s\n",
monitor_addr_name (get_pc ()));
}
}
printf ("m6809-run stopped after %d cycles\n", total);
return 0;
}
diff --git a/monitor.c b/monitor.c
index c8b1ece..a328151 100644
--- a/monitor.c
+++ b/monitor.c
@@ -522,919 +522,900 @@ opcode_t codes10[256] = {
{_cmpd, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _indexed},
{_undoc, _illegal},
{_ldy, _indexed},
{_sty, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _extended},
{_undoc, _illegal},
{_ldy, _extended},
{_sty, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _direct},
{_sts, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _indexed},
{_sts, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _extended},
{_sts, _extended}
};
opcode_t codes11[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_swi3, _implied},
{_undoc, _illegal}, /* 11 40 */
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal}
};
char *reg[] = {
"D", "X", "Y", "U", "S", "PC", "??", "??",
"A", "B", "CC", "DP", "??", "??", "??", "??"
};
char index_reg[] = { 'X', 'Y', 'U', 'S' };
char *off4[] = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15",
"-16", "-15", "-14", "-13", "-12", "-11", "-10", "-9",
"-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"
};
/* Disassemble the current instruction. Returns the number of bytes that
compose it. */
int
dasm (char *buf, absolute_address_t opc)
{
UINT8 op, am;
char *op_str;
absolute_address_t pc = opc;
char R;
int fetch1; /* the first (MSB) fetched byte, used in macro RDWORD */
op = fetch8 ();
if (op == 0x10)
{
op = fetch8 ();
am = codes10[op].mode;
op = codes10[op].code;
}
else if (op == 0x11)
{
op = fetch8 ();
am = codes11[op].mode;
op = codes11[op].code;
}
else
{
am = codes[op].mode;
op = codes[op].code;
}
op_str = (char *) mne[op];
buf += sprintf (buf, "%-6.6s", op_str);
switch (am)
{
case _illegal:
sprintf (buf, "???");
break;
case _implied:
break;
case _imm_byte:
sprintf (buf, "#$%02X", fetch8 ());
break;
case _imm_word:
sprintf (buf, "#$%04X", fetch16 ());
break;
case _direct:
sprintf (buf, "<%s", monitor_addr_name (fetch8 ()));
break;
case _extended:
sprintf (buf, "%s", monitor_addr_name (fetch16 ()));
break;
case _indexed:
op = fetch8 ();
R = index_reg[(op >> 5) & 0x3];
if ((op & 0x80) == 0)
{
sprintf (buf, "%s,%c", off4[op & 0x1f], R);
break;
}
switch (op & 0x1f)
{
case 0x00:
sprintf (buf, ",%c+", R);
break;
case 0x01:
sprintf (buf, ",%c++", R);
break;
case 0x02:
sprintf (buf, ",-%c", R);
break;
case 0x03:
sprintf (buf, ",--%c", R);
break;
case 0x04:
sprintf (buf, ",%c", R);
break;
case 0x05:
sprintf (buf, "B,%c", R);
break;
case 0x06:
sprintf (buf, "A,%c", R);
break;
case 0x08:
sprintf (buf, "$%02X,%c", fetch8 (), R);
break;
case 0x09:
sprintf (buf, "$%04X,%c", fetch16 (), R);
break;
case 0x0B:
sprintf (buf, "D,%c", R);
break;
case 0x0C:
sprintf (buf, "$%02X,PC", fetch8 ());
break;
case 0x0D:
sprintf (buf, "$%04X,PC", fetch16 ());
break;
case 0x11:
sprintf (buf, "[,%c++]", R);
break;
case 0x13:
sprintf (buf, "[,--%c]", R);
break;
case 0x14:
sprintf (buf, "[,%c]", R);
break;
case 0x15:
sprintf (buf, "[B,%c]", R);
break;
case 0x16:
sprintf (buf, "[A,%c]", R);
break;
case 0x18:
sprintf (buf, "[$%02X,%c]", fetch8 (), R);
break;
case 0x19:
sprintf (buf, "[$%04X,%c]", fetch16 (), R);
break;
case 0x1B:
sprintf (buf, "[D,%c]", R);
break;
case 0x1C:
sprintf (buf, "[$%02X,PC]", fetch8 ());
break;
case 0x1D:
sprintf (buf, "[$%04X,PC]", fetch16 ());
break;
case 0x1F:
sprintf (buf, "[%s]", monitor_addr_name (fetch16 ()));
break;
default:
sprintf (buf, "???");
break;
}
break;
case _rel_byte:
fetch1 = ((INT8) fetch8 ());
- //sprintf (buf, "$%04X", (fetch1 + pc) & 0xffff);
- sprintf (buf, "%s", monitor_addr_name ((fetch1 + pc) & 0xffff));
+ sprintf (buf, "%s", absolute_addr_name (fetch1 + pc));
break;
case _rel_word:
- //sprintf (buf, "$%04X", (fetch16 () + pc) & 0xffff);
- sprintf (buf, "%s", monitor_addr_name ((fetch16 () + pc) & 0xffff));
+ sprintf (buf, "%s", absolute_addr_name (fetch16 () + pc));
break;
case _reg_post:
op = fetch8 ();
sprintf (buf, "%s,%s", reg[op >> 4], reg[op & 15]);
break;
case _usr_post:
case _sys_post:
op = fetch8 ();
if (op & 0x80)
strcat (buf, "PC,");
if (op & 0x40)
strcat (buf, am == _usr_post ? "S," : "U,");
if (op & 0x20)
strcat (buf, "Y,");
if (op & 0x10)
strcat (buf, "X,");
if (op & 0x08)
strcat (buf, "DP,");
if ((op & 0x06) == 0x06)
strcat (buf, "D,");
else
{
if (op & 0x04)
strcat (buf, "B,");
if (op & 0x02)
strcat (buf, "A,");
}
if (op & 0x01)
strcat (buf, "CC,");
buf[strlen (buf) - 1] = '\0';
break;
}
return pc - opc;
}
int
sizeof_file (FILE * file)
{
int size;
fseek (file, 0, SEEK_END);
size = ftell (file);
rewind (file);
return size;
}
int
load_map_file (const char *name)
{
FILE *fp;
char map_filename[256];
char buf[256];
char *value_ptr, *id_ptr;
target_addr_t value;
char *file_ptr;
sprintf (map_filename, "%s.map", name);
fp = file_open (NULL, map_filename, "r");
if (!fp)
return -1;
for (;;)
{
fgets (buf, sizeof(buf)-1, fp);
if (feof (fp))
break;
value_ptr = buf;
if (!strncmp (value_ptr, "page", 4))
{
unsigned char page = strtoul (value_ptr+4, NULL, 10);
wpc_set_rom_page (page);
continue;
}
if (strncmp (value_ptr, " ", 6))
continue;
while (*value_ptr == ' ')
value_ptr++;
value = strtoul (value_ptr, &id_ptr, 16);
if (id_ptr == value_ptr)
continue;
while (*id_ptr == ' ')
id_ptr++;
id_ptr = strtok (id_ptr, " \t\n");
if (((*id_ptr == 'l') || (*id_ptr == 's')) && (id_ptr[1] == '_'))
continue;
++id_ptr;
file_ptr = strtok (NULL, " \t\n");
sym_add (&program_symtab, id_ptr, to_absolute (value), 0); /* file_ptr? */
}
fclose (fp);
return 0;
}
int
load_hex (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = file_open (NULL, name, "r");
if (fp == NULL)
{
printf ("failed to open hex record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, ":%2x%4x%2x", &count, &addr, &type) != 3)
{
printf ("line %d: invalid hex record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff) + type;
switch (type)
{
case 0:
for (; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid hex record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 1:
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid hex record checksum \n", line);
done = 0;
break;
case 2:
default:
printf ("line %d: not supported hex type %d.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
int
load_s19 (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = file_open (NULL, name, "r");
if (fp == NULL)
{
printf ("failed to open S-record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, "S%1x%2x%4x", &type, &count, &addr) != 3)
{
printf ("line %d: invalid S record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff);
switch (type)
{
case 1:
for (count -= 3; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 9:
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
default:
printf ("line %d: S%d not supported.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
void
monitor_call (unsigned int flags)
{
#ifdef CALL_STACK
if (current_function_call <= &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call++;
current_function_call->entry_point = get_pc ();
current_function_call->flags = flags;
}
#endif
+ const char *id = sym_lookup (&program_symtab, to_absolute (get_pc ()));
+ if (id)
+ {
+ // printf ("In %s now\n", id);
+ }
}
void
monitor_return (void)
{
#ifdef CALL_STACK
if (current_function_call > &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call--;
return;
}
while ((current_function_call->flags & FC_TAIL_CALL) &&
(current_function_call > fctab))
{
current_function_call--;
}
if (current_function_call > fctab)
current_function_call--;
#endif
}
+const char *
+absolute_addr_name (absolute_address_t addr)
+{
+ static char buf[256], *bufptr;
+ const char *name;
+
+ bufptr = buf;
+
+ bufptr += sprintf (bufptr, "%02X:0x%04X", addr >> 28, addr & 0xFFFFFF);
+
+ name = sym_lookup (&program_symtab, addr);
+ if (name)
+ bufptr += sprintf (bufptr, " <%-16.16s>", name);
+
+ return buf;
+
+}
+
+
const char *
monitor_addr_name (target_addr_t target_addr)
{
static char buf[256], *bufptr;
const char *name;
absolute_address_t addr = to_absolute (target_addr);
bufptr = buf;
bufptr += sprintf (bufptr, "0x%04X", target_addr);
name = sym_lookup (&program_symtab, addr);
if (name)
bufptr += sprintf (bufptr, " <%s>", name);
return buf;
}
static void
monitor_signal (int sigtype)
{
(void) sigtype;
putchar ('\n');
monitor_on = 1;
}
void
monitor_init (void)
{
int tmp;
extern int debug_enabled;
target_addr_t a;
fctab[0].entry_point = read16 (0xfffe);
memset (&fctab[0].entry_regs, 0, sizeof (struct cpu_regs));
current_function_call = &fctab[0];
auto_break_insn_count = 0;
monitor_on = debug_enabled;
signal (SIGINT, monitor_signal);
}
int
check_break (unsigned break_pc)
{
if (auto_break_insn_count > 0)
if (--auto_break_insn_count == 0)
return 1;
return 0;
}
-
-void
-cmd_show (void)
-{
- int cc = get_cc ();
- int pc = get_pc ();
- char inst[50];
- int offset, moffset;
-
- moffset = dasm (inst, pc);
-
- printf ("S $%04X U $%04X X $%04X Y $%04X EFHINZVC\n", get_s (),
- get_u (), get_x (), get_y ());
- printf ("A $%02X B $%02X DP $%02X CC $%02X ", get_a (),
- get_b (), get_dp (), cc);
- printf ("%c%c%c%c", (cc & E_FLAG ? '1' : '.'), (cc & F_FLAG ? '1' : '.'),
- (cc & H_FLAG ? '1' : '.'), (cc & I_FLAG ? '1' : '.'));
- printf ("%c%c%c%c\n", (cc & N_FLAG ? '1' : '.'), (cc & Z_FLAG ? '1' : '.'),
- (cc & V_FLAG ? '1' : '.'), (cc & C_FLAG ? '1' : '.'));
- printf ("PC: %s ", monitor_addr_name (pc));
- printf ("Cycle %lX ", total);
- for (offset = 0; offset < moffset; offset++)
- printf ("%02X", read8 (offset+pc));
- printf (" NextInst: %s\n", inst);
-}
-
-
-void
-monitor_prompt (void)
-{
- char inst[50];
- target_addr_t pc = get_pc ();
- dasm (inst, pc);
-
- printf ("S:%04X U:%04X X:%04X Y:%04X D:%04X\n",
- get_s (), get_u (), get_x (), get_y (), get_d ());
-
- printf ("%30.30s %s\n", monitor_addr_name (pc), inst);
-}
-
-
void
monitor_backtrace (void)
{
struct function_call *fc = current_function_call;
while (fc >= &fctab[0]) {
printf ("%s\n", monitor_addr_name (fc->entry_point));
fc--;
}
}
int
monitor6809 (void)
{
int rc;
signal (SIGINT, monitor_signal);
rc = command_loop ();
monitor_on = 0;
return rc;
}
diff --git a/monitor.h b/monitor.h
index ad36524..a93091c 100644
--- a/monitor.h
+++ b/monitor.h
@@ -1,81 +1,82 @@
#define S_NAMED 0x1
#define S_OFFSET 0x2
#define S_LINE 0x4
#define MAX_BREAKPOINTS 16
#define MAX_FUNCTION_CALLS 512
#define BP_FREE 0x0
#define BP_USED 0x1
#define BP_TEMP 0x2
#define PROMPT_REGS 0x1
#define PROMPT_CYCLES 0x2
#define PROMPT_INSN 0x4
struct cpu_regs {
unsigned X, Y, S, U, PC;
unsigned A, B, DP;
unsigned H, N, Z, OV, C;
unsigned EFI;
#ifdef H6309
unsigned E, F, V, MD;
#endif
};
struct x_symbol {
int flags;
union {
struct named_symbol {
char *id;
char *file;
target_addr_t addr;
} named;
struct line_symbol {
struct named_symbol *name;
int lineno;
} line;
int offset;
} u;
};
struct symbol_table {
struct symbol *addr_to_symbol[0x10000];
char *name_area;
int name_area_free;
char *name_area_next;
};
struct breakpoint {
target_addr_t addr;
int flags;
int count;
};
#define FC_TAIL_CALL 0x1
struct function_call {
target_addr_t entry_point;
struct cpu_regs entry_regs;
int flags;
};
void add_named_symbol (const char *id, target_addr_t value, const char *filename);
struct x_symbol * find_symbol (target_addr_t value);
void monitor_branch (void);
void monitor_call (unsigned int flags);
void monitor_return (void);
const char * monitor_addr_name (target_addr_t addr);
+const char * absolute_addr_name (unsigned long addr);
diff --git a/wpc.c b/wpc.c
index cee19e6..bcfdc2a 100644
--- a/wpc.c
+++ b/wpc.c
@@ -1,587 +1,593 @@
/*
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include <sys/time.h>
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3800
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
U8 opto_mx[8];
int curr_sw;
int curr_sw_time;
+ int wdog_timer;
};
struct wpc_asic *global_wpc;
void wpc_asic_reset (struct hw_device *dev)
{
struct wpc_asic *wpc = dev->priv;
global_wpc = wpc;
wpc->curr_sw_time = 0;
+ wpc->wdog_timer = 0;
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
#if 1
return rc;
#endif
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
rc |= WPC_DEBUG_READ_READY;
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
unsigned int wpc_read_switch (struct wpc_asic *wpc, int num)
{
unsigned int val;
val = wpc->switch_mx[num / 8] & (1 << (num % 8));
// printf ("SW %d = %d\n", num, val);
return val ? 1 : 0;
}
void wpc_write_switch (struct wpc_asic *wpc, int num, int flag)
{
unsigned int col, val;
col = num / 8;
val = 1 << (num % 8);
if (wpc->opto_mx[col] & val)
flag = !flag;
wpc->switch_mx[col] &= ~val;
if (flag)
wpc->switch_mx[col] |= val;
}
void wpc_press_switch (struct wpc_asic *wpc, int num, int delay)
{
wpc_write_switch (wpc, num, 1);
wpc->curr_sw = num;
wpc->curr_sw_time = delay;
}
unsigned int wpc_read_switch_column (struct wpc_asic *wpc, int col)
{
unsigned int val = 0;
int row;
for (row = 0; row < 8; row++)
if (wpc_read_switch (wpc, col * 8 + row))
val |= (1 << row);
return val;
}
void wpc_write_lamp (int num, int flag)
{
}
void wpc_write_sol (int num, int flag)
{
}
void wpc_keypoll (struct wpc_asic *wpc)
{
fd_set fds;
struct timeval timeout;
int rc;
unsigned char c;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
{
rc = read (0, &c, 1);
//printf ("%c pressed\n", c);
switch (c)
{
case '7':
wpc_press_switch (wpc, 4, 200);
break;
case '8':
wpc_press_switch (wpc, 5, 200);
break;
case '9':
wpc_press_switch (wpc, 6, 200);
break;
case '0':
wpc_press_switch (wpc, 7, 200);
break;
default:
break;
}
}
}
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
struct wpc_asic *wpc = dev->priv;
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit / 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
case WPC_SW_ROW_INPUT:
val = wpc_read_switch_column (wpc, 1 + scanbit (wpc->switch_strobe));
break;
case WPC_SW_JUMPER_INPUT:
val = 0x55;
break;
case WPC_SW_CABINET_INPUT:
val = wpc_read_switch_column (wpc, 0);
break;
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (struct wpc_asic *wpc)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_set_rom_page (unsigned char val)
{
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
}
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct wpc_asic *wpc = dev->priv;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
- /* ignore for now */
+ wpc->wdog_timer++;
break;
case WPC_ROM_BANK:
wpc->rombank = val;
wpc_set_rom_page (val);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram (wpc);
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram (wpc);
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
case WPC_SW_COL_STROBE:
wpc->switch_strobe = val;
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
struct wpc_asic *wpc = global_wpc;
- //printf ("WPC 100ms periodic\n");
wpc_keypoll (wpc);
+ wpc->wdog_timer -= 50;
+ if (wpc->wdog_timer <= 0)
+ {
+ }
+
if (wpc->curr_sw_time > 0)
{
wpc->curr_sw_time -= 100;
if (wpc->curr_sw_time <= 0)
{
wpc->curr_sw_time = 0;
wpc_write_switch (wpc, wpc->curr_sw, 0);
}
}
}
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
struct wpc_asic *wpc = calloc (sizeof (struct wpc_asic), 1);
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
void io_sym_add (const char *name, unsigned long cpuaddr)
{
sym_add (&program_symtab, name, to_absolute (cpuaddr), 0);
}
#define IO_SYM_ADD(name) io_sym_add (#name, name)
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
struct wpc_asic *wpc;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
wpc = dev->priv;
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
wpc_update_ram (wpc);
IO_SYM_ADD(WPC_DMD_HIGH_PAGE);
IO_SYM_ADD(WPC_DMD_FIRQ_ROW_VALUE);
IO_SYM_ADD(WPC_DMD_LOW_PAGE);
IO_SYM_ADD(WPC_DMD_ACTIVE_PAGE);
IO_SYM_ADD(WPC_SERIAL_STATUS_PORT);
IO_SYM_ADD(WPC_PARALLEL_DATA_PORT);
IO_SYM_ADD(WPC_PARALLEL_STROBE_PORT);
IO_SYM_ADD(WPC_SERIAL_DATA_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_CONTROL_OUTPUT);
IO_SYM_ADD(WPC_SERIAL_BAUD_SELECT);
IO_SYM_ADD(WPC_TICKET_DISPENSE);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_OUT);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_IN);
IO_SYM_ADD(WPC_DCS_SOUND_RESET);
IO_SYM_ADD(WPC_DCS_SOUND_DATA_READY);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_A);
IO_SYM_ADD(WPC_FLIPTRONIC_PORT_B);
IO_SYM_ADD(WPCS_DATA);
IO_SYM_ADD(WPCS_CONTROL_STATUS);
IO_SYM_ADD(WPC_SOL_FLASH2_OUTPUT);
IO_SYM_ADD(WPC_SOL_HIGHPOWER_OUTPUT);
IO_SYM_ADD(WPC_SOL_FLASH1_OUTPUT);
IO_SYM_ADD(WPC_SOL_LOWPOWER_OUTPUT);
IO_SYM_ADD(WPC_LAMP_ROW_OUTPUT);
IO_SYM_ADD(WPC_LAMP_COL_STROBE);
IO_SYM_ADD(WPC_GI_TRIAC);
IO_SYM_ADD(WPC_SW_JUMPER_INPUT);
IO_SYM_ADD(WPC_SW_CABINET_INPUT);
IO_SYM_ADD(WPC_SW_ROW_INPUT);
IO_SYM_ADD(WPC_SW_COL_STROBE);
IO_SYM_ADD(WPC_LEDS);
IO_SYM_ADD(WPC_RAM_BANK);
IO_SYM_ADD(WPC_SHIFTADDR);
IO_SYM_ADD(WPC_SHIFTBIT);
IO_SYM_ADD(WPC_SHIFTBIT2);
IO_SYM_ADD(WPC_PERIPHERAL_TIMER_FIRQ_CLEAR);
IO_SYM_ADD(WPC_ROM_LOCK);
IO_SYM_ADD(WPC_CLK_HOURS_DAYS);
IO_SYM_ADD(WPC_CLK_MINS);
IO_SYM_ADD(WPC_ROM_BANK);
IO_SYM_ADD(WPC_RAM_LOCK);
IO_SYM_ADD(WPC_RAM_LOCKSIZE);
}
struct machine wpc_machine =
{
.name = "wpc",
.fault = wpc_fault,
.init = wpc_init,
};
|
bcd/exec09
|
828cc48f9b7a42d5fba34b23d776bec6336a0063
|
Further improvements:
|
diff --git a/6809.c b/6809.c
old mode 100755
new mode 100644
diff --git a/6809.h b/6809.h
old mode 100755
new mode 100644
index c656271..f4c3cdc
--- a/6809.h
+++ b/6809.h
@@ -1,226 +1,241 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_H
#define M6809_H
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#else
#error
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
#error
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#else
#error
#endif
typedef uint8_t UINT8;
typedef signed char INT8;
typedef uint16_t UINT16;
typedef signed short INT16;
typedef uint32_t UINT32;
typedef signed int INT32;
typedef uint16_t target_addr_t;
#include "machine.h"
#define E_FLAG 0x80
#define F_FLAG 0x40
#define H_FLAG 0x20
#define I_FLAG 0x10
#define N_FLAG 0x08
#define Z_FLAG 0x04
#define V_FLAG 0x02
#define C_FLAG 0x01
extern int debug_enabled;
extern int need_flush;
extern unsigned long total;
extern int dump_cycles_on_success;
#ifdef OLDSYS
extern UINT8 *memory;
#endif
/* Primitive read/write macros */
#define read8(addr) cpu_read8 (addr)
#define write8(addr,val) do { cpu_write8 (addr, val); } while (0)
/* 16-bit versions */
#define read16(addr) (read8(addr) << 8 | read8(addr+1))
#define write16(addr,val) do { write8(addr, val & 0xFF); write8(addr+1, (val >> 8) & 0xFF) } while (0)
/* Fetch macros */
#define abs_read16(addr) ((abs_read8(addr) << 8) | abs_read8(addr+1))
#define fetch8() abs_read8 (pc++)
#define fetch16() (pc += 2, abs_read16(pc-2))
/* 6809.c */
extern int cpu_quit;
extern int cpu_execute (int);
extern void cpu_reset (void);
extern unsigned get_a (void);
extern unsigned get_b (void);
extern unsigned get_cc (void);
extern unsigned get_dp (void);
extern unsigned get_x (void);
extern unsigned get_y (void);
extern unsigned get_s (void);
extern unsigned get_u (void);
extern unsigned get_pc (void);
extern unsigned get_d (void);
extern void set_a (unsigned);
extern void set_b (unsigned);
extern void set_cc (unsigned);
extern void set_dp (unsigned);
extern void set_x (unsigned);
extern void set_y (unsigned);
extern void set_s (unsigned);
extern void set_u (unsigned);
extern void set_pc (unsigned);
extern void set_d (unsigned);
+/* fileio.c */
+
+struct pathlist
+{
+ int count;
+ char *entry[32];
+};
+
+
+void path_init (struct pathlist *path);
+void path_add (struct pathlist *path, const char *dir);
+FILE * file_open (struct pathlist *path, const char *filename, const char *mode);
+FILE * file_require_open (struct pathlist *path, const char *filename, const char *mode);
+void file_close (FILE *fp);
+
/* monitor.c */
extern int monitor_on;
extern int check_break (unsigned);
extern void monitor_init (void);
extern int monitor6809 (void);
extern int dasm (char *, absolute_address_t);
extern int load_hex (char *);
extern int load_s19 (char *);
extern int load_bin (char *,int);
#define MAX_STRINGSPACE 32000
#define MAX_SYMBOL_HASH 1009
#define SYM_DEFAULT 0
#define SYM_AUTO 1
typedef struct
{
unsigned char format;
unsigned int size;
} datatype_t;
/* symtab.c */
struct stringspace
{
char space[32000];
unsigned int used;
};
struct symbol
{
char *name;
unsigned long value;
datatype_t ty;
unsigned int type;
struct symbol *name_chain;
struct symbol *value_chain;
};
struct symtab
{
struct symbol *syms_by_name[MAX_SYMBOL_HASH];
struct symbol *syms_by_value[MAX_SYMBOL_HASH];
struct symtab *parent;
};
extern struct symtab program_symtab;
extern struct symtab internal_symtab;
extern struct symtab auto_symtab;
void sym_add (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
void sym_set (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
int sym_find (struct symtab *symtab, const char *name, unsigned long *value, unsigned int type);
const char *sym_lookup (struct symtab *symtab, unsigned long value);
typedef void (*command_handler_t) (void);
typedef void (*virtual_handler_t) (unsigned long *val, int writep);
typedef unsigned int thread_id_t;
typedef struct
{
unsigned int id : 8;
unsigned int used : 1;
unsigned int enabled : 1;
unsigned int conditional : 1;
unsigned int threaded : 1;
unsigned int on_read : 1;
unsigned int on_write : 1;
unsigned int on_execute : 1;
unsigned int size : 4;
unsigned int keep_running : 1;
unsigned int temp : 1;
absolute_address_t addr;
char condition[128];
thread_id_t tid;
unsigned int pass_count;
unsigned int ignore_count;
} breakpoint_t;
typedef struct
{
int used : 1;
datatype_t type;
char expr[128];
} display_t;
typedef struct
{
int id : 8;
thread_id_t tid;
} thread_t;
#define MAX_BREAKS 32
#define MAX_DISPLAYS 32
#define MAX_HISTORY 10
#define MAX_THREADS 64
void command_irq_hook (unsigned long cycles);
#endif /* M6809_H */
diff --git a/command.c b/command.c
old mode 100755
new mode 100644
index ca58ebb..932be4d
--- a/command.c
+++ b/command.c
@@ -1,1294 +1,1345 @@
#include "6809.h"
#include "monitor.h"
#include "machine.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
-#if 0
-#include <sys/time.h>
-#endif
#include <sys/errno.h>
#include <termios.h>
-#define PERIODIC_INTERVAL 50 /* in ms */
+typedef struct
+{
+ unsigned int size;
+ unsigned int count;
+ char **strings;
+} cmdqueue_t;
+
/**********************************************************/
/********************* Global Data ************************/
/**********************************************************/
unsigned int break_count = 0;
breakpoint_t breaktab[MAX_BREAKS];
unsigned int active_break_count = 0;
unsigned int display_count = 0;
display_t displaytab[MAX_DISPLAYS];
unsigned int history_count = 0;
unsigned long historytab[MAX_HISTORY];
absolute_address_t examine_addr = 0;
unsigned int examine_repeat = 1;
datatype_t examine_type;
unsigned int thread_id_size = 2;
absolute_address_t thread_current;
absolute_address_t thread_id = 0;
thread_t threadtab[MAX_THREADS];
+#define MAX_CMD_QUEUES 8
+int command_stack_depth = -1;
+cmdqueue_t command_stack[MAX_CMD_QUEUES];
+
datatype_t print_type;
char *command_flags;
int exit_command_loop;
unsigned long eval (char *expr);
extern int auto_break_insn_count;
/**********************************************************/
/******************** 6809 Functions **********************/
/**********************************************************/
void
print_addr (absolute_address_t addr)
{
const char *name;
print_device_name (addr >> 28);
putchar (':');
printf ("0x%04X", addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
printf (" <%-16.16s>", name);
else
printf ("%-20.20s", "");
}
unsigned long
compute_inirq (void)
{
}
unsigned long
compute_infirq (void)
{
}
/**********************************************************/
/*********************** Functions ************************/
/**********************************************************/
void
syntax_error (const char *string)
{
fprintf (stderr, "error: %s\n", string);
}
void
save_value (unsigned long val)
{
historytab[history_count++ % MAX_HISTORY] = val;
}
unsigned long
eval_historical (unsigned int id)
{
return historytab[id % MAX_HISTORY];
}
void
assign_virtual (const char *name, unsigned long val)
{
unsigned long v_val;
if (!sym_find (&auto_symtab, name, &v_val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)v_val;
virtual (&val, 1);
return;
}
sym_set (&internal_symtab, name, val, 0);
if (!strcmp (name, "thread_current"))
{
printf ("Thread pointer initialized to ");
print_addr (val);
putchar ('\n');
thread_current = val;
}
}
unsigned long
eval_virtual (const char *name)
{
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
if (!sym_find (&auto_symtab, name, &val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)val;
virtual (&val, 0);
}
else if (!sym_find (&internal_symtab, name, &val, 0))
{
}
else
{
syntax_error ("???");
return 0;
}
return val;
}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
case 'o':
case 'a':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
char *
match_binary (char *expr, const char *op, char **secondp)
{
char *p;
p = strstr (expr, op);
if (!p)
return NULL;
*p = '\0';
p += strlen (op);
*secondp = p;
return expr;
}
int
fold_comparisons (char *expr, unsigned long *value)
{
char *p;
if (match_binary (expr, "==", &p))
*value = (eval (expr) == eval (p));
else if (match_binary (expr, "!=", &p))
*value = (eval (expr) != eval (p));
else
return 0;
return 1;
}
int
fold_binary (char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
eval_mem (char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
/* TODO - if expr is already in absolute form,
this explodes ! */
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
eval (char *expr)
{
char *p;
unsigned long val;
if (fold_comparisons (expr, &val));
else if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
unsigned int size = 1;
expr++;
if (*expr == '*')
{
expr++;
size = 2;
}
absolute_address_t addr = eval_mem (expr);
return target_read (addr, size);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
br->keep_running = 0;
br->ignore_count = 0;
br->temp = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
+void
+brkfree_temps (void)
+{
+}
+
+
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
if (brkpt->keep_running)
printf (", print-only");
if (brkpt->temp)
printf (", temp");
putchar ('\n');
}
display_t *
display_alloc (void)
{
unsigned int n;
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (!ds->used)
{
ds->used = 1;
return ds;
}
}
}
void
display_free (display_t *ds)
{
}
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
switch (typep->format)
{
case 'a':
print_addr (val);
return;
}
if (typep->format == 'x')
{
printf ("0x");
sprintf (f, "%%0%d%c", typep->size * 2, typep->format);
}
else if (typep->format == 'o')
{
printf ("0");
sprintf (f, "%%%c", typep->format);
}
else
sprintf (f, "%%%c", typep->format);
printf (f, val);
}
void
display_print (void)
{
unsigned int n;
char comma = '\0';
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (ds->used)
{
char expr[256];
strcpy (expr, ds->expr);
printf ("%c %s = ", comma, expr);
print_value (eval (expr), &ds->type);
comma = ',';
}
}
if (comma)
putchar ('\n');
}
int
print_insn (absolute_address_t addr)
{
char buf[64];
int size = dasm (buf, addr);
printf ("%s", buf);
return size;
}
void
do_examine (void)
{
unsigned int n;
unsigned int objs_per_line = 16;
if (isdigit (*command_flags))
examine_repeat = strtoul (command_flags, &command_flags, 0);
if (*command_flags == 's' || *command_flags == 'i')
examine_type.format = *command_flags;
else
parse_format_flag (command_flags, &examine_type.format);
parse_size_flag (command_flags, &examine_type.size);
switch (examine_type.format)
{
case 'i':
objs_per_line = 1;
break;
case 'w':
objs_per_line = 8;
break;
}
for (n = 0; n < examine_repeat; n++)
{
if ((n % objs_per_line) == 0)
{
putchar ('\n');
print_addr (examine_addr);
printf (": ");
}
switch (examine_type.format)
{
case 's': /* string */
break;
case 'i': /* instruction */
examine_addr += print_insn (examine_addr);
break;
default:
print_value (target_read (examine_addr, examine_type.size),
&examine_type);
putchar (' ');
examine_addr += examine_type.size;
}
}
putchar ('\n');
}
void
do_print (char *expr)
{
unsigned long val = eval (expr);
printf ("$%d = ", history_count);
parse_format_flag (command_flags, &print_type.format);
parse_size_flag (command_flags, &print_type.size);
print_value (val, &print_type);
putchar ('\n');
save_value (val);
}
void
do_set (char *expr)
{
unsigned long val = eval (expr);
save_value (val);
}
#define THREAD_DATA_PC 3
#define THREAD_DATA_ROMBANK 9
void
print_thread_data (absolute_address_t th)
{
U8 b;
U16 w;
absolute_address_t pc;
w = abs_read16 (th + THREAD_DATA_PC);
b = abs_read8 (th + THREAD_DATA_ROMBANK);
printf ("{ PC = %04X, BANK = %02X }", w, b);
}
void
command_change_thread (void)
{
target_addr_t addr = target_read (thread_current, thread_id_size);
absolute_address_t th = to_absolute (addr);
if (th == thread_id)
return;
thread_id = th;
- if (addr)
+
+ if (machine->dump_thread && eval ("$thread_debug"))
{
- printf ("[Current thread = ");
- print_addr (thread_id);
- print_thread_data (thread_id);
- printf ("]\n");
+ if (addr)
+ {
+ printf ("[Current thread = ");
+ print_addr (thread_id);
+ machine->dump_thread (thread_id);
+ print_thread_data (thread_id);
+ printf ("]\n");
+ }
+ else
+ {
+ printf ("[ No thread ]\n");
+ }
}
- else
- printf ("[ No thread ]\n");
+}
+
+
+void
+command_stack_push (unsigned int reason)
+{
+ cmdqueue_t *q = &command_stack[++command_stack_depth];
+}
+
+
+void
+command_stack_pop (void)
+{
+ cmdqueue_t *q = &command_stack[command_stack_depth];
+ --command_stack_depth;
+}
+
+
+void
+command_stack_add (const char *cmd)
+{
+ cmdqueue_t *q = &command_stack[command_stack_depth];
}
char *
getarg (void)
{
return strtok (NULL, " \t\n");
}
/****************** Command Handlers ************************/
void cmd_print (void)
{
char *arg = getarg ();
if (arg)
do_print (arg);
else
do_print ("$");
}
void cmd_set (void)
{
char *arg = getarg ();
if (arg)
do_set (arg);
else
do_set ("$");
}
void cmd_examine (void)
{
char *arg = getarg ();
if (arg)
examine_addr = eval_mem (arg);
do_examine ();
}
void cmd_break (void)
{
char *arg = getarg ();
if (!arg)
return;
unsigned long val = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = val;
br->on_execute = 1;
if ((arg = getarg()) && !strcmp (arg, "if"))
{
br->conditional = 1;
arg = getarg ();
strcpy (br->condition, arg);
}
brkprint (br);
}
void cmd_watch1 (int on_read, int on_write)
{
char *arg;
arg = getarg ();
if (!arg)
return;
absolute_address_t addr = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = addr;
br->on_read = on_read;
br->on_write = on_write;
arg = getarg ();
if (!arg)
return;
if (!strcmp (arg, "print"))
br->keep_running = 1;
else if (!strcmp (arg, "if"))
{
arg = getarg ();
br->conditional = 1;
strcpy (br->condition, arg);
}
brkprint (br);
}
void cmd_watch (void)
{
cmd_watch1 (0, 1);
}
void cmd_rwatch (void)
{
cmd_watch1 (1, 0);
}
void cmd_awatch (void)
{
cmd_watch1 (1, 1);
}
void cmd_break_list (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
brkprint (&breaktab[n]);
}
void cmd_step (void)
{
auto_break_insn_count = 1;
exit_command_loop = 0;
}
void cmd_next (void)
{
char buf[128];
breakpoint_t *br;
unsigned long addr = to_absolute (get_pc ());
addr += dasm (buf, addr);
- printf ("Will stop at ");
- print_addr (addr);
- putchar ('\n');
br = brkalloc ();
br->addr = addr;
br->on_execute = 1;
br->temp = 1;
+
+ /* TODO - for conditional branches, should also set a
+ temp breakpoint at the branch target */
+
exit_command_loop = 0;
}
void cmd_continue (void)
{
exit_command_loop = 0;
}
void cmd_quit (void)
{
cpu_quit = 0;
exit_command_loop = 1;
}
void cmd_delete (void)
{
const char *arg = getarg ();
unsigned int id;
if (!arg)
{
int n;
printf ("Deleting all breakpoints.\n");
for (id = 0; id < MAX_BREAKS; id++)
{
breakpoint_t *br = brkfind_by_id (id);
brkfree (br);
}
return;
}
id = atoi (arg);
breakpoint_t *br = brkfind_by_id (id);
if (br->used)
{
printf ("Deleting breakpoint %d\n", id);
brkfree (br);
}
}
void cmd_list (void)
{
char *arg;
static absolute_address_t lastpc = 0;
static absolute_address_t lastaddr = 0;
absolute_address_t addr;
int n;
arg = getarg ();
if (arg)
addr = eval_mem (arg);
else
{
addr = to_absolute (get_pc ());
if (addr == lastpc)
addr = lastaddr;
else
lastaddr = lastpc = addr;
}
for (n = 0; n < 10; n++)
{
print_addr (addr);
printf (" : ");
addr += print_insn (addr);
putchar ('\n');
}
lastaddr = addr;
}
void cmd_symbol_file (void)
{
char *arg = getarg ();
if (arg)
load_map_file (arg);
}
void cmd_display (void)
{
char *arg;
while ((arg = getarg ()) != NULL)
{
display_t *ds = display_alloc ();
strcpy (ds->expr, arg);
ds->type = print_type;
parse_format_flag (command_flags, &ds->type.format);
parse_size_flag (command_flags, &ds->type.size);
}
}
-void command_exec_file (const char *filename)
+int command_exec_file (const char *filename)
{
FILE *infile;
extern int command_exec (FILE *);
- infile = fopen (filename, "r");
+ infile = file_open (NULL, filename, "r");
if (!infile)
- {
- fprintf (stderr, "can't open %s\n", filename);
- return;
- }
+ return 0;
while (command_exec (infile) >= 0);
fclose (infile);
+ return 1;
}
void cmd_source (void)
{
char *arg = getarg ();
if (!arg)
return;
- command_exec_file (arg);
+
+ if (command_exec_file (arg) == 0)
+ fprintf (stderr, "can't open %s\n", arg);
}
void cmd_regs (void)
{
}
+void cmd_vars (void)
+{
+ for_each_var (NULL);
+}
+
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
{ "s", "step", cmd_step,
"Step one instruction" },
{ "n", "next", cmd_next,
"Break at the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
{ "wa", "watch", cmd_watch,
"Add a watchpoint on write" },
{ "rwa", "rwatch", cmd_rwatch,
"Add a watchpoint on read" },
{ "awa", "awatch", cmd_awatch,
"Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
{ "l", "list", cmd_list },
{ "sym", "symbol-file", cmd_symbol_file,
"Open a symbol table file" },
{ "di", "display", cmd_display,
"Add a display expression" },
{ "so", "source", cmd_source,
"Run a command script" },
{ "regs", "regs", cmd_regs,
"Show all CPU registers" },
+ { "vars", "vars", cmd_vars,
+ "Show all program variables" },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
{ "f", "file", cmd_file,
"Choose the program to be debugged" },
{ "exe", "exec-file", cmd_exec_file,
"Open an executable" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
/* TODO - look for a match anywhere between
* the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
void
print_current_insn (void)
{
absolute_address_t addr = to_absolute (get_pc ());
print_addr (addr);
printf (" : ");
print_insn (addr);
putchar ('\n');
}
int
command_exec (FILE *infile)
{
char buffer[256];
static char prev_buffer[256];
char *cmd;
command_handler_t handler;
int rc;
do {
errno = 0;
fgets (buffer, 255, infile);
if (feof (infile))
return -1;
} while (errno != 0);
/* In terminal mode, a blank line means to execute
the previous command. */
if (buffer[0] == '\n')
strcpy (buffer, prev_buffer);
/* Skip comments */
if (*buffer == '#')
return 0;
cmd = strtok (buffer, " \t\n");
if (!cmd)
return 0;
strcpy (prev_buffer, cmd);
handler = command_lookup (cmd);
if (!handler)
{
syntax_error ("no such command");
return 0;
}
(*handler) ();
return 0;
}
void
keybuffering (int flag)
{
struct termios tio;
tcgetattr (0, &tio);
if (!flag) /* 0 = no buffering = not default */
tio.c_lflag &= ~ICANON;
else /* 1 = buffering = default */
tio.c_lflag |= ICANON;
tcsetattr (0, TCSANOW, &tio);
}
int
command_loop (void)
{
keybuffering (1);
+ brkfree_temps ();
display_print ();
print_current_insn ();
exit_command_loop = -1;
while (exit_command_loop < 0)
{
command_prompt ();
if (command_exec (stdin) < 0)
break;
}
if (exit_command_loop == 0)
keybuffering (0);
return (exit_command_loop);
}
void
breakpoint_hit (breakpoint_t *br)
{
if (br->threaded && (thread_id != br->tid))
return;
if (br->conditional)
{
if (eval (br->condition) == 0)
return;
}
if (br->ignore_count)
{
--br->ignore_count;
return;
}
monitor_on = !br->keep_running;
}
void
command_insn_hook (void)
{
absolute_address_t abspc;
breakpoint_t *br;
if (active_break_count == 0)
return;
abspc = to_absolute (get_pc ());
br = brkfind_by_addr (abspc);
if (br && br->enabled && br->on_execute)
{
breakpoint_hit (br);
if (monitor_on == 0)
return;
if (br->temp)
brkfree (br);
else
printf ("Breakpoint %d reached.\n", br->id);
}
}
void
command_read_hook (absolute_address_t addr)
{
breakpoint_t *br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_read)
{
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf ("]\n");
breakpoint_hit (br);
}
}
void
command_write_hook (absolute_address_t addr, U8 val)
{
breakpoint_t *br;
br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_write)
{
breakpoint_hit (br);
if (monitor_on == 0)
return;
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf (" = 0x%02X", val);
printf ("]\n");
}
if (thread_id_size && (addr == thread_current + thread_id_size - 1))
{
command_change_thread ();
}
}
void pc_virtual (unsigned long *val, int writep) {
writep ? set_pc (*val) : (*val = get_pc ());
}
void x_virtual (unsigned long *val, int writep) {
writep ? set_x (*val) : (*val = get_x ());
}
void y_virtual (unsigned long *val, int writep) {
writep ? set_y (*val) : (*val = get_y ());
}
void u_virtual (unsigned long *val, int writep) {
writep ? set_u (*val) : (*val = get_u ());
}
void s_virtual (unsigned long *val, int writep) {
writep ? set_s (*val) : (*val = get_s ());
}
void d_virtual (unsigned long *val, int writep) {
writep ? set_d (*val) : (*val = get_d ());
}
void a_virtual (unsigned long *val, int writep) {
writep ? set_a (*val) : (*val = get_a ());
}
void b_virtual (unsigned long *val, int writep) {
writep ? set_b (*val) : (*val = get_b ());
}
void dp_virtual (unsigned long *val, int writep) {
writep ? set_dp (*val) : (*val = get_dp ());
}
void cc_virtual (unsigned long *val, int writep) {
writep ? set_cc (*val) : (*val = get_cc ());
}
void cycles_virtual (unsigned long *val, int writep)
{
if (!writep)
*val = get_cycles ();
}
void
command_periodic (int signo)
{
}
void
command_irq_hook (unsigned long cycles)
{
//printf ("IRQ took %lu cycles\n", cycles);
}
void
command_init (void)
{
//struct itimerval itimer;
struct sigaction sact;
int rc;
sym_add (&auto_symtab, "pc", (unsigned long)pc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "x", (unsigned long)x_virtual, SYM_AUTO);
sym_add (&auto_symtab, "y", (unsigned long)y_virtual, SYM_AUTO);
sym_add (&auto_symtab, "u", (unsigned long)u_virtual, SYM_AUTO);
sym_add (&auto_symtab, "s", (unsigned long)s_virtual, SYM_AUTO);
sym_add (&auto_symtab, "d", (unsigned long)d_virtual, SYM_AUTO);
sym_add (&auto_symtab, "a", (unsigned long)a_virtual, SYM_AUTO);
sym_add (&auto_symtab, "b", (unsigned long)b_virtual, SYM_AUTO);
sym_add (&auto_symtab, "dp", (unsigned long)dp_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cc", (unsigned long)cc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cycles", (unsigned long)cycles_virtual, SYM_AUTO);
examine_type.format = 'x';
examine_type.size = 1;
print_type.format = 'x';
print_type.size = 1;
#if 0
sigemptyset (&sact.sa_mask);
sact.sa_flags = 0;
sact.sa_handler = command_periodic;
sigaction (SIGALRM, &sact, NULL);
itimer.it_interval.tv_sec = 0;
itimer.it_interval.tv_usec = PERIODIC_INTERVAL * 1000;
itimer.it_value.tv_sec = 0;
itimer.it_value.tv_usec = PERIODIC_INTERVAL * 1000;
rc = setitimer (ITIMER_REAL, &itimer, NULL);
if (rc < 0)
fprintf (stderr, "couldn't register interval timer\n");
#endif
- command_exec_file (".dbinit");
+ (void)command_exec_file (".dbinit");
}
/* vim: set ts=3: */
/* vim: set expandtab: */
diff --git a/eon.c b/eon.c
index 884a126..08c5168 100644
--- a/eon.c
+++ b/eon.c
@@ -1,71 +1,79 @@
#include "machine.h"
#include "eon.h"
extern int system_running;
void eon_fault (unsigned int addr, unsigned char type)
{
if (system_running)
{
sim_error (">>> Page fault: addr=%04X type=%02X PC=%04X\n", addr, type, get_pc ());
#if 0
fault_addr = addr;
fault_type = type;
irq ();
#endif
}
}
-struct machine eon_machine =
-{
- .fault = eon_fault,
-};
-
/**
* Initialize the EON machine.
*/
void eon_init (const char *boot_rom_file)
{
struct hw_device *dev;
- machine = &eon_machine;
-
/* The MMU must be defined first, as all other devices
that are attached can try to hook into the MMU. */
device_define ( mmu_create (), 0,
MMU_ADDR, BUS_MAP_SIZE, MAP_READWRITE+MAP_FIXED );
/* A 1MB RAM part is mapped into all of the allowable 64KB
address space, until overriden by other devices. */
device_define ( ram_create (RAM_SIZE), 0,
0x0000, MAX_CPU_ADDR, MAP_READWRITE );
device_define ( rom_create (boot_rom_file, BOOT_ROM_SIZE), 0,
BOOT_ROM_ADDR, BOOT_ROM_SIZE, MAP_READONLY );
device_define ( dev = console_create (), 0,
CONSOLE_ADDR, BUS_MAP_SIZE, MAP_READWRITE );
device_define (dev, 0,
0xFF00, BUS_MAP_SIZE, MAP_READWRITE );
device_define ( disk_create ("disk.bin"), 0,
DISK_ADDR(0), BUS_MAP_SIZE, MAP_READWRITE);
}
/**
* Initialize the simple machine, which is the default
* machine that has no bells or whistles.
*/
void simple_init (const char *boot_rom_file)
{
- machine = &eon_machine;
device_define ( ram_create (MAX_CPU_ADDR), 0,
0x0000, MAX_CPU_ADDR, MAP_READWRITE );
device_define ( console_create (), 0,
0xFF00, BUS_MAP_SIZE, MAP_READWRITE );
}
+
+struct machine eon_machine =
+{
+ .name = "eon",
+ .fault = eon_fault,
+ .init = eon_init,
+};
+
+struct machine simple_machine =
+{
+ .name = "simple",
+ .fault = eon_fault,
+ .init = simple_init,
+};
+
+
diff --git a/fileio.c b/fileio.c
index a0fd2c7..2aef61e 100644
--- a/fileio.c
+++ b/fileio.c
@@ -1,58 +1,62 @@
#include <stdio.h>
-
-struct pathlist
-{
- int count;
- char *entry[32];
-};
-
+#include "6809.h"
void
path_init (struct pathlist *path)
{
path->count = 0;
}
void
path_add (struct pathlist *path, const char *dir)
{
char *dir2;
dir2 = path->entry[path->count++] = malloc (strlen (dir) + 1);
strcpy (dir2, dir);
}
FILE *
file_open (struct pathlist *path, const char *filename, const char *mode)
{
FILE *fp;
char fqname[128];
int count;
const char dirsep = '/';
fp = fopen (filename, mode);
if (fp)
return fp;
- if (!path || strchr (filename, dirsep))
+ if (!path || strchr (filename, dirsep) || *mode == 'w')
return NULL;
for (count = 0; count < path->count; count++)
{
sprintf (fqname, "%s%c%s", path->entry[count], dirsep, filename);
fp = fopen (fqname, mode);
if (fp)
return fp;
}
return NULL;
}
+FILE *
+file_require_open (struct pathlist *path, const char *filename, const char *mode)
+{
+ FILE *fp = file_open (path, filename, mode);
+ if (!fp)
+ fprintf (stderr, "error: could not open '%s'\n", filename);
+ return fp;
+}
+
+
void
file_close (FILE *fp)
{
fclose (fp);
}
diff --git a/machine.c b/machine.c
old mode 100755
new mode 100644
index c341f94..ff850e3
--- a/machine.c
+++ b/machine.c
@@ -1,625 +1,637 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "machine.h"
#include "eon.h"
#define CONFIG_LEGACY
#define MISSING 0xff
#define mmu_device (device_table[0])
extern void eon_init (const char *);
extern void wpc_init (const char *);
struct machine *machine;
unsigned int device_count = 0;
struct hw_device *device_table[MAX_BUS_DEVICES];
struct bus_map busmaps[NUM_BUS_MAPS];
struct bus_map default_busmaps[NUM_BUS_MAPS];
U16 fault_addr;
U8 fault_type;
int system_running = 0;
void cpu_is_running (void)
{
system_running = 1;
}
/**
* Attach a new device to the bus. Only called during init.
*/
struct hw_device *device_attach (struct hw_class *class_ptr, unsigned int size, void *priv)
{
struct hw_device *dev = malloc (sizeof (struct hw_device));
dev->class_ptr = class_ptr;
dev->devid = device_count;
dev->size = size;
dev->priv = priv;
device_table[device_count++] = dev;
/* Attach implies reset */
class_ptr->reset (dev);
return dev;
};
/**
* Map a portion of a device into the CPU's address space.
*/
void bus_map (unsigned int addr,
unsigned int devid,
unsigned long offset,
unsigned int len,
unsigned int flags)
{
struct bus_map *map;
unsigned int start, count;
/* Warn if trying to map too much */
if (addr + len > MAX_CPU_ADDR)
{
fprintf (stderr, "warning: mapping %04X bytes into %04X causes overflow\n",
len, addr);
}
/* Round address and length to be multiples of the map unit size. */
addr = ((addr + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
len = ((len + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
offset = ((offset + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
/* Convert from byte addresses to unit counts */
start = addr / BUS_MAP_SIZE;
count = len / BUS_MAP_SIZE;
/* Initialize the maps. This will let the CPU access the device. */
map = &busmaps[start];
while (count > 0)
{
if (!(map->flags & MAP_FIXED))
{
map->devid = devid;
map->offset = offset;
map->flags = flags;
}
count--;
map++;
offset += BUS_MAP_SIZE;
}
}
void device_define (struct hw_device *dev,
unsigned long offset,
unsigned int addr,
unsigned int len,
unsigned int flags)
{
bus_map (addr, dev->devid, offset, len, flags);
}
void bus_unmap (unsigned int addr, unsigned int len)
{
struct bus_map *map;
unsigned int start, count;
/* Round address and length to be multiples of the map unit size. */
addr = ((addr + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
len = ((len + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
/* Convert from byte addresses to unit counts */
start = addr / BUS_MAP_SIZE;
count = len / BUS_MAP_SIZE;
/* Set the maps to their defaults. */
memcpy (&busmaps[start], &default_busmaps[start],
sizeof (struct bus_map) * count);
}
/**
* Generate a page fault. ADDR says which address was accessed
* incorrectly. TYPE says what kind of violation occurred.
*/
static struct bus_map *find_map (unsigned int addr)
{
return &busmaps[addr / BUS_MAP_SIZE];
}
static struct hw_device *find_device (unsigned int addr, unsigned char id)
{
/* Fault if any invalid device is accessed */
if ((id == INVALID_DEVID) || (id >= device_count))
machine->fault (addr, FAULT_NO_RESPONSE);
return device_table[id];
}
void
print_device_name (unsigned int devno)
{
struct hw_device *dev = device_table[devno];
printf ("%02X", devno);
}
absolute_address_t
absolute_from_reladdr (unsigned int device, unsigned long reladdr)
{
return (device * 0x10000000L) + reladdr;
}
U8 abs_read8 (absolute_address_t addr)
{
unsigned int id = addr >> 28;
unsigned long phy_addr = addr & 0xFFFFFFF;
struct hw_device *dev = device_table[id];
struct hw_class *class_ptr = dev->class_ptr;
return (*class_ptr->read) (dev, phy_addr);
}
/**
* Called by the CPU to read a byte.
*/
U8 cpu_read8 (unsigned int addr)
{
struct bus_map *map = find_map (addr);
struct hw_device *dev = find_device (addr, map->devid);
struct hw_class *class_ptr = dev->class_ptr;
unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE;
command_read_hook (absolute_from_reladdr (map->devid, phy_addr));
return (*class_ptr->read) (dev, phy_addr);
}
/**
* Called by the CPU to write a byte.
*/
void cpu_write8 (unsigned int addr, U8 val)
{
struct bus_map *map = find_map (addr);
struct hw_device *dev = find_device (addr, map->devid);
struct hw_class *class_ptr = dev->class_ptr;
unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE;
/* This can fail if the area is read-only */
if (system_running && (map->flags & MAP_READONLY))
machine->fault (addr, FAULT_NOT_WRITABLE);
else
(*class_ptr->write) (dev, phy_addr, val);
command_write_hook (absolute_from_reladdr (map->devid, phy_addr), val);
}
absolute_address_t
to_absolute (unsigned long cpuaddr)
{
struct bus_map *map = find_map (cpuaddr);
struct hw_device *dev = find_device (cpuaddr, map->devid);
unsigned long phy_addr = map->offset + cpuaddr % BUS_MAP_SIZE;
return absolute_from_reladdr (map->devid, phy_addr);
}
void dump_machine (void)
{
unsigned int mapno;
unsigned int n;
for (mapno = 0; mapno < NUM_BUS_MAPS; mapno++)
{
struct bus_map *map = &busmaps[mapno];
printf ("Map %d addr=%04X dev=%d offset=%04X size=%06X\n",
mapno, mapno * BUS_MAP_SIZE, map->devid, map->offset,
0 /* device_table[map->devid]->size */);
#if 0
for (n = 0; n < BUS_MAP_SIZE; n++)
printf ("%02X ", cpu_read8 (mapno * BUS_MAP_SIZE + n));
printf ("\n");
#endif
}
}
/**********************************************************/
void null_reset (struct hw_device *dev)
{
}
U8 null_read (struct hw_device *dev, unsigned long addr)
{
return 0;
}
void null_write (struct hw_device *dev, unsigned long addr, U8 val)
{
}
/**********************************************************/
void ram_reset (struct hw_device *dev)
{
memset (dev->priv, 0, dev->size);
}
U8 ram_read (struct hw_device *dev, unsigned long addr)
{
char *buf = dev->priv;
return buf[addr];
}
void ram_write (struct hw_device *dev, unsigned long addr, U8 val)
{
char *buf = dev->priv;
buf[addr] = val;
}
struct hw_class ram_class =
{
.readonly = 0,
.reset = ram_reset,
.read = ram_read,
.write = ram_write,
};
struct hw_device *ram_create (unsigned long size)
{
void *buf = malloc (size);
return device_attach (&ram_class, size, buf);
}
/**********************************************************/
struct hw_class rom_class =
{
.readonly = 1,
.reset = null_reset,
.read = ram_read,
.write = ram_write,
};
struct hw_device *rom_create (const char *filename, unsigned int maxsize)
{
FILE *fp;
struct hw_device *dev;
unsigned int image_size;
char *buf;
if (filename)
{
- fp = fopen (filename, "rb");
+ fp = file_open (NULL, filename, "rb");
if (!fp)
return NULL;
image_size = sizeof_file (fp);
}
buf = malloc (maxsize);
dev = device_attach (&rom_class, maxsize, buf);
if (filename)
{
fread (buf, image_size, 1, fp);
fclose (fp);
maxsize -= image_size;
while (maxsize > 0)
{
memcpy (buf + image_size, buf, image_size);
buf += image_size;
maxsize -= image_size;
}
}
return dev;
}
/**********************************************************/
U8 console_read (struct hw_device *dev, unsigned long addr)
{
switch (addr)
{
case CON_IN:
return getchar ();
default:
return MISSING;
}
}
void console_write (struct hw_device *dev, unsigned long addr, U8 val)
{
switch (addr)
{
case CON_OUT:
putchar (val);
break;
case CON_EXIT:
sim_exit (val);
break;
default:
break;
}
}
struct hw_class console_class =
{
.readonly = 0,
.reset = null_reset,
.read = console_read,
.write = console_write,
};
struct hw_device *console_create (void)
{
return device_attach (&console_class, BUS_MAP_SIZE, NULL);
}
/**********************************************************/
U8 mmu_regs[MMU_PAGECOUNT][MMU_PAGEREGS];
U8 mmu_read (struct hw_device *dev, unsigned long addr)
{
switch (addr)
{
case 0x60:
return fault_addr >> 8;
case 0x61:
return fault_addr & 0xFF;
case 0x62:
return fault_type;
default:
{
unsigned int page = (addr / MMU_PAGEREGS) % MMU_PAGECOUNT;
unsigned int reg = addr % MMU_PAGEREGS;
U8 val = mmu_regs[page][reg];
//printf ("\n%02X, %02X = %02X\n", page, reg, val);
return val;
}
}
}
void mmu_write (struct hw_device *dev, unsigned long addr, U8 val)
{
unsigned int page = (addr / MMU_PAGEREGS) % MMU_PAGECOUNT;
unsigned int reg = addr % MMU_PAGEREGS;
mmu_regs[page][reg] = val;
bus_map (page * MMU_PAGESIZE,
mmu_regs[page][0],
mmu_regs[page][1] * MMU_PAGESIZE,
MMU_PAGESIZE,
mmu_regs[page][2] & 0x1);
}
void mmu_reset (struct hw_device *dev)
{
unsigned int page;
for (page = 0; page < MMU_PAGECOUNT; page++)
{
mmu_write (dev, page * MMU_PAGEREGS + 0, 0);
mmu_write (dev, page * MMU_PAGEREGS + 1, 0);
mmu_write (dev, page * MMU_PAGEREGS + 2, 0);
}
}
void mmu_reset_complete (struct hw_device *dev)
{
unsigned int page;
const struct bus_map *map;
/* Examine all of the bus_maps in place now, and
sync with the MMU registers. */
for (page = 0; page < MMU_PAGECOUNT; page++)
{
map = &busmaps[4 + page * (MMU_PAGESIZE / BUS_MAP_SIZE)];
mmu_regs[page][0] = map->devid;
mmu_regs[page][1] = map->offset / MMU_PAGESIZE;
mmu_regs[page][2] = map->flags & 0x1;
/* printf ("%02X %02X %02X\n",
map->devid, map->offset / MMU_PAGESIZE,
map->flags); */
}
}
struct hw_class mmu_class =
{
.readonly = 0,
.reset = mmu_reset,
.read = mmu_read,
.write = mmu_write,
};
struct hw_device *mmu_create (void)
{
return device_attach (&mmu_class, BUS_MAP_SIZE, NULL);
}
/**********************************************************/
/* The disk drive is emulated as follows:
* The disk is capable of "bus-mastering" and is able to dump data directly
* into the RAM, without CPU-involvement. (The pages do not even need to
* be mapped.) A transaction is initiated with the following parameters:
*
* - address of RAM, aligned to 512 bytes, must reside in lower 32KB.
* Thus there are 64 possible sector locations.
* - address of disk sector, given as a 16-bit value. This allows for up to
* a 32MB disk.
* - direction, either to disk or from disk.
*
* Emulation is synchronous with respect to the CPU.
*/
struct disk_priv
{
FILE *fp;
struct hw_device *dev;
unsigned long offset;
struct hw_device *ramdev;
unsigned int sectors;
char *ram;
};
U8 disk_read (struct hw_device *dev, unsigned long addr)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
}
void disk_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
switch (addr)
{
case DSK_ADDR:
disk->ram = disk->ramdev->priv + val * SECTOR_SIZE;
break;
case DSK_SECTOR:
disk->offset = val; /* high byte */
break;
case DSK_SECTOR+1:
disk->offset = (disk->offset << 8) | val;
disk->offset *= SECTOR_SIZE;
fseek (disk->fp, disk->offset, SEEK_SET);
break;
case DSK_CTRL:
if (val & DSK_READ)
{
fread (disk->ram, SECTOR_SIZE, 1, disk->fp);
}
else if (val & DSK_WRITE)
{
fwrite (disk->ram, SECTOR_SIZE, 1, disk->fp);
}
else if (val & DSK_ERASE)
{
char empty_sector[SECTOR_SIZE];
memset (empty_sector, 0xff, SECTOR_SIZE);
fwrite (empty_sector, SECTOR_SIZE, 1, disk->fp);
}
if (val & DSK_FLUSH)
{
fflush (disk->fp);
}
break;
}
}
void disk_reset (struct hw_device *dev)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
disk_write (dev, DSK_ADDR, 0);
disk_write (dev, DSK_SECTOR, 0);
disk_write (dev, DSK_SECTOR+1, 0);
disk_write (dev, DSK_CTRL, DSK_FLUSH);
}
void disk_format (struct hw_device *dev)
{
unsigned int sector;
struct disk_priv *disk = (struct disk_priv *)dev->priv;
for (sector = 0; sector < disk->sectors; sector++)
{
disk_write (dev, DSK_SECTOR, sector >> 8);
disk_write (dev, DSK_SECTOR+1, sector & 0xFF);
disk_write (dev, DSK_CTRL, DSK_ERASE);
}
disk_write (dev, DSK_CTRL, DSK_FLUSH);
}
struct hw_class disk_class =
{
.readonly = 0,
.reset = disk_reset,
.read = disk_read,
.write = disk_write,
};
struct hw_device *disk_create (const char *backing_file)
{
struct disk_priv *disk = malloc (sizeof (struct disk_priv));
int newdisk = 0;
- disk->fp = fopen (backing_file, "r+b");
+ disk->fp = file_open (NULL, backing_file, "r+b");
if (disk->fp == NULL)
{
printf ("warning: disk does not exist, creating\n");
- disk->fp = fopen (backing_file, "w+b");
+ disk->fp = file_open (NULL, backing_file, "w+b");
newdisk = 1;
if (disk->fp == NULL)
{
printf ("warning: disk not created\n");
}
}
disk->ram = 0;
disk->ramdev = device_table[1];
disk->dev = device_attach (&disk_class, BUS_MAP_SIZE, disk);
disk->sectors = DISK_SECTOR_COUNT;
if (newdisk)
disk_format (disk->dev);
return disk->dev;
}
/**********************************************************/
+int machine_match (const char *machine_name, const char *boot_rom_file, struct machine *m)
+{
+ if (!strcmp (m->name, machine_name))
+ {
+ machine = m;
+ m->init (boot_rom_file);
+ return 1;
+ }
+ return 0;
+}
+
+
void machine_init (const char *machine_name, const char *boot_rom_file)
{
+ extern struct machine simple_machine;
+ extern struct machine eon_machine;
+ extern struct machine wpc_machine;
+
memset (busmaps, 0, sizeof (busmaps));
- if (!strcmp (machine_name, "simple"))
- simple_init (boot_rom_file);
- else if (!strcmp (machine_name, "eon"))
- eon_init (boot_rom_file);
- else if (!strcmp (machine_name, "wpc"))
- wpc_init (boot_rom_file);
- else
- exit (1);
+ if (machine_match (machine_name, boot_rom_file, &simple_machine));
+ else if (machine_match (machine_name, boot_rom_file, &eon_machine));
+ else if (machine_match (machine_name, boot_rom_file, &wpc_machine));
+ else exit (1);
/* Save the default busmap configuration, before the
CPU begins to run, so that it can be restored if
necessary. */
memcpy (default_busmaps, busmaps, sizeof (busmaps));
if (!strcmp (machine_name, "eon"))
mmu_reset_complete (mmu_device);
}
diff --git a/machine.h b/machine.h
index 4f13bc2..6490d27 100644
--- a/machine.h
+++ b/machine.h
@@ -1,127 +1,130 @@
/*
* Copyright 2006, 2007, 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_MACHINE_H
#define M6809_MACHINE_H
/* This file defines structures used to build generic machines on a 6809. */
typedef unsigned char U8;
typedef unsigned short U16;
typedef unsigned long absolute_address_t;
#define MAX_CPU_ADDR 65536
/* The generic bus architecture. */
/* Up to 32 devices may be connected. Each device is addressed by a 32-bit physical address */
#define MAX_BUS_DEVICES 32
#define INVALID_DEVID 0xff
/* Say whether or not the mapping is RO or RW. */
#define MAP_READWRITE 0x0
#define MAP_READONLY 0x1
/* A fixed map cannot be reprogrammed. Attempts to
bus_map something differently will silently be
ignored. */
#define MAP_FIXED 0x2
#define FAULT_NONE 0
#define FAULT_NOT_WRITABLE 1
#define FAULT_NO_RESPONSE 2
/* A bus map is assocated with part of the 6809 address space
and says what device and which part of it is mapped into that
area. It also has associated flags which say how it is allowed
to be accessed.
A single bus map defines 128 bytes of address space; for a 64KB CPU,
that requires a total of 512 such structures.
Note that the bus map need not correspond to the page size that can
be configured by the MMU. It allows for more granularity and is
needed in some *hardcoded* mapping cases. */
#define BUS_MAP_SIZE 128
struct bus_map
{
unsigned int devid; /* The devid mapped here */
unsigned long offset; /* The offset within the device */
unsigned char flags;
};
#define NUM_BUS_MAPS (MAX_CPU_ADDR / BUS_MAP_SIZE)
/* A hardware device structure exists for each physical device
in the machine */
struct hw_device;
/* A hardware class structure exists for each type of device.
It defines the operations that are allowed on that device.
For example, if there are multiple ROM chips, then there is
a single "ROM" class and multiple ROM device objects. */
struct hw_class
{
/* Nonzero if the device is readonly */
int readonly;
/* Resets the device */
void (*reset) (struct hw_device *dev);
/* Reads a byte at a given offset from the beginning of the device. */
U8 (*read) (struct hw_device *dev, unsigned long phy_addr);
/* Writes a byte at a given offset from the beginning of the device. */
void (*write) (struct hw_device *dev, unsigned long phy_addr, U8 val);
};
struct hw_device
{
/* A pointer to the class object. This says what kind of device it is. */
struct hw_class *class_ptr;
/* The device ID assigned to it. This is filled in automatically
by the simulator. */
unsigned int devid;
/* The total size of the device in bytes. */
unsigned long size;
/* The private pointer, which is interpreted differently for each type
(hw_class) of device. */
void *priv;
};
extern struct machine *machine;
struct machine
{
+ const char *name;
+ void (*init) (char *boot_rom_file);
void (*fault) (unsigned int addr, unsigned char type);
+ void (*dump_thread) (unsigned int thread_id);
};
#endif /* _M6809_MACHINE_H */
diff --git a/main.c b/main.c
old mode 100755
new mode 100644
diff --git a/monitor.c b/monitor.c
old mode 100755
new mode 100644
index f5d1f4e..dc3bee7
--- a/monitor.c
+++ b/monitor.c
@@ -591,849 +591,848 @@ opcode_t codes10[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _indexed},
{_sts, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _extended},
{_sts, _extended}
};
opcode_t codes11[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_swi3, _implied},
{_undoc, _illegal}, /* 11 40 */
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal}
};
char *reg[] = {
"D", "X", "Y", "U", "S", "PC", "??", "??",
"A", "B", "CC", "DP", "??", "??", "??", "??"
};
char index_reg[] = { 'X', 'Y', 'U', 'S' };
char *off4[] = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15",
"-16", "-15", "-14", "-13", "-12", "-11", "-10", "-9",
"-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"
};
/* Disassemble the current instruction. Returns the number of bytes that
compose it. */
int
dasm (char *buf, absolute_address_t opc)
{
UINT8 op, am;
char *op_str;
absolute_address_t pc = opc;
char R;
int fetch1; /* the first (MSB) fetched byte, used in macro RDWORD */
op = fetch8 ();
if (op == 0x10)
{
op = fetch8 ();
am = codes10[op].mode;
op = codes10[op].code;
}
else if (op == 0x11)
{
op = fetch8 ();
am = codes11[op].mode;
op = codes11[op].code;
}
else
{
am = codes[op].mode;
op = codes[op].code;
}
op_str = (char *) mne[op];
buf += sprintf (buf, "%-6.6s", op_str);
switch (am)
{
case _illegal:
sprintf (buf, "???");
break;
case _implied:
break;
case _imm_byte:
sprintf (buf, "#$%02X", fetch8 ());
break;
case _imm_word:
sprintf (buf, "#$%04X", fetch16 ());
break;
case _direct:
sprintf (buf, "<%s", monitor_addr_name (fetch8 ()));
break;
case _extended:
sprintf (buf, "%s", monitor_addr_name (fetch16 ()));
break;
case _indexed:
op = fetch8 ();
R = index_reg[(op >> 5) & 0x3];
if ((op & 0x80) == 0)
{
sprintf (buf, "%s,%c", off4[op & 0x1f], R);
break;
}
switch (op & 0x1f)
{
case 0x00:
sprintf (buf, ",%c+", R);
break;
case 0x01:
sprintf (buf, ",%c++", R);
break;
case 0x02:
sprintf (buf, ",-%c", R);
break;
case 0x03:
sprintf (buf, ",--%c", R);
break;
case 0x04:
sprintf (buf, ",%c", R);
break;
case 0x05:
sprintf (buf, "B,%c", R);
break;
case 0x06:
sprintf (buf, "A,%c", R);
break;
case 0x08:
sprintf (buf, "$%02X,%c", fetch8 (), R);
break;
case 0x09:
sprintf (buf, "$%04X,%c", fetch16 (), R);
break;
case 0x0B:
sprintf (buf, "D,%c", R);
break;
case 0x0C:
sprintf (buf, "$%02X,PC", fetch8 ());
break;
case 0x0D:
sprintf (buf, "$%04X,PC", fetch16 ());
break;
case 0x11:
sprintf (buf, "[,%c++]", R);
break;
case 0x13:
sprintf (buf, "[,--%c]", R);
break;
case 0x14:
sprintf (buf, "[,%c]", R);
break;
case 0x15:
sprintf (buf, "[B,%c]", R);
break;
case 0x16:
sprintf (buf, "[A,%c]", R);
break;
case 0x18:
sprintf (buf, "[$%02X,%c]", fetch8 (), R);
break;
case 0x19:
sprintf (buf, "[$%04X,%c]", fetch16 (), R);
break;
case 0x1B:
sprintf (buf, "[D,%c]", R);
break;
case 0x1C:
sprintf (buf, "[$%02X,PC]", fetch8 ());
break;
case 0x1D:
sprintf (buf, "[$%04X,PC]", fetch16 ());
break;
case 0x1F:
sprintf (buf, "[%s]", monitor_addr_name (fetch16 ()));
break;
default:
sprintf (buf, "???");
break;
}
break;
case _rel_byte:
fetch1 = ((INT8) fetch8 ());
sprintf (buf, "$%04X", (fetch1 + pc) & 0xffff);
break;
case _rel_word:
sprintf (buf, "$%04X", (fetch16 () + pc) & 0xffff);
break;
case _reg_post:
op = fetch8 ();
sprintf (buf, "%s,%s", reg[op >> 4], reg[op & 15]);
break;
case _usr_post:
case _sys_post:
op = fetch8 ();
if (op & 0x80)
strcat (buf, "PC,");
if (op & 0x40)
strcat (buf, am == _usr_post ? "S," : "U,");
if (op & 0x20)
strcat (buf, "Y,");
if (op & 0x10)
strcat (buf, "X,");
if (op & 0x08)
strcat (buf, "DP,");
if ((op & 0x06) == 0x06)
strcat (buf, "D,");
else
{
if (op & 0x04)
strcat (buf, "B,");
if (op & 0x02)
strcat (buf, "A,");
}
if (op & 0x01)
strcat (buf, "CC,");
buf[strlen (buf) - 1] = '\0';
break;
}
return pc - opc;
}
int
sizeof_file (FILE * file)
{
int size;
fseek (file, 0, SEEK_END);
size = ftell (file);
rewind (file);
return size;
}
int
load_map_file (const char *name)
{
FILE *fp;
char map_filename[256];
char buf[256];
char *value_ptr, *id_ptr;
target_addr_t value;
char *file_ptr;
sprintf (map_filename, "%s.map", name);
- fp = fopen (map_filename, "r");
+ fp = file_open (NULL, map_filename, "r");
if (!fp)
return -1;
for (;;)
{
fgets (buf, sizeof(buf)-1, fp);
if (feof (fp))
break;
value_ptr = buf;
if (!strncmp (value_ptr, "page", 4))
{
unsigned char page = strtoul (value_ptr+4, NULL, 10);
- printf ("Page is now %d\n", page);
wpc_set_rom_page (page);
continue;
}
if (strncmp (value_ptr, " ", 6))
continue;
while (*value_ptr == ' ')
value_ptr++;
value = strtoul (value_ptr, &id_ptr, 16);
if (id_ptr == value_ptr)
continue;
while (*id_ptr == ' ')
id_ptr++;
id_ptr = strtok (id_ptr, " \t\n");
if (((*id_ptr == 'l') || (*id_ptr == 's')) && (id_ptr[1] == '_'))
continue;
++id_ptr;
file_ptr = strtok (NULL, " \t\n");
sym_add (&program_symtab, id_ptr, to_absolute (value), 0); /* file_ptr? */
}
fclose (fp);
return 0;
}
int
load_hex (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
- fp = fopen (name, "r");
+ fp = file_open (NULL, name, "r");
if (fp == NULL)
{
printf ("failed to open hex record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, ":%2x%4x%2x", &count, &addr, &type) != 3)
{
printf ("line %d: invalid hex record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff) + type;
switch (type)
{
case 0:
for (; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid hex record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 1:
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid hex record checksum \n", line);
done = 0;
break;
case 2:
default:
printf ("line %d: not supported hex type %d.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
int
load_s19 (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
- fp = fopen (name, "r");
+ fp = file_open (NULL, name, "r");
if (fp == NULL)
{
printf ("failed to open S-record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, "S%1x%2x%4x", &type, &count, &addr) != 3)
{
printf ("line %d: invalid S record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff);
switch (type)
{
case 1:
for (count -= 3; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 9:
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
default:
printf ("line %d: S%d not supported.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
void
monitor_call (unsigned int flags)
{
#ifdef CALL_STACK
if (current_function_call <= &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call++;
current_function_call->entry_point = get_pc ();
current_function_call->flags = flags;
}
#endif
}
void
monitor_return (void)
{
#ifdef CALL_STACK
if (current_function_call > &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call--;
return;
}
while ((current_function_call->flags & FC_TAIL_CALL) &&
(current_function_call > fctab))
{
current_function_call--;
}
if (current_function_call > fctab)
current_function_call--;
#endif
}
const char *
monitor_addr_name (target_addr_t target_addr)
{
static char buf[256], *bufptr;
const char *name;
absolute_address_t addr = to_absolute (target_addr);
bufptr = buf;
bufptr += sprintf (bufptr, "0x%04X", target_addr);
name = sym_lookup (&program_symtab, addr);
if (name)
bufptr += sprintf (bufptr, " <%s>", name);
return buf;
}
static void
monitor_signal (int sigtype)
{
(void) sigtype;
putchar ('\n');
monitor_on = 1;
}
void
monitor_init (void)
{
int tmp;
extern int debug_enabled;
target_addr_t a;
fctab[0].entry_point = read16 (0xfffe);
memset (&fctab[0].entry_regs, 0, sizeof (struct cpu_regs));
current_function_call = &fctab[0];
auto_break_insn_count = 0;
monitor_on = debug_enabled;
signal (SIGINT, monitor_signal);
}
int
check_break (unsigned break_pc)
{
if (auto_break_insn_count > 0)
if (--auto_break_insn_count == 0)
return 1;
return 0;
}
void
cmd_show (void)
{
int cc = get_cc ();
int pc = get_pc ();
char inst[50];
int offset, moffset;
moffset = dasm (inst, pc);
printf ("S $%04X U $%04X X $%04X Y $%04X EFHINZVC\n", get_s (),
get_u (), get_x (), get_y ());
printf ("A $%02X B $%02X DP $%02X CC $%02X ", get_a (),
get_b (), get_dp (), cc);
printf ("%c%c%c%c", (cc & E_FLAG ? '1' : '.'), (cc & F_FLAG ? '1' : '.'),
(cc & H_FLAG ? '1' : '.'), (cc & I_FLAG ? '1' : '.'));
printf ("%c%c%c%c\n", (cc & N_FLAG ? '1' : '.'), (cc & Z_FLAG ? '1' : '.'),
(cc & V_FLAG ? '1' : '.'), (cc & C_FLAG ? '1' : '.'));
printf ("PC: %s ", monitor_addr_name (pc));
printf ("Cycle %lX ", total);
for (offset = 0; offset < moffset; offset++)
printf ("%02X", read8 (offset+pc));
printf (" NextInst: %s\n", inst);
}
void
monitor_prompt (void)
{
char inst[50];
target_addr_t pc = get_pc ();
dasm (inst, pc);
printf ("S:%04X U:%04X X:%04X Y:%04X D:%04X\n",
get_s (), get_u (), get_x (), get_y (), get_d ());
printf ("%30.30s %s\n", monitor_addr_name (pc), inst);
}
void
monitor_backtrace (void)
{
struct function_call *fc = current_function_call;
while (fc >= &fctab[0]) {
printf ("%s\n", monitor_addr_name (fc->entry_point));
fc--;
}
}
int
monitor6809 (void)
{
int rc;
signal (SIGINT, monitor_signal);
rc = command_loop ();
monitor_on = 0;
return rc;
}
diff --git a/symtab.c b/symtab.c
old mode 100755
new mode 100644
index 1e0866c..6a905a2
--- a/symtab.c
+++ b/symtab.c
@@ -1,197 +1,237 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of the Portable 6809 Simulator.
*
* The Simulator 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.
*
* The Simulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+/* A pointer to the current stringspace */
struct stringspace *current_stringspace;
+/* Symbol table for program variables (taken from symbol file) */
struct symtab program_symtab;
+/* Symbol table for internal variables. Works identically to the
+above but in a different namespace */
struct symtab internal_symtab;
+/* Symbol table for the 'autocomputed virtuals'. The values
+kept in the table are pointers to functions that compute the
+values, allowing for dynamic variables. */
struct symtab auto_symtab;
+
+/**
+ * Create a new stringspace, which is just a buffer that
+ * holds strings.
+ */
struct stringspace *stringspace_create (void)
{
struct stringspace *ss = malloc (sizeof (struct stringspace));
ss->used = 0;
return ss;
}
+
+/**
+ * Copy a string into the stringspace. This keeps it around
+ * permanently; the caller is allowed to free the string
+ * afterwards.
+ */
char *stringspace_copy (const char *string)
{
unsigned int len = strlen (string) + 1;
char *result;
if (current_stringspace->used + len > MAX_STRINGSPACE)
current_stringspace = stringspace_create ();
result = current_stringspace->space + current_stringspace->used;
strcpy (result, string);
current_stringspace->used += len;
return result;
}
unsigned int sym_hash_name (const char *name)
{
unsigned int hash = *name & 0x1F;
if (*name++ != '\0')
{
hash = (hash << 11) + (544 * *name);
if (*name++ != '\0')
{
hash = (hash << 5) + (17 * *name);
}
}
return hash % MAX_SYMBOL_HASH;
}
unsigned int sym_hash_value (unsigned long value)
{
return value % MAX_SYMBOL_HASH;
}
/**
- * Lookup the symbol 'name'.
- * Returns 0 if the symbol exists (and optionally stores its value
- * in *value if not NULL), or -1 if it does not exist.
+ * Lookup the symbol table entry for 'name'.
+ * Returns NULL if the symbol is not defined.
+ * If VALUE is not-null, the value is also copied there.
*/
struct symbol *sym_find1 (struct symtab *symtab,
const char *name, unsigned long *value,
unsigned int type)
{
unsigned int hash = sym_hash_name (name);
/* Search starting in the current symbol table, and if that fails,
* try its parent tables. */
while (symtab != NULL)
{
/* Find the list of elements that hashed to this string. */
struct symbol *chain = symtab->syms_by_name[hash];
/* Scan the list for an exact match, and return it. */
while (chain != NULL)
{
if (!strcmp (name, chain->name))
{
if (type && (chain->type != type))
return NULL;
if (value)
*value = chain->value;
return chain;
}
chain = chain->name_chain;
}
symtab = symtab->parent;
}
return NULL;
}
+/**
+ * Lookup the symbol 'name'.
+ * Returns 0 if the symbol exists (and optionally stores its value
+ * in *value if not NULL), or -1 if it does not exist.
+ */
int sym_find (struct symtab *symtab,
const char *name, unsigned long *value, unsigned int type)
{
return sym_find1 (symtab, name, value, type) ? 0 : -1;
}
const char *sym_lookup (struct symtab *symtab, unsigned long value)
{
unsigned int hash = sym_hash_value (value);
while (symtab != NULL)
{
struct symbol *chain = symtab->syms_by_value[hash];
while (chain != NULL)
{
if (value == chain->value)
return chain->name;
chain = chain->value_chain;
}
symtab = symtab->parent;
}
return NULL;
}
void sym_add (struct symtab *symtab,
const char *name, unsigned long value, unsigned int type)
{
unsigned int hash;
struct symbol *s, *chain;
s = malloc (sizeof (struct symbol));
s->name = stringspace_copy (name);
s->value = value;
s->type = type;
hash = sym_hash_name (name);
chain = symtab->syms_by_name[hash];
s->name_chain = chain;
symtab->syms_by_name[hash] = s;
hash = sym_hash_value (value);
chain = symtab->syms_by_value[hash];
s->value_chain = chain;
symtab->syms_by_value[hash] = s;
}
void sym_set (struct symtab *symtab,
const char *name, unsigned long value, unsigned int type)
{
struct symbol * s = sym_find1 (symtab, name, NULL, type);
if (s)
s->value = value;
else
sym_add (symtab, name, value, type);
}
+void for_each_var (void (*cb) (struct symbol *, unsigned int size))
+{
+ struct symtab *symtab = &program_symtab;
+ absolute_address_t addr;
+ const char *sym;
+ unsigned int devid = 1;
+
+ for (addr = devid << 28; addr < (devid << 28) + 0x2000; addr++)
+ {
+ sym = sym_lookup (symtab, addr);
+ if (sym)
+ {
+ printf ("%s = %X\n", sym, addr);
+ }
+ }
+}
+
void symtab_init (struct symtab *symtab)
{
memset (symtab, 0, sizeof (struct symtab));
}
void symtab_reset (struct symtab *symtab)
{
/* TODO */
symtab_init (symtab);
}
void sym_init (void)
{
current_stringspace = stringspace_create ();
symtab_init (&program_symtab);
symtab_init (&internal_symtab);
symtab_init (&auto_symtab);
}
diff --git a/wpc.c b/wpc.c
old mode 100755
new mode 100644
index 762f7a1..b8794fe
--- a/wpc.c
+++ b/wpc.c
@@ -1,532 +1,582 @@
/*
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include <sys/time.h>
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3800
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
U8 directsw;
int curr_sw;
int curr_sw_time;
};
struct wpc_asic *global_wpc;
void wpc_asic_reset (struct hw_device *dev)
{
struct wpc_asic *wpc = dev->priv;
global_wpc = wpc;
wpc->curr_sw_time = 0;
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
#if 1
return rc;
#endif
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
rc |= WPC_DEBUG_READ_READY;
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
unsigned int wpc_read_switch (struct wpc_asic *wpc, int num)
{
unsigned int val;
val = wpc->switch_mx[num / 8] & (1 << (num % 8));
// printf ("SW %d = %d\n", num, val);
return val ? 1 : 0;
}
void wpc_write_switch (struct wpc_asic *wpc, int num, int flag)
{
unsigned int col, val;
col = num / 8;
val = 1 << (num % 8);
wpc->switch_mx[col] &= ~val;
if (flag)
wpc->switch_mx[col] |= val;
}
void wpc_press_switch (struct wpc_asic *wpc, int num, int delay)
{
wpc_write_switch (wpc, num, 1);
wpc->curr_sw = num;
wpc->curr_sw_time = delay;
}
unsigned int wpc_read_switch_column (struct wpc_asic *wpc, int col)
{
unsigned int val = 0;
int row;
for (row = 0; row < 8; row++)
if (wpc_read_switch (wpc, col * 8 + row))
val |= (1 << row);
return val;
}
void wpc_write_lamp (int num, int flag)
{
}
void wpc_write_sol (int num, int flag)
{
}
void wpc_keypoll (struct wpc_asic *wpc)
{
fd_set fds;
struct timeval timeout;
int rc;
unsigned char c;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
{
rc = read (0, &c, 1);
//printf ("%c pressed\n", c);
switch (c)
{
case '7':
wpc_press_switch (wpc, 4, 200);
break;
case '8':
wpc_press_switch (wpc, 5, 200);
break;
case '9':
wpc_press_switch (wpc, 6, 200);
break;
case '0':
wpc_press_switch (wpc, 7, 200);
break;
default:
break;
}
}
}
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
struct wpc_asic *wpc = dev->priv;
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit % 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
case WPC_SW_ROW_INPUT:
val = wpc_read_switch_column (wpc, 1 + scanbit (wpc->switch_strobe));
break;
case WPC_SW_JUMPER_INPUT:
val = 0x55;
break;
case WPC_SW_CABINET_INPUT:
val = wpc_read_switch_column (wpc, 0);
break;
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (struct wpc_asic *wpc)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_set_rom_page (unsigned char val)
{
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
}
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct wpc_asic *wpc = dev->priv;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
/* ignore for now */
break;
case WPC_ROM_BANK:
wpc->rombank = val;
wpc_set_rom_page (val);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram (wpc);
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram (wpc);
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
case WPC_SW_COL_STROBE:
wpc->switch_strobe = val;
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
struct wpc_asic *wpc = global_wpc;
//printf ("WPC 100ms periodic\n");
wpc_keypoll (wpc);
if (wpc->curr_sw_time > 0)
{
wpc->curr_sw_time -= 100;
if (wpc->curr_sw_time <= 0)
{
wpc->curr_sw_time = 0;
wpc_write_switch (wpc, wpc->curr_sw, 0);
}
}
}
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
struct wpc_asic *wpc = calloc (sizeof (struct wpc_asic), 1);
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
-struct machine wpc_machine =
+void io_sym_add (const char *name, unsigned long cpuaddr)
{
- .fault = wpc_fault,
-};
+ sym_add (&program_symtab, name, to_absolute (cpuaddr), 0);
+}
+#define IO_SYM_ADD(name) io_sym_add (#name, name)
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
struct wpc_asic *wpc;
- machine = &wpc_machine;
-
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
wpc = dev->priv;
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
wpc_update_ram (wpc);
- sym_add (&program_symtab, "WPC_ROM_BANK", to_absolute (WPC_ROM_BANK), 0);
+ IO_SYM_ADD(WPC_DMD_HIGH_PAGE);
+ IO_SYM_ADD(WPC_DMD_FIRQ_ROW_VALUE);
+ IO_SYM_ADD(WPC_DMD_LOW_PAGE);
+ IO_SYM_ADD(WPC_DMD_ACTIVE_PAGE);
+ IO_SYM_ADD(WPC_SERIAL_STATUS_PORT);
+ IO_SYM_ADD(WPC_PARALLEL_DATA_PORT);
+ IO_SYM_ADD(WPC_PARALLEL_STROBE_PORT);
+ IO_SYM_ADD(WPC_SERIAL_DATA_OUTPUT);
+ IO_SYM_ADD(WPC_SERIAL_CONTROL_OUTPUT);
+ IO_SYM_ADD(WPC_SERIAL_BAUD_SELECT);
+ IO_SYM_ADD(WPC_TICKET_DISPENSE);
+ IO_SYM_ADD(WPC_DCS_SOUND_DATA_OUT);
+ IO_SYM_ADD(WPC_DCS_SOUND_DATA_IN);
+ IO_SYM_ADD(WPC_DCS_SOUND_RESET);
+ IO_SYM_ADD(WPC_DCS_SOUND_DATA_READY);
+ IO_SYM_ADD(WPC_FLIPTRONIC_PORT_A);
+ IO_SYM_ADD(WPC_FLIPTRONIC_PORT_B);
+ IO_SYM_ADD(WPCS_DATA);
+ IO_SYM_ADD(WPCS_CONTROL_STATUS);
+ IO_SYM_ADD(WPC_SOL_FLASH2_OUTPUT);
+ IO_SYM_ADD(WPC_SOL_HIGHPOWER_OUTPUT);
+ IO_SYM_ADD(WPC_SOL_FLASH1_OUTPUT);
+ IO_SYM_ADD(WPC_SOL_LOWPOWER_OUTPUT);
+ IO_SYM_ADD(WPC_LAMP_ROW_OUTPUT);
+ IO_SYM_ADD(WPC_LAMP_COL_STROBE);
+ IO_SYM_ADD(WPC_GI_TRIAC);
+ IO_SYM_ADD(WPC_SW_JUMPER_INPUT);
+ IO_SYM_ADD(WPC_SW_CABINET_INPUT);
+ IO_SYM_ADD(WPC_SW_ROW_INPUT);
+ IO_SYM_ADD(WPC_SW_COL_STROBE);
+ IO_SYM_ADD(WPC_LEDS);
+ IO_SYM_ADD(WPC_RAM_BANK);
+ IO_SYM_ADD(WPC_SHIFTADDR);
+ IO_SYM_ADD(WPC_SHIFTBIT);
+ IO_SYM_ADD(WPC_SHIFTBIT2);
+ IO_SYM_ADD(WPC_PERIPHERAL_TIMER_FIRQ_CLEAR);
+ IO_SYM_ADD(WPC_ROM_LOCK);
+ IO_SYM_ADD(WPC_CLK_HOURS_DAYS);
+ IO_SYM_ADD(WPC_CLK_MINS);
+ IO_SYM_ADD(WPC_ROM_BANK);
+ IO_SYM_ADD(WPC_RAM_LOCK);
+ IO_SYM_ADD(WPC_RAM_LOCKSIZE);
}
+
+struct machine wpc_machine =
+{
+ .name = "wpc",
+ .fault = wpc_fault,
+ .init = wpc_init,
+};
+
+
+
|
bcd/exec09
|
58fe855dc2c605b0b72a8cc518b822e9b1862bd3
|
Continued improvements:
|
diff --git a/6809.c b/6809.c
index 683361e..14046e1 100755
--- a/6809.c
+++ b/6809.c
@@ -911,1025 +911,1025 @@ inc (unsigned arg)
OV = ~arg & res;
cpu_clk -= 2;
return res;
}
static unsigned
ld (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
return res;
}
static unsigned
lsr (unsigned arg)
{
unsigned res = arg >> 1;
N = 0;
Z = res;
C = arg & 1;
cpu_clk -= 2;
return res;
}
static void
mul (void)
{
unsigned res = (A * B) & 0xffff;
Z = res;
C = res & 0x80;
A = res >> 8;
B = res & 0xff;
cpu_clk -= 11;
}
static unsigned
neg (int arg)
{
unsigned res = (-arg) & 0xff;
C = N = Z = res;
OV = res & arg;
cpu_clk -= 2;
return res;
}
static unsigned
or (unsigned arg, unsigned val)
{
unsigned res = arg | val;
N = Z = res;
OV = 0;
return res;
}
static unsigned
rol (unsigned arg)
{
unsigned res = (arg << 1) + (C != 0);
C = res & 0x100;
N = Z = res &= 0xff;
OV = arg ^ res;
cpu_clk -= 2;
return res;
}
static unsigned
ror (unsigned arg)
{
unsigned res = arg;
if (C != 0)
res |= 0x100;
C = res & 1;
N = Z = res >>= 1;
cpu_clk -= 2;
return res;
}
static unsigned
sbc (unsigned arg, unsigned val)
{
unsigned res = arg - val - (C != 0);
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
return res;
}
static void
st (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
WRMEM (ea, res);
}
static unsigned
sub (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
return res;
}
static void
tst (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
cpu_clk -= 2;
}
static void
tfr (void)
{
unsigned tmp1 = 0xff;
unsigned post = imm_byte ();
if (((post ^ (post << 4)) & 0x80) == 0)
tmp1 = get_reg (post >> 4);
set_reg (post & 15, tmp1);
cpu_clk -= 6;
}
/* 16-Bit Accumulator Instructions */
static void
abx (void)
{
X = (X + B) & 0xffff;
cpu_clk -= 3;
}
static void
addd (unsigned val)
{
unsigned arg = (A << 8) | B;
unsigned res = arg + val;
C = res & 0x10000;
Z = res &= 0xffff;
OV = ((arg ^ res) & (val ^ res)) >> 8;
A = N = res >> 8;
B = res & 0xff;
}
static void
cmp16 (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x10000;
Z = res &= 0xffff;
N = res >> 8;
OV = ((arg ^ val) & (arg ^ res)) >> 8;
}
static void
ldd (unsigned arg)
{
unsigned res = arg;
Z = res;
A = N = res >> 8;
B = res & 0xff;
OV = 0;
}
static unsigned
ld16 (unsigned arg)
{
unsigned res = arg;
Z = res;
N = res >> 8;
OV = 0;
return res;
}
static void
sex (void)
{
unsigned res = B;
Z = res;
N = res &= 0x80;
if (res != 0)
res = 0xff;
A = res;
cpu_clk -= 2;
}
static void
std (void)
{
unsigned res = (A << 8) | B;
Z = res;
N = A;
OV = 0;
WRMEM16 (ea, res);
}
static void
st16 (unsigned arg)
{
unsigned res = arg;
Z = res;
N = res >> 8;
OV = 0;
WRMEM16 (ea, res);
}
static void
subd (unsigned val)
{
unsigned arg = (A << 8) | B;
unsigned res = arg - val;
C = res & 0x10000;
Z = res &= 0xffff;
OV = ((arg ^ val) & (arg ^ res)) >> 8;
A = N = res >> 8;
B = res & 0xff;
}
/* stack instructions */
static void
pshs (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x80)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
}
if (post & 0x40)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, U);
}
if (post & 0x20)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
}
if (post & 0x10)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
}
}
static void
pshu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x80)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, PC & 0xffff);
}
if (post & 0x40)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, S);
}
if (post & 0x20)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, Y);
}
if (post & 0x10)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, get_cc ());
}
}
static void
puls (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
}
static void
pulu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (U));
U = (U + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (U) << 8;
U = (U + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
S = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (U);
check_pc ();
U = (U + 2) & 0xffff;
}
}
/* Miscellaneous Instructions */
static void
nop (void)
{
cpu_clk -= 2;
}
static void
jsr (void)
{
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
change_pc (ea);
monitor_call (0);
}
static void
rti (void)
{
monitor_return ();
cpu_clk -= 6;
- command_irq_hook (get_cycles () - irq_start_time);
+ command_exit_irq_hook (get_cycles () - irq_start_time);
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
if ((EFI & E_FLAG) != 0)
{
cpu_clk -= 9;
A = read_stack (S);
S = (S + 1) & 0xffff;
B = read_stack (S);
S = (S + 1) & 0xffff;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
static void
rts (void)
{
monitor_return ();
cpu_clk -= 5;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
void
irq (void)
{
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
irq_start_time = get_cycles ();
change_pc (read16 (0xfff8));
#if 1
irqs_pending = 0;
#endif
}
void
swi (void)
{
cpu_clk -= 19;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
change_pc (read16 (0xfffa));
}
void
swi2 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff4));
}
void
swi3 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff2));
}
void
cwai (void)
{
puts ("CWAI - not supported yet!");
exit (100);
}
void
sync (void)
{
puts ("SYNC - not supported yet!");
exit (100);
cpu_clk -= 4;
}
static void
orcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () | tmp);
cpu_clk -= 3;
}
static void
andcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () & tmp);
cpu_clk -= 3;
}
/* Branch Instructions */
#define cond_HI() ((Z != 0) && (C == 0))
#define cond_LS() ((Z == 0) || (C != 0))
#define cond_HS() (C == 0)
#define cond_LO() (C != 0)
#define cond_NE() (Z != 0)
#define cond_EQ() (Z == 0)
#define cond_VC() ((OV & 0x80) == 0)
#define cond_VS() ((OV & 0x80) != 0)
#define cond_PL() ((N & 0x80) == 0)
#define cond_MI() ((N & 0x80) != 0)
#define cond_GE() (((N^OV) & 0x80) == 0)
#define cond_LT() (((N^OV) & 0x80) != 0)
#define cond_GT() ((((N^OV) & 0x80) == 0) && (Z != 0))
#define cond_LE() ((((N^OV) & 0x80) != 0) || (Z == 0))
static void
bra (void)
{
INT8 tmp = (INT8) imm_byte ();
change_pc (PC + tmp);
}
static void
branch (unsigned cond)
{
if (cond)
bra ();
else
change_pc (PC+1);
cpu_clk -= 3;
}
static void
long_bra (void)
{
INT16 tmp = (INT16) imm_word ();
change_pc (PC + tmp);
}
static void
long_branch (unsigned cond)
{
if (cond)
{
long_bra ();
cpu_clk -= 6;
}
else
{
change_pc (PC + 2);
cpu_clk -= 5;
}
}
static void
long_bsr (void)
{
INT16 tmp = (INT16) imm_word ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 9;
change_pc (ea);
monitor_call (0);
}
static void
bsr (void)
{
INT8 tmp = (INT8) imm_byte ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 7;
change_pc (ea);
monitor_call (0);
}
/* execute 6809 code */
int
cpu_execute (int cycles)
{
unsigned opcode;
cpu_period = cpu_clk = cycles;
do
{
command_insn_hook ();
if (check_break (PC) != 0)
monitor_on = 1;
if (monitor_on != 0)
if (monitor6809 () != 0)
goto cpu_exit;
iPC = PC;
opcode = imm_byte ();
switch (opcode)
{
case 0x00:
direct ();
cpu_clk -= 4;
WRMEM (ea, neg (RDMEM (ea)));
break; /* NEG direct */
#ifdef H6309
case 0x01: /* OIM */
break;
case 0x02: /* AIM */
break;
#endif
case 0x03:
direct ();
cpu_clk -= 4;
WRMEM (ea, com (RDMEM (ea)));
break; /* COM direct */
case 0x04:
direct ();
cpu_clk -= 4;
WRMEM (ea, lsr (RDMEM (ea)));
break; /* LSR direct */
#ifdef H6309
case 0x05: /* EIM */
break;
#endif
case 0x06:
direct ();
cpu_clk -= 4;
WRMEM (ea, ror (RDMEM (ea)));
break; /* ROR direct */
case 0x07:
direct ();
cpu_clk -= 4;
WRMEM (ea, asr (RDMEM (ea)));
break; /* ASR direct */
case 0x08:
direct ();
cpu_clk -= 4;
WRMEM (ea, asl (RDMEM (ea)));
break; /* ASL direct */
case 0x09:
direct ();
cpu_clk -= 4;
WRMEM (ea, rol (RDMEM (ea)));
break; /* ROL direct */
case 0x0a:
direct ();
cpu_clk -= 4;
WRMEM (ea, dec (RDMEM (ea)));
break; /* DEC direct */
#ifdef H6309
case 0x0B: /* TIM */
break;
#endif
case 0x0c:
direct ();
cpu_clk -= 4;
WRMEM (ea, inc (RDMEM (ea)));
break; /* INC direct */
case 0x0d:
direct ();
cpu_clk -= 4;
tst (RDMEM (ea));
break; /* TST direct */
case 0x0e:
direct ();
cpu_clk -= 3;
PC = ea;
check_pc ();
monitor_call (FC_TAIL_CALL);
break; /* JMP direct */
case 0x0f:
direct ();
cpu_clk -= 4;
WRMEM (ea, clr (RDMEM (ea)));
break; /* CLR direct */
case 0x10:
{
opcode = imm_byte ();
switch (opcode)
{
case 0x21:
cpu_clk -= 5;
PC += 2;
break;
case 0x22:
long_branch (cond_HI ());
break;
case 0x23:
long_branch (cond_LS ());
break;
case 0x24:
long_branch (cond_HS ());
break;
case 0x25:
long_branch (cond_LO ());
break;
case 0x26:
long_branch (cond_NE ());
break;
case 0x27:
long_branch (cond_EQ ());
break;
case 0x28:
long_branch (cond_VC ());
break;
case 0x29:
long_branch (cond_VS ());
break;
case 0x2a:
long_branch (cond_PL ());
break;
case 0x2b:
long_branch (cond_MI ());
break;
case 0x2c:
long_branch (cond_GE ());
break;
case 0x2d:
long_branch (cond_LT ());
break;
case 0x2e:
long_branch (cond_GT ());
break;
case 0x2f:
long_branch (cond_LE ());
break;
#ifdef H6309
case 0x30: /* ADDR */
break;
case 0x31: /* ADCR */
break;
case 0x32: /* SUBR */
break;
case 0x33: /* SBCR */
break;
case 0x34: /* ANDR */
break;
case 0x35: /* ORR */
break;
case 0x36: /* EORR */
break;
case 0x37: /* CMPR */
break;
case 0x38: /* PSHSW */
break;
case 0x39: /* PULSW */
break;
case 0x3a: /* PSHUW */
break;
case 0x3b: /* PULUW */
break;
#endif
case 0x3f:
swi2 ();
break;
#ifdef H6309
case 0x40: /* NEGD */
break;
case 0x43: /* COMD */
break;
case 0x44: /* LSRD */
break;
case 0x46: /* RORD */
break;
case 0x47: /* ASRD */
break;
case 0x48: /* ASLD/LSLD */
break;
case 0x49: /* ROLD */
break;
case 0x4a: /* DECD */
break;
case 0x4c: /* INCD */
break;
case 0x4d: /* TSTD */
break;
case 0x4f: /* CLRD */
break;
case 0x53: /* COMW */
break;
case 0x54: /* LSRW */
break;
case 0x56: /* ??RORW */
break;
case 0x59: /* ROLW */
break;
case 0x5a: /* DECW */
break;
case 0x5c: /* INCW */
break;
case 0x5d: /* TSTW */
break;
case 0x5f: /* CLRW */
break;
case 0x80: /* SUBW */
break;
case 0x81: /* CMPW */
break;
case 0x82: /* SBCD */
break;
#endif
case 0x83:
cpu_clk -= 5;
cmp16 (get_d (), imm_word ());
break;
#ifdef H6309
case 0x84: /* ANDD */
break;
case 0x85: /* BITD */
break;
case 0x86: /* LDW */
break;
case 0x88: /* EORD */
break;
case 0x89: /* ADCD */
break;
case 0x8a: /* ORD */
break;
case 0x8b: /* ADDW */
break;
#endif
case 0x8c:
cpu_clk -= 5;
cmp16 (Y, imm_word ());
break;
case 0x8e:
cpu_clk -= 4;
Y = ld16 (imm_word ());
break;
#ifdef H6309
case 0x90: /* SUBW */
break;
case 0x91: /* CMPW */
break;
diff --git a/command.c b/command.c
index ca58ebb..a8cf9bb 100755
--- a/command.c
+++ b/command.c
@@ -1,664 +1,649 @@
#include "6809.h"
#include "monitor.h"
#include "machine.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <signal.h>
-#if 0
-#include <sys/time.h>
-#endif
#include <sys/errno.h>
#include <termios.h>
-#define PERIODIC_INTERVAL 50 /* in ms */
-
/**********************************************************/
/********************* Global Data ************************/
/**********************************************************/
unsigned int break_count = 0;
breakpoint_t breaktab[MAX_BREAKS];
unsigned int active_break_count = 0;
unsigned int display_count = 0;
display_t displaytab[MAX_DISPLAYS];
unsigned int history_count = 0;
unsigned long historytab[MAX_HISTORY];
absolute_address_t examine_addr = 0;
unsigned int examine_repeat = 1;
datatype_t examine_type;
unsigned int thread_id_size = 2;
absolute_address_t thread_current;
absolute_address_t thread_id = 0;
thread_t threadtab[MAX_THREADS];
datatype_t print_type;
char *command_flags;
int exit_command_loop;
+#define IRQ_CYCLE_COUNTS 128
+unsigned int irq_cycle_tab[IRQ_CYCLE_COUNTS] = { 0, };
+unsigned int irq_cycle_entry = 0;
+unsigned long irq_cycles = 0;
+
unsigned long eval (char *expr);
extern int auto_break_insn_count;
/**********************************************************/
/******************** 6809 Functions **********************/
/**********************************************************/
void
print_addr (absolute_address_t addr)
{
const char *name;
print_device_name (addr >> 28);
putchar (':');
printf ("0x%04X", addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
printf (" <%-16.16s>", name);
else
printf ("%-20.20s", "");
}
-unsigned long
-compute_inirq (void)
-{
-}
-
-
-unsigned long
-compute_infirq (void)
-{
-}
-
-
-
/**********************************************************/
/*********************** Functions ************************/
/**********************************************************/
void
syntax_error (const char *string)
{
fprintf (stderr, "error: %s\n", string);
}
void
save_value (unsigned long val)
{
historytab[history_count++ % MAX_HISTORY] = val;
}
unsigned long
eval_historical (unsigned int id)
{
return historytab[id % MAX_HISTORY];
}
void
assign_virtual (const char *name, unsigned long val)
{
unsigned long v_val;
if (!sym_find (&auto_symtab, name, &v_val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)v_val;
virtual (&val, 1);
return;
}
sym_set (&internal_symtab, name, val, 0);
if (!strcmp (name, "thread_current"))
{
printf ("Thread pointer initialized to ");
print_addr (val);
putchar ('\n');
thread_current = val;
}
}
unsigned long
eval_virtual (const char *name)
{
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
if (!sym_find (&auto_symtab, name, &val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)val;
virtual (&val, 0);
}
else if (!sym_find (&internal_symtab, name, &val, 0))
{
}
else
{
- syntax_error ("???");
return 0;
}
return val;
}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
case 'o':
case 'a':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
char *
match_binary (char *expr, const char *op, char **secondp)
{
char *p;
p = strstr (expr, op);
if (!p)
return NULL;
*p = '\0';
p += strlen (op);
*secondp = p;
return expr;
}
int
fold_comparisons (char *expr, unsigned long *value)
{
char *p;
if (match_binary (expr, "==", &p))
*value = (eval (expr) == eval (p));
else if (match_binary (expr, "!=", &p))
*value = (eval (expr) != eval (p));
else
return 0;
return 1;
}
int
fold_binary (char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
eval_mem (char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
/* TODO - if expr is already in absolute form,
this explodes ! */
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
eval (char *expr)
{
char *p;
unsigned long val;
if (fold_comparisons (expr, &val));
else if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
unsigned int size = 1;
expr++;
if (*expr == '*')
{
expr++;
size = 2;
}
absolute_address_t addr = eval_mem (expr);
return target_read (addr, size);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
br->keep_running = 0;
br->ignore_count = 0;
br->temp = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
if (brkpt->keep_running)
printf (", print-only");
if (brkpt->temp)
printf (", temp");
putchar ('\n');
}
display_t *
display_alloc (void)
{
unsigned int n;
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (!ds->used)
{
ds->used = 1;
return ds;
}
}
}
void
display_free (display_t *ds)
{
}
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
switch (typep->format)
{
case 'a':
print_addr (val);
return;
}
if (typep->format == 'x')
{
printf ("0x");
sprintf (f, "%%0%d%c", typep->size * 2, typep->format);
}
else if (typep->format == 'o')
{
printf ("0");
sprintf (f, "%%%c", typep->format);
}
else
sprintf (f, "%%%c", typep->format);
printf (f, val);
}
void
display_print (void)
{
unsigned int n;
char comma = '\0';
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (ds->used)
{
char expr[256];
strcpy (expr, ds->expr);
printf ("%c %s = ", comma, expr);
print_value (eval (expr), &ds->type);
comma = ',';
}
}
if (comma)
putchar ('\n');
}
int
print_insn (absolute_address_t addr)
{
char buf[64];
int size = dasm (buf, addr);
printf ("%s", buf);
return size;
}
void
do_examine (void)
{
unsigned int n;
unsigned int objs_per_line = 16;
if (isdigit (*command_flags))
examine_repeat = strtoul (command_flags, &command_flags, 0);
if (*command_flags == 's' || *command_flags == 'i')
examine_type.format = *command_flags;
else
parse_format_flag (command_flags, &examine_type.format);
parse_size_flag (command_flags, &examine_type.size);
switch (examine_type.format)
{
case 'i':
objs_per_line = 1;
break;
case 'w':
objs_per_line = 8;
break;
}
for (n = 0; n < examine_repeat; n++)
{
if ((n % objs_per_line) == 0)
{
putchar ('\n');
print_addr (examine_addr);
printf (": ");
}
switch (examine_type.format)
{
case 's': /* string */
break;
case 'i': /* instruction */
examine_addr += print_insn (examine_addr);
break;
default:
print_value (target_read (examine_addr, examine_type.size),
&examine_type);
putchar (' ');
examine_addr += examine_type.size;
}
}
putchar ('\n');
}
void
do_print (char *expr)
{
unsigned long val = eval (expr);
printf ("$%d = ", history_count);
parse_format_flag (command_flags, &print_type.format);
parse_size_flag (command_flags, &print_type.size);
print_value (val, &print_type);
putchar ('\n');
save_value (val);
}
void
do_set (char *expr)
{
unsigned long val = eval (expr);
save_value (val);
}
#define THREAD_DATA_PC 3
#define THREAD_DATA_ROMBANK 9
void
print_thread_data (absolute_address_t th)
{
U8 b;
U16 w;
absolute_address_t pc;
w = abs_read16 (th + THREAD_DATA_PC);
b = abs_read8 (th + THREAD_DATA_ROMBANK);
printf ("{ PC = %04X, BANK = %02X }", w, b);
}
void
command_change_thread (void)
{
target_addr_t addr = target_read (thread_current, thread_id_size);
absolute_address_t th = to_absolute (addr);
if (th == thread_id)
return;
thread_id = th;
if (addr)
{
printf ("[Current thread = ");
print_addr (thread_id);
print_thread_data (thread_id);
printf ("]\n");
}
else
printf ("[ No thread ]\n");
}
char *
getarg (void)
{
return strtok (NULL, " \t\n");
}
/****************** Command Handlers ************************/
void cmd_print (void)
{
char *arg = getarg ();
if (arg)
do_print (arg);
else
@@ -715,580 +700,567 @@ void cmd_watch1 (int on_read, int on_write)
absolute_address_t addr = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = addr;
br->on_read = on_read;
br->on_write = on_write;
arg = getarg ();
if (!arg)
return;
if (!strcmp (arg, "print"))
br->keep_running = 1;
else if (!strcmp (arg, "if"))
{
arg = getarg ();
br->conditional = 1;
strcpy (br->condition, arg);
}
brkprint (br);
}
void cmd_watch (void)
{
cmd_watch1 (0, 1);
}
void cmd_rwatch (void)
{
cmd_watch1 (1, 0);
}
void cmd_awatch (void)
{
cmd_watch1 (1, 1);
}
void cmd_break_list (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
brkprint (&breaktab[n]);
}
void cmd_step (void)
{
auto_break_insn_count = 1;
exit_command_loop = 0;
}
void cmd_next (void)
{
char buf[128];
breakpoint_t *br;
unsigned long addr = to_absolute (get_pc ());
addr += dasm (buf, addr);
printf ("Will stop at ");
print_addr (addr);
putchar ('\n');
br = brkalloc ();
br->addr = addr;
br->on_execute = 1;
br->temp = 1;
exit_command_loop = 0;
}
void cmd_continue (void)
{
exit_command_loop = 0;
}
void cmd_quit (void)
{
cpu_quit = 0;
exit_command_loop = 1;
}
void cmd_delete (void)
{
const char *arg = getarg ();
unsigned int id;
if (!arg)
{
int n;
printf ("Deleting all breakpoints.\n");
for (id = 0; id < MAX_BREAKS; id++)
{
breakpoint_t *br = brkfind_by_id (id);
brkfree (br);
}
return;
}
id = atoi (arg);
breakpoint_t *br = brkfind_by_id (id);
if (br->used)
{
printf ("Deleting breakpoint %d\n", id);
brkfree (br);
}
}
void cmd_list (void)
{
char *arg;
static absolute_address_t lastpc = 0;
static absolute_address_t lastaddr = 0;
absolute_address_t addr;
int n;
arg = getarg ();
if (arg)
addr = eval_mem (arg);
else
{
addr = to_absolute (get_pc ());
if (addr == lastpc)
addr = lastaddr;
else
lastaddr = lastpc = addr;
}
for (n = 0; n < 10; n++)
{
print_addr (addr);
printf (" : ");
addr += print_insn (addr);
putchar ('\n');
}
lastaddr = addr;
}
void cmd_symbol_file (void)
{
char *arg = getarg ();
if (arg)
load_map_file (arg);
}
void cmd_display (void)
{
char *arg;
while ((arg = getarg ()) != NULL)
{
display_t *ds = display_alloc ();
strcpy (ds->expr, arg);
ds->type = print_type;
parse_format_flag (command_flags, &ds->type.format);
parse_size_flag (command_flags, &ds->type.size);
}
}
void command_exec_file (const char *filename)
{
FILE *infile;
extern int command_exec (FILE *);
infile = fopen (filename, "r");
if (!infile)
{
fprintf (stderr, "can't open %s\n", filename);
return;
}
while (command_exec (infile) >= 0);
fclose (infile);
}
void cmd_source (void)
{
char *arg = getarg ();
if (!arg)
return;
command_exec_file (arg);
}
void cmd_regs (void)
{
}
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
{ "s", "step", cmd_step,
"Step one instruction" },
{ "n", "next", cmd_next,
"Break at the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
{ "wa", "watch", cmd_watch,
"Add a watchpoint on write" },
{ "rwa", "rwatch", cmd_rwatch,
"Add a watchpoint on read" },
{ "awa", "awatch", cmd_awatch,
"Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
{ "l", "list", cmd_list },
{ "sym", "symbol-file", cmd_symbol_file,
"Open a symbol table file" },
{ "di", "display", cmd_display,
"Add a display expression" },
{ "so", "source", cmd_source,
"Run a command script" },
{ "regs", "regs", cmd_regs,
"Show all CPU registers" },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
{ "f", "file", cmd_file,
"Choose the program to be debugged" },
{ "exe", "exec-file", cmd_exec_file,
"Open an executable" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
/* TODO - look for a match anywhere between
* the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
void
print_current_insn (void)
{
absolute_address_t addr = to_absolute (get_pc ());
print_addr (addr);
printf (" : ");
print_insn (addr);
putchar ('\n');
}
int
command_exec (FILE *infile)
{
char buffer[256];
static char prev_buffer[256];
char *cmd;
command_handler_t handler;
int rc;
do {
errno = 0;
fgets (buffer, 255, infile);
if (feof (infile))
return -1;
} while (errno != 0);
/* In terminal mode, a blank line means to execute
the previous command. */
if (buffer[0] == '\n')
strcpy (buffer, prev_buffer);
/* Skip comments */
if (*buffer == '#')
return 0;
cmd = strtok (buffer, " \t\n");
if (!cmd)
return 0;
strcpy (prev_buffer, cmd);
handler = command_lookup (cmd);
if (!handler)
{
syntax_error ("no such command");
return 0;
}
(*handler) ();
return 0;
}
void
keybuffering (int flag)
{
struct termios tio;
tcgetattr (0, &tio);
if (!flag) /* 0 = no buffering = not default */
tio.c_lflag &= ~ICANON;
else /* 1 = buffering = default */
tio.c_lflag |= ICANON;
tcsetattr (0, TCSANOW, &tio);
}
int
command_loop (void)
{
keybuffering (1);
display_print ();
print_current_insn ();
exit_command_loop = -1;
while (exit_command_loop < 0)
{
command_prompt ();
if (command_exec (stdin) < 0)
break;
}
if (exit_command_loop == 0)
keybuffering (0);
return (exit_command_loop);
}
void
breakpoint_hit (breakpoint_t *br)
{
if (br->threaded && (thread_id != br->tid))
return;
if (br->conditional)
{
if (eval (br->condition) == 0)
return;
}
if (br->ignore_count)
{
--br->ignore_count;
return;
}
monitor_on = !br->keep_running;
}
void
command_insn_hook (void)
{
absolute_address_t abspc;
breakpoint_t *br;
if (active_break_count == 0)
return;
abspc = to_absolute (get_pc ());
br = brkfind_by_addr (abspc);
if (br && br->enabled && br->on_execute)
{
breakpoint_hit (br);
if (monitor_on == 0)
return;
if (br->temp)
brkfree (br);
else
printf ("Breakpoint %d reached.\n", br->id);
}
}
void
command_read_hook (absolute_address_t addr)
{
breakpoint_t *br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_read)
{
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf ("]\n");
breakpoint_hit (br);
}
}
void
command_write_hook (absolute_address_t addr, U8 val)
{
breakpoint_t *br;
br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_write)
{
breakpoint_hit (br);
if (monitor_on == 0)
return;
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf (" = 0x%02X", val);
printf ("]\n");
}
if (thread_id_size && (addr == thread_current + thread_id_size - 1))
{
command_change_thread ();
}
}
void pc_virtual (unsigned long *val, int writep) {
writep ? set_pc (*val) : (*val = get_pc ());
}
void x_virtual (unsigned long *val, int writep) {
writep ? set_x (*val) : (*val = get_x ());
}
void y_virtual (unsigned long *val, int writep) {
writep ? set_y (*val) : (*val = get_y ());
}
void u_virtual (unsigned long *val, int writep) {
writep ? set_u (*val) : (*val = get_u ());
}
void s_virtual (unsigned long *val, int writep) {
writep ? set_s (*val) : (*val = get_s ());
}
void d_virtual (unsigned long *val, int writep) {
writep ? set_d (*val) : (*val = get_d ());
}
void a_virtual (unsigned long *val, int writep) {
writep ? set_a (*val) : (*val = get_a ());
}
void b_virtual (unsigned long *val, int writep) {
writep ? set_b (*val) : (*val = get_b ());
}
void dp_virtual (unsigned long *val, int writep) {
writep ? set_dp (*val) : (*val = get_dp ());
}
void cc_virtual (unsigned long *val, int writep) {
writep ? set_cc (*val) : (*val = get_cc ());
}
+void irq_load_virtual (unsigned long *val, int writep) {
+ if (!writep)
+ *val = irq_cycles / IRQ_CYCLE_COUNTS;
+}
void cycles_virtual (unsigned long *val, int writep)
{
if (!writep)
*val = get_cycles ();
}
void
-command_periodic (int signo)
-{
-}
-
-
-void
-command_irq_hook (unsigned long cycles)
+command_exit_irq_hook (unsigned long cycles)
{
+ irq_cycles -= irq_cycle_tab[irq_cycle_entry];
+ irq_cycles += cycles;
+ irq_cycle_tab[irq_cycle_entry] = cycles;
+ irq_cycle_entry = (irq_cycle_entry + 1) % IRQ_CYCLE_COUNTS;
//printf ("IRQ took %lu cycles\n", cycles);
+ //printf ("Average = %d\n", irq_cycles / IRQ_CYCLE_COUNTS);
}
void
command_init (void)
{
- //struct itimerval itimer;
- struct sigaction sact;
int rc;
sym_add (&auto_symtab, "pc", (unsigned long)pc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "x", (unsigned long)x_virtual, SYM_AUTO);
sym_add (&auto_symtab, "y", (unsigned long)y_virtual, SYM_AUTO);
sym_add (&auto_symtab, "u", (unsigned long)u_virtual, SYM_AUTO);
sym_add (&auto_symtab, "s", (unsigned long)s_virtual, SYM_AUTO);
sym_add (&auto_symtab, "d", (unsigned long)d_virtual, SYM_AUTO);
sym_add (&auto_symtab, "a", (unsigned long)a_virtual, SYM_AUTO);
sym_add (&auto_symtab, "b", (unsigned long)b_virtual, SYM_AUTO);
sym_add (&auto_symtab, "dp", (unsigned long)dp_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cc", (unsigned long)cc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cycles", (unsigned long)cycles_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "irqload", (unsigned long)irq_load_virtual, SYM_AUTO);
examine_type.format = 'x';
examine_type.size = 1;
print_type.format = 'x';
print_type.size = 1;
-#if 0
- sigemptyset (&sact.sa_mask);
- sact.sa_flags = 0;
- sact.sa_handler = command_periodic;
- sigaction (SIGALRM, &sact, NULL);
-
- itimer.it_interval.tv_sec = 0;
- itimer.it_interval.tv_usec = PERIODIC_INTERVAL * 1000;
- itimer.it_value.tv_sec = 0;
- itimer.it_value.tv_usec = PERIODIC_INTERVAL * 1000;
- rc = setitimer (ITIMER_REAL, &itimer, NULL);
- if (rc < 0)
- fprintf (stderr, "couldn't register interval timer\n");
-#endif
-
command_exec_file (".dbinit");
}
/* vim: set ts=3: */
/* vim: set expandtab: */
diff --git a/main.c b/main.c
index 85517c2..68fa794 100755
--- a/main.c
+++ b/main.c
@@ -1,365 +1,364 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/time.h>
#include "6809.h"
enum
{ HEX, S19, BIN };
/* The total number of cycles that have executed */
unsigned long total = 0;
/* The frequency of the emulated CPU, in megahertz */
unsigned int mhz = 1;
/* When nonzero, indicates that the IRQ should be triggered periodically,
every so many cycles. By default no periodic IRQ is generated. */
unsigned int cycles_per_irq = 0;
/* When nonzero, indicates that the FIRQ should be triggered periodically,
every so many cycles. By default no periodic FIRQ is generated. */
unsigned int cycles_per_firq = 0;
/* Nonzero if debugging support is turned on */
int debug_enabled = 0;
/* Nonzero if tracing is enabled */
int trace_enabled = 0;
/* When nonzero, causes the program to print the total number of cycles
on a successful exit. */
int dump_cycles_on_success = 0;
/* When nonzero, indicates the total number of cycles before an automated
exit. This is to help speed through test cases that never finish. */
int max_cycles = 100000000;
char *exename;
const char *machine_name = "simple";
static void usage (void)
{
printf ("Usage: %s <options> filename\n", exename);
printf ("Options are:\n");
printf ("-hex - load intel hex file\n");
printf ("-s19 - load motorola s record file\n");
printf ("-bin - load binary file\n");
printf ("-s addr - specify binary load address hexadecimal (default 0)\n");
printf ("default format is motorola s record\n");
exit (1);
}
void
idle_loop (void)
{
struct timeval now;
static struct timeval last = { 0, 0 };
int real_ms;
static unsigned long last_cycles = 0;
unsigned long cycles;
int sim_ms;
const int cycles_per_ms = 2000;
static int period = 100;
static int count = 100;
int delay;
static int total_ms_elapsed = 0;
if (--count > 0)
return;
if (last.tv_usec == 0)
gettimeofday (&last, NULL);
gettimeofday (&now, NULL);
real_ms = (now.tv_usec - last.tv_usec) / 1000;
if (real_ms < 0)
real_ms += 1000;
last = now;
cycles = get_cycles ();
sim_ms = (cycles - last_cycles) / cycles_per_ms;
if (sim_ms < 0)
sim_ms += cycles_per_ms;
last_cycles = cycles;
/* Minimum sleep time is usually around 10ms. */
delay = sim_ms - real_ms;
total_ms_elapsed += delay;
if (total_ms_elapsed > 100)
{
total_ms_elapsed -= 100;
- command_periodic ();
wpc_periodic ();
}
if (delay > 0)
{
if (delay > 60)
period -= 5;
else if (delay < 20)
period += 5;
usleep (delay * 1000UL);
}
count = period;
}
struct option
{
char o_short;
const char *o_long;
const char *help;
unsigned int can_negate : 1;
unsigned int takes_arg : 1;
int *int_value;
char *string_value;
} option_table[] = {
{ 'd', "debug" },
{ 'h', "help" },
{ 'b', "binary" },
{ 'M', "mhz" },
{ '-', "68a09" },
{ '-', "68b09" },
{ 'R', "realtime" },
{ 'I', "irqfreq" },
{ 'F', "firqfreq" },
{ 'C', "cycledump" },
{ 't', "loadmap" },
{ 'T', "trace" },
{ 'm', "maxcycles" },
{ 's', "machine" },
{ '\0', NULL },
};
int
process_option (struct option *opt, const char *arg)
{
return 0;
}
int
parse_args (int argc, char *argv[])
{
int argn = 1;
struct option *opt;
next_arg:
while (argn < argc)
{
char *arg = argv[argn];
if (arg[0] == '-')
{
if (arg[1] == '-')
{
char *rest = strchr (arg+2, '=');
if (rest)
*rest++ = '\0';
opt = option_table;
while (opt->o_long != NULL)
{
if (!strcmp (opt->o_long, arg+2))
{
if (process_option (opt, rest))
argn++;
goto next_arg;
}
opt++;
}
}
else
{
opt = option_table;
while (opt->o_long != NULL)
{
if (opt->o_short == arg[1])
{
if (process_option (opt, argv[argn]))
argn++;
goto next_arg;
}
opt++;
}
}
}
else
{
return argn;
}
}
}
int
main (int argc, char *argv[])
{
char *name = NULL;
int type = S19;
int off = 0;
int i, j, n;
int argn = 1;
int load_tmp_map = 0;
unsigned int loops = 0;
exename = argv[0];
/* TODO - enable different options by default
based on the executable name. */
while (argn < argc)
{
if (argv[argn][0] == '-')
{
int argpos = 1;
next_arg:
switch (argv[argn][argpos++])
{
case 'd':
debug_enabled = 1;
goto next_arg;
case 'h':
type = HEX;
goto next_arg;
case 'b':
type = BIN;
goto next_arg;
case 'M':
mhz = strtoul (argv[++argn], NULL, 16);
break;
case 'o':
off = strtoul (argv[++argn], NULL, 16);
type = BIN;
break;
case 'I':
cycles_per_irq = strtoul (argv[++argn], NULL, 0);
break;
case 'F':
cycles_per_firq = strtoul (argv[++argn], NULL, 0);
break;
case 'C':
dump_cycles_on_success = 1;
goto next_arg;
case 't':
load_tmp_map = 1;
break;
case 'T':
trace_enabled = 1;
goto next_arg;
case 'm':
max_cycles = strtoul (argv[++argn], NULL, 16);
break;
case 's':
machine_name = argv[++argn];
break;
case '\0':
break;
default:
usage ();
}
}
else if (!name)
{
name = argv[argn];
}
else
{
usage ();
}
argn++;
}
sym_init ();
switch (type)
{
case HEX:
if (name && load_hex (name))
usage ();
break;
case S19:
machine_init (machine_name, NULL);
if (name && load_s19 (name))
usage ();
break;
default:
machine_init (machine_name, name);
break;
}
/* Try to load a map file */
if (load_tmp_map)
load_map_file ("tmp");
else if (name)
load_map_file (name);
/* Enable debugging if no executable given yet. */
if (!name)
debug_enabled = 1;
else
/* OK, ready to run. Reset the CPU first. */
cpu_reset ();
monitor_init ();
command_init ();
keybuffering (0);
/* Now, iterate through the instructions.
* If no IRQs or FIRQs are enabled, we can just call cpu_execute()
* and let it run for a long time; otherwise, we need to come back
* here periodically and do the interrupt handling. */
for (cpu_quit = 1; cpu_quit != 0;)
{
if ((cycles_per_irq == 0) && (cycles_per_firq == 0))
{
total += cpu_execute (max_cycles ? max_cycles-1 : 500000);
}
else
{
/* TODO - FIRQ not handled yet */
total += cpu_execute (cycles_per_irq);
request_irq (0);
}
idle_loop ();
/* Check for a rogue program that won't end */
if ((max_cycles > 0) && (total > max_cycles))
{
sim_error ("maximum cycle count exceeded at %s\n",
monitor_addr_name (get_pc ()));
}
}
printf ("m6809-run stopped after %d cycles\n", total);
return 0;
}
diff --git a/monitor.c b/monitor.c
index f5d1f4e..e331043 100755
--- a/monitor.c
+++ b/monitor.c
@@ -522,918 +522,919 @@ opcode_t codes10[256] = {
{_cmpd, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _indexed},
{_undoc, _illegal},
{_ldy, _indexed},
{_sty, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _extended},
{_undoc, _illegal},
{_ldy, _extended},
{_sty, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _direct},
{_sts, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _indexed},
{_sts, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _extended},
{_sts, _extended}
};
opcode_t codes11[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_swi3, _implied},
{_undoc, _illegal}, /* 11 40 */
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal}
};
char *reg[] = {
"D", "X", "Y", "U", "S", "PC", "??", "??",
"A", "B", "CC", "DP", "??", "??", "??", "??"
};
char index_reg[] = { 'X', 'Y', 'U', 'S' };
char *off4[] = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15",
"-16", "-15", "-14", "-13", "-12", "-11", "-10", "-9",
"-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"
};
/* Disassemble the current instruction. Returns the number of bytes that
compose it. */
int
dasm (char *buf, absolute_address_t opc)
{
UINT8 op, am;
char *op_str;
absolute_address_t pc = opc;
char R;
int fetch1; /* the first (MSB) fetched byte, used in macro RDWORD */
op = fetch8 ();
if (op == 0x10)
{
op = fetch8 ();
am = codes10[op].mode;
op = codes10[op].code;
}
else if (op == 0x11)
{
op = fetch8 ();
am = codes11[op].mode;
op = codes11[op].code;
}
else
{
am = codes[op].mode;
op = codes[op].code;
}
op_str = (char *) mne[op];
buf += sprintf (buf, "%-6.6s", op_str);
switch (am)
{
case _illegal:
sprintf (buf, "???");
break;
case _implied:
break;
case _imm_byte:
sprintf (buf, "#$%02X", fetch8 ());
break;
case _imm_word:
sprintf (buf, "#$%04X", fetch16 ());
break;
case _direct:
sprintf (buf, "<%s", monitor_addr_name (fetch8 ()));
break;
case _extended:
sprintf (buf, "%s", monitor_addr_name (fetch16 ()));
break;
case _indexed:
op = fetch8 ();
R = index_reg[(op >> 5) & 0x3];
if ((op & 0x80) == 0)
{
sprintf (buf, "%s,%c", off4[op & 0x1f], R);
break;
}
switch (op & 0x1f)
{
case 0x00:
sprintf (buf, ",%c+", R);
break;
case 0x01:
sprintf (buf, ",%c++", R);
break;
case 0x02:
sprintf (buf, ",-%c", R);
break;
case 0x03:
sprintf (buf, ",--%c", R);
break;
case 0x04:
sprintf (buf, ",%c", R);
break;
case 0x05:
sprintf (buf, "B,%c", R);
break;
case 0x06:
sprintf (buf, "A,%c", R);
break;
case 0x08:
sprintf (buf, "$%02X,%c", fetch8 (), R);
break;
case 0x09:
sprintf (buf, "$%04X,%c", fetch16 (), R);
break;
case 0x0B:
sprintf (buf, "D,%c", R);
break;
case 0x0C:
sprintf (buf, "$%02X,PC", fetch8 ());
break;
case 0x0D:
sprintf (buf, "$%04X,PC", fetch16 ());
break;
case 0x11:
sprintf (buf, "[,%c++]", R);
break;
case 0x13:
sprintf (buf, "[,--%c]", R);
break;
case 0x14:
sprintf (buf, "[,%c]", R);
break;
case 0x15:
sprintf (buf, "[B,%c]", R);
break;
case 0x16:
sprintf (buf, "[A,%c]", R);
break;
case 0x18:
sprintf (buf, "[$%02X,%c]", fetch8 (), R);
break;
case 0x19:
sprintf (buf, "[$%04X,%c]", fetch16 (), R);
break;
case 0x1B:
sprintf (buf, "[D,%c]", R);
break;
case 0x1C:
sprintf (buf, "[$%02X,PC]", fetch8 ());
break;
case 0x1D:
sprintf (buf, "[$%04X,PC]", fetch16 ());
break;
case 0x1F:
sprintf (buf, "[%s]", monitor_addr_name (fetch16 ()));
break;
default:
sprintf (buf, "???");
break;
}
break;
case _rel_byte:
fetch1 = ((INT8) fetch8 ());
- sprintf (buf, "$%04X", (fetch1 + pc) & 0xffff);
+ //sprintf (buf, "$%04X", (fetch1 + pc) & 0xffff);
+ sprintf (buf, "%s", monitor_addr_name ((fetch1 + pc) & 0xffff));
break;
case _rel_word:
- sprintf (buf, "$%04X", (fetch16 () + pc) & 0xffff);
+ //sprintf (buf, "$%04X", (fetch16 () + pc) & 0xffff);
+ sprintf (buf, "%s", monitor_addr_name ((fetch16 () + pc) & 0xffff));
break;
case _reg_post:
op = fetch8 ();
sprintf (buf, "%s,%s", reg[op >> 4], reg[op & 15]);
break;
case _usr_post:
case _sys_post:
op = fetch8 ();
if (op & 0x80)
strcat (buf, "PC,");
if (op & 0x40)
strcat (buf, am == _usr_post ? "S," : "U,");
if (op & 0x20)
strcat (buf, "Y,");
if (op & 0x10)
strcat (buf, "X,");
if (op & 0x08)
strcat (buf, "DP,");
if ((op & 0x06) == 0x06)
strcat (buf, "D,");
else
{
if (op & 0x04)
strcat (buf, "B,");
if (op & 0x02)
strcat (buf, "A,");
}
if (op & 0x01)
strcat (buf, "CC,");
buf[strlen (buf) - 1] = '\0';
break;
}
return pc - opc;
}
int
sizeof_file (FILE * file)
{
int size;
fseek (file, 0, SEEK_END);
size = ftell (file);
rewind (file);
return size;
}
int
load_map_file (const char *name)
{
FILE *fp;
char map_filename[256];
char buf[256];
char *value_ptr, *id_ptr;
target_addr_t value;
char *file_ptr;
sprintf (map_filename, "%s.map", name);
fp = fopen (map_filename, "r");
if (!fp)
return -1;
for (;;)
{
fgets (buf, sizeof(buf)-1, fp);
if (feof (fp))
break;
value_ptr = buf;
if (!strncmp (value_ptr, "page", 4))
{
unsigned char page = strtoul (value_ptr+4, NULL, 10);
- printf ("Page is now %d\n", page);
wpc_set_rom_page (page);
continue;
}
if (strncmp (value_ptr, " ", 6))
continue;
while (*value_ptr == ' ')
value_ptr++;
value = strtoul (value_ptr, &id_ptr, 16);
if (id_ptr == value_ptr)
continue;
while (*id_ptr == ' ')
id_ptr++;
id_ptr = strtok (id_ptr, " \t\n");
if (((*id_ptr == 'l') || (*id_ptr == 's')) && (id_ptr[1] == '_'))
continue;
++id_ptr;
file_ptr = strtok (NULL, " \t\n");
sym_add (&program_symtab, id_ptr, to_absolute (value), 0); /* file_ptr? */
}
fclose (fp);
return 0;
}
int
load_hex (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = fopen (name, "r");
if (fp == NULL)
{
printf ("failed to open hex record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, ":%2x%4x%2x", &count, &addr, &type) != 3)
{
printf ("line %d: invalid hex record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff) + type;
switch (type)
{
case 0:
for (; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid hex record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 1:
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid hex record checksum \n", line);
done = 0;
break;
case 2:
default:
printf ("line %d: not supported hex type %d.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
int
load_s19 (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = fopen (name, "r");
if (fp == NULL)
{
printf ("failed to open S-record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, "S%1x%2x%4x", &type, &count, &addr) != 3)
{
printf ("line %d: invalid S record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff);
switch (type)
{
case 1:
for (count -= 3; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 9:
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
default:
printf ("line %d: S%d not supported.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
void
monitor_call (unsigned int flags)
{
#ifdef CALL_STACK
if (current_function_call <= &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call++;
current_function_call->entry_point = get_pc ();
current_function_call->flags = flags;
}
#endif
}
void
monitor_return (void)
{
#ifdef CALL_STACK
if (current_function_call > &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call--;
return;
}
while ((current_function_call->flags & FC_TAIL_CALL) &&
(current_function_call > fctab))
{
current_function_call--;
}
if (current_function_call > fctab)
current_function_call--;
#endif
}
const char *
monitor_addr_name (target_addr_t target_addr)
{
static char buf[256], *bufptr;
const char *name;
absolute_address_t addr = to_absolute (target_addr);
bufptr = buf;
bufptr += sprintf (bufptr, "0x%04X", target_addr);
name = sym_lookup (&program_symtab, addr);
if (name)
bufptr += sprintf (bufptr, " <%s>", name);
return buf;
}
static void
monitor_signal (int sigtype)
{
(void) sigtype;
putchar ('\n');
monitor_on = 1;
}
void
monitor_init (void)
{
int tmp;
extern int debug_enabled;
target_addr_t a;
fctab[0].entry_point = read16 (0xfffe);
memset (&fctab[0].entry_regs, 0, sizeof (struct cpu_regs));
current_function_call = &fctab[0];
auto_break_insn_count = 0;
monitor_on = debug_enabled;
signal (SIGINT, monitor_signal);
}
int
check_break (unsigned break_pc)
{
if (auto_break_insn_count > 0)
if (--auto_break_insn_count == 0)
return 1;
return 0;
}
void
cmd_show (void)
{
int cc = get_cc ();
int pc = get_pc ();
char inst[50];
int offset, moffset;
moffset = dasm (inst, pc);
printf ("S $%04X U $%04X X $%04X Y $%04X EFHINZVC\n", get_s (),
get_u (), get_x (), get_y ());
printf ("A $%02X B $%02X DP $%02X CC $%02X ", get_a (),
get_b (), get_dp (), cc);
printf ("%c%c%c%c", (cc & E_FLAG ? '1' : '.'), (cc & F_FLAG ? '1' : '.'),
(cc & H_FLAG ? '1' : '.'), (cc & I_FLAG ? '1' : '.'));
printf ("%c%c%c%c\n", (cc & N_FLAG ? '1' : '.'), (cc & Z_FLAG ? '1' : '.'),
(cc & V_FLAG ? '1' : '.'), (cc & C_FLAG ? '1' : '.'));
printf ("PC: %s ", monitor_addr_name (pc));
printf ("Cycle %lX ", total);
for (offset = 0; offset < moffset; offset++)
printf ("%02X", read8 (offset+pc));
printf (" NextInst: %s\n", inst);
}
void
monitor_prompt (void)
{
char inst[50];
target_addr_t pc = get_pc ();
dasm (inst, pc);
printf ("S:%04X U:%04X X:%04X Y:%04X D:%04X\n",
get_s (), get_u (), get_x (), get_y (), get_d ());
printf ("%30.30s %s\n", monitor_addr_name (pc), inst);
}
void
monitor_backtrace (void)
{
struct function_call *fc = current_function_call;
while (fc >= &fctab[0]) {
printf ("%s\n", monitor_addr_name (fc->entry_point));
fc--;
}
}
int
monitor6809 (void)
{
int rc;
signal (SIGINT, monitor_signal);
rc = command_loop ();
monitor_on = 0;
return rc;
}
diff --git a/wpc.c b/wpc.c
index 762f7a1..4545165 100755
--- a/wpc.c
+++ b/wpc.c
@@ -1,532 +1,537 @@
/*
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include <sys/time.h>
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3800
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
- U8 directsw;
+ U8 opto_mx[8];
int curr_sw;
int curr_sw_time;
};
struct wpc_asic *global_wpc;
void wpc_asic_reset (struct hw_device *dev)
{
struct wpc_asic *wpc = dev->priv;
global_wpc = wpc;
wpc->curr_sw_time = 0;
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
#if 1
return rc;
#endif
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
rc |= WPC_DEBUG_READ_READY;
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
unsigned int wpc_read_switch (struct wpc_asic *wpc, int num)
{
unsigned int val;
val = wpc->switch_mx[num / 8] & (1 << (num % 8));
// printf ("SW %d = %d\n", num, val);
return val ? 1 : 0;
}
void wpc_write_switch (struct wpc_asic *wpc, int num, int flag)
{
unsigned int col, val;
col = num / 8;
val = 1 << (num % 8);
+
+ if (wpc->opto_mx[col] & val)
+ flag = !flag;
+
wpc->switch_mx[col] &= ~val;
if (flag)
wpc->switch_mx[col] |= val;
}
void wpc_press_switch (struct wpc_asic *wpc, int num, int delay)
{
wpc_write_switch (wpc, num, 1);
wpc->curr_sw = num;
wpc->curr_sw_time = delay;
}
unsigned int wpc_read_switch_column (struct wpc_asic *wpc, int col)
{
unsigned int val = 0;
int row;
for (row = 0; row < 8; row++)
if (wpc_read_switch (wpc, col * 8 + row))
val |= (1 << row);
return val;
}
void wpc_write_lamp (int num, int flag)
{
}
void wpc_write_sol (int num, int flag)
{
}
void wpc_keypoll (struct wpc_asic *wpc)
{
fd_set fds;
struct timeval timeout;
int rc;
unsigned char c;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
{
rc = read (0, &c, 1);
//printf ("%c pressed\n", c);
switch (c)
{
case '7':
wpc_press_switch (wpc, 4, 200);
break;
case '8':
wpc_press_switch (wpc, 5, 200);
break;
case '9':
wpc_press_switch (wpc, 6, 200);
break;
case '0':
wpc_press_switch (wpc, 7, 200);
break;
default:
break;
}
}
}
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
struct wpc_asic *wpc = dev->priv;
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
- val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit % 8);
+ val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit / 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
case WPC_SW_ROW_INPUT:
val = wpc_read_switch_column (wpc, 1 + scanbit (wpc->switch_strobe));
break;
case WPC_SW_JUMPER_INPUT:
val = 0x55;
break;
case WPC_SW_CABINET_INPUT:
val = wpc_read_switch_column (wpc, 0);
break;
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (struct wpc_asic *wpc)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_set_rom_page (unsigned char val)
{
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
}
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct wpc_asic *wpc = dev->priv;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
/* ignore for now */
break;
case WPC_ROM_BANK:
wpc->rombank = val;
wpc_set_rom_page (val);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram (wpc);
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram (wpc);
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
case WPC_SW_COL_STROBE:
wpc->switch_strobe = val;
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
struct wpc_asic *wpc = global_wpc;
//printf ("WPC 100ms periodic\n");
wpc_keypoll (wpc);
if (wpc->curr_sw_time > 0)
{
wpc->curr_sw_time -= 100;
if (wpc->curr_sw_time <= 0)
{
wpc->curr_sw_time = 0;
wpc_write_switch (wpc, wpc->curr_sw, 0);
}
}
}
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
struct wpc_asic *wpc = calloc (sizeof (struct wpc_asic), 1);
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
struct machine wpc_machine =
{
.fault = wpc_fault,
};
+
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
struct wpc_asic *wpc;
machine = &wpc_machine;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
wpc = dev->priv;
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
wpc_update_ram (wpc);
sym_add (&program_symtab, "WPC_ROM_BANK", to_absolute (WPC_ROM_BANK), 0);
}
|
bcd/exec09
|
921df4e896dafe6d4e53335ce09d4341958f1468
|
Add new fileio.c.
|
diff --git a/fileio.c b/fileio.c
new file mode 100644
index 0000000..a0fd2c7
--- /dev/null
+++ b/fileio.c
@@ -0,0 +1,58 @@
+
+#include <stdio.h>
+
+struct pathlist
+{
+ int count;
+ char *entry[32];
+};
+
+
+void
+path_init (struct pathlist *path)
+{
+ path->count = 0;
+}
+
+void
+path_add (struct pathlist *path, const char *dir)
+{
+ char *dir2;
+ dir2 = path->entry[path->count++] = malloc (strlen (dir) + 1);
+ strcpy (dir2, dir);
+}
+
+
+FILE *
+file_open (struct pathlist *path, const char *filename, const char *mode)
+{
+ FILE *fp;
+ char fqname[128];
+ int count;
+ const char dirsep = '/';
+
+ fp = fopen (filename, mode);
+ if (fp)
+ return fp;
+
+ if (!path || strchr (filename, dirsep))
+ return NULL;
+
+ for (count = 0; count < path->count; count++)
+ {
+ sprintf (fqname, "%s%c%s", path->entry[count], dirsep, filename);
+ fp = fopen (fqname, mode);
+ if (fp)
+ return fp;
+ }
+
+ return NULL;
+}
+
+
+void
+file_close (FILE *fp)
+{
+ fclose (fp);
+}
+
|
bcd/exec09
|
aa0bf2ce91a7f93f0948ca6770f3a18fcfbb9ad3
|
Changes made during PAPA 11:
|
diff --git a/6809.h b/6809.h
index a84b7a7..c656271 100755
--- a/6809.h
+++ b/6809.h
@@ -1,225 +1,226 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_H
#define M6809_H
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#else
#error
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
#error
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#else
#error
#endif
typedef uint8_t UINT8;
typedef signed char INT8;
typedef uint16_t UINT16;
typedef signed short INT16;
typedef uint32_t UINT32;
typedef signed int INT32;
typedef uint16_t target_addr_t;
#include "machine.h"
#define E_FLAG 0x80
#define F_FLAG 0x40
#define H_FLAG 0x20
#define I_FLAG 0x10
#define N_FLAG 0x08
#define Z_FLAG 0x04
#define V_FLAG 0x02
#define C_FLAG 0x01
extern int debug_enabled;
extern int need_flush;
extern unsigned long total;
extern int dump_cycles_on_success;
#ifdef OLDSYS
extern UINT8 *memory;
#endif
/* Primitive read/write macros */
#define read8(addr) cpu_read8 (addr)
#define write8(addr,val) do { cpu_write8 (addr, val); } while (0)
/* 16-bit versions */
#define read16(addr) (read8(addr) << 8 | read8(addr+1))
#define write16(addr,val) do { write8(addr, val & 0xFF); write8(addr+1, (val >> 8) & 0xFF) } while (0)
/* Fetch macros */
#define abs_read16(addr) ((abs_read8(addr) << 8) | abs_read8(addr+1))
#define fetch8() abs_read8 (pc++)
#define fetch16() (pc += 2, abs_read16(pc-2))
/* 6809.c */
extern int cpu_quit;
extern int cpu_execute (int);
extern void cpu_reset (void);
extern unsigned get_a (void);
extern unsigned get_b (void);
extern unsigned get_cc (void);
extern unsigned get_dp (void);
extern unsigned get_x (void);
extern unsigned get_y (void);
extern unsigned get_s (void);
extern unsigned get_u (void);
extern unsigned get_pc (void);
extern unsigned get_d (void);
extern void set_a (unsigned);
extern void set_b (unsigned);
extern void set_cc (unsigned);
extern void set_dp (unsigned);
extern void set_x (unsigned);
extern void set_y (unsigned);
extern void set_s (unsigned);
extern void set_u (unsigned);
extern void set_pc (unsigned);
extern void set_d (unsigned);
/* monitor.c */
extern int monitor_on;
extern int check_break (unsigned);
extern void monitor_init (void);
extern int monitor6809 (void);
extern int dasm (char *, absolute_address_t);
extern int load_hex (char *);
extern int load_s19 (char *);
extern int load_bin (char *,int);
#define MAX_STRINGSPACE 32000
#define MAX_SYMBOL_HASH 1009
#define SYM_DEFAULT 0
#define SYM_AUTO 1
typedef struct
{
unsigned char format;
unsigned int size;
} datatype_t;
/* symtab.c */
struct stringspace
{
char space[32000];
unsigned int used;
};
struct symbol
{
char *name;
unsigned long value;
datatype_t ty;
unsigned int type;
struct symbol *name_chain;
struct symbol *value_chain;
};
struct symtab
{
struct symbol *syms_by_name[MAX_SYMBOL_HASH];
struct symbol *syms_by_value[MAX_SYMBOL_HASH];
struct symtab *parent;
};
extern struct symtab program_symtab;
extern struct symtab internal_symtab;
extern struct symtab auto_symtab;
void sym_add (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
void sym_set (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
int sym_find (struct symtab *symtab, const char *name, unsigned long *value, unsigned int type);
const char *sym_lookup (struct symtab *symtab, unsigned long value);
typedef void (*command_handler_t) (void);
typedef void (*virtual_handler_t) (unsigned long *val, int writep);
typedef unsigned int thread_id_t;
typedef struct
{
unsigned int id : 8;
unsigned int used : 1;
unsigned int enabled : 1;
unsigned int conditional : 1;
unsigned int threaded : 1;
unsigned int on_read : 1;
unsigned int on_write : 1;
unsigned int on_execute : 1;
unsigned int size : 4;
unsigned int keep_running : 1;
+ unsigned int temp : 1;
absolute_address_t addr;
char condition[128];
thread_id_t tid;
unsigned int pass_count;
unsigned int ignore_count;
} breakpoint_t;
typedef struct
{
int used : 1;
datatype_t type;
char expr[128];
} display_t;
typedef struct
{
int id : 8;
thread_id_t tid;
} thread_t;
#define MAX_BREAKS 32
#define MAX_DISPLAYS 32
#define MAX_HISTORY 10
#define MAX_THREADS 64
void command_irq_hook (unsigned long cycles);
#endif /* M6809_H */
diff --git a/Makefile.am b/Makefile.am
index a12ed29..daf5acd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,2 +1,2 @@
-m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c
+m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c fileio.c
bin_PROGRAMS = m6809-run
diff --git a/Makefile.in b/Makefile.in
index 7ed3cb9..5303319 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,545 +1,547 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
+LIBOBJDIR =
bin_PROGRAMS = m6809-run$(EXEEXT)
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure COPYING depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_m6809_run_OBJECTS = 6809.$(OBJEXT) main.$(OBJEXT) monitor.$(OBJEXT) \
machine.$(OBJEXT) eon.$(OBJEXT) wpc.$(OBJEXT) symtab.$(OBJEXT) \
- command.$(OBJEXT)
+ command.$(OBJEXT) fileio.$(OBJEXT)
m6809_run_OBJECTS = $(am_m6809_run_OBJECTS)
m6809_run_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(m6809_run_SOURCES)
DIST_SOURCES = $(m6809_run_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c
+m6809_run_SOURCES = 6809.c main.c monitor.c machine.c eon.c wpc.c symtab.c command.c fileio.c
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
m6809-run$(EXEEXT): $(m6809_run_OBJECTS) $(m6809_run_DEPENDENCIES)
@rm -f m6809-run$(EXEEXT)
$(LINK) $(m6809_run_LDFLAGS) $(m6809_run_OBJECTS) $(m6809_run_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/6809.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/machine.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symtab.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wpc.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) config.h
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/README b/README
index 6c9564f..7882b94 100644
--- a/README
+++ b/README
@@ -1,43 +1,78 @@
-This is a port of Arto Salmi's 6809 simulator. Minor changes have been
-made to get it to work in the way that I would like. This program
-remains licensed under the GNU General Public License.
-
-Included are some sample C programs built with the gcc6809 compiler
-to demonstrate how to create a program from scratch.
-
-The simulator includes some memory-mapped registers for I/O; see
-prog/libsim.h for more information.
-
-==========================================================================
-
-Original README text from Arto:
-
-
-simple 6809 simulator under GPL licence
-
-NOTE! this software is beta stage, and has bugs.
-To compile it you should have 32-bit ANSI C complier.
-
-This simulator is missing all interrupt related SYNC, NMI Etc...
-
-I am currently busy with school, thus this is relased.
-if you have guestion or found something funny in my code please mail me.
-
-have fun!
-
-arto salmi asalmi@ratol.fi
-
-history:
-
-2001-01-28 V1.0 original version
-2001-02-15 V1.1 fixed str_scan function, fixed dasm _rel_???? code.
-2001-06-19 V1.2 Added changes made by Joze Fabcic:
- - 6809's memory is initialized to zero
- - function dasm() had two bugs when using vc6.0 complier:
- - RDWORD macro used two ++ in same variable
- - _rel_byte address was wrong by 1.
- - after EXIT command, if invalid instruction is encountered, monitor is activated again
- - default file format is motorola S-record
- - monitor formatting
-
-
+This is a rewrite of Arto Salmi's 6809 simulator. Many changes
+have been made to it. This program remains licensed under the
+GNU General Public License.
+
+Input Files
+
+
+Machines
+
+The simulator now has the notion of different 'machines':
+which says what types of I/O devices are mapped into the 6809's
+address space and how they can be accessed. Adding support for
+a new machine is fairly easy.
+
+There are 3 builtin machine types at present. The default,
+called 'simple', assumes that you have a full 64KB of RAM,
+minus some input/output functions mapped at $FF00 (see I/O below).
+If you compile a program with gcc6809 with no special linker
+option, you'll get an S-record file that is suitable for running
+on this machine. The S-record file will include a vector table
+at $FFF0, with a reset vector that points to a _start function,
+which will call your main() function. When main returns,
+_start writes to an 'exit register' at $FF01, which the simulator
+interprets and causes it to stop.
+
+gcc6809 also has a builtin notion of which addresses are used
+for text and data. The simple machine enforces this and will
+"fault" on invalid accesses.
+
+The second machine is 'wpc', and is an emulation of the
+Williams Pinball Controller which was the impetus for me
+working on the compiler in the first place.
+
+The third machine, still in development, is called 'eon'
+(for Eight-O-Nine). It is similar to simple but has some
+more advanced I/O capabilities, like a larger memory space
+that can be paged in/out, and a disk emulation for programs
+that wants to have persistence.
+
+TODO : Would anyone be interested in a CoCo machine type?
+
+
+Faults
+
+
+-----------------------------------------------------------------
+
+Original README text from Arto:
+
+
+simple 6809 simulator under GPL licence
+
+NOTE! this software is beta stage, and has bugs.
+To compile it you should have 32-bit ANSI C complier.
+
+This simulator is missing all interrupt related SYNC, NMI Etc...
+
+I am currently busy with school, thus this is relased.
+if you have guestion or found something funny in my code please mail me.
+
+have fun!
+
+arto salmi asalmi@ratol.fi
+
+history:
+
+2001-01-28 V1.0 original version
+2001-02-15 V1.1 fixed str_scan function, fixed dasm _rel_???? code.
+2001-06-19 V1.2 Added changes made by Joze Fabcic:
+ - 6809's memory is initialized to zero
+ - function dasm() had two bugs when using vc6.0 complier:
+ - RDWORD macro used two ++ in same variable
+ - _rel_byte address was wrong by 1.
+ - after EXIT command, if invalid instruction is encountered, monitor is activated again
+ - default file format is motorola S-record
+ - monitor formatting
+
+
diff --git a/command.c b/command.c
index 66961fb..ca58ebb 100755
--- a/command.c
+++ b/command.c
@@ -1,1157 +1,1294 @@
#include "6809.h"
#include "monitor.h"
#include "machine.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
+#if 0
#include <sys/time.h>
+#endif
#include <sys/errno.h>
+#include <termios.h>
#define PERIODIC_INTERVAL 50 /* in ms */
/**********************************************************/
/********************* Global Data ************************/
/**********************************************************/
unsigned int break_count = 0;
breakpoint_t breaktab[MAX_BREAKS];
unsigned int active_break_count = 0;
unsigned int display_count = 0;
display_t displaytab[MAX_DISPLAYS];
unsigned int history_count = 0;
unsigned long historytab[MAX_HISTORY];
absolute_address_t examine_addr = 0;
unsigned int examine_repeat = 1;
datatype_t examine_type;
unsigned int thread_id_size = 2;
absolute_address_t thread_current;
absolute_address_t thread_id = 0;
thread_t threadtab[MAX_THREADS];
datatype_t print_type;
char *command_flags;
int exit_command_loop;
-unsigned long eval (const char *expr);
+unsigned long eval (char *expr);
extern int auto_break_insn_count;
/**********************************************************/
/******************** 6809 Functions **********************/
/**********************************************************/
void
print_addr (absolute_address_t addr)
{
const char *name;
print_device_name (addr >> 28);
putchar (':');
- printf ("0x%X", addr & 0xFFFFFF);
+ printf ("0x%04X", addr & 0xFFFFFF);
name = sym_lookup (&program_symtab, addr);
if (name)
- printf (" <%s>", name);
+ printf (" <%-16.16s>", name);
+ else
+ printf ("%-20.20s", "");
}
unsigned long
compute_inirq (void)
{
}
unsigned long
compute_infirq (void)
{
}
/**********************************************************/
/*********************** Functions ************************/
/**********************************************************/
void
syntax_error (const char *string)
{
fprintf (stderr, "error: %s\n", string);
}
void
save_value (unsigned long val)
{
historytab[history_count++ % MAX_HISTORY] = val;
}
unsigned long
eval_historical (unsigned int id)
{
return historytab[id % MAX_HISTORY];
}
void
assign_virtual (const char *name, unsigned long val)
{
unsigned long v_val;
if (!sym_find (&auto_symtab, name, &v_val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)v_val;
virtual (&val, 1);
return;
}
sym_set (&internal_symtab, name, val, 0);
if (!strcmp (name, "thread_current"))
{
printf ("Thread pointer initialized to ");
print_addr (val);
putchar ('\n');
thread_current = val;
}
}
unsigned long
eval_virtual (const char *name)
{
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
if (!sym_find (&auto_symtab, name, &val, 0))
{
virtual_handler_t virtual = (virtual_handler_t)val;
virtual (&val, 0);
}
else if (!sym_find (&internal_symtab, name, &val, 0))
{
}
else
{
syntax_error ("???");
return 0;
}
return val;
}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
case 'o':
case 'a':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
+char *
+match_binary (char *expr, const char *op, char **secondp)
+{
+ char *p;
+ p = strstr (expr, op);
+ if (!p)
+ return NULL;
+ *p = '\0';
+ p += strlen (op);
+ *secondp = p;
+ return expr;
+}
+
+
+int
+fold_comparisons (char *expr, unsigned long *value)
+{
+ char *p;
+ if (match_binary (expr, "==", &p))
+ *value = (eval (expr) == eval (p));
+ else if (match_binary (expr, "!=", &p))
+ *value = (eval (expr) != eval (p));
+ else
+ return 0;
+ return 1;
+}
+
+
int
-fold_binary (const char *expr, const char op, unsigned long *valp)
+fold_binary (char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
-eval_mem (const char *expr)
+eval_mem (char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
+ /* TODO - if expr is already in absolute form,
+ this explodes ! */
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
-eval (const char *expr)
+eval (char *expr)
{
char *p;
unsigned long val;
- if ((p = strchr (expr, '=')) != NULL)
+ if (fold_comparisons (expr, &val));
+ else if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
- absolute_address_t addr = eval_mem (expr+1);
- return abs_read8 (addr);
+ unsigned int size = 1;
+ expr++;
+ if (*expr == '*')
+ {
+ expr++;
+ size = 2;
+ }
+
+ absolute_address_t addr = eval_mem (expr);
+ return target_read (addr, size);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
br->keep_running = 0;
br->ignore_count = 0;
+ br->temp = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
if (brkpt->keep_running)
printf (", print-only");
+ if (brkpt->temp)
+ printf (", temp");
putchar ('\n');
}
display_t *
display_alloc (void)
{
unsigned int n;
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (!ds->used)
{
ds->used = 1;
return ds;
}
}
}
void
display_free (display_t *ds)
{
}
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
switch (typep->format)
{
case 'a':
print_addr (val);
return;
}
if (typep->format == 'x')
{
printf ("0x");
sprintf (f, "%%0%d%c", typep->size * 2, typep->format);
}
else if (typep->format == 'o')
{
printf ("0");
sprintf (f, "%%%c", typep->format);
}
else
sprintf (f, "%%%c", typep->format);
printf (f, val);
}
void
display_print (void)
{
unsigned int n;
+ char comma = '\0';
+
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (ds->used)
{
- printf ("%s = ", ds->expr);
- print_value (eval (ds->expr), &ds->type);
- putchar ('\n');
+ char expr[256];
+ strcpy (expr, ds->expr);
+ printf ("%c %s = ", comma, expr);
+ print_value (eval (expr), &ds->type);
+ comma = ',';
}
}
+
+ if (comma)
+ putchar ('\n');
}
int
print_insn (absolute_address_t addr)
{
char buf[64];
int size = dasm (buf, addr);
printf ("%s", buf);
return size;
}
void
do_examine (void)
{
unsigned int n;
unsigned int objs_per_line = 16;
if (isdigit (*command_flags))
examine_repeat = strtoul (command_flags, &command_flags, 0);
if (*command_flags == 's' || *command_flags == 'i')
examine_type.format = *command_flags;
else
parse_format_flag (command_flags, &examine_type.format);
parse_size_flag (command_flags, &examine_type.size);
switch (examine_type.format)
{
case 'i':
objs_per_line = 1;
break;
case 'w':
objs_per_line = 8;
break;
}
for (n = 0; n < examine_repeat; n++)
{
if ((n % objs_per_line) == 0)
{
putchar ('\n');
print_addr (examine_addr);
printf (": ");
}
switch (examine_type.format)
{
case 's': /* string */
break;
case 'i': /* instruction */
examine_addr += print_insn (examine_addr);
break;
default:
print_value (target_read (examine_addr, examine_type.size),
&examine_type);
putchar (' ');
examine_addr += examine_type.size;
}
}
putchar ('\n');
}
void
-do_print (const char *expr)
+do_print (char *expr)
{
unsigned long val = eval (expr);
printf ("$%d = ", history_count);
parse_format_flag (command_flags, &print_type.format);
parse_size_flag (command_flags, &print_type.size);
print_value (val, &print_type);
putchar ('\n');
save_value (val);
}
void
-do_set (const char *expr)
+do_set (char *expr)
{
unsigned long val = eval (expr);
save_value (val);
}
#define THREAD_DATA_PC 3
#define THREAD_DATA_ROMBANK 9
void
print_thread_data (absolute_address_t th)
{
U8 b;
U16 w;
absolute_address_t pc;
w = abs_read16 (th + THREAD_DATA_PC);
b = abs_read8 (th + THREAD_DATA_ROMBANK);
printf ("{ PC = %04X, BANK = %02X }", w, b);
}
void
command_change_thread (void)
{
target_addr_t addr = target_read (thread_current, thread_id_size);
absolute_address_t th = to_absolute (addr);
if (th == thread_id)
return;
thread_id = th;
if (addr)
{
printf ("[Current thread = ");
print_addr (thread_id);
print_thread_data (thread_id);
printf ("]\n");
}
else
printf ("[ No thread ]\n");
}
char *
getarg (void)
{
return strtok (NULL, " \t\n");
}
/****************** Command Handlers ************************/
void cmd_print (void)
{
- const char *arg = getarg ();
+ char *arg = getarg ();
if (arg)
do_print (arg);
else
do_print ("$");
}
void cmd_set (void)
{
- const char *arg = getarg ();
+ char *arg = getarg ();
if (arg)
do_set (arg);
else
do_set ("$");
}
void cmd_examine (void)
{
- const char *arg = getarg ();
+ char *arg = getarg ();
if (arg)
examine_addr = eval_mem (arg);
do_examine ();
}
void cmd_break (void)
{
- const char *arg = getarg ();
+ char *arg = getarg ();
if (!arg)
return;
unsigned long val = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = val;
br->on_execute = 1;
+
+ if ((arg = getarg()) && !strcmp (arg, "if"))
+ {
+ br->conditional = 1;
+ arg = getarg ();
+ strcpy (br->condition, arg);
+ }
+
brkprint (br);
}
void cmd_watch1 (int on_read, int on_write)
{
- const char *arg;
+ char *arg;
arg = getarg ();
if (!arg)
return;
absolute_address_t addr = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = addr;
br->on_read = on_read;
br->on_write = on_write;
arg = getarg ();
if (!arg)
return;
+
if (!strcmp (arg, "print"))
br->keep_running = 1;
+ else if (!strcmp (arg, "if"))
+ {
+ arg = getarg ();
+ br->conditional = 1;
+ strcpy (br->condition, arg);
+ }
brkprint (br);
}
void cmd_watch (void)
{
cmd_watch1 (0, 1);
}
void cmd_rwatch (void)
{
cmd_watch1 (1, 0);
}
void cmd_awatch (void)
{
cmd_watch1 (1, 1);
}
void cmd_break_list (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
brkprint (&breaktab[n]);
}
-void cmd_step_next (void)
+void cmd_step (void)
{
auto_break_insn_count = 1;
exit_command_loop = 0;
}
+void cmd_next (void)
+{
+ char buf[128];
+ breakpoint_t *br;
+
+ unsigned long addr = to_absolute (get_pc ());
+ addr += dasm (buf, addr);
+ printf ("Will stop at ");
+ print_addr (addr);
+ putchar ('\n');
+
+ br = brkalloc ();
+ br->addr = addr;
+ br->on_execute = 1;
+ br->temp = 1;
+ exit_command_loop = 0;
+}
+
void cmd_continue (void)
{
exit_command_loop = 0;
}
void cmd_quit (void)
{
cpu_quit = 0;
exit_command_loop = 1;
}
void cmd_delete (void)
{
const char *arg = getarg ();
unsigned int id;
if (!arg)
{
int n;
printf ("Deleting all breakpoints.\n");
for (id = 0; id < MAX_BREAKS; id++)
{
breakpoint_t *br = brkfind_by_id (id);
brkfree (br);
}
return;
}
id = atoi (arg);
breakpoint_t *br = brkfind_by_id (id);
if (br->used)
{
printf ("Deleting breakpoint %d\n", id);
brkfree (br);
}
}
void cmd_list (void)
{
char *arg;
static absolute_address_t lastpc = 0;
static absolute_address_t lastaddr = 0;
absolute_address_t addr;
int n;
arg = getarg ();
if (arg)
addr = eval_mem (arg);
else
{
addr = to_absolute (get_pc ());
if (addr == lastpc)
addr = lastaddr;
else
lastaddr = lastpc = addr;
}
for (n = 0; n < 10; n++)
{
print_addr (addr);
printf (" : ");
addr += print_insn (addr);
putchar ('\n');
}
lastaddr = addr;
}
void cmd_symbol_file (void)
{
char *arg = getarg ();
if (arg)
load_map_file (arg);
}
void cmd_display (void)
{
- display_t *ds = display_alloc ();
- strcpy (ds->expr, getarg ());
- ds->type = print_type;
- parse_format_flag (command_flags, &ds->type.format);
- parse_size_flag (command_flags, &ds->type.size);
+ char *arg;
+
+ while ((arg = getarg ()) != NULL)
+ {
+ display_t *ds = display_alloc ();
+ strcpy (ds->expr, arg);
+ ds->type = print_type;
+ parse_format_flag (command_flags, &ds->type.format);
+ parse_size_flag (command_flags, &ds->type.size);
+ }
}
-void cmd_script (void)
+void command_exec_file (const char *filename)
{
- char *arg = getarg ();
FILE *infile;
extern int command_exec (FILE *);
- if (!arg)
- return;
-
- infile = fopen (arg, "r");
+ infile = fopen (filename, "r");
if (!infile)
{
- fprintf (stderr, "can't open %s\n", arg);
+ fprintf (stderr, "can't open %s\n", filename);
return;
}
while (command_exec (infile) >= 0);
fclose (infile);
}
+void cmd_source (void)
+{
+ char *arg = getarg ();
+ if (!arg)
+ return;
+ command_exec_file (arg);
+}
+
+
+void cmd_regs (void)
+{
+}
+
+
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
- { "s", "step", cmd_step_next,
- "Step to the next instruction" },
- { "n", "next", cmd_step_next,
- "Continue up to the next instruction" },
+ { "s", "step", cmd_step,
+ "Step one instruction" },
+ { "n", "next", cmd_next,
+ "Break at the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
{ "wa", "watch", cmd_watch,
"Add a watchpoint on write" },
{ "rwa", "rwatch", cmd_rwatch,
"Add a watchpoint on read" },
{ "awa", "awatch", cmd_awatch,
"Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
{ "l", "list", cmd_list },
{ "sym", "symbol-file", cmd_symbol_file,
"Open a symbol table file" },
{ "di", "display", cmd_display,
"Add a display expression" },
- { "scr", "script", cmd_script,
+ { "so", "source", cmd_source,
"Run a command script" },
+ { "regs", "regs", cmd_regs,
+ "Show all CPU registers" },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
{ "f", "file", cmd_file,
"Choose the program to be debugged" },
{ "exe", "exec-file", cmd_exec_file,
"Open an executable" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
/* TODO - look for a match anywhere between
* the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
void
print_current_insn (void)
{
absolute_address_t addr = to_absolute (get_pc ());
print_addr (addr);
printf (" : ");
print_insn (addr);
putchar ('\n');
}
int
command_exec (FILE *infile)
{
char buffer[256];
- char prev_buffer[256];
+ static char prev_buffer[256];
char *cmd;
command_handler_t handler;
int rc;
do {
errno = 0;
fgets (buffer, 255, infile);
if (feof (infile))
return -1;
} while (errno != 0);
+ /* In terminal mode, a blank line means to execute
+ the previous command. */
if (buffer[0] == '\n')
strcpy (buffer, prev_buffer);
+ /* Skip comments */
+ if (*buffer == '#')
+ return 0;
+
cmd = strtok (buffer, " \t\n");
if (!cmd)
return 0;
strcpy (prev_buffer, cmd);
handler = command_lookup (cmd);
if (!handler)
{
syntax_error ("no such command");
return 0;
}
(*handler) ();
return 0;
}
+void
+keybuffering (int flag)
+{
+ struct termios tio;
+
+ tcgetattr (0, &tio);
+ if (!flag) /* 0 = no buffering = not default */
+ tio.c_lflag &= ~ICANON;
+ else /* 1 = buffering = default */
+ tio.c_lflag |= ICANON;
+ tcsetattr (0, TCSANOW, &tio);
+}
+
+
int
command_loop (void)
{
+ keybuffering (1);
display_print ();
print_current_insn ();
exit_command_loop = -1;
while (exit_command_loop < 0)
{
command_prompt ();
if (command_exec (stdin) < 0)
break;
}
+
+ if (exit_command_loop == 0)
+ keybuffering (0);
return (exit_command_loop);
}
void
breakpoint_hit (breakpoint_t *br)
{
- if (br->threaded)
- {
- }
+ if (br->threaded && (thread_id != br->tid))
+ return;
if (br->conditional)
{
+ if (eval (br->condition) == 0)
+ return;
}
if (br->ignore_count)
{
--br->ignore_count;
return;
}
monitor_on = !br->keep_running;
}
void
command_insn_hook (void)
{
absolute_address_t abspc;
breakpoint_t *br;
if (active_break_count == 0)
return;
abspc = to_absolute (get_pc ());
br = brkfind_by_addr (abspc);
if (br && br->enabled && br->on_execute)
{
- printf ("Breakpoint %d reached.\n", br->id);
breakpoint_hit (br);
+ if (monitor_on == 0)
+ return;
+ if (br->temp)
+ brkfree (br);
+ else
+ printf ("Breakpoint %d reached.\n", br->id);
}
}
void
command_read_hook (absolute_address_t addr)
{
breakpoint_t *br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_read)
{
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf ("]\n");
breakpoint_hit (br);
}
}
void
command_write_hook (absolute_address_t addr, U8 val)
{
breakpoint_t *br;
br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_write)
{
+ breakpoint_hit (br);
+ if (monitor_on == 0)
+ return;
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf (" = 0x%02X", val);
printf ("]\n");
- breakpoint_hit (br);
}
if (thread_id_size && (addr == thread_current + thread_id_size - 1))
{
command_change_thread ();
}
}
void pc_virtual (unsigned long *val, int writep) {
writep ? set_pc (*val) : (*val = get_pc ());
}
void x_virtual (unsigned long *val, int writep) {
writep ? set_x (*val) : (*val = get_x ());
}
void y_virtual (unsigned long *val, int writep) {
writep ? set_y (*val) : (*val = get_y ());
}
void u_virtual (unsigned long *val, int writep) {
writep ? set_u (*val) : (*val = get_u ());
}
void s_virtual (unsigned long *val, int writep) {
writep ? set_s (*val) : (*val = get_s ());
}
void d_virtual (unsigned long *val, int writep) {
writep ? set_d (*val) : (*val = get_d ());
}
+void a_virtual (unsigned long *val, int writep) {
+ writep ? set_a (*val) : (*val = get_a ());
+}
+void b_virtual (unsigned long *val, int writep) {
+ writep ? set_b (*val) : (*val = get_b ());
+}
void dp_virtual (unsigned long *val, int writep) {
writep ? set_dp (*val) : (*val = get_dp ());
}
void cc_virtual (unsigned long *val, int writep) {
writep ? set_cc (*val) : (*val = get_cc ());
}
void cycles_virtual (unsigned long *val, int writep)
{
if (!writep)
*val = get_cycles ();
}
void
command_periodic (int signo)
{
- static unsigned long last_cycles = 0;
-
- if (!monitor_on && signo == SIGALRM)
- {
- /* TODO */
-#if 0
- unsigned long diff = get_cycles () - last_cycles;
- printf ("%d cycles in 50ms\n");
- last_cycles += diff;
-#endif
- }
}
void
command_irq_hook (unsigned long cycles)
{
//printf ("IRQ took %lu cycles\n", cycles);
}
void
command_init (void)
{
- struct itimerval itimer;
+ //struct itimerval itimer;
struct sigaction sact;
int rc;
sym_add (&auto_symtab, "pc", (unsigned long)pc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "x", (unsigned long)x_virtual, SYM_AUTO);
sym_add (&auto_symtab, "y", (unsigned long)y_virtual, SYM_AUTO);
sym_add (&auto_symtab, "u", (unsigned long)u_virtual, SYM_AUTO);
sym_add (&auto_symtab, "s", (unsigned long)s_virtual, SYM_AUTO);
sym_add (&auto_symtab, "d", (unsigned long)d_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "a", (unsigned long)a_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "b", (unsigned long)b_virtual, SYM_AUTO);
sym_add (&auto_symtab, "dp", (unsigned long)dp_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cc", (unsigned long)cc_virtual, SYM_AUTO);
sym_add (&auto_symtab, "cycles", (unsigned long)cycles_virtual, SYM_AUTO);
examine_type.format = 'x';
examine_type.size = 1;
print_type.format = 'x';
print_type.size = 1;
+#if 0
sigemptyset (&sact.sa_mask);
sact.sa_flags = 0;
sact.sa_handler = command_periodic;
sigaction (SIGALRM, &sact, NULL);
itimer.it_interval.tv_sec = 0;
itimer.it_interval.tv_usec = PERIODIC_INTERVAL * 1000;
itimer.it_value.tv_sec = 0;
itimer.it_value.tv_usec = PERIODIC_INTERVAL * 1000;
rc = setitimer (ITIMER_REAL, &itimer, NULL);
if (rc < 0)
fprintf (stderr, "couldn't register interval timer\n");
+#endif
+
+ command_exec_file (".dbinit");
}
/* vim: set ts=3: */
/* vim: set expandtab: */
diff --git a/main.c b/main.c
index 5bc576a..85517c2 100755
--- a/main.c
+++ b/main.c
@@ -1,215 +1,365 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
- * Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
+ * Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <sys/time.h>
#include "6809.h"
enum
{ HEX, S19, BIN };
/* The total number of cycles that have executed */
unsigned long total = 0;
/* The frequency of the emulated CPU, in megahertz */
unsigned int mhz = 1;
/* When nonzero, indicates that the IRQ should be triggered periodically,
every so many cycles. By default no periodic IRQ is generated. */
unsigned int cycles_per_irq = 0;
/* When nonzero, indicates that the FIRQ should be triggered periodically,
every so many cycles. By default no periodic FIRQ is generated. */
unsigned int cycles_per_firq = 0;
/* Nonzero if debugging support is turned on */
int debug_enabled = 0;
/* Nonzero if tracing is enabled */
int trace_enabled = 0;
/* When nonzero, causes the program to print the total number of cycles
on a successful exit. */
int dump_cycles_on_success = 0;
/* When nonzero, indicates the total number of cycles before an automated
exit. This is to help speed through test cases that never finish. */
-#ifdef CONFIG_WPC
-int max_cycles = -1;
-#else
int max_cycles = 100000000;
-#endif
char *exename;
const char *machine_name = "simple";
static void usage (void)
{
printf ("Usage: %s <options> filename\n", exename);
printf ("Options are:\n");
printf ("-hex - load intel hex file\n");
printf ("-s19 - load motorola s record file\n");
printf ("-bin - load binary file\n");
printf ("-s addr - specify binary load address hexadecimal (default 0)\n");
printf ("default format is motorola s record\n");
exit (1);
}
+void
+idle_loop (void)
+{
+ struct timeval now;
+ static struct timeval last = { 0, 0 };
+ int real_ms;
+ static unsigned long last_cycles = 0;
+ unsigned long cycles;
+ int sim_ms;
+ const int cycles_per_ms = 2000;
+ static int period = 100;
+ static int count = 100;
+ int delay;
+ static int total_ms_elapsed = 0;
+
+ if (--count > 0)
+ return;
+
+ if (last.tv_usec == 0)
+ gettimeofday (&last, NULL);
+
+ gettimeofday (&now, NULL);
+ real_ms = (now.tv_usec - last.tv_usec) / 1000;
+ if (real_ms < 0)
+ real_ms += 1000;
+ last = now;
+
+ cycles = get_cycles ();
+ sim_ms = (cycles - last_cycles) / cycles_per_ms;
+ if (sim_ms < 0)
+ sim_ms += cycles_per_ms;
+ last_cycles = cycles;
+
+
+ /* Minimum sleep time is usually around 10ms. */
+ delay = sim_ms - real_ms;
+ total_ms_elapsed += delay;
+ if (total_ms_elapsed > 100)
+ {
+ total_ms_elapsed -= 100;
+ command_periodic ();
+ wpc_periodic ();
+ }
+
+ if (delay > 0)
+ {
+ if (delay > 60)
+ period -= 5;
+ else if (delay < 20)
+ period += 5;
+ usleep (delay * 1000UL);
+ }
+
+ count = period;
+}
+
+
+
+struct option
+{
+ char o_short;
+ const char *o_long;
+ const char *help;
+ unsigned int can_negate : 1;
+ unsigned int takes_arg : 1;
+ int *int_value;
+ char *string_value;
+} option_table[] = {
+ { 'd', "debug" },
+ { 'h', "help" },
+ { 'b', "binary" },
+ { 'M', "mhz" },
+ { '-', "68a09" },
+ { '-', "68b09" },
+ { 'R', "realtime" },
+ { 'I', "irqfreq" },
+ { 'F', "firqfreq" },
+ { 'C', "cycledump" },
+ { 't', "loadmap" },
+ { 'T', "trace" },
+ { 'm', "maxcycles" },
+ { 's', "machine" },
+ { '\0', NULL },
+};
+
+
+int
+process_option (struct option *opt, const char *arg)
+{
+ return 0;
+}
+
+
+int
+parse_args (int argc, char *argv[])
+{
+ int argn = 1;
+ struct option *opt;
+
+next_arg:
+ while (argn < argc)
+ {
+ char *arg = argv[argn];
+ if (arg[0] == '-')
+ {
+ if (arg[1] == '-')
+ {
+ char *rest = strchr (arg+2, '=');
+ if (rest)
+ *rest++ = '\0';
+
+ opt = option_table;
+ while (opt->o_long != NULL)
+ {
+ if (!strcmp (opt->o_long, arg+2))
+ {
+ if (process_option (opt, rest))
+ argn++;
+ goto next_arg;
+ }
+ opt++;
+ }
+ }
+ else
+ {
+ opt = option_table;
+ while (opt->o_long != NULL)
+ {
+ if (opt->o_short == arg[1])
+ {
+ if (process_option (opt, argv[argn]))
+ argn++;
+ goto next_arg;
+ }
+ opt++;
+ }
+ }
+ }
+ else
+ {
+ return argn;
+ }
+ }
+}
+
+
+
int
main (int argc, char *argv[])
{
char *name = NULL;
int type = S19;
int off = 0;
int i, j, n;
int argn = 1;
int load_tmp_map = 0;
+ unsigned int loops = 0;
exename = argv[0];
+ /* TODO - enable different options by default
+ based on the executable name. */
while (argn < argc)
{
if (argv[argn][0] == '-')
{
int argpos = 1;
next_arg:
switch (argv[argn][argpos++])
{
case 'd':
debug_enabled = 1;
goto next_arg;
case 'h':
type = HEX;
goto next_arg;
case 'b':
type = BIN;
goto next_arg;
case 'M':
mhz = strtoul (argv[++argn], NULL, 16);
break;
case 'o':
off = strtoul (argv[++argn], NULL, 16);
type = BIN;
break;
case 'I':
cycles_per_irq = strtoul (argv[++argn], NULL, 0);
break;
case 'F':
cycles_per_firq = strtoul (argv[++argn], NULL, 0);
break;
case 'C':
dump_cycles_on_success = 1;
goto next_arg;
case 't':
load_tmp_map = 1;
break;
case 'T':
trace_enabled = 1;
goto next_arg;
case 'm':
max_cycles = strtoul (argv[++argn], NULL, 16);
break;
case 's':
machine_name = argv[++argn];
break;
case '\0':
break;
default:
usage ();
}
}
else if (!name)
{
name = argv[argn];
}
else
{
usage ();
}
argn++;
}
sym_init ();
switch (type)
{
case HEX:
if (name && load_hex (name))
usage ();
break;
case S19:
machine_init (machine_name, NULL);
if (name && load_s19 (name))
usage ();
break;
default:
machine_init (machine_name, name);
break;
}
/* Try to load a map file */
if (load_tmp_map)
load_map_file ("tmp");
else if (name)
load_map_file (name);
/* Enable debugging if no executable given yet. */
if (!name)
debug_enabled = 1;
else
/* OK, ready to run. Reset the CPU first. */
cpu_reset ();
monitor_init ();
command_init ();
+ keybuffering (0);
/* Now, iterate through the instructions.
* If no IRQs or FIRQs are enabled, we can just call cpu_execute()
* and let it run for a long time; otherwise, we need to come back
* here periodically and do the interrupt handling. */
for (cpu_quit = 1; cpu_quit != 0;)
{
if ((cycles_per_irq == 0) && (cycles_per_firq == 0))
{
total += cpu_execute (max_cycles ? max_cycles-1 : 500000);
}
else
{
/* TODO - FIRQ not handled yet */
total += cpu_execute (cycles_per_irq);
request_irq (0);
}
+ idle_loop ();
+
/* Check for a rogue program that won't end */
if ((max_cycles > 0) && (total > max_cycles))
{
sim_error ("maximum cycle count exceeded at %s\n",
monitor_addr_name (get_pc ()));
}
}
printf ("m6809-run stopped after %d cycles\n", total);
return 0;
}
diff --git a/monitor.c b/monitor.c
index 1a9e071..f5d1f4e 100755
--- a/monitor.c
+++ b/monitor.c
@@ -411,1022 +411,1029 @@ opcode_t codes10[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_swi2, _implied},
{_undoc, _illegal}, /* 10 40 */
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _imm_word},
{_undoc, _illegal},
{_ldy, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _direct},
{_undoc, _illegal},
{_ldy, _direct},
{_sty, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _indexed},
{_undoc, _illegal},
{_ldy, _indexed},
{_sty, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _extended},
{_undoc, _illegal},
{_ldy, _extended},
{_sty, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _direct},
{_sts, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _indexed},
{_sts, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _extended},
{_sts, _extended}
};
opcode_t codes11[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_swi3, _implied},
{_undoc, _illegal}, /* 11 40 */
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal}
};
char *reg[] = {
"D", "X", "Y", "U", "S", "PC", "??", "??",
"A", "B", "CC", "DP", "??", "??", "??", "??"
};
char index_reg[] = { 'X', 'Y', 'U', 'S' };
char *off4[] = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15",
"-16", "-15", "-14", "-13", "-12", "-11", "-10", "-9",
"-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"
};
/* Disassemble the current instruction. Returns the number of bytes that
compose it. */
int
dasm (char *buf, absolute_address_t opc)
{
UINT8 op, am;
char *op_str;
absolute_address_t pc = opc;
char R;
int fetch1; /* the first (MSB) fetched byte, used in macro RDWORD */
op = fetch8 ();
if (op == 0x10)
{
op = fetch8 ();
am = codes10[op].mode;
op = codes10[op].code;
}
else if (op == 0x11)
{
op = fetch8 ();
am = codes11[op].mode;
op = codes11[op].code;
}
else
{
am = codes[op].mode;
op = codes[op].code;
}
op_str = (char *) mne[op];
+ buf += sprintf (buf, "%-6.6s", op_str);
switch (am)
{
case _illegal:
sprintf (buf, "???");
break;
case _implied:
- sprintf (buf, "%s ", op_str);
break;
case _imm_byte:
- sprintf (buf, "%s #$%02X", op_str, fetch8 ());
+ sprintf (buf, "#$%02X", fetch8 ());
break;
case _imm_word:
- sprintf (buf, "%s #$%04X", op_str, fetch16 ());
+ sprintf (buf, "#$%04X", fetch16 ());
break;
case _direct:
- sprintf (buf, "%s <%s", op_str, monitor_addr_name (fetch8 ()));
+ sprintf (buf, "<%s", monitor_addr_name (fetch8 ()));
break;
case _extended:
- sprintf (buf, "%s %s", op_str, monitor_addr_name (fetch16 ()));
+ sprintf (buf, "%s", monitor_addr_name (fetch16 ()));
break;
case _indexed:
op = fetch8 ();
R = index_reg[(op >> 5) & 0x3];
if ((op & 0x80) == 0)
{
- sprintf (buf, "%s %s,%c", op_str, off4[op & 0x1f], R);
+ sprintf (buf, "%s,%c", off4[op & 0x1f], R);
break;
}
switch (op & 0x1f)
{
case 0x00:
- sprintf (buf, "%s ,%c+", op_str, R);
+ sprintf (buf, ",%c+", R);
break;
case 0x01:
- sprintf (buf, "%s ,%c++", op_str, R);
+ sprintf (buf, ",%c++", R);
break;
case 0x02:
- sprintf (buf, "%s ,-%c", op_str, R);
+ sprintf (buf, ",-%c", R);
break;
case 0x03:
- sprintf (buf, "%s ,--%c", op_str, R);
+ sprintf (buf, ",--%c", R);
break;
case 0x04:
- sprintf (buf, "%s ,%c", op_str, R);
+ sprintf (buf, ",%c", R);
break;
case 0x05:
- sprintf (buf, "%s B,%c", op_str, R);
+ sprintf (buf, "B,%c", R);
break;
case 0x06:
- sprintf (buf, "%s A,%c", op_str, R);
+ sprintf (buf, "A,%c", R);
break;
case 0x08:
- sprintf (buf, "%s $%02X,%c", op_str, fetch8 (), R);
+ sprintf (buf, "$%02X,%c", fetch8 (), R);
break;
case 0x09:
- sprintf (buf, "%s $%04X,%c", op_str, fetch16 (), R);
+ sprintf (buf, "$%04X,%c", fetch16 (), R);
break;
case 0x0B:
- sprintf (buf, "%s D,%c", op_str, R);
+ sprintf (buf, "D,%c", R);
break;
case 0x0C:
- sprintf (buf, "%s $%02X,PC", op_str, fetch8 ());
+ sprintf (buf, "$%02X,PC", fetch8 ());
break;
case 0x0D:
- sprintf (buf, "%s $%04X,PC", op_str, fetch16 ());
+ sprintf (buf, "$%04X,PC", fetch16 ());
break;
case 0x11:
- sprintf (buf, "%s [,%c++]", op_str, R);
+ sprintf (buf, "[,%c++]", R);
break;
case 0x13:
- sprintf (buf, "%s [,--%c]", op_str, R);
+ sprintf (buf, "[,--%c]", R);
break;
case 0x14:
- sprintf (buf, "%s [,%c]", op_str, R);
+ sprintf (buf, "[,%c]", R);
break;
case 0x15:
- sprintf (buf, "%s [B,%c]", op_str, R);
+ sprintf (buf, "[B,%c]", R);
break;
case 0x16:
- sprintf (buf, "%s [A,%c]", op_str, R);
+ sprintf (buf, "[A,%c]", R);
break;
case 0x18:
- sprintf (buf, "%s [$%02X,%c]", op_str, fetch8 (), R);
+ sprintf (buf, "[$%02X,%c]", fetch8 (), R);
break;
case 0x19:
- sprintf (buf, "%s [$%04X,%c]", op_str, fetch16 (), R);
+ sprintf (buf, "[$%04X,%c]", fetch16 (), R);
break;
case 0x1B:
- sprintf (buf, "%s [D,%c]", op_str, R);
+ sprintf (buf, "[D,%c]", R);
break;
case 0x1C:
- sprintf (buf, "%s [$%02X,PC]", op_str, fetch8 ());
+ sprintf (buf, "[$%02X,PC]", fetch8 ());
break;
case 0x1D:
- sprintf (buf, "%s [$%04X,PC]", op_str, fetch16 ());
+ sprintf (buf, "[$%04X,PC]", fetch16 ());
break;
case 0x1F:
- sprintf (buf, "%s [%s]", op_str, monitor_addr_name (fetch16 ()));
+ sprintf (buf, "[%s]", monitor_addr_name (fetch16 ()));
break;
default:
- sprintf (buf, "%s ??", op_str);
+ sprintf (buf, "???");
break;
}
break;
case _rel_byte:
fetch1 = ((INT8) fetch8 ());
- sprintf (buf, "%s $%04X", op_str, (fetch1 + pc) & 0xffff);
+ sprintf (buf, "$%04X", (fetch1 + pc) & 0xffff);
break;
case _rel_word:
- sprintf (buf, "%s $%04X", op_str, (fetch16 () + pc) & 0xffff);
+ sprintf (buf, "$%04X", (fetch16 () + pc) & 0xffff);
break;
case _reg_post:
op = fetch8 ();
- sprintf (buf, "%s %s,%s", op_str, reg[op >> 4], reg[op & 15]);
+ sprintf (buf, "%s,%s", reg[op >> 4], reg[op & 15]);
break;
case _usr_post:
case _sys_post:
op = fetch8 ();
- sprintf (buf, "%s ", op_str);
if (op & 0x80)
strcat (buf, "PC,");
if (op & 0x40)
strcat (buf, am == _usr_post ? "S," : "U,");
if (op & 0x20)
strcat (buf, "Y,");
if (op & 0x10)
strcat (buf, "X,");
if (op & 0x08)
strcat (buf, "DP,");
if ((op & 0x06) == 0x06)
strcat (buf, "D,");
else
{
if (op & 0x04)
strcat (buf, "B,");
if (op & 0x02)
strcat (buf, "A,");
}
if (op & 0x01)
strcat (buf, "CC,");
buf[strlen (buf) - 1] = '\0';
break;
}
return pc - opc;
}
int
sizeof_file (FILE * file)
{
int size;
fseek (file, 0, SEEK_END);
size = ftell (file);
rewind (file);
return size;
}
int
load_map_file (const char *name)
{
FILE *fp;
char map_filename[256];
char buf[256];
char *value_ptr, *id_ptr;
target_addr_t value;
char *file_ptr;
sprintf (map_filename, "%s.map", name);
fp = fopen (map_filename, "r");
if (!fp)
return -1;
for (;;)
{
fgets (buf, sizeof(buf)-1, fp);
if (feof (fp))
break;
value_ptr = buf;
+ if (!strncmp (value_ptr, "page", 4))
+ {
+ unsigned char page = strtoul (value_ptr+4, NULL, 10);
+ printf ("Page is now %d\n", page);
+ wpc_set_rom_page (page);
+ continue;
+ }
+
if (strncmp (value_ptr, " ", 6))
continue;
while (*value_ptr == ' ')
value_ptr++;
value = strtoul (value_ptr, &id_ptr, 16);
if (id_ptr == value_ptr)
continue;
while (*id_ptr == ' ')
id_ptr++;
id_ptr = strtok (id_ptr, " \t\n");
if (((*id_ptr == 'l') || (*id_ptr == 's')) && (id_ptr[1] == '_'))
continue;
++id_ptr;
file_ptr = strtok (NULL, " \t\n");
sym_add (&program_symtab, id_ptr, to_absolute (value), 0); /* file_ptr? */
}
fclose (fp);
return 0;
}
int
load_hex (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = fopen (name, "r");
if (fp == NULL)
{
printf ("failed to open hex record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, ":%2x%4x%2x", &count, &addr, &type) != 3)
{
printf ("line %d: invalid hex record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff) + type;
switch (type)
{
case 0:
for (; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid hex record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 1:
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid hex record checksum \n", line);
done = 0;
break;
case 2:
default:
printf ("line %d: not supported hex type %d.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
int
load_s19 (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = fopen (name, "r");
if (fp == NULL)
{
printf ("failed to open S-record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, "S%1x%2x%4x", &type, &count, &addr) != 3)
{
printf ("line %d: invalid S record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff);
switch (type)
{
case 1:
for (count -= 3; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 9:
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
default:
printf ("line %d: S%d not supported.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
void
monitor_call (unsigned int flags)
{
#ifdef CALL_STACK
if (current_function_call <= &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call++;
current_function_call->entry_point = get_pc ();
current_function_call->flags = flags;
}
#endif
}
void
monitor_return (void)
{
#ifdef CALL_STACK
if (current_function_call > &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call--;
return;
}
while ((current_function_call->flags & FC_TAIL_CALL) &&
(current_function_call > fctab))
{
current_function_call--;
}
if (current_function_call > fctab)
current_function_call--;
#endif
}
const char *
monitor_addr_name (target_addr_t target_addr)
{
static char buf[256], *bufptr;
const char *name;
absolute_address_t addr = to_absolute (target_addr);
bufptr = buf;
bufptr += sprintf (bufptr, "0x%04X", target_addr);
name = sym_lookup (&program_symtab, addr);
if (name)
bufptr += sprintf (bufptr, " <%s>", name);
return buf;
}
static void
monitor_signal (int sigtype)
{
(void) sigtype;
putchar ('\n');
monitor_on = 1;
}
void
monitor_init (void)
{
int tmp;
extern int debug_enabled;
target_addr_t a;
fctab[0].entry_point = read16 (0xfffe);
memset (&fctab[0].entry_regs, 0, sizeof (struct cpu_regs));
current_function_call = &fctab[0];
auto_break_insn_count = 0;
monitor_on = debug_enabled;
signal (SIGINT, monitor_signal);
}
int
check_break (unsigned break_pc)
{
if (auto_break_insn_count > 0)
if (--auto_break_insn_count == 0)
return 1;
return 0;
}
void
cmd_show (void)
{
int cc = get_cc ();
int pc = get_pc ();
char inst[50];
int offset, moffset;
moffset = dasm (inst, pc);
printf ("S $%04X U $%04X X $%04X Y $%04X EFHINZVC\n", get_s (),
get_u (), get_x (), get_y ());
printf ("A $%02X B $%02X DP $%02X CC $%02X ", get_a (),
get_b (), get_dp (), cc);
printf ("%c%c%c%c", (cc & E_FLAG ? '1' : '.'), (cc & F_FLAG ? '1' : '.'),
(cc & H_FLAG ? '1' : '.'), (cc & I_FLAG ? '1' : '.'));
printf ("%c%c%c%c\n", (cc & N_FLAG ? '1' : '.'), (cc & Z_FLAG ? '1' : '.'),
(cc & V_FLAG ? '1' : '.'), (cc & C_FLAG ? '1' : '.'));
printf ("PC: %s ", monitor_addr_name (pc));
printf ("Cycle %lX ", total);
for (offset = 0; offset < moffset; offset++)
printf ("%02X", read8 (offset+pc));
printf (" NextInst: %s\n", inst);
}
void
monitor_prompt (void)
{
char inst[50];
target_addr_t pc = get_pc ();
dasm (inst, pc);
printf ("S:%04X U:%04X X:%04X Y:%04X D:%04X\n",
get_s (), get_u (), get_x (), get_y (), get_d ());
printf ("%30.30s %s\n", monitor_addr_name (pc), inst);
}
void
monitor_backtrace (void)
{
struct function_call *fc = current_function_call;
while (fc >= &fctab[0]) {
printf ("%s\n", monitor_addr_name (fc->entry_point));
fc--;
}
}
int
monitor6809 (void)
{
int rc;
signal (SIGINT, monitor_signal);
rc = command_loop ();
monitor_on = 0;
return rc;
}
diff --git a/wpc.c b/wpc.c
index fa7d615..762f7a1 100755
--- a/wpc.c
+++ b/wpc.c
@@ -1,400 +1,532 @@
/*
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include <sys/time.h>
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3800
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
U8 directsw;
+
+ int curr_sw;
+ int curr_sw_time;
};
+struct wpc_asic *global_wpc;
+
void wpc_asic_reset (struct hw_device *dev)
{
struct wpc_asic *wpc = dev->priv;
+ global_wpc = wpc;
+ wpc->curr_sw_time = 0;
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
+#if 1
+ return rc;
+#endif
+
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
rc |= WPC_DEBUG_READ_READY;
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
+unsigned int wpc_read_switch (struct wpc_asic *wpc, int num)
+{
+ unsigned int val;
+ val = wpc->switch_mx[num / 8] & (1 << (num % 8));
+ // printf ("SW %d = %d\n", num, val);
+ return val ? 1 : 0;
+}
+
+void wpc_write_switch (struct wpc_asic *wpc, int num, int flag)
+{
+ unsigned int col, val;
+
+ col = num / 8;
+ val = 1 << (num % 8);
+ wpc->switch_mx[col] &= ~val;
+ if (flag)
+ wpc->switch_mx[col] |= val;
+}
+
+void wpc_press_switch (struct wpc_asic *wpc, int num, int delay)
+{
+ wpc_write_switch (wpc, num, 1);
+ wpc->curr_sw = num;
+ wpc->curr_sw_time = delay;
+}
+
+unsigned int wpc_read_switch_column (struct wpc_asic *wpc, int col)
+{
+ unsigned int val = 0;
+ int row;
+ for (row = 0; row < 8; row++)
+ if (wpc_read_switch (wpc, col * 8 + row))
+ val |= (1 << row);
+ return val;
+}
+
+void wpc_write_lamp (int num, int flag)
+{
+}
+
+
+void wpc_write_sol (int num, int flag)
+{
+}
+
+
+void wpc_keypoll (struct wpc_asic *wpc)
+{
+ fd_set fds;
+ struct timeval timeout;
+ int rc;
+ unsigned char c;
+
+ FD_ZERO (&fds);
+ FD_SET (0, &fds);
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+ if (select (1, &fds, NULL, NULL, &timeout))
+ {
+ rc = read (0, &c, 1);
+
+ //printf ("%c pressed\n", c);
+ switch (c)
+ {
+ case '7':
+ wpc_press_switch (wpc, 4, 200);
+ break;
+ case '8':
+ wpc_press_switch (wpc, 5, 200);
+ break;
+ case '9':
+ wpc_press_switch (wpc, 6, 200);
+ break;
+ case '0':
+ wpc_press_switch (wpc, 7, 200);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+
+
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
struct wpc_asic *wpc = dev->priv;
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit % 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
+ case WPC_SW_ROW_INPUT:
+ val = wpc_read_switch_column (wpc, 1 + scanbit (wpc->switch_strobe));
+ break;
+
+ case WPC_SW_JUMPER_INPUT:
+ val = 0x55;
+ break;
+
+ case WPC_SW_CABINET_INPUT:
+ val = wpc_read_switch_column (wpc, 0);
+ break;
+
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (struct wpc_asic *wpc)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
+void wpc_set_rom_page (unsigned char val)
+{
+ bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
+}
+
+
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct wpc_asic *wpc = dev->priv;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
/* ignore for now */
break;
case WPC_ROM_BANK:
wpc->rombank = val;
- bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
+ wpc_set_rom_page (val);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram (wpc);
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram (wpc);
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
+ case WPC_SW_COL_STROBE:
+ wpc->switch_strobe = val;
+
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
+ struct wpc_asic *wpc = global_wpc;
+ //printf ("WPC 100ms periodic\n");
+
+ wpc_keypoll (wpc);
+
+ if (wpc->curr_sw_time > 0)
+ {
+ wpc->curr_sw_time -= 100;
+ if (wpc->curr_sw_time <= 0)
+ {
+ wpc->curr_sw_time = 0;
+ wpc_write_switch (wpc, wpc->curr_sw, 0);
+ }
+ }
}
+
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
struct wpc_asic *wpc = calloc (sizeof (struct wpc_asic), 1);
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
struct machine wpc_machine =
{
.fault = wpc_fault,
};
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
struct wpc_asic *wpc;
machine = &wpc_machine;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
wpc = dev->priv;
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
wpc_update_ram (wpc);
sym_add (&program_symtab, "WPC_ROM_BANK", to_absolute (WPC_ROM_BANK), 0);
}
|
bcd/exec09
|
7384cbf517ff9d85cb44196ffddbf451b7a49580
|
Latest batch of changes:
|
diff --git a/6809.h b/6809.h
index 8b9bfe9..a84b7a7 100755
--- a/6809.h
+++ b/6809.h
@@ -1,226 +1,225 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_H
#define M6809_H
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#else
#error
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
#error
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#else
#error
#endif
typedef uint8_t UINT8;
typedef signed char INT8;
typedef uint16_t UINT16;
typedef signed short INT16;
typedef uint32_t UINT32;
typedef signed int INT32;
typedef uint16_t target_addr_t;
#include "machine.h"
#define E_FLAG 0x80
#define F_FLAG 0x40
#define H_FLAG 0x20
#define I_FLAG 0x10
#define N_FLAG 0x08
#define Z_FLAG 0x04
#define V_FLAG 0x02
#define C_FLAG 0x01
extern int debug_enabled;
extern int need_flush;
extern unsigned long total;
extern int dump_cycles_on_success;
#ifdef OLDSYS
extern UINT8 *memory;
#endif
/* Primitive read/write macros */
#define read8(addr) cpu_read8 (addr)
#define write8(addr,val) do { cpu_write8 (addr, val); } while (0)
/* 16-bit versions */
#define read16(addr) (read8(addr) << 8 | read8(addr+1))
#define write16(addr,val) do { write8(addr, val & 0xFF); write8(addr+1, (val >> 8) & 0xFF) } while (0)
/* Fetch macros */
#define abs_read16(addr) ((abs_read8(addr) << 8) | abs_read8(addr+1))
#define fetch8() abs_read8 (pc++)
#define fetch16() (pc += 2, abs_read16(pc-2))
/* 6809.c */
extern int cpu_quit;
extern int cpu_execute (int);
extern void cpu_reset (void);
extern unsigned get_a (void);
extern unsigned get_b (void);
extern unsigned get_cc (void);
extern unsigned get_dp (void);
extern unsigned get_x (void);
extern unsigned get_y (void);
extern unsigned get_s (void);
extern unsigned get_u (void);
extern unsigned get_pc (void);
extern unsigned get_d (void);
extern void set_a (unsigned);
extern void set_b (unsigned);
extern void set_cc (unsigned);
extern void set_dp (unsigned);
extern void set_x (unsigned);
extern void set_y (unsigned);
extern void set_s (unsigned);
extern void set_u (unsigned);
extern void set_pc (unsigned);
extern void set_d (unsigned);
/* monitor.c */
extern int monitor_on;
extern int check_break (unsigned);
extern void monitor_init (void);
extern int monitor6809 (void);
extern int dasm (char *, absolute_address_t);
extern int load_hex (char *);
extern int load_s19 (char *);
extern int load_bin (char *,int);
#define MAX_STRINGSPACE 32000
#define MAX_SYMBOL_HASH 1009
-#define SYM_KEYWORD 0
-#define SYM_COMMAND 1
-#define SYM_REGISTER 2
-#define SYM_MEM 3
-#define SYM_INT 4
-
+#define SYM_DEFAULT 0
+#define SYM_AUTO 1
typedef struct
{
unsigned char format;
unsigned int size;
} datatype_t;
/* symtab.c */
struct stringspace
{
char space[32000];
unsigned int used;
};
struct symbol
{
char *name;
unsigned long value;
datatype_t ty;
unsigned int type;
- struct symbol *chain;
+ struct symbol *name_chain;
+ struct symbol *value_chain;
};
struct symtab
{
struct symbol *syms_by_name[MAX_SYMBOL_HASH];
struct symbol *syms_by_value[MAX_SYMBOL_HASH];
struct symtab *parent;
};
extern struct symtab program_symtab;
extern struct symtab internal_symtab;
+extern struct symtab auto_symtab;
void sym_add (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
+void sym_set (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
int sym_find (struct symtab *symtab, const char *name, unsigned long *value, unsigned int type);
const char *sym_lookup (struct symtab *symtab, unsigned long value);
typedef void (*command_handler_t) (void);
typedef void (*virtual_handler_t) (unsigned long *val, int writep);
typedef unsigned int thread_id_t;
typedef struct
{
unsigned int id : 8;
unsigned int used : 1;
unsigned int enabled : 1;
unsigned int conditional : 1;
unsigned int threaded : 1;
unsigned int on_read : 1;
unsigned int on_write : 1;
unsigned int on_execute : 1;
unsigned int size : 4;
unsigned int keep_running : 1;
absolute_address_t addr;
char condition[128];
thread_id_t tid;
unsigned int pass_count;
unsigned int ignore_count;
} breakpoint_t;
typedef struct
{
int used : 1;
datatype_t type;
char expr[128];
} display_t;
typedef struct
{
int id : 8;
thread_id_t tid;
} thread_t;
#define MAX_BREAKS 32
#define MAX_DISPLAYS 32
#define MAX_HISTORY 10
#define MAX_THREADS 64
void command_irq_hook (unsigned long cycles);
#endif /* M6809_H */
diff --git a/command.c b/command.c
index 801d0f9..66961fb 100755
--- a/command.c
+++ b/command.c
@@ -1,994 +1,1157 @@
#include "6809.h"
#include "monitor.h"
#include "machine.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/errno.h>
#define PERIODIC_INTERVAL 50 /* in ms */
/**********************************************************/
/********************* Global Data ************************/
/**********************************************************/
unsigned int break_count = 0;
breakpoint_t breaktab[MAX_BREAKS];
unsigned int active_break_count = 0;
unsigned int display_count = 0;
display_t displaytab[MAX_DISPLAYS];
unsigned int history_count = 0;
unsigned long historytab[MAX_HISTORY];
absolute_address_t examine_addr = 0;
unsigned int examine_repeat = 1;
datatype_t examine_type;
+unsigned int thread_id_size = 2;
+absolute_address_t thread_current;
+absolute_address_t thread_id = 0;
thread_t threadtab[MAX_THREADS];
datatype_t print_type;
char *command_flags;
int exit_command_loop;
unsigned long eval (const char *expr);
extern int auto_break_insn_count;
/**********************************************************/
/******************** 6809 Functions **********************/
/**********************************************************/
void
print_addr (absolute_address_t addr)
{
+ const char *name;
+
print_device_name (addr >> 28);
putchar (':');
- printf ("%04X", addr & 0xFFFFFF);
+ printf ("0x%X", addr & 0xFFFFFF);
+
+ name = sym_lookup (&program_symtab, addr);
+ if (name)
+ printf (" <%s>", name);
}
unsigned long
compute_inirq (void)
{
}
unsigned long
compute_infirq (void)
{
}
/**********************************************************/
/*********************** Functions ************************/
/**********************************************************/
void
syntax_error (const char *string)
{
fprintf (stderr, "error: %s\n", string);
}
void
save_value (unsigned long val)
{
historytab[history_count++ % MAX_HISTORY] = val;
}
unsigned long
eval_historical (unsigned int id)
{
return historytab[id % MAX_HISTORY];
}
void
assign_virtual (const char *name, unsigned long val)
{
- virtual_handler_t virtual;
unsigned long v_val;
- if (sym_find (&internal_symtab, name, &v_val, 0))
- sym_add (&internal_symtab, name, 0, 0);
-
- virtual = (virtual_handler_t)v_val;
- virtual (&val, 1);
-}
-
+ if (!sym_find (&auto_symtab, name, &v_val, 0))
+ {
+ virtual_handler_t virtual = (virtual_handler_t)v_val;
+ virtual (&val, 1);
+ return;
+ }
+ sym_set (&internal_symtab, name, val, 0);
-/**
- * Returns $name if name is defined as a symbol.
- * Returns NULL otherwise.
- */
-const char *
-virtual_defined (const char *name)
-{
- if (sym_find (&internal_symtab, name, NULL, 0))
- return name;
- else
- return NULL;
+ if (!strcmp (name, "thread_current"))
+ {
+ printf ("Thread pointer initialized to ");
+ print_addr (val);
+ putchar ('\n');
+ thread_current = val;
+ }
}
unsigned long
eval_virtual (const char *name)
{
- virtual_handler_t virtual;
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
- if (sym_find (&internal_symtab, name, &val, 0))
+ if (!sym_find (&auto_symtab, name, &val, 0))
{
+ virtual_handler_t virtual = (virtual_handler_t)val;
+ virtual (&val, 0);
+ }
+ else if (!sym_find (&internal_symtab, name, &val, 0))
+ {
+ }
+ else
+ {
syntax_error ("???");
return 0;
- }
+ }
- virtual = (virtual_handler_t)val;
- virtual (&val, 0);
return val;
}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
case 'o':
case 'a':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
int
fold_binary (const char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
eval_mem (const char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
+ else if (isalpha (*expr))
+ {
+ if (sym_find (&program_symtab, expr, &val, 0))
+ val = 0;
+ }
else
{
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
eval (const char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
absolute_address_t addr = eval_mem (expr+1);
return abs_read8 (addr);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
else if (isalpha (*expr))
{
if (sym_find (&program_symtab, expr, &val, 0))
val = 0;
}
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
br->keep_running = 0;
+ br->ignore_count = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
if (brkpt->keep_running)
printf (", print-only");
putchar ('\n');
}
display_t *
display_alloc (void)
{
+ unsigned int n;
+ for (n = 0; n < MAX_DISPLAYS; n++)
+ {
+ display_t *ds = &displaytab[n];
+ if (!ds->used)
+ {
+ ds->used = 1;
+ return ds;
+ }
+ }
}
void
display_free (display_t *ds)
{
}
-void
-display_print (void)
-{
-}
-
-
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
switch (typep->format)
{
case 'a':
print_addr (val);
return;
}
if (typep->format == 'x')
{
printf ("0x");
sprintf (f, "%%0%d%c", typep->size * 2, typep->format);
}
else if (typep->format == 'o')
{
printf ("0");
sprintf (f, "%%%c", typep->format);
}
else
sprintf (f, "%%%c", typep->format);
printf (f, val);
}
+void
+display_print (void)
+{
+ unsigned int n;
+ for (n = 0; n < MAX_DISPLAYS; n++)
+ {
+ display_t *ds = &displaytab[n];
+ if (ds->used)
+ {
+ printf ("%s = ", ds->expr);
+ print_value (eval (ds->expr), &ds->type);
+ putchar ('\n');
+ }
+ }
+}
+
+
+
int
print_insn (absolute_address_t addr)
{
char buf[64];
int size = dasm (buf, addr);
printf ("%s", buf);
return size;
}
void
do_examine (void)
{
unsigned int n;
unsigned int objs_per_line = 16;
if (isdigit (*command_flags))
examine_repeat = strtoul (command_flags, &command_flags, 0);
if (*command_flags == 's' || *command_flags == 'i')
examine_type.format = *command_flags;
else
parse_format_flag (command_flags, &examine_type.format);
parse_size_flag (command_flags, &examine_type.size);
switch (examine_type.format)
{
case 'i':
objs_per_line = 1;
break;
case 'w':
objs_per_line = 8;
break;
}
for (n = 0; n < examine_repeat; n++)
{
if ((n % objs_per_line) == 0)
{
putchar ('\n');
print_addr (examine_addr);
printf (": ");
}
switch (examine_type.format)
{
case 's': /* string */
break;
case 'i': /* instruction */
examine_addr += print_insn (examine_addr);
break;
default:
print_value (target_read (examine_addr, examine_type.size),
&examine_type);
putchar (' ');
examine_addr += examine_type.size;
}
}
putchar ('\n');
}
void
do_print (const char *expr)
{
unsigned long val = eval (expr);
printf ("$%d = ", history_count);
parse_format_flag (command_flags, &print_type.format);
parse_size_flag (command_flags, &print_type.size);
print_value (val, &print_type);
putchar ('\n');
save_value (val);
}
void
do_set (const char *expr)
{
unsigned long val = eval (expr);
save_value (val);
}
+#define THREAD_DATA_PC 3
+#define THREAD_DATA_ROMBANK 9
+
+void
+print_thread_data (absolute_address_t th)
+{
+ U8 b;
+ U16 w;
+ absolute_address_t pc;
+
+ w = abs_read16 (th + THREAD_DATA_PC);
+ b = abs_read8 (th + THREAD_DATA_ROMBANK);
+ printf ("{ PC = %04X, BANK = %02X }", w, b);
+}
+
+
+void
+command_change_thread (void)
+{
+ target_addr_t addr = target_read (thread_current, thread_id_size);
+ absolute_address_t th = to_absolute (addr);
+ if (th == thread_id)
+ return;
+
+ thread_id = th;
+ if (addr)
+ {
+ printf ("[Current thread = ");
+ print_addr (thread_id);
+ print_thread_data (thread_id);
+ printf ("]\n");
+ }
+ else
+ printf ("[ No thread ]\n");
+}
+
char *
getarg (void)
{
return strtok (NULL, " \t\n");
}
/****************** Command Handlers ************************/
void cmd_print (void)
{
const char *arg = getarg ();
if (arg)
do_print (arg);
else
do_print ("$");
}
void cmd_set (void)
{
const char *arg = getarg ();
if (arg)
do_set (arg);
else
do_set ("$");
}
void cmd_examine (void)
{
const char *arg = getarg ();
if (arg)
examine_addr = eval_mem (arg);
do_examine ();
}
void cmd_break (void)
{
const char *arg = getarg ();
+ if (!arg)
+ return;
unsigned long val = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = val;
br->on_execute = 1;
brkprint (br);
}
void cmd_watch1 (int on_read, int on_write)
{
const char *arg;
arg = getarg ();
+ if (!arg)
+ return;
absolute_address_t addr = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = addr;
br->on_read = on_read;
br->on_write = on_write;
arg = getarg ();
if (!arg)
return;
if (!strcmp (arg, "print"))
br->keep_running = 1;
brkprint (br);
}
void cmd_watch (void)
{
cmd_watch1 (0, 1);
}
void cmd_rwatch (void)
{
cmd_watch1 (1, 0);
}
void cmd_awatch (void)
{
cmd_watch1 (1, 1);
}
void cmd_break_list (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
brkprint (&breaktab[n]);
}
void cmd_step_next (void)
{
auto_break_insn_count = 1;
exit_command_loop = 0;
}
void cmd_continue (void)
{
exit_command_loop = 0;
}
void cmd_quit (void)
{
cpu_quit = 0;
exit_command_loop = 1;
}
void cmd_delete (void)
{
const char *arg = getarg ();
- unsigned int id = atoi (arg);
+ unsigned int id;
+
+ if (!arg)
+ {
+ int n;
+ printf ("Deleting all breakpoints.\n");
+ for (id = 0; id < MAX_BREAKS; id++)
+ {
+ breakpoint_t *br = brkfind_by_id (id);
+ brkfree (br);
+ }
+ return;
+ }
+
+ id = atoi (arg);
breakpoint_t *br = brkfind_by_id (id);
if (br->used)
{
printf ("Deleting breakpoint %d\n", id);
brkfree (br);
}
}
void cmd_list (void)
{
char *arg;
static absolute_address_t lastpc = 0;
static absolute_address_t lastaddr = 0;
absolute_address_t addr;
int n;
arg = getarg ();
if (arg)
addr = eval_mem (arg);
else
{
addr = to_absolute (get_pc ());
if (addr == lastpc)
addr = lastaddr;
else
lastaddr = lastpc = addr;
}
for (n = 0; n < 10; n++)
{
print_addr (addr);
printf (" : ");
addr += print_insn (addr);
putchar ('\n');
}
lastaddr = addr;
}
+
+void cmd_symbol_file (void)
+{
+ char *arg = getarg ();
+ if (arg)
+ load_map_file (arg);
+}
+
+
+void cmd_display (void)
+{
+ display_t *ds = display_alloc ();
+ strcpy (ds->expr, getarg ());
+ ds->type = print_type;
+ parse_format_flag (command_flags, &ds->type.format);
+ parse_size_flag (command_flags, &ds->type.size);
+}
+
+
+void cmd_script (void)
+{
+ char *arg = getarg ();
+ FILE *infile;
+ extern int command_exec (FILE *);
+
+ if (!arg)
+ return;
+
+ infile = fopen (arg, "r");
+ if (!infile)
+ {
+ fprintf (stderr, "can't open %s\n", arg);
+ return;
+ }
+
+ while (command_exec (infile) >= 0);
+ fclose (infile);
+}
+
+
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
{ "s", "step", cmd_step_next,
"Step to the next instruction" },
{ "n", "next", cmd_step_next,
"Continue up to the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
{ "wa", "watch", cmd_watch,
"Add a watchpoint on write" },
{ "rwa", "rwatch", cmd_rwatch,
"Add a watchpoint on read" },
{ "awa", "awatch", cmd_awatch,
"Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
{ "l", "list", cmd_list },
+ { "sym", "symbol-file", cmd_symbol_file,
+ "Open a symbol table file" },
+ { "di", "display", cmd_display,
+ "Add a display expression" },
+ { "scr", "script", cmd_script,
+ "Run a command script" },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
{ "f", "file", cmd_file,
"Choose the program to be debugged" },
{ "exe", "exec-file", cmd_exec_file,
"Open an executable" },
- { "sym", "symbol-file", cmd_symbol_file,
- "Open a symbol table file" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
/* TODO - look for a match anywhere between
* the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
- unsigned int n;
- for (n = 0; n < MAX_DISPLAYS; n++)
- {
- display_t *ds = &displaytab[n];
- if (ds->used)
- {
- }
- }
-
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
void
print_current_insn (void)
{
absolute_address_t addr = to_absolute (get_pc ());
print_addr (addr);
printf (" : ");
print_insn (addr);
putchar ('\n');
}
int
-command_loop (void)
+command_exec (FILE *infile)
{
char buffer[256];
char prev_buffer[256];
char *cmd;
command_handler_t handler;
int rc;
+ do {
+ errno = 0;
+ fgets (buffer, 255, infile);
+ if (feof (infile))
+ return -1;
+ } while (errno != 0);
+
+ if (buffer[0] == '\n')
+ strcpy (buffer, prev_buffer);
+
+ cmd = strtok (buffer, " \t\n");
+ if (!cmd)
+ return 0;
+
+ strcpy (prev_buffer, cmd);
+
+ handler = command_lookup (cmd);
+ if (!handler)
+ {
+ syntax_error ("no such command");
+ return 0;
+ }
+
+ (*handler) ();
+ return 0;
+}
+
+
+int
+command_loop (void)
+{
+ display_print ();
print_current_insn ();
exit_command_loop = -1;
while (exit_command_loop < 0)
{
command_prompt ();
-
- do {
- errno = 0;
- fgets (buffer, 255, stdin);
- } while (errno != 0);
-
- if (feof (stdin))
+ if (command_exec (stdin) < 0)
break;
+ }
+ return (exit_command_loop);
+}
- if (buffer[0] == '\n')
- strcpy (buffer, prev_buffer);
- cmd = strtok (buffer, " \t\n");
- if (!cmd)
- continue;
- strcpy (prev_buffer, cmd);
+void
+breakpoint_hit (breakpoint_t *br)
+{
+ if (br->threaded)
+ {
+ }
- handler = command_lookup (cmd);
- if (!handler)
- {
- syntax_error ("no such command");
- continue;
- }
+ if (br->conditional)
+ {
+ }
- (*handler) ();
+ if (br->ignore_count)
+ {
+ --br->ignore_count;
+ return;
}
- return (exit_command_loop);
+
+ monitor_on = !br->keep_running;
}
void
command_insn_hook (void)
{
absolute_address_t abspc;
breakpoint_t *br;
if (active_break_count == 0)
return;
abspc = to_absolute (get_pc ());
br = brkfind_by_addr (abspc);
if (br && br->enabled && br->on_execute)
{
printf ("Breakpoint %d reached.\n", br->id);
- monitor_on = 1;
+ breakpoint_hit (br);
}
}
void
command_read_hook (absolute_address_t addr)
{
breakpoint_t *br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_read)
{
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf ("]\n");
- monitor_on = !br->keep_running;
+ breakpoint_hit (br);
}
}
void
command_write_hook (absolute_address_t addr, U8 val)
{
- breakpoint_t *br = brkfind_by_addr (addr);
+ breakpoint_t *br;
+
+ br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_write)
{
printf ("Watchpoint %d triggered. [", br->id);
print_addr (addr);
printf (" = 0x%02X", val);
printf ("]\n");
- monitor_on = !br->keep_running;
+ breakpoint_hit (br);
+ }
+
+ if (thread_id_size && (addr == thread_current + thread_id_size - 1))
+ {
+ command_change_thread ();
}
}
void pc_virtual (unsigned long *val, int writep) {
writep ? set_pc (*val) : (*val = get_pc ());
}
void x_virtual (unsigned long *val, int writep) {
writep ? set_x (*val) : (*val = get_x ());
}
void y_virtual (unsigned long *val, int writep) {
writep ? set_y (*val) : (*val = get_y ());
}
void u_virtual (unsigned long *val, int writep) {
writep ? set_u (*val) : (*val = get_u ());
}
void s_virtual (unsigned long *val, int writep) {
writep ? set_s (*val) : (*val = get_s ());
}
void d_virtual (unsigned long *val, int writep) {
writep ? set_d (*val) : (*val = get_d ());
}
void dp_virtual (unsigned long *val, int writep) {
writep ? set_dp (*val) : (*val = get_dp ());
}
void cc_virtual (unsigned long *val, int writep) {
writep ? set_cc (*val) : (*val = get_cc ());
}
void cycles_virtual (unsigned long *val, int writep)
{
if (!writep)
*val = get_cycles ();
}
void
command_periodic (int signo)
{
static unsigned long last_cycles = 0;
if (!monitor_on && signo == SIGALRM)
{
/* TODO */
#if 0
unsigned long diff = get_cycles () - last_cycles;
printf ("%d cycles in 50ms\n");
last_cycles += diff;
#endif
}
}
void
command_irq_hook (unsigned long cycles)
{
//printf ("IRQ took %lu cycles\n", cycles);
}
void
command_init (void)
{
struct itimerval itimer;
struct sigaction sact;
int rc;
- sym_add (&internal_symtab, "pc", (unsigned long)pc_virtual, SYM_REGISTER);
- sym_add (&internal_symtab, "x", (unsigned long)x_virtual, SYM_REGISTER);
- sym_add (&internal_symtab, "y", (unsigned long)y_virtual, SYM_REGISTER);
- sym_add (&internal_symtab, "u", (unsigned long)u_virtual, SYM_REGISTER);
- sym_add (&internal_symtab, "s", (unsigned long)s_virtual, SYM_REGISTER);
- sym_add (&internal_symtab, "d", (unsigned long)d_virtual, SYM_REGISTER);
- sym_add (&internal_symtab, "dp", (unsigned long)dp_virtual, SYM_REGISTER);
- sym_add (&internal_symtab, "cc", (unsigned long)cc_virtual, SYM_REGISTER);
- sym_add (&internal_symtab, "cycles", (unsigned long)cycles_virtual, SYM_REGISTER);
+ sym_add (&auto_symtab, "pc", (unsigned long)pc_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "x", (unsigned long)x_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "y", (unsigned long)y_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "u", (unsigned long)u_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "s", (unsigned long)s_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "d", (unsigned long)d_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "dp", (unsigned long)dp_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "cc", (unsigned long)cc_virtual, SYM_AUTO);
+ sym_add (&auto_symtab, "cycles", (unsigned long)cycles_virtual, SYM_AUTO);
examine_type.format = 'x';
examine_type.size = 1;
print_type.format = 'x';
print_type.size = 1;
sigemptyset (&sact.sa_mask);
sact.sa_flags = 0;
sact.sa_handler = command_periodic;
sigaction (SIGALRM, &sact, NULL);
itimer.it_interval.tv_sec = 0;
itimer.it_interval.tv_usec = PERIODIC_INTERVAL * 1000;
itimer.it_value.tv_sec = 0;
itimer.it_value.tv_usec = PERIODIC_INTERVAL * 1000;
rc = setitimer (ITIMER_REAL, &itimer, NULL);
if (rc < 0)
fprintf (stderr, "couldn't register interval timer\n");
}
/* vim: set ts=3: */
/* vim: set expandtab: */
diff --git a/monitor.c b/monitor.c
index ad8a296..1a9e071 100755
--- a/monitor.c
+++ b/monitor.c
@@ -1,1508 +1,1432 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006-2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include "monitor.h"
#include <ctype.h>
#include <signal.h>
-/* A container for all symbol table information */
-struct symbol_table symtab;
-
/* The function call stack */
struct function_call fctab[MAX_FUNCTION_CALLS];
/* The top of the function call stack */
struct function_call *current_function_call;
/* Automatically break after executing this many instructions */
int auto_break_insn_count = 0;
int monitor_on = 0;
enum addr_mode
{
_illegal, _implied, _imm_byte, _imm_word, _direct, _extended,
_indexed, _rel_byte, _rel_word, _reg_post, _sys_post, _usr_post
};
enum opcode
{
_undoc, _abx, _adca, _adcb, _adda, _addb, _addd, _anda, _andb,
_andcc, _asla, _aslb, _asl, _asra, _asrb, _asr, _bcc, _lbcc,
_bcs, _lbcs, _beq, _lbeq, _bge, _lbge, _bgt, _lbgt, _bhi,
_lbhi, _bita, _bitb, _ble, _lble, _bls, _lbls, _blt, _lblt,
_bmi, _lbmi, _bne, _lbne, _bpl, _lbpl, _bra, _lbra, _brn,
_lbrn, _bsr, _lbsr, _bvc, _lbvc, _bvs, _lbvs, _clra, _clrb,
_clr, _cmpa, _cmpb, _cmpd, _cmps, _cmpu, _cmpx, _cmpy, _coma,
_comb, _com, _cwai, _daa, _deca, _decb, _dec, _eora, _eorb,
_exg, _inca, _incb, _inc, _jmp, _jsr, _lda, _ldb, _ldd,
_lds, _ldu, _ldx, _ldy, _leas, _leau, _leax, _leay, _lsra,
_lsrb, _lsr, _mul, _nega, _negb, _neg, _nop, _ora, _orb,
_orcc, _pshs, _pshu, _puls, _pulu, _rola, _rolb, _rol, _rora,
_rorb, _ror, _rti, _rts, _sbca, _sbcb, _sex, _sta, _stb,
_std, _sts, _stu, _stx, _sty, _suba, _subb, _subd, _swi,
_swi2, _swi3, _sync, _tfr, _tsta, _tstb, _tst, _reset,
#ifdef H6309
_negd, _comd, _lsrd, _rord, _asrd, _rold, _decd, _incd, _tstd,
_clrd
#endif
};
char *mne[] = {
"???", "ABX", "ADCA", "ADCB", "ADDA", "ADDB", "ADDD", "ANDA", "ANDB",
"ANDCC", "ASLA", "ASLB", "ASL", "ASRA", "ASRB", "ASR", "BCC", "LBCC",
"BCS", "LBCS", "BEQ", "LBEQ", "BGE", "LBGE", "BGT", "LBGT", "BHI",
"LBHI", "BITA", "BITB", "BLE", "LBLE", "BLS", "LBLS", "BLT", "LBLT",
"BMI", "LBMI", "BNE", "LBNE", "BPL", "LBPL", "BRA", "LBRA", "BRN",
"LBRN", "BSR", "LBSR", "BVC", "LBVC", "BVS", "LBVS", "CLRA", "CLRB",
"CLR", "CMPA", "CMPB", "CMPD", "CMPS", "CMPU", "CMPX", "CMPY", "COMA",
"COMB", "COM", "CWAI", "DAA", "DECA", "DECB", "DEC", "EORA", "EORB",
"EXG", "INCA", "INCB", "INC", "JMP", "JSR", "LDA", "LDB", "LDD",
"LDS", "LDU", "LDX", "LDY", "LEAS", "LEAU", "LEAX", "LEAY", "LSRA",
"LSRB", "LSR", "MUL", "NEGA", "NEGB", "NEG", "NOP", "ORA", "ORB",
"ORCC", "PSHS", "PSHU", "PULS", "PULU", "ROLA", "ROLB", "ROL", "RORA",
"RORB", "ROR", "RTI", "RTS", "SBCA", "SBCB", "SEX", "STA", "STB",
"STD", "STS", "STU", "STX", "STY", "SUBA", "SUBB", "SUBD", "SWI",
"SWI2", "SWI3", "SYNC", "TFR", "TSTA", "TSTB", "TST", "RESET",
#ifdef H6309
"NEGD", "COMD", "LSRD", "RORD", "ASRD", "ROLD", "DECD",
"INCD", "TSTD", "CLRD",
#endif
};
typedef struct
{
UINT8 code;
UINT8 mode;
} opcode_t;
opcode_t codes[256] = {
{_neg, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_com, _direct},
{_lsr, _direct},
{_undoc, _illegal},
{_ror, _direct},
{_asr, _direct},
{_asl, _direct},
{_rol, _direct},
{_dec, _direct},
{_undoc, _illegal},
{_inc, _direct},
{_tst, _direct},
{_jmp, _direct},
{_clr, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_nop, _implied},
{_sync, _implied},
{_undoc, _illegal},
{_undoc, _illegal},
{_lbra, _rel_word},
{_lbsr, _rel_word},
{_undoc, _illegal},
{_daa, _implied},
{_orcc, _imm_byte},
{_undoc, _illegal},
{_andcc, _imm_byte},
{_sex, _implied},
{_exg, _reg_post},
{_tfr, _reg_post},
{_bra, _rel_byte},
{_brn, _rel_byte},
{_bhi, _rel_byte},
{_bls, _rel_byte},
{_bcc, _rel_byte},
{_bcs, _rel_byte},
{_bne, _rel_byte},
{_beq, _rel_byte},
{_bvc, _rel_byte},
{_bvs, _rel_byte},
{_bpl, _rel_byte},
{_bmi, _rel_byte},
{_bge, _rel_byte},
{_blt, _rel_byte},
{_bgt, _rel_byte},
{_ble, _rel_byte},
{_leax, _indexed},
{_leay, _indexed},
{_leas, _indexed},
{_leau, _indexed},
{_pshs, _sys_post},
{_puls, _sys_post},
{_pshu, _usr_post},
{_pulu, _usr_post},
{_undoc, _illegal},
{_rts, _implied},
{_abx, _implied},
{_rti, _implied},
{_cwai, _imm_byte},
{_mul, _implied},
{_reset, _implied},
{_swi, _implied},
{_nega, _implied},
{_undoc, _illegal},
{_undoc, _illegal},
{_coma, _implied},
{_lsra, _implied},
{_undoc, _illegal},
{_rora, _implied},
{_asra, _implied},
{_asla, _implied},
{_rola, _implied},
{_deca, _implied},
{_undoc, _illegal},
{_inca, _implied},
{_tsta, _implied},
{_undoc, _illegal},
{_clra, _implied},
{_negb, _implied},
{_undoc, _illegal},
{_undoc, _illegal},
{_comb, _implied},
{_lsrb, _implied},
{_undoc, _illegal},
{_rorb, _implied},
{_asrb, _implied},
{_aslb, _implied},
{_rolb, _implied},
{_decb, _implied},
{_undoc, _illegal},
{_incb, _implied},
{_tstb, _implied},
{_undoc, _illegal},
{_clrb, _implied},
{_neg, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_com, _indexed},
{_lsr, _indexed},
{_undoc, _illegal},
{_ror, _indexed},
{_asr, _indexed},
{_asl, _indexed},
{_rol, _indexed},
{_dec, _indexed},
{_undoc, _illegal},
{_inc, _indexed},
{_tst, _indexed},
{_jmp, _indexed},
{_clr, _indexed},
{_neg, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_com, _extended},
{_lsr, _extended},
{_undoc, _illegal},
{_ror, _extended},
{_asr, _extended},
{_asl, _extended},
{_rol, _extended},
{_dec, _extended},
{_undoc, _illegal},
{_inc, _extended},
{_tst, _extended},
{_jmp, _extended},
{_clr, _extended},
{_suba, _imm_byte},
{_cmpa, _imm_byte},
{_sbca, _imm_byte},
{_subd, _imm_word},
{_anda, _imm_byte},
{_bita, _imm_byte},
{_lda, _imm_byte},
{_undoc, _illegal},
{_eora, _imm_byte},
{_adca, _imm_byte},
{_ora, _imm_byte},
{_adda, _imm_byte},
{_cmpx, _imm_word},
{_bsr, _rel_byte},
{_ldx, _imm_word},
{_undoc, _illegal},
{_suba, _direct},
{_cmpa, _direct},
{_sbca, _direct},
{_subd, _direct},
{_anda, _direct},
{_bita, _direct},
{_lda, _direct},
{_sta, _direct},
{_eora, _direct},
{_adca, _direct},
{_ora, _direct},
{_adda, _direct},
{_cmpx, _direct},
{_jsr, _direct},
{_ldx, _direct},
{_stx, _direct},
{_suba, _indexed},
{_cmpa, _indexed},
{_sbca, _indexed},
{_subd, _indexed},
{_anda, _indexed},
{_bita, _indexed},
{_lda, _indexed},
{_sta, _indexed},
{_eora, _indexed},
{_adca, _indexed},
{_ora, _indexed},
{_adda, _indexed},
{_cmpx, _indexed},
{_jsr, _indexed},
{_ldx, _indexed},
{_stx, _indexed},
{_suba, _extended},
{_cmpa, _extended},
{_sbca, _extended},
{_subd, _extended},
{_anda, _extended},
{_bita, _extended},
{_lda, _extended},
{_sta, _extended},
{_eora, _extended},
{_adca, _extended},
{_ora, _extended},
{_adda, _extended},
{_cmpx, _extended},
{_jsr, _extended},
{_ldx, _extended},
{_stx, _extended},
{_subb, _imm_byte},
{_cmpb, _imm_byte},
{_sbcb, _imm_byte},
{_addd, _imm_word},
{_andb, _imm_byte},
{_bitb, _imm_byte},
{_ldb, _imm_byte},
{_undoc, _illegal},
{_eorb, _imm_byte},
{_adcb, _imm_byte},
{_orb, _imm_byte},
{_addb, _imm_byte},
{_ldd, _imm_word},
{_undoc, _illegal},
{_ldu, _imm_word},
{_undoc, _illegal},
{_subb, _direct},
{_cmpb, _direct},
{_sbcb, _direct},
{_addd, _direct},
{_andb, _direct},
{_bitb, _direct},
{_ldb, _direct},
{_stb, _direct},
{_eorb, _direct},
{_adcb, _direct},
{_orb, _direct},
{_addb, _direct},
{_ldd, _direct},
{_std, _direct},
{_ldu, _direct},
{_stu, _direct},
{_subb, _indexed},
{_cmpb, _indexed},
{_sbcb, _indexed},
{_addd, _indexed},
{_andb, _indexed},
{_bitb, _indexed},
{_ldb, _indexed},
{_stb, _indexed},
{_eorb, _indexed},
{_adcb, _indexed},
{_orb, _indexed},
{_addb, _indexed},
{_ldd, _indexed},
{_std, _indexed},
{_ldu, _indexed},
{_stu, _indexed},
{_subb, _extended},
{_cmpb, _extended},
{_sbcb, _extended},
{_addd, _extended},
{_andb, _extended},
{_bitb, _extended},
{_ldb, _extended},
{_stb, _extended},
{_eorb, _extended},
{_adcb, _extended},
{_orb, _extended},
{_addb, _extended},
{_ldd, _extended},
{_std, _extended},
{_ldu, _extended},
{_stu, _extended}
};
opcode_t codes10[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lbrn, _rel_word},
{_lbhi, _rel_word},
{_lbls, _rel_word},
{_lbcc, _rel_word},
{_lbcs, _rel_word},
{_lbne, _rel_word},
{_lbeq, _rel_word},
{_lbvc, _rel_word},
{_lbvs, _rel_word},
{_lbpl, _rel_word},
{_lbmi, _rel_word},
{_lbge, _rel_word},
{_lblt, _rel_word},
{_lbgt, _rel_word},
{_lble, _rel_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_swi2, _implied},
{_undoc, _illegal}, /* 10 40 */
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _imm_word},
{_undoc, _illegal},
{_ldy, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _direct},
{_undoc, _illegal},
{_ldy, _direct},
{_sty, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _indexed},
{_undoc, _illegal},
{_ldy, _indexed},
{_sty, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _extended},
{_undoc, _illegal},
{_ldy, _extended},
{_sty, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _direct},
{_sts, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _indexed},
{_sts, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _extended},
{_sts, _extended}
};
opcode_t codes11[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_swi3, _implied},
{_undoc, _illegal}, /* 11 40 */
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal}
};
char *reg[] = {
"D", "X", "Y", "U", "S", "PC", "??", "??",
"A", "B", "CC", "DP", "??", "??", "??", "??"
};
char index_reg[] = { 'X', 'Y', 'U', 'S' };
char *off4[] = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15",
"-16", "-15", "-14", "-13", "-12", "-11", "-10", "-9",
"-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"
};
-void
-add_named_symbol (const char *id, target_addr_t value, const char *filename)
-{
- struct x_symbol *sym;
- static char *last_filename = "";
-
- symtab.addr_to_symbol[value] = sym = malloc (sizeof (struct x_symbol));
- sym->flags = S_NAMED;
- sym->u.named.id = symtab.name_area_next;
- sym->u.named.addr = value;
-
- strcpy (symtab.name_area_next, id);
- symtab.name_area_next += strlen (symtab.name_area_next) + 1;
-
- if (!filename)
- filename = "";
-
- if (strcmp (filename, last_filename))
- {
- last_filename = symtab.name_area_next;
- strcpy (last_filename, filename);
- symtab.name_area_next += strlen (symtab.name_area_next) + 1;
- }
- sym->u.named.file = last_filename;
-}
-
-
-struct x_symbol *
-find_symbol (target_addr_t value)
-{
- struct x_symbol *sym = NULL;
-
-#if 1
- return NULL;
-#endif
-
- while (value > 0)
- {
- sym = symtab.addr_to_symbol[value];
- if (sym)
- break;
- else
- value--;
- }
- return sym;
-}
-
-
-struct x_symbol *
-find_symbol_by_name (const char *id)
-{
- unsigned int addr;
- struct x_symbol *sym;
-
- for (addr = 0; addr < 0x10000; addr++)
- {
- sym = symtab.addr_to_symbol[addr];
- if (sym && !strcmp (sym->u.named.id, id))
- return sym;
- }
- return NULL;
-}
-
-
/* Disassemble the current instruction. Returns the number of bytes that
compose it. */
int
dasm (char *buf, absolute_address_t opc)
{
UINT8 op, am;
char *op_str;
absolute_address_t pc = opc;
char R;
int fetch1; /* the first (MSB) fetched byte, used in macro RDWORD */
op = fetch8 ();
if (op == 0x10)
{
op = fetch8 ();
am = codes10[op].mode;
op = codes10[op].code;
}
else if (op == 0x11)
{
op = fetch8 ();
am = codes11[op].mode;
op = codes11[op].code;
}
else
{
am = codes[op].mode;
op = codes[op].code;
}
op_str = (char *) mne[op];
switch (am)
{
case _illegal:
sprintf (buf, "???");
break;
case _implied:
sprintf (buf, "%s ", op_str);
break;
case _imm_byte:
sprintf (buf, "%s #$%02X", op_str, fetch8 ());
break;
case _imm_word:
sprintf (buf, "%s #$%04X", op_str, fetch16 ());
break;
case _direct:
sprintf (buf, "%s <%s", op_str, monitor_addr_name (fetch8 ()));
break;
case _extended:
sprintf (buf, "%s %s", op_str, monitor_addr_name (fetch16 ()));
break;
case _indexed:
op = fetch8 ();
R = index_reg[(op >> 5) & 0x3];
if ((op & 0x80) == 0)
{
sprintf (buf, "%s %s,%c", op_str, off4[op & 0x1f], R);
break;
}
switch (op & 0x1f)
{
case 0x00:
sprintf (buf, "%s ,%c+", op_str, R);
break;
case 0x01:
sprintf (buf, "%s ,%c++", op_str, R);
break;
case 0x02:
sprintf (buf, "%s ,-%c", op_str, R);
break;
case 0x03:
sprintf (buf, "%s ,--%c", op_str, R);
break;
case 0x04:
sprintf (buf, "%s ,%c", op_str, R);
break;
case 0x05:
sprintf (buf, "%s B,%c", op_str, R);
break;
case 0x06:
sprintf (buf, "%s A,%c", op_str, R);
break;
case 0x08:
sprintf (buf, "%s $%02X,%c", op_str, fetch8 (), R);
break;
case 0x09:
sprintf (buf, "%s $%04X,%c", op_str, fetch16 (), R);
break;
case 0x0B:
sprintf (buf, "%s D,%c", op_str, R);
break;
case 0x0C:
sprintf (buf, "%s $%02X,PC", op_str, fetch8 ());
break;
case 0x0D:
sprintf (buf, "%s $%04X,PC", op_str, fetch16 ());
break;
case 0x11:
sprintf (buf, "%s [,%c++]", op_str, R);
break;
case 0x13:
sprintf (buf, "%s [,--%c]", op_str, R);
break;
case 0x14:
sprintf (buf, "%s [,%c]", op_str, R);
break;
case 0x15:
sprintf (buf, "%s [B,%c]", op_str, R);
break;
case 0x16:
sprintf (buf, "%s [A,%c]", op_str, R);
break;
case 0x18:
sprintf (buf, "%s [$%02X,%c]", op_str, fetch8 (), R);
break;
case 0x19:
sprintf (buf, "%s [$%04X,%c]", op_str, fetch16 (), R);
break;
case 0x1B:
sprintf (buf, "%s [D,%c]", op_str, R);
break;
case 0x1C:
sprintf (buf, "%s [$%02X,PC]", op_str, fetch8 ());
break;
case 0x1D:
sprintf (buf, "%s [$%04X,PC]", op_str, fetch16 ());
break;
case 0x1F:
sprintf (buf, "%s [%s]", op_str, monitor_addr_name (fetch16 ()));
break;
default:
sprintf (buf, "%s ??", op_str);
break;
}
break;
case _rel_byte:
fetch1 = ((INT8) fetch8 ());
sprintf (buf, "%s $%04X", op_str, (fetch1 + pc) & 0xffff);
break;
case _rel_word:
sprintf (buf, "%s $%04X", op_str, (fetch16 () + pc) & 0xffff);
break;
case _reg_post:
op = fetch8 ();
sprintf (buf, "%s %s,%s", op_str, reg[op >> 4], reg[op & 15]);
break;
case _usr_post:
case _sys_post:
op = fetch8 ();
sprintf (buf, "%s ", op_str);
if (op & 0x80)
strcat (buf, "PC,");
if (op & 0x40)
strcat (buf, am == _usr_post ? "S," : "U,");
if (op & 0x20)
strcat (buf, "Y,");
if (op & 0x10)
strcat (buf, "X,");
if (op & 0x08)
strcat (buf, "DP,");
if ((op & 0x06) == 0x06)
strcat (buf, "D,");
else
{
if (op & 0x04)
strcat (buf, "B,");
if (op & 0x02)
strcat (buf, "A,");
}
if (op & 0x01)
strcat (buf, "CC,");
buf[strlen (buf) - 1] = '\0';
break;
}
return pc - opc;
}
int
sizeof_file (FILE * file)
{
int size;
fseek (file, 0, SEEK_END);
size = ftell (file);
rewind (file);
return size;
}
int
load_map_file (const char *name)
{
FILE *fp;
char map_filename[256];
char buf[256];
char *value_ptr, *id_ptr;
target_addr_t value;
char *file_ptr;
sprintf (map_filename, "%s.map", name);
fp = fopen (map_filename, "r");
if (!fp)
return -1;
for (;;)
{
fgets (buf, sizeof(buf)-1, fp);
if (feof (fp))
break;
value_ptr = buf;
if (strncmp (value_ptr, " ", 6))
continue;
while (*value_ptr == ' ')
value_ptr++;
value = strtoul (value_ptr, &id_ptr, 16);
if (id_ptr == value_ptr)
continue;
while (*id_ptr == ' ')
id_ptr++;
id_ptr = strtok (id_ptr, " \t\n");
if (((*id_ptr == 'l') || (*id_ptr == 's')) && (id_ptr[1] == '_'))
continue;
++id_ptr;
file_ptr = strtok (NULL, " \t\n");
- add_named_symbol (id_ptr, value, file_ptr);
+ sym_add (&program_symtab, id_ptr, to_absolute (value), 0); /* file_ptr? */
}
fclose (fp);
return 0;
}
int
load_hex (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = fopen (name, "r");
if (fp == NULL)
{
printf ("failed to open hex record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, ":%2x%4x%2x", &count, &addr, &type) != 3)
{
printf ("line %d: invalid hex record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff) + type;
switch (type)
{
case 0:
for (; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid hex record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 1:
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid hex record checksum \n", line);
done = 0;
break;
case 2:
default:
printf ("line %d: not supported hex type %d.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
int
load_s19 (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = fopen (name, "r");
if (fp == NULL)
{
printf ("failed to open S-record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, "S%1x%2x%4x", &type, &count, &addr) != 3)
{
printf ("line %d: invalid S record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff);
switch (type)
{
case 1:
for (count -= 3; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 9:
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
default:
printf ("line %d: S%d not supported.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
void
monitor_call (unsigned int flags)
{
#ifdef CALL_STACK
if (current_function_call <= &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call++;
current_function_call->entry_point = get_pc ();
current_function_call->flags = flags;
}
#endif
}
void
monitor_return (void)
{
#ifdef CALL_STACK
if (current_function_call > &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call--;
return;
}
while ((current_function_call->flags & FC_TAIL_CALL) &&
(current_function_call > fctab))
{
current_function_call--;
}
if (current_function_call > fctab)
current_function_call--;
#endif
}
const char *
-monitor_addr_name (target_addr_t addr)
+monitor_addr_name (target_addr_t target_addr)
{
- static char addr_name[256];
- struct x_symbol *sym;
+ static char buf[256], *bufptr;
+ const char *name;
+ absolute_address_t addr = to_absolute (target_addr);
- sym = find_symbol (addr);
- if (sym)
- {
- if (sym->u.named.addr == addr)
- return sym->u.named.id;
- else
- sprintf (addr_name, "%s+0x%X",
- sym->u.named.id, addr - sym->u.named.addr);
- }
- else
- sprintf (addr_name, "$%04X", addr);
- return addr_name;
+ bufptr = buf;
+
+ bufptr += sprintf (bufptr, "0x%04X", target_addr);
+
+ name = sym_lookup (&program_symtab, addr);
+ if (name)
+ bufptr += sprintf (bufptr, " <%s>", name);
+
+ return buf;
}
static void
monitor_signal (int sigtype)
{
(void) sigtype;
putchar ('\n');
monitor_on = 1;
}
void
monitor_init (void)
{
int tmp;
extern int debug_enabled;
target_addr_t a;
- symtab.name_area = symtab.name_area_next =
- malloc (symtab.name_area_free = 0x100000);
- a = 0;
- do {
- symtab.addr_to_symbol[a] = NULL;
- } while (++a != 0);
-
fctab[0].entry_point = read16 (0xfffe);
memset (&fctab[0].entry_regs, 0, sizeof (struct cpu_regs));
current_function_call = &fctab[0];
auto_break_insn_count = 0;
monitor_on = debug_enabled;
signal (SIGINT, monitor_signal);
}
int
check_break (unsigned break_pc)
{
if (auto_break_insn_count > 0)
if (--auto_break_insn_count == 0)
return 1;
return 0;
}
void
cmd_show (void)
{
int cc = get_cc ();
int pc = get_pc ();
char inst[50];
int offset, moffset;
moffset = dasm (inst, pc);
printf ("S $%04X U $%04X X $%04X Y $%04X EFHINZVC\n", get_s (),
get_u (), get_x (), get_y ());
printf ("A $%02X B $%02X DP $%02X CC $%02X ", get_a (),
get_b (), get_dp (), cc);
printf ("%c%c%c%c", (cc & E_FLAG ? '1' : '.'), (cc & F_FLAG ? '1' : '.'),
(cc & H_FLAG ? '1' : '.'), (cc & I_FLAG ? '1' : '.'));
printf ("%c%c%c%c\n", (cc & N_FLAG ? '1' : '.'), (cc & Z_FLAG ? '1' : '.'),
(cc & V_FLAG ? '1' : '.'), (cc & C_FLAG ? '1' : '.'));
printf ("PC: %s ", monitor_addr_name (pc));
printf ("Cycle %lX ", total);
for (offset = 0; offset < moffset; offset++)
printf ("%02X", read8 (offset+pc));
printf (" NextInst: %s\n", inst);
}
void
monitor_prompt (void)
{
char inst[50];
target_addr_t pc = get_pc ();
dasm (inst, pc);
printf ("S:%04X U:%04X X:%04X Y:%04X D:%04X\n",
get_s (), get_u (), get_x (), get_y (), get_d ());
printf ("%30.30s %s\n", monitor_addr_name (pc), inst);
}
void
monitor_backtrace (void)
{
struct function_call *fc = current_function_call;
while (fc >= &fctab[0]) {
printf ("%s\n", monitor_addr_name (fc->entry_point));
fc--;
}
}
int
monitor6809 (void)
{
int rc;
signal (SIGINT, monitor_signal);
rc = command_loop ();
monitor_on = 0;
return rc;
}
diff --git a/symtab.c b/symtab.c
index 524d333..1e0866c 100755
--- a/symtab.c
+++ b/symtab.c
@@ -1,160 +1,197 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of the Portable 6809 Simulator.
*
* The Simulator 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.
*
* The Simulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct stringspace *current_stringspace;
struct symtab program_symtab;
struct symtab internal_symtab;
+struct symtab auto_symtab;
+
struct stringspace *stringspace_create (void)
{
struct stringspace *ss = malloc (sizeof (struct stringspace));
ss->used = 0;
return ss;
}
char *stringspace_copy (const char *string)
{
unsigned int len = strlen (string) + 1;
char *result;
if (current_stringspace->used + len > MAX_STRINGSPACE)
current_stringspace = stringspace_create ();
result = current_stringspace->space + current_stringspace->used;
strcpy (result, string);
current_stringspace->used += len;
return result;
}
unsigned int sym_hash_name (const char *name)
{
unsigned int hash = *name & 0x1F;
if (*name++ != '\0')
{
hash = (hash << 11) + (544 * *name);
if (*name++ != '\0')
{
hash = (hash << 5) + (17 * *name);
}
}
return hash % MAX_SYMBOL_HASH;
}
unsigned int sym_hash_value (unsigned long value)
{
return value % MAX_SYMBOL_HASH;
}
/**
* Lookup the symbol 'name'.
* Returns 0 if the symbol exists (and optionally stores its value
* in *value if not NULL), or -1 if it does not exist.
*/
-int sym_find (struct symtab *symtab,
- const char *name, unsigned long *value, unsigned int type)
+struct symbol *sym_find1 (struct symtab *symtab,
+ const char *name, unsigned long *value,
+ unsigned int type)
{
unsigned int hash = sym_hash_name (name);
/* Search starting in the current symbol table, and if that fails,
* try its parent tables. */
while (symtab != NULL)
{
/* Find the list of elements that hashed to this string. */
struct symbol *chain = symtab->syms_by_name[hash];
/* Scan the list for an exact match, and return it. */
while (chain != NULL)
{
if (!strcmp (name, chain->name))
{
if (type && (chain->type != type))
- return -1;
+ return NULL;
if (value)
- *value = chain->value;
- return 0;
+ *value = chain->value;
+ return chain;
}
- chain = chain->chain;
+ chain = chain->name_chain;
}
symtab = symtab->parent;
}
- return -1;
+ return NULL;
}
+
+int sym_find (struct symtab *symtab,
+ const char *name, unsigned long *value, unsigned int type)
+{
+ return sym_find1 (symtab, name, value, type) ? 0 : -1;
+}
+
+
const char *sym_lookup (struct symtab *symtab, unsigned long value)
{
unsigned int hash = sym_hash_value (value);
while (symtab != NULL)
{
struct symbol *chain = symtab->syms_by_value[hash];
while (chain != NULL)
{
if (value == chain->value)
return chain->name;
- chain = chain->chain;
+ chain = chain->value_chain;
}
symtab = symtab->parent;
}
return NULL;
}
void sym_add (struct symtab *symtab,
const char *name, unsigned long value, unsigned int type)
{
unsigned int hash;
struct symbol *s, *chain;
s = malloc (sizeof (struct symbol));
s->name = stringspace_copy (name);
s->value = value;
s->type = type;
hash = sym_hash_name (name);
chain = symtab->syms_by_name[hash];
- s->chain = chain;
+ s->name_chain = chain;
symtab->syms_by_name[hash] = s;
hash = sym_hash_value (value);
chain = symtab->syms_by_value[hash];
- s->chain = chain;
+ s->value_chain = chain;
symtab->syms_by_value[hash] = s;
}
+void sym_set (struct symtab *symtab,
+ const char *name, unsigned long value, unsigned int type)
+{
+ struct symbol * s = sym_find1 (symtab, name, NULL, type);
+ if (s)
+ s->value = value;
+ else
+ sym_add (symtab, name, value, type);
+}
+
+
+void symtab_init (struct symtab *symtab)
+{
+ memset (symtab, 0, sizeof (struct symtab));
+}
+
+
+void symtab_reset (struct symtab *symtab)
+{
+ /* TODO */
+ symtab_init (symtab);
+}
+
+
void sym_init (void)
{
current_stringspace = stringspace_create ();
- memset (&program_symtab, 0, sizeof (program_symtab));
- memset (&internal_symtab, 0, sizeof (internal_symtab));
+
+ symtab_init (&program_symtab);
+ symtab_init (&internal_symtab);
+ symtab_init (&auto_symtab);
}
diff --git a/wpc.c b/wpc.c
index 0e37fea..fa7d615 100755
--- a/wpc.c
+++ b/wpc.c
@@ -1,403 +1,400 @@
/*
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include <sys/time.h>
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3800
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
U8 lamp_strobe;
U8 lamp_mx[8];
U8 sols[6];
U8 switch_strobe;
U8 switch_mx[8];
U8 directsw;
};
void wpc_asic_reset (struct hw_device *dev)
{
struct wpc_asic *wpc = dev->priv;
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
- {
rc |= WPC_DEBUG_READ_READY;
- printf ("read ready!\n");
- }
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
static int scanbit (U8 val)
{
if (val & 0x80) return 7;
else if (val & 0x40) return 6;
else if (val & 0x20) return 5;
else if (val & 0x10) return 4;
else if (val & 0x08) return 3;
else if (val & 0x04) return 2;
else if (val & 0x02) return 1;
else if (val & 0x01) return 0;
else return -1;
}
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
struct wpc_asic *wpc = dev->priv;
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit % 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (struct wpc_asic *wpc)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct wpc_asic *wpc = dev->priv;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
/* ignore for now */
break;
case WPC_ROM_BANK:
wpc->rombank = val;
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram (wpc);
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram (wpc);
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
case WPC_LAMP_ROW_OUTPUT:
wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
break;
case WPC_LAMP_COL_STROBE:
wpc->lamp_strobe = val;
break;
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
void wpc_periodic (void)
{
}
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
struct wpc_asic *wpc = calloc (sizeof (struct wpc_asic), 1);
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
struct machine wpc_machine =
{
.fault = wpc_fault,
};
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
struct wpc_asic *wpc;
machine = &wpc_machine;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
wpc = dev->priv;
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
wpc_update_ram (wpc);
sym_add (&program_symtab, "WPC_ROM_BANK", to_absolute (WPC_ROM_BANK), 0);
}
|
bcd/exec09
|
b569ecb7893691af3cd9c5cf4b844d1b5febe48b
|
Continued improvements:
|
diff --git a/6809.c b/6809.c
old mode 100644
new mode 100755
index 3764570..683361e
--- a/6809.c
+++ b/6809.c
@@ -1,558 +1,559 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include "monitor.h"
#include <stdarg.h>
unsigned X, Y, S, U, PC;
unsigned A, B, DP;
unsigned H, N, Z, OV, C;
unsigned EFI;
#ifdef H6309
unsigned E, F, V, MD;
#define MD_NATIVE 0x1 /* if 1, execute in 6309 mode */
#define MD_FIRQ_LIKE_IRQ 0x2 /* if 1, FIRQ acts like IRQ */
#define MD_ILL 0x40 /* illegal instruction */
#define MD_DBZ 0x80 /* divide by zero */
#endif /* H6309 */
unsigned iPC;
+unsigned long irq_start_time;
unsigned ea = 0;
-int cpu_clk = 0;
-int cpu_period = 0;
+long cpu_clk = 0;
+long cpu_period = 0;
int cpu_quit = 1;
unsigned int irqs_pending = 0;
unsigned int firqs_pending = 0;
unsigned *index_regs[4] = { &X, &Y, &U, &S };
extern int dump_cycles_on_success;
extern int trace_enabled;
extern void irq (void);
void request_irq (unsigned int source)
{
/* If the interrupt is not masked, generate
* IRQ immediately. Else, mark it pending and
* we'll check it later when the flags change.
*/
//printf ("request IRQ : pending=%02X flags=%02X\n", irqs_pending, EFI);
irqs_pending |= (1 << source);
if (!(EFI & I_FLAG))
irq ();
}
void release_irq (unsigned int source)
{
irqs_pending &= ~(1 << source);
}
static inline void
check_pc (void)
{
/* TODO */
}
static inline void
check_stack (void)
{
/* TODO */
}
void
sim_error (const char *format, ...)
{
va_list ap;
va_start (ap, format);
fprintf (stderr, "m6809-run: (at PC=%04X) ", iPC);
vfprintf (stderr, format, ap);
va_end (ap);
if (debug_enabled)
monitor_on = 1;
else
exit (2);
}
unsigned long
get_cycles (void)
{
return total + cpu_period - cpu_clk;
}
void
sim_exit (uint8_t exit_code)
{
/* On a nonzero exit, always print an error message. */
if (exit_code != 0)
{
printf ("m6809-run: program exited with %d\n", exit_code);
if (exit_code)
monitor_backtrace ();
}
/* If a cycle count should be printed, do that last. */
if (dump_cycles_on_success)
printf ("Finished in %d cycles\n", get_cycles ());
exit (exit_code);
}
static inline void
change_pc (unsigned newPC)
{
/* TODO - will let some RAM execute for trampolines */
if ((newPC < 0x1C00) || (newPC > 0xFFFF))
{
fprintf (stderr, "m6809-run: invalid PC = %04X, previous was %s\n",
newPC, monitor_addr_name (PC));
exit (2);
}
if (trace_enabled)
{
fprintf (stderr, "PC : %s ", monitor_addr_name (PC));
fprintf (stderr, "-> %s\n", monitor_addr_name (newPC));
}
PC = newPC;
}
static inline unsigned
imm_byte (void)
{
unsigned val = read8 (PC);
PC++;
return val;
}
static inline unsigned
imm_word (void)
{
unsigned val = read16 (PC);
PC += 2;
return val;
}
#define WRMEM(addr, data) write8 (addr, data)
static void
WRMEM16 (unsigned addr, unsigned data)
{
WRMEM (addr, data >> 8);
cpu_clk--;
WRMEM ((addr + 1) & 0xffff, data & 0xff);
}
#define RDMEM(addr) read8 (addr)
static unsigned
RDMEM16 (unsigned addr)
{
unsigned val = RDMEM (addr) << 8;
cpu_clk--;
val |= RDMEM ((addr + 1) & 0xffff);
return val;
}
#define write_stack WRMEM
#define read_stack RDMEM
static void
write_stack16 (unsigned addr, unsigned data)
{
write_stack ((addr + 1) & 0xffff, data & 0xff);
write_stack (addr, data >> 8);
}
static unsigned
read_stack16 (unsigned addr)
{
return (read_stack (addr) << 8) | read_stack ((addr + 1) & 0xffff);
}
static void
direct (void)
{
unsigned val = read8 (PC) | DP;
PC++;
ea = val;
}
static void
indexed (void) /* note take 1 extra cycle */
{
unsigned post = imm_byte ();
unsigned *R = index_regs[(post >> 5) & 0x3];
if (post & 0x80)
{
switch (post & 0x1f)
{
case 0x00:
ea = *R;
*R = (*R + 1) & 0xffff;
cpu_clk -= 6;
break;
case 0x01:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
break;
case 0x02:
*R = (*R - 1) & 0xffff;
ea = *R;
cpu_clk -= 6;
break;
case 0x03:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
break;
case 0x04:
ea = *R;
cpu_clk -= 4;
break;
case 0x05:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
break;
case 0x06:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
break;
case 0x08:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
break;
case 0x09:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
break;
case 0x0c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
break;
case 0x0d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
break;
case 0x11:
ea = *R;
*R = (*R + 2) & 0xffff;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x13:
*R = (*R - 2) & 0xffff;
ea = *R;
cpu_clk -= 7;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x14:
ea = *R;
cpu_clk -= 4;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x15:
ea = (*R + ((INT8) B)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x16:
ea = (*R + ((INT8) A)) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x18:
ea = (*R + ((INT8) imm_byte ())) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x19:
ea = (*R + imm_word ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1b:
ea = (*R + get_d ()) & 0xffff;
cpu_clk -= 8;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1c:
ea = (INT8) imm_byte ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 5;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1d:
ea = imm_word ();
ea = (ea + PC) & 0xffff;
cpu_clk -= 9;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
case 0x1f:
ea = imm_word ();
cpu_clk -= 6;
ea = RDMEM16 (ea);
cpu_clk -= 2;
break;
default:
ea = 0;
printf ("%X: invalid index post $%02X\n", iPC, post);
if (debug_enabled)
{
monitor_on = 1;
}
else
{
exit (1);
}
break;
}
}
else
{
if (post & 0x10)
post |= 0xfff0;
else
post &= 0x000f;
ea = (*R + post) & 0xffff;
cpu_clk -= 5;
}
}
static void
extended (void)
{
unsigned val = read16 (PC);
PC += 2;
ea = val;
}
/* external register functions */
unsigned
get_a (void)
{
return A;
}
unsigned
get_b (void)
{
return B;
}
unsigned
get_dp (void)
{
return DP >> 8;
}
unsigned
get_x (void)
{
return X;
}
unsigned
get_y (void)
{
return Y;
}
unsigned
get_s (void)
{
return S;
}
unsigned
get_u (void)
{
return U;
}
unsigned
get_pc (void)
{
return PC & 0xffff;
}
unsigned
get_d (void)
{
return (A << 8) | B;
}
#ifdef H6309
unsigned
get_e (void)
{
return E;
}
unsigned
get_f (void)
{
return F;
}
unsigned
get_w (void)
{
return (E << 8) | F;
}
unsigned
get_q (void)
{
return (get_w () << 16) | get_d ();
}
unsigned
get_v (void)
{
return V;
}
unsigned
get_zero (void)
{
return 0;
}
unsigned
get_md (void)
{
return MD;
}
#endif
void
set_a (unsigned val)
{
A = val & 0xff;
}
void
set_b (unsigned val)
{
B = val & 0xff;
}
void
set_dp (unsigned val)
{
DP = (val & 0xff) << 8;
}
void
set_x (unsigned val)
{
X = val & 0xffff;
}
void
set_y (unsigned val)
{
Y = val & 0xffff;
}
void
set_s (unsigned val)
{
S = val & 0xffff;
check_stack ();
}
void
set_u (unsigned val)
{
U = val & 0xffff;
}
void
set_pc (unsigned val)
{
PC = val & 0xffff;
check_pc ();
}
void
set_d (unsigned val)
{
A = (val >> 8) & 0xff;
B = val & 0xff;
}
#ifdef H6309
void
set_e (unsigned val)
{
E = val & 0xff;
}
void
set_f (unsigned val)
{
F = val & 0xff;
}
void
set_w (unsigned val)
{
E = (val >> 8) & 0xff;
@@ -910,1293 +911,1295 @@ inc (unsigned arg)
OV = ~arg & res;
cpu_clk -= 2;
return res;
}
static unsigned
ld (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
return res;
}
static unsigned
lsr (unsigned arg)
{
unsigned res = arg >> 1;
N = 0;
Z = res;
C = arg & 1;
cpu_clk -= 2;
return res;
}
static void
mul (void)
{
unsigned res = (A * B) & 0xffff;
Z = res;
C = res & 0x80;
A = res >> 8;
B = res & 0xff;
cpu_clk -= 11;
}
static unsigned
neg (int arg)
{
unsigned res = (-arg) & 0xff;
C = N = Z = res;
OV = res & arg;
cpu_clk -= 2;
return res;
}
static unsigned
or (unsigned arg, unsigned val)
{
unsigned res = arg | val;
N = Z = res;
OV = 0;
return res;
}
static unsigned
rol (unsigned arg)
{
unsigned res = (arg << 1) + (C != 0);
C = res & 0x100;
N = Z = res &= 0xff;
OV = arg ^ res;
cpu_clk -= 2;
return res;
}
static unsigned
ror (unsigned arg)
{
unsigned res = arg;
if (C != 0)
res |= 0x100;
C = res & 1;
N = Z = res >>= 1;
cpu_clk -= 2;
return res;
}
static unsigned
sbc (unsigned arg, unsigned val)
{
unsigned res = arg - val - (C != 0);
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
return res;
}
static void
st (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
WRMEM (ea, res);
}
static unsigned
sub (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x100;
N = Z = res &= 0xff;
OV = (arg ^ val) & (arg ^ res);
return res;
}
static void
tst (unsigned arg)
{
unsigned res = arg;
N = Z = res;
OV = 0;
cpu_clk -= 2;
}
static void
tfr (void)
{
unsigned tmp1 = 0xff;
unsigned post = imm_byte ();
if (((post ^ (post << 4)) & 0x80) == 0)
tmp1 = get_reg (post >> 4);
set_reg (post & 15, tmp1);
cpu_clk -= 6;
}
/* 16-Bit Accumulator Instructions */
static void
abx (void)
{
X = (X + B) & 0xffff;
cpu_clk -= 3;
}
static void
addd (unsigned val)
{
unsigned arg = (A << 8) | B;
unsigned res = arg + val;
C = res & 0x10000;
Z = res &= 0xffff;
OV = ((arg ^ res) & (val ^ res)) >> 8;
A = N = res >> 8;
B = res & 0xff;
}
static void
cmp16 (unsigned arg, unsigned val)
{
unsigned res = arg - val;
C = res & 0x10000;
Z = res &= 0xffff;
N = res >> 8;
OV = ((arg ^ val) & (arg ^ res)) >> 8;
}
static void
ldd (unsigned arg)
{
unsigned res = arg;
Z = res;
A = N = res >> 8;
B = res & 0xff;
OV = 0;
}
static unsigned
ld16 (unsigned arg)
{
unsigned res = arg;
Z = res;
N = res >> 8;
OV = 0;
return res;
}
static void
sex (void)
{
unsigned res = B;
Z = res;
N = res &= 0x80;
if (res != 0)
res = 0xff;
A = res;
cpu_clk -= 2;
}
static void
std (void)
{
unsigned res = (A << 8) | B;
Z = res;
N = A;
OV = 0;
WRMEM16 (ea, res);
}
static void
st16 (unsigned arg)
{
unsigned res = arg;
Z = res;
N = res >> 8;
OV = 0;
WRMEM16 (ea, res);
}
static void
subd (unsigned val)
{
unsigned arg = (A << 8) | B;
unsigned res = arg - val;
C = res & 0x10000;
Z = res &= 0xffff;
OV = ((arg ^ val) & (arg ^ res)) >> 8;
A = N = res >> 8;
B = res & 0xff;
}
/* stack instructions */
static void
pshs (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x80)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
}
if (post & 0x40)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, U);
}
if (post & 0x20)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
}
if (post & 0x10)
{
cpu_clk -= 2;
S = (S - 2) & 0xffff;
write_stack16 (S, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
}
}
static void
pshu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x80)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, PC & 0xffff);
}
if (post & 0x40)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, S);
}
if (post & 0x20)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, Y);
}
if (post & 0x10)
{
cpu_clk -= 2;
U = (U - 2) & 0xffff;
write_stack16 (U, X);
}
if (post & 0x08)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, DP >> 8);
}
if (post & 0x04)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, B);
}
if (post & 0x02)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, A);
}
if (post & 0x01)
{
cpu_clk -= 1;
U = (U - 1) & 0xffff;
write_stack (U, get_cc ());
}
}
static void
puls (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (S);
S = (S + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
}
static void
pulu (void)
{
unsigned post = imm_byte ();
cpu_clk -= 5;
if (post & 0x01)
{
cpu_clk -= 1;
set_cc (read_stack (U));
U = (U + 1) & 0xffff;
}
if (post & 0x02)
{
cpu_clk -= 1;
A = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x04)
{
cpu_clk -= 1;
B = read_stack (U);
U = (U + 1) & 0xffff;
}
if (post & 0x08)
{
cpu_clk -= 1;
DP = read_stack (U) << 8;
U = (U + 1) & 0xffff;
}
if (post & 0x10)
{
cpu_clk -= 2;
X = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x20)
{
cpu_clk -= 2;
Y = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x40)
{
cpu_clk -= 2;
S = read_stack16 (U);
U = (U + 2) & 0xffff;
}
if (post & 0x80)
{
monitor_return ();
cpu_clk -= 2;
PC = read_stack16 (U);
check_pc ();
U = (U + 2) & 0xffff;
}
}
/* Miscellaneous Instructions */
static void
nop (void)
{
cpu_clk -= 2;
}
static void
jsr (void)
{
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
change_pc (ea);
monitor_call (0);
}
static void
rti (void)
{
monitor_return ();
cpu_clk -= 6;
+ command_irq_hook (get_cycles () - irq_start_time);
set_cc (read_stack (S));
S = (S + 1) & 0xffff;
if ((EFI & E_FLAG) != 0)
{
cpu_clk -= 9;
A = read_stack (S);
S = (S + 1) & 0xffff;
B = read_stack (S);
S = (S + 1) & 0xffff;
DP = read_stack (S) << 8;
S = (S + 1) & 0xffff;
X = read_stack16 (S);
S = (S + 2) & 0xffff;
Y = read_stack16 (S);
S = (S + 2) & 0xffff;
U = read_stack16 (S);
S = (S + 2) & 0xffff;
}
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
static void
rts (void)
{
monitor_return ();
cpu_clk -= 5;
PC = read_stack16 (S);
check_pc ();
S = (S + 2) & 0xffff;
}
void
irq (void)
{
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
+ irq_start_time = get_cycles ();
change_pc (read16 (0xfff8));
#if 1
irqs_pending = 0;
#endif
}
void
swi (void)
{
cpu_clk -= 19;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
EFI |= (I_FLAG | F_FLAG);
change_pc (read16 (0xfffa));
}
void
swi2 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff4));
}
void
swi3 (void)
{
cpu_clk -= 20;
EFI |= E_FLAG;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
S = (S - 2) & 0xffff;
write_stack16 (S, U);
S = (S - 2) & 0xffff;
write_stack16 (S, Y);
S = (S - 2) & 0xffff;
write_stack16 (S, X);
S = (S - 1) & 0xffff;
write_stack (S, DP >> 8);
S = (S - 1) & 0xffff;
write_stack (S, B);
S = (S - 1) & 0xffff;
write_stack (S, A);
S = (S - 1) & 0xffff;
write_stack (S, get_cc ());
change_pc (read16 (0xfff2));
}
void
cwai (void)
{
puts ("CWAI - not supported yet!");
exit (100);
}
void
sync (void)
{
puts ("SYNC - not supported yet!");
exit (100);
cpu_clk -= 4;
}
static void
orcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () | tmp);
cpu_clk -= 3;
}
static void
andcc (void)
{
unsigned tmp = imm_byte ();
set_cc (get_cc () & tmp);
cpu_clk -= 3;
}
/* Branch Instructions */
#define cond_HI() ((Z != 0) && (C == 0))
#define cond_LS() ((Z == 0) || (C != 0))
#define cond_HS() (C == 0)
#define cond_LO() (C != 0)
#define cond_NE() (Z != 0)
#define cond_EQ() (Z == 0)
#define cond_VC() ((OV & 0x80) == 0)
#define cond_VS() ((OV & 0x80) != 0)
#define cond_PL() ((N & 0x80) == 0)
#define cond_MI() ((N & 0x80) != 0)
#define cond_GE() (((N^OV) & 0x80) == 0)
#define cond_LT() (((N^OV) & 0x80) != 0)
#define cond_GT() ((((N^OV) & 0x80) == 0) && (Z != 0))
#define cond_LE() ((((N^OV) & 0x80) != 0) || (Z == 0))
static void
bra (void)
{
INT8 tmp = (INT8) imm_byte ();
change_pc (PC + tmp);
}
static void
branch (unsigned cond)
{
if (cond)
bra ();
else
change_pc (PC+1);
cpu_clk -= 3;
}
static void
long_bra (void)
{
INT16 tmp = (INT16) imm_word ();
change_pc (PC + tmp);
}
static void
long_branch (unsigned cond)
{
if (cond)
{
long_bra ();
cpu_clk -= 6;
}
else
{
change_pc (PC + 2);
cpu_clk -= 5;
}
}
static void
long_bsr (void)
{
INT16 tmp = (INT16) imm_word ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 9;
change_pc (ea);
monitor_call (0);
}
static void
bsr (void)
{
INT8 tmp = (INT8) imm_byte ();
ea = PC + tmp;
S = (S - 2) & 0xffff;
write_stack16 (S, PC & 0xffff);
cpu_clk -= 7;
change_pc (ea);
monitor_call (0);
}
/* execute 6809 code */
int
cpu_execute (int cycles)
{
unsigned opcode;
cpu_period = cpu_clk = cycles;
do
{
command_insn_hook ();
if (check_break (PC) != 0)
monitor_on = 1;
if (monitor_on != 0)
if (monitor6809 () != 0)
- return cpu_period - cpu_clk;
+ goto cpu_exit;
iPC = PC;
opcode = imm_byte ();
switch (opcode)
{
case 0x00:
direct ();
cpu_clk -= 4;
WRMEM (ea, neg (RDMEM (ea)));
break; /* NEG direct */
#ifdef H6309
case 0x01: /* OIM */
break;
case 0x02: /* AIM */
break;
#endif
case 0x03:
direct ();
cpu_clk -= 4;
WRMEM (ea, com (RDMEM (ea)));
break; /* COM direct */
case 0x04:
direct ();
cpu_clk -= 4;
WRMEM (ea, lsr (RDMEM (ea)));
break; /* LSR direct */
#ifdef H6309
case 0x05: /* EIM */
break;
#endif
case 0x06:
direct ();
cpu_clk -= 4;
WRMEM (ea, ror (RDMEM (ea)));
break; /* ROR direct */
case 0x07:
direct ();
cpu_clk -= 4;
WRMEM (ea, asr (RDMEM (ea)));
break; /* ASR direct */
case 0x08:
direct ();
cpu_clk -= 4;
WRMEM (ea, asl (RDMEM (ea)));
break; /* ASL direct */
case 0x09:
direct ();
cpu_clk -= 4;
WRMEM (ea, rol (RDMEM (ea)));
break; /* ROL direct */
case 0x0a:
direct ();
cpu_clk -= 4;
WRMEM (ea, dec (RDMEM (ea)));
break; /* DEC direct */
#ifdef H6309
case 0x0B: /* TIM */
break;
#endif
case 0x0c:
direct ();
cpu_clk -= 4;
WRMEM (ea, inc (RDMEM (ea)));
break; /* INC direct */
case 0x0d:
direct ();
cpu_clk -= 4;
tst (RDMEM (ea));
break; /* TST direct */
case 0x0e:
direct ();
cpu_clk -= 3;
PC = ea;
check_pc ();
monitor_call (FC_TAIL_CALL);
break; /* JMP direct */
case 0x0f:
direct ();
cpu_clk -= 4;
WRMEM (ea, clr (RDMEM (ea)));
break; /* CLR direct */
case 0x10:
{
opcode = imm_byte ();
switch (opcode)
{
case 0x21:
cpu_clk -= 5;
PC += 2;
break;
case 0x22:
long_branch (cond_HI ());
break;
case 0x23:
long_branch (cond_LS ());
break;
case 0x24:
long_branch (cond_HS ());
break;
case 0x25:
long_branch (cond_LO ());
break;
case 0x26:
long_branch (cond_NE ());
break;
case 0x27:
long_branch (cond_EQ ());
break;
case 0x28:
long_branch (cond_VC ());
break;
case 0x29:
long_branch (cond_VS ());
break;
case 0x2a:
long_branch (cond_PL ());
break;
case 0x2b:
long_branch (cond_MI ());
break;
case 0x2c:
long_branch (cond_GE ());
break;
case 0x2d:
long_branch (cond_LT ());
break;
case 0x2e:
long_branch (cond_GT ());
break;
case 0x2f:
long_branch (cond_LE ());
break;
#ifdef H6309
case 0x30: /* ADDR */
break;
case 0x31: /* ADCR */
break;
case 0x32: /* SUBR */
break;
case 0x33: /* SBCR */
break;
case 0x34: /* ANDR */
break;
case 0x35: /* ORR */
break;
case 0x36: /* EORR */
break;
case 0x37: /* CMPR */
break;
case 0x38: /* PSHSW */
break;
case 0x39: /* PULSW */
break;
case 0x3a: /* PSHUW */
break;
case 0x3b: /* PULUW */
break;
#endif
case 0x3f:
swi2 ();
break;
#ifdef H6309
case 0x40: /* NEGD */
break;
case 0x43: /* COMD */
break;
case 0x44: /* LSRD */
break;
case 0x46: /* RORD */
break;
case 0x47: /* ASRD */
break;
case 0x48: /* ASLD/LSLD */
break;
case 0x49: /* ROLD */
break;
case 0x4a: /* DECD */
break;
case 0x4c: /* INCD */
break;
case 0x4d: /* TSTD */
break;
case 0x4f: /* CLRD */
break;
case 0x53: /* COMW */
break;
case 0x54: /* LSRW */
break;
case 0x56: /* ??RORW */
break;
case 0x59: /* ROLW */
break;
case 0x5a: /* DECW */
break;
case 0x5c: /* INCW */
break;
case 0x5d: /* TSTW */
break;
case 0x5f: /* CLRW */
break;
case 0x80: /* SUBW */
break;
case 0x81: /* CMPW */
break;
case 0x82: /* SBCD */
break;
#endif
case 0x83:
cpu_clk -= 5;
cmp16 (get_d (), imm_word ());
break;
#ifdef H6309
case 0x84: /* ANDD */
break;
case 0x85: /* BITD */
break;
case 0x86: /* LDW */
break;
case 0x88: /* EORD */
break;
case 0x89: /* ADCD */
break;
case 0x8a: /* ORD */
break;
case 0x8b: /* ADDW */
break;
#endif
case 0x8c:
cpu_clk -= 5;
cmp16 (Y, imm_word ());
break;
case 0x8e:
cpu_clk -= 4;
Y = ld16 (imm_word ());
break;
#ifdef H6309
case 0x90: /* SUBW */
break;
case 0x91: /* CMPW */
break;
case 0x92: /* SBCD */
break;
#endif
case 0x93:
direct ();
cpu_clk -= 5;
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0x9c:
direct ();
cpu_clk -= 5;
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0x9e:
direct ();
cpu_clk -= 5;
Y = ld16 (RDMEM16 (ea));
break;
case 0x9f:
direct ();
cpu_clk -= 5;
st16 (Y);
break;
case 0xa3:
cpu_clk--;
indexed ();
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0xac:
cpu_clk--;
indexed ();
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0xae:
cpu_clk--;
indexed ();
Y = ld16 (RDMEM16 (ea));
break;
case 0xaf:
cpu_clk--;
indexed ();
st16 (Y);
break;
case 0xb3:
extended ();
cpu_clk -= 6;
cmp16 (get_d (), RDMEM16 (ea));
cpu_clk--;
break;
case 0xbc:
extended ();
cpu_clk -= 6;
cmp16 (Y, RDMEM16 (ea));
cpu_clk--;
break;
case 0xbe:
extended ();
cpu_clk -= 6;
Y = ld16 (RDMEM16 (ea));
break;
case 0xbf:
extended ();
cpu_clk -= 6;
st16 (Y);
break;
case 0xce:
cpu_clk -= 4;
S = ld16 (imm_word ());
break;
case 0xde:
direct ();
cpu_clk -= 5;
S = ld16 (RDMEM16 (ea));
break;
case 0xdf:
direct ();
cpu_clk -= 5;
st16 (S);
break;
case 0xee:
cpu_clk--;
indexed ();
S = ld16 (RDMEM16 (ea));
break;
case 0xef:
cpu_clk--;
indexed ();
st16 (S);
break;
case 0xfe:
extended ();
cpu_clk -= 6;
S = ld16 (RDMEM16 (ea));
break;
case 0xff:
extended ();
cpu_clk -= 6;
st16 (S);
break;
default:
sim_error ("invalid opcode (1) at %s\n", monitor_addr_name (iPC));
break;
}
}
break;
case 0x11:
{
opcode = imm_byte ();
switch (opcode)
{
case 0x3f:
swi3 ();
break;
case 0x83:
cpu_clk -= 5;
cmp16 (U, imm_word ());
break;
case 0x8c:
cpu_clk -= 5;
cmp16 (S, imm_word ());
break;
case 0x93:
direct ();
cpu_clk -= 5;
cmp16 (U, RDMEM16 (ea));
cpu_clk--;
break;
case 0x9c:
direct ();
cpu_clk -= 5;
cmp16 (S, RDMEM16 (ea));
cpu_clk--;
break;
case 0xa3:
cpu_clk--;
indexed ();
cmp16 (U, RDMEM16 (ea));
cpu_clk--;
break;
case 0xac:
cpu_clk--;
indexed ();
cmp16 (S, RDMEM16 (ea));
cpu_clk--;
break;
case 0xb3:
extended ();
cpu_clk -= 6;
cmp16 (U, RDMEM16 (ea));
cpu_clk--;
break;
case 0xbc:
extended ();
cpu_clk -= 6;
cmp16 (S, RDMEM16 (ea));
cpu_clk--;
break;
default:
sim_error ("invalid opcode (2) at %s\n", monitor_addr_name (iPC));
break;
}
}
break;
case 0x12:
nop ();
break;
case 0x13:
sync ();
break;
#ifdef H6309
case 0x14: /* SEXW */
break;
#endif
case 0x16:
long_bra ();
cpu_clk -= 5;
break;
case 0x17:
long_bsr ();
break;
case 0x19:
daa ();
break;
case 0x1a:
orcc ();
break;
case 0x1c:
andcc ();
break;
case 0x1d:
sex ();
break;
case 0x1e:
exg ();
break;
case 0x1f:
tfr ();
break;
case 0x20:
bra ();
cpu_clk -= 3;
break;
case 0x21:
PC++;
cpu_clk -= 3;
break;
case 0x22:
branch (cond_HI ());
break;
case 0x23:
branch (cond_LS ());
break;
case 0x24:
branch (cond_HS ());
break;
case 0x25:
branch (cond_LO ());
break;
case 0x26:
branch (cond_NE ());
break;
case 0x27:
branch (cond_EQ ());
break;
case 0x28:
branch (cond_VC ());
break;
case 0x29:
branch (cond_VS ());
break;
case 0x2a:
branch (cond_PL ());
break;
case 0x2b:
branch (cond_MI ());
break;
case 0x2c:
branch (cond_GE ());
break;
case 0x2d:
branch (cond_LT ());
break;
case 0x2e:
branch (cond_GT ());
break;
case 0x2f:
branch (cond_LE ());
break;
case 0x30:
indexed ();
Z = X = ea;
break; /* LEAX indexed */
case 0x31:
indexed ();
Z = Y = ea;
break; /* LEAY indexed */
case 0x32:
indexed ();
S = ea;
break; /* LEAS indexed */
case 0x33:
@@ -2519,529 +2522,532 @@ cpu_execute (int cycles)
subd (RDMEM16 (ea));
cpu_clk--;
break;
case 0x94:
direct ();
cpu_clk -= 4;
A = and (A, RDMEM (ea));
break;
case 0x95:
direct ();
cpu_clk -= 4;
bit (A, RDMEM (ea));
break;
case 0x96:
direct ();
cpu_clk -= 4;
A = ld (RDMEM (ea));
break;
case 0x97:
direct ();
cpu_clk -= 4;
st (A);
break;
case 0x98:
direct ();
cpu_clk -= 4;
A = eor (A, RDMEM (ea));
break;
case 0x99:
direct ();
cpu_clk -= 4;
A = adc (A, RDMEM (ea));
break;
case 0x9a:
direct ();
cpu_clk -= 4;
A = or (A, RDMEM (ea));
break;
case 0x9b:
direct ();
cpu_clk -= 4;
A = add (A, RDMEM (ea));
break;
case 0x9c:
direct ();
cpu_clk -= 4;
cmp16 (X, RDMEM16 (ea));
cpu_clk--;
break;
case 0x9d:
direct ();
cpu_clk -= 7;
jsr ();
break;
case 0x9e:
direct ();
cpu_clk -= 4;
X = ld16 (RDMEM16 (ea));
break;
case 0x9f:
direct ();
cpu_clk -= 4;
st16 (X);
break;
case 0xa0:
indexed ();
A = sub (A, RDMEM (ea));
break;
case 0xa1:
indexed ();
cmp (A, RDMEM (ea));
break;
case 0xa2:
indexed ();
A = sbc (A, RDMEM (ea));
break;
case 0xa3:
indexed ();
subd (RDMEM16 (ea));
cpu_clk--;
break;
case 0xa4:
indexed ();
A = and (A, RDMEM (ea));
break;
case 0xa5:
indexed ();
bit (A, RDMEM (ea));
break;
case 0xa6:
indexed ();
A = ld (RDMEM (ea));
break;
case 0xa7:
indexed ();
st (A);
break;
case 0xa8:
indexed ();
A = eor (A, RDMEM (ea));
break;
case 0xa9:
indexed ();
A = adc (A, RDMEM (ea));
break;
case 0xaa:
indexed ();
A = or (A, RDMEM (ea));
break;
case 0xab:
indexed ();
A = add (A, RDMEM (ea));
break;
case 0xac:
indexed ();
cmp16 (X, RDMEM16 (ea));
cpu_clk--;
break;
case 0xad:
indexed ();
cpu_clk -= 3;
jsr ();
break;
case 0xae:
indexed ();
X = ld16 (RDMEM16 (ea));
break;
case 0xaf:
indexed ();
st16 (X);
break;
case 0xb0:
extended ();
cpu_clk -= 5;
A = sub (A, RDMEM (ea));
break;
case 0xb1:
extended ();
cpu_clk -= 5;
cmp (A, RDMEM (ea));
break;
case 0xb2:
extended ();
cpu_clk -= 5;
A = sbc (A, RDMEM (ea));
break;
case 0xb3:
extended ();
cpu_clk -= 5;
subd (RDMEM16 (ea));
cpu_clk--;
break;
case 0xb4:
extended ();
cpu_clk -= 5;
A = and (A, RDMEM (ea));
break;
case 0xb5:
extended ();
cpu_clk -= 5;
bit (A, RDMEM (ea));
break;
case 0xb6:
extended ();
cpu_clk -= 5;
A = ld (RDMEM (ea));
break;
case 0xb7:
extended ();
cpu_clk -= 5;
st (A);
break;
case 0xb8:
extended ();
cpu_clk -= 5;
A = eor (A, RDMEM (ea));
break;
case 0xb9:
extended ();
cpu_clk -= 5;
A = adc (A, RDMEM (ea));
break;
case 0xba:
extended ();
cpu_clk -= 5;
A = or (A, RDMEM (ea));
break;
case 0xbb:
extended ();
cpu_clk -= 5;
A = add (A, RDMEM (ea));
break;
case 0xbc:
extended ();
cpu_clk -= 5;
cmp16 (X, RDMEM16 (ea));
cpu_clk--;
break;
case 0xbd:
extended ();
cpu_clk -= 8;
jsr ();
break;
case 0xbe:
extended ();
cpu_clk -= 5;
X = ld16 (RDMEM16 (ea));
break;
case 0xbf:
extended ();
cpu_clk -= 5;
st16 (X);
break;
case 0xc0:
cpu_clk -= 2;
B = sub (B, imm_byte ());
break;
case 0xc1:
cpu_clk -= 2;
cmp (B, imm_byte ());
break;
case 0xc2:
cpu_clk -= 2;
B = sbc (B, imm_byte ());
break;
case 0xc3:
cpu_clk -= 4;
addd (imm_word ());
break;
case 0xc4:
cpu_clk -= 2;
B = and (B, imm_byte ());
break;
case 0xc5:
cpu_clk -= 2;
bit (B, imm_byte ());
break;
case 0xc6:
cpu_clk -= 2;
B = ld (imm_byte ());
break;
case 0xc8:
cpu_clk -= 2;
B = eor (B, imm_byte ());
break;
case 0xc9:
cpu_clk -= 2;
B = adc (B, imm_byte ());
break;
case 0xca:
cpu_clk -= 2;
B = or (B, imm_byte ());
break;
case 0xcb:
cpu_clk -= 2;
B = add (B, imm_byte ());
break;
case 0xcc:
cpu_clk -= 3;
ldd (imm_word ());
break;
#ifdef H6309
case 0xcd: /* LDQ immed */
break;
#endif
case 0xce:
cpu_clk -= 3;
U = ld16 (imm_word ());
break;
case 0xd0:
direct ();
cpu_clk -= 4;
B = sub (B, RDMEM (ea));
break;
case 0xd1:
direct ();
cpu_clk -= 4;
cmp (B, RDMEM (ea));
break;
case 0xd2:
direct ();
cpu_clk -= 4;
B = sbc (B, RDMEM (ea));
break;
case 0xd3:
direct ();
cpu_clk -= 4;
addd (RDMEM16 (ea));
cpu_clk--;
break;
case 0xd4:
direct ();
cpu_clk -= 4;
B = and (B, RDMEM (ea));
break;
case 0xd5:
direct ();
cpu_clk -= 4;
bit (B, RDMEM (ea));
break;
case 0xd6:
direct ();
cpu_clk -= 4;
B = ld (RDMEM (ea));
break;
case 0xd7:
direct ();
cpu_clk -= 4;
st (B);
break;
case 0xd8:
direct ();
cpu_clk -= 4;
B = eor (B, RDMEM (ea));
break;
case 0xd9:
direct ();
cpu_clk -= 4;
B = adc (B, RDMEM (ea));
break;
case 0xda:
direct ();
cpu_clk -= 4;
B = or (B, RDMEM (ea));
break;
case 0xdb:
direct ();
cpu_clk -= 4;
B = add (B, RDMEM (ea));
break;
case 0xdc:
direct ();
cpu_clk -= 4;
ldd (RDMEM16 (ea));
break;
case 0xdd:
direct ();
cpu_clk -= 4;
std ();
break;
case 0xde:
direct ();
cpu_clk -= 4;
U = ld16 (RDMEM16 (ea));
break;
case 0xdf:
direct ();
cpu_clk -= 4;
st16 (U);
break;
case 0xe0:
indexed ();
B = sub (B, RDMEM (ea));
break;
case 0xe1:
indexed ();
cmp (B, RDMEM (ea));
break;
case 0xe2:
indexed ();
B = sbc (B, RDMEM (ea));
break;
case 0xe3:
indexed ();
addd (RDMEM16 (ea));
cpu_clk--;
break;
case 0xe4:
indexed ();
B = and (B, RDMEM (ea));
break;
case 0xe5:
indexed ();
bit (B, RDMEM (ea));
break;
case 0xe6:
indexed ();
B = ld (RDMEM (ea));
break;
case 0xe7:
indexed ();
st (B);
break;
case 0xe8:
indexed ();
B = eor (B, RDMEM (ea));
break;
case 0xe9:
indexed ();
B = adc (B, RDMEM (ea));
break;
case 0xea:
indexed ();
B = or (B, RDMEM (ea));
break;
case 0xeb:
indexed ();
B = add (B, RDMEM (ea));
break;
case 0xec:
indexed ();
ldd (RDMEM16 (ea));
break;
case 0xed:
indexed ();
std ();
break;
case 0xee:
indexed ();
U = ld16 (RDMEM16 (ea));
break;
case 0xef:
indexed ();
st16 (U);
break;
case 0xf0:
extended ();
cpu_clk -= 5;
B = sub (B, RDMEM (ea));
break;
case 0xf1:
extended ();
cpu_clk -= 5;
cmp (B, RDMEM (ea));
break;
case 0xf2:
extended ();
cpu_clk -= 5;
B = sbc (B, RDMEM (ea));
break;
case 0xf3:
extended ();
cpu_clk -= 5;
addd (RDMEM16 (ea));
cpu_clk--;
break;
case 0xf4:
extended ();
cpu_clk -= 5;
B = and (B, RDMEM (ea));
break;
case 0xf5:
extended ();
cpu_clk -= 5;
bit (B, RDMEM (ea));
break;
case 0xf6:
extended ();
cpu_clk -= 5;
B = ld (RDMEM (ea));
break;
case 0xf7:
extended ();
cpu_clk -= 5;
st (B);
break;
case 0xf8:
extended ();
cpu_clk -= 5;
B = eor (B, RDMEM (ea));
break;
case 0xf9:
extended ();
cpu_clk -= 5;
B = adc (B, RDMEM (ea));
break;
case 0xfa:
extended ();
cpu_clk -= 5;
B = or (B, RDMEM (ea));
break;
case 0xfb:
extended ();
cpu_clk -= 5;
B = add (B, RDMEM (ea));
break;
case 0xfc:
extended ();
cpu_clk -= 5;
ldd (RDMEM16 (ea));
break;
case 0xfd:
extended ();
cpu_clk -= 5;
std ();
break;
case 0xfe:
extended ();
cpu_clk -= 5;
U = ld16 (RDMEM16 (ea));
break;
case 0xff:
extended ();
cpu_clk -= 5;
st16 (U);
break;
default:
cpu_clk -= 2;
sim_error ("invalid opcode '%02X'\n", opcode);
PC = iPC;
break;
}
}
while (cpu_clk > 0);
- return cpu_period - cpu_clk;
+cpu_exit:
+ cpu_period -= cpu_clk;
+ cpu_clk = cpu_period;
+ return cpu_period;
}
void
cpu_reset (void)
{
X = Y = S = U = A = B = DP = 0;
H = N = OV = C = 0;
Z = 1;
EFI = F_FLAG | I_FLAG;
#ifdef H6309
MD = E = F = V = 0;
#endif
change_pc (read16 (0xfffe));
cpu_is_running ();
}
diff --git a/6809.h b/6809.h
old mode 100644
new mode 100755
index 9bccee4..8b9bfe9
--- a/6809.h
+++ b/6809.h
@@ -1,215 +1,226 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef M6809_H
#define M6809_H
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#else
#error
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
#error
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#else
#error
#endif
typedef uint8_t UINT8;
typedef signed char INT8;
typedef uint16_t UINT16;
typedef signed short INT16;
typedef uint32_t UINT32;
typedef signed int INT32;
typedef uint16_t target_addr_t;
#include "machine.h"
#define E_FLAG 0x80
#define F_FLAG 0x40
#define H_FLAG 0x20
#define I_FLAG 0x10
#define N_FLAG 0x08
#define Z_FLAG 0x04
#define V_FLAG 0x02
#define C_FLAG 0x01
extern int debug_enabled;
extern int need_flush;
-extern unsigned int total;
+extern unsigned long total;
extern int dump_cycles_on_success;
#ifdef OLDSYS
extern UINT8 *memory;
#endif
/* Primitive read/write macros */
#define read8(addr) cpu_read8 (addr)
#define write8(addr,val) do { cpu_write8 (addr, val); } while (0)
/* 16-bit versions */
#define read16(addr) (read8(addr) << 8 | read8(addr+1))
#define write16(addr,val) do { write8(addr, val & 0xFF); write8(addr+1, (val >> 8) & 0xFF) } while (0)
/* Fetch macros */
-#define fetch8() read8(pc++)
-#define fetch16() (pc += 2, read16(pc-2))
+#define abs_read16(addr) ((abs_read8(addr) << 8) | abs_read8(addr+1))
+
+#define fetch8() abs_read8 (pc++)
+#define fetch16() (pc += 2, abs_read16(pc-2))
/* 6809.c */
extern int cpu_quit;
extern int cpu_execute (int);
extern void cpu_reset (void);
extern unsigned get_a (void);
extern unsigned get_b (void);
extern unsigned get_cc (void);
extern unsigned get_dp (void);
extern unsigned get_x (void);
extern unsigned get_y (void);
extern unsigned get_s (void);
extern unsigned get_u (void);
extern unsigned get_pc (void);
extern unsigned get_d (void);
extern void set_a (unsigned);
extern void set_b (unsigned);
extern void set_cc (unsigned);
extern void set_dp (unsigned);
extern void set_x (unsigned);
extern void set_y (unsigned);
extern void set_s (unsigned);
extern void set_u (unsigned);
extern void set_pc (unsigned);
extern void set_d (unsigned);
/* monitor.c */
extern int monitor_on;
extern int check_break (unsigned);
extern void monitor_init (void);
extern int monitor6809 (void);
-extern int dasm (char *, int);
+extern int dasm (char *, absolute_address_t);
extern int load_hex (char *);
extern int load_s19 (char *);
extern int load_bin (char *,int);
#define MAX_STRINGSPACE 32000
#define MAX_SYMBOL_HASH 1009
#define SYM_KEYWORD 0
#define SYM_COMMAND 1
#define SYM_REGISTER 2
#define SYM_MEM 3
#define SYM_INT 4
+
+
+typedef struct
+{
+ unsigned char format;
+ unsigned int size;
+} datatype_t;
+
+
/* symtab.c */
struct stringspace
{
char space[32000];
unsigned int used;
};
struct symbol
{
char *name;
unsigned long value;
+ datatype_t ty;
unsigned int type;
struct symbol *chain;
};
struct symtab
{
struct symbol *syms_by_name[MAX_SYMBOL_HASH];
struct symbol *syms_by_value[MAX_SYMBOL_HASH];
struct symtab *parent;
};
-void sym_add (const char *name, unsigned long value, unsigned int type);
-int sym_find (const char *name, unsigned long *value, unsigned int type);
+extern struct symtab program_symtab;
+extern struct symtab internal_symtab;
+
+void sym_add (struct symtab *symtab, const char *name, unsigned long value, unsigned int type);
+int sym_find (struct symtab *symtab, const char *name, unsigned long *value, unsigned int type);
const char *sym_lookup (struct symtab *symtab, unsigned long value);
typedef void (*command_handler_t) (void);
typedef void (*virtual_handler_t) (unsigned long *val, int writep);
typedef unsigned int thread_id_t;
typedef struct
{
- int id : 8;
- int used : 1;
- int enabled : 1;
- int conditional : 1;
- int threaded : 1;
- int on_read : 1;
- int on_write : 1;
- int on_execute : 1;
- int size : 4;
+ unsigned int id : 8;
+ unsigned int used : 1;
+ unsigned int enabled : 1;
+ unsigned int conditional : 1;
+ unsigned int threaded : 1;
+ unsigned int on_read : 1;
+ unsigned int on_write : 1;
+ unsigned int on_execute : 1;
+ unsigned int size : 4;
+ unsigned int keep_running : 1;
absolute_address_t addr;
char condition[128];
thread_id_t tid;
unsigned int pass_count;
unsigned int ignore_count;
} breakpoint_t;
-typedef struct
-{
- unsigned char format;
- unsigned int size;
-} datatype_t;
-
typedef struct
{
int used : 1;
datatype_t type;
char expr[128];
} display_t;
typedef struct
{
int id : 8;
thread_id_t tid;
} thread_t;
#define MAX_BREAKS 32
#define MAX_DISPLAYS 32
#define MAX_HISTORY 10
#define MAX_THREADS 64
+void command_irq_hook (unsigned long cycles);
#endif /* M6809_H */
diff --git a/command.c b/command.c
old mode 100644
new mode 100755
index 55fd8c1..801d0f9
--- a/command.c
+++ b/command.c
@@ -1,883 +1,994 @@
#include "6809.h"
#include "monitor.h"
#include "machine.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/errno.h>
+#define PERIODIC_INTERVAL 50 /* in ms */
+
/**********************************************************/
/********************* Global Data ************************/
/**********************************************************/
unsigned int break_count = 0;
breakpoint_t breaktab[MAX_BREAKS];
unsigned int active_break_count = 0;
unsigned int display_count = 0;
display_t displaytab[MAX_DISPLAYS];
unsigned int history_count = 0;
unsigned long historytab[MAX_HISTORY];
absolute_address_t examine_addr = 0;
unsigned int examine_repeat = 1;
datatype_t examine_type;
thread_t threadtab[MAX_THREADS];
datatype_t print_type;
char *command_flags;
int exit_command_loop;
unsigned long eval (const char *expr);
extern int auto_break_insn_count;
/**********************************************************/
/******************** 6809 Functions **********************/
/**********************************************************/
+
void
print_addr (absolute_address_t addr)
{
- printf ("%02X:%04X", addr >> 28, addr & 0xFFFFFF);
+ print_device_name (addr >> 28);
+ putchar (':');
+ printf ("%04X", addr & 0xFFFFFF);
}
unsigned long
compute_inirq (void)
{
}
unsigned long
compute_infirq (void)
{
}
/**********************************************************/
/*********************** Functions ************************/
/**********************************************************/
void
syntax_error (const char *string)
{
fprintf (stderr, "error: %s\n", string);
}
void
save_value (unsigned long val)
{
historytab[history_count++ % MAX_HISTORY] = val;
}
unsigned long
eval_historical (unsigned int id)
{
return historytab[id % MAX_HISTORY];
}
void
assign_virtual (const char *name, unsigned long val)
{
virtual_handler_t virtual;
unsigned long v_val;
- if (sym_find (name, &v_val, 0))
- {
- syntax_error ("???");
- return;
- }
+
+ if (sym_find (&internal_symtab, name, &v_val, 0))
+ sym_add (&internal_symtab, name, 0, 0);
virtual = (virtual_handler_t)v_val;
virtual (&val, 1);
}
+/**
+ * Returns $name if name is defined as a symbol.
+ * Returns NULL otherwise.
+ */
+const char *
+virtual_defined (const char *name)
+{
+ if (sym_find (&internal_symtab, name, NULL, 0))
+ return name;
+ else
+ return NULL;
+}
+
+
unsigned long
eval_virtual (const char *name)
{
virtual_handler_t virtual;
unsigned long val;
/* The name of the virtual is looked up in the global
* symbol table, which holds the pointer to a
* variable in simulator memory, or to a function
* that can compute the value on-the-fly. */
- if (sym_find (name, &val, 0))
+ if (sym_find (&internal_symtab, name, &val, 0))
{
syntax_error ("???");
return 0;
}
virtual = (virtual_handler_t)val;
virtual (&val, 0);
return val;
}
-unsigned long
-eval_absolute (const char *page, const char *addr)
-{
- unsigned long pageval = eval (page);
- unsigned long cpuaddr = eval (addr);
- /* ... */
-}
void
eval_assign (const char *expr, unsigned long val)
{
if (*expr == '$')
{
assign_virtual (expr+1, val);
}
}
unsigned long
target_read (absolute_address_t addr, unsigned int size)
{
switch (size)
{
case 1:
return abs_read8 (addr);
case 2:
- return abs_read8 (addr) << 8 +
- abs_read8 (addr+1);
+ return abs_read16 (addr);
}
}
void
parse_format_flag (const char *flags, unsigned char *formatp)
{
while (*flags)
{
switch (*flags)
{
case 'x':
case 'd':
case 'u':
+ case 'o':
+ case 'a':
*formatp = *flags;
break;
}
flags++;
}
}
void
parse_size_flag (const char *flags, unsigned int *sizep)
{
while (*flags)
{
switch (*flags++)
{
case 'b':
*sizep = 1;
break;
case 'w':
*sizep = 2;
break;
}
}
}
int
fold_binary (const char *expr, const char op, unsigned long *valp)
{
char *p;
unsigned long val1, val2;
if ((p = strchr (expr, op)) == NULL)
return 0;
/* If the operator is the first character of the expression,
* then it's really a unary and shouldn't match here. */
if (p == expr)
return 0;
*p++ = '\0';
val1 = eval (expr);
val2 = eval (p);
switch (op)
{
case '+': *valp = val1 + val2; break;
case '-': *valp = val1 - val2; break;
case '*': *valp = val1 * val2; break;
case '/': *valp = val1 / val2; break;
}
return 1;
}
unsigned long
eval_mem (const char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, ':')) != NULL)
{
*p++ = '\0';
val = eval (expr) * 0x10000000L + eval (p);
}
else
{
val = to_absolute (eval (expr));
}
return val;
}
unsigned long
eval (const char *expr)
{
char *p;
unsigned long val;
if ((p = strchr (expr, '=')) != NULL)
{
*p++ = '\0';
val = eval (p);
eval_assign (expr, val);
}
else if (fold_binary (expr, '+', &val));
else if (fold_binary (expr, '-', &val));
else if (fold_binary (expr, '*', &val));
else if (fold_binary (expr, '/', &val));
else if (*expr == '$')
{
if (expr[1] == '$')
val = eval_historical (history_count - strtoul (expr+2, NULL, 10));
else if (isdigit (expr[1]))
val = eval_historical (strtoul (expr+1, NULL, 10));
else if (!expr[1])
val = eval_historical (0);
else
val = eval_virtual (expr+1);
}
else if (*expr == '*')
{
absolute_address_t addr = eval_mem (expr+1);
- return target_read (addr, 1);
+ return abs_read8 (addr);
}
else if (*expr == '@')
{
val = eval_mem (expr+1);
}
+ else if (isalpha (*expr))
+ {
+ if (sym_find (&program_symtab, expr, &val, 0))
+ val = 0;
+ }
else
{
val = strtoul (expr, NULL, 0);
}
return val;
}
void brk_enable (breakpoint_t *br, int flag)
{
if (br->enabled != flag)
{
br->enabled = flag;
if (flag)
active_break_count++;
else
active_break_count--;
}
}
breakpoint_t *
brkalloc (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (!breaktab[n].used)
{
breakpoint_t *br = &breaktab[n];
br->used = 1;
br->id = n;
br->conditional = 0;
br->threaded = 0;
+ br->keep_running = 0;
brk_enable (br, 1);
return br;
}
return NULL;
}
void
brkfree (breakpoint_t *br)
{
brk_enable (br, 0);
br->used = 0;
}
breakpoint_t *
brkfind_by_addr (absolute_address_t addr)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
if (breaktab[n].addr == addr)
return &breaktab[n];
return NULL;
}
breakpoint_t *
brkfind_by_id (unsigned int id)
{
return &breaktab[id];
}
void
brkprint (breakpoint_t *brkpt)
{
if (!brkpt->used)
return;
if (brkpt->on_execute)
printf ("Breakpoint");
else
{
printf ("Watchpoint");
if (brkpt->on_read)
printf ("(%s)", brkpt->on_write ? "RW" : "RO");
}
printf (" %d at ", brkpt->id);
print_addr (brkpt->addr);
if (!brkpt->enabled)
printf (" (disabled)");
if (brkpt->conditional)
printf (" if %s", brkpt->condition);
if (brkpt->threaded)
printf (" on thread %d", brkpt->tid);
+ if (brkpt->keep_running)
+ printf (", print-only");
putchar ('\n');
}
display_t *
display_alloc (void)
{
}
void
display_free (display_t *ds)
{
}
void
display_print (void)
{
}
void
print_value (unsigned long val, datatype_t *typep)
{
char f[8];
+ switch (typep->format)
+ {
+ case 'a':
+ print_addr (val);
+ return;
+ }
+
if (typep->format == 'x')
+ {
printf ("0x");
+ sprintf (f, "%%0%d%c", typep->size * 2, typep->format);
+ }
else if (typep->format == 'o')
+ {
printf ("0");
-
- sprintf (f, "%%0*%c", typep->format);
- printf (f, typep->size, val);
+ sprintf (f, "%%%c", typep->format);
+ }
+ else
+ sprintf (f, "%%%c", typep->format);
+ printf (f, val);
}
int
print_insn (absolute_address_t addr)
{
char buf[64];
int size = dasm (buf, addr);
printf ("%s", buf);
return size;
}
void
do_examine (void)
{
unsigned int n;
unsigned int objs_per_line = 16;
if (isdigit (*command_flags))
examine_repeat = strtoul (command_flags, &command_flags, 0);
if (*command_flags == 's' || *command_flags == 'i')
examine_type.format = *command_flags;
else
parse_format_flag (command_flags, &examine_type.format);
parse_size_flag (command_flags, &examine_type.size);
- if (examine_type.format == 'i')
- objs_per_line = 1;
+ switch (examine_type.format)
+ {
+ case 'i':
+ objs_per_line = 1;
+ break;
+
+ case 'w':
+ objs_per_line = 8;
+ break;
+ }
for (n = 0; n < examine_repeat; n++)
{
if ((n % objs_per_line) == 0)
{
putchar ('\n');
print_addr (examine_addr);
printf (": ");
}
switch (examine_type.format)
{
case 's': /* string */
break;
case 'i': /* instruction */
examine_addr += print_insn (examine_addr);
break;
default:
print_value (target_read (examine_addr, examine_type.size),
&examine_type);
putchar (' ');
examine_addr += examine_type.size;
}
}
putchar ('\n');
}
void
do_print (const char *expr)
{
unsigned long val = eval (expr);
printf ("$%d = ", history_count);
parse_format_flag (command_flags, &print_type.format);
parse_size_flag (command_flags, &print_type.size);
print_value (val, &print_type);
putchar ('\n');
save_value (val);
}
void
do_set (const char *expr)
{
unsigned long val = eval (expr);
save_value (val);
}
char *
getarg (void)
{
return strtok (NULL, " \t\n");
}
/****************** Command Handlers ************************/
void cmd_print (void)
{
const char *arg = getarg ();
if (arg)
do_print (arg);
else
do_print ("$");
}
void cmd_set (void)
{
const char *arg = getarg ();
if (arg)
do_set (arg);
else
do_set ("$");
}
void cmd_examine (void)
{
const char *arg = getarg ();
if (arg)
examine_addr = eval_mem (arg);
do_examine ();
}
void cmd_break (void)
{
const char *arg = getarg ();
unsigned long val = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = val;
br->on_execute = 1;
brkprint (br);
}
void cmd_watch1 (int on_read, int on_write)
{
- const char *arg = getarg ();
+ const char *arg;
+
+ arg = getarg ();
absolute_address_t addr = eval_mem (arg);
breakpoint_t *br = brkalloc ();
br->addr = addr;
br->on_read = on_read;
br->on_write = on_write;
+
+ arg = getarg ();
+ if (!arg)
+ return;
+ if (!strcmp (arg, "print"))
+ br->keep_running = 1;
+
brkprint (br);
}
void cmd_watch (void)
{
cmd_watch1 (0, 1);
}
void cmd_rwatch (void)
{
cmd_watch1 (1, 0);
}
void cmd_awatch (void)
{
cmd_watch1 (1, 1);
}
void cmd_break_list (void)
{
unsigned int n;
for (n = 0; n < MAX_BREAKS; n++)
brkprint (&breaktab[n]);
}
void cmd_step_next (void)
{
auto_break_insn_count = 1;
exit_command_loop = 0;
}
void cmd_continue (void)
{
exit_command_loop = 0;
}
void cmd_quit (void)
{
cpu_quit = 0;
exit_command_loop = 1;
}
void cmd_delete (void)
{
const char *arg = getarg ();
unsigned int id = atoi (arg);
breakpoint_t *br = brkfind_by_id (id);
if (br->used)
{
printf ("Deleting breakpoint %d\n", id);
brkfree (br);
}
}
+void cmd_list (void)
+{
+ char *arg;
+ static absolute_address_t lastpc = 0;
+ static absolute_address_t lastaddr = 0;
+ absolute_address_t addr;
+ int n;
+
+ arg = getarg ();
+ if (arg)
+ addr = eval_mem (arg);
+ else
+ {
+ addr = to_absolute (get_pc ());
+ if (addr == lastpc)
+ addr = lastaddr;
+ else
+ lastaddr = lastpc = addr;
+ }
+
+ for (n = 0; n < 10; n++)
+ {
+ print_addr (addr);
+ printf (" : ");
+ addr += print_insn (addr);
+ putchar ('\n');
+ }
+
+ lastaddr = addr;
+}
+
/****************** Parser ************************/
void cmd_help (void);
struct command_name
{
const char *prefix;
const char *name;
command_handler_t handler;
const char *help;
} cmdtab[] = {
{ "p", "print", cmd_print,
"Print the value of an expression" },
{ "set", "set", cmd_set,
"Set an internal variable/target memory" },
{ "x", "examine", cmd_examine,
"Examine raw memory" },
{ "b", "break", cmd_break,
"Set a breakpoint" },
{ "bl", "blist", cmd_break_list,
"List all breakpoints" },
{ "d", "delete", cmd_delete,
"Delete a breakpoint" },
{ "s", "step", cmd_step_next,
"Step to the next instruction" },
{ "n", "next", cmd_step_next,
"Continue up to the next instruction" },
{ "c", "continue", cmd_continue,
"Continue the program" },
{ "q", "quit", cmd_quit,
"Quit the simulator" },
{ "re", "reset", cpu_reset,
"Reset the CPU" },
{ "h", "help", cmd_help,
"Display this help" },
- { "wa", "watch", cmd_watch },
- { "rwa", "rwatch", cmd_rwatch },
- { "awa", "awatch", cmd_awatch },
+ { "wa", "watch", cmd_watch,
+ "Add a watchpoint on write" },
+ { "rwa", "rwatch", cmd_rwatch,
+ "Add a watchpoint on read" },
+ { "awa", "awatch", cmd_awatch,
+ "Add a watchpoint on read/write" },
{ "?", "?", cmd_help },
+ { "l", "list", cmd_list },
#if 0
{ "cl", "clear", cmd_clear },
{ "i", "info", cmd_info },
{ "co", "condition", cmd_condition },
{ "tr", "trace", cmd_trace },
{ "di", "disable", cmd_disable },
{ "en", "enable", cmd_enable },
- { "l", "list", cmd_list },
+ { "f", "file", cmd_file,
+ "Choose the program to be debugged" },
+ { "exe", "exec-file", cmd_exec_file,
+ "Open an executable" },
+ { "sym", "symbol-file", cmd_symbol_file,
+ "Open a symbol table file" },
#endif
{ NULL, NULL },
};
void cmd_help (void)
{
struct command_name *cn = cmdtab;
while (cn->prefix != NULL)
{
if (cn->help)
printf ("%s (%s) - %s\n",
cn->name, cn->prefix, cn->help);
cn++;
}
}
command_handler_t
command_lookup (const char *cmd)
{
struct command_name *cn;
char *p;
p = strchr (cmd, '/');
if (p)
{
*p = '\0';
command_flags = p+1;
}
else
command_flags = "";
cn = cmdtab;
while (cn->prefix != NULL)
{
if (!strcmp (cmd, cn->prefix))
return cn->handler;
if (!strcmp (cmd, cn->name))
return cn->handler;
+ /* TODO - look for a match anywhere between
+ * the minimum prefix and the full name */
cn++;
}
return NULL;
}
void
command_prompt (void)
{
unsigned int n;
for (n = 0; n < MAX_DISPLAYS; n++)
{
display_t *ds = &displaytab[n];
if (ds->used)
{
}
}
fprintf (stderr, "(dbg) ");
fflush (stderr);
}
void
print_current_insn (void)
{
absolute_address_t addr = to_absolute (get_pc ());
print_addr (addr);
printf (" : ");
print_insn (addr);
putchar ('\n');
}
int
command_loop (void)
{
char buffer[256];
char prev_buffer[256];
char *cmd;
command_handler_t handler;
int rc;
+ print_current_insn ();
exit_command_loop = -1;
while (exit_command_loop < 0)
{
- print_current_insn ();
command_prompt ();
do {
errno = 0;
fgets (buffer, 255, stdin);
} while (errno != 0);
if (feof (stdin))
break;
if (buffer[0] == '\n')
strcpy (buffer, prev_buffer);
cmd = strtok (buffer, " \t\n");
if (!cmd)
continue;
strcpy (prev_buffer, cmd);
handler = command_lookup (cmd);
if (!handler)
{
syntax_error ("no such command");
continue;
}
(*handler) ();
}
return (exit_command_loop);
}
void
command_insn_hook (void)
{
absolute_address_t abspc;
breakpoint_t *br;
if (active_break_count == 0)
return;
abspc = to_absolute (get_pc ());
br = brkfind_by_addr (abspc);
if (br && br->enabled && br->on_execute)
{
printf ("Breakpoint %d reached.\n", br->id);
monitor_on = 1;
}
}
void
command_read_hook (absolute_address_t addr)
{
breakpoint_t *br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_read)
{
- printf ("Watchpoint %d triggered.\n", br->id);
- monitor_on = 1;
+ printf ("Watchpoint %d triggered. [", br->id);
+ print_addr (addr);
+ printf ("]\n");
+ monitor_on = !br->keep_running;
}
}
void
-command_write_hook (absolute_address_t addr)
+command_write_hook (absolute_address_t addr, U8 val)
{
breakpoint_t *br = brkfind_by_addr (addr);
if (br && br->enabled && br->on_write)
{
- printf ("Watchpoint %d triggered.\n", br->id);
- monitor_on = 1;
+ printf ("Watchpoint %d triggered. [", br->id);
+ print_addr (addr);
+ printf (" = 0x%02X", val);
+ printf ("]\n");
+ monitor_on = !br->keep_running;
}
}
void pc_virtual (unsigned long *val, int writep) {
writep ? set_pc (*val) : (*val = get_pc ());
}
void x_virtual (unsigned long *val, int writep) {
writep ? set_x (*val) : (*val = get_x ());
}
void y_virtual (unsigned long *val, int writep) {
writep ? set_y (*val) : (*val = get_y ());
}
void u_virtual (unsigned long *val, int writep) {
writep ? set_u (*val) : (*val = get_u ());
}
void s_virtual (unsigned long *val, int writep) {
writep ? set_s (*val) : (*val = get_s ());
}
void d_virtual (unsigned long *val, int writep) {
writep ? set_d (*val) : (*val = get_d ());
}
void dp_virtual (unsigned long *val, int writep) {
writep ? set_dp (*val) : (*val = get_dp ());
}
void cc_virtual (unsigned long *val, int writep) {
writep ? set_cc (*val) : (*val = get_cc ());
}
void cycles_virtual (unsigned long *val, int writep)
{
if (!writep)
*val = get_cycles ();
}
+
void
command_periodic (int signo)
{
+ static unsigned long last_cycles = 0;
+
if (!monitor_on && signo == SIGALRM)
{
/* TODO */
+#if 0
+ unsigned long diff = get_cycles () - last_cycles;
+ printf ("%d cycles in 50ms\n");
+ last_cycles += diff;
+#endif
}
}
+void
+command_irq_hook (unsigned long cycles)
+{
+ //printf ("IRQ took %lu cycles\n", cycles);
+}
+
+
void
command_init (void)
{
struct itimerval itimer;
struct sigaction sact;
int rc;
- sym_add ("pc", (unsigned long)pc_virtual, SYM_REGISTER);
- sym_add ("x", (unsigned long)x_virtual, SYM_REGISTER);
- sym_add ("y", (unsigned long)y_virtual, SYM_REGISTER);
- sym_add ("u", (unsigned long)u_virtual, SYM_REGISTER);
- sym_add ("s", (unsigned long)s_virtual, SYM_REGISTER);
- sym_add ("d", (unsigned long)d_virtual, SYM_REGISTER);
- sym_add ("dp", (unsigned long)dp_virtual, SYM_REGISTER);
- sym_add ("cc", (unsigned long)cc_virtual, SYM_REGISTER);
- sym_add ("cycles", (unsigned long)cycles_virtual, SYM_REGISTER);
+ sym_add (&internal_symtab, "pc", (unsigned long)pc_virtual, SYM_REGISTER);
+ sym_add (&internal_symtab, "x", (unsigned long)x_virtual, SYM_REGISTER);
+ sym_add (&internal_symtab, "y", (unsigned long)y_virtual, SYM_REGISTER);
+ sym_add (&internal_symtab, "u", (unsigned long)u_virtual, SYM_REGISTER);
+ sym_add (&internal_symtab, "s", (unsigned long)s_virtual, SYM_REGISTER);
+ sym_add (&internal_symtab, "d", (unsigned long)d_virtual, SYM_REGISTER);
+ sym_add (&internal_symtab, "dp", (unsigned long)dp_virtual, SYM_REGISTER);
+ sym_add (&internal_symtab, "cc", (unsigned long)cc_virtual, SYM_REGISTER);
+ sym_add (&internal_symtab, "cycles", (unsigned long)cycles_virtual, SYM_REGISTER);
examine_type.format = 'x';
examine_type.size = 1;
print_type.format = 'x';
print_type.size = 1;
sigemptyset (&sact.sa_mask);
sact.sa_flags = 0;
sact.sa_handler = command_periodic;
sigaction (SIGALRM, &sact, NULL);
- itimer.it_interval.tv_sec = 1;
- itimer.it_interval.tv_usec = 0;
- itimer.it_value.tv_sec = 1;
- itimer.it_value.tv_usec = 0;
+ itimer.it_interval.tv_sec = 0;
+ itimer.it_interval.tv_usec = PERIODIC_INTERVAL * 1000;
+ itimer.it_value.tv_sec = 0;
+ itimer.it_value.tv_usec = PERIODIC_INTERVAL * 1000;
rc = setitimer (ITIMER_REAL, &itimer, NULL);
if (rc < 0)
fprintf (stderr, "couldn't register interval timer\n");
}
/* vim: set ts=3: */
/* vim: set expandtab: */
diff --git a/machine.c b/machine.c
old mode 100644
new mode 100755
index 2dfc277..c341f94
--- a/machine.c
+++ b/machine.c
@@ -1,619 +1,625 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "machine.h"
#include "eon.h"
#define CONFIG_LEGACY
#define MISSING 0xff
#define mmu_device (device_table[0])
extern void eon_init (const char *);
extern void wpc_init (const char *);
struct machine *machine;
unsigned int device_count = 0;
struct hw_device *device_table[MAX_BUS_DEVICES];
struct bus_map busmaps[NUM_BUS_MAPS];
struct bus_map default_busmaps[NUM_BUS_MAPS];
U16 fault_addr;
U8 fault_type;
int system_running = 0;
void cpu_is_running (void)
{
system_running = 1;
}
/**
* Attach a new device to the bus. Only called during init.
*/
struct hw_device *device_attach (struct hw_class *class_ptr, unsigned int size, void *priv)
{
struct hw_device *dev = malloc (sizeof (struct hw_device));
dev->class_ptr = class_ptr;
dev->devid = device_count;
dev->size = size;
dev->priv = priv;
device_table[device_count++] = dev;
/* Attach implies reset */
class_ptr->reset (dev);
return dev;
};
/**
* Map a portion of a device into the CPU's address space.
*/
void bus_map (unsigned int addr,
unsigned int devid,
unsigned long offset,
unsigned int len,
unsigned int flags)
{
struct bus_map *map;
unsigned int start, count;
/* Warn if trying to map too much */
if (addr + len > MAX_CPU_ADDR)
{
fprintf (stderr, "warning: mapping %04X bytes into %04X causes overflow\n",
len, addr);
}
/* Round address and length to be multiples of the map unit size. */
addr = ((addr + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
len = ((len + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
offset = ((offset + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
/* Convert from byte addresses to unit counts */
start = addr / BUS_MAP_SIZE;
count = len / BUS_MAP_SIZE;
/* Initialize the maps. This will let the CPU access the device. */
map = &busmaps[start];
while (count > 0)
{
if (!(map->flags & MAP_FIXED))
{
map->devid = devid;
map->offset = offset;
map->flags = flags;
}
count--;
map++;
offset += BUS_MAP_SIZE;
}
}
void device_define (struct hw_device *dev,
unsigned long offset,
unsigned int addr,
unsigned int len,
unsigned int flags)
{
bus_map (addr, dev->devid, offset, len, flags);
}
void bus_unmap (unsigned int addr, unsigned int len)
{
struct bus_map *map;
unsigned int start, count;
/* Round address and length to be multiples of the map unit size. */
addr = ((addr + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
len = ((len + BUS_MAP_SIZE - 1) / BUS_MAP_SIZE) * BUS_MAP_SIZE;
/* Convert from byte addresses to unit counts */
start = addr / BUS_MAP_SIZE;
count = len / BUS_MAP_SIZE;
/* Set the maps to their defaults. */
memcpy (&busmaps[start], &default_busmaps[start],
sizeof (struct bus_map) * count);
}
/**
* Generate a page fault. ADDR says which address was accessed
* incorrectly. TYPE says what kind of violation occurred.
*/
static struct bus_map *find_map (unsigned int addr)
{
return &busmaps[addr / BUS_MAP_SIZE];
}
static struct hw_device *find_device (unsigned int addr, unsigned char id)
{
/* Fault if any invalid device is accessed */
if ((id == INVALID_DEVID) || (id >= device_count))
machine->fault (addr, FAULT_NO_RESPONSE);
return device_table[id];
}
+void
+print_device_name (unsigned int devno)
+{
+ struct hw_device *dev = device_table[devno];
+ printf ("%02X", devno);
+}
+
+
absolute_address_t
absolute_from_reladdr (unsigned int device, unsigned long reladdr)
{
return (device * 0x10000000L) + reladdr;
}
U8 abs_read8 (absolute_address_t addr)
{
unsigned int id = addr >> 28;
unsigned long phy_addr = addr & 0xFFFFFFF;
struct hw_device *dev = device_table[id];
struct hw_class *class_ptr = dev->class_ptr;
return (*class_ptr->read) (dev, phy_addr);
}
/**
* Called by the CPU to read a byte.
*/
U8 cpu_read8 (unsigned int addr)
{
struct bus_map *map = find_map (addr);
struct hw_device *dev = find_device (addr, map->devid);
struct hw_class *class_ptr = dev->class_ptr;
unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE;
command_read_hook (absolute_from_reladdr (map->devid, phy_addr));
return (*class_ptr->read) (dev, phy_addr);
}
/**
* Called by the CPU to write a byte.
*/
void cpu_write8 (unsigned int addr, U8 val)
{
struct bus_map *map = find_map (addr);
struct hw_device *dev = find_device (addr, map->devid);
struct hw_class *class_ptr = dev->class_ptr;
unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE;
/* This can fail if the area is read-only */
if (system_running && (map->flags & MAP_READONLY))
machine->fault (addr, FAULT_NOT_WRITABLE);
else
- {
- command_write_hook (absolute_from_reladdr (map->devid, phy_addr));
(*class_ptr->write) (dev, phy_addr, val);
- }
+ command_write_hook (absolute_from_reladdr (map->devid, phy_addr), val);
}
absolute_address_t
to_absolute (unsigned long cpuaddr)
{
struct bus_map *map = find_map (cpuaddr);
struct hw_device *dev = find_device (cpuaddr, map->devid);
unsigned long phy_addr = map->offset + cpuaddr % BUS_MAP_SIZE;
return absolute_from_reladdr (map->devid, phy_addr);
}
void dump_machine (void)
{
unsigned int mapno;
unsigned int n;
for (mapno = 0; mapno < NUM_BUS_MAPS; mapno++)
{
struct bus_map *map = &busmaps[mapno];
printf ("Map %d addr=%04X dev=%d offset=%04X size=%06X\n",
mapno, mapno * BUS_MAP_SIZE, map->devid, map->offset,
0 /* device_table[map->devid]->size */);
#if 0
for (n = 0; n < BUS_MAP_SIZE; n++)
printf ("%02X ", cpu_read8 (mapno * BUS_MAP_SIZE + n));
printf ("\n");
#endif
}
}
/**********************************************************/
void null_reset (struct hw_device *dev)
{
}
U8 null_read (struct hw_device *dev, unsigned long addr)
{
return 0;
}
void null_write (struct hw_device *dev, unsigned long addr, U8 val)
{
}
/**********************************************************/
void ram_reset (struct hw_device *dev)
{
memset (dev->priv, 0, dev->size);
}
U8 ram_read (struct hw_device *dev, unsigned long addr)
{
char *buf = dev->priv;
return buf[addr];
}
void ram_write (struct hw_device *dev, unsigned long addr, U8 val)
{
char *buf = dev->priv;
buf[addr] = val;
}
struct hw_class ram_class =
{
.readonly = 0,
.reset = ram_reset,
.read = ram_read,
.write = ram_write,
};
struct hw_device *ram_create (unsigned long size)
{
void *buf = malloc (size);
return device_attach (&ram_class, size, buf);
}
/**********************************************************/
struct hw_class rom_class =
{
.readonly = 1,
.reset = null_reset,
.read = ram_read,
.write = ram_write,
};
struct hw_device *rom_create (const char *filename, unsigned int maxsize)
{
FILE *fp;
struct hw_device *dev;
unsigned int image_size;
char *buf;
if (filename)
{
fp = fopen (filename, "rb");
if (!fp)
return NULL;
image_size = sizeof_file (fp);
}
buf = malloc (maxsize);
dev = device_attach (&rom_class, maxsize, buf);
if (filename)
{
fread (buf, image_size, 1, fp);
fclose (fp);
maxsize -= image_size;
while (maxsize > 0)
{
memcpy (buf + image_size, buf, image_size);
buf += image_size;
maxsize -= image_size;
}
}
return dev;
}
/**********************************************************/
U8 console_read (struct hw_device *dev, unsigned long addr)
{
switch (addr)
{
case CON_IN:
return getchar ();
default:
return MISSING;
}
}
void console_write (struct hw_device *dev, unsigned long addr, U8 val)
{
switch (addr)
{
case CON_OUT:
putchar (val);
break;
case CON_EXIT:
sim_exit (val);
break;
default:
break;
}
}
struct hw_class console_class =
{
.readonly = 0,
.reset = null_reset,
.read = console_read,
.write = console_write,
};
struct hw_device *console_create (void)
{
return device_attach (&console_class, BUS_MAP_SIZE, NULL);
}
/**********************************************************/
U8 mmu_regs[MMU_PAGECOUNT][MMU_PAGEREGS];
U8 mmu_read (struct hw_device *dev, unsigned long addr)
{
switch (addr)
{
case 0x60:
return fault_addr >> 8;
case 0x61:
return fault_addr & 0xFF;
case 0x62:
return fault_type;
default:
{
unsigned int page = (addr / MMU_PAGEREGS) % MMU_PAGECOUNT;
unsigned int reg = addr % MMU_PAGEREGS;
U8 val = mmu_regs[page][reg];
//printf ("\n%02X, %02X = %02X\n", page, reg, val);
return val;
}
}
}
void mmu_write (struct hw_device *dev, unsigned long addr, U8 val)
{
unsigned int page = (addr / MMU_PAGEREGS) % MMU_PAGECOUNT;
unsigned int reg = addr % MMU_PAGEREGS;
mmu_regs[page][reg] = val;
bus_map (page * MMU_PAGESIZE,
mmu_regs[page][0],
mmu_regs[page][1] * MMU_PAGESIZE,
MMU_PAGESIZE,
mmu_regs[page][2] & 0x1);
}
void mmu_reset (struct hw_device *dev)
{
unsigned int page;
for (page = 0; page < MMU_PAGECOUNT; page++)
{
mmu_write (dev, page * MMU_PAGEREGS + 0, 0);
mmu_write (dev, page * MMU_PAGEREGS + 1, 0);
mmu_write (dev, page * MMU_PAGEREGS + 2, 0);
}
}
void mmu_reset_complete (struct hw_device *dev)
{
unsigned int page;
const struct bus_map *map;
/* Examine all of the bus_maps in place now, and
sync with the MMU registers. */
for (page = 0; page < MMU_PAGECOUNT; page++)
{
map = &busmaps[4 + page * (MMU_PAGESIZE / BUS_MAP_SIZE)];
mmu_regs[page][0] = map->devid;
mmu_regs[page][1] = map->offset / MMU_PAGESIZE;
mmu_regs[page][2] = map->flags & 0x1;
/* printf ("%02X %02X %02X\n",
map->devid, map->offset / MMU_PAGESIZE,
map->flags); */
}
}
struct hw_class mmu_class =
{
.readonly = 0,
.reset = mmu_reset,
.read = mmu_read,
.write = mmu_write,
};
struct hw_device *mmu_create (void)
{
return device_attach (&mmu_class, BUS_MAP_SIZE, NULL);
}
/**********************************************************/
/* The disk drive is emulated as follows:
* The disk is capable of "bus-mastering" and is able to dump data directly
* into the RAM, without CPU-involvement. (The pages do not even need to
* be mapped.) A transaction is initiated with the following parameters:
*
* - address of RAM, aligned to 512 bytes, must reside in lower 32KB.
* Thus there are 64 possible sector locations.
* - address of disk sector, given as a 16-bit value. This allows for up to
* a 32MB disk.
* - direction, either to disk or from disk.
*
* Emulation is synchronous with respect to the CPU.
*/
struct disk_priv
{
FILE *fp;
struct hw_device *dev;
unsigned long offset;
struct hw_device *ramdev;
unsigned int sectors;
char *ram;
};
U8 disk_read (struct hw_device *dev, unsigned long addr)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
}
void disk_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
switch (addr)
{
case DSK_ADDR:
disk->ram = disk->ramdev->priv + val * SECTOR_SIZE;
break;
case DSK_SECTOR:
disk->offset = val; /* high byte */
break;
case DSK_SECTOR+1:
disk->offset = (disk->offset << 8) | val;
disk->offset *= SECTOR_SIZE;
fseek (disk->fp, disk->offset, SEEK_SET);
break;
case DSK_CTRL:
if (val & DSK_READ)
{
fread (disk->ram, SECTOR_SIZE, 1, disk->fp);
}
else if (val & DSK_WRITE)
{
fwrite (disk->ram, SECTOR_SIZE, 1, disk->fp);
}
else if (val & DSK_ERASE)
{
char empty_sector[SECTOR_SIZE];
memset (empty_sector, 0xff, SECTOR_SIZE);
fwrite (empty_sector, SECTOR_SIZE, 1, disk->fp);
}
if (val & DSK_FLUSH)
{
fflush (disk->fp);
}
break;
}
}
void disk_reset (struct hw_device *dev)
{
struct disk_priv *disk = (struct disk_priv *)dev->priv;
disk_write (dev, DSK_ADDR, 0);
disk_write (dev, DSK_SECTOR, 0);
disk_write (dev, DSK_SECTOR+1, 0);
disk_write (dev, DSK_CTRL, DSK_FLUSH);
}
void disk_format (struct hw_device *dev)
{
unsigned int sector;
struct disk_priv *disk = (struct disk_priv *)dev->priv;
for (sector = 0; sector < disk->sectors; sector++)
{
disk_write (dev, DSK_SECTOR, sector >> 8);
disk_write (dev, DSK_SECTOR+1, sector & 0xFF);
disk_write (dev, DSK_CTRL, DSK_ERASE);
}
disk_write (dev, DSK_CTRL, DSK_FLUSH);
}
struct hw_class disk_class =
{
.readonly = 0,
.reset = disk_reset,
.read = disk_read,
.write = disk_write,
};
struct hw_device *disk_create (const char *backing_file)
{
struct disk_priv *disk = malloc (sizeof (struct disk_priv));
int newdisk = 0;
disk->fp = fopen (backing_file, "r+b");
if (disk->fp == NULL)
{
printf ("warning: disk does not exist, creating\n");
disk->fp = fopen (backing_file, "w+b");
newdisk = 1;
if (disk->fp == NULL)
{
printf ("warning: disk not created\n");
}
}
disk->ram = 0;
disk->ramdev = device_table[1];
disk->dev = device_attach (&disk_class, BUS_MAP_SIZE, disk);
disk->sectors = DISK_SECTOR_COUNT;
if (newdisk)
disk_format (disk->dev);
return disk->dev;
}
/**********************************************************/
void machine_init (const char *machine_name, const char *boot_rom_file)
{
memset (busmaps, 0, sizeof (busmaps));
if (!strcmp (machine_name, "simple"))
simple_init (boot_rom_file);
else if (!strcmp (machine_name, "eon"))
eon_init (boot_rom_file);
else if (!strcmp (machine_name, "wpc"))
wpc_init (boot_rom_file);
else
exit (1);
/* Save the default busmap configuration, before the
CPU begins to run, so that it can be restored if
necessary. */
memcpy (default_busmaps, busmaps, sizeof (busmaps));
if (!strcmp (machine_name, "eon"))
mmu_reset_complete (mmu_device);
}
diff --git a/main.c b/main.c
old mode 100644
new mode 100755
index a6f215c..5bc576a
--- a/main.c
+++ b/main.c
@@ -1,216 +1,215 @@
/*
* Copyright 2001 by Arto Salmi and Joze Fabcic
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
enum
{ HEX, S19, BIN };
/* The total number of cycles that have executed */
-unsigned int total = 0;
+unsigned long total = 0;
/* The frequency of the emulated CPU, in megahertz */
unsigned int mhz = 1;
/* When nonzero, indicates that the IRQ should be triggered periodically,
every so many cycles. By default no periodic IRQ is generated. */
unsigned int cycles_per_irq = 0;
/* When nonzero, indicates that the FIRQ should be triggered periodically,
every so many cycles. By default no periodic FIRQ is generated. */
unsigned int cycles_per_firq = 0;
/* Nonzero if debugging support is turned on */
int debug_enabled = 0;
/* Nonzero if tracing is enabled */
int trace_enabled = 0;
/* When nonzero, causes the program to print the total number of cycles
on a successful exit. */
int dump_cycles_on_success = 0;
/* When nonzero, indicates the total number of cycles before an automated
exit. This is to help speed through test cases that never finish. */
#ifdef CONFIG_WPC
int max_cycles = -1;
#else
int max_cycles = 100000000;
#endif
char *exename;
const char *machine_name = "simple";
static void usage (void)
{
printf ("Usage: %s <options> filename\n", exename);
printf ("Options are:\n");
printf ("-hex - load intel hex file\n");
printf ("-s19 - load motorola s record file\n");
printf ("-bin - load binary file\n");
printf ("-s addr - specify binary load address hexadecimal (default 0)\n");
printf ("default format is motorola s record\n");
exit (1);
}
int
main (int argc, char *argv[])
{
char *name = NULL;
int type = S19;
int off = 0;
int i, j, n;
int argn = 1;
int load_tmp_map = 0;
exename = argv[0];
while (argn < argc)
{
if (argv[argn][0] == '-')
{
int argpos = 1;
next_arg:
switch (argv[argn][argpos++])
{
case 'd':
debug_enabled = 1;
goto next_arg;
case 'h':
type = HEX;
goto next_arg;
case 'b':
type = BIN;
goto next_arg;
case 'M':
mhz = strtoul (argv[++argn], NULL, 16);
break;
case 'o':
off = strtoul (argv[++argn], NULL, 16);
type = BIN;
break;
case 'I':
cycles_per_irq = strtoul (argv[++argn], NULL, 0);
break;
case 'F':
cycles_per_firq = strtoul (argv[++argn], NULL, 0);
break;
case 'C':
dump_cycles_on_success = 1;
goto next_arg;
case 't':
load_tmp_map = 1;
break;
case 'T':
trace_enabled = 1;
goto next_arg;
case 'm':
max_cycles = strtoul (argv[++argn], NULL, 16);
break;
case 's':
machine_name = argv[++argn];
break;
case '\0':
break;
default:
usage ();
}
}
else if (!name)
{
name = argv[argn];
}
else
{
usage ();
}
argn++;
}
+ sym_init ();
+
switch (type)
{
case HEX:
if (name && load_hex (name))
usage ();
break;
case S19:
machine_init (machine_name, NULL);
if (name && load_s19 (name))
usage ();
break;
default:
machine_init (machine_name, name);
break;
}
- /* Initialize all of the simulator pieces. */
- sym_init ();
-
/* Try to load a map file */
if (load_tmp_map)
load_map_file ("tmp");
else if (name)
load_map_file (name);
/* Enable debugging if no executable given yet. */
if (!name)
debug_enabled = 1;
else
/* OK, ready to run. Reset the CPU first. */
cpu_reset ();
monitor_init ();
command_init ();
/* Now, iterate through the instructions.
* If no IRQs or FIRQs are enabled, we can just call cpu_execute()
* and let it run for a long time; otherwise, we need to come back
* here periodically and do the interrupt handling. */
for (cpu_quit = 1; cpu_quit != 0;)
{
if ((cycles_per_irq == 0) && (cycles_per_firq == 0))
{
total += cpu_execute (max_cycles ? max_cycles-1 : 500000);
}
else
{
/* TODO - FIRQ not handled yet */
total += cpu_execute (cycles_per_irq);
request_irq (0);
}
/* Check for a rogue program that won't end */
if ((max_cycles > 0) && (total > max_cycles))
{
sim_error ("maximum cycle count exceeded at %s\n",
monitor_addr_name (get_pc ()));
}
}
printf ("m6809-run stopped after %d cycles\n", total);
return 0;
}
diff --git a/monitor.c b/monitor.c
old mode 100644
new mode 100755
index a271867..ad8a296
--- a/monitor.c
+++ b/monitor.c
@@ -449,1420 +449,1060 @@ opcode_t codes10[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _imm_word},
{_undoc, _illegal},
{_ldy, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _direct},
{_undoc, _illegal},
{_ldy, _direct},
{_sty, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _indexed},
{_undoc, _illegal},
{_ldy, _indexed},
{_sty, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpd, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpy, _extended},
{_undoc, _illegal},
{_ldy, _extended},
{_sty, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _direct},
{_sts, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _indexed},
{_sts, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_lds, _extended},
{_sts, _extended}
};
opcode_t codes11[256] = {
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_swi3, _implied},
{_undoc, _illegal}, /* 11 40 */
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _imm_word},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _direct},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _indexed},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmpu, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_cmps, _extended},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal},
{_undoc, _illegal}
};
char *reg[] = {
"D", "X", "Y", "U", "S", "PC", "??", "??",
"A", "B", "CC", "DP", "??", "??", "??", "??"
};
char index_reg[] = { 'X', 'Y', 'U', 'S' };
char *off4[] = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15",
"-16", "-15", "-14", "-13", "-12", "-11", "-10", "-9",
"-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"
};
void
add_named_symbol (const char *id, target_addr_t value, const char *filename)
{
struct x_symbol *sym;
static char *last_filename = "";
symtab.addr_to_symbol[value] = sym = malloc (sizeof (struct x_symbol));
sym->flags = S_NAMED;
sym->u.named.id = symtab.name_area_next;
sym->u.named.addr = value;
strcpy (symtab.name_area_next, id);
symtab.name_area_next += strlen (symtab.name_area_next) + 1;
if (!filename)
filename = "";
if (strcmp (filename, last_filename))
{
last_filename = symtab.name_area_next;
strcpy (last_filename, filename);
symtab.name_area_next += strlen (symtab.name_area_next) + 1;
}
sym->u.named.file = last_filename;
}
struct x_symbol *
find_symbol (target_addr_t value)
{
struct x_symbol *sym = NULL;
#if 1
return NULL;
#endif
while (value > 0)
{
sym = symtab.addr_to_symbol[value];
if (sym)
break;
else
value--;
}
return sym;
}
struct x_symbol *
find_symbol_by_name (const char *id)
{
unsigned int addr;
struct x_symbol *sym;
for (addr = 0; addr < 0x10000; addr++)
{
sym = symtab.addr_to_symbol[addr];
if (sym && !strcmp (sym->u.named.id, id))
return sym;
}
return NULL;
}
/* Disassemble the current instruction. Returns the number of bytes that
compose it. */
int
-dasm (char *buf, int opc)
+dasm (char *buf, absolute_address_t opc)
{
UINT8 op, am;
char *op_str;
- int pc = opc & 0xffff;
+ absolute_address_t pc = opc;
char R;
int fetch1; /* the first (MSB) fetched byte, used in macro RDWORD */
op = fetch8 ();
if (op == 0x10)
{
op = fetch8 ();
am = codes10[op].mode;
op = codes10[op].code;
}
else if (op == 0x11)
{
op = fetch8 ();
am = codes11[op].mode;
op = codes11[op].code;
}
else
{
am = codes[op].mode;
op = codes[op].code;
}
op_str = (char *) mne[op];
switch (am)
{
case _illegal:
sprintf (buf, "???");
break;
case _implied:
sprintf (buf, "%s ", op_str);
break;
case _imm_byte:
sprintf (buf, "%s #$%02X", op_str, fetch8 ());
break;
case _imm_word:
sprintf (buf, "%s #$%04X", op_str, fetch16 ());
break;
case _direct:
sprintf (buf, "%s <%s", op_str, monitor_addr_name (fetch8 ()));
break;
case _extended:
sprintf (buf, "%s %s", op_str, monitor_addr_name (fetch16 ()));
break;
case _indexed:
op = fetch8 ();
R = index_reg[(op >> 5) & 0x3];
if ((op & 0x80) == 0)
{
sprintf (buf, "%s %s,%c", op_str, off4[op & 0x1f], R);
break;
}
switch (op & 0x1f)
{
case 0x00:
sprintf (buf, "%s ,%c+", op_str, R);
break;
case 0x01:
sprintf (buf, "%s ,%c++", op_str, R);
break;
case 0x02:
sprintf (buf, "%s ,-%c", op_str, R);
break;
case 0x03:
sprintf (buf, "%s ,--%c", op_str, R);
break;
case 0x04:
sprintf (buf, "%s ,%c", op_str, R);
break;
case 0x05:
sprintf (buf, "%s B,%c", op_str, R);
break;
case 0x06:
sprintf (buf, "%s A,%c", op_str, R);
break;
case 0x08:
sprintf (buf, "%s $%02X,%c", op_str, fetch8 (), R);
break;
case 0x09:
sprintf (buf, "%s $%04X,%c", op_str, fetch16 (), R);
break;
case 0x0B:
sprintf (buf, "%s D,%c", op_str, R);
break;
case 0x0C:
sprintf (buf, "%s $%02X,PC", op_str, fetch8 ());
break;
case 0x0D:
sprintf (buf, "%s $%04X,PC", op_str, fetch16 ());
break;
case 0x11:
sprintf (buf, "%s [,%c++]", op_str, R);
break;
case 0x13:
sprintf (buf, "%s [,--%c]", op_str, R);
break;
case 0x14:
sprintf (buf, "%s [,%c]", op_str, R);
break;
case 0x15:
sprintf (buf, "%s [B,%c]", op_str, R);
break;
case 0x16:
sprintf (buf, "%s [A,%c]", op_str, R);
break;
case 0x18:
sprintf (buf, "%s [$%02X,%c]", op_str, fetch8 (), R);
break;
case 0x19:
sprintf (buf, "%s [$%04X,%c]", op_str, fetch16 (), R);
break;
case 0x1B:
sprintf (buf, "%s [D,%c]", op_str, R);
break;
case 0x1C:
sprintf (buf, "%s [$%02X,PC]", op_str, fetch8 ());
break;
case 0x1D:
sprintf (buf, "%s [$%04X,PC]", op_str, fetch16 ());
break;
case 0x1F:
sprintf (buf, "%s [%s]", op_str, monitor_addr_name (fetch16 ()));
break;
default:
sprintf (buf, "%s ??", op_str);
break;
}
break;
case _rel_byte:
fetch1 = ((INT8) fetch8 ());
sprintf (buf, "%s $%04X", op_str, (fetch1 + pc) & 0xffff);
break;
case _rel_word:
sprintf (buf, "%s $%04X", op_str, (fetch16 () + pc) & 0xffff);
break;
case _reg_post:
op = fetch8 ();
sprintf (buf, "%s %s,%s", op_str, reg[op >> 4], reg[op & 15]);
break;
case _usr_post:
case _sys_post:
op = fetch8 ();
sprintf (buf, "%s ", op_str);
if (op & 0x80)
strcat (buf, "PC,");
if (op & 0x40)
strcat (buf, am == _usr_post ? "S," : "U,");
if (op & 0x20)
strcat (buf, "Y,");
if (op & 0x10)
strcat (buf, "X,");
if (op & 0x08)
strcat (buf, "DP,");
if ((op & 0x06) == 0x06)
strcat (buf, "D,");
else
{
if (op & 0x04)
strcat (buf, "B,");
if (op & 0x02)
strcat (buf, "A,");
}
if (op & 0x01)
strcat (buf, "CC,");
buf[strlen (buf) - 1] = '\0';
break;
}
return pc - opc;
}
int
sizeof_file (FILE * file)
{
int size;
fseek (file, 0, SEEK_END);
size = ftell (file);
rewind (file);
return size;
}
int
load_map_file (const char *name)
{
FILE *fp;
char map_filename[256];
char buf[256];
char *value_ptr, *id_ptr;
target_addr_t value;
char *file_ptr;
sprintf (map_filename, "%s.map", name);
fp = fopen (map_filename, "r");
if (!fp)
return -1;
for (;;)
{
fgets (buf, sizeof(buf)-1, fp);
if (feof (fp))
break;
value_ptr = buf;
if (strncmp (value_ptr, " ", 6))
continue;
while (*value_ptr == ' ')
value_ptr++;
value = strtoul (value_ptr, &id_ptr, 16);
if (id_ptr == value_ptr)
continue;
while (*id_ptr == ' ')
id_ptr++;
id_ptr = strtok (id_ptr, " \t\n");
if (((*id_ptr == 'l') || (*id_ptr == 's')) && (id_ptr[1] == '_'))
continue;
++id_ptr;
file_ptr = strtok (NULL, " \t\n");
add_named_symbol (id_ptr, value, file_ptr);
}
fclose (fp);
return 0;
}
int
load_hex (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = fopen (name, "r");
if (fp == NULL)
{
printf ("failed to open hex record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, ":%2x%4x%2x", &count, &addr, &type) != 3)
{
printf ("line %d: invalid hex record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff) + type;
switch (type)
{
case 0:
for (; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid hex record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 1:
checksum = (-checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid hex record checksum \n", line);
done = 0;
break;
case 2:
default:
printf ("line %d: not supported hex type %d.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
int
load_s19 (char *name)
{
FILE *fp;
int count, addr, type, data, checksum;
int done = 1;
int line = 0;
fp = fopen (name, "r");
if (fp == NULL)
{
printf ("failed to open S-record file %s.\n", name);
return 1;
}
while (done != 0)
{
line++;
if (fscanf (fp, "S%1x%2x%4x", &type, &count, &addr) != 3)
{
printf ("line %d: invalid S record information.\n", line);
break;
}
checksum = count + (addr >> 8) + (addr & 0xff);
switch (type)
{
case 1:
for (count -= 3; count != 0; count--, addr++, checksum += data)
{
fscanf (fp, "%2x", &data);
write8 (addr, (UINT8) data);
}
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
{
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
}
(void) fgetc (fp); /* skip CR/LF/NULL */
break;
case 9:
checksum = (~checksum) & 0xff;
fscanf (fp, "%2x", &data);
if (data != checksum)
printf ("line %d: invalid S record checksum.\n", line);
done = 0;
break;
default:
printf ("line %d: S%d not supported.\n", line, type);
done = 0;
break;
}
}
fclose (fp);
return 0;
}
void
monitor_call (unsigned int flags)
{
#ifdef CALL_STACK
if (current_function_call <= &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call++;
current_function_call->entry_point = get_pc ();
current_function_call->flags = flags;
}
#endif
}
void
monitor_return (void)
{
#ifdef CALL_STACK
if (current_function_call > &fctab[MAX_FUNCTION_CALLS-1])
{
current_function_call--;
return;
}
while ((current_function_call->flags & FC_TAIL_CALL) &&
(current_function_call > fctab))
{
current_function_call--;
}
if (current_function_call > fctab)
current_function_call--;
#endif
}
const char *
monitor_addr_name (target_addr_t addr)
{
static char addr_name[256];
struct x_symbol *sym;
sym = find_symbol (addr);
if (sym)
{
if (sym->u.named.addr == addr)
return sym->u.named.id;
else
sprintf (addr_name, "%s+0x%X",
sym->u.named.id, addr - sym->u.named.addr);
}
else
sprintf (addr_name, "$%04X", addr);
return addr_name;
}
-void
-str_toupper (char *str)
-{
- if (*str == '\0' || str == NULL)
- return;
- do
- {
- *str = toupper (*str);
- str++;
- }
- while (*str != '\0');
-}
-
-int
-str_getnumber (char *str)
-{
- struct x_symbol *sym = find_symbol_by_name (str);
- if (sym)
- return sym->u.named.addr;
-
- return strtoul (str, NULL, 0);
-}
-
-int
-str_scan (char *str, char *table[], int maxi)
-{
- int i = 0;
-
- for (;;)
- {
- while (isgraph (*str) == 0 && *str != '\0')
- str++;
- if (*str == '\0')
- return i;
- table[i] = str;
- if (maxi-- == 0)
- return i;
-
- while (isgraph (*str) != 0)
- str++;
- if (*str == '\0')
- return i;
- *str++ = '\0';
- i++;
- }
-}
-
-typedef struct
-{
- int cmd_nro;
- char *cmd_string;
-} command_t;
-
-enum cmd_numbers
-{
- CMD_HELP,
- CMD_DUMP,
- CMD_DASM,
- CMD_RUN,
- CMD_STEP,
- CMD_CONTINUE,
- CMD_SET,
- CMD_CLR,
- CMD_SHOW,
- CMD_SETBRK,
- CMD_CLRBRK,
- CMD_BRKSHOW,
- CMD_JUMP,
- CMD_QUIT,
- CMD_BACKTRACE,
- CMD_NEXT,
- CMD_RESET,
-
- REG_PC,
- REG_X,
- REG_Y,
- REG_S,
- REG_U,
- REG_D,
- REG_CC,
- REG_DP,
- REG_A,
- REG_B,
- CCR_E,
- CCR_F,
- CCR_H,
- CCR_I,
- CCR_N,
- CCR_Z,
- CCR_V,
- CCR_C
-};
-
-command_t cmd_table[] = {
- {CMD_HELP, "h"},
- {CMD_DUMP, "dump"},
- {CMD_DASM, "dasm"},
- {CMD_RUN, "r"},
- {CMD_JUMP, "jump"},
- {CMD_SET, "set"},
- {CMD_CLR, "clear"},
- {CMD_SHOW, "show"},
- {CMD_SETBRK, "b"},
- {CMD_CLRBRK, "bc"},
- {CMD_BRKSHOW, "bl"},
- {CMD_QUIT, "q"},
- {CMD_CONTINUE, "c"},
- {CMD_STEP, "s"},
- {CMD_NEXT, "n"},
- {CMD_BACKTRACE, "bt" },
- {CMD_RESET, "reset" },
- {-1, NULL}
-};
-
-command_t arg_table[] = {
- {REG_PC, "PC"},
- {REG_X, "X"},
- {REG_Y, "Y"},
- {REG_S, "S"},
- {REG_U, "U"},
- {REG_D, "D"},
- {REG_CC, "CC"},
- {REG_DP, "DP"},
- {REG_A, "A"},
- {REG_B, "B"},
- {CCR_E, "E"},
- {CCR_F, "F"},
- {CCR_H, "H"},
- {CCR_I, "I"},
- {CCR_N, "N"},
- {CCR_Z, "Z"},
- {CCR_V, "V"},
- {CCR_C, "C"},
-
- {-1, NULL}
-};
-
-
-
static void
monitor_signal (int sigtype)
{
(void) sigtype;
putchar ('\n');
monitor_on = 1;
}
void
monitor_init (void)
{
int tmp;
extern int debug_enabled;
target_addr_t a;
symtab.name_area = symtab.name_area_next =
malloc (symtab.name_area_free = 0x100000);
a = 0;
do {
symtab.addr_to_symbol[a] = NULL;
} while (++a != 0);
fctab[0].entry_point = read16 (0xfffe);
memset (&fctab[0].entry_regs, 0, sizeof (struct cpu_regs));
current_function_call = &fctab[0];
auto_break_insn_count = 0;
monitor_on = debug_enabled;
signal (SIGINT, monitor_signal);
}
int
check_break (unsigned break_pc)
{
if (auto_break_insn_count > 0)
if (--auto_break_insn_count == 0)
return 1;
return 0;
}
void
cmd_show (void)
{
int cc = get_cc ();
int pc = get_pc ();
char inst[50];
int offset, moffset;
moffset = dasm (inst, pc);
printf ("S $%04X U $%04X X $%04X Y $%04X EFHINZVC\n", get_s (),
get_u (), get_x (), get_y ());
printf ("A $%02X B $%02X DP $%02X CC $%02X ", get_a (),
get_b (), get_dp (), cc);
printf ("%c%c%c%c", (cc & E_FLAG ? '1' : '.'), (cc & F_FLAG ? '1' : '.'),
(cc & H_FLAG ? '1' : '.'), (cc & I_FLAG ? '1' : '.'));
printf ("%c%c%c%c\n", (cc & N_FLAG ? '1' : '.'), (cc & Z_FLAG ? '1' : '.'),
(cc & V_FLAG ? '1' : '.'), (cc & C_FLAG ? '1' : '.'));
printf ("PC: %s ", monitor_addr_name (pc));
printf ("Cycle %lX ", total);
for (offset = 0; offset < moffset; offset++)
printf ("%02X", read8 (offset+pc));
printf (" NextInst: %s\n", inst);
}
void
monitor_prompt (void)
{
char inst[50];
target_addr_t pc = get_pc ();
dasm (inst, pc);
printf ("S:%04X U:%04X X:%04X Y:%04X D:%04X\n",
get_s (), get_u (), get_x (), get_y (), get_d ());
printf ("%30.30s %s\n", monitor_addr_name (pc), inst);
}
void
monitor_backtrace (void)
{
struct function_call *fc = current_function_call;
while (fc >= &fctab[0]) {
printf ("%s\n", monitor_addr_name (fc->entry_point));
fc--;
}
}
int
monitor6809 (void)
{
int rc;
signal (SIGINT, monitor_signal);
rc = command_loop ();
monitor_on = 0;
return rc;
-
-#if 0
- case CMD_BACKTRACE:
- monitor_backtrace ();
- continue;
-
- case CMD_JUMP:
- if (arg_count != 2)
- break;
- set_pc (str_getnumber (arg[1]) & 0xffff);
- return 0;
-
- case CMD_SET:
- if (arg_count == 3)
- {
- int temp = str_getnumber (arg[2]);
-
- switch (get_command (arg[1], arg_table))
- {
- case REG_PC:
- set_pc (temp);
- continue;
- case REG_X:
- set_x (temp);
- continue;
- case REG_Y:
- set_y (temp);
- continue;
- case REG_S:
- set_s (temp);
- continue;
- case REG_U:
- set_u (temp);
- continue;
- case REG_D:
- set_d (temp);
- continue;
- case REG_CC:
- set_cc (temp);
- continue;
- case REG_DP:
- set_dp (temp);
- continue;
- case REG_A:
- set_a (temp);
- continue;
- case REG_B:
- set_b (temp);
- continue;
- }
- break; /* invalid argument */
- }
- else if (arg_count == 2)
- {
- switch (get_command (arg[1], arg_table))
- {
- case CCR_E:
- set_cc (get_cc () | E_FLAG);
- continue;
- case CCR_F:
- set_cc (get_cc () | F_FLAG);
- continue;
- case CCR_H:
- set_cc (get_cc () | H_FLAG);
- continue;
- case CCR_I:
- set_cc (get_cc () | I_FLAG);
- continue;
- case CCR_N:
- set_cc (get_cc () | N_FLAG);
- continue;
- case CCR_Z:
- set_cc (get_cc () | Z_FLAG);
- continue;
- case CCR_V:
- set_cc (get_cc () | V_FLAG);
- continue;
- case CCR_C:
- set_cc (get_cc () | C_FLAG);
- continue;
- }
- break; /* invalid argument */
- }
- break; /* invalid number of arguments */
-
- case CMD_CLR:
- if (arg_count != 2)
- break;
-
- switch (get_command (arg[1], arg_table))
- {
- case REG_PC:
- set_pc (0);
- continue;
- case REG_X:
- set_x (0);
- continue;
- case REG_Y:
- set_y (0);
- continue;
- case REG_S:
- set_s (0);
- continue;
- case REG_U:
- set_u (0);
- continue;
- case REG_D:
- set_d (0);
- continue;
- case REG_DP:
- set_dp (0);
- continue;
- case REG_CC:
- set_cc (0);
- continue;
- case REG_A:
- set_a (0);
- continue;
- case REG_B:
- set_b (0);
- continue;
-
- case CCR_E:
- set_cc (get_cc () & ~E_FLAG);
- continue;
- case CCR_F:
- set_cc (get_cc () & ~F_FLAG);
- continue;
- case CCR_H:
- set_cc (get_cc () & ~H_FLAG);
- continue;
- case CCR_I:
- set_cc (get_cc () & ~I_FLAG);
- continue;
- case CCR_N:
- set_cc (get_cc () & ~N_FLAG);
- continue;
- case CCR_Z:
- set_cc (get_cc () & ~Z_FLAG);
- continue;
- case CCR_V:
- set_cc (get_cc () & ~V_FLAG);
- continue;
- case CCR_C:
- set_cc (get_cc () & ~C_FLAG);
- continue;
- }
- break; /* invalid argument */
-
- case CMD_SHOW:
- if (arg_count != 2)
- {
- cmd_show ();
- continue;
- }
-
- switch (get_command (arg[1], arg_table))
- {
- case REG_PC:
- printf ("PC: %s\n", monitor_addr_name (get_pc ()));
- continue;
- case REG_X:
- printf ("X: $%04X\n", get_x ());
- continue;
- case REG_Y:
- printf ("Y: $%04X\n", get_y ());
- continue;
- case REG_S:
- printf ("S: $%04X\n", get_s ());
- continue;
- case REG_U:
- printf ("U: $%04X\n", get_u ());
- continue;
- case REG_D:
- printf ("D: $%04X\n", get_d ());
- continue;
- case REG_DP:
- printf ("DP: $%02X\n", get_dp ());
- continue;
- case REG_CC:
- printf ("CC: $%02X\n", get_cc ());
- continue;
- case REG_A:
- printf ("A: $%02X\n", get_a ());
- continue;
- case REG_B:
- printf ("B: $%02X\n", get_b ());
- continue;
-
- case CCR_E:
- printf ("CC:E %c\n", get_cc () & E_FLAG ? '1' : '0');
- continue;
- case CCR_F:
- printf ("CC:F %c\n", get_cc () & F_FLAG ? '1' : '0');
- continue;
- case CCR_H:
- printf ("CC:H %c\n", get_cc () & H_FLAG ? '1' : '0');
- continue;
- case CCR_I:
- printf ("CC:I %c\n", get_cc () & I_FLAG ? '1' : '0');
- continue;
- case CCR_N:
- printf ("CC:N %c\n", get_cc () & N_FLAG ? '1' : '0');
- continue;
-
- case CCR_Z:
- printf ("CC:Z %c\n", get_cc () & Z_FLAG ? '1' : '0');
- continue;
- case CCR_V:
- printf ("CC:V %c\n", get_cc () & V_FLAG ? '1' : '0');
- continue;
- case CCR_C:
- printf ("CC:C %c\n", get_cc () & C_FLAG ? '1' : '0');
- continue;
- }
- break; /* invalid argument */
-
- case CMD_RESET:
- cpu_reset ();
- continue;
-#endif
}
diff --git a/symtab.c b/symtab.c
old mode 100644
new mode 100755
index 3466c79..524d333
--- a/symtab.c
+++ b/symtab.c
@@ -1,153 +1,160 @@
/*
* Copyright 2008 by Brian Dominy <brian@oddchange.com>
*
* This file is part of the Portable 6809 Simulator.
*
* The Simulator 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.
*
* The Simulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct stringspace *current_stringspace;
-struct symtab default_symtab;
-
-struct symtab *current_symtab = &default_symtab;
+struct symtab program_symtab;
+struct symtab internal_symtab;
struct stringspace *stringspace_create (void)
{
struct stringspace *ss = malloc (sizeof (struct stringspace));
ss->used = 0;
return ss;
}
char *stringspace_copy (const char *string)
{
unsigned int len = strlen (string) + 1;
char *result;
if (current_stringspace->used + len > MAX_STRINGSPACE)
current_stringspace = stringspace_create ();
result = current_stringspace->space + current_stringspace->used;
strcpy (result, string);
current_stringspace->used += len;
return result;
}
unsigned int sym_hash_name (const char *name)
{
unsigned int hash = *name & 0x1F;
if (*name++ != '\0')
{
hash = (hash << 11) + (544 * *name);
if (*name++ != '\0')
{
hash = (hash << 5) + (17 * *name);
}
}
return hash % MAX_SYMBOL_HASH;
}
unsigned int sym_hash_value (unsigned long value)
{
return value % MAX_SYMBOL_HASH;
}
-int sym_find (const char *name, unsigned long *value, unsigned int type)
+/**
+ * Lookup the symbol 'name'.
+ * Returns 0 if the symbol exists (and optionally stores its value
+ * in *value if not NULL), or -1 if it does not exist.
+ */
+int sym_find (struct symtab *symtab,
+ const char *name, unsigned long *value, unsigned int type)
{
unsigned int hash = sym_hash_name (name);
- struct symtab *symtab = current_symtab;
/* Search starting in the current symbol table, and if that fails,
* try its parent tables. */
while (symtab != NULL)
{
/* Find the list of elements that hashed to this string. */
struct symbol *chain = symtab->syms_by_name[hash];
/* Scan the list for an exact match, and return it. */
while (chain != NULL)
{
if (!strcmp (name, chain->name))
{
if (type && (chain->type != type))
return -1;
- *value = chain->value;
+ if (value)
+ *value = chain->value;
return 0;
}
chain = chain->chain;
}
symtab = symtab->parent;
}
return -1;
}
const char *sym_lookup (struct symtab *symtab, unsigned long value)
{
unsigned int hash = sym_hash_value (value);
while (symtab != NULL)
{
struct symbol *chain = symtab->syms_by_value[hash];
while (chain != NULL)
{
if (value == chain->value)
return chain->name;
chain = chain->chain;
}
symtab = symtab->parent;
}
return NULL;
}
-void sym_add (const char *name, unsigned long value, unsigned int type)
+void sym_add (struct symtab *symtab,
+ const char *name, unsigned long value, unsigned int type)
{
unsigned int hash;
struct symbol *s, *chain;
s = malloc (sizeof (struct symbol));
s->name = stringspace_copy (name);
s->value = value;
s->type = type;
hash = sym_hash_name (name);
- chain = current_symtab->syms_by_name[hash];
+ chain = symtab->syms_by_name[hash];
s->chain = chain;
- current_symtab->syms_by_name[hash] = s;
+ symtab->syms_by_name[hash] = s;
hash = sym_hash_value (value);
- chain = current_symtab->syms_by_value[hash];
+ chain = symtab->syms_by_value[hash];
s->chain = chain;
- current_symtab->syms_by_value[hash] = s;
+ symtab->syms_by_value[hash] = s;
}
void sym_init (void)
{
current_stringspace = stringspace_create ();
- memset (&default_symtab, 0, sizeof (default_symtab));
+ memset (&program_symtab, 0, sizeof (program_symtab));
+ memset (&internal_symtab, 0, sizeof (internal_symtab));
}
diff --git a/wpc.c b/wpc.c
old mode 100644
new mode 100755
index d864b37..0e37fea
--- a/wpc.c
+++ b/wpc.c
@@ -1,367 +1,403 @@
/*
* Copyright 2006, 2007 by Brian Dominy <brian@oddchange.com>
*
* This file is part of GCC6809.
*
* GCC6809 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.
*
* GCC6809 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 GCC6809; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "6809.h"
+#include <sys/time.h>
#define WPC_RAM_BASE 0x0000
#define WPC_RAM_SIZE 0x2000
#define WPC_ROM_SIZE 0x100000
#define WPC_PAGED_REGION 0x4000
#define WPC_PAGED_SIZE 0x4000
#define WPC_FIXED_REGION 0x8000
#define WPC_FIXED_SIZE 0x8000
/* The register set of the WPC ASIC */
#define WPC_ASIC_BASE 0x3800
#define WPC_DMD_LOW_BASE 0x3800
#define WPC_DMD_HIGH_BASE 0x3A00
#define WPC_DEBUG_DATA_PORT 0x3D60
#define WPC_DEBUG_CONTROL_PORT 0x3D61
#define WPC_DEBUG_WRITE_READY 0x1
#define WPC_DEBUG_READ_READY 0x2
#define WPC_PINMAME_CYCLE_COUNT 0x3D62
#define WPC_PINMAME_FUNC_ENTRY_HI 0x3D63
#define WPC_PINMAME_FUNC_ENTRY_LO 0x3D64
#define WPC_PINMAME_FUNC_EXIT_HI 0x3D65
#define WPC_PINMAME_FUNC_EXIT_LO 0x3D66
#define WPC_SERIAL_CONTROL_PORT 0x3E66
#define WPC_SERIAL_DATA_PORT 0x3E67
#define WPC_DMD_3200_PAGE 0x3FB8
#define WPC_DMD_3000_PAGE 0x3FB9
#define WPC_DMD_3600_PAGE 0x3FBA
#define WPC_DMD_3400_PAGE 0x3FBB
#define WPC_DMD_HIGH_PAGE 0x3FBC
#define WPC_DMD_FIRQ_ROW_VALUE 0x3FBD
#define WPC_DMD_LOW_PAGE 0x3FBE
#define WPC_DMD_ACTIVE_PAGE 0x3FBF
#define WPC_SERIAL_STATUS_PORT 0x3FC0
#define WPC_PARALLEL_DATA_PORT 0x3FC1
#define WPC_PARALLEL_STROBE_PORT 0x3FC2
#define WPC_SERIAL_DATA_OUTPUT 0x3FC3
#define WPC_SERIAL_CONTROL_OUTPUT 0x3FC4
#define WPC_SERIAL_BAUD_SELECT 0x3FC5
#define WPC_TICKET_DISPENSE 0x3FC6
#define WPC_DCS_SOUND_DATA_OUT 0x3FD0
#define WPC_DCS_SOUND_DATA_IN 0x3FD1
#define WPC_DCS_SOUND_RESET 0x3FD2
#define WPC_DCS_SOUND_DATA_READY 0x3FD3
#define WPC_FLIPTRONIC_PORT_A 0x3FD4
#define WPC_FLIPTRONIC_PORT_B 0x3FD5
#define WPCS_DATA 0x3FDC
#define WPCS_CONTROL_STATUS 0x3FDD
#define WPC_SOL_FLASH2_OUTPUT 0x3FE0
#define WPC_SOL_HIGHPOWER_OUTPUT 0x3FE1
#define WPC_SOL_FLASH1_OUTPUT 0x3FE2
#define WPC_SOL_LOWPOWER_OUTPUT 0x3FE3
#define WPC_LAMP_ROW_OUTPUT 0x3FE4
#define WPC_LAMP_COL_STROBE 0x3FE5
#define WPC_GI_TRIAC 0x3FE6
#define WPC_SW_JUMPER_INPUT 0x3FE7
#define WPC_SW_CABINET_INPUT 0x3FE8
#define WPC_SW_ROW_INPUT 0x3FE9
#define WPC_SW_COL_STROBE 0x3FEA
#if (MACHINE_PIC == 1)
#define WPCS_PIC_READ 0x3FE9
#define WPCS_PIC_WRITE 0x3FEA
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_POS 0x3FEB
#define WPC_ALPHA_ROW1 0x3FEC
#else
#define WPC_EXTBOARD1 0x3FEB
#define WPC_EXTBOARD2 0x3FEC
#define WPC_EXTBOARD3 0x3FED
#endif
#if (MACHINE_WPC95 == 1)
#define WPC95_FLIPPER_COIL_OUTPUT 0x3FEE
#define WPC95_FLIPPER_SWITCH_INPUT 0x3FEF
#else
#endif
#if (MACHINE_DMD == 0)
#define WPC_ALPHA_ROW2 0x3FEE
#else
#endif
#define WPC_LEDS 0x3FF2
#define WPC_RAM_BANK 0x3FF3
#define WPC_SHIFTADDR 0x3FF4
#define WPC_SHIFTBIT 0x3FF6
#define WPC_SHIFTBIT2 0x3FF7
#define WPC_PERIPHERAL_TIMER_FIRQ_CLEAR 0x3FF8
#define WPC_ROM_LOCK 0x3FF9
#define WPC_CLK_HOURS_DAYS 0x3FFA
#define WPC_CLK_MINS 0x3FFB
#define WPC_ROM_BANK 0x3FFC
#define WPC_RAM_LOCK 0x3FFD
#define WPC_RAM_LOCKSIZE 0x3FFE
#define WPC_ZEROCROSS_IRQ_CLEAR 0x3FFF
struct wpc_asic
{
struct hw_device *rom_dev;
struct hw_device *ram_dev;
U8 led;
U8 rombank;
U8 ram_unlocked;
U8 ram_lock_size;
U16 shiftaddr;
U16 shiftbit;
+ U8 lamp_strobe;
+ U8 lamp_mx[8];
+ U8 sols[6];
+ U8 switch_strobe;
+ U8 switch_mx[8];
+ U8 directsw;
};
void wpc_asic_reset (struct hw_device *dev)
{
+ struct wpc_asic *wpc = dev->priv;
}
static int wpc_console_inited = 0;
static U8 wpc_get_console_state (void)
{
fd_set fds;
struct timeval timeout;
U8 rc = WPC_DEBUG_WRITE_READY;
if (!wpc_console_inited)
rc |= WPC_DEBUG_READ_READY;
FD_ZERO (&fds);
FD_SET (0, &fds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select (1, &fds, NULL, NULL, &timeout))
{
rc |= WPC_DEBUG_READ_READY;
printf ("read ready!\n");
}
return rc;
}
static U8 wpc_console_read (void)
{
int rc;
U8 c = 0;
if (!wpc_console_inited)
{
wpc_console_inited = 1;
return 0;
}
rc = read (0, &c, 1);
return c;
}
static void wpc_console_write (U8 val)
{
putchar (val);
fflush (stdout);
}
+static int scanbit (U8 val)
+{
+ if (val & 0x80) return 7;
+ else if (val & 0x40) return 6;
+ else if (val & 0x20) return 5;
+ else if (val & 0x10) return 4;
+ else if (val & 0x08) return 3;
+ else if (val & 0x04) return 2;
+ else if (val & 0x02) return 1;
+ else if (val & 0x01) return 0;
+ else return -1;
+}
+
+
U8 wpc_asic_read (struct hw_device *dev, unsigned long addr)
{
struct wpc_asic *wpc = dev->priv;
U8 val;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
val = wpc->led;
break;
case WPC_ROM_BANK:
val = wpc->rombank;
break;
case WPC_DEBUG_CONTROL_PORT:
val = wpc_get_console_state ();
break;
case WPC_DEBUG_DATA_PORT:
val = wpc_console_read ();
break;
case WPC_SHIFTADDR:
val = wpc->shiftaddr >> 8;
break;
case WPC_SHIFTADDR+1:
val = (wpc->shiftaddr & 0xFF) + (wpc->shiftbit % 8);
break;
case WPC_SHIFTBIT:
val = 1 << (wpc->shiftbit % 8);
break;
default:
val = 0;
break;
}
//printf (">>> ASIC read %04X -> %02X\n", addr + WPC_ASIC_BASE, val);
return val;
}
/**
* Enforce the current read-only area of RAM.
*/
void wpc_update_ram (struct wpc_asic *wpc)
{
unsigned int size_writable = WPC_RAM_SIZE;
if (!wpc->ram_unlocked)
{
switch (wpc->ram_lock_size)
{
default:
break;
case 0xF:
size_writable -= 256;
break;
case 0x7:
size_writable -= 512;
case 0x3:
size_writable -= 1024;
break;
case 0x1:
size_writable -= 2048;
break;
case 0:
size_writable -= 4096;
break;
}
}
bus_map (WPC_RAM_BASE, wpc->ram_dev->devid, 0, size_writable, MAP_READWRITE);
if (size_writable < WPC_RAM_SIZE)
bus_map (WPC_RAM_BASE + size_writable, wpc->ram_dev->devid, size_writable,
WPC_RAM_SIZE - size_writable, MAP_READONLY);
}
void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val)
{
struct wpc_asic *wpc = dev->priv;
switch (addr + WPC_ASIC_BASE)
{
case WPC_LEDS:
wpc->led = val;
break;
case WPC_ZEROCROSS_IRQ_CLEAR:
/* ignore for now */
break;
case WPC_ROM_BANK:
wpc->rombank = val;
bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READONLY);
break;
case WPC_DEBUG_DATA_PORT:
wpc_console_write (val);
break;
case WPC_RAM_LOCK:
wpc->ram_unlocked = val;
wpc_update_ram (wpc);
break;
case WPC_RAM_LOCKSIZE:
wpc->ram_lock_size = val;
wpc_update_ram (wpc);
break;
case WPC_SHIFTADDR:
wpc->shiftaddr &= 0x00FF;
wpc->shiftaddr |= val << 8;
break;
case WPC_SHIFTADDR+1:
wpc->shiftaddr &= 0xFF00;
wpc->shiftaddr |= val;
break;
case WPC_SHIFTBIT:
wpc->shiftbit = val;
break;
+ case WPC_LAMP_ROW_OUTPUT:
+ wpc->lamp_mx[scanbit (wpc->lamp_strobe)] = val;
+ break;
+
+ case WPC_LAMP_COL_STROBE:
+ wpc->lamp_strobe = val;
+ break;
+
default:
break;
}
//printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val);
}
+void wpc_periodic (void)
+{
+}
+
struct hw_class wpc_asic_class =
{
.reset = wpc_asic_reset,
.read = wpc_asic_read,
.write = wpc_asic_write,
};
struct hw_device *wpc_asic_create (void)
{
struct wpc_asic *wpc = calloc (sizeof (struct wpc_asic), 1);
return device_attach (&wpc_asic_class, 0x800, wpc);
}
void wpc_fault (unsigned int addr, unsigned char type)
{
}
struct machine wpc_machine =
{
.fault = wpc_fault,
};
void wpc_init (const char *boot_rom_file)
{
struct hw_device *dev;
struct wpc_asic *wpc;
machine = &wpc_machine;
device_define ( dev = wpc_asic_create (), 0,
WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE);
wpc = dev->priv;
device_define ( dev = ram_create (WPC_RAM_SIZE), 0,
WPC_RAM_BASE, WPC_RAM_SIZE, MAP_READWRITE );
wpc->ram_dev = dev;
dev = rom_create (boot_rom_file, WPC_ROM_SIZE);
device_define ( dev, 0,
WPC_PAGED_REGION, WPC_PAGED_SIZE, MAP_READONLY);
device_define ( dev, WPC_ROM_SIZE - WPC_FIXED_SIZE,
WPC_FIXED_REGION, WPC_FIXED_SIZE, MAP_READONLY);
wpc->rom_dev = dev;
wpc_update_ram (wpc);
+
+ sym_add (&program_symtab, "WPC_ROM_BANK", to_absolute (WPC_ROM_BANK), 0);
}
|
rspeicher/JuggyWishlists
|
f27cb131e12a3a7cb6d6f98546001b3f88d521e6
|
Remove an unused variable
|
diff --git a/JuggyWishlists.lua b/JuggyWishlists.lua
index 3c0ad3f..74a7b3f 100644
--- a/JuggyWishlists.lua
+++ b/JuggyWishlists.lua
@@ -1,34 +1,33 @@
-- Huge thanks to tekkub's Engravings for most of this code.
Wishlists = {}
-local sources = Wishlists
local origs = {}
local R, G, B = 1, 136/255, 0
local db
local function initdb()
return JuggyWishlist_Data
end
Wishlists.initdb = initdb
local function OnTooltipSetItem(frame, ...)
if not db then db = initdb() end
local name, link = frame:GetItem()
if link then
local link_id = tonumber(link:match("item:(%d+):"))
for id,notes in pairs(db) do
if id == link_id then
frame:AddLine(" ", 0, 0, 0)
for index, note in ipairs(notes) do
frame:AddDoubleLine(note[2], note[1], R, G, B, R, G, B)
end
end
end
end
if origs[frame] then return origs[frame](frame, ...) end
end
for _,frame in pairs{GameTooltip, ItemRefTooltip, ShoppingTooltip1, ShoppingTooltip2} do
origs[frame] = frame:GetScript("OnTooltipSetItem")
frame:SetScript("OnTooltipSetItem", OnTooltipSetItem)
end
\ No newline at end of file
|
daaku/python-colorized-logger
|
7f38c1243cf18d1df2bed01ae6fb378f80fea0f3
|
use escape codes instead of binary data, added readme/gitignore
|
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..52e4e61
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.pyc
+*.pyo
diff --git a/README.markdown b/README.markdown
new file mode 100644
index 0000000..a7dbf86
--- /dev/null
+++ b/README.markdown
@@ -0,0 +1,5 @@
+colorized-logger
+================
+
+Include this to enable colorized logging messages for use in a Terminal.
+It turns on DEBUG level logging as well.
diff --git a/__init__.py b/__init__.py
index 48d3243..27027f1 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,17 +1,18 @@
+# coding: utf-8
import logging
-DEF_COLOR="[0m"
-BLUE="[34;01m"
-CYAN="[36;01m"
-GREEN="[32;01m"
-RED="[31;01m"
-GRAY="[37;01m"
-YELLOW="[33;01m"
+DEF_COLOR="\x1b[0m"
+BLUE="\x1b[34;01m"
+CYAN="\x1b[36;01m"
+GREEN="\x1b[32;01m"
+RED="\x1b[31;01m"
+GRAY="\x1b[37;01m"
+YELLOW="\x1b[33;01m"
logging.addLevelName(logging.DEBUG, CYAN + '>> DEBUG')
logging.addLevelName(logging.INFO, GREEN + '>> INFO')
logging.addLevelName(logging.WARNING, YELLOW + '>> WARNING')
logging.addLevelName(logging.ERROR, RED + '>> ERROR')
logging.addLevelName(logging.CRITICAL, RED + '>> CRITICAL')
logging.basicConfig(level=logging.DEBUG, format=' %(levelname)-19s' + DEF_COLOR + ' %(message)s')
|
daaku/python-colorized-logger
|
82713b89de0d33736fede8b458fd1a5025fcae0c
|
haha - never worked, copy paste doesnt mix with binary data
|
diff --git a/__init__.py b/__init__.py
index 301c23e..48d3243 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,15 +1,17 @@
import logging
-DEF_COLOR="^[[0m"
-CYAN="^[[36;01m"
-GREEN="^[[32;01m"
-YELLOW="^[[33;01m"
-RED="^[[31;01m"
+DEF_COLOR="[0m"
+BLUE="[34;01m"
+CYAN="[36;01m"
+GREEN="[32;01m"
+RED="[31;01m"
+GRAY="[37;01m"
+YELLOW="[33;01m"
logging.addLevelName(logging.DEBUG, CYAN + '>> DEBUG')
logging.addLevelName(logging.INFO, GREEN + '>> INFO')
logging.addLevelName(logging.WARNING, YELLOW + '>> WARNING')
logging.addLevelName(logging.ERROR, RED + '>> ERROR')
logging.addLevelName(logging.CRITICAL, RED + '>> CRITICAL')
logging.basicConfig(level=logging.DEBUG, format=' %(levelname)-19s' + DEF_COLOR + ' %(message)s')
|
func09/Basic-Scss
|
52bc01f5bcf05715946813fb9de152d551b3f265
|
ãã©ã¼ã ããã¤ã¢ãã°å¨ã
|
diff --git a/scss/flash.scss b/scss/flash.scss
new file mode 100644
index 0000000..ae7e386
--- /dev/null
+++ b/scss/flash.scss
@@ -0,0 +1,41 @@
+.error, .notice, .successã{
+
+ border: 1px solid #CCCCCC;
+ font-weight: bold;
+ margin: 0 0 1em;
+
+ p {
+ padding: 1px;
+ }
+
+ }
+
+.error, .notice, .success {
+ border: 1px solid #CCCCCC;
+ font-weight: bold;
+ margin: 0 0 1em;
+ p {
+ padding: 1em;
+ margin: 0;
+ font-size: 12px;
+ }
+ }
+
+.success {
+ background: #E6EFC2;
+ border-color: #C6D880;
+ color: #264409;
+ }
+
+.error {
+ background: #FBE3E4;
+ border-color: #FBC2C4;
+ color: #8A1F11;
+ }
+
+.notice {
+ background: #FFF6BF;
+ border-color: #FFD324;
+ color: #514721;
+ }
+
diff --git a/scss/forms.scss b/scss/forms.scss
new file mode 100644
index 0000000..18f60d7
--- /dev/null
+++ b/scss/forms.scss
@@ -0,0 +1,68 @@
+fieldset.inputs, fieldset.buttons {
+ ol {
+ margin: 0px;
+ padding: 0px;
+ li {
+ list-style: none;
+ padding: 0px;
+ margin: 1em 0 !important;
+ }
+ }
+ }
+.fieldWithErrors {
+ input, textarea {
+ background: none repeat scroll 0 0 #FBE3E4;
+ border: 1px solid #8A1F11 !important;
+ }
+ }
+
+fieldset.inputs {
+
+ font-family: "Lucida Grande",Helvetica,Arial,sans-serif;
+ label {
+ display: block;
+ margin-top: 0px;
+ margin-bottom: 5px;
+ font-weight: bold;
+ font-size: 12px;
+ }
+
+ input[type="text"], input[type="password"] {
+ border: 1px solid #999999;
+ font-size: 20px;
+ padding: 5px;
+ width: 690px;
+ }
+
+ textarea {
+ border: 1px solid #999999;
+ font-size: 14px;
+ padding: 5px;
+ width: 690px;
+ }
+ textarea:focus, input[type="text"]:focus, input[type="password"]:focus {
+ background: none repeat scroll 0 0 #FFFCE1;
+ }
+
+ }
+
+.errorExplanation {
+ background: #FBE3E4;
+ border: 2px solid #FBC2C4;
+ color: #8a1f11;
+ padding: 0 10px;
+ h2 { display: none; }
+ p {
+ font-size: 12px;
+ font-weight: bold;
+ margin: 15px 0 10px 0!important;
+ padding: 0 5px;
+ }
+ ul { margin: 0 0 10px 25px!important; }
+ ul li {
+ font-size: 12px;
+ list-style: square!important; margin: 0!important;
+ }
+}
+
+
|
func09/Basic-Scss
|
abacdaa1731a5b15adfa3f43ac16c6cfe671acd5
|
ãªã»ããCSS
|
diff --git a/scss/mixins.scss b/scss/mixins.scss
new file mode 100644
index 0000000..770ab51
--- /dev/null
+++ b/scss/mixins.scss
@@ -0,0 +1,27 @@
+@mixin border-radius($tl: 0px, $tr: 0px, $br: 0px, $bl: 0px) {
+ -webkit-border-top-left-radius: $tl;
+ -webkit-border-top-right-radius: $tr;
+ -webkit-border-bottom-right-radius: $br;
+ -webkit-border-bottom-left-radius: $bl;
+ -moz-border-radius-topleft: $tl;
+ -moz-border-radius-topright: $tr;
+ -moz-border-radius-bottomright: $br;
+ -moz-border-radius-bottomleft: $bl;
+ border-top-left-radius: $tl;
+ border-top-right-radius: $tr;
+ border-bottom-right-radius: $br;
+ border-bottom-left-radius: $bl;
+}
+
+@mixin box-shadow($c, $x, $y, $d) {
+ -webkit-box-shadow: $c $x $y $d;
+ -moz-box-shadow: $c $x $y $d;
+ box-shadow: $c $x $y $d;
+}
+
+@mixin box-sizing($mode:border-box) {
+ -webkit-box-sizing: $mode;
+ -moz-box-sizing: $mode;
+ box-sizing: $mode;
+}
+
diff --git a/scss/reset.scss b/scss/reset.scss
new file mode 100644
index 0000000..1551c38
--- /dev/null
+++ b/scss/reset.scss
@@ -0,0 +1,54 @@
+html {
+ color: #000;
+ background: #FFF; }
+
+body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td {
+ margin: 0;
+ padding: 0; }
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0; }
+
+fieldset, img {
+ border: 0; }
+
+address, caption, cite, code, dfn, em, strong, th, var, optgroup {
+ font-style: inherit;
+ font-weight: inherit; }
+
+del, ins {
+ text-decoration: none; }
+
+li {
+ list-style: none; }
+
+caption, th {
+ text-align: left; }
+
+h1, h2, h3, h4, h5, h6 {
+ font-size: 100%;
+ font-weight: normal; }
+
+q {
+ &:before, &:after {
+ content: ''; } }
+
+abbr, acronym {
+ border: 0;
+ font-variant: normal; }
+
+sup, sub {
+ vertical-align: baseline; }
+
+legend {
+ color: #000; }
+
+input, button, textarea, select, optgroup, option {
+ font-family: inherit;
+ font-size: inherit;
+ font-style: inherit;
+ font-weight: inherit; }
+
+input, button, textarea, select {
+ *font-size: 100%; }
|
reddavis/Frequency-Distribution
|
f6cb61204954c5c9504a7040059160ad6e7528a2
|
Regenerated gemspec for version 0.0.0
|
diff --git a/frequency_distribution.gemspec b/frequency_distribution.gemspec
index 91931b7..1b21c06 100644
--- a/frequency_distribution.gemspec
+++ b/frequency_distribution.gemspec
@@ -1,54 +1,55 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{frequency_distribution}
s.version = "0.0.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["reddavis"]
s.date = %q{2010-05-29}
s.description = %q{Simple frequency distribution, with tabulation and eventually, graph creation}
s.email = %q{reddavis@gmail.com}
s.extra_rdoc_files = [
"LICENSE",
"README.rdoc"
]
s.files = [
".document",
".gitignore",
"LICENSE",
"README.rdoc",
"Rakefile",
"VERSION",
+ "frequency_distribution.gemspec",
"lib/frequency_distribution.rb",
"spec/frequency_distribution_spec.rb",
"spec/spec.opts",
"spec/spec_helper.rb"
]
s.homepage = %q{http://github.com/reddavis/frequency_distribution}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.6}
s.summary = %q{Simple frequency distribution, with tabulation and eventually, graph creation}
s.test_files = [
"spec/frequency_distribution_spec.rb",
"spec/spec_helper.rb"
]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
else
s.add_dependency(%q<rspec>, [">= 1.2.9"])
end
else
s.add_dependency(%q<rspec>, [">= 1.2.9"])
end
end
|
reddavis/Frequency-Distribution
|
4455578c445929867fb166d321503919ba868a12
|
remove gchart
|
diff --git a/lib/frequency_distribution.rb b/lib/frequency_distribution.rb
index a2a0ea1..9165ecd 100644
--- a/lib/frequency_distribution.rb
+++ b/lib/frequency_distribution.rb
@@ -1,45 +1,43 @@
-require 'gchart'
-
class FrequencyDistribution
def initialize(conditions, *events)
@conditions = conditions
@events = events
end
def process
@results ||= calculate_cfd
end
def to_tabulation
data = "\t#{@events.join("\t")}\n"
process.each_pair do |condition, events|
data << "#{condition}\t"
@events.each {|e| data << "#{events[e]}\t"}
data << "\n"
end
data
end
private
def calculate_cfd
results = build_hash
@events.each do |event|
@conditions.each_pair do |condition, data|
results[condition][event] = data.select {|term| term == event}.size
end
end
results
end
# Build a hash with the conditions as keys
def build_hash
hash = {}
@conditions.each_key {|key| hash[key] = {}}
hash
end
end
\ No newline at end of file
|
reddavis/Frequency-Distribution
|
da409d61cde8fe0e5d6843151db54a55c780ab2e
|
for first release
|
diff --git a/Rakefile b/Rakefile
index dcd9e5e..269b395 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,45 +1,45 @@
require 'rubygems'
require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "frequency_distribution"
- gem.summary = %Q{TODO: one-line summary of your gem}
- gem.description = %Q{TODO: longer description of your gem}
+ gem.summary = %Q{Simple frequency distribution, with tabulation and eventually, graph creation}
+ gem.description = %Q{Simple frequency distribution, with tabulation and eventually, graph creation}
gem.email = "reddavis@gmail.com"
gem.homepage = "http://github.com/reddavis/frequency_distribution"
gem.authors = ["reddavis"]
gem.add_development_dependency "rspec", ">= 1.2.9"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
require 'spec/rake/spectask'
Spec::Rake::SpecTask.new(:spec) do |spec|
spec.libs << 'lib' << 'spec'
spec.spec_files = FileList['spec/**/*_spec.rb']
end
Spec::Rake::SpecTask.new(:rcov) do |spec|
spec.libs << 'lib' << 'spec'
spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true
end
task :spec => :check_dependencies
task :default => :spec
require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "frequency_distribution #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
diff --git a/frequency_distribution.gemspec b/frequency_distribution.gemspec
new file mode 100644
index 0000000..91931b7
--- /dev/null
+++ b/frequency_distribution.gemspec
@@ -0,0 +1,54 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{frequency_distribution}
+ s.version = "0.0.0"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["reddavis"]
+ s.date = %q{2010-05-29}
+ s.description = %q{Simple frequency distribution, with tabulation and eventually, graph creation}
+ s.email = %q{reddavis@gmail.com}
+ s.extra_rdoc_files = [
+ "LICENSE",
+ "README.rdoc"
+ ]
+ s.files = [
+ ".document",
+ ".gitignore",
+ "LICENSE",
+ "README.rdoc",
+ "Rakefile",
+ "VERSION",
+ "lib/frequency_distribution.rb",
+ "spec/frequency_distribution_spec.rb",
+ "spec/spec.opts",
+ "spec/spec_helper.rb"
+ ]
+ s.homepage = %q{http://github.com/reddavis/frequency_distribution}
+ s.rdoc_options = ["--charset=UTF-8"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.3.6}
+ s.summary = %q{Simple frequency distribution, with tabulation and eventually, graph creation}
+ s.test_files = [
+ "spec/frequency_distribution_spec.rb",
+ "spec/spec_helper.rb"
+ ]
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
+ else
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
+ end
+ else
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
+ end
+end
+
diff --git a/lib/frequency_distribution.rb b/lib/frequency_distribution.rb
index e69de29..a2a0ea1 100644
--- a/lib/frequency_distribution.rb
+++ b/lib/frequency_distribution.rb
@@ -0,0 +1,45 @@
+require 'gchart'
+
+class FrequencyDistribution
+ def initialize(conditions, *events)
+ @conditions = conditions
+ @events = events
+ end
+
+ def process
+ @results ||= calculate_cfd
+ end
+
+ def to_tabulation
+ data = "\t#{@events.join("\t")}\n"
+
+ process.each_pair do |condition, events|
+ data << "#{condition}\t"
+ @events.each {|e| data << "#{events[e]}\t"}
+ data << "\n"
+ end
+
+ data
+ end
+
+ private
+
+ def calculate_cfd
+ results = build_hash
+
+ @events.each do |event|
+ @conditions.each_pair do |condition, data|
+ results[condition][event] = data.select {|term| term == event}.size
+ end
+ end
+
+ results
+ end
+
+ # Build a hash with the conditions as keys
+ def build_hash
+ hash = {}
+ @conditions.each_key {|key| hash[key] = {}}
+ hash
+ end
+end
\ No newline at end of file
diff --git a/spec/frequency_distribution_spec.rb b/spec/frequency_distribution_spec.rb
index d119cc0..5534672 100644
--- a/spec/frequency_distribution_spec.rb
+++ b/spec/frequency_distribution_spec.rb
@@ -1,7 +1,51 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "FrequencyDistribution" do
- it "fails" do
- fail "hey buddy, you should probably rename this file and start specing for real"
+ before do
+ conditions = {:happy => happy_text, :sad => sad_text}
+ @cfd = FrequencyDistribution.new(conditions, "happy", "sad")
+ @results = @cfd.process
+ end
+
+ it "should return a hash" do
+ @results.should be_a(Hash)
+ end
+
+ describe "Happy condition" do
+ it "should return 2 for happy" do
+ @results[:happy]["happy"].should == 2
+ end
+
+ it "should return 0 for sad" do
+ @results[:happy]["sad"].should == 0
+ end
+ end
+
+ describe "Sad condition" do
+ it "should return 0 for happy" do
+ @results[:sad]["happy"].should == 0
+ end
+
+ it "should return 2 for sad" do
+ @results[:sad]["sad"].should == 2
+ end
+ end
+
+ describe "Tabulation" do
+ it "should include the events" do
+ table = @cfd.to_tabulation
+ table.should match(/happy/)
+ table.should match(/sad/)
+ end
+ end
+
+ private
+
+ def happy_text
+ %w{when happy things happen it makes me happy}
+ end
+
+ def sad_text
+ %w{when sad things happen it makes me sad}
end
end
|
reddavis/Frequency-Distribution
|
550603f5d1239062b3ff8888ae5820520197dca5
|
Version bump to 0.0.0
|
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..77d6f4c
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.0.0
|
tomasmalmsten/c2dm-web-server
|
dcf1edc6c6b36e208c09afa58bdfe8ce1a90f84a
|
Added some more to README
|
diff --git a/README b/README
index eacbfa9..5cf3982 100644
--- a/README
+++ b/README
@@ -1,13 +1,17 @@
This is the web application server to support the C2DM application test.
You are free to use and abuse this code as is without any warranty.
Please note that when you have check the code out you will need to issue two
more git command before you can run the server:
git submodule init
git submodule update
Tornado is added as a git sub module. The above commands will check out the
latest Tornado from github.
+You will need to add a valid gmail account that has been accepted to test C2DM
+to ClientLoginTokenFactory. See the official website for more info:
+http://code.google.com/intl/sv-SE/android/c2dm/index.html
+
Have fun.
|
tomasmalmsten/c2dm-web-server
|
894ebbecb6565364582d4ddd424812376212850c
|
Added README
|
diff --git a/README b/README
new file mode 100644
index 0000000..eacbfa9
--- /dev/null
+++ b/README
@@ -0,0 +1,13 @@
+This is the web application server to support the C2DM application test.
+
+You are free to use and abuse this code as is without any warranty.
+
+Please note that when you have check the code out you will need to issue two
+more git command before you can run the server:
+git submodule init
+git submodule update
+
+Tornado is added as a git sub module. The above commands will check out the
+latest Tornado from github.
+
+Have fun.
|
hardbap/wanna
|
96276496730e5d586b26d802fc286a50d1e2b454
|
minor updates to controller/view templates.
|
diff --git a/wanna_scaffold/templates/controller.rb b/wanna_scaffold/templates/controller.rb
index 48fd1dd..1c12472 100644
--- a/wanna_scaffold/templates/controller.rb
+++ b/wanna_scaffold/templates/controller.rb
@@ -1,65 +1,65 @@
class <%= controller_class_name %>Controller < ApplicationController
def index
@<%= table_name %> = <%= class_name %>.all
-
+
respond_to do |format|
- format.html
+ format.html
end
end
-
+
def show
@<%= file_name %> = <%= class_name %>.find(params[:id])
-
+
respond_to do |format|
format.html
end
end
-
+
def new
@<%= file_name %> = <%= class_name %>.new
-
+
respond_to do |format|
format.html
end
end
-
+
def edit
@<%= file_name %> = <%= class_name %>.find(params[:id])
end
-
+
def create
@<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])
-
+
respond_to do |format|
if @<%= file_name %>.save
flash[:success] = '<%= class_name %> was successfully created.'
- format.html { redirect_to(@<%= file_name %>) }
+ format.html { redirect_to(@<%= file_name %>) }
else
format.html { render :action => "new" }
end
end
end
-
+
def update
@<%= file_name %> = <%= class_name %>.find params[:id]
-
+
respond_to do |format|
if @<%= file_name %>.update_attributes(params[:<%= file_name %>])
flash[:success] = '<%= class_name %> was successfully updated.'
format.html { redirect_to(@<%= file_name %>) }
else
format.html { render :action => "edit" }
end
end
end
-
+
def destroy
@<%= file_name %> = <%= class_name %>.find params[:id]
@<%= file_name %>.destroy
flash[:success] = '<%= class_name %> was successfully deleted.'
-
+
respond_to do |format|
- format.html { redirect_to(<%= table_name %>_url) }
+ format.html { redirect_to(<%= table_name %>_path) }
end
end
-end
\ No newline at end of file
+end
diff --git a/wanna_scaffold/templates/view/edit.html.erb b/wanna_scaffold/templates/view/edit.html.erb
index b1ddff9..d609e51 100644
--- a/wanna_scaffold/templates/view/edit.html.erb
+++ b/wanna_scaffold/templates/view/edit.html.erb
@@ -1,12 +1,12 @@
<h1>Editing <%= singular_name %></h1>
-
+
<%% form_for(@<%= singular_name %>) do |form| %>
<%%= render :partial => 'form', :locals => {:form => form} -%>
- <p><%%= form.submit 'Update' -%></p>
+ <div><%%= form.submit 'Update' -%></div>
<%% end %>
-
+
<p>
<%%= link_to 'Show', @<%= singular_name %> -%>
|
<%%= link_to 'Back', :back -%>
-</p>
\ No newline at end of file
+</p>
diff --git a/wanna_scaffold/templates/view/new.html.erb b/wanna_scaffold/templates/view/new.html.erb
index 287d6b5..14a35d7 100644
--- a/wanna_scaffold/templates/view/new.html.erb
+++ b/wanna_scaffold/templates/view/new.html.erb
@@ -1,8 +1,8 @@
<h1>New <%= singular_name %></h1>
-
+
<%% form_for(@<%= singular_name %>) do |form| %>
<%%= render :partial => 'form', :locals => {:form => form} -%>
- <p><%%= form.submit 'Create' -%></p>
+ <div><%%= form.submit 'Create' -%></div>
<%% end %>
-
-<p><%%= link_to 'Back', :back -%></p>
\ No newline at end of file
+
+<p><%%= link_to 'Back', :back -%></p>
|
hardbap/wanna
|
96ee90aa40f8a45b6918decc0f8b82a7d81f8b0e
|
add a Readme
|
diff --git a/Readme.textile b/Readme.textile
new file mode 100644
index 0000000..e69de29
|
hardbap/wanna
|
904aba5d5b989e07f2ea8271153067b5cfba449a
|
Clean up factory & migration templates.
|
diff --git a/wanna_model/templates/factory.rb b/wanna_model/templates/factory.rb
index ad48dc3..e972766 100644
--- a/wanna_model/templates/factory.rb
+++ b/wanna_model/templates/factory.rb
@@ -1,5 +1,5 @@
Factory.define :<%= file_name %> do |factory|
-<% for attribute in attributes -%>
+<%- attributes.each do |attribute| -%>
<%= factory_line(attribute) %>
-<% end -%>
-end
\ No newline at end of file
+<%- end -%>
+end
diff --git a/wanna_model/templates/migration.rb b/wanna_model/templates/migration.rb
index 37126a9..1d815c8 100644
--- a/wanna_model/templates/migration.rb
+++ b/wanna_model/templates/migration.rb
@@ -1,23 +1,23 @@
class <%= migration_name %> < ActiveRecord::Migration
def self.up
- create_table :<%= table_name %> do |t|
-<% for attribute in attributes -%>
- t.<%= attribute.type %> :<%= attribute.name %>
-<% end -%>
-<% unless options[:skip_timestamps] %>
- t.timestamps
-<% end -%>
+ create_table :<%= table_name %> do |table|
+<%- attributes.each do |attribute| -%>
+ table.<%= attribute.type %> :<%= attribute.name %>
+<%- end -%>
+<%- unless options[:skip_timestamps] %>
+ table.timestamps
+<%- end -%>
end
-
+
<% attributes.select(&:reference?).each do |attribute| -%>
add_index :<%= table_name %>, :<%= attribute.name %>_id
-<% end -%>
+<% end -%>
end
def self.down
-<% attributes.select(&:reference?).each do |attribute| -%>
+<%- attributes.select(&:reference?).each do |attribute| -%>
remove_index :<%= table_name %>, :<%= attribute.name %>_id
-<% end %>
+<%- end -%>
drop_table :<%= table_name %>
end
-end
\ No newline at end of file
+end
|
hardbap/wanna
|
a51cbe0319668bcf548c3f9928a3e444bd634820
|
Clean up unit_test template.
|
diff --git a/wanna_model/templates/unit_test.rb b/wanna_model/templates/unit_test.rb
index 7c94578..a202023 100644
--- a/wanna_model/templates/unit_test.rb
+++ b/wanna_model/templates/unit_test.rb
@@ -1,10 +1,10 @@
require File.join(File.dirname(__FILE__), '..', 'test_helper')
-
+
class <%= class_name %>Test < ActiveSupport::TestCase
-<% for attribute in attributes -%>
- <% if attribute.reference? %>
+<%- attributes.each do |attribute| -%>
+ <%- if attribute.reference? -%>
should_belong_to :<%= attribute.name %>
should_have_index :<%= attribute.name %>_id
- <% end -%>
-<% end -%>
-end
\ No newline at end of file
+ <%- end -%>
+<%- end -%>
+end
|
hardbap/wanna
|
7d8af68d569f5522b7be9b0e2979bea69fcc9c31
|
Fix require test_helper in helper_test template.
|
diff --git a/wanna_scaffold/templates/helper_test.rb b/wanna_scaffold/templates/helper_test.rb
index 6388cbd..62093ad 100644
--- a/wanna_scaffold/templates/helper_test.rb
+++ b/wanna_scaffold/templates/helper_test.rb
@@ -1,4 +1,4 @@
-require 'test_helper'
+require File.join(File.dirname(__FILE__), '..', 'test_helper')
class <%= controller_class_name %>HelperTest < ActionView::TestCase
-end
\ No newline at end of file
+end
|
hardbap/wanna
|
1f731fdd21a5b2016ebc837d0fb6962aa0d1bff9
|
Add wanna_integration generator.
|
diff --git a/wanna_integration/USAGE b/wanna_integration/USAGE
new file mode 100644
index 0000000..c733b25
--- /dev/null
+++ b/wanna_integration/USAGE
@@ -0,0 +1,8 @@
+Description:
+ Stubs out a new integration test. Pass the name of the test, either
+ CamelCased or under_scored, as an argument. The new test class is
+ generated in test/integration/testname_test.rb
+
+Example:
+ `./script/generate integration_test GeneralStories` creates a GeneralStories
+ integration test in test/integration/general_stories_test.rb
\ No newline at end of file
diff --git a/wanna_integration/templates/integration_test.rb b/wanna_integration/templates/integration_test.rb
new file mode 100644
index 0000000..91ae9d2
--- /dev/null
+++ b/wanna_integration/templates/integration_test.rb
@@ -0,0 +1,4 @@
+require File.join(File.dirname(__FILE__), '..', 'test_helper')
+
+class <%= class_name %>Test < ActionController::IntegrationTest
+end
diff --git a/wanna_integration/wanna_integration_generator.rb b/wanna_integration/wanna_integration_generator.rb
new file mode 100644
index 0000000..5bfc82e
--- /dev/null
+++ b/wanna_integration/wanna_integration_generator.rb
@@ -0,0 +1,14 @@
+class WannaIntegrationGenerator < Rails::Generator::NamedBase
+ def manifest
+ record do |m|
+ # Check for class naming collisions.
+ m.class_collisions class_name, "#{class_name}Test"
+
+ # integration test directory
+ m.directory File.join('test/integration', class_path)
+
+ # integration test stub
+ m.template 'integration_test.rb', File.join('test/integration', class_path, "#{file_name}_test.rb")
+ end
+ end
+end
|
hardbap/wanna
|
f48a6be45c24a70f1dbb2a03c31b8390b883e15e
|
Clean up scaffold options.
|
diff --git a/wanna_scaffold/wanna_scaffold_generator.rb b/wanna_scaffold/wanna_scaffold_generator.rb
index 0ce8bad..53ee038 100644
--- a/wanna_scaffold/wanna_scaffold_generator.rb
+++ b/wanna_scaffold/wanna_scaffold_generator.rb
@@ -1,119 +1,125 @@
class WannaScaffoldGenerator < Rails::Generator::NamedBase
default_options :skip_timestamps => false,
:skip_migration => false,
:skip_factory => false,
:add_helper => false,
:functional_test => false
attr_reader :controller_name,
:controller_class_path,
:controller_file_path,
:controller_class_nesting,
:controller_class_nesting_depth,
:controller_class_name,
:controller_underscore_name,
:controller_singular_name,
:controller_plural_name
alias_method :controller_file_name, :controller_underscore_name
alias_method :controller_table_name, :controller_plural_name
def initialize(runtime_args, runtime_options = {})
super
if @name == @name.pluralize && !options[:force_plural]
logger.warning "Plural version of the model detected, using singularized version. Override with --force-plural."
@name = @name.singularize
end
@controller_name = @name.pluralize
base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
@controller_class_name_without_nesting, @controller_underscore_name, @controller_plural_name = inflect_names(base_name)
@controller_singular_name = base_name.singularize
if @controller_class_nesting.empty?
@controller_class_name = @controller_class_name_without_nesting
else
@controller_class_name =
"#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
end
end
def manifest
record do |m|
# Check for class naming collisions.
m.class_collisions(controller_class_path,
"#{controller_class_name}Controller", "#{controller_class_name}Helper")
m.class_collisions(class_path, "#{class_name}")
# Controller, helper, views, and test directories.
m.directory(File.join('app/models', class_path))
m.directory(File.join('app/controllers', controller_class_path))
m.directory(File.join('app/views', controller_class_path, controller_file_name))
m.directory(File.join('test/unit', class_path))
for view in scaffold_views
m.template(
"view/#{view}.html.erb",
File.join('app/views', controller_class_path, controller_file_name, "#{view}.html.erb")
)
end
m.template(
'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
)
if options[:functional_test]
m.directory(File.join('test/functional', controller_class_path))
m.template("functional_test/shoulda_controller.rb",
File.join('test/functional', controller_class_path,
"#{controller_file_name}_controller_test.rb"))
end
if options[:add_helper]
m.directory(File.join('app/helpers', controller_class_path))
m.directory(File.join('test/unit/helpers', class_path))
- m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
- m.template('helper_test.rb', File.join('test/unit/helpers', class_path, "#{controller_file_name}_helper_test.rb"))
+ m.template('helper.rb',
+ File.join('app/helpers', controller_class_path,
+ "#{controller_file_name}_helper.rb"))
+ m.template('helper_test.rb',
+ File.join('test/unit/helpers', class_path,
+ "#{controller_file_name}_helper_test.rb"))
end
m.route_resources controller_file_name
m.dependency 'wanna_model', [name] + @args, :collision => :skip
end
end
protected
- # Override with your own usage banner.
- def banner
- "Usage: #{$0} wanna_scaffold ModelName [field:type, field:type]"
- end
+ # Override with your own usage banner.
+ def banner
+ "Usage: #{$0} wanna_scaffold ModelName [field:type, field:type]"
+ end
- def add_options!(opt)
- opt.separator ''
- opt.separator 'Options:'
- opt.on("--skip-timestamps",
- "Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
- opt.on("--skip-migration",
- "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
- opt.on("--skip-factory",
- "Don't generation a factory file for this model") { |v| options[:skip_factory] = v}
- opt.on("--add-helper",
- "Generate a helper for this controller") { |v| options[:add_helper] = v }
- opt.on("--functional-test",
- "Generate a functional test for this controller") { |v| options[:functional_test] = v }
+ def add_options!(opt)
+ opt.separator ''
+ opt.separator 'Options:'
+ scaffold_options.each do |key, val|
+ opt.on("--#{key}", val) { |v| options[key.underscore.to_sym] = v }
end
+ end
- def scaffold_views
- %w[ index show new edit _form ]
- end
+ def scaffold_views
+ %w{ index show new edit _form }
+ end
- def model_name
- class_name.demodulize
- end
+ def model_name
+ class_name.demodulize
+ end
+
+ def scaffold_options
+ { 'skip-timestamps' => "Don't add timestamps to the migration file for this model",
+ 'skip-migration' => "Don't generate a migration file for this model",
+ 'skip-factory' => "Don't generation a factory file for this model",
+ 'add-helper' => "Generate a helper for this controller",
+ 'functional-test' => "Generate a functional test for this controller" }
+
+ end
end
|
hardbap/wanna
|
df35ad21d6507fbf4baeb809935e528ac69d5be8
|
Add option to generate functional test.
|
diff --git a/wanna_scaffold/wanna_scaffold_generator.rb b/wanna_scaffold/wanna_scaffold_generator.rb
index f984b5d..0ce8bad 100644
--- a/wanna_scaffold/wanna_scaffold_generator.rb
+++ b/wanna_scaffold/wanna_scaffold_generator.rb
@@ -1,111 +1,119 @@
class WannaScaffoldGenerator < Rails::Generator::NamedBase
default_options :skip_timestamps => false,
:skip_migration => false,
:skip_factory => false,
- :add_helper => false;
+ :add_helper => false,
+ :functional_test => false
attr_reader :controller_name,
:controller_class_path,
:controller_file_path,
:controller_class_nesting,
:controller_class_nesting_depth,
:controller_class_name,
:controller_underscore_name,
:controller_singular_name,
:controller_plural_name
alias_method :controller_file_name, :controller_underscore_name
alias_method :controller_table_name, :controller_plural_name
def initialize(runtime_args, runtime_options = {})
super
if @name == @name.pluralize && !options[:force_plural]
logger.warning "Plural version of the model detected, using singularized version. Override with --force-plural."
@name = @name.singularize
end
@controller_name = @name.pluralize
base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
@controller_class_name_without_nesting, @controller_underscore_name, @controller_plural_name = inflect_names(base_name)
@controller_singular_name = base_name.singularize
if @controller_class_nesting.empty?
@controller_class_name = @controller_class_name_without_nesting
else
@controller_class_name =
"#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
end
end
def manifest
record do |m|
# Check for class naming collisions.
m.class_collisions(controller_class_path,
"#{controller_class_name}Controller", "#{controller_class_name}Helper")
m.class_collisions(class_path, "#{class_name}")
# Controller, helper, views, and test directories.
m.directory(File.join('app/models', class_path))
m.directory(File.join('app/controllers', controller_class_path))
m.directory(File.join('app/views', controller_class_path, controller_file_name))
- m.directory(File.join('test/functional', controller_class_path))
+
m.directory(File.join('test/unit', class_path))
for view in scaffold_views
m.template(
"view/#{view}.html.erb",
File.join('app/views', controller_class_path, controller_file_name, "#{view}.html.erb")
)
end
m.template(
'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
)
- m.template("functional_test/shoulda_controller.rb", File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
+ if options[:functional_test]
+ m.directory(File.join('test/functional', controller_class_path))
+ m.template("functional_test/shoulda_controller.rb",
+ File.join('test/functional', controller_class_path,
+ "#{controller_file_name}_controller_test.rb"))
+ end
if options[:add_helper]
m.directory(File.join('app/helpers', controller_class_path))
m.directory(File.join('test/unit/helpers', class_path))
m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
m.template('helper_test.rb', File.join('test/unit/helpers', class_path, "#{controller_file_name}_helper_test.rb"))
end
m.route_resources controller_file_name
m.dependency 'wanna_model', [name] + @args, :collision => :skip
end
end
protected
# Override with your own usage banner.
def banner
"Usage: #{$0} wanna_scaffold ModelName [field:type, field:type]"
end
def add_options!(opt)
opt.separator ''
opt.separator 'Options:'
opt.on("--skip-timestamps",
"Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
opt.on("--skip-migration",
"Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
opt.on("--skip-factory",
"Don't generation a factory file for this model") { |v| options[:skip_factory] = v}
opt.on("--add-helper",
"Generate a helper for this controller") { |v| options[:add_helper] = v }
+ opt.on("--functional-test",
+ "Generate a functional test for this controller") { |v| options[:functional_test] = v }
end
def scaffold_views
%w[ index show new edit _form ]
end
def model_name
class_name.demodulize
end
end
|
hardbap/wanna
|
1a500801c17b1fa794888b1e973ead4c80d4f57a
|
Add option to skip helpers to scaffold.
|
diff --git a/wanna_scaffold/wanna_scaffold_generator.rb b/wanna_scaffold/wanna_scaffold_generator.rb
index 6c9fded..f984b5d 100644
--- a/wanna_scaffold/wanna_scaffold_generator.rb
+++ b/wanna_scaffold/wanna_scaffold_generator.rb
@@ -1,107 +1,111 @@
class WannaScaffoldGenerator < Rails::Generator::NamedBase
- default_options :skip_timestamps => false,
- :skip_migration => false,
- :skip_factory => false
-
+ default_options :skip_timestamps => false,
+ :skip_migration => false,
+ :skip_factory => false,
+ :add_helper => false;
+
attr_reader :controller_name,
:controller_class_path,
:controller_file_path,
:controller_class_nesting,
:controller_class_nesting_depth,
:controller_class_name,
:controller_underscore_name,
:controller_singular_name,
:controller_plural_name
-
+
alias_method :controller_file_name, :controller_underscore_name
alias_method :controller_table_name, :controller_plural_name
-
+
def initialize(runtime_args, runtime_options = {})
super
-
+
if @name == @name.pluralize && !options[:force_plural]
logger.warning "Plural version of the model detected, using singularized version. Override with --force-plural."
@name = @name.singularize
end
@controller_name = @name.pluralize
base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
@controller_class_name_without_nesting, @controller_underscore_name, @controller_plural_name = inflect_names(base_name)
@controller_singular_name = base_name.singularize
-
+
if @controller_class_nesting.empty?
@controller_class_name = @controller_class_name_without_nesting
else
- @controller_class_name =
+ @controller_class_name =
"#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
- end
+ end
end
-
+
def manifest
record do |m|
# Check for class naming collisions.
- m.class_collisions(controller_class_path,
+ m.class_collisions(controller_class_path,
"#{controller_class_name}Controller", "#{controller_class_name}Helper")
m.class_collisions(class_path, "#{class_name}")
-
+
# Controller, helper, views, and test directories.
m.directory(File.join('app/models', class_path))
m.directory(File.join('app/controllers', controller_class_path))
- m.directory(File.join('app/helpers', controller_class_path))
+
m.directory(File.join('app/views', controller_class_path, controller_file_name))
m.directory(File.join('test/functional', controller_class_path))
m.directory(File.join('test/unit', class_path))
- m.directory(File.join('test/unit/helpers', class_path))
-
+
for view in scaffold_views
m.template(
"view/#{view}.html.erb",
File.join('app/views', controller_class_path, controller_file_name, "#{view}.html.erb")
)
end
-
+
m.template(
'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
)
-
+
m.template("functional_test/shoulda_controller.rb", File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
-
- m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
-
- m.template('helper_test.rb', File.join('test/unit/helpers', class_path, "#{controller_file_name}_helper_test.rb"))
-
+
+ if options[:add_helper]
+ m.directory(File.join('app/helpers', controller_class_path))
+ m.directory(File.join('test/unit/helpers', class_path))
+ m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
+ m.template('helper_test.rb', File.join('test/unit/helpers', class_path, "#{controller_file_name}_helper_test.rb"))
+ end
+
m.route_resources controller_file_name
-
+
m.dependency 'wanna_model', [name] + @args, :collision => :skip
end
- end
-
+ end
+
protected
# Override with your own usage banner.
def banner
"Usage: #{$0} wanna_scaffold ModelName [field:type, field:type]"
end
-
+
def add_options!(opt)
opt.separator ''
opt.separator 'Options:'
opt.on("--skip-timestamps",
"Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
opt.on("--skip-migration",
"Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
opt.on("--skip-factory",
- "Don't generation a fixture file for this model") { |v| options[:skip_factory] = v}
+ "Don't generation a factory file for this model") { |v| options[:skip_factory] = v}
+ opt.on("--add-helper",
+ "Generate a helper for this controller") { |v| options[:add_helper] = v }
end
-
+
def scaffold_views
%w[ index show new edit _form ]
end
-
+
def model_name
class_name.demodulize
end
-
-end
\ No newline at end of file
+end
|
rbdixon/rbdpuppet
|
f0c9a5bcf93b6180a74129fb7114d1ac49c211eb
|
evacuate
|
diff --git a/manifests/.gitignore b/manifests/.gitignore
new file mode 100644
index 0000000..d680f5d
--- /dev/null
+++ b/manifests/.gitignore
@@ -0,0 +1 @@
+passwords.pp
diff --git a/manifests/classes/pkgs.pp b/manifests/classes/pkgs.pp
index a505178..2fe3330 100644
--- a/manifests/classes/pkgs.pp
+++ b/manifests/classes/pkgs.pp
@@ -1,13 +1,50 @@
-$packages = ["emacs", "git", "git-core", "inkscape", "skype", "acroread", "pdfjam", "keyjnote"]
import "repos"
class pkgs {
- include repos
+ $packages = ["emacs", "git", "git-core", "inkscape", "skype", "acroread", "pdfjam", "keyjnote", "debconf-utils", "s3cmd"]
+
+ class java6 {
+ $seeds = "/var/cache/debconf/java6.seeds"
+
+ file{"$seeds":
+ ensure => present,
+ content => "sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
+sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true
+",
+ }
+
+ package{["gcj-4.2-base","libgcj-common", "libgcj8-1", "libgcj8-1-awt", "libgcj8-jar"]:
+ ensure => absent,
+ }
+
+ package{["sun-java6-jre", "sun-java6-plugin"]:
+ ensure => present,
+ require => [Package[debconf-utils], File[$seeds]],
+ responsefile => "$seeds",
+ }
+ }
+
+ class exchange {
+ package{["evolution-exchange", "openchangeclient", "openchangeproxy"]:
+ ensure => present,
+ }
+ }
+
+ class openoffice {
+ package{"openoffice.org":
+ ensure => latest,
+ }
+ }
+
+ include repos
+ include java6
+ include exchange
+ include openoffice
package{$packages:
ensure => installed,
}
}
diff --git a/manifests/site.pp b/manifests/site.pp
index 4b3ab8d..13da569 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -1,13 +1,17 @@
import "classes/*.pp"
import "mail"
import "gpgcard"
import "sshd"
import "personal.pp"
+import "users"
node default {
include pkgs
include mail
include gpgcard
include sshd
+ include users
+
+ users::user{"bdixon": }
}
diff --git a/modules/java/#init.pp# b/modules/java/#init.pp#
new file mode 100644
index 0000000..50e6352
--- /dev/null
+++ b/modules/java/#init.pp#
@@ -0,0 +1,2 @@
+class java {
+
\ No newline at end of file
diff --git a/modules/java/.#init.pp b/modules/java/.#init.pp
new file mode 120000
index 0000000..25afca1
--- /dev/null
+++ b/modules/java/.#init.pp
@@ -0,0 +1 @@
+root@bd-laptop.22181:1232983643
\ No newline at end of file
diff --git a/modules/repos/manifests/init.pp b/modules/repos/manifests/init.pp
index a52a844..cdb3342 100644
--- a/modules/repos/manifests/init.pp
+++ b/modules/repos/manifests/init.pp
@@ -1,30 +1,45 @@
class repos {
define repo($url, $release, $components) {
file {"/etc/apt/sources.list.d/$name.list":
ensure => present,
content => "deb $url $release $components\n",
- notify => [ Exec["apt-get update $name"], Exec["apt-get $name keyring"] ],
+ notify => Exec["apt-get update $name"],
}
exec{"apt-get update $name":
command => "/usr/bin/apt-get -q -q update",
refreshonly => true,
}
- exec{"apt-get $name keyring":
- command => "/usr/bin/apt-get -q -q -y --force-yes install $name-keyring",
- refreshonly => true,
- require => [ Exec["apt-get update $name"], File["/etc/apt/sources.list.d/$name.list"] ],
+ }
+
+ define apt-key($fp) {
+ exec{"/usr/bin/apt-key adv --recv-keys --keyserver keyserver.ubuntu.com $fp":
+ unless => "/usr/bin/apt-key list|grep $fp",
}
-
}
+ apt-key{"Medibuntu":
+ fp => "0C5A2783",
+ }
+
repo{"medibuntu":
url => "http://packages.medibuntu.org/",
release => "intrepid",
components => "free non-free",
+ require => Apt-key["Medibuntu"],
+ }
+
+ apt-key{"OpenOffice.org":
+ fp => "247D1CFF",
}
+ repo{"ooo3":
+ url => "http://ppa.launchpad.net/openoffice-pkgs/ubuntu",
+ release => "intrepid",
+ components => "main",
+ require => Apt-key["OpenOffice.org"],
+ }
}
diff --git a/modules/sshd/manifests/init.pp b/modules/sshd/manifests/init.pp
index 7352d40..1d4020d 100644
--- a/modules/sshd/manifests/init.pp
+++ b/modules/sshd/manifests/init.pp
@@ -1,17 +1,24 @@
class sshd {
- package{["openssh-client", "openssh-server"]:
+ package{["openssh-client", "openssh-server", "denyhosts"]:
ensure => present,
}
+
+ service{["ssh", "denyhosts"]:
+ ensure => running,
+ require => [Package[openssh-server], Package[denyhosts]],
+ }
file{"/etc/ssh/ssh_config":
ensure => present,
content => template("sshd/ssh_config.erb"),
+ notify => Service[ssh],
}
file{"/etc/ssh/sshd_config":
ensure => present,
content => template("sshd/sshd_config.erb"),
+ notify => Service[ssh],
}
}
diff --git a/modules/users/manifests/init.pp b/modules/users/manifests/init.pp
new file mode 100644
index 0000000..e605671
--- /dev/null
+++ b/modules/users/manifests/init.pp
@@ -0,0 +1,11 @@
+class users {
+
+ define user() {
+ file{"/home/$name/.ssh/authorized_keys2":
+ ensure => present,
+ content => template("users/authorized_keys2.erb"),
+ }
+ }
+
+}
+
diff --git a/modules/users/templates/authorized_keys2.erb b/modules/users/templates/authorized_keys2.erb
new file mode 100644
index 0000000..0ac130a
--- /dev/null
+++ b/modules/users/templates/authorized_keys2.erb
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAAFAKDD8CcAAACBAJnaX2L2o5nf8ha/gG0kMW9PyPMIDQcdV6+pOLaDuu3PzvN2JU7eXR3DfSQta6tj2pQ2x//KruXkI9ejG3lMYPijkt1LQgKT/a2UFJ+wlzPbjcAz1jaScSBGBwt6HuZCUeYkgGB4v5prL5bbeW8iUqE1zghON4HqU6nBLm4pEqEt cardno:000100000A96
\ No newline at end of file
|
rbdixon/rbdpuppet
|
142787282a3eb2716e851c35a6ed8d40be17ac02
|
basic work on packages, mail, and ssh
|
diff --git a/.gitignore b/.gitignore
index b25c15b..21b13a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
*~
+manifests/.gitignore
diff --git a/manifests/classes/pkgs.pp b/manifests/classes/pkgs.pp
index 925bf5f..a505178 100644
--- a/manifests/classes/pkgs.pp
+++ b/manifests/classes/pkgs.pp
@@ -1,7 +1,13 @@
-$packages = ["emacs", "git", "git-core", "inkscape"]
+$packages = ["emacs", "git", "git-core", "inkscape", "skype", "acroread", "pdfjam", "keyjnote"]
+
+import "repos"
class pkgs {
+
+ include repos
+
package{$packages:
- ensure => installed
+ ensure => installed,
}
+
}
diff --git a/manifests/personal.pp b/manifests/personal.pp
new file mode 100644
index 0000000..7075661
--- /dev/null
+++ b/manifests/personal.pp
@@ -0,0 +1,4 @@
+$email = "private@private.com"
+$emailuser = "private"
+$emailpass = "private"
+$emailhub = "mail.private.com"
diff --git a/manifests/site.pp b/manifests/site.pp
index 4a9cff6..4b3ab8d 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -1,6 +1,13 @@
import "classes/*.pp"
+import "mail"
+import "gpgcard"
+import "sshd"
+import "personal.pp"
node default {
include pkgs
+ include mail
+ include gpgcard
+ include sshd
}
diff --git a/modules/gpgcard/manifests/init.pp b/modules/gpgcard/manifests/init.pp
new file mode 100644
index 0000000..0d9075a
--- /dev/null
+++ b/modules/gpgcard/manifests/init.pp
@@ -0,0 +1,15 @@
+class gpgcard {
+ file{"/dev/cmx0":
+ owner => "bdixon",
+ group => "bdixon",
+ }
+
+ package{["seahorse", "seahorse-plugins"]:
+ ensure => absent,
+ }
+
+ package{"gnupg-agent":
+ ensure => present
+ }
+}
+
diff --git a/modules/mail/manifests/init.pp b/modules/mail/manifests/init.pp
new file mode 100644
index 0000000..77c0d9c
--- /dev/null
+++ b/modules/mail/manifests/init.pp
@@ -0,0 +1,22 @@
+class mail {
+ package{["mutt", "ssmtp", "mailutils"]:
+ ensure => installed
+ }
+
+ package{"sendmail":
+ ensure => absent
+ }
+
+ file{"/etc/ssmtp/revaliases":
+ ensure => present,
+ content => template("mail/revaliases.erb"),
+ require => Package[ssmtp],
+ }
+
+ file{"/etc/ssmtp/ssmtp.conf":
+ ensure => present,
+ content => template("mail/ssmtp.conf.erb"),
+ require => Package[ssmtp],
+ }
+
+}
diff --git a/modules/mail/templates/revaliases.erb b/modules/mail/templates/revaliases.erb
new file mode 100644
index 0000000..bed0a9f
--- /dev/null
+++ b/modules/mail/templates/revaliases.erb
@@ -0,0 +1,8 @@
+# sSMTP aliases
+#
+# Format: local_account:outgoing_address:mailhub
+#
+# Example: root:your_login@your.domain:mailhub.your.domain[:port]
+# where [:port] is an optional port number that defaults to 25.
+root:rbdixon@gmail.com:smtp.gmail.com:587
+bdixon:rbdixon@gmail.com:smtp.gmail.com:587
\ No newline at end of file
diff --git a/modules/mail/templates/ssmtp.conf.erb b/modules/mail/templates/ssmtp.conf.erb
new file mode 100644
index 0000000..267db6b
--- /dev/null
+++ b/modules/mail/templates/ssmtp.conf.erb
@@ -0,0 +1,24 @@
+#
+# Config file for sSMTP sendmail
+#
+# The person who gets all mail for userids < 1000
+# Make this empty to disable rewriting.
+root=<%= email %>
+
+# The place where the mail goes. The actual machine name is required no
+# MX records are consulted. Commonly mailhosts are named mail.domain.com
+mailhub=<%= emailhub %>
+AuthUser=<%= emailuser %>
+AuthPass=<%= emailpass %>
+UseSTARTTLS=YES
+
+# Where will the mail seem to come from?
+rewriteDomain=
+
+# The full hostname
+hostname=<%= email %>
+
+# Are users allowed to set their own From: address?
+# YES - Allow the user to specify their own From: address
+# NO - Use the system generated From: address
+FromLineOverride=YES
diff --git a/modules/repos/manifests/init.pp b/modules/repos/manifests/init.pp
new file mode 100644
index 0000000..a52a844
--- /dev/null
+++ b/modules/repos/manifests/init.pp
@@ -0,0 +1,30 @@
+class repos {
+
+ define repo($url, $release, $components) {
+ file {"/etc/apt/sources.list.d/$name.list":
+ ensure => present,
+ content => "deb $url $release $components\n",
+ notify => [ Exec["apt-get update $name"], Exec["apt-get $name keyring"] ],
+ }
+
+ exec{"apt-get update $name":
+ command => "/usr/bin/apt-get -q -q update",
+ refreshonly => true,
+ }
+
+ exec{"apt-get $name keyring":
+ command => "/usr/bin/apt-get -q -q -y --force-yes install $name-keyring",
+ refreshonly => true,
+ require => [ Exec["apt-get update $name"], File["/etc/apt/sources.list.d/$name.list"] ],
+ }
+
+ }
+
+ repo{"medibuntu":
+ url => "http://packages.medibuntu.org/",
+ release => "intrepid",
+ components => "free non-free",
+ }
+
+}
+
diff --git a/modules/sshd/manifests/init.pp b/modules/sshd/manifests/init.pp
new file mode 100644
index 0000000..7352d40
--- /dev/null
+++ b/modules/sshd/manifests/init.pp
@@ -0,0 +1,17 @@
+class sshd {
+
+ package{["openssh-client", "openssh-server"]:
+ ensure => present,
+ }
+
+ file{"/etc/ssh/ssh_config":
+ ensure => present,
+ content => template("sshd/ssh_config.erb"),
+ }
+
+ file{"/etc/ssh/sshd_config":
+ ensure => present,
+ content => template("sshd/sshd_config.erb"),
+ }
+}
+
diff --git a/modules/sshd/templates/ssh_config.erb b/modules/sshd/templates/ssh_config.erb
new file mode 100644
index 0000000..bbd46cf
--- /dev/null
+++ b/modules/sshd/templates/ssh_config.erb
@@ -0,0 +1,49 @@
+
+# This is the ssh client system-wide configuration file. See
+# ssh_config(5) for more information. This file provides defaults for
+# users, and the values can be changed in per-user configuration files
+# or on the command line.
+
+# Configuration data is parsed as follows:
+# 1. command line options
+# 2. user-specific file
+# 3. system-wide file
+# Any configuration value is only changed the first time it is set.
+# Thus, host-specific definitions should be at the beginning of the
+# configuration file, and defaults at the end.
+
+# Site-wide defaults for some commonly used options. For a comprehensive
+# list of available options, their meanings and defaults, please see the
+# ssh_config(5) man page.
+
+Host *
+# ForwardAgent no
+ ForwardX11 no
+ ForwardX11Trusted yes
+ RhostsRSAAuthentication no
+ RSAAuthentication yes
+ PasswordAuthentication no
+ HostbasedAuthentication no
+ GSSAPIAuthentication no
+ GSSAPIDelegateCredentials no
+ GSSAPIKeyExchange no
+ GSSAPITrustDNS no
+# BatchMode no
+ CheckHostIP yes
+# AddressFamily any
+# ConnectTimeout 0
+ StrictHostKeyChecking ask
+# IdentityFile ~/.ssh/identity
+# IdentityFile ~/.ssh/id_rsa
+# IdentityFile ~/.ssh/id_dsa
+# Port 22
+# Protocol 2,1
+# Cipher 3des
+# Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
+# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
+# EscapeChar ~
+# Tunnel no
+# TunnelDevice any:any
+# PermitLocalCommand no
+ SendEnv LANG LC_*
+ HashKnownHosts yes
\ No newline at end of file
diff --git a/modules/sshd/templates/sshd_config.erb b/modules/sshd/templates/sshd_config.erb
new file mode 100644
index 0000000..b491098
--- /dev/null
+++ b/modules/sshd/templates/sshd_config.erb
@@ -0,0 +1,77 @@
+# Package generated configuration file
+# See the sshd(8) manpage for details
+
+# What ports, IPs and protocols we listen for
+Port 22
+# Use these options to restrict which interfaces/protocols sshd will bind to
+#ListenAddress ::
+#ListenAddress 0.0.0.0
+Protocol 2
+# HostKeys for protocol version 2
+HostKey /etc/ssh/ssh_host_rsa_key
+HostKey /etc/ssh/ssh_host_dsa_key
+#Privilege Separation is turned on for security
+UsePrivilegeSeparation yes
+
+# Lifetime and size of ephemeral version 1 server key
+KeyRegenerationInterval 3600
+ServerKeyBits 768
+
+# Logging
+SyslogFacility AUTH
+LogLevel INFO
+
+# Authentication:
+LoginGraceTime 120
+PermitRootLogin no
+StrictModes yes
+
+RSAAuthentication yes
+PubkeyAuthentication yes
+#AuthorizedKeysFile %h/.ssh/authorized_keys
+
+# Don't read the user's ~/.rhosts and ~/.shosts files
+IgnoreRhosts yes
+# For this to work you will also need host keys in /etc/ssh_known_hosts
+RhostsRSAAuthentication no
+# similar for protocol version 2
+HostbasedAuthentication no
+# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
+#IgnoreUserKnownHosts yes
+
+# To enable empty passwords, change to yes (NOT RECOMMENDED)
+PermitEmptyPasswords no
+
+# Change to yes to enable challenge-response passwords (beware issues with
+# some PAM modules and threads)
+ChallengeResponseAuthentication no
+
+# Change to no to disable tunnelled clear text passwords
+PasswordAuthentication no
+
+# Kerberos options
+#KerberosAuthentication no
+#KerberosGetAFSToken no
+#KerberosOrLocalPasswd yes
+#KerberosTicketCleanup yes
+
+# GSSAPI options
+#GSSAPIAuthentication no
+#GSSAPICleanupCredentials yes
+
+X11Forwarding no
+X11DisplayOffset 10
+PrintMotd no
+PrintLastLog yes
+TCPKeepAlive yes
+#UseLogin no
+
+#MaxStartups 10:30:60
+#Banner /etc/issue.net
+
+# Allow client to pass locale environment variables
+AcceptEnv LANG LC_*
+
+Subsystem sftp /usr/lib/openssh/sftp-server
+
+UsePAM yes
|
rbdixon/rbdpuppet
|
70bd76e6777948766bea14bf9d69ee6a967765d9
|
First steps. git, inkscape, emacs
|
diff --git a/manifests/classes/pkgs.pp b/manifests/classes/pkgs.pp
new file mode 100644
index 0000000..925bf5f
--- /dev/null
+++ b/manifests/classes/pkgs.pp
@@ -0,0 +1,7 @@
+$packages = ["emacs", "git", "git-core", "inkscape"]
+
+class pkgs {
+ package{$packages:
+ ensure => installed
+ }
+}
diff --git a/manifests/site.pp b/manifests/site.pp
new file mode 100644
index 0000000..4a9cff6
--- /dev/null
+++ b/manifests/site.pp
@@ -0,0 +1,6 @@
+import "classes/*.pp"
+
+node default {
+ include pkgs
+}
+
|
rbdixon/rbdpuppet
|
1a794d21f61756417c64fedb4c7c0e73019a9bc5
|
gitignore
|
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*~
|
rbdixon/rbdpuppet
|
c5ae6f860110bec503874f8d9eed57201f9a7262
|
Stock install manifests
|
diff --git a/fileserver.conf b/fileserver.conf
new file mode 100644
index 0000000..19cccda
--- /dev/null
+++ b/fileserver.conf
@@ -0,0 +1,17 @@
+# This file consists of arbitrarily named sections/modules
+# defining where files are served from and to whom
+
+# Define a section 'files'
+# Adapt the allow/deny settings to your needs. Order
+# for allow/deny does not matter, allow always takes precedence
+# over deny
+[files]
+ path /etc/puppet/files
+# allow *.example.com
+# deny *.evil.example.com
+# allow 192.168.0.0/24
+
+[plugins]
+# allow *.example.com
+# deny *.evil.example.com
+# allow 192.168.0.0/24
diff --git a/puppet.conf b/puppet.conf
new file mode 100644
index 0000000..01e92a1
--- /dev/null
+++ b/puppet.conf
@@ -0,0 +1,10 @@
+[main]
+logdir=/var/log/puppet
+vardir=/var/lib/puppet
+ssldir=/var/lib/puppet/ssl
+rundir=/var/run/puppet
+factpath=$vardir/lib/facter
+pluginsync=true
+
+[puppetmasterd]
+templatedir=/var/lib/puppet/templates
|
tinyjs/simple-jquery-form-validation
|
04e4587fb5525933041639ab1f943bd5ea06a8f3
|
inital commit
|
diff --git a/index.html b/index.html
new file mode 100755
index 0000000..915c426
--- /dev/null
+++ b/index.html
@@ -0,0 +1,87 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <meta name="author" content="charlesmarshall" />
+
+ <link rel="icon" type="image/gif" href="/favicon.ico" />
+ <link rel="stylesheet" href="http://tinyjs.com/files/projects/simple-jquery-form-validation/styles.css" type="text/css" media="screen" charset="utf-8" />
+ <script src="http://tinyjs.com/files/projects/simple-jquery-form-validation/jquery.js" type="text/javascript" charset="utf-8"></script><script src="http://tinyjs.com/files/projects/simple-jquery-form-validation/validator.js" type="text/javascript" charset="utf-8"></script>
+
+ <title>Simple jQuery form validation</title>
+
+</head>
+
+<body>
+ <body>
+<h3>Simple jQuery form validation</h3>
+<p>Easy setup, create a form with a class of 'validate'.</p>
+<p>Then give each form element you wish to validate a class of validate along with one of these choices...</p>
+<ul>
+ <li>valid-required</li>
+ <li>valid-number</li>
+ <li>valid-date</li>
+ <li>valid-email</li>
+</ul>
+<p>Then add the following to your global javascript file....</p>
+<pre>
+ $(document).ready(function() {
+ $("form.validate").validate();
+ });
+</pre>
+<p>
+ See the form below for an example. Styles for error messages can be edited too.
+</p>
+<form action="" class="validate">
+ <ul class="form">
+ <li>
+ <label for="name">Name:</label>
+ <input class="validate valid-required" name="name" id="name" type="text" maxlength="20" value="" />
+ </li>
+ <li>
+ <label for="telephone">Telephone Number:</label>
+ <input class="validate valid-number" name="password" id="telephone" type="text" maxlength="20" />
+ </li>
+ <li>
+ <label for="dob">Date of birth: (dd/mm/yyyy)</label>
+ <input class="validate valid-date" name="dob" id="dob" type="dob" maxlength="20" />
+ </li>
+ <li>
+ <label for="email">email:</label>
+ <input class="validate valid-email" name="email" id="email" type="email" maxlength="20" />
+ </li>
+ <li>
+ <input type="submit" name="submit" value="Submit" id="submit" />
+ </li>
+ </ul>
+</form>
+<p> feel free to use the code. A link back would be nice</p>
+
+<script type="text/javascript">
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+ </script>
+ <script type="text/javascript">
+ try {
+ var pageTracker = _gat._getTracker("UA-2549287-19");
+ pageTracker._trackPageview();
+ } catch(err) {}
+</script>
+</body>
+
+ <script type="text/javascript">
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+ </script>
+ <script type="text/javascript">
+ try {
+ var pageTracker = _gat._getTracker("UA-2549287-19");
+ pageTracker._trackPageview();
+ } catch(err) {}
+ </script>
+</body>
+</html>
+
+
diff --git a/jquery.js b/jquery.js
new file mode 100755
index 0000000..88e661e
--- /dev/null
+++ b/jquery.js
@@ -0,0 +1,3549 @@
+(function(){
+/*
+ * jQuery 1.2.6 - New Wave Javascript
+ *
+ * Copyright (c) 2008 John Resig (jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
+ * $Rev: 5685 $
+ */
+
+// Map over jQuery in case of overwrite
+var _jQuery = window.jQuery,
+// Map over the $ in case of overwrite
+ _$ = window.$;
+
+var jQuery = window.jQuery = window.$ = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context );
+};
+
+// A simple way to check for HTML strings or ID strings
+// (both of which we optimize for)
+var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
+
+// Is it a simple selector
+ isSimple = /^.[^:#\[\.]*$/,
+
+// Will speed up references to undefined, and allows munging its name.
+ undefined;
+
+jQuery.fn = jQuery.prototype = {
+ init: function( selector, context ) {
+ // Make sure that a selection was provided
+ selector = selector || document;
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this[0] = selector;
+ this.length = 1;
+ return this;
+ }
+ // Handle HTML strings
+ if ( typeof selector == "string" ) {
+ // Are we dealing with HTML string or an ID?
+ var match = quickExpr.exec( selector );
+
+ // Verify a match, and that no context was specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] )
+ selector = jQuery.clean( [ match[1] ], context );
+
+ // HANDLE: $("#id")
+ else {
+ var elem = document.getElementById( match[3] );
+
+ // Make sure an element was located
+ if ( elem ){
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id != match[3] )
+ return jQuery().find( selector );
+
+ // Otherwise, we inject the element directly into the jQuery object
+ return jQuery( elem );
+ }
+ selector = [];
+ }
+
+ // HANDLE: $(expr, [context])
+ // (which is just equivalent to: $(content).find(expr)
+ } else
+ return jQuery( context ).find( selector );
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) )
+ return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
+
+ return this.setArray(jQuery.makeArray(selector));
+ },
+
+ // The current version of jQuery being used
+ jquery: "1.2.6",
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ // The number of elements contained in the matched element set
+ length: 0,
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == undefined ?
+
+ // Return a 'clean' array
+ jQuery.makeArray( this ) :
+
+ // Return just the object
+ this[ num ];
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems ) {
+ // Build a new jQuery matched element set
+ var ret = jQuery( elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Force the current matched set of elements to become
+ // the specified array of elements (destroying the stack in the process)
+ // You should use pushStack() in order to do this, but maintain the stack
+ setArray: function( elems ) {
+ // Resetting the length to 0, then using the native Array push
+ // is a super-fast way to populate an object with array-like properties
+ this.length = 0;
+ Array.prototype.push.apply( this, elems );
+
+ return this;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+ var ret = -1;
+
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem && elem.jquery ? elem[0] : elem
+ , this );
+ },
+
+ attr: function( name, value, type ) {
+ var options = name;
+
+ // Look for the case where we're accessing a style value
+ if ( name.constructor == String )
+ if ( value === undefined )
+ return this[0] && jQuery[ type || "attr" ]( this[0], name );
+
+ else {
+ options = {};
+ options[ name ] = value;
+ }
+
+ // Check to see if we're setting style values
+ return this.each(function(i){
+ // Set all the styles
+ for ( name in options )
+ jQuery.attr(
+ type ?
+ this.style :
+ this,
+ name, jQuery.prop( this, options[ name ], type, i, name )
+ );
+ });
+ },
+
+ css: function( key, value ) {
+ // ignore negative width and height values
+ if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
+ value = undefined;
+ return this.attr( key, value, "curCSS" );
+ },
+
+ text: function( text ) {
+ if ( typeof text != "object" && text != null )
+ return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
+
+ var ret = "";
+
+ jQuery.each( text || this, function(){
+ jQuery.each( this.childNodes, function(){
+ if ( this.nodeType != 8 )
+ ret += this.nodeType != 1 ?
+ this.nodeValue :
+ jQuery.fn.text( [ this ] );
+ });
+ });
+
+ return ret;
+ },
+
+ wrapAll: function( html ) {
+ if ( this[0] )
+ // The elements to wrap the target around
+ jQuery( html, this[0].ownerDocument )
+ .clone()
+ .insertBefore( this[0] )
+ .map(function(){
+ var elem = this;
+
+ while ( elem.firstChild )
+ elem = elem.firstChild;
+
+ return elem;
+ })
+ .append(this);
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ return this.each(function(){
+ jQuery( this ).contents().wrapAll( html );
+ });
+ },
+
+ wrap: function( html ) {
+ return this.each(function(){
+ jQuery( this ).wrapAll( html );
+ });
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, false, function(elem){
+ if (this.nodeType == 1)
+ this.appendChild( elem );
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, true, function(elem){
+ if (this.nodeType == 1)
+ this.insertBefore( elem, this.firstChild );
+ });
+ },
+
+ before: function() {
+ return this.domManip(arguments, false, false, function(elem){
+ this.parentNode.insertBefore( elem, this );
+ });
+ },
+
+ after: function() {
+ return this.domManip(arguments, false, true, function(elem){
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ });
+ },
+
+ end: function() {
+ return this.prevObject || jQuery( [] );
+ },
+
+ find: function( selector ) {
+ var elems = jQuery.map(this, function(elem){
+ return jQuery.find( selector, elem );
+ });
+
+ return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
+ jQuery.unique( elems ) :
+ elems );
+ },
+
+ clone: function( events ) {
+ // Do the clone
+ var ret = this.map(function(){
+ if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
+ // IE copies events bound via attachEvent when
+ // using cloneNode. Calling detachEvent on the
+ // clone will also remove the events from the orignal
+ // In order to get around this, we use innerHTML.
+ // Unfortunately, this means some modifications to
+ // attributes in IE that are actually only stored
+ // as properties will not be copied (such as the
+ // the name attribute on an input).
+ var clone = this.cloneNode(true),
+ container = document.createElement("div");
+ container.appendChild(clone);
+ return jQuery.clean([container.innerHTML])[0];
+ } else
+ return this.cloneNode(true);
+ });
+
+ // Need to set the expando to null on the cloned set if it exists
+ // removeData doesn't work here, IE removes it from the original as well
+ // this is primarily for IE but the data expando shouldn't be copied over in any browser
+ var clone = ret.find("*").andSelf().each(function(){
+ if ( this[ expando ] != undefined )
+ this[ expando ] = null;
+ });
+
+ // Copy the events from the original to the clone
+ if ( events === true )
+ this.find("*").andSelf().each(function(i){
+ if (this.nodeType == 3)
+ return;
+ var events = jQuery.data( this, "events" );
+
+ for ( var type in events )
+ for ( var handler in events[ type ] )
+ jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
+ });
+
+ // Return the cloned set
+ return ret;
+ },
+
+ filter: function( selector ) {
+ return this.pushStack(
+ jQuery.isFunction( selector ) &&
+ jQuery.grep(this, function(elem, i){
+ return selector.call( elem, i );
+ }) ||
+
+ jQuery.multiFilter( selector, this ) );
+ },
+
+ not: function( selector ) {
+ if ( selector.constructor == String )
+ // test special case where just one selector is passed in
+ if ( isSimple.test( selector ) )
+ return this.pushStack( jQuery.multiFilter( selector, this, true ) );
+ else
+ selector = jQuery.multiFilter( selector, this );
+
+ var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
+ return this.filter(function() {
+ return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
+ });
+ },
+
+ add: function( selector ) {
+ return this.pushStack( jQuery.unique( jQuery.merge(
+ this.get(),
+ typeof selector == 'string' ?
+ jQuery( selector ) :
+ jQuery.makeArray( selector )
+ )));
+ },
+
+ is: function( selector ) {
+ return !!selector && jQuery.multiFilter( selector, this ).length > 0;
+ },
+
+ hasClass: function( selector ) {
+ return this.is( "." + selector );
+ },
+
+ val: function( value ) {
+ if ( value == undefined ) {
+
+ if ( this.length ) {
+ var elem = this[0];
+
+ // We need to handle select boxes special
+ if ( jQuery.nodeName( elem, "select" ) ) {
+ var index = elem.selectedIndex,
+ values = [],
+ options = elem.options,
+ one = elem.type == "select-one";
+
+ // Nothing was selected
+ if ( index < 0 )
+ return null;
+
+ // Loop through all the selected options
+ for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
+ var option = options[ i ];
+
+ if ( option.selected ) {
+ // Get the specifc value for the option
+ value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
+
+ // We don't need an array for one selects
+ if ( one )
+ return value;
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+
+ // Everything else, we just grab the value
+ } else
+ return (this[0].value || "").replace(/\r/g, "");
+
+ }
+
+ return undefined;
+ }
+
+ if( value.constructor == Number )
+ value += '';
+
+ return this.each(function(){
+ if ( this.nodeType != 1 )
+ return;
+
+ if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
+ this.checked = (jQuery.inArray(this.value, value) >= 0 ||
+ jQuery.inArray(this.name, value) >= 0);
+
+ else if ( jQuery.nodeName( this, "select" ) ) {
+ var values = jQuery.makeArray(value);
+
+ jQuery( "option", this ).each(function(){
+ this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
+ jQuery.inArray( this.text, values ) >= 0);
+ });
+
+ if ( !values.length )
+ this.selectedIndex = -1;
+
+ } else
+ this.value = value;
+ });
+ },
+
+ html: function( value ) {
+ return value == undefined ?
+ (this[0] ?
+ this[0].innerHTML :
+ null) :
+ this.empty().append( value );
+ },
+
+ replaceWith: function( value ) {
+ return this.after( value ).remove();
+ },
+
+ eq: function( i ) {
+ return this.slice( i, i + 1 );
+ },
+
+ slice: function() {
+ return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function(elem, i){
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ andSelf: function() {
+ return this.add( this.prevObject );
+ },
+
+ data: function( key, value ){
+ var parts = key.split(".");
+ parts[1] = parts[1] ? "." + parts[1] : "";
+
+ if ( value === undefined ) {
+ var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+
+ if ( data === undefined && this.length )
+ data = jQuery.data( this[0], key );
+
+ return data === undefined && parts[1] ?
+ this.data( parts[0] ) :
+ data;
+ } else
+ return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
+ jQuery.data( this, key, value );
+ });
+ },
+
+ removeData: function( key ){
+ return this.each(function(){
+ jQuery.removeData( this, key );
+ });
+ },
+
+ domManip: function( args, table, reverse, callback ) {
+ var clone = this.length > 1, elems;
+
+ return this.each(function(){
+ if ( !elems ) {
+ elems = jQuery.clean( args, this.ownerDocument );
+
+ if ( reverse )
+ elems.reverse();
+ }
+
+ var obj = this;
+
+ if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
+ obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
+
+ var scripts = jQuery( [] );
+
+ jQuery.each(elems, function(){
+ var elem = clone ?
+ jQuery( this ).clone( true )[0] :
+ this;
+
+ // execute all scripts after the elements have been injected
+ if ( jQuery.nodeName( elem, "script" ) )
+ scripts = scripts.add( elem );
+ else {
+ // Remove any inner scripts for later evaluation
+ if ( elem.nodeType == 1 )
+ scripts = scripts.add( jQuery( "script", elem ).remove() );
+
+ // Inject the elements into the document
+ callback.call( obj, elem );
+ }
+ });
+
+ scripts.each( evalScript );
+ });
+ }
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+function evalScript( i, elem ) {
+ if ( elem.src )
+ jQuery.ajax({
+ url: elem.src,
+ async: false,
+ dataType: "script"
+ });
+
+ else
+ jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+
+ if ( elem.parentNode )
+ elem.parentNode.removeChild( elem );
+}
+
+function now(){
+ return +new Date;
+}
+
+jQuery.extend = jQuery.fn.extend = function() {
+ // copy reference to target object
+ var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
+
+ // Handle a deep copy situation
+ if ( target.constructor == Boolean ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target != "object" && typeof target != "function" )
+ target = {};
+
+ // extend jQuery itself if only one argument is passed
+ if ( length == i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ )
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null )
+ // Extend the base object
+ for ( var name in options ) {
+ var src = target[ name ], copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy )
+ continue;
+
+ // Recurse if we're merging object values
+ if ( deep && copy && typeof copy == "object" && !copy.nodeType )
+ target[ name ] = jQuery.extend( deep,
+ // Never move original objects, clone them
+ src || ( copy.length != null ? [ ] : { } )
+ , copy );
+
+ // Don't bring in undefined values
+ else if ( copy !== undefined )
+ target[ name ] = copy;
+
+ }
+
+ // Return the modified object
+ return target;
+};
+
+var expando = "jQuery" + now(), uuid = 0, windowData = {},
+ // exclude the following css properties to add px
+ exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
+ // cache defaultView
+ defaultView = document.defaultView || {};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ window.$ = _$;
+
+ if ( deep )
+ window.jQuery = _jQuery;
+
+ return jQuery;
+ },
+
+ // See test/unit/core.js for details concerning this function.
+ isFunction: function( fn ) {
+ return !!fn && typeof fn != "string" && !fn.nodeName &&
+ fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
+ },
+
+ // check if an element is in a (or is an) XML document
+ isXMLDoc: function( elem ) {
+ return elem.documentElement && !elem.body ||
+ elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
+ },
+
+ // Evalulates a script in a global context
+ globalEval: function( data ) {
+ data = jQuery.trim( data );
+
+ if ( data ) {
+ // Inspired by code by Andrea Giammarchi
+ // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
+ var head = document.getElementsByTagName("head")[0] || document.documentElement,
+ script = document.createElement("script");
+
+ script.type = "text/javascript";
+ if ( jQuery.browser.msie )
+ script.text = data;
+ else
+ script.appendChild( document.createTextNode( data ) );
+
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709).
+ head.insertBefore( script, head.firstChild );
+ head.removeChild( script );
+ }
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
+ },
+
+ cache: {},
+
+ data: function( elem, name, data ) {
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var id = elem[ expando ];
+
+ // Compute a unique ID for the element
+ if ( !id )
+ id = elem[ expando ] = ++uuid;
+
+ // Only generate the data cache if we're
+ // trying to access or manipulate it
+ if ( name && !jQuery.cache[ id ] )
+ jQuery.cache[ id ] = {};
+
+ // Prevent overriding the named cache with undefined values
+ if ( data !== undefined )
+ jQuery.cache[ id ][ name ] = data;
+
+ // Return the named cache data, or the ID for the element
+ return name ?
+ jQuery.cache[ id ][ name ] :
+ id;
+ },
+
+ removeData: function( elem, name ) {
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var id = elem[ expando ];
+
+ // If we want to remove a specific section of the element's data
+ if ( name ) {
+ if ( jQuery.cache[ id ] ) {
+ // Remove the section of cache data
+ delete jQuery.cache[ id ][ name ];
+
+ // If we've removed all the data, remove the element's cache
+ name = "";
+
+ for ( name in jQuery.cache[ id ] )
+ break;
+
+ if ( !name )
+ jQuery.removeData( elem );
+ }
+
+ // Otherwise, we want to remove all of the element's data
+ } else {
+ // Clean up the element expando
+ try {
+ delete elem[ expando ];
+ } catch(e){
+ // IE has trouble directly removing the expando
+ // but it's ok with using removeAttribute
+ if ( elem.removeAttribute )
+ elem.removeAttribute( expando );
+ }
+
+ // Completely remove the data cache
+ delete jQuery.cache[ id ];
+ }
+ },
+
+ // args is for internal usage only
+ each: function( object, callback, args ) {
+ var name, i = 0, length = object.length;
+
+ if ( args ) {
+ if ( length == undefined ) {
+ for ( name in object )
+ if ( callback.apply( object[ name ], args ) === false )
+ break;
+ } else
+ for ( ; i < length; )
+ if ( callback.apply( object[ i++ ], args ) === false )
+ break;
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( length == undefined ) {
+ for ( name in object )
+ if ( callback.call( object[ name ], name, object[ name ] ) === false )
+ break;
+ } else
+ for ( var value = object[0];
+ i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
+ }
+
+ return object;
+ },
+
+ prop: function( elem, value, type, i, name ) {
+ // Handle executable functions
+ if ( jQuery.isFunction( value ) )
+ value = value.call( elem, i );
+
+ // Handle passing in a number to a CSS property
+ return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
+ value + "px" :
+ value;
+ },
+
+ className: {
+ // internal only, use addClass("class")
+ add: function( elem, classNames ) {
+ jQuery.each((classNames || "").split(/\s+/), function(i, className){
+ if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
+ elem.className += (elem.className ? " " : "") + className;
+ });
+ },
+
+ // internal only, use removeClass("class")
+ remove: function( elem, classNames ) {
+ if (elem.nodeType == 1)
+ elem.className = classNames != undefined ?
+ jQuery.grep(elem.className.split(/\s+/), function(className){
+ return !jQuery.className.has( classNames, className );
+ }).join(" ") :
+ "";
+ },
+
+ // internal only, use hasClass("class")
+ has: function( elem, className ) {
+ return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
+ }
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback ) {
+ var old = {};
+ // Remember the old values, and insert the new ones
+ for ( var name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ callback.call( elem );
+
+ // Revert the old values
+ for ( var name in options )
+ elem.style[ name ] = old[ name ];
+ },
+
+ css: function( elem, name, force ) {
+ if ( name == "width" || name == "height" ) {
+ var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
+
+ function getWH() {
+ val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
+ var padding = 0, border = 0;
+ jQuery.each( which, function() {
+ padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
+ border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
+ });
+ val -= Math.round(padding + border);
+ }
+
+ if ( jQuery(elem).is(":visible") )
+ getWH();
+ else
+ jQuery.swap( elem, props, getWH );
+
+ return Math.max(0, val);
+ }
+
+ return jQuery.curCSS( elem, name, force );
+ },
+
+ curCSS: function( elem, name, force ) {
+ var ret, style = elem.style;
+
+ // A helper method for determining if an element's values are broken
+ function color( elem ) {
+ if ( !jQuery.browser.safari )
+ return false;
+
+ // defaultView is cached
+ var ret = defaultView.getComputedStyle( elem, null );
+ return !ret || ret.getPropertyValue("color") == "";
+ }
+
+ // We need to handle opacity special in IE
+ if ( name == "opacity" && jQuery.browser.msie ) {
+ ret = jQuery.attr( style, "opacity" );
+
+ return ret == "" ?
+ "1" :
+ ret;
+ }
+ // Opera sometimes will give the wrong display answer, this fixes it, see #2037
+ if ( jQuery.browser.opera && name == "display" ) {
+ var save = style.outline;
+ style.outline = "0 solid black";
+ style.outline = save;
+ }
+
+ // Make sure we're using the right name for getting the float value
+ if ( name.match( /float/i ) )
+ name = styleFloat;
+
+ if ( !force && style && style[ name ] )
+ ret = style[ name ];
+
+ else if ( defaultView.getComputedStyle ) {
+
+ // Only "float" is needed here
+ if ( name.match( /float/i ) )
+ name = "float";
+
+ name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
+
+ var computedStyle = defaultView.getComputedStyle( elem, null );
+
+ if ( computedStyle && !color( elem ) )
+ ret = computedStyle.getPropertyValue( name );
+
+ // If the element isn't reporting its values properly in Safari
+ // then some display: none elements are involved
+ else {
+ var swap = [], stack = [], a = elem, i = 0;
+
+ // Locate all of the parent display: none elements
+ for ( ; a && color(a); a = a.parentNode )
+ stack.unshift(a);
+
+ // Go through and make them visible, but in reverse
+ // (It would be better if we knew the exact display type that they had)
+ for ( ; i < stack.length; i++ )
+ if ( color( stack[ i ] ) ) {
+ swap[ i ] = stack[ i ].style.display;
+ stack[ i ].style.display = "block";
+ }
+
+ // Since we flip the display style, we have to handle that
+ // one special, otherwise get the value
+ ret = name == "display" && swap[ stack.length - 1 ] != null ?
+ "none" :
+ ( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
+
+ // Finally, revert the display styles back
+ for ( i = 0; i < swap.length; i++ )
+ if ( swap[ i ] != null )
+ stack[ i ].style.display = swap[ i ];
+ }
+
+ // We should always get a number back from opacity
+ if ( name == "opacity" && ret == "" )
+ ret = "1";
+
+ } else if ( elem.currentStyle ) {
+ var camelCase = name.replace(/\-(\w)/g, function(all, letter){
+ return letter.toUpperCase();
+ });
+
+ ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
+ // Remember the original values
+ var left = style.left, rsLeft = elem.runtimeStyle.left;
+
+ // Put in the new values to get a computed value out
+ elem.runtimeStyle.left = elem.currentStyle.left;
+ style.left = ret || 0;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ elem.runtimeStyle.left = rsLeft;
+ }
+ }
+
+ return ret;
+ },
+
+ clean: function( elems, context ) {
+ var ret = [];
+ context = context || document;
+ // !context.createElement fails in IE with an error but returns typeof 'object'
+ if (typeof context.createElement == 'undefined')
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
+
+ jQuery.each(elems, function(i, elem){
+ if ( !elem )
+ return;
+
+ if ( elem.constructor == Number )
+ elem += '';
+
+ // Convert html string into DOM nodes
+ if ( typeof elem == "string" ) {
+ // Fix "XHTML"-style tags in all browsers
+ elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
+ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
+ all :
+ front + "></" + tag + ">";
+ });
+
+ // Trim whitespace, otherwise indexOf won't work as expected
+ var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
+
+ var wrap =
+ // option or optgroup
+ !tags.indexOf("<opt") &&
+ [ 1, "<select multiple='multiple'>", "</select>" ] ||
+
+ !tags.indexOf("<leg") &&
+ [ 1, "<fieldset>", "</fieldset>" ] ||
+
+ tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
+ [ 1, "<table>", "</table>" ] ||
+
+ !tags.indexOf("<tr") &&
+ [ 2, "<table><tbody>", "</tbody></table>" ] ||
+
+ // <thead> matched above
+ (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
+ [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
+
+ !tags.indexOf("<col") &&
+ [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
+
+ // IE can't serialize <link> and <script> tags normally
+ jQuery.browser.msie &&
+ [ 1, "div<div>", "</div>" ] ||
+
+ [ 0, "", "" ];
+
+ // Go to html and back, then peel off extra wrappers
+ div.innerHTML = wrap[1] + elem + wrap[2];
+
+ // Move to the right depth
+ while ( wrap[0]-- )
+ div = div.lastChild;
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( jQuery.browser.msie ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
+ div.firstChild && div.firstChild.childNodes :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
+ div.childNodes :
+ [];
+
+ for ( var j = tbody.length - 1; j >= 0 ; --j )
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
+
+ // IE completely kills leading whitespace when innerHTML is used
+ if ( /^\s/.test( elem ) )
+ div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
+
+ }
+
+ elem = jQuery.makeArray( div.childNodes );
+ }
+
+ if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
+ return;
+
+ if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
+ ret.push( elem );
+
+ else
+ ret = jQuery.merge( ret, elem );
+
+ });
+
+ return ret;
+ },
+
+ attr: function( elem, name, value ) {
+ // don't set attributes on text and comment nodes
+ if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
+ return undefined;
+
+ var notxml = !jQuery.isXMLDoc( elem ),
+ // Whether we are setting (or getting)
+ set = value !== undefined,
+ msie = jQuery.browser.msie;
+
+ // Try to normalize/fix the name
+ name = notxml && jQuery.props[ name ] || name;
+
+ // Only do all the following if this is a node (faster for style)
+ // IE elem.getAttribute passes even for style
+ if ( elem.tagName ) {
+
+ // These attributes require special treatment
+ var special = /href|src|style/.test( name );
+
+ // Safari mis-reports the default selected property of a hidden option
+ // Accessing the parent's selectedIndex property fixes it
+ if ( name == "selected" && jQuery.browser.safari )
+ elem.parentNode.selectedIndex;
+
+ // If applicable, access the attribute via the DOM 0 way
+ if ( name in elem && notxml && !special ) {
+ if ( set ){
+ // We can't allow the type property to be changed (since it causes problems in IE)
+ if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
+ throw "type property can't be changed";
+
+ elem[ name ] = value;
+ }
+
+ // browsers index elements by id/name on forms, give priority to attributes.
+ if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
+ return elem.getAttributeNode( name ).nodeValue;
+
+ return elem[ name ];
+ }
+
+ if ( msie && notxml && name == "style" )
+ return jQuery.attr( elem.style, "cssText", value );
+
+ if ( set )
+ // convert the value to a string (all browsers do this but IE) see #1070
+ elem.setAttribute( name, "" + value );
+
+ var attr = msie && notxml && special
+ // Some attributes require a special call on IE
+ ? elem.getAttribute( name, 2 )
+ : elem.getAttribute( name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return attr === null ? undefined : attr;
+ }
+
+ // elem is actually elem.style ... set the style
+
+ // IE uses filters for opacity
+ if ( msie && name == "opacity" ) {
+ if ( set ) {
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ elem.zoom = 1;
+
+ // Set the alpha filter to set the opacity
+ elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
+ (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
+ }
+
+ return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
+ (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
+ "";
+ }
+
+ name = name.replace(/-([a-z])/ig, function(all, letter){
+ return letter.toUpperCase();
+ });
+
+ if ( set )
+ elem[ name ] = value;
+
+ return elem[ name ];
+ },
+
+ trim: function( text ) {
+ return (text || "").replace( /^\s+|\s+$/g, "" );
+ },
+
+ makeArray: function( array ) {
+ var ret = [];
+
+ if( array != null ){
+ var i = array.length;
+ //the window, strings and functions also have 'length'
+ if( i == null || array.split || array.setInterval || array.call )
+ ret[0] = array;
+ else
+ while( i )
+ ret[--i] = array[i];
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, array ) {
+ for ( var i = 0, length = array.length; i < length; i++ )
+ // Use === because on IE, window == document
+ if ( array[ i ] === elem )
+ return i;
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ // We have to loop this way because IE & Opera overwrite the length
+ // expando of getElementsByTagName
+ var i = 0, elem, pos = first.length;
+ // Also, we need to make sure that the correct elements are being returned
+ // (IE returns comment nodes in a '*' query)
+ if ( jQuery.browser.msie ) {
+ while ( elem = second[ i++ ] )
+ if ( elem.nodeType != 8 )
+ first[ pos++ ] = elem;
+
+ } else
+ while ( elem = second[ i++ ] )
+ first[ pos++ ] = elem;
+
+ return first;
+ },
+
+ unique: function( array ) {
+ var ret = [], done = {};
+
+ try {
+
+ for ( var i = 0, length = array.length; i < length; i++ ) {
+ var id = jQuery.data( array[ i ] );
+
+ if ( !done[ id ] ) {
+ done[ id ] = true;
+ ret.push( array[ i ] );
+ }
+ }
+
+ } catch( e ) {
+ ret = array;
+ }
+
+ return ret;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var ret = [];
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( var i = 0, length = elems.length; i < length; i++ )
+ if ( !inv != !callback( elems[ i ], i ) )
+ ret.push( elems[ i ] );
+
+ return ret;
+ },
+
+ map: function( elems, callback ) {
+ var ret = [];
+
+ // Go through the array, translating each of the items to their
+ // new value (or values).
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ var value = callback( elems[ i ], i );
+
+ if ( value != null )
+ ret[ ret.length ] = value;
+ }
+
+ return ret.concat.apply( [], ret );
+ }
+});
+
+var userAgent = navigator.userAgent.toLowerCase();
+
+// Figure out what browser is being used
+jQuery.browser = {
+ version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
+ safari: /webkit/.test( userAgent ),
+ opera: /opera/.test( userAgent ),
+ msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
+ mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
+};
+
+var styleFloat = jQuery.browser.msie ?
+ "styleFloat" :
+ "cssFloat";
+
+jQuery.extend({
+ // Check to see if the W3C box model is being used
+ boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
+
+ props: {
+ "for": "htmlFor",
+ "class": "className",
+ "float": styleFloat,
+ cssFloat: styleFloat,
+ styleFloat: styleFloat,
+ readonly: "readOnly",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing"
+ }
+});
+
+jQuery.each({
+ parent: function(elem){return elem.parentNode;},
+ parents: function(elem){return jQuery.dir(elem,"parentNode");},
+ next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
+ prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
+ nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
+ prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
+ siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
+ children: function(elem){return jQuery.sibling(elem.firstChild);},
+ contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
+}, function(name, fn){
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = jQuery.map( this, fn );
+
+ if ( selector && typeof selector == "string" )
+ ret = jQuery.multiFilter( selector, ret );
+
+ return this.pushStack( jQuery.unique( ret ) );
+ };
+});
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function(name, original){
+ jQuery.fn[ name ] = function() {
+ var args = arguments;
+
+ return this.each(function(){
+ for ( var i = 0, length = args.length; i < length; i++ )
+ jQuery( args[ i ] )[ original ]( this );
+ });
+ };
+});
+
+jQuery.each({
+ removeAttr: function( name ) {
+ jQuery.attr( this, name, "" );
+ if (this.nodeType == 1)
+ this.removeAttribute( name );
+ },
+
+ addClass: function( classNames ) {
+ jQuery.className.add( this, classNames );
+ },
+
+ removeClass: function( classNames ) {
+ jQuery.className.remove( this, classNames );
+ },
+
+ toggleClass: function( classNames ) {
+ jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
+ },
+
+ remove: function( selector ) {
+ if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
+ // Prevent memory leaks
+ jQuery( "*", this ).add(this).each(function(){
+ jQuery.event.remove(this);
+ jQuery.removeData(this);
+ });
+ if (this.parentNode)
+ this.parentNode.removeChild( this );
+ }
+ },
+
+ empty: function() {
+ // Remove element nodes and prevent memory leaks
+ jQuery( ">*", this ).remove();
+
+ // Remove any remaining nodes
+ while ( this.firstChild )
+ this.removeChild( this.firstChild );
+ }
+}, function(name, fn){
+ jQuery.fn[ name ] = function(){
+ return this.each( fn, arguments );
+ };
+});
+
+jQuery.each([ "Height", "Width" ], function(i, name){
+ var type = name.toLowerCase();
+
+ jQuery.fn[ type ] = function( size ) {
+ // Get window width or height
+ return this[0] == window ?
+ // Opera reports document.body.client[Width/Height] properly in both quirks and standards
+ jQuery.browser.opera && document.body[ "client" + name ] ||
+
+ // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
+ jQuery.browser.safari && window[ "inner" + name ] ||
+
+ // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
+ document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
+
+ // Get document width or height
+ this[0] == document ?
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+ Math.max(
+ Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
+ Math.max(document.body["offset" + name], document.documentElement["offset" + name])
+ ) :
+
+ // Get or set width or height on the element
+ size == undefined ?
+ // Get width or height on the element
+ (this.length ? jQuery.css( this[0], type ) : null) :
+
+ // Set the width or height on the element (default to pixels if value is unitless)
+ this.css( type, size.constructor == String ? size : size + "px" );
+ };
+});
+
+// Helper function used by the dimensions and offset modules
+function num(elem, prop) {
+ return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
+}var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
+ "(?:[\\w*_-]|\\\\.)" :
+ "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
+ quickChild = new RegExp("^>\\s*(" + chars + "+)"),
+ quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
+ quickClass = new RegExp("^([#.]?)(" + chars + "*)");
+
+jQuery.extend({
+ expr: {
+ "": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
+ "#": function(a,i,m){return a.getAttribute("id")==m[2];},
+ ":": {
+ // Position Checks
+ lt: function(a,i,m){return i<m[3]-0;},
+ gt: function(a,i,m){return i>m[3]-0;},
+ nth: function(a,i,m){return m[3]-0==i;},
+ eq: function(a,i,m){return m[3]-0==i;},
+ first: function(a,i){return i==0;},
+ last: function(a,i,m,r){return i==r.length-1;},
+ even: function(a,i){return i%2==0;},
+ odd: function(a,i){return i%2;},
+
+ // Child Checks
+ "first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
+ "last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
+ "only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},
+
+ // Parent Checks
+ parent: function(a){return a.firstChild;},
+ empty: function(a){return !a.firstChild;},
+
+ // Text Check
+ contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},
+
+ // Visibility
+ visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
+ hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},
+
+ // Form attributes
+ enabled: function(a){return !a.disabled;},
+ disabled: function(a){return a.disabled;},
+ checked: function(a){return a.checked;},
+ selected: function(a){return a.selected||jQuery.attr(a,"selected");},
+
+ // Form elements
+ text: function(a){return "text"==a.type;},
+ radio: function(a){return "radio"==a.type;},
+ checkbox: function(a){return "checkbox"==a.type;},
+ file: function(a){return "file"==a.type;},
+ password: function(a){return "password"==a.type;},
+ submit: function(a){return "submit"==a.type;},
+ image: function(a){return "image"==a.type;},
+ reset: function(a){return "reset"==a.type;},
+ button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
+ input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},
+
+ // :has()
+ has: function(a,i,m){return jQuery.find(m[3],a).length;},
+
+ // :header
+ header: function(a){return /h\d/i.test(a.nodeName);},
+
+ // :animated
+ animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
+ }
+ },
+
+ // The regular expressions that power the parsing engine
+ parse: [
+ // Match: [@value='test'], [@foo]
+ /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
+
+ // Match: :contains('foo')
+ /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
+
+ // Match: :even, :last-child, #id, .class
+ new RegExp("^([:.#]*)(" + chars + "+)")
+ ],
+
+ multiFilter: function( expr, elems, not ) {
+ var old, cur = [];
+
+ while ( expr && expr != old ) {
+ old = expr;
+ var f = jQuery.filter( expr, elems, not );
+ expr = f.t.replace(/^\s*,\s*/, "" );
+ cur = not ? elems = f.r : jQuery.merge( cur, f.r );
+ }
+
+ return cur;
+ },
+
+ find: function( t, context ) {
+ // Quickly handle non-string expressions
+ if ( typeof t != "string" )
+ return [ t ];
+
+ // check to make sure context is a DOM element or a document
+ if ( context && context.nodeType != 1 && context.nodeType != 9)
+ return [ ];
+
+ // Set the correct context (if none is provided)
+ context = context || document;
+
+ // Initialize the search
+ var ret = [context], done = [], last, nodeName;
+
+ // Continue while a selector expression exists, and while
+ // we're no longer looping upon ourselves
+ while ( t && last != t ) {
+ var r = [];
+ last = t;
+
+ t = jQuery.trim(t);
+
+ var foundToken = false,
+
+ // An attempt at speeding up child selectors that
+ // point to a specific element tag
+ re = quickChild,
+
+ m = re.exec(t);
+
+ if ( m ) {
+ nodeName = m[1].toUpperCase();
+
+ // Perform our own iteration and filter
+ for ( var i = 0; ret[i]; i++ )
+ for ( var c = ret[i].firstChild; c; c = c.nextSibling )
+ if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
+ r.push( c );
+
+ ret = r;
+ t = t.replace( re, "" );
+ if ( t.indexOf(" ") == 0 ) continue;
+ foundToken = true;
+ } else {
+ re = /^([>+~])\s*(\w*)/i;
+
+ if ( (m = re.exec(t)) != null ) {
+ r = [];
+
+ var merge = {};
+ nodeName = m[2].toUpperCase();
+ m = m[1];
+
+ for ( var j = 0, rl = ret.length; j < rl; j++ ) {
+ var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
+ for ( ; n; n = n.nextSibling )
+ if ( n.nodeType == 1 ) {
+ var id = jQuery.data(n);
+
+ if ( m == "~" && merge[id] ) break;
+
+ if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
+ if ( m == "~" ) merge[id] = true;
+ r.push( n );
+ }
+
+ if ( m == "+" ) break;
+ }
+ }
+
+ ret = r;
+
+ // And remove the token
+ t = jQuery.trim( t.replace( re, "" ) );
+ foundToken = true;
+ }
+ }
+
+ // See if there's still an expression, and that we haven't already
+ // matched a token
+ if ( t && !foundToken ) {
+ // Handle multiple expressions
+ if ( !t.indexOf(",") ) {
+ // Clean the result set
+ if ( context == ret[0] ) ret.shift();
+
+ // Merge the result sets
+ done = jQuery.merge( done, ret );
+
+ // Reset the context
+ r = ret = [context];
+
+ // Touch up the selector string
+ t = " " + t.substr(1,t.length);
+
+ } else {
+ // Optimize for the case nodeName#idName
+ var re2 = quickID;
+ var m = re2.exec(t);
+
+ // Re-organize the results, so that they're consistent
+ if ( m ) {
+ m = [ 0, m[2], m[3], m[1] ];
+
+ } else {
+ // Otherwise, do a traditional filter check for
+ // ID, class, and element selectors
+ re2 = quickClass;
+ m = re2.exec(t);
+ }
+
+ m[2] = m[2].replace(/\\/g, "");
+
+ var elem = ret[ret.length-1];
+
+ // Try to do a global search by ID, where we can
+ if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
+ // Optimization for HTML document case
+ var oid = elem.getElementById(m[2]);
+
+ // Do a quick check for the existence of the actual ID attribute
+ // to avoid selecting by the name attribute in IE
+ // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
+ if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
+ oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
+
+ // Do a quick check for node name (where applicable) so
+ // that div#foo searches will be really fast
+ ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
+ } else {
+ // We need to find all descendant elements
+ for ( var i = 0; ret[i]; i++ ) {
+ // Grab the tag name being searched for
+ var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
+
+ // Handle IE7 being really dumb about <object>s
+ if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
+ tag = "param";
+
+ r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
+ }
+
+ // It's faster to filter by class and be done with it
+ if ( m[1] == "." )
+ r = jQuery.classFilter( r, m[2] );
+
+ // Same with ID filtering
+ if ( m[1] == "#" ) {
+ var tmp = [];
+
+ // Try to find the element with the ID
+ for ( var i = 0; r[i]; i++ )
+ if ( r[i].getAttribute("id") == m[2] ) {
+ tmp = [ r[i] ];
+ break;
+ }
+
+ r = tmp;
+ }
+
+ ret = r;
+ }
+
+ t = t.replace( re2, "" );
+ }
+
+ }
+
+ // If a selector string still exists
+ if ( t ) {
+ // Attempt to filter it
+ var val = jQuery.filter(t,r);
+ ret = r = val.r;
+ t = jQuery.trim(val.t);
+ }
+ }
+
+ // An error occurred with the selector;
+ // just return an empty set instead
+ if ( t )
+ ret = [];
+
+ // Remove the root context
+ if ( ret && context == ret[0] )
+ ret.shift();
+
+ // And combine the results
+ done = jQuery.merge( done, ret );
+
+ return done;
+ },
+
+ classFilter: function(r,m,not){
+ m = " " + m + " ";
+ var tmp = [];
+ for ( var i = 0; r[i]; i++ ) {
+ var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
+ if ( !not && pass || not && !pass )
+ tmp.push( r[i] );
+ }
+ return tmp;
+ },
+
+ filter: function(t,r,not) {
+ var last;
+
+ // Look for common filter expressions
+ while ( t && t != last ) {
+ last = t;
+
+ var p = jQuery.parse, m;
+
+ for ( var i = 0; p[i]; i++ ) {
+ m = p[i].exec( t );
+
+ if ( m ) {
+ // Remove what we just matched
+ t = t.substring( m[0].length );
+
+ m[2] = m[2].replace(/\\/g, "");
+ break;
+ }
+ }
+
+ if ( !m )
+ break;
+
+ // :not() is a special case that can be optimized by
+ // keeping it out of the expression list
+ if ( m[1] == ":" && m[2] == "not" )
+ // optimize if only one selector found (most common case)
+ r = isSimple.test( m[3] ) ?
+ jQuery.filter(m[3], r, true).r :
+ jQuery( r ).not( m[3] );
+
+ // We can get a big speed boost by filtering by class here
+ else if ( m[1] == "." )
+ r = jQuery.classFilter(r, m[2], not);
+
+ else if ( m[1] == "[" ) {
+ var tmp = [], type = m[3];
+
+ for ( var i = 0, rl = r.length; i < rl; i++ ) {
+ var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
+
+ if ( z == null || /href|src|selected/.test(m[2]) )
+ z = jQuery.attr(a,m[2]) || '';
+
+ if ( (type == "" && !!z ||
+ type == "=" && z == m[5] ||
+ type == "!=" && z != m[5] ||
+ type == "^=" && z && !z.indexOf(m[5]) ||
+ type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
+ (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
+ tmp.push( a );
+ }
+
+ r = tmp;
+
+ // We can get a speed boost by handling nth-child here
+ } else if ( m[1] == ":" && m[2] == "nth-child" ) {
+ var merge = {}, tmp = [],
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+ test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+ m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
+ !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
+ // calculate the numbers (first)n+(last) including if they are negative
+ first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
+
+ // loop through all the elements left in the jQuery object
+ for ( var i = 0, rl = r.length; i < rl; i++ ) {
+ var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
+
+ if ( !merge[id] ) {
+ var c = 1;
+
+ for ( var n = parentNode.firstChild; n; n = n.nextSibling )
+ if ( n.nodeType == 1 )
+ n.nodeIndex = c++;
+
+ merge[id] = true;
+ }
+
+ var add = false;
+
+ if ( first == 0 ) {
+ if ( node.nodeIndex == last )
+ add = true;
+ } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
+ add = true;
+
+ if ( add ^ not )
+ tmp.push( node );
+ }
+
+ r = tmp;
+
+ // Otherwise, find the expression to execute
+ } else {
+ var fn = jQuery.expr[ m[1] ];
+ if ( typeof fn == "object" )
+ fn = fn[ m[2] ];
+
+ if ( typeof fn == "string" )
+ fn = eval("false||function(a,i){return " + fn + ";}");
+
+ // Execute it against the current filter
+ r = jQuery.grep( r, function(elem, i){
+ return fn(elem, i, m, r);
+ }, not );
+ }
+ }
+
+ // Return an array of filtered elements (r)
+ // and the modified expression string (t)
+ return { r: r, t: t };
+ },
+
+ dir: function( elem, dir ){
+ var matched = [],
+ cur = elem[dir];
+ while ( cur && cur != document ) {
+ if ( cur.nodeType == 1 )
+ matched.push( cur );
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ nth: function(cur,result,dir,elem){
+ result = result || 1;
+ var num = 0;
+
+ for ( ; cur; cur = cur[dir] )
+ if ( cur.nodeType == 1 && ++num == result )
+ break;
+
+ return cur;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType == 1 && n != elem )
+ r.push( n );
+ }
+
+ return r;
+ }
+});
+/*
+ * A number of helper functions used for managing events.
+ * Many of the ideas behind this code orignated from
+ * Dean Edwards' addEvent library.
+ */
+jQuery.event = {
+
+ // Bind an event to an element
+ // Original by Dean Edwards
+ add: function(elem, types, handler, data) {
+ if ( elem.nodeType == 3 || elem.nodeType == 8 )
+ return;
+
+ // For whatever reason, IE has trouble passing the window object
+ // around, causing it to be cloned in the process
+ if ( jQuery.browser.msie && elem.setInterval )
+ elem = window;
+
+ // Make sure that the function being executed has a unique ID
+ if ( !handler.guid )
+ handler.guid = this.guid++;
+
+ // if data is passed, bind to handler
+ if( data != undefined ) {
+ // Create temporary function pointer to original handler
+ var fn = handler;
+
+ // Create unique handler function, wrapped around original handler
+ handler = this.proxy( fn, function() {
+ // Pass arguments and context to original handler
+ return fn.apply(this, arguments);
+ });
+
+ // Store data in unique handler
+ handler.data = data;
+ }
+
+ // Init the element's event structure
+ var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
+ handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
+ // Handle the second event of a trigger and when
+ // an event is called after a page has unloaded
+ if ( typeof jQuery != "undefined" && !jQuery.event.triggered )
+ return jQuery.event.handle.apply(arguments.callee.elem, arguments);
+ });
+ // Add elem as a property of the handle function
+ // This is to prevent a memory leak with non-native
+ // event in IE.
+ handle.elem = elem;
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ jQuery.each(types.split(/\s+/), function(index, type) {
+ // Namespaced event handlers
+ var parts = type.split(".");
+ type = parts[0];
+ handler.type = parts[1];
+
+ // Get the current list of functions bound to this event
+ var handlers = events[type];
+
+ // Init the event handler queue
+ if (!handlers) {
+ handlers = events[type] = {};
+
+ // Check for a special event handler
+ // Only use addEventListener/attachEvent if the special
+ // events handler returns false
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
+ // Bind the global event handler to the element
+ if (elem.addEventListener)
+ elem.addEventListener(type, handle, false);
+ else if (elem.attachEvent)
+ elem.attachEvent("on" + type, handle);
+ }
+ }
+
+ // Add the function to the element's handler list
+ handlers[handler.guid] = handler;
+
+ // Keep track of which events have been used, for global triggering
+ jQuery.event.global[type] = true;
+ });
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ guid: 1,
+ global: {},
+
+ // Detach an event or set of events from an element
+ remove: function(elem, types, handler) {
+ // don't do events on text and comment nodes
+ if ( elem.nodeType == 3 || elem.nodeType == 8 )
+ return;
+
+ var events = jQuery.data(elem, "events"), ret, index;
+
+ if ( events ) {
+ // Unbind all events for the element
+ if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )
+ for ( var type in events )
+ this.remove( elem, type + (types || "") );
+ else {
+ // types is actually an event object here
+ if ( types.type ) {
+ handler = types.handler;
+ types = types.type;
+ }
+
+ // Handle multiple events seperated by a space
+ // jQuery(...).unbind("mouseover mouseout", fn);
+ jQuery.each(types.split(/\s+/), function(index, type){
+ // Namespaced event handlers
+ var parts = type.split(".");
+ type = parts[0];
+
+ if ( events[type] ) {
+ // remove the given handler for the given type
+ if ( handler )
+ delete events[type][handler.guid];
+
+ // remove all handlers for the given type
+ else
+ for ( handler in events[type] )
+ // Handle the removal of namespaced events
+ if ( !parts[1] || events[type][handler].type == parts[1] )
+ delete events[type][handler];
+
+ // remove generic event handler if no more handlers exist
+ for ( ret in events[type] ) break;
+ if ( !ret ) {
+ if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
+ if (elem.removeEventListener)
+ elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
+ else if (elem.detachEvent)
+ elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
+ }
+ ret = null;
+ delete events[type];
+ }
+ }
+ });
+ }
+
+ // Remove the expando if it's no longer used
+ for ( ret in events ) break;
+ if ( !ret ) {
+ var handle = jQuery.data( elem, "handle" );
+ if ( handle ) handle.elem = null;
+ jQuery.removeData( elem, "events" );
+ jQuery.removeData( elem, "handle" );
+ }
+ }
+ },
+
+ trigger: function(type, data, elem, donative, extra) {
+ // Clone the incoming data, if any
+ data = jQuery.makeArray(data);
+
+ if ( type.indexOf("!") >= 0 ) {
+ type = type.slice(0, -1);
+ var exclusive = true;
+ }
+
+ // Handle a global trigger
+ if ( !elem ) {
+ // Only trigger if we've ever bound an event for it
+ if ( this.global[type] )
+ jQuery("*").add([window, document]).trigger(type, data);
+
+ // Handle triggering a single element
+ } else {
+ // don't do events on text and comment nodes
+ if ( elem.nodeType == 3 || elem.nodeType == 8 )
+ return undefined;
+
+ var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
+ // Check to see if we need to provide a fake event, or not
+ event = !data[0] || !data[0].preventDefault;
+
+ // Pass along a fake event
+ if ( event ) {
+ data.unshift({
+ type: type,
+ target: elem,
+ preventDefault: function(){},
+ stopPropagation: function(){},
+ timeStamp: now()
+ });
+ data[0][expando] = true; // no need to fix fake event
+ }
+
+ // Enforce the right trigger type
+ data[0].type = type;
+ if ( exclusive )
+ data[0].exclusive = true;
+
+ // Trigger the event, it is assumed that "handle" is a function
+ var handle = jQuery.data(elem, "handle");
+ if ( handle )
+ val = handle.apply( elem, data );
+
+ // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
+ if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
+ val = false;
+
+ // Extra functions don't get the custom event object
+ if ( event )
+ data.shift();
+
+ // Handle triggering of extra function
+ if ( extra && jQuery.isFunction( extra ) ) {
+ // call the extra function and tack the current return value on the end for possible inspection
+ ret = extra.apply( elem, val == null ? data : data.concat( val ) );
+ // if anything is returned, give it precedence and have it overwrite the previous value
+ if (ret !== undefined)
+ val = ret;
+ }
+
+ // Trigger the native events (except for clicks on links)
+ if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
+ this.triggered = true;
+ try {
+ elem[ type ]();
+ // prevent IE from throwing an error for some hidden elements
+ } catch (e) {}
+ }
+
+ this.triggered = false;
+ }
+
+ return val;
+ },
+
+ handle: function(event) {
+ // returned undefined or false
+ var val, ret, namespace, all, handlers;
+
+ event = arguments[0] = jQuery.event.fix( event || window.event );
+
+ // Namespaced event handlers
+ namespace = event.type.split(".");
+ event.type = namespace[0];
+ namespace = namespace[1];
+ // Cache this now, all = true means, any handler
+ all = !namespace && !event.exclusive;
+
+ handlers = ( jQuery.data(this, "events") || {} )[event.type];
+
+ for ( var j in handlers ) {
+ var handler = handlers[j];
+
+ // Filter the functions by class
+ if ( all || handler.type == namespace ) {
+ // Pass in a reference to the handler function itself
+ // So that we can later remove it
+ event.handler = handler;
+ event.data = handler.data;
+
+ ret = handler.apply( this, arguments );
+
+ if ( val !== false )
+ val = ret;
+
+ if ( ret === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+
+ return val;
+ },
+
+ fix: function(event) {
+ if ( event[expando] == true )
+ return event;
+
+ // store a copy of the original event object
+ // and "clone" to set read-only properties
+ var originalEvent = event;
+ event = { originalEvent: originalEvent };
+ var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
+ for ( var i=props.length; i; i-- )
+ event[ props[i] ] = originalEvent[ props[i] ];
+
+ // Mark it as fixed
+ event[expando] = true;
+
+ // add preventDefault and stopPropagation since
+ // they will not work on the clone
+ event.preventDefault = function() {
+ // if preventDefault exists run it on the original event
+ if (originalEvent.preventDefault)
+ originalEvent.preventDefault();
+ // otherwise set the returnValue property of the original event to false (IE)
+ originalEvent.returnValue = false;
+ };
+ event.stopPropagation = function() {
+ // if stopPropagation exists run it on the original event
+ if (originalEvent.stopPropagation)
+ originalEvent.stopPropagation();
+ // otherwise set the cancelBubble property of the original event to true (IE)
+ originalEvent.cancelBubble = true;
+ };
+
+ // Fix timeStamp
+ event.timeStamp = event.timeStamp || now();
+
+ // Fix target property, if necessary
+ if ( !event.target )
+ event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
+
+ // check if target is a textnode (safari)
+ if ( event.target.nodeType == 3 )
+ event.target = event.target.parentNode;
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && event.fromElement )
+ event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && event.clientX != null ) {
+ var doc = document.documentElement, body = document.body;
+ event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
+ event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
+ }
+
+ // Add which for key events
+ if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
+ event.which = event.charCode || event.keyCode;
+
+ // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
+ if ( !event.metaKey && event.ctrlKey )
+ event.metaKey = event.ctrlKey;
+
+ // Add which for click: 1 == left; 2 == middle; 3 == right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && event.button )
+ event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+
+ return event;
+ },
+
+ proxy: function( fn, proxy ){
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
+ // So proxy can be declared as an argument
+ return proxy;
+ },
+
+ special: {
+ ready: {
+ setup: function() {
+ // Make sure the ready event is setup
+ bindReady();
+ return;
+ },
+
+ teardown: function() { return; }
+ },
+
+ mouseenter: {
+ setup: function() {
+ if ( jQuery.browser.msie ) return false;
+ jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
+ return true;
+ },
+
+ teardown: function() {
+ if ( jQuery.browser.msie ) return false;
+ jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
+ return true;
+ },
+
+ handler: function(event) {
+ // If we actually just moused on to a sub-element, ignore it
+ if ( withinElement(event, this) ) return true;
+ // Execute the right handlers by setting the event type to mouseenter
+ event.type = "mouseenter";
+ return jQuery.event.handle.apply(this, arguments);
+ }
+ },
+
+ mouseleave: {
+ setup: function() {
+ if ( jQuery.browser.msie ) return false;
+ jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
+ return true;
+ },
+
+ teardown: function() {
+ if ( jQuery.browser.msie ) return false;
+ jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
+ return true;
+ },
+
+ handler: function(event) {
+ // If we actually just moused on to a sub-element, ignore it
+ if ( withinElement(event, this) ) return true;
+ // Execute the right handlers by setting the event type to mouseleave
+ event.type = "mouseleave";
+ return jQuery.event.handle.apply(this, arguments);
+ }
+ }
+ }
+};
+
+jQuery.fn.extend({
+ bind: function( type, data, fn ) {
+ return type == "unload" ? this.one(type, data, fn) : this.each(function(){
+ jQuery.event.add( this, type, fn || data, fn && data );
+ });
+ },
+
+ one: function( type, data, fn ) {
+ var one = jQuery.event.proxy( fn || data, function(event) {
+ jQuery(this).unbind(event, one);
+ return (fn || data).apply( this, arguments );
+ });
+ return this.each(function(){
+ jQuery.event.add( this, type, one, fn && data);
+ });
+ },
+
+ unbind: function( type, fn ) {
+ return this.each(function(){
+ jQuery.event.remove( this, type, fn );
+ });
+ },
+
+ trigger: function( type, data, fn ) {
+ return this.each(function(){
+ jQuery.event.trigger( type, data, this, true, fn );
+ });
+ },
+
+ triggerHandler: function( type, data, fn ) {
+ return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );
+ },
+
+ toggle: function( fn ) {
+ // Save reference to arguments for access in closure
+ var args = arguments, i = 1;
+
+ // link all the functions, so any of them can unbind this click handler
+ while( i < args.length )
+ jQuery.event.proxy( fn, args[i++] );
+
+ return this.click( jQuery.event.proxy( fn, function(event) {
+ // Figure out which function to execute
+ this.lastToggle = ( this.lastToggle || 0 ) % i;
+
+ // Make sure that clicks stop
+ event.preventDefault();
+
+ // and execute the function
+ return args[ this.lastToggle++ ].apply( this, arguments ) || false;
+ }));
+ },
+
+ hover: function(fnOver, fnOut) {
+ return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
+ },
+
+ ready: function(fn) {
+ // Attach the listeners
+ bindReady();
+
+ // If the DOM is already ready
+ if ( jQuery.isReady )
+ // Execute the function immediately
+ fn.call( document, jQuery );
+
+ // Otherwise, remember the function for later
+ else
+ // Add the function to the wait list
+ jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
+
+ return this;
+ }
+});
+
+jQuery.extend({
+ isReady: false,
+ readyList: [],
+ // Handle when the DOM is ready
+ ready: function() {
+ // Make sure that the DOM is not already loaded
+ if ( !jQuery.isReady ) {
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If there are functions bound, to execute
+ if ( jQuery.readyList ) {
+ // Execute all of them
+ jQuery.each( jQuery.readyList, function(){
+ this.call( document );
+ });
+
+ // Reset the list of functions
+ jQuery.readyList = null;
+ }
+
+ // Trigger any bound ready events
+ jQuery(document).triggerHandler("ready");
+ }
+ }
+});
+
+var readyBound = false;
+
+function bindReady(){
+ if ( readyBound ) return;
+ readyBound = true;
+
+ // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
+ if ( document.addEventListener && !jQuery.browser.opera)
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
+
+ // If IE is used and is not in a frame
+ // Continually check to see if the document is ready
+ if ( jQuery.browser.msie && window == top ) (function(){
+ if (jQuery.isReady) return;
+ try {
+ // If IE is used, use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ document.documentElement.doScroll("left");
+ } catch( error ) {
+ setTimeout( arguments.callee, 0 );
+ return;
+ }
+ // and execute any waiting functions
+ jQuery.ready();
+ })();
+
+ if ( jQuery.browser.opera )
+ document.addEventListener( "DOMContentLoaded", function () {
+ if (jQuery.isReady) return;
+ for (var i = 0; i < document.styleSheets.length; i++)
+ if (document.styleSheets[i].disabled) {
+ setTimeout( arguments.callee, 0 );
+ return;
+ }
+ // and execute any waiting functions
+ jQuery.ready();
+ }, false);
+
+ if ( jQuery.browser.safari ) {
+ var numStyles;
+ (function(){
+ if (jQuery.isReady) return;
+ if ( document.readyState != "loaded" && document.readyState != "complete" ) {
+ setTimeout( arguments.callee, 0 );
+ return;
+ }
+ if ( numStyles === undefined )
+ numStyles = jQuery("style, link[rel=stylesheet]").length;
+ if ( document.styleSheets.length != numStyles ) {
+ setTimeout( arguments.callee, 0 );
+ return;
+ }
+ // and execute any waiting functions
+ jQuery.ready();
+ })();
+ }
+
+ // A fallback to window.onload, that will always work
+ jQuery.event.add( window, "load", jQuery.ready );
+}
+
+jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
+ "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
+ "submit,keydown,keypress,keyup,error").split(","), function(i, name){
+
+ // Handle event binding
+ jQuery.fn[name] = function(fn){
+ return fn ? this.bind(name, fn) : this.trigger(name);
+ };
+});
+
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function(event, elem) {
+ // Check if mouse(over|out) are still within the same parent element
+ var parent = event.relatedTarget;
+ // Traverse up the tree
+ while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
+ // Return true if we actually just moused on to a sub-element
+ return parent == elem;
+};
+
+// Prevent memory leaks in IE
+// And prevent errors on refresh with events like mouseover in other browsers
+// Window isn't included so as not to unbind existing unload events
+jQuery(window).bind("unload", function() {
+ jQuery("*").add(document).unbind();
+});
+jQuery.fn.extend({
+ // Keep a copy of the old load
+ _load: jQuery.fn.load,
+
+ load: function( url, params, callback ) {
+ if ( typeof url != 'string' )
+ return this._load( url );
+
+ var off = url.indexOf(" ");
+ if ( off >= 0 ) {
+ var selector = url.slice(off, url.length);
+ url = url.slice(0, off);
+ }
+
+ callback = callback || function(){};
+
+ // Default to a GET request
+ var type = "GET";
+
+ // If the second parameter was provided
+ if ( params )
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+ // We assume that it's the callback
+ callback = params;
+ params = null;
+
+ // Otherwise, build a param string
+ } else {
+ params = jQuery.param( params );
+ type = "POST";
+ }
+
+ var self = this;
+
+ // Request the remote document
+ jQuery.ajax({
+ url: url,
+ type: type,
+ dataType: "html",
+ data: params,
+ complete: function(res, status){
+ // If successful, inject the HTML into all the matched elements
+ if ( status == "success" || status == "notmodified" )
+ // See if a selector was specified
+ self.html( selector ?
+ // Create a dummy div to hold the results
+ jQuery("<div/>")
+ // inject the contents of the document in, removing the scripts
+ // to avoid any 'Permission Denied' errors in IE
+ .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
+
+ // Locate the specified elements
+ .find(selector) :
+
+ // If not, just inject the full result
+ res.responseText );
+
+ self.each( callback, [res.responseText, status, res] );
+ }
+ });
+ return this;
+ },
+
+ serialize: function() {
+ return jQuery.param(this.serializeArray());
+ },
+ serializeArray: function() {
+ return this.map(function(){
+ return jQuery.nodeName(this, "form") ?
+ jQuery.makeArray(this.elements) : this;
+ })
+ .filter(function(){
+ return this.name && !this.disabled &&
+ (this.checked || /select|textarea/i.test(this.nodeName) ||
+ /text|hidden|password/i.test(this.type));
+ })
+ .map(function(i, elem){
+ var val = jQuery(this).val();
+ return val == null ? null :
+ val.constructor == Array ?
+ jQuery.map( val, function(val, i){
+ return {name: elem.name, value: val};
+ }) :
+ {name: elem.name, value: val};
+ }).get();
+ }
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
+ jQuery.fn[o] = function(f){
+ return this.bind(o, f);
+ };
+});
+
+var jsc = now();
+
+jQuery.extend({
+ get: function( url, data, callback, type ) {
+ // shift arguments if data argument was ommited
+ if ( jQuery.isFunction( data ) ) {
+ callback = data;
+ data = null;
+ }
+
+ return jQuery.ajax({
+ type: "GET",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get(url, null, callback, "script");
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get(url, data, callback, "json");
+ },
+
+ post: function( url, data, callback, type ) {
+ if ( jQuery.isFunction( data ) ) {
+ callback = data;
+ data = {};
+ }
+
+ return jQuery.ajax({
+ type: "POST",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ ajaxSetup: function( settings ) {
+ jQuery.extend( jQuery.ajaxSettings, settings );
+ },
+
+ ajaxSettings: {
+ url: location.href,
+ global: true,
+ type: "GET",
+ timeout: 0,
+ contentType: "application/x-www-form-urlencoded",
+ processData: true,
+ async: true,
+ data: null,
+ username: null,
+ password: null,
+ accepts: {
+ xml: "application/xml, text/xml",
+ html: "text/html",
+ script: "text/javascript, application/javascript",
+ json: "application/json, text/javascript",
+ text: "text/plain",
+ _default: "*/*"
+ }
+ },
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+
+ ajax: function( s ) {
+ // Extend the settings, but re-extend 's' so that it can be
+ // checked again later (in the test suite, specifically)
+ s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
+
+ var jsonp, jsre = /=\?(&|$)/g, status, data,
+ type = s.type.toUpperCase();
+
+ // convert data if not already a string
+ if ( s.data && s.processData && typeof s.data != "string" )
+ s.data = jQuery.param(s.data);
+
+ // Handle JSONP Parameter Callbacks
+ if ( s.dataType == "jsonp" ) {
+ if ( type == "GET" ) {
+ if ( !s.url.match(jsre) )
+ s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
+ } else if ( !s.data || !s.data.match(jsre) )
+ s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
+ s.dataType = "json";
+ }
+
+ // Build temporary JSONP function
+ if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
+ jsonp = "jsonp" + jsc++;
+
+ // Replace the =? sequence both in the query string and the data
+ if ( s.data )
+ s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
+ s.url = s.url.replace(jsre, "=" + jsonp + "$1");
+
+ // We need to make sure
+ // that a JSONP style response is executed properly
+ s.dataType = "script";
+
+ // Handle JSONP-style loading
+ window[ jsonp ] = function(tmp){
+ data = tmp;
+ success();
+ complete();
+ // Garbage collect
+ window[ jsonp ] = undefined;
+ try{ delete window[ jsonp ]; } catch(e){}
+ if ( head )
+ head.removeChild( script );
+ };
+ }
+
+ if ( s.dataType == "script" && s.cache == null )
+ s.cache = false;
+
+ if ( s.cache === false && type == "GET" ) {
+ var ts = now();
+ // try replacing _= if it is there
+ var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
+ // if nothing was replaced, add timestamp to the end
+ s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
+ }
+
+ // If data is available, append data to url for get requests
+ if ( s.data && type == "GET" ) {
+ s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
+
+ // IE likes to send both get and post data, prevent this
+ s.data = null;
+ }
+
+ // Watch for a new set of requests
+ if ( s.global && ! jQuery.active++ )
+ jQuery.event.trigger( "ajaxStart" );
+
+ // Matches an absolute URL, and saves the domain
+ var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
+
+ // If we're requesting a remote document
+ // and trying to load JSON or Script with a GET
+ if ( s.dataType == "script" && type == "GET"
+ && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
+ var head = document.getElementsByTagName("head")[0];
+ var script = document.createElement("script");
+ script.src = s.url;
+ if (s.scriptCharset)
+ script.charset = s.scriptCharset;
+
+ // Handle Script loading
+ if ( !jsonp ) {
+ var done = false;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function(){
+ if ( !done && (!this.readyState ||
+ this.readyState == "loaded" || this.readyState == "complete") ) {
+ done = true;
+ success();
+ complete();
+ head.removeChild( script );
+ }
+ };
+ }
+
+ head.appendChild(script);
+
+ // We handle everything using the script element injection
+ return undefined;
+ }
+
+ var requestDone = false;
+
+ // Create the request object; Microsoft failed to properly
+ // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
+ var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if( s.username )
+ xhr.open(type, s.url, s.async, s.username, s.password);
+ else
+ xhr.open(type, s.url, s.async);
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ // Set the correct header, if data is being sent
+ if ( s.data )
+ xhr.setRequestHeader("Content-Type", s.contentType);
+
+ // Set the If-Modified-Since header, if ifModified mode.
+ if ( s.ifModified )
+ xhr.setRequestHeader("If-Modified-Since",
+ jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
+
+ // Set header so the called script knows that it's an XMLHttpRequest
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+
+ // Set the Accepts header for the server, depending on the dataType
+ xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
+ s.accepts[ s.dataType ] + ", */*" :
+ s.accepts._default );
+ } catch(e){}
+
+ // Allow custom headers/mimetypes
+ if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
+ // cleanup active request counter
+ s.global && jQuery.active--;
+ // close opended socket
+ xhr.abort();
+ return false;
+ }
+
+ if ( s.global )
+ jQuery.event.trigger("ajaxSend", [xhr, s]);
+
+ // Wait for a response to come back
+ var onreadystatechange = function(isTimeout){
+ // The transfer is complete and the data is available, or the request timed out
+ if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
+ requestDone = true;
+
+ // clear poll interval
+ if (ival) {
+ clearInterval(ival);
+ ival = null;
+ }
+
+ status = isTimeout == "timeout" && "timeout" ||
+ !jQuery.httpSuccess( xhr ) && "error" ||
+ s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" ||
+ "success";
+
+ if ( status == "success" ) {
+ // Watch for, and catch, XML document parse errors
+ try {
+ // process the data (runs the xml through httpData regardless of callback)
+ data = jQuery.httpData( xhr, s.dataType, s.dataFilter );
+ } catch(e) {
+ status = "parsererror";
+ }
+ }
+
+ // Make sure that the request was successful or notmodified
+ if ( status == "success" ) {
+ // Cache Last-Modified header, if ifModified mode.
+ var modRes;
+ try {
+ modRes = xhr.getResponseHeader("Last-Modified");
+ } catch(e) {} // swallow exception thrown by FF if header is not available
+
+ if ( s.ifModified && modRes )
+ jQuery.lastModified[s.url] = modRes;
+
+ // JSONP handles its own success callback
+ if ( !jsonp )
+ success();
+ } else
+ jQuery.handleError(s, xhr, status);
+
+ // Fire the complete handlers
+ complete();
+
+ // Stop memory leaks
+ if ( s.async )
+ xhr = null;
+ }
+ };
+
+ if ( s.async ) {
+ // don't attach the handler to the request, just poll it instead
+ var ival = setInterval(onreadystatechange, 13);
+
+ // Timeout checker
+ if ( s.timeout > 0 )
+ setTimeout(function(){
+ // Check to see if the request is still happening
+ if ( xhr ) {
+ // Cancel the request
+ xhr.abort();
+
+ if( !requestDone )
+ onreadystatechange( "timeout" );
+ }
+ }, s.timeout);
+ }
+
+ // Send the data
+ try {
+ xhr.send(s.data);
+ } catch(e) {
+ jQuery.handleError(s, xhr, null, e);
+ }
+
+ // firefox 1.5 doesn't fire statechange for sync requests
+ if ( !s.async )
+ onreadystatechange();
+
+ function success(){
+ // If a local callback was specified, fire it and pass it the data
+ if ( s.success )
+ s.success( data, status );
+
+ // Fire the global callback
+ if ( s.global )
+ jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
+ }
+
+ function complete(){
+ // Process result
+ if ( s.complete )
+ s.complete(xhr, status);
+
+ // The request was completed
+ if ( s.global )
+ jQuery.event.trigger( "ajaxComplete", [xhr, s] );
+
+ // Handle the global AJAX counter
+ if ( s.global && ! --jQuery.active )
+ jQuery.event.trigger( "ajaxStop" );
+ }
+
+ // return XMLHttpRequest to allow aborting the request etc.
+ return xhr;
+ },
+
+ handleError: function( s, xhr, status, e ) {
+ // If a local callback was specified, fire it
+ if ( s.error ) s.error( xhr, status, e );
+
+ // Fire the global callback
+ if ( s.global )
+ jQuery.event.trigger( "ajaxError", [xhr, s, e] );
+ },
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Determines if an XMLHttpRequest was successful or not
+ httpSuccess: function( xhr ) {
+ try {
+ // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
+ return !xhr.status && location.protocol == "file:" ||
+ ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 ||
+ jQuery.browser.safari && xhr.status == undefined;
+ } catch(e){}
+ return false;
+ },
+
+ // Determines if an XMLHttpRequest returns NotModified
+ httpNotModified: function( xhr, url ) {
+ try {
+ var xhrRes = xhr.getResponseHeader("Last-Modified");
+
+ // Firefox always returns 200. check Last-Modified date
+ return xhr.status == 304 || xhrRes == jQuery.lastModified[url] ||
+ jQuery.browser.safari && xhr.status == undefined;
+ } catch(e){}
+ return false;
+ },
+
+ httpData: function( xhr, type, filter ) {
+ var ct = xhr.getResponseHeader("content-type"),
+ xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
+ data = xml ? xhr.responseXML : xhr.responseText;
+
+ if ( xml && data.documentElement.tagName == "parsererror" )
+ throw "parsererror";
+
+ // Allow a pre-filtering function to sanitize the response
+ if( filter )
+ data = filter( data, type );
+
+ // If the type is "script", eval it in global context
+ if ( type == "script" )
+ jQuery.globalEval( data );
+
+ // Get the JavaScript object, if JSON is used.
+ if ( type == "json" )
+ data = eval("(" + data + ")");
+
+ return data;
+ },
+
+ // Serialize an array of form elements or a set of
+ // key/values into a query string
+ param: function( a ) {
+ var s = [];
+
+ // If an array was passed in, assume that it is an array
+ // of form elements
+ if ( a.constructor == Array || a.jquery )
+ // Serialize the form elements
+ jQuery.each( a, function(){
+ s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
+ });
+
+ // Otherwise, assume that it's an object of key/value pairs
+ else
+ // Serialize the key/values
+ for ( var j in a )
+ // If the value is an array then the key names need to be repeated
+ if ( a[j] && a[j].constructor == Array )
+ jQuery.each( a[j], function(){
+ s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
+ });
+ else
+ s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );
+
+ // Return the resulting serialization
+ return s.join("&").replace(/%20/g, "+");
+ }
+
+});
+jQuery.fn.extend({
+ show: function(speed,callback){
+ return speed ?
+ this.animate({
+ height: "show", width: "show", opacity: "show"
+ }, speed, callback) :
+
+ this.filter(":hidden").each(function(){
+ this.style.display = this.oldblock || "";
+ if ( jQuery.css(this,"display") == "none" ) {
+ var elem = jQuery("<" + this.tagName + " />").appendTo("body");
+ this.style.display = elem.css("display");
+ // handle an edge condition where css is - div { display:none; } or similar
+ if (this.style.display == "none")
+ this.style.display = "block";
+ elem.remove();
+ }
+ }).end();
+ },
+
+ hide: function(speed,callback){
+ return speed ?
+ this.animate({
+ height: "hide", width: "hide", opacity: "hide"
+ }, speed, callback) :
+
+ this.filter(":visible").each(function(){
+ this.oldblock = this.oldblock || jQuery.css(this,"display");
+ this.style.display = "none";
+ }).end();
+ },
+
+ // Save the old toggle function
+ _toggle: jQuery.fn.toggle,
+
+ toggle: function( fn, fn2 ){
+ return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
+ this._toggle.apply( this, arguments ) :
+ fn ?
+ this.animate({
+ height: "toggle", width: "toggle", opacity: "toggle"
+ }, fn, fn2) :
+ this.each(function(){
+ jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
+ });
+ },
+
+ slideDown: function(speed,callback){
+ return this.animate({height: "show"}, speed, callback);
+ },
+
+ slideUp: function(speed,callback){
+ return this.animate({height: "hide"}, speed, callback);
+ },
+
+ slideToggle: function(speed, callback){
+ return this.animate({height: "toggle"}, speed, callback);
+ },
+
+ fadeIn: function(speed, callback){
+ return this.animate({opacity: "show"}, speed, callback);
+ },
+
+ fadeOut: function(speed, callback){
+ return this.animate({opacity: "hide"}, speed, callback);
+ },
+
+ fadeTo: function(speed,to,callback){
+ return this.animate({opacity: to}, speed, callback);
+ },
+
+ animate: function( prop, speed, easing, callback ) {
+ var optall = jQuery.speed(speed, easing, callback);
+
+ return this[ optall.queue === false ? "each" : "queue" ](function(){
+ if ( this.nodeType != 1)
+ return false;
+
+ var opt = jQuery.extend({}, optall), p,
+ hidden = jQuery(this).is(":hidden"), self = this;
+
+ for ( p in prop ) {
+ if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
+ return opt.complete.call(this);
+
+ if ( p == "height" || p == "width" ) {
+ // Store display property
+ opt.display = jQuery.css(this, "display");
+
+ // Make sure that nothing sneaks out
+ opt.overflow = this.style.overflow;
+ }
+ }
+
+ if ( opt.overflow != null )
+ this.style.overflow = "hidden";
+
+ opt.curAnim = jQuery.extend({}, prop);
+
+ jQuery.each( prop, function(name, val){
+ var e = new jQuery.fx( self, opt, name );
+
+ if ( /toggle|show|hide/.test(val) )
+ e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
+ else {
+ var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
+ start = e.cur(true) || 0;
+
+ if ( parts ) {
+ var end = parseFloat(parts[2]),
+ unit = parts[3] || "px";
+
+ // We need to compute starting value
+ if ( unit != "px" ) {
+ self.style[ name ] = (end || 1) + unit;
+ start = ((end || 1) / e.cur(true)) * start;
+ self.style[ name ] = start + unit;
+ }
+
+ // If a +=/-= token was provided, we're doing a relative animation
+ if ( parts[1] )
+ end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
+
+ e.custom( start, end, unit );
+ } else
+ e.custom( start, val, "" );
+ }
+ });
+
+ // For JS strict compliance
+ return true;
+ });
+ },
+
+ queue: function(type, fn){
+ if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
+ fn = type;
+ type = "fx";
+ }
+
+ if ( !type || (typeof type == "string" && !fn) )
+ return queue( this[0], type );
+
+ return this.each(function(){
+ if ( fn.constructor == Array )
+ queue(this, type, fn);
+ else {
+ queue(this, type).push( fn );
+
+ if ( queue(this, type).length == 1 )
+ fn.call(this);
+ }
+ });
+ },
+
+ stop: function(clearQueue, gotoEnd){
+ var timers = jQuery.timers;
+
+ if (clearQueue)
+ this.queue([]);
+
+ this.each(function(){
+ // go in reverse order so anything added to the queue during the loop is ignored
+ for ( var i = timers.length - 1; i >= 0; i-- )
+ if ( timers[i].elem == this ) {
+ if (gotoEnd)
+ // force the next step to be the last
+ timers[i](true);
+ timers.splice(i, 1);
+ }
+ });
+
+ // start the next in the queue if the last step wasn't forced
+ if (!gotoEnd)
+ this.dequeue();
+
+ return this;
+ }
+
+});
+
+var queue = function( elem, type, array ) {
+ if ( elem ){
+
+ type = type || "fx";
+
+ var q = jQuery.data( elem, type + "queue" );
+
+ if ( !q || array )
+ q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
+
+ }
+ return q;
+};
+
+jQuery.fn.dequeue = function(type){
+ type = type || "fx";
+
+ return this.each(function(){
+ var q = queue(this, type);
+
+ q.shift();
+
+ if ( q.length )
+ q[0].call( this );
+ });
+};
+
+jQuery.extend({
+
+ speed: function(speed, easing, fn) {
+ var opt = speed && speed.constructor == Object ? speed : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && easing.constructor != Function && easing
+ };
+
+ opt.duration = (opt.duration && opt.duration.constructor == Number ?
+ opt.duration :
+ jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
+
+ // Queueing
+ opt.old = opt.complete;
+ opt.complete = function(){
+ if ( opt.queue !== false )
+ jQuery(this).dequeue();
+ if ( jQuery.isFunction( opt.old ) )
+ opt.old.call( this );
+ };
+
+ return opt;
+ },
+
+ easing: {
+ linear: function( p, n, firstNum, diff ) {
+ return firstNum + diff * p;
+ },
+ swing: function( p, n, firstNum, diff ) {
+ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
+ }
+ },
+
+ timers: [],
+ timerId: null,
+
+ fx: function( elem, options, prop ){
+ this.options = options;
+ this.elem = elem;
+ this.prop = prop;
+
+ if ( !options.orig )
+ options.orig = {};
+ }
+
+});
+
+jQuery.fx.prototype = {
+
+ // Simple function for setting a style value
+ update: function(){
+ if ( this.options.step )
+ this.options.step.call( this.elem, this.now, this );
+
+ (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
+
+ // Set display property to block for height/width animations
+ if ( this.prop == "height" || this.prop == "width" )
+ this.elem.style.display = "block";
+ },
+
+ // Get the current size
+ cur: function(force){
+ if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
+ return this.elem[ this.prop ];
+
+ var r = parseFloat(jQuery.css(this.elem, this.prop, force));
+ return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
+ },
+
+ // Start an animation from one number to another
+ custom: function(from, to, unit){
+ this.startTime = now();
+ this.start = from;
+ this.end = to;
+ this.unit = unit || this.unit || "px";
+ this.now = this.start;
+ this.pos = this.state = 0;
+ this.update();
+
+ var self = this;
+ function t(gotoEnd){
+ return self.step(gotoEnd);
+ }
+
+ t.elem = this.elem;
+
+ jQuery.timers.push(t);
+
+ if ( jQuery.timerId == null ) {
+ jQuery.timerId = setInterval(function(){
+ var timers = jQuery.timers;
+
+ for ( var i = 0; i < timers.length; i++ )
+ if ( !timers[i]() )
+ timers.splice(i--, 1);
+
+ if ( !timers.length ) {
+ clearInterval( jQuery.timerId );
+ jQuery.timerId = null;
+ }
+ }, 13);
+ }
+ },
+
+ // Simple 'show' function
+ show: function(){
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+ this.options.show = true;
+
+ // Begin the animation
+ this.custom(0, this.cur());
+
+ // Make sure that we start at a small width/height to avoid any
+ // flash of content
+ if ( this.prop == "width" || this.prop == "height" )
+ this.elem.style[this.prop] = "1px";
+
+ // Start by showing the element
+ jQuery(this.elem).show();
+ },
+
+ // Simple 'hide' function
+ hide: function(){
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
+ this.options.hide = true;
+
+ // Begin the animation
+ this.custom(this.cur(), 0);
+ },
+
+ // Each step of an animation
+ step: function(gotoEnd){
+ var t = now();
+
+ if ( gotoEnd || t > this.options.duration + this.startTime ) {
+ this.now = this.end;
+ this.pos = this.state = 1;
+ this.update();
+
+ this.options.curAnim[ this.prop ] = true;
+
+ var done = true;
+ for ( var i in this.options.curAnim )
+ if ( this.options.curAnim[i] !== true )
+ done = false;
+
+ if ( done ) {
+ if ( this.options.display != null ) {
+ // Reset the overflow
+ this.elem.style.overflow = this.options.overflow;
+
+ // Reset the display
+ this.elem.style.display = this.options.display;
+ if ( jQuery.css(this.elem, "display") == "none" )
+ this.elem.style.display = "block";
+ }
+
+ // Hide the element if the "hide" operation was done
+ if ( this.options.hide )
+ this.elem.style.display = "none";
+
+ // Reset the properties, if the item has been hidden or shown
+ if ( this.options.hide || this.options.show )
+ for ( var p in this.options.curAnim )
+ jQuery.attr(this.elem.style, p, this.options.orig[p]);
+ }
+
+ if ( done )
+ // Execute the complete function
+ this.options.complete.call( this.elem );
+
+ return false;
+ } else {
+ var n = t - this.startTime;
+ this.state = n / this.options.duration;
+
+ // Perform the easing function, defaults to swing
+ this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
+ this.now = this.start + ((this.end - this.start) * this.pos);
+
+ // Perform the next step of the animation
+ this.update();
+ }
+
+ return true;
+ }
+
+};
+
+jQuery.extend( jQuery.fx, {
+ speeds:{
+ slow: 600,
+ fast: 200,
+ // Default speed
+ def: 400
+ },
+ step: {
+ scrollLeft: function(fx){
+ fx.elem.scrollLeft = fx.now;
+ },
+
+ scrollTop: function(fx){
+ fx.elem.scrollTop = fx.now;
+ },
+
+ opacity: function(fx){
+ jQuery.attr(fx.elem.style, "opacity", fx.now);
+ },
+
+ _default: function(fx){
+ fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+ }
+ }
+});
+// The Offset Method
+// Originally By Brandon Aaron, part of the Dimension Plugin
+// http://jquery.com/plugins/project/dimensions
+jQuery.fn.offset = function() {
+ var left = 0, top = 0, elem = this[0], results;
+
+ if ( elem ) with ( jQuery.browser ) {
+ var parent = elem.parentNode,
+ offsetChild = elem,
+ offsetParent = elem.offsetParent,
+ doc = elem.ownerDocument,
+ safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
+ css = jQuery.curCSS,
+ fixed = css(elem, "position") == "fixed";
+
+ // Use getBoundingClientRect if available
+ if ( elem.getBoundingClientRect ) {
+ var box = elem.getBoundingClientRect();
+
+ // Add the document scroll offsets
+ add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
+ box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
+
+ // IE adds the HTML element's border, by default it is medium which is 2px
+ // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
+ // IE 7 standards mode, the border is always 2px
+ // This border/offset is typically represented by the clientLeft and clientTop properties
+ // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
+ // Therefore this method will be off by 2px in IE while in quirksmode
+ add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
+
+ // Otherwise loop through the offsetParents and parentNodes
+ } else {
+
+ // Initial element offsets
+ add( elem.offsetLeft, elem.offsetTop );
+
+ // Get parent offsets
+ while ( offsetParent ) {
+ // Add offsetParent offsets
+ add( offsetParent.offsetLeft, offsetParent.offsetTop );
+
+ // Mozilla and Safari > 2 does not include the border on offset parents
+ // However Mozilla adds the border for table or table cells
+ if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
+ border( offsetParent );
+
+ // Add the document scroll offsets if position is fixed on any offsetParent
+ if ( !fixed && css(offsetParent, "position") == "fixed" )
+ fixed = true;
+
+ // Set offsetChild to previous offsetParent unless it is the body element
+ offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
+ // Get next offsetParent
+ offsetParent = offsetParent.offsetParent;
+ }
+
+ // Get parent scroll offsets
+ while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
+ // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
+ if ( !/^inline|table.*$/i.test(css(parent, "display")) )
+ // Subtract parent scroll offsets
+ add( -parent.scrollLeft, -parent.scrollTop );
+
+ // Mozilla does not add the border for a parent that has overflow != visible
+ if ( mozilla && css(parent, "overflow") != "visible" )
+ border( parent );
+
+ // Get next parent
+ parent = parent.parentNode;
+ }
+
+ // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
+ // Mozilla doubles body offsets with a non-absolutely positioned offsetChild
+ if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||
+ (mozilla && css(offsetChild, "position") != "absolute") )
+ add( -doc.body.offsetLeft, -doc.body.offsetTop );
+
+ // Add the document scroll offsets if position is fixed
+ if ( fixed )
+ add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
+ Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
+ }
+
+ // Return an object with top and left properties
+ results = { top: top, left: left };
+ }
+
+ function border(elem) {
+ add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
+ }
+
+ function add(l, t) {
+ left += parseInt(l, 10) || 0;
+ top += parseInt(t, 10) || 0;
+ }
+
+ return results;
+};
+
+
+jQuery.fn.extend({
+ position: function() {
+ var left = 0, top = 0, results;
+
+ if ( this[0] ) {
+ // Get *real* offsetParent
+ var offsetParent = this.offsetParent(),
+
+ // Get correct offsets
+ offset = this.offset(),
+ parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
+
+ // Subtract element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ offset.top -= num( this, 'marginTop' );
+ offset.left -= num( this, 'marginLeft' );
+
+ // Add offsetParent borders
+ parentOffset.top += num( offsetParent, 'borderTopWidth' );
+ parentOffset.left += num( offsetParent, 'borderLeftWidth' );
+
+ // Subtract the two offsets
+ results = {
+ top: offset.top - parentOffset.top,
+ left: offset.left - parentOffset.left
+ };
+ }
+
+ return results;
+ },
+
+ offsetParent: function() {
+ var offsetParent = this[0].offsetParent;
+ while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
+ offsetParent = offsetParent.offsetParent;
+ return jQuery(offsetParent);
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( ['Left', 'Top'], function(i, name) {
+ var method = 'scroll' + name;
+
+ jQuery.fn[ method ] = function(val) {
+ if (!this[0]) return;
+
+ return val != undefined ?
+
+ // Set the scroll offset
+ this.each(function() {
+ this == window || this == document ?
+ window.scrollTo(
+ !i ? val : jQuery(window).scrollLeft(),
+ i ? val : jQuery(window).scrollTop()
+ ) :
+ this[ method ] = val;
+ }) :
+
+ // Return the scroll offset
+ this[0] == window || this[0] == document ?
+ self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
+ jQuery.boxModel && document.documentElement[ method ] ||
+ document.body[ method ] :
+ this[0][ method ];
+ };
+});
+// Create innerHeight, innerWidth, outerHeight and outerWidth methods
+jQuery.each([ "Height", "Width" ], function(i, name){
+
+ var tl = i ? "Left" : "Top", // top or left
+ br = i ? "Right" : "Bottom"; // bottom or right
+
+ // innerHeight and innerWidth
+ jQuery.fn["inner" + name] = function(){
+ return this[ name.toLowerCase() ]() +
+ num(this, "padding" + tl) +
+ num(this, "padding" + br);
+ };
+
+ // outerHeight and outerWidth
+ jQuery.fn["outer" + name] = function(margin) {
+ return this["inner" + name]() +
+ num(this, "border" + tl + "Width") +
+ num(this, "border" + br + "Width") +
+ (margin ?
+ num(this, "margin" + tl) + num(this, "margin" + br) : 0);
+ };
+
+});})();
diff --git a/simple-jquery-form-validation.zip b/simple-jquery-form-validation.zip
new file mode 100755
index 0000000..35f8673
Binary files /dev/null and b/simple-jquery-form-validation.zip differ
diff --git a/styles.css b/styles.css
new file mode 100755
index 0000000..99fcd5c
--- /dev/null
+++ b/styles.css
@@ -0,0 +1,5 @@
+label {display:block;margin:2px;}
+.form {padding:0px;margin:0px;background-color:#EDECDC;}
+.form li {width:390px;margin:3px;padding:5px 5px 5px 30px;list-style:none;position:relative;}
+*html .form li {left:-15px;}
+.form .error {border:1px solid #A90000;padding:4px;background-color:#F8E5E5; font-size:12px;}
diff --git a/validator.js b/validator.js
new file mode 100755
index 0000000..120e924
--- /dev/null
+++ b/validator.js
@@ -0,0 +1,86 @@
+(function($) {
+
+ $.fn.validate = function(args) {
+
+ /* Load the default options. */
+ var options = $.extend({}, $.fn.validate.defaults, args);
+ var jQ = jQuery;
+ return this.each(function() {
+ /***** Plugin Goes Here *********/
+ jQ(this).submit(function(){
+ jQ(this).find(".error").remove();
+ var valid=true;
+
+ jQ(this).find(".validate").each(function(){
+ el = jQ(this);
+ if(el.hasClass("valid-email")) {
+ if(!valid_email(el.val())) {
+ add_error(el, options.email_error_message);
+ valid=false;
+ }
+ }
+ if(el.hasClass("valid-date")) {
+ if(!valid_date(el.val(), options.date_format)) {
+ add_error(el, options.date_error_message);
+ valid=false;
+ }
+ }
+ if(el.hasClass("valid-required")) {
+ if(!valid_required(el.val())) {
+ add_error(el, options.required_error_message);
+ valid=false;
+ }
+ }
+ if(el.hasClass("valid-number")) {
+ if(!valid_number(el.val())) {
+ add_error(el, options.number_error_message);
+ valid=false;
+ }
+ }
+ });
+ return valid;
+ });
+
+ });
+
+ };
+
+ function add_error(el, message) {
+ el.after("<span class='error'>"+message+"</span>");
+ }
+
+ function valid_email(email) {
+ var email_pattern = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
+ if(email.match(email_pattern)) return true;
+ return false;
+ };
+
+ function valid_number(number) {
+ var number_pattern = /^([0-9\s])+$/;
+ if(number.match(number_pattern)) return true;
+ return false;
+ };
+
+ function valid_required(val) {
+ if(val.length>0) return true;
+ return false;
+ }
+
+ function valid_date(date_passed, date_format) {
+ if(date_format == "mm/dd/yyyy") var date_pattern = /(0[1-9]|1[012])+\/(0[1-9]|[12][0-9]|3[01])+\/(19|20)\d\d/;
+ if(date_format == "dd/mm/yyyy") var date_pattern = /(0[1-9]|[12][0-9]|3[01])+\/(0[1-9]|1[012])+\/(19|20)\d\d/;
+ if(date_passed.match(date_pattern)) return true;
+ return false;
+ };
+
+ $.fn.validate.defaults = {
+ email_error_message: 'not a valid email address',
+ text_error_message: 'must be text only',
+ number_error_message: 'not a valid number',
+ date_error_message: 'not a valid date',
+ required_error_message: 'is a required field',
+ date_format: "dd/mm/yyyy"
+ };
+
+})(jQuery);
+
|
p3lim-wow/Devak
|
be2a3a8b97a8f6a327354b6bd1487851cbc39abf
|
AddonLoader greatness
|
diff --git a/Devak.lua b/Devak.lua
index 9c3530b..32d5161 100644
--- a/Devak.lua
+++ b/Devak.lua
@@ -1,78 +1,82 @@
--[[
Copyright (c) 2010 Adrian L Lange <adrianlund@gmail.com>
All rights reserved.
You're allowed to use this addon, free of monetary charge,
but you are not allowed to modify, alter, or redistribute
this addon without express, written permission of the author.
--]]
if(select(2, UnitClass('player')) ~= 'SHAMAN') then return end
+local NAME = ...
local buttons = {}
local coords = {
{68/128, 96/128, 102/256, 128/256},
{67/128, 95/128, 5/256, 31/256},
{40/128, 68/128, 211/256, 237/256},
{67/128, 95/128, 38/256, 64/256},
}
local function OnClick(self, button)
if(button == 'RightButton') then
DestroyTotem(self.id)
end
end
local function OnUpdate(slot)
local button = buttons[slot]
local exists, _, start, duration = GetTotemInfo(slot)
if(exists and duration > 0) then
button.swirly:SetCooldown(start, duration)
button:Show()
else
button:Hide()
end
end
for index = 1, 4 do
local button = CreateFrame('Button', nil, UIParent)
button:SetHeight(23)
button:SetWidth(23)
button:SetNormalTexture([=[Interface\Buttons\UI-TotemBar]=])
button:GetNormalTexture():SetTexCoord(unpack(coords[index]))
button:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {left = -1, right = -1, top = -1, bottom = -1}})
button:SetBackdropColor(0, 0, 0)
button:RegisterForClicks('RightButtonUp')
button:SetScript('OnClick', OnClick)
button.id = index
if(index == 1) then
button:SetPoint('TOPLEFT', Minimap, 'BOTTOMLEFT', -1, -8)
else
button:SetPoint('TOPLEFT', buttons[index -1], 'TOPRIGHT', 11.5, 0)
end
button.swirly = CreateFrame('Cooldown', nil, button)
button.swirly:SetAllPoints(button)
button.swirly:SetReverse()
buttons[index] = button
end
local function OnEvent(self, event, ...)
if(event == 'PLAYER_TOTEM_UPDATE') then
- OnUpdate(...)
- else
- for index = 1, 4 do
- OnUpdate(index)
- end
+ return OnUpdate(...)
+ end
+
+ local name = ...
+ if(name and name ~= NAME) then return end
+
+ for index = 1, 4 do
+ OnUpdate(index)
end
end
local addon = CreateFrame('Frame')
addon:RegisterEvent('PLAYER_TOTEM_UPDATE')
-addon:RegisterEvent('PLAYER_ENTERING_WORLD')
+addon:RegisterEvent(IsAddOnLoaded('AddonLoader') and 'ADDON_LOADED' or 'PLAYER_ENTERING_WORLD')
addon:SetScript('OnEvent', OnEvent)
diff --git a/Devak.toc b/Devak.toc
index 69f9041..ade16d1 100644
--- a/Devak.toc
+++ b/Devak.toc
@@ -1,7 +1,11 @@
## Interface: 30300
## Author: p3lim
## Version: Alpha
## Title: Devak
## Notes: Simple totem management
+## LoadManagers: AddonLoader
+## X-LoadOn-Class: Shaman
+## X-LoadOn-Always: delayed
+
Devak.lua
|
p3lim-wow/Devak
|
d43b4cd7f74102ea3077416ec22d1d8a8eb6040a
|
Zone/login updates
|
diff --git a/Devak.lua b/Devak.lua
index d9917bb..9c3530b 100644
--- a/Devak.lua
+++ b/Devak.lua
@@ -1,68 +1,78 @@
--[[
Copyright (c) 2010 Adrian L Lange <adrianlund@gmail.com>
All rights reserved.
You're allowed to use this addon, free of monetary charge,
but you are not allowed to modify, alter, or redistribute
this addon without express, written permission of the author.
--]]
if(select(2, UnitClass('player')) ~= 'SHAMAN') then return end
local buttons = {}
local coords = {
{68/128, 96/128, 102/256, 128/256},
{67/128, 95/128, 5/256, 31/256},
{40/128, 68/128, 211/256, 237/256},
{67/128, 95/128, 38/256, 64/256},
}
local function OnClick(self, button)
if(button == 'RightButton') then
DestroyTotem(self.id)
end
end
-local function OnUpdate(self, event, slot)
+local function OnUpdate(slot)
local button = buttons[slot]
local exists, _, start, duration = GetTotemInfo(slot)
if(exists and duration > 0) then
button.swirly:SetCooldown(start, duration)
button:Show()
else
button:Hide()
end
end
for index = 1, 4 do
local button = CreateFrame('Button', nil, UIParent)
button:SetHeight(23)
button:SetWidth(23)
button:SetNormalTexture([=[Interface\Buttons\UI-TotemBar]=])
button:GetNormalTexture():SetTexCoord(unpack(coords[index]))
button:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], insets = {left = -1, right = -1, top = -1, bottom = -1}})
button:SetBackdropColor(0, 0, 0)
button:RegisterForClicks('RightButtonUp')
button:SetScript('OnClick', OnClick)
button.id = index
if(index == 1) then
button:SetPoint('TOPLEFT', Minimap, 'BOTTOMLEFT', -1, -8)
else
button:SetPoint('TOPLEFT', buttons[index -1], 'TOPRIGHT', 11.5, 0)
end
button.swirly = CreateFrame('Cooldown', nil, button)
button.swirly:SetAllPoints(button)
button.swirly:SetReverse()
buttons[index] = button
- OnUpdate(nil, nil, index)
+end
+
+local function OnEvent(self, event, ...)
+ if(event == 'PLAYER_TOTEM_UPDATE') then
+ OnUpdate(...)
+ else
+ for index = 1, 4 do
+ OnUpdate(index)
+ end
+ end
end
local addon = CreateFrame('Frame')
addon:RegisterEvent('PLAYER_TOTEM_UPDATE')
-addon:SetScript('OnEvent', OnUpdate)
+addon:RegisterEvent('PLAYER_ENTERING_WORLD')
+addon:SetScript('OnEvent', OnEvent)
|
comotion/edd
|
3b52ea821d4ce14ba21016c3e2cc728cfb88c16c
|
bpf filter for pcap files too, and usage() somewhere
|
diff --git a/edd.c b/edd.c
index 59ea82a..55c4a88 100644
--- a/edd.c
+++ b/edd.c
@@ -321,586 +321,590 @@ void packet_profiler (const u_char *packet, const uint32_t p_len)
* tresholds? markov chains? averaging?
*
* check this with our friend the kolmogorov
*
* Basis for this entropy: just guessing:
* Entropy(set_bits) - Entropy (unset_bits) + E(total)
*/
double simple_entropy(double set_bits, double total_bits)
{
/* oldscool
return total_bits * (( -set_bits / total_bits )*log2(set_bits/total_bits)
- (1 - (set_bits / total_bits) * log2(1 - (set_bits/total_bits))))
+ log2(total_bits);
*/
return
( -set_bits )*(log2(set_bits)-log2(total_bits))
-
( total_bits - set_bits) * ( log2 (total_bits - set_bits) - log2(total_bits) ) //log2(1 - (set_bits/total_bits))
+ log2(total_bits) ;
}
static uint32_t packet_count;
void got_packet_profile (u_char *useless,const struct pcap_pkthdr *pheader, const u_char *packet)
{
static char flag;
if ( intr_flag != 0 ) { game_over(); }
inpacket = 1;
const uint32_t p_len = ((pheader->len > SNAPLENGTH)?SNAPLENGTH:pheader->len);
packet_profiler(packet, p_len);
}
void got_packet (u_char *useless,const struct pcap_pkthdr *pheader, const u_char *packet)
{
static char flag;
if ( intr_flag != 0 ) { game_over(); }
inpacket = 1;
tstamp = time(NULL);
const uint32_t p_len = ((pheader->len > SNAPLENGTH)?SNAPLENGTH:pheader->len);
const uint32_t bits = p_len*8;
uint32_t set = count_bits_64(packet, p_len);
p_tot[head] = bits;
p_set[head] = set;
p_entropy[head] = simple_entropy(set, bits);
packet_count++;
//printf("[%lu] %lu/%lu, E(%f)\n", head, set, bits, p_entropy[head]);
if (packet_count >= p_window) {
// we have some packets for analysis
uint32_t k, total_set = 0, total_bits = 0;
double sum_entropy = 0;
for(k = 0; k < p_window; k++){
total_set += p_set[k];
total_bits+= p_tot[k];
sum_entropy += p_entropy[k];
}
double joint_entropy = simple_entropy(total_set, total_bits);
if(tresh < sum_entropy - joint_entropy ){
if (!flag)
fprintf(stderr, "ddos attack!!! Entropy(%f) < Total_Entropy(%f) over %lu bits\n",
joint_entropy, sum_entropy, total_bits);
flag = 1;
}else{
if (flag)
fprintf(stdout, "no news, Entropy(%f) >= Total_Entropy(%f) over %lu bits\n",
joint_entropy, sum_entropy, total_bits);
flag = 0;
}
}
head = (head + 1) % p_window;
ether_header *eth_hdr;
eth_hdr = (ether_header *) (packet);
u_short eth_type;
eth_type = ntohs(eth_hdr->eth_ip_type);
int eth_header_len;
eth_header_len = ETHERNET_HEADER_LEN;
/* sample code from cxtracker
u_short p_bytes;
if ( eth_type == ETHERNET_TYPE_8021Q ) {
// printf("[*] ETHERNET TYPE 8021Q\n");
eth_type = ntohs(eth_hdr->eth_8_ip_type);
eth_header_len +=4;
}
else if ( eth_type == (ETHERNET_TYPE_802Q1MT|ETHERNET_TYPE_802Q1MT2|ETHERNET_TYPE_802Q1MT3|ETHERNET_TYPE_8021AD) ) {
// printf("[*] ETHERNET TYPE 802Q1MT\n");
eth_type = ntohs(eth_hdr->eth_82_ip_type);
eth_header_len +=8;
}
if ( eth_type == ETHERNET_TYPE_IP ) {
// printf("[*] Got IPv4 Packet...\n");
ip4_header *ip4;
ip4 = (ip4_header *) (packet + eth_header_len);
p_bytes = (ip4->ip_len - (IP_HL(ip4)*4));
struct in6_addr ip_src, ip_dst;
ip_src.s6_addr32[0] = ip4->ip_src;
ip_src.s6_addr32[1] = 0;
ip_src.s6_addr32[2] = 0;
ip_src.s6_addr32[3] = 0;
ip_dst.s6_addr32[0] = ip4->ip_dst;
ip_dst.s6_addr32[1] = 0;
ip_dst.s6_addr32[2] = 0;
ip_dst.s6_addr32[3] = 0;
if ( ip4->ip_p == IP_PROTO_TCP ) {
tcp_header *tcph;
tcph = (tcp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
// printf("[*] IPv4 PROTOCOL TYPE TCP:\n");
cx_track(ip_src, tcph->src_port, ip_dst, tcph->dst_port, ip4->ip_p, p_bytes, tcph->t_flags, tstamp, AF_INET);
inpacket = 0;
return;
}
else if (ip4->ip_p == IP_PROTO_UDP) {
udp_header *udph;
udph = (udp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
// printf("[*] IPv4 PROTOCOL TYPE UDP:\n");
cx_track(ip_src, udph->src_port, ip_dst, udph->dst_port, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
inpacket = 0;
return;
}
else if (ip4->ip_p == IP_PROTO_ICMP) {
icmp_header *icmph;
icmph = (icmp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
// printf("[*] IP PROTOCOL TYPE ICMP\n");
cx_track(ip_src, icmph->s_icmp_id, ip_dst, icmph->s_icmp_id, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
inpacket = 0;
return;
}
else {
// printf("[*] IPv4 PROTOCOL TYPE OTHER: %d\n",ip4->ip_p);
cx_track(ip_src, ip4->ip_p, ip_dst, ip4->ip_p, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
inpacket = 0;
return;
}
}
else if ( eth_type == ETHERNET_TYPE_IPV6) {
// printf("[*] Got IPv6 Packet...\n");
ip6_header *ip6;
ip6 = (ip6_header *) (packet + eth_header_len);
if ( ip6->next == IP_PROTO_TCP ) {
tcp_header *tcph;
tcph = (tcp_header *) (packet + eth_header_len + IP6_HEADER_LEN);
// printf("[*] IPv6 PROTOCOL TYPE TCP:\n");
cx_track(ip6->ip_src, tcph->src_port, ip6->ip_dst, tcph->dst_port, ip6->next, ip6->len, tcph->t_flags, tstamp, AF_INET6);
inpacket = 0;
return;
}
else if (ip6->next == IP_PROTO_UDP) {
udp_header *udph;
udph = (udp_header *) (packet + eth_header_len + IP6_HEADER_LEN);
// printf("[*] IPv6 PROTOCOL TYPE UDP:\n");
cx_track(ip6->ip_src, udph->src_port, ip6->ip_dst, udph->dst_port, ip6->next, ip6->len, 0, tstamp, AF_INET6);
inpacket = 0;
return;
}
else if (ip6->next == IP6_PROTO_ICMP) {
icmp6_header *icmph;
icmph = (icmp6_header *) (packet + eth_header_len + IP6_HEADER_LEN);
// printf("[*] IPv6 PROTOCOL TYPE ICMP\n");
cx_track(ip6->ip_src, ip6->hop_lmt, ip6->ip_dst, ip6->hop_lmt, ip6->next, ip6->len, 0, tstamp, AF_INET6);
inpacket = 0;
return;
}
else {
// printf("[*] IPv6 PROTOCOL TYPE OTHER: %d\n",ip6->next);
cx_track(ip6->ip_src, ip6->next, ip6->ip_dst, ip6->next, ip6->next, ip6->len, 0, tstamp, AF_INET6);
inpacket = 0;
return;
}
}
*/
inpacket = 0;
return;
}
void test_it(){
/* test it! */
uint8_t b[18];
memset((void*) b, 1, 17);
b[17]= 0x11; // the faulty bits
printf("KnR %lu\n", count_bits(b,17));
printf("KaW %lu\n", count_bits_kw(b,17));
printf("PaP %lu\n", count_bits_pp(b,17));
printf("JaP %lu\n", count_bits_p(b,17));
printf("P64 %lu\n", count_bits_64(b,17));
printf("T 1 %lu\n", count_bits_t1(b,17));
printf("T 2 %lu\n", count_bits_t2(b,17));
printf("weirdness test: %lu %lu %lu %lu %lu %lu\n",
count_bits_pp(b,17),
count_bits_pp(b,17),
count_bits_pp(b,17),
count_bits_pp(b,17),
count_bits_pp(b,17),
count_bits_pp(b,17));
}
static void usage() {
printf("edd: Entropy DDoS Detection\n\n");
printf("USAGE:\n");
printf(" $ %s [options]\n", BIN_NAME);
printf("\n");
printf(" OPTIONS:\n");
printf("\n");
printf(" -i : network device (default: eth0)\n");
printf(" -r : read pcap file\n");
printf(" -w : packet window size (default: %u)\n", DEFAULT_WINDOW);
printf(" -b : berkeley packet filter\n");
printf(" -e : treshold value (default : %f)\n", DEFAULT_TRESH);
printf(" -u : user\n");
printf(" -g : group\n");
printf(" -D : enables daemon mode\n");
printf(" -T : dir to chroot into\n");
printf(" -h : this help message\n");
printf(" -t : profile counter algoritms\n");
printf(" -E : test edd\n");
printf(" -v : verbose\n\n");
}
static int set_chroot(void) {
char *absdir;
char *logdir;
int abslen;
/* logdir = get_abs_path(logpath); */
/* change to the directory */
if ( chdir(chroot_dir) != 0 ) {
printf("set_chroot: Can not chdir to \"%s\": %s\n",chroot_dir,strerror(errno));
}
/* always returns an absolute pathname */
absdir = getcwd(NULL, 0);
abslen = strlen(absdir);
/* make the chroot call */
if ( chroot(absdir) < 0 ) {
printf("Can not chroot to \"%s\": absolute: %s: %s\n",chroot_dir,absdir,strerror(errno));
}
if ( chdir("/") < 0 ) {
printf("Can not chdir to \"/\" after chroot: %s\n",strerror(errno));
}
return 0;
}
static int drop_privs(void) {
struct group *gr;
struct passwd *pw;
char *endptr;
int i;
int do_setuid = 0;
int do_setgid = 0;
unsigned long groupid = 0;
unsigned long userid = 0;
if ( group_name != NULL ) {
do_setgid = 1;
if( isdigit(group_name[0]) == 0 ) {
gr = getgrnam(group_name);
groupid = gr->gr_gid;
}
else {
groupid = strtoul(group_name, &endptr, 10);
}
}
if ( user_name != NULL ) {
do_setuid = 1;
do_setgid = 1;
if ( isdigit(user_name[0]) == 0 ) {
pw = getpwnam(user_name);
userid = pw->pw_uid;
} else {
userid = strtoul(user_name, &endptr, 10);
pw = getpwuid(userid);
}
if ( group_name == NULL ) {
groupid = pw->pw_gid;
}
}
if ( do_setgid ) {
if ( (i = setgid(groupid)) < 0 ) {
printf("Unable to set group ID: %s", strerror(i));
}
}
endgrent();
endpwent();
if ( do_setuid ) {
if (getuid() == 0 && initgroups(user_name, groupid) < 0 ) {
printf("Unable to init group names (%s/%lu)", user_name, groupid);
}
if ( (i = setuid(userid)) < 0 ) {
printf("Unable to set user ID: %s\n", strerror(i));
}
}
return 0;
}
static int is_valid_path(char *path) {
struct stat st;
if ( path == NULL ) {
return 0;
}
if ( stat(path, &st) != 0 ) {
return 0;
}
if ( !S_ISDIR(st.st_mode) || access(path, W_OK) == -1 ) {
return 0;
}
return 1;
}
static int create_pid_file(char *path, char *filename) {
char filepath[STDBUF];
char *fp = NULL;
char *fn = NULL;
char pid_buffer[12];
struct flock lock;
int rval;
int fd;
memset(filepath, 0, STDBUF);
if ( !filename ) {
fn = pidfile;
}
else {
fn = filename;
}
if ( !path ) {
fp = pidpath;
}
else {
fp = path;
}
if ( is_valid_path(fp) ) {
snprintf(filepath, STDBUF-1, "%s/%s", fp, fn);
}
else {
printf("PID path \"%s\" isn't a writeable directory!", fp);
}
true_pid_name = strdup(filename);
if ( (fd = open(filepath, O_CREAT | O_WRONLY,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1 ) {
return ERROR;
}
/* pid file locking */
lock.l_type = F_WRLCK;
lock.l_start = 0;
lock.l_whence = SEEK_SET;
lock.l_len = 0;
if ( fcntl(fd, F_SETLK, &lock) == -1 ) {
if ( errno == EACCES || errno == EAGAIN ) {
rval = ERROR;
}
else {
rval = ERROR;
}
close(fd);
return rval;
}
snprintf(pid_buffer, sizeof(pid_buffer), "%d\n", (int) getpid());
if ( ftruncate(fd, 0) != 0 ) { return ERROR; }
if ( write(fd, pid_buffer, strlen(pid_buffer)) != 0 ) { return ERROR; }
return SUCCESS;
}
int daemonize() {
pid_t pid;
int fd;
pid = fork();
if ( pid > 0 ) {
exit(0); /* parent */
}
use_syslog = 1;
if ( pid < 0 ) {
return ERROR;
}
/* new process group */
setsid();
/* close file handles */
if ( (fd = open("/dev/null", O_RDWR)) >= 0 ) {
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
if ( fd > 2 ) {
close(fd);
}
}
if ( pidfile ) {
return create_pid_file(pidpath, pidfile);
}
return SUCCESS;
}
int main(int argc, char *argv[]) {
int ch, fromfile, setfilter, version, drop_privs_flag, daemon_flag, chroot_flag;
int use_syslog = 0;
struct in_addr addr;
struct bpf_program cfilter;
char *bpff, errbuf[PCAP_ERRBUF_SIZE], *user_filter;
char *net_ip_string;
bpf_u_int32 net_mask;
char *pcapfile = NULL;
ch = fromfile = setfilter = version = drop_privs_flag = daemon_flag = 0;
dev = "eth0";
bpff = "";
chroot_dir = "/tmp/";
inpacket = intr_flag = chroot_flag = 0;
timecnt = time(NULL);
signal(SIGTERM, game_over);
signal(SIGINT, game_over);
signal(SIGQUIT, game_over);
//signal(SIGHUP, dump_active);
//signal(SIGALRM, set_end_sessions);
while ((ch = getopt(argc, argv, "b:d:w:e:tDET:g:hi:p:r:P:u:v")) != -1)
switch (ch) {
case 'i':
dev = strdup(optarg);
break;
case 'b':
bpff = strdup(optarg);
break;
case 'w':
p_window = strtol(optarg, NULL, 0);
break;
case 'e':
tresh = strtod(optarg, NULL);
break;
case 'v':
verbose = 1;
break;
case 'r':
pcapfile = strdup(optarg);
break;
case 'h':
usage();
exit(0);
break;
case 't':
profile_packet = 1;
break;
case 'E':
test_it();
break;
case 'D':
daemon_flag = 1;
break;
case 'T':
chroot_flag = 1;
break;
case 'u':
user_name = strdup(optarg);
drop_privs_flag = 1;
break;
case 'g':
group_name = strdup(optarg);
drop_privs_flag = 1;
break;
case 'p':
pidfile = strdup(optarg);
break;
case 'P':
pidpath = strdup(optarg);
break;
default:
exit(1);
break;
}
printf("%s - The Entropy DDoS Detector - version %s\n", BIN_NAME, VERSION);
+ errbuf[0] = '\0';
if (pcapfile) {
printf("[*] reading from file %s\n", pcapfile);
if((handle = pcap_open_offline(pcapfile, errbuf)) == NULL) {
printf("[*] Error pcap_open_offline: %s \n", errbuf);
exit(1);
}
} else {
if (getuid()) {
printf("[*] You must be root..\n");
+ usage();
return (1);
}
- errbuf[0] = '\0';
/* look up an availible device if non specified */
if (dev == 0x0) dev = pcap_lookupdev(errbuf);
printf("[*] Device: %s\n", dev);
if ((handle = pcap_open_live(dev, SNAPLENGTH, 1, 500, errbuf)) == NULL) {
printf("[*] Error pcap_open_live: %s \n", errbuf);
pcap_close(handle);
exit(1);
}
- if ((pcap_compile(handle, &cfilter, bpff, 1 ,net_mask)) == -1) {
- printf("[*] Error pcap_compile user_filter: %s\n", pcap_geterr(handle));
+ }
+ if ((pcap_compile(handle, &cfilter, bpff, 1, net_mask)) == -1) {
+ printf("[*] Error pcap_compile user_filter '%s' : %s\n", bpff, pcap_geterr(handle));
pcap_close(handle);
exit(1);
}
- pcap_setfilter(handle, &cfilter);
- pcap_freecode(&cfilter); // filter code not needed after setfilter
+ if(pcap_setfilter(handle, &cfilter)) {
+ printf("[*] Error in pcap_setfilter: %s\n", pcap_geterr(handle));
+ exit(1);
+ }
+ //pcap_freecode(&cfilter); // filter code not needed after setfilter
/* B0rk if we see an error... */
if (strlen(errbuf) > 0) {
printf("[*] Error errbuf: %s \n", errbuf);
pcap_close(handle);
exit(1);
}
- }
if ( chroot_flag == 1 ) {
set_chroot();
}
if(daemon_flag) {
if(!is_valid_path(pidpath)){
printf("[*] PID path \"%s\" is bad, check privilege.",pidpath);
exit(1);
}
openlog("ppacket", LOG_PID | LOG_CONS, LOG_DAEMON);
printf("[*] Daemonizing...\n\n");
daemonize(NULL);
}
if(drop_privs_flag) {
printf("[*] Dropping privs...\n\n");
drop_privs();
}
p_set = calloc(p_window, sizeof(uint32_t));
p_tot = calloc(p_window, sizeof(uint32_t));
p_entropy = calloc(p_window, sizeof(uint32_t));
//alarm(TIMEOUT);
printf("[*] Charging ddos detector.. need to fill %u-size window of packets.\n\n", p_window+1);
if(profile_packet) {
pcap_loop(handle,-1,got_packet_profile, NULL);
}else {
pcap_loop(handle,-1,got_packet,NULL);
}
pcap_close(handle);
return(0);
}
|
comotion/edd
|
bc2f4df34745e4c422a17e70aac271bc930b9f1a
|
EDD now classifies simple SYN floods successfully.
|
diff --git a/edd.c b/edd.c
index bad4b94..59ea82a 100644
--- a/edd.c
+++ b/edd.c
@@ -1,835 +1,906 @@
/* ppacket. Detect DDOS thru entropy
*
* Author: comotion@users.sf.net
* Idea by breno.silva@gmail.com
http://lists.openinfosecfoundation.org/pipermail/oisf-wg-portscan/2009-October/000023.html
* Thanks to ebf0 (http://www.gamelinux.org/) whose support code is good enough.
* License? If U have the code U have the GPL... >:-P
Entropy H(P1) + H(P2) + ... + H(Pi) > H(P1P2..Pi) => DDOS
Pseudo code:
- # can segment into destport or src:port:dst:port
for each packet
count set bits
count packet bits
sum_entropy = Entropy(packet);
track window of n last packets{
increase set & total bit values
if(H(window) > H(p1p2..pwin)
=> DDOS!
}
+ done
+ # can segment into destport or src:port:dst:port
+ TODO: identify involved services/hosts/networks.
+ foreach port in window
+ do entropy counts per port
+ foreach dst:port in window
+ do entropy counts per host:port
+ do entropy counts per host
+ foreach src in window
+ do entropy counts per src
+ foreach TCP(syn,rst,fin) in window
+ do entropy counts per class
+ foreach data packet
+ do entropy counts on data
+ register src: dst:port
+ graph entropy values / bits of entropy
+
+ + better ways to compute entropy (see simple_entropy())
+ -> tresholds, markov chains, averaging, compression: huffman window or PPZ
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <signal.h>
#include <pcap.h>
#include <getopt.h>
#include <time.h>
#include <sys/types.h>
#include <grp.h>
#include <pwd.h>
#include <unistd.h>
#include <sys/stat.h>
#include <syslog.h>
#include <fcntl.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
#include "edd.h"
static int verbose, inpacket, intr_flag, use_syslog;
time_t timecnt,tstamp;
pcap_t *handle;
-static char *dev,*dpath,*chroot_dir;
+static char *dev,*chroot_dir;
static char *group_name, *user_name, *true_pid_name;
static char *pidfile = "edd.pid";
static char *pidpath = "/var/run";
static int verbose, inpacket, intr_flag, use_syslog;
+static int profile_packet;
/* our window of packets */
-#define P_WINDOW 0xFF // 256
-static uint32_t p_set[P_WINDOW];
-static uint32_t p_tot[P_WINDOW];
-static double p_entropy[P_WINDOW];
+//#define P_WINDOW 0xFF // 256
+#define DEFAULT_WINDOW 0xFF
+#define DEFAULT_TRESH 1200.0
+static double tresh = DEFAULT_TRESH;
+static uint32_t p_window = DEFAULT_WINDOW;
+static uint32_t *p_set;
+static uint32_t *p_tot;
+static double *p_entropy;
static uint32_t head = 0, tail = 0;
static uint32_t b_tot = 0, b_set = 0;
void game_over() {
fprintf(stderr, "it is over my friend\n");
if ( inpacket == 0 ) {
pcap_close(handle);
exit (0);
}
intr_flag = 1;
}
/* For each byte, for each bit: count bits. Kernighan style */
inline uint32_t count_bits(const u_char *packet, const uint32_t p_len)
{
const uint32_t *ptr = (uint32_t *) packet;
const uint32_t *end = (uint32_t *) (packet + p_len);
uint32_t v; // count the number of bits set in v
uint8_t c; // c accumulates the total bits set in v
uint32_t set_bits = 0;
while (ptr < end){
v = *ptr++;
for (c = 0; v; c++) {
v &= v - 1; // clear the least significant bit set
}
set_bits += c;
}
return set_bits;
}
/* count bits in parallel
* How? With magick bit patterns.
* Thx go to http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
* The B array, expressed as binary, is:
0x1235467A = 01110101 00010010 10001010 11101101
B[0] = 0x55555555 = 01010101 01010101 01010101 01010101
B[1] = 0x33333333 = 00110011 00110011 00110011 00110011
B[2] = 0x0F0F0F0F = 00001111 00001111 00001111 00001111
B[3] = 0x00FF00FF = 00000000 11111111 00000000 11111111
B[4] = 0x0000FFFF = 00000000 00000000 11111111 11111111
We can adjust the method for larger integer sizes by continuing with the patterns for the Binary Magic Numbers, B and S. If there are k bits, then we need the arrays S and B to be ceil(lg(k)) elements long, and we must compute the same number of expressions for c as S or B are long. For a 32-bit v, 16 operations are used.
*/
inline uint32_t count_bits_p(const u_char *packet, const uint32_t p_len)
{
uint32_t v, c, set_bits = 0;
static const int S[] = { 1, 2, 4, 8, 16};
static const int B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF};
const uint32_t *ptr = (uint32_t *) packet;
const uint32_t *end = (uint32_t *) (packet + p_len);
while(end > ptr){
v = *ptr++;
c = v - ((v >> 1) & B[0]);
c = ((c >> S[1]) & B[1]) + (c & B[1]);
c = ((c >> S[2]) + c) & B[2];
c = ((c >> S[3]) + c) & B[3];
c = ((c >> S[4]) + c) & B[4];
set_bits += c;
}
return set_bits;
}
/* this algo does 4 bytes at a time. Note! what about garbage padding? */
uint32_t count_bits_pp(const u_char *packet, const uint32_t p_len)
{
uint32_t v, set_bits = 0;
const uint32_t *ptr = (uint32_t *) packet;
const uint32_t *end = (uint32_t *) (packet + p_len);
while(end > ptr){
v = *ptr++;
//fprintf(stderr, "%08p ", v);
v = v - ((v >> 1) & 0x55555555); // reuse input as temporary
v = (v & 0x33333333) + ((v >> 2) & 0x33333333); // temp
set_bits += ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; // count
}
/* last N<4 bytes */
//uint8_t mod = p_len % 4;
//set_bits += count_bits((uint8_t*)ptr,p_len % 4);
//fprintf(stderr, "\n");
return set_bits;
}
/* same dog, except use 64bit datatype*/
uint32_t count_bits_64(const u_char *packet, const uint32_t p_len)
{
uint64_t v, set_bits = 0;
const uint64_t *ptr = (uint64_t *) packet;
const uint64_t *end = (uint64_t *) (packet + p_len);
while(end > ptr){
v = *ptr++;
//fprintf(stderr, "%08p ", v);
v = v - ((v >> 1) & 0x5555555555555555); // reuse input as temporary
v = (v & 0x3333333333333333) + ((v >> 2) & 0x3333333333333333); // temp
v = (v + (v >> 4)) & 0x0F0F0F0F0F0F0F0F;
set_bits += (v * 0x0101010101010101) >> (sizeof(v) - 1) * CHAR_BIT; // count
}
//set_bits += count_bits_p((uint8_t *)ptr, p_len % 4);
//fprintf(stderr, "\n");
return set_bits;
}
/* this can be generalized if we have a 64bit or 128 bit type T
v = v - ((v >> 1) & (T)~(T)0/3); // temp
v = (v & (T)~(T)0/15*3) + ((v >> 2) & (T)~(T)0/15*3); // temp
v = (v + (v >> 4)) & (T)~(T)0/255*15; // temp
c = (T)(v * ((T)~(T)0/255)) >> (sizeof(v) - 1) * CHAR_BIT; // count
*/
/* simplistic bit-by-bit implementation */
inline uint32_t count_bits_kw(const u_char *packet, const uint32_t p_len)
{
uint32_t tmp;
uint32_t set_bits = 0;
// byte for byte
const u_char *ptr = packet;
while(ptr != packet + p_len){
tmp = *ptr;
while(tmp){
// isolate bit
set_bits += tmp & 0x1;
tmp >>= 1;
}
ptr++;
}
return set_bits;
}
/* count bits by lookup table */
static const unsigned char BitsSetTable256[256] =
{
# define B2(n) n, n+1, n+1, n+2
# define B4(n) B2(n), B2(n+1), B2(n+1), B2(n+2)
# define B6(n) B4(n), B4(n+1), B4(n+1), B4(n+2)
B6(0), B6(1), B6(1), B6(2)
};
/*
// To initially generate the table algorithmically:
BitsSetTable256[0] = 0;
for (int i = 0; i < 256; i++)
{
BitsSetTable256[i] = (i & 1) + BitsSetTable256[i / 2];
}
*/
inline uint32_t count_bits_t1(const u_char *packet, const uint32_t p_len){
uint32_t v, set_bits = 0;
const uint32_t *ptr = (uint32_t *) packet;
const uint32_t *end = (uint32_t *) (packet + p_len);
while(end >= ptr){
v = *ptr++; // count the number of bits set in 32-bit value v
// Option 1:
set_bits += BitsSetTable256[v & 0xff] +
BitsSetTable256[(v >> 8) & 0xff] +
BitsSetTable256[(v >> 16) & 0xff] +
BitsSetTable256[v >> 24];
}
return set_bits;
}
inline uint32_t count_bits_t2(const u_char *packet, const uint32_t p_len){
uint32_t v, set_bits = 0;
const uint32_t *ptr = (uint32_t *) packet;
const uint32_t *end = (uint32_t *) (packet + p_len);
unsigned char *p;
while(end >= ptr){
v = *ptr++; // count the number of bits set in 32-bit value v
//unsigned int c; // c is the total bits set in v
// Option 2:
p = (unsigned char *) &v;
set_bits += BitsSetTable256[p[0]] +
BitsSetTable256[p[1]] +
BitsSetTable256[p[2]] +
BitsSetTable256[p[3]];
}
return set_bits;
}
+
/* Could do algo selection based on best performance */
void packet_profiler (const u_char *packet, const uint32_t p_len)
{
- uint64_t s, e;
+ volatile uint64_t S, s, e;
const uint32_t p_bits = p_len*8;
__asm__ __volatile__("cpuid: rdtsc;" : "=A" (s) :: "ebx", "ecx", "memory");
uint32_t set_bits = count_bits_pp(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
- //printf("S: %llu\nD: %llu\ndiff: %lld\n", s, e, e - s);
- printf("[PP] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
- p_len, p_bits, set_bits);
+ printf("== %8llu == PP\n", e-s);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits_64(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
- printf("[64] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
- p_len, p_bits, set_bits);
+ printf("== %8llu == 64\n", e-s);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits_t1(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
- printf("[T1] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
- p_len, p_bits, set_bits);
+ printf("== %8llu == T1\n", e-s);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits_t2(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
- printf("[T2] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
- p_len, p_bits, set_bits);
+ printf("== %8llu == T2\n", e-s);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits_p(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
- printf("[ P] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
- p_len, p_bits, set_bits);
+ printf("== %8llu == P \n", e-s);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
- printf("[KR] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
- p_len, p_bits, set_bits);
+ printf("== %8llu == KR\n", e-s);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits_kw(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
- printf("[KW] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
- p_len, p_bits, set_bits);
+ printf("== %8llu == KW\n", e-s);
}
/* calculate the simple entropy of a packet, ie
* assume all bits are equiprobable and randomly distributed
*
* needs work: do this with pure, positive ints?
+ * log(x/y) = log(x) - log (y) : (-set/total)=(log(set)-log(total)
* tresholds? markov chains? averaging?
*
* check this with our friend the kolmogorov
+ *
+ * Basis for this entropy: just guessing:
+ * Entropy(set_bits) - Entropy (unset_bits) + E(total)
*/
double simple_entropy(double set_bits, double total_bits)
{
+
+ /* oldscool
return total_bits * (( -set_bits / total_bits )*log2(set_bits/total_bits)
- (1 - (set_bits / total_bits) * log2(1 - (set_bits/total_bits))))
+ log2(total_bits);
+ */
+
+ return
+ ( -set_bits )*(log2(set_bits)-log2(total_bits))
+ -
+ ( total_bits - set_bits) * ( log2 (total_bits - set_bits) - log2(total_bits) ) //log2(1 - (set_bits/total_bits))
+ + log2(total_bits) ;
}
static uint32_t packet_count;
+void got_packet_profile (u_char *useless,const struct pcap_pkthdr *pheader, const u_char *packet)
+{
+ static char flag;
+ if ( intr_flag != 0 ) { game_over(); }
+ inpacket = 1;
+ const uint32_t p_len = ((pheader->len > SNAPLENGTH)?SNAPLENGTH:pheader->len);
+
+ packet_profiler(packet, p_len);
+}
+
void got_packet (u_char *useless,const struct pcap_pkthdr *pheader, const u_char *packet)
{
static char flag;
if ( intr_flag != 0 ) { game_over(); }
inpacket = 1;
tstamp = time(NULL);
const uint32_t p_len = ((pheader->len > SNAPLENGTH)?SNAPLENGTH:pheader->len);
const uint32_t bits = p_len*8;
+
uint32_t set = count_bits_64(packet, p_len);
- static const double tresh = 1000;
p_tot[head] = bits;
p_set[head] = set;
p_entropy[head] = simple_entropy(set, bits);
packet_count++;
//printf("[%lu] %lu/%lu, E(%f)\n", head, set, bits, p_entropy[head]);
- if (packet_count >= P_WINDOW) {
+ if (packet_count >= p_window) {
// we have some packets for analysis
uint32_t k, total_set = 0, total_bits = 0;
double sum_entropy = 0;
- for(k = 0; k < P_WINDOW; k++){
+ for(k = 0; k < p_window; k++){
total_set += p_set[k];
total_bits+= p_tot[k];
sum_entropy += p_entropy[k];
}
double joint_entropy = simple_entropy(total_set, total_bits);
if(tresh < sum_entropy - joint_entropy ){
if (!flag)
- fprintf(stderr, "ddos attack!!! e(%f) < te(%f)\n",
- joint_entropy, sum_entropy);
+ fprintf(stderr, "ddos attack!!! Entropy(%f) < Total_Entropy(%f) over %lu bits\n",
+ joint_entropy, sum_entropy, total_bits);
flag = 1;
}else{
if (flag)
- fprintf(stdout, "no news, e(%f) >= te(%f)\n",
- joint_entropy, sum_entropy);
+ fprintf(stdout, "no news, Entropy(%f) >= Total_Entropy(%f) over %lu bits\n",
+ joint_entropy, sum_entropy, total_bits);
flag = 0;
}
}
- head = (head + 1) % P_WINDOW;
+ head = (head + 1) % p_window;
ether_header *eth_hdr;
eth_hdr = (ether_header *) (packet);
u_short eth_type;
eth_type = ntohs(eth_hdr->eth_ip_type);
int eth_header_len;
eth_header_len = ETHERNET_HEADER_LEN;
/* sample code from cxtracker
u_short p_bytes;
if ( eth_type == ETHERNET_TYPE_8021Q ) {
// printf("[*] ETHERNET TYPE 8021Q\n");
eth_type = ntohs(eth_hdr->eth_8_ip_type);
eth_header_len +=4;
}
else if ( eth_type == (ETHERNET_TYPE_802Q1MT|ETHERNET_TYPE_802Q1MT2|ETHERNET_TYPE_802Q1MT3|ETHERNET_TYPE_8021AD) ) {
// printf("[*] ETHERNET TYPE 802Q1MT\n");
eth_type = ntohs(eth_hdr->eth_82_ip_type);
eth_header_len +=8;
}
if ( eth_type == ETHERNET_TYPE_IP ) {
// printf("[*] Got IPv4 Packet...\n");
ip4_header *ip4;
ip4 = (ip4_header *) (packet + eth_header_len);
p_bytes = (ip4->ip_len - (IP_HL(ip4)*4));
struct in6_addr ip_src, ip_dst;
ip_src.s6_addr32[0] = ip4->ip_src;
ip_src.s6_addr32[1] = 0;
ip_src.s6_addr32[2] = 0;
ip_src.s6_addr32[3] = 0;
ip_dst.s6_addr32[0] = ip4->ip_dst;
ip_dst.s6_addr32[1] = 0;
ip_dst.s6_addr32[2] = 0;
ip_dst.s6_addr32[3] = 0;
if ( ip4->ip_p == IP_PROTO_TCP ) {
tcp_header *tcph;
tcph = (tcp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
// printf("[*] IPv4 PROTOCOL TYPE TCP:\n");
cx_track(ip_src, tcph->src_port, ip_dst, tcph->dst_port, ip4->ip_p, p_bytes, tcph->t_flags, tstamp, AF_INET);
inpacket = 0;
return;
}
else if (ip4->ip_p == IP_PROTO_UDP) {
udp_header *udph;
udph = (udp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
// printf("[*] IPv4 PROTOCOL TYPE UDP:\n");
cx_track(ip_src, udph->src_port, ip_dst, udph->dst_port, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
inpacket = 0;
return;
}
else if (ip4->ip_p == IP_PROTO_ICMP) {
icmp_header *icmph;
icmph = (icmp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
// printf("[*] IP PROTOCOL TYPE ICMP\n");
cx_track(ip_src, icmph->s_icmp_id, ip_dst, icmph->s_icmp_id, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
inpacket = 0;
return;
}
else {
// printf("[*] IPv4 PROTOCOL TYPE OTHER: %d\n",ip4->ip_p);
cx_track(ip_src, ip4->ip_p, ip_dst, ip4->ip_p, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
inpacket = 0;
return;
}
}
else if ( eth_type == ETHERNET_TYPE_IPV6) {
// printf("[*] Got IPv6 Packet...\n");
ip6_header *ip6;
ip6 = (ip6_header *) (packet + eth_header_len);
if ( ip6->next == IP_PROTO_TCP ) {
tcp_header *tcph;
tcph = (tcp_header *) (packet + eth_header_len + IP6_HEADER_LEN);
// printf("[*] IPv6 PROTOCOL TYPE TCP:\n");
cx_track(ip6->ip_src, tcph->src_port, ip6->ip_dst, tcph->dst_port, ip6->next, ip6->len, tcph->t_flags, tstamp, AF_INET6);
inpacket = 0;
return;
}
else if (ip6->next == IP_PROTO_UDP) {
udp_header *udph;
udph = (udp_header *) (packet + eth_header_len + IP6_HEADER_LEN);
// printf("[*] IPv6 PROTOCOL TYPE UDP:\n");
cx_track(ip6->ip_src, udph->src_port, ip6->ip_dst, udph->dst_port, ip6->next, ip6->len, 0, tstamp, AF_INET6);
inpacket = 0;
return;
}
else if (ip6->next == IP6_PROTO_ICMP) {
icmp6_header *icmph;
icmph = (icmp6_header *) (packet + eth_header_len + IP6_HEADER_LEN);
// printf("[*] IPv6 PROTOCOL TYPE ICMP\n");
cx_track(ip6->ip_src, ip6->hop_lmt, ip6->ip_dst, ip6->hop_lmt, ip6->next, ip6->len, 0, tstamp, AF_INET6);
inpacket = 0;
return;
}
else {
// printf("[*] IPv6 PROTOCOL TYPE OTHER: %d\n",ip6->next);
cx_track(ip6->ip_src, ip6->next, ip6->ip_dst, ip6->next, ip6->next, ip6->len, 0, tstamp, AF_INET6);
inpacket = 0;
return;
}
}
*/
inpacket = 0;
return;
}
void test_it(){
/* test it! */
uint8_t b[18];
memset((void*) b, 1, 17);
b[17]= 0x11; // the faulty bits
printf("KnR %lu\n", count_bits(b,17));
printf("KaW %lu\n", count_bits_kw(b,17));
printf("PaP %lu\n", count_bits_pp(b,17));
printf("JaP %lu\n", count_bits_p(b,17));
printf("P64 %lu\n", count_bits_64(b,17));
printf("T 1 %lu\n", count_bits_t1(b,17));
printf("T 2 %lu\n", count_bits_t2(b,17));
printf("weirdness test: %lu %lu %lu %lu %lu %lu\n",
count_bits_pp(b,17),
count_bits_pp(b,17),
count_bits_pp(b,17),
count_bits_pp(b,17),
count_bits_pp(b,17),
count_bits_pp(b,17));
}
static void usage() {
printf("edd: Entropy DDoS Detection\n\n");
printf("USAGE:\n");
printf(" $ %s [options]\n", BIN_NAME);
printf("\n");
printf(" OPTIONS:\n");
printf("\n");
printf(" -i : network device (default: eth0)\n");
+ printf(" -r : read pcap file\n");
+ printf(" -w : packet window size (default: %u)\n", DEFAULT_WINDOW);
printf(" -b : berkeley packet filter\n");
- printf(" -d : directory to dump sessions files in\n");
+ printf(" -e : treshold value (default : %f)\n", DEFAULT_TRESH);
printf(" -u : user\n");
printf(" -g : group\n");
printf(" -D : enables daemon mode\n");
printf(" -T : dir to chroot into\n");
printf(" -h : this help message\n");
+ printf(" -t : profile counter algoritms\n");
+ printf(" -E : test edd\n");
printf(" -v : verbose\n\n");
}
static int set_chroot(void) {
char *absdir;
char *logdir;
int abslen;
/* logdir = get_abs_path(logpath); */
/* change to the directory */
if ( chdir(chroot_dir) != 0 ) {
printf("set_chroot: Can not chdir to \"%s\": %s\n",chroot_dir,strerror(errno));
}
/* always returns an absolute pathname */
absdir = getcwd(NULL, 0);
abslen = strlen(absdir);
/* make the chroot call */
if ( chroot(absdir) < 0 ) {
printf("Can not chroot to \"%s\": absolute: %s: %s\n",chroot_dir,absdir,strerror(errno));
}
if ( chdir("/") < 0 ) {
printf("Can not chdir to \"/\" after chroot: %s\n",strerror(errno));
}
return 0;
}
static int drop_privs(void) {
struct group *gr;
struct passwd *pw;
char *endptr;
int i;
int do_setuid = 0;
int do_setgid = 0;
unsigned long groupid = 0;
unsigned long userid = 0;
if ( group_name != NULL ) {
do_setgid = 1;
if( isdigit(group_name[0]) == 0 ) {
gr = getgrnam(group_name);
groupid = gr->gr_gid;
}
else {
groupid = strtoul(group_name, &endptr, 10);
}
}
if ( user_name != NULL ) {
do_setuid = 1;
do_setgid = 1;
if ( isdigit(user_name[0]) == 0 ) {
pw = getpwnam(user_name);
userid = pw->pw_uid;
} else {
userid = strtoul(user_name, &endptr, 10);
pw = getpwuid(userid);
}
if ( group_name == NULL ) {
groupid = pw->pw_gid;
}
}
if ( do_setgid ) {
if ( (i = setgid(groupid)) < 0 ) {
printf("Unable to set group ID: %s", strerror(i));
}
}
endgrent();
endpwent();
if ( do_setuid ) {
if (getuid() == 0 && initgroups(user_name, groupid) < 0 ) {
printf("Unable to init group names (%s/%lu)", user_name, groupid);
}
if ( (i = setuid(userid)) < 0 ) {
printf("Unable to set user ID: %s\n", strerror(i));
}
}
return 0;
}
static int is_valid_path(char *path) {
struct stat st;
if ( path == NULL ) {
return 0;
}
if ( stat(path, &st) != 0 ) {
return 0;
}
if ( !S_ISDIR(st.st_mode) || access(path, W_OK) == -1 ) {
return 0;
}
return 1;
}
static int create_pid_file(char *path, char *filename) {
char filepath[STDBUF];
char *fp = NULL;
char *fn = NULL;
char pid_buffer[12];
struct flock lock;
int rval;
int fd;
memset(filepath, 0, STDBUF);
if ( !filename ) {
fn = pidfile;
}
else {
fn = filename;
}
if ( !path ) {
fp = pidpath;
}
else {
fp = path;
}
if ( is_valid_path(fp) ) {
snprintf(filepath, STDBUF-1, "%s/%s", fp, fn);
}
else {
printf("PID path \"%s\" isn't a writeable directory!", fp);
}
true_pid_name = strdup(filename);
if ( (fd = open(filepath, O_CREAT | O_WRONLY,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1 ) {
return ERROR;
}
/* pid file locking */
lock.l_type = F_WRLCK;
lock.l_start = 0;
lock.l_whence = SEEK_SET;
lock.l_len = 0;
if ( fcntl(fd, F_SETLK, &lock) == -1 ) {
if ( errno == EACCES || errno == EAGAIN ) {
rval = ERROR;
}
else {
rval = ERROR;
}
close(fd);
return rval;
}
snprintf(pid_buffer, sizeof(pid_buffer), "%d\n", (int) getpid());
if ( ftruncate(fd, 0) != 0 ) { return ERROR; }
if ( write(fd, pid_buffer, strlen(pid_buffer)) != 0 ) { return ERROR; }
return SUCCESS;
}
int daemonize() {
pid_t pid;
int fd;
pid = fork();
if ( pid > 0 ) {
exit(0); /* parent */
}
use_syslog = 1;
if ( pid < 0 ) {
return ERROR;
}
/* new process group */
setsid();
/* close file handles */
if ( (fd = open("/dev/null", O_RDWR)) >= 0 ) {
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
if ( fd > 2 ) {
close(fd);
}
}
if ( pidfile ) {
return create_pid_file(pidpath, pidfile);
}
return SUCCESS;
}
int main(int argc, char *argv[]) {
int ch, fromfile, setfilter, version, drop_privs_flag, daemon_flag, chroot_flag;
int use_syslog = 0;
struct in_addr addr;
struct bpf_program cfilter;
char *bpff, errbuf[PCAP_ERRBUF_SIZE], *user_filter;
char *net_ip_string;
bpf_u_int32 net_mask;
+ char *pcapfile = NULL;
ch = fromfile = setfilter = version = drop_privs_flag = daemon_flag = 0;
dev = "eth0";
bpff = "";
chroot_dir = "/tmp/";
- dpath = "./";
inpacket = intr_flag = chroot_flag = 0;
timecnt = time(NULL);
signal(SIGTERM, game_over);
signal(SIGINT, game_over);
signal(SIGQUIT, game_over);
//signal(SIGHUP, dump_active);
//signal(SIGALRM, set_end_sessions);
- while ((ch = getopt(argc, argv, "b:d:DT:g:hi:p:P:u:v")) != -1)
+ while ((ch = getopt(argc, argv, "b:d:w:e:tDET:g:hi:p:r:P:u:v")) != -1)
switch (ch) {
case 'i':
dev = strdup(optarg);
break;
case 'b':
bpff = strdup(optarg);
break;
+ case 'w':
+ p_window = strtol(optarg, NULL, 0);
+ break;
+ case 'e':
+ tresh = strtod(optarg, NULL);
+ break;
case 'v':
verbose = 1;
break;
- case 'd':
- dpath = strdup(optarg);
+ case 'r':
+ pcapfile = strdup(optarg);
break;
case 'h':
usage();
exit(0);
break;
+ case 't':
+ profile_packet = 1;
+ break;
+ case 'E':
+ test_it();
+ break;
case 'D':
daemon_flag = 1;
break;
case 'T':
chroot_flag = 1;
break;
case 'u':
user_name = strdup(optarg);
drop_privs_flag = 1;
break;
case 'g':
group_name = strdup(optarg);
drop_privs_flag = 1;
break;
case 'p':
pidfile = strdup(optarg);
break;
case 'P':
pidpath = strdup(optarg);
break;
default:
exit(1);
break;
}
- //test_it();
- printf("[*] Running %s v %s\n", BIN_NAME, VERSION);
+ printf("%s - The Entropy DDoS Detector - version %s\n", BIN_NAME, VERSION);
- if (getuid()) {
- printf("[*] You must be root..\n");
- return (1);
- }
+ if (pcapfile) {
+ printf("[*] reading from file %s\n", pcapfile);
+ if((handle = pcap_open_offline(pcapfile, errbuf)) == NULL) {
+ printf("[*] Error pcap_open_offline: %s \n", errbuf);
+ exit(1);
+ }
+ } else {
- errbuf[0] = '\0';
- /* look up an availible device if non specified */
- if (dev == 0x0) dev = pcap_lookupdev(errbuf);
- printf("[*] Device: %s\n", dev);
+ if (getuid()) {
+ printf("[*] You must be root..\n");
+ return (1);
+ }
- if ((handle = pcap_open_live(dev, SNAPLENGTH, 1, 500, errbuf)) == NULL) {
- printf("[*] Error pcap_open_live: %s \n", errbuf);
- pcap_close(handle);
- exit(1);
- }
- else if ((pcap_compile(handle, &cfilter, bpff, 1 ,net_mask)) == -1) {
+ errbuf[0] = '\0';
+ /* look up an availible device if non specified */
+ if (dev == 0x0) dev = pcap_lookupdev(errbuf);
+ printf("[*] Device: %s\n", dev);
+
+ if ((handle = pcap_open_live(dev, SNAPLENGTH, 1, 500, errbuf)) == NULL) {
+ printf("[*] Error pcap_open_live: %s \n", errbuf);
+ pcap_close(handle);
+ exit(1);
+ }
+
+ if ((pcap_compile(handle, &cfilter, bpff, 1 ,net_mask)) == -1) {
printf("[*] Error pcap_compile user_filter: %s\n", pcap_geterr(handle));
pcap_close(handle);
exit(1);
}
pcap_setfilter(handle, &cfilter);
pcap_freecode(&cfilter); // filter code not needed after setfilter
/* B0rk if we see an error... */
if (strlen(errbuf) > 0) {
printf("[*] Error errbuf: %s \n", errbuf);
pcap_close(handle);
exit(1);
}
+ }
if ( chroot_flag == 1 ) {
set_chroot();
}
if(daemon_flag) {
if(!is_valid_path(pidpath)){
printf("[*] PID path \"%s\" is bad, check privilege.",pidpath);
exit(1);
}
openlog("ppacket", LOG_PID | LOG_CONS, LOG_DAEMON);
printf("[*] Daemonizing...\n\n");
daemonize(NULL);
}
if(drop_privs_flag) {
printf("[*] Dropping privs...\n\n");
drop_privs();
}
+ p_set = calloc(p_window, sizeof(uint32_t));
+ p_tot = calloc(p_window, sizeof(uint32_t));
+ p_entropy = calloc(p_window, sizeof(uint32_t));
//alarm(TIMEOUT);
- printf("[*] Charging... need %lu to operate correctly.\n\n", P_WINDOW);
- pcap_loop(handle,-1,got_packet,NULL);
+ printf("[*] Charging ddos detector.. need to fill %u-size window of packets.\n\n", p_window+1);
+ if(profile_packet) {
+ pcap_loop(handle,-1,got_packet_profile, NULL);
+ }else {
+ pcap_loop(handle,-1,got_packet,NULL);
+ }
pcap_close(handle);
return(0);
}
|
comotion/edd
|
e230968a87e56bd7b07ed6aa486c58c85fd7c189
|
level-trigger instead of all-the-time-triggering
|
diff --git a/edd.c b/edd.c
index 8889606..bad4b94 100644
--- a/edd.c
+++ b/edd.c
@@ -1,825 +1,835 @@
/* ppacket. Detect DDOS thru entropy
*
* Author: comotion@users.sf.net
* Idea by breno.silva@gmail.com
http://lists.openinfosecfoundation.org/pipermail/oisf-wg-portscan/2009-October/000023.html
* Thanks to ebf0 (http://www.gamelinux.org/) whose support code is good enough.
* License? If U have the code U have the GPL... >:-P
Entropy H(P1) + H(P2) + ... + H(Pi) > H(P1P2..Pi) => DDOS
Pseudo code:
# can segment into destport or src:port:dst:port
for each packet
count set bits
count packet bits
sum_entropy = Entropy(packet);
track window of n last packets{
increase set & total bit values
if(H(window) > H(p1p2..pwin)
=> DDOS!
}
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <signal.h>
#include <pcap.h>
#include <getopt.h>
#include <time.h>
#include <sys/types.h>
#include <grp.h>
#include <pwd.h>
#include <unistd.h>
#include <sys/stat.h>
#include <syslog.h>
#include <fcntl.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
#include "edd.h"
static int verbose, inpacket, intr_flag, use_syslog;
time_t timecnt,tstamp;
pcap_t *handle;
static char *dev,*dpath,*chroot_dir;
static char *group_name, *user_name, *true_pid_name;
static char *pidfile = "edd.pid";
static char *pidpath = "/var/run";
static int verbose, inpacket, intr_flag, use_syslog;
/* our window of packets */
#define P_WINDOW 0xFF // 256
static uint32_t p_set[P_WINDOW];
static uint32_t p_tot[P_WINDOW];
static double p_entropy[P_WINDOW];
static uint32_t head = 0, tail = 0;
static uint32_t b_tot = 0, b_set = 0;
void game_over() {
fprintf(stderr, "it is over my friend\n");
if ( inpacket == 0 ) {
pcap_close(handle);
exit (0);
}
intr_flag = 1;
}
/* For each byte, for each bit: count bits. Kernighan style */
inline uint32_t count_bits(const u_char *packet, const uint32_t p_len)
{
const uint32_t *ptr = (uint32_t *) packet;
const uint32_t *end = (uint32_t *) (packet + p_len);
uint32_t v; // count the number of bits set in v
uint8_t c; // c accumulates the total bits set in v
uint32_t set_bits = 0;
while (ptr < end){
v = *ptr++;
for (c = 0; v; c++) {
v &= v - 1; // clear the least significant bit set
}
set_bits += c;
}
return set_bits;
}
/* count bits in parallel
* How? With magick bit patterns.
* Thx go to http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
* The B array, expressed as binary, is:
0x1235467A = 01110101 00010010 10001010 11101101
B[0] = 0x55555555 = 01010101 01010101 01010101 01010101
B[1] = 0x33333333 = 00110011 00110011 00110011 00110011
B[2] = 0x0F0F0F0F = 00001111 00001111 00001111 00001111
B[3] = 0x00FF00FF = 00000000 11111111 00000000 11111111
B[4] = 0x0000FFFF = 00000000 00000000 11111111 11111111
We can adjust the method for larger integer sizes by continuing with the patterns for the Binary Magic Numbers, B and S. If there are k bits, then we need the arrays S and B to be ceil(lg(k)) elements long, and we must compute the same number of expressions for c as S or B are long. For a 32-bit v, 16 operations are used.
*/
inline uint32_t count_bits_p(const u_char *packet, const uint32_t p_len)
{
uint32_t v, c, set_bits = 0;
static const int S[] = { 1, 2, 4, 8, 16};
static const int B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF};
const uint32_t *ptr = (uint32_t *) packet;
const uint32_t *end = (uint32_t *) (packet + p_len);
while(end > ptr){
v = *ptr++;
c = v - ((v >> 1) & B[0]);
c = ((c >> S[1]) & B[1]) + (c & B[1]);
c = ((c >> S[2]) + c) & B[2];
c = ((c >> S[3]) + c) & B[3];
c = ((c >> S[4]) + c) & B[4];
set_bits += c;
}
return set_bits;
}
/* this algo does 4 bytes at a time. Note! what about garbage padding? */
uint32_t count_bits_pp(const u_char *packet, const uint32_t p_len)
{
uint32_t v, set_bits = 0;
const uint32_t *ptr = (uint32_t *) packet;
const uint32_t *end = (uint32_t *) (packet + p_len);
while(end > ptr){
v = *ptr++;
//fprintf(stderr, "%08p ", v);
v = v - ((v >> 1) & 0x55555555); // reuse input as temporary
v = (v & 0x33333333) + ((v >> 2) & 0x33333333); // temp
set_bits += ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; // count
}
/* last N<4 bytes */
//uint8_t mod = p_len % 4;
//set_bits += count_bits((uint8_t*)ptr,p_len % 4);
//fprintf(stderr, "\n");
return set_bits;
}
/* same dog, except use 64bit datatype*/
uint32_t count_bits_64(const u_char *packet, const uint32_t p_len)
{
uint64_t v, set_bits = 0;
const uint64_t *ptr = (uint64_t *) packet;
const uint64_t *end = (uint64_t *) (packet + p_len);
while(end > ptr){
v = *ptr++;
//fprintf(stderr, "%08p ", v);
v = v - ((v >> 1) & 0x5555555555555555); // reuse input as temporary
v = (v & 0x3333333333333333) + ((v >> 2) & 0x3333333333333333); // temp
v = (v + (v >> 4)) & 0x0F0F0F0F0F0F0F0F;
set_bits += (v * 0x0101010101010101) >> (sizeof(v) - 1) * CHAR_BIT; // count
}
//set_bits += count_bits_p((uint8_t *)ptr, p_len % 4);
//fprintf(stderr, "\n");
return set_bits;
}
/* this can be generalized if we have a 64bit or 128 bit type T
v = v - ((v >> 1) & (T)~(T)0/3); // temp
v = (v & (T)~(T)0/15*3) + ((v >> 2) & (T)~(T)0/15*3); // temp
v = (v + (v >> 4)) & (T)~(T)0/255*15; // temp
c = (T)(v * ((T)~(T)0/255)) >> (sizeof(v) - 1) * CHAR_BIT; // count
*/
/* simplistic bit-by-bit implementation */
inline uint32_t count_bits_kw(const u_char *packet, const uint32_t p_len)
{
uint32_t tmp;
uint32_t set_bits = 0;
// byte for byte
const u_char *ptr = packet;
while(ptr != packet + p_len){
tmp = *ptr;
while(tmp){
// isolate bit
set_bits += tmp & 0x1;
tmp >>= 1;
}
ptr++;
}
return set_bits;
}
/* count bits by lookup table */
static const unsigned char BitsSetTable256[256] =
{
# define B2(n) n, n+1, n+1, n+2
# define B4(n) B2(n), B2(n+1), B2(n+1), B2(n+2)
# define B6(n) B4(n), B4(n+1), B4(n+1), B4(n+2)
B6(0), B6(1), B6(1), B6(2)
};
/*
// To initially generate the table algorithmically:
BitsSetTable256[0] = 0;
for (int i = 0; i < 256; i++)
{
BitsSetTable256[i] = (i & 1) + BitsSetTable256[i / 2];
}
*/
inline uint32_t count_bits_t1(const u_char *packet, const uint32_t p_len){
uint32_t v, set_bits = 0;
const uint32_t *ptr = (uint32_t *) packet;
const uint32_t *end = (uint32_t *) (packet + p_len);
while(end >= ptr){
v = *ptr++; // count the number of bits set in 32-bit value v
// Option 1:
set_bits += BitsSetTable256[v & 0xff] +
BitsSetTable256[(v >> 8) & 0xff] +
BitsSetTable256[(v >> 16) & 0xff] +
BitsSetTable256[v >> 24];
}
return set_bits;
}
inline uint32_t count_bits_t2(const u_char *packet, const uint32_t p_len){
uint32_t v, set_bits = 0;
const uint32_t *ptr = (uint32_t *) packet;
const uint32_t *end = (uint32_t *) (packet + p_len);
unsigned char *p;
while(end >= ptr){
v = *ptr++; // count the number of bits set in 32-bit value v
//unsigned int c; // c is the total bits set in v
// Option 2:
p = (unsigned char *) &v;
set_bits += BitsSetTable256[p[0]] +
BitsSetTable256[p[1]] +
BitsSetTable256[p[2]] +
BitsSetTable256[p[3]];
}
return set_bits;
}
/* Could do algo selection based on best performance */
void packet_profiler (const u_char *packet, const uint32_t p_len)
{
uint64_t s, e;
const uint32_t p_bits = p_len*8;
__asm__ __volatile__("cpuid: rdtsc;" : "=A" (s) :: "ebx", "ecx", "memory");
uint32_t set_bits = count_bits_pp(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
//printf("S: %llu\nD: %llu\ndiff: %lld\n", s, e, e - s);
printf("[PP] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
p_len, p_bits, set_bits);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits_64(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
printf("[64] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
p_len, p_bits, set_bits);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits_t1(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
printf("[T1] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
p_len, p_bits, set_bits);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits_t2(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
printf("[T2] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
p_len, p_bits, set_bits);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits_p(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
printf("[ P] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
p_len, p_bits, set_bits);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
printf("[KR] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
p_len, p_bits, set_bits);
__asm__ volatile("rdtsc":"=A"(s));
set_bits = count_bits_kw(packet, p_len);
__asm__ volatile("rdtsc":"=A"(e));
printf("[KW] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
p_len, p_bits, set_bits);
}
/* calculate the simple entropy of a packet, ie
* assume all bits are equiprobable and randomly distributed
*
* needs work: do this with pure, positive ints?
* tresholds? markov chains? averaging?
*
* check this with our friend the kolmogorov
*/
double simple_entropy(double set_bits, double total_bits)
{
return total_bits * (( -set_bits / total_bits )*log2(set_bits/total_bits)
- (1 - (set_bits / total_bits) * log2(1 - (set_bits/total_bits))))
+ log2(total_bits);
}
static uint32_t packet_count;
void got_packet (u_char *useless,const struct pcap_pkthdr *pheader, const u_char *packet)
{
+ static char flag;
if ( intr_flag != 0 ) { game_over(); }
inpacket = 1;
tstamp = time(NULL);
const uint32_t p_len = ((pheader->len > SNAPLENGTH)?SNAPLENGTH:pheader->len);
const uint32_t bits = p_len*8;
uint32_t set = count_bits_64(packet, p_len);
- static const double tresh = 100;
+ static const double tresh = 1000;
p_tot[head] = bits;
p_set[head] = set;
p_entropy[head] = simple_entropy(set, bits);
packet_count++;
- if (packet_count < P_WINDOW) {
- printf("[%lu] %lu/%lu, E(%f)\n", head, set, bits, p_entropy[head]);
- } else {
+ //printf("[%lu] %lu/%lu, E(%f)\n", head, set, bits, p_entropy[head]);
+ if (packet_count >= P_WINDOW) {
// we have some packets for analysis
uint32_t k, total_set = 0, total_bits = 0;
double sum_entropy = 0;
for(k = 0; k < P_WINDOW; k++){
total_set += p_set[k];
total_bits+= p_tot[k];
sum_entropy += p_entropy[k];
}
double joint_entropy = simple_entropy(total_set, total_bits);
if(tresh < sum_entropy - joint_entropy ){
- fprintf(stderr, "ddos attack!!! e(%f) < te(%f)\n",
+ if (!flag)
+ fprintf(stderr, "ddos attack!!! e(%f) < te(%f)\n",
joint_entropy, sum_entropy);
+ flag = 1;
}else{
- fprintf(stdout, "no news, e(%f) >= te(%f)\n",
+ if (flag)
+ fprintf(stdout, "no news, e(%f) >= te(%f)\n",
joint_entropy, sum_entropy);
+ flag = 0;
}
}
head = (head + 1) % P_WINDOW;
ether_header *eth_hdr;
eth_hdr = (ether_header *) (packet);
u_short eth_type;
eth_type = ntohs(eth_hdr->eth_ip_type);
int eth_header_len;
eth_header_len = ETHERNET_HEADER_LEN;
/* sample code from cxtracker
u_short p_bytes;
if ( eth_type == ETHERNET_TYPE_8021Q ) {
// printf("[*] ETHERNET TYPE 8021Q\n");
eth_type = ntohs(eth_hdr->eth_8_ip_type);
eth_header_len +=4;
}
else if ( eth_type == (ETHERNET_TYPE_802Q1MT|ETHERNET_TYPE_802Q1MT2|ETHERNET_TYPE_802Q1MT3|ETHERNET_TYPE_8021AD) ) {
// printf("[*] ETHERNET TYPE 802Q1MT\n");
eth_type = ntohs(eth_hdr->eth_82_ip_type);
eth_header_len +=8;
}
if ( eth_type == ETHERNET_TYPE_IP ) {
// printf("[*] Got IPv4 Packet...\n");
ip4_header *ip4;
ip4 = (ip4_header *) (packet + eth_header_len);
p_bytes = (ip4->ip_len - (IP_HL(ip4)*4));
struct in6_addr ip_src, ip_dst;
ip_src.s6_addr32[0] = ip4->ip_src;
ip_src.s6_addr32[1] = 0;
ip_src.s6_addr32[2] = 0;
ip_src.s6_addr32[3] = 0;
ip_dst.s6_addr32[0] = ip4->ip_dst;
ip_dst.s6_addr32[1] = 0;
ip_dst.s6_addr32[2] = 0;
ip_dst.s6_addr32[3] = 0;
if ( ip4->ip_p == IP_PROTO_TCP ) {
tcp_header *tcph;
tcph = (tcp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
// printf("[*] IPv4 PROTOCOL TYPE TCP:\n");
cx_track(ip_src, tcph->src_port, ip_dst, tcph->dst_port, ip4->ip_p, p_bytes, tcph->t_flags, tstamp, AF_INET);
inpacket = 0;
return;
}
else if (ip4->ip_p == IP_PROTO_UDP) {
udp_header *udph;
udph = (udp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
// printf("[*] IPv4 PROTOCOL TYPE UDP:\n");
cx_track(ip_src, udph->src_port, ip_dst, udph->dst_port, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
inpacket = 0;
return;
}
else if (ip4->ip_p == IP_PROTO_ICMP) {
icmp_header *icmph;
icmph = (icmp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
// printf("[*] IP PROTOCOL TYPE ICMP\n");
cx_track(ip_src, icmph->s_icmp_id, ip_dst, icmph->s_icmp_id, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
inpacket = 0;
return;
}
else {
// printf("[*] IPv4 PROTOCOL TYPE OTHER: %d\n",ip4->ip_p);
cx_track(ip_src, ip4->ip_p, ip_dst, ip4->ip_p, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
inpacket = 0;
return;
}
}
else if ( eth_type == ETHERNET_TYPE_IPV6) {
// printf("[*] Got IPv6 Packet...\n");
ip6_header *ip6;
ip6 = (ip6_header *) (packet + eth_header_len);
if ( ip6->next == IP_PROTO_TCP ) {
tcp_header *tcph;
tcph = (tcp_header *) (packet + eth_header_len + IP6_HEADER_LEN);
// printf("[*] IPv6 PROTOCOL TYPE TCP:\n");
cx_track(ip6->ip_src, tcph->src_port, ip6->ip_dst, tcph->dst_port, ip6->next, ip6->len, tcph->t_flags, tstamp, AF_INET6);
inpacket = 0;
return;
}
else if (ip6->next == IP_PROTO_UDP) {
udp_header *udph;
udph = (udp_header *) (packet + eth_header_len + IP6_HEADER_LEN);
// printf("[*] IPv6 PROTOCOL TYPE UDP:\n");
cx_track(ip6->ip_src, udph->src_port, ip6->ip_dst, udph->dst_port, ip6->next, ip6->len, 0, tstamp, AF_INET6);
inpacket = 0;
return;
}
else if (ip6->next == IP6_PROTO_ICMP) {
icmp6_header *icmph;
icmph = (icmp6_header *) (packet + eth_header_len + IP6_HEADER_LEN);
// printf("[*] IPv6 PROTOCOL TYPE ICMP\n");
cx_track(ip6->ip_src, ip6->hop_lmt, ip6->ip_dst, ip6->hop_lmt, ip6->next, ip6->len, 0, tstamp, AF_INET6);
inpacket = 0;
return;
}
else {
// printf("[*] IPv6 PROTOCOL TYPE OTHER: %d\n",ip6->next);
cx_track(ip6->ip_src, ip6->next, ip6->ip_dst, ip6->next, ip6->next, ip6->len, 0, tstamp, AF_INET6);
inpacket = 0;
return;
}
}
*/
inpacket = 0;
return;
}
+
+
+void test_it(){
+ /* test it! */
+ uint8_t b[18];
+ memset((void*) b, 1, 17);
+ b[17]= 0x11; // the faulty bits
+
+ printf("KnR %lu\n", count_bits(b,17));
+ printf("KaW %lu\n", count_bits_kw(b,17));
+ printf("PaP %lu\n", count_bits_pp(b,17));
+ printf("JaP %lu\n", count_bits_p(b,17));
+ printf("P64 %lu\n", count_bits_64(b,17));
+ printf("T 1 %lu\n", count_bits_t1(b,17));
+ printf("T 2 %lu\n", count_bits_t2(b,17));
+
+ printf("weirdness test: %lu %lu %lu %lu %lu %lu\n",
+ count_bits_pp(b,17),
+ count_bits_pp(b,17),
+ count_bits_pp(b,17),
+ count_bits_pp(b,17),
+ count_bits_pp(b,17),
+ count_bits_pp(b,17));
+}
+
+
static void usage() {
printf("edd: Entropy DDoS Detection\n\n");
printf("USAGE:\n");
printf(" $ %s [options]\n", BIN_NAME);
printf("\n");
printf(" OPTIONS:\n");
printf("\n");
printf(" -i : network device (default: eth0)\n");
printf(" -b : berkeley packet filter\n");
printf(" -d : directory to dump sessions files in\n");
printf(" -u : user\n");
printf(" -g : group\n");
printf(" -D : enables daemon mode\n");
printf(" -T : dir to chroot into\n");
printf(" -h : this help message\n");
printf(" -v : verbose\n\n");
}
static int set_chroot(void) {
char *absdir;
char *logdir;
int abslen;
/* logdir = get_abs_path(logpath); */
/* change to the directory */
if ( chdir(chroot_dir) != 0 ) {
printf("set_chroot: Can not chdir to \"%s\": %s\n",chroot_dir,strerror(errno));
}
/* always returns an absolute pathname */
absdir = getcwd(NULL, 0);
abslen = strlen(absdir);
/* make the chroot call */
if ( chroot(absdir) < 0 ) {
printf("Can not chroot to \"%s\": absolute: %s: %s\n",chroot_dir,absdir,strerror(errno));
}
if ( chdir("/") < 0 ) {
printf("Can not chdir to \"/\" after chroot: %s\n",strerror(errno));
}
return 0;
}
static int drop_privs(void) {
struct group *gr;
struct passwd *pw;
char *endptr;
int i;
int do_setuid = 0;
int do_setgid = 0;
unsigned long groupid = 0;
unsigned long userid = 0;
if ( group_name != NULL ) {
do_setgid = 1;
if( isdigit(group_name[0]) == 0 ) {
gr = getgrnam(group_name);
groupid = gr->gr_gid;
}
else {
groupid = strtoul(group_name, &endptr, 10);
}
}
if ( user_name != NULL ) {
do_setuid = 1;
do_setgid = 1;
if ( isdigit(user_name[0]) == 0 ) {
pw = getpwnam(user_name);
userid = pw->pw_uid;
} else {
userid = strtoul(user_name, &endptr, 10);
pw = getpwuid(userid);
}
if ( group_name == NULL ) {
groupid = pw->pw_gid;
}
}
if ( do_setgid ) {
if ( (i = setgid(groupid)) < 0 ) {
printf("Unable to set group ID: %s", strerror(i));
}
}
endgrent();
endpwent();
if ( do_setuid ) {
if (getuid() == 0 && initgroups(user_name, groupid) < 0 ) {
printf("Unable to init group names (%s/%lu)", user_name, groupid);
}
if ( (i = setuid(userid)) < 0 ) {
printf("Unable to set user ID: %s\n", strerror(i));
}
}
return 0;
}
static int is_valid_path(char *path) {
struct stat st;
if ( path == NULL ) {
return 0;
}
if ( stat(path, &st) != 0 ) {
return 0;
}
if ( !S_ISDIR(st.st_mode) || access(path, W_OK) == -1 ) {
return 0;
}
return 1;
}
static int create_pid_file(char *path, char *filename) {
char filepath[STDBUF];
char *fp = NULL;
char *fn = NULL;
char pid_buffer[12];
struct flock lock;
int rval;
int fd;
memset(filepath, 0, STDBUF);
if ( !filename ) {
fn = pidfile;
}
else {
fn = filename;
}
if ( !path ) {
fp = pidpath;
}
else {
fp = path;
}
if ( is_valid_path(fp) ) {
snprintf(filepath, STDBUF-1, "%s/%s", fp, fn);
}
else {
printf("PID path \"%s\" isn't a writeable directory!", fp);
}
true_pid_name = strdup(filename);
if ( (fd = open(filepath, O_CREAT | O_WRONLY,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1 ) {
return ERROR;
}
/* pid file locking */
lock.l_type = F_WRLCK;
lock.l_start = 0;
lock.l_whence = SEEK_SET;
lock.l_len = 0;
if ( fcntl(fd, F_SETLK, &lock) == -1 ) {
if ( errno == EACCES || errno == EAGAIN ) {
rval = ERROR;
}
else {
rval = ERROR;
}
close(fd);
return rval;
}
snprintf(pid_buffer, sizeof(pid_buffer), "%d\n", (int) getpid());
if ( ftruncate(fd, 0) != 0 ) { return ERROR; }
if ( write(fd, pid_buffer, strlen(pid_buffer)) != 0 ) { return ERROR; }
return SUCCESS;
}
int daemonize() {
pid_t pid;
int fd;
pid = fork();
if ( pid > 0 ) {
exit(0); /* parent */
}
use_syslog = 1;
if ( pid < 0 ) {
return ERROR;
}
/* new process group */
setsid();
/* close file handles */
if ( (fd = open("/dev/null", O_RDWR)) >= 0 ) {
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
if ( fd > 2 ) {
close(fd);
}
}
if ( pidfile ) {
return create_pid_file(pidpath, pidfile);
}
return SUCCESS;
}
int main(int argc, char *argv[]) {
int ch, fromfile, setfilter, version, drop_privs_flag, daemon_flag, chroot_flag;
int use_syslog = 0;
struct in_addr addr;
struct bpf_program cfilter;
char *bpff, errbuf[PCAP_ERRBUF_SIZE], *user_filter;
char *net_ip_string;
bpf_u_int32 net_mask;
ch = fromfile = setfilter = version = drop_privs_flag = daemon_flag = 0;
dev = "eth0";
bpff = "";
chroot_dir = "/tmp/";
dpath = "./";
inpacket = intr_flag = chroot_flag = 0;
timecnt = time(NULL);
- /* test it! */
- uint8_t b[18];
- memset((void*) b, 1, 17);
- b[17]= 0x11; // the faulty bits
-
- printf("KnR %lu\n", count_bits(b,17));
- printf("KaW %lu\n", count_bits_kw(b,17));
- printf("PaP %lu\n", count_bits_pp(b,17));
- printf("JaP %lu\n", count_bits_p(b,17));
- printf("P64 %lu\n", count_bits_64(b,17));
- printf("T 1 %lu\n", count_bits_t1(b,17));
- printf("T 2 %lu\n", count_bits_t2(b,17));
-
- printf("weirdness test: %lu %lu %lu %lu %lu %lu\n",
- count_bits_pp(b,17),
- count_bits_pp(b,17),
- count_bits_pp(b,17),
- count_bits_pp(b,17),
- count_bits_pp(b,17),
- count_bits_pp(b,17));
-
signal(SIGTERM, game_over);
signal(SIGINT, game_over);
signal(SIGQUIT, game_over);
//signal(SIGHUP, dump_active);
//signal(SIGALRM, set_end_sessions);
while ((ch = getopt(argc, argv, "b:d:DT:g:hi:p:P:u:v")) != -1)
switch (ch) {
case 'i':
dev = strdup(optarg);
break;
case 'b':
bpff = strdup(optarg);
break;
case 'v':
verbose = 1;
break;
case 'd':
dpath = strdup(optarg);
break;
case 'h':
usage();
exit(0);
break;
case 'D':
daemon_flag = 1;
break;
case 'T':
chroot_flag = 1;
break;
case 'u':
user_name = strdup(optarg);
drop_privs_flag = 1;
break;
case 'g':
group_name = strdup(optarg);
drop_privs_flag = 1;
break;
case 'p':
pidfile = strdup(optarg);
break;
case 'P':
pidpath = strdup(optarg);
break;
default:
exit(1);
break;
}
+ //test_it();
printf("[*] Running %s v %s\n", BIN_NAME, VERSION);
if (getuid()) {
printf("[*] You must be root..\n");
return (1);
}
errbuf[0] = '\0';
/* look up an availible device if non specified */
if (dev == 0x0) dev = pcap_lookupdev(errbuf);
printf("[*] Device: %s\n", dev);
if ((handle = pcap_open_live(dev, SNAPLENGTH, 1, 500, errbuf)) == NULL) {
printf("[*] Error pcap_open_live: %s \n", errbuf);
pcap_close(handle);
exit(1);
}
else if ((pcap_compile(handle, &cfilter, bpff, 1 ,net_mask)) == -1) {
printf("[*] Error pcap_compile user_filter: %s\n", pcap_geterr(handle));
pcap_close(handle);
exit(1);
}
pcap_setfilter(handle, &cfilter);
pcap_freecode(&cfilter); // filter code not needed after setfilter
/* B0rk if we see an error... */
if (strlen(errbuf) > 0) {
printf("[*] Error errbuf: %s \n", errbuf);
pcap_close(handle);
exit(1);
}
if ( chroot_flag == 1 ) {
set_chroot();
}
if(daemon_flag) {
if(!is_valid_path(pidpath)){
printf("[*] PID path \"%s\" is bad, check privilege.",pidpath);
exit(1);
}
openlog("ppacket", LOG_PID | LOG_CONS, LOG_DAEMON);
printf("[*] Daemonizing...\n\n");
daemonize(NULL);
}
if(drop_privs_flag) {
printf("[*] Dropping privs...\n\n");
drop_privs();
}
//alarm(TIMEOUT);
- printf("[*] Sniffing... need %lu packets for operation\n\n", P_WINDOW);
+ printf("[*] Charging... need %lu to operate correctly.\n\n", P_WINDOW);
pcap_loop(handle,-1,got_packet,NULL);
pcap_close(handle);
return(0);
}
|
comotion/edd
|
6a380dd4267b51decf2600c8d45922b269f705cc
|
edd: first commit
|
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..3d5e64c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+#Makefile
+
+CC=gcc
+LDFLAGS=-lpcap -lm
+CFLAGS=-O3
+DCFLAGS=-g
+PCFLAGS='-g -pg'
+ifneq (${DEBUG},)
+CFLAGS = -g -DDEBUG
+endif
+
+OBJECTS = edd.o
+
+
+all: edd
+
+edd: $(OBJECTS)
+ $(CC) $(OCFLAGS) -o $@ $(OBJECTS) $(LDFLAGS)
+
+debug:
+ ${MAKE} DEBUG=y
+
+profile:
+ ${MAKE} CFLAGS+=${PCFLAGS}
+
+clean:
+ -rm -v $(OBJECTS)
+ -rm edd
+
+indent:
+ find -type f -name '*.[ch]' | xargs indent -kr -i4 -cdb -sc -sob -ss -ncs -ts8 -nut
+
+# oldschool header file dependency checking.
+deps:
+ -rm -f deps.d
+ for i in *.c; do gcc -MM $$i >> deps.d; done
+
+ifneq ($(wildcard deps.d),)
+include deps.d
+endif
+
diff --git a/README b/README
new file mode 100644
index 0000000..485ce11
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+edd: Entropy DDoS Detector
diff --git a/edd.c b/edd.c
new file mode 100644
index 0000000..8889606
--- /dev/null
+++ b/edd.c
@@ -0,0 +1,825 @@
+/* ppacket. Detect DDOS thru entropy
+ *
+ * Author: comotion@users.sf.net
+ * Idea by breno.silva@gmail.com
+ http://lists.openinfosecfoundation.org/pipermail/oisf-wg-portscan/2009-October/000023.html
+ * Thanks to ebf0 (http://www.gamelinux.org/) whose support code is good enough.
+ * License? If U have the code U have the GPL... >:-P
+
+Entropy H(P1) + H(P2) + ... + H(Pi) > H(P1P2..Pi) => DDOS
+
+
+Pseudo code:
+ # can segment into destport or src:port:dst:port
+ for each packet
+ count set bits
+ count packet bits
+ sum_entropy = Entropy(packet);
+ track window of n last packets{
+ increase set & total bit values
+ if(H(window) > H(p1p2..pwin)
+ => DDOS!
+ }
+
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h>
+#include <signal.h>
+#include <pcap.h>
+#include <getopt.h>
+#include <time.h>
+#include <sys/types.h>
+#include <grp.h>
+#include <pwd.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <syslog.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <limits.h>
+#include <math.h>
+#include "edd.h"
+
+static int verbose, inpacket, intr_flag, use_syslog;
+
+time_t timecnt,tstamp;
+pcap_t *handle;
+static char *dev,*dpath,*chroot_dir;
+static char *group_name, *user_name, *true_pid_name;
+static char *pidfile = "edd.pid";
+static char *pidpath = "/var/run";
+static int verbose, inpacket, intr_flag, use_syslog;
+
+
+/* our window of packets */
+#define P_WINDOW 0xFF // 256
+static uint32_t p_set[P_WINDOW];
+static uint32_t p_tot[P_WINDOW];
+static double p_entropy[P_WINDOW];
+static uint32_t head = 0, tail = 0;
+static uint32_t b_tot = 0, b_set = 0;
+
+void game_over() {
+ fprintf(stderr, "it is over my friend\n");
+ if ( inpacket == 0 ) {
+ pcap_close(handle);
+ exit (0);
+ }
+ intr_flag = 1;
+}
+
+/* For each byte, for each bit: count bits. Kernighan style */
+inline uint32_t count_bits(const u_char *packet, const uint32_t p_len)
+{
+ const uint32_t *ptr = (uint32_t *) packet;
+ const uint32_t *end = (uint32_t *) (packet + p_len);
+ uint32_t v; // count the number of bits set in v
+ uint8_t c; // c accumulates the total bits set in v
+ uint32_t set_bits = 0;
+ while (ptr < end){
+ v = *ptr++;
+ for (c = 0; v; c++) {
+ v &= v - 1; // clear the least significant bit set
+ }
+ set_bits += c;
+ }
+ return set_bits;
+}
+
+/* count bits in parallel
+ * How? With magick bit patterns.
+ * Thx go to http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
+ * The B array, expressed as binary, is:
+ 0x1235467A = 01110101 00010010 10001010 11101101
+B[0] = 0x55555555 = 01010101 01010101 01010101 01010101
+B[1] = 0x33333333 = 00110011 00110011 00110011 00110011
+B[2] = 0x0F0F0F0F = 00001111 00001111 00001111 00001111
+B[3] = 0x00FF00FF = 00000000 11111111 00000000 11111111
+B[4] = 0x0000FFFF = 00000000 00000000 11111111 11111111
+
+We can adjust the method for larger integer sizes by continuing with the patterns for the Binary Magic Numbers, B and S. If there are k bits, then we need the arrays S and B to be ceil(lg(k)) elements long, and we must compute the same number of expressions for c as S or B are long. For a 32-bit v, 16 operations are used.
+ */
+inline uint32_t count_bits_p(const u_char *packet, const uint32_t p_len)
+{
+ uint32_t v, c, set_bits = 0;
+ static const int S[] = { 1, 2, 4, 8, 16};
+ static const int B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF};
+
+ const uint32_t *ptr = (uint32_t *) packet;
+ const uint32_t *end = (uint32_t *) (packet + p_len);
+ while(end > ptr){
+ v = *ptr++;
+ c = v - ((v >> 1) & B[0]);
+ c = ((c >> S[1]) & B[1]) + (c & B[1]);
+ c = ((c >> S[2]) + c) & B[2];
+ c = ((c >> S[3]) + c) & B[3];
+ c = ((c >> S[4]) + c) & B[4];
+ set_bits += c;
+ }
+ return set_bits;
+}
+
+/* this algo does 4 bytes at a time. Note! what about garbage padding? */
+uint32_t count_bits_pp(const u_char *packet, const uint32_t p_len)
+{
+ uint32_t v, set_bits = 0;
+ const uint32_t *ptr = (uint32_t *) packet;
+ const uint32_t *end = (uint32_t *) (packet + p_len);
+
+ while(end > ptr){
+ v = *ptr++;
+ //fprintf(stderr, "%08p ", v);
+ v = v - ((v >> 1) & 0x55555555); // reuse input as temporary
+ v = (v & 0x33333333) + ((v >> 2) & 0x33333333); // temp
+ set_bits += ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; // count
+ }
+ /* last N<4 bytes */
+ //uint8_t mod = p_len % 4;
+ //set_bits += count_bits((uint8_t*)ptr,p_len % 4);
+ //fprintf(stderr, "\n");
+ return set_bits;
+}
+
+/* same dog, except use 64bit datatype*/
+uint32_t count_bits_64(const u_char *packet, const uint32_t p_len)
+{
+ uint64_t v, set_bits = 0;
+ const uint64_t *ptr = (uint64_t *) packet;
+ const uint64_t *end = (uint64_t *) (packet + p_len);
+
+ while(end > ptr){
+ v = *ptr++;
+ //fprintf(stderr, "%08p ", v);
+ v = v - ((v >> 1) & 0x5555555555555555); // reuse input as temporary
+ v = (v & 0x3333333333333333) + ((v >> 2) & 0x3333333333333333); // temp
+ v = (v + (v >> 4)) & 0x0F0F0F0F0F0F0F0F;
+ set_bits += (v * 0x0101010101010101) >> (sizeof(v) - 1) * CHAR_BIT; // count
+ }
+ //set_bits += count_bits_p((uint8_t *)ptr, p_len % 4);
+ //fprintf(stderr, "\n");
+ return set_bits;
+}
+
+ /* this can be generalized if we have a 64bit or 128 bit type T
+ v = v - ((v >> 1) & (T)~(T)0/3); // temp
+ v = (v & (T)~(T)0/15*3) + ((v >> 2) & (T)~(T)0/15*3); // temp
+ v = (v + (v >> 4)) & (T)~(T)0/255*15; // temp
+ c = (T)(v * ((T)~(T)0/255)) >> (sizeof(v) - 1) * CHAR_BIT; // count
+ */
+
+/* simplistic bit-by-bit implementation */
+inline uint32_t count_bits_kw(const u_char *packet, const uint32_t p_len)
+{
+ uint32_t tmp;
+ uint32_t set_bits = 0;
+ // byte for byte
+ const u_char *ptr = packet;
+ while(ptr != packet + p_len){
+ tmp = *ptr;
+ while(tmp){
+ // isolate bit
+ set_bits += tmp & 0x1;
+ tmp >>= 1;
+ }
+ ptr++;
+ }
+ return set_bits;
+}
+
+
+/* count bits by lookup table */
+static const unsigned char BitsSetTable256[256] =
+{
+# define B2(n) n, n+1, n+1, n+2
+# define B4(n) B2(n), B2(n+1), B2(n+1), B2(n+2)
+# define B6(n) B4(n), B4(n+1), B4(n+1), B4(n+2)
+ B6(0), B6(1), B6(1), B6(2)
+};
+ /*
+ // To initially generate the table algorithmically:
+ BitsSetTable256[0] = 0;
+ for (int i = 0; i < 256; i++)
+ {
+ BitsSetTable256[i] = (i & 1) + BitsSetTable256[i / 2];
+ }
+ */
+
+
+inline uint32_t count_bits_t1(const u_char *packet, const uint32_t p_len){
+
+ uint32_t v, set_bits = 0;
+ const uint32_t *ptr = (uint32_t *) packet;
+ const uint32_t *end = (uint32_t *) (packet + p_len);
+
+ while(end >= ptr){
+ v = *ptr++; // count the number of bits set in 32-bit value v
+
+ // Option 1:
+ set_bits += BitsSetTable256[v & 0xff] +
+ BitsSetTable256[(v >> 8) & 0xff] +
+ BitsSetTable256[(v >> 16) & 0xff] +
+ BitsSetTable256[v >> 24];
+ }
+ return set_bits;
+}
+
+inline uint32_t count_bits_t2(const u_char *packet, const uint32_t p_len){
+
+ uint32_t v, set_bits = 0;
+ const uint32_t *ptr = (uint32_t *) packet;
+ const uint32_t *end = (uint32_t *) (packet + p_len);
+ unsigned char *p;
+
+ while(end >= ptr){
+ v = *ptr++; // count the number of bits set in 32-bit value v
+ //unsigned int c; // c is the total bits set in v
+
+ // Option 2:
+ p = (unsigned char *) &v;
+ set_bits += BitsSetTable256[p[0]] +
+ BitsSetTable256[p[1]] +
+ BitsSetTable256[p[2]] +
+ BitsSetTable256[p[3]];
+ }
+ return set_bits;
+}
+
+/* Could do algo selection based on best performance */
+void packet_profiler (const u_char *packet, const uint32_t p_len)
+{
+ uint64_t s, e;
+ const uint32_t p_bits = p_len*8;
+ __asm__ __volatile__("cpuid: rdtsc;" : "=A" (s) :: "ebx", "ecx", "memory");
+ uint32_t set_bits = count_bits_pp(packet, p_len);
+ __asm__ volatile("rdtsc":"=A"(e));
+ //printf("S: %llu\nD: %llu\ndiff: %lld\n", s, e, e - s);
+ printf("[PP] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
+ p_len, p_bits, set_bits);
+
+ __asm__ volatile("rdtsc":"=A"(s));
+ set_bits = count_bits_64(packet, p_len);
+ __asm__ volatile("rdtsc":"=A"(e));
+ printf("[64] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
+ p_len, p_bits, set_bits);
+
+ __asm__ volatile("rdtsc":"=A"(s));
+ set_bits = count_bits_t1(packet, p_len);
+ __asm__ volatile("rdtsc":"=A"(e));
+ printf("[T1] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
+ p_len, p_bits, set_bits);
+
+ __asm__ volatile("rdtsc":"=A"(s));
+ set_bits = count_bits_t2(packet, p_len);
+ __asm__ volatile("rdtsc":"=A"(e));
+ printf("[T2] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
+ p_len, p_bits, set_bits);
+
+ __asm__ volatile("rdtsc":"=A"(s));
+ set_bits = count_bits_p(packet, p_len);
+ __asm__ volatile("rdtsc":"=A"(e));
+ printf("[ P] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
+ p_len, p_bits, set_bits);
+
+ __asm__ volatile("rdtsc":"=A"(s));
+ set_bits = count_bits(packet, p_len);
+ __asm__ volatile("rdtsc":"=A"(e));
+ printf("[KR] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
+ p_len, p_bits, set_bits);
+
+ __asm__ volatile("rdtsc":"=A"(s));
+ set_bits = count_bits_kw(packet, p_len);
+ __asm__ volatile("rdtsc":"=A"(e));
+ printf("[KW] [%lld] Bytes: %lu, Bits: %lu, Set: %lu\n", e - s,
+ p_len, p_bits, set_bits);
+}
+
+/* calculate the simple entropy of a packet, ie
+ * assume all bits are equiprobable and randomly distributed
+ *
+ * needs work: do this with pure, positive ints?
+ * tresholds? markov chains? averaging?
+ *
+ * check this with our friend the kolmogorov
+ */
+
+double simple_entropy(double set_bits, double total_bits)
+{
+ return total_bits * (( -set_bits / total_bits )*log2(set_bits/total_bits)
+ - (1 - (set_bits / total_bits) * log2(1 - (set_bits/total_bits))))
+ + log2(total_bits);
+}
+
+static uint32_t packet_count;
+
+void got_packet (u_char *useless,const struct pcap_pkthdr *pheader, const u_char *packet)
+{
+ if ( intr_flag != 0 ) { game_over(); }
+ inpacket = 1;
+ tstamp = time(NULL);
+ const uint32_t p_len = ((pheader->len > SNAPLENGTH)?SNAPLENGTH:pheader->len);
+ const uint32_t bits = p_len*8;
+ uint32_t set = count_bits_64(packet, p_len);
+ static const double tresh = 100;
+
+ p_tot[head] = bits;
+ p_set[head] = set;
+ p_entropy[head] = simple_entropy(set, bits);
+
+ packet_count++;
+ if (packet_count < P_WINDOW) {
+ printf("[%lu] %lu/%lu, E(%f)\n", head, set, bits, p_entropy[head]);
+ } else {
+ // we have some packets for analysis
+ uint32_t k, total_set = 0, total_bits = 0;
+ double sum_entropy = 0;
+ for(k = 0; k < P_WINDOW; k++){
+ total_set += p_set[k];
+ total_bits+= p_tot[k];
+ sum_entropy += p_entropy[k];
+ }
+ double joint_entropy = simple_entropy(total_set, total_bits);
+ if(tresh < sum_entropy - joint_entropy ){
+ fprintf(stderr, "ddos attack!!! e(%f) < te(%f)\n",
+ joint_entropy, sum_entropy);
+ }else{
+ fprintf(stdout, "no news, e(%f) >= te(%f)\n",
+ joint_entropy, sum_entropy);
+ }
+ }
+
+ head = (head + 1) % P_WINDOW;
+
+
+ ether_header *eth_hdr;
+ eth_hdr = (ether_header *) (packet);
+ u_short eth_type;
+ eth_type = ntohs(eth_hdr->eth_ip_type);
+ int eth_header_len;
+ eth_header_len = ETHERNET_HEADER_LEN;
+
+ /* sample code from cxtracker
+
+ u_short p_bytes;
+ if ( eth_type == ETHERNET_TYPE_8021Q ) {
+ // printf("[*] ETHERNET TYPE 8021Q\n");
+ eth_type = ntohs(eth_hdr->eth_8_ip_type);
+ eth_header_len +=4;
+ }
+
+ else if ( eth_type == (ETHERNET_TYPE_802Q1MT|ETHERNET_TYPE_802Q1MT2|ETHERNET_TYPE_802Q1MT3|ETHERNET_TYPE_8021AD) ) {
+ // printf("[*] ETHERNET TYPE 802Q1MT\n");
+ eth_type = ntohs(eth_hdr->eth_82_ip_type);
+ eth_header_len +=8;
+ }
+
+ if ( eth_type == ETHERNET_TYPE_IP ) {
+ // printf("[*] Got IPv4 Packet...\n");
+ ip4_header *ip4;
+ ip4 = (ip4_header *) (packet + eth_header_len);
+ p_bytes = (ip4->ip_len - (IP_HL(ip4)*4));
+ struct in6_addr ip_src, ip_dst;
+ ip_src.s6_addr32[0] = ip4->ip_src;
+ ip_src.s6_addr32[1] = 0;
+ ip_src.s6_addr32[2] = 0;
+ ip_src.s6_addr32[3] = 0;
+ ip_dst.s6_addr32[0] = ip4->ip_dst;
+ ip_dst.s6_addr32[1] = 0;
+ ip_dst.s6_addr32[2] = 0;
+ ip_dst.s6_addr32[3] = 0;
+
+ if ( ip4->ip_p == IP_PROTO_TCP ) {
+ tcp_header *tcph;
+ tcph = (tcp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
+ // printf("[*] IPv4 PROTOCOL TYPE TCP:\n");
+ cx_track(ip_src, tcph->src_port, ip_dst, tcph->dst_port, ip4->ip_p, p_bytes, tcph->t_flags, tstamp, AF_INET);
+ inpacket = 0;
+ return;
+ }
+ else if (ip4->ip_p == IP_PROTO_UDP) {
+ udp_header *udph;
+ udph = (udp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
+ // printf("[*] IPv4 PROTOCOL TYPE UDP:\n");
+ cx_track(ip_src, udph->src_port, ip_dst, udph->dst_port, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
+ inpacket = 0;
+ return;
+ }
+ else if (ip4->ip_p == IP_PROTO_ICMP) {
+ icmp_header *icmph;
+ icmph = (icmp_header *) (packet + eth_header_len + (IP_HL(ip4)*4));
+ // printf("[*] IP PROTOCOL TYPE ICMP\n");
+ cx_track(ip_src, icmph->s_icmp_id, ip_dst, icmph->s_icmp_id, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
+ inpacket = 0;
+ return;
+ }
+ else {
+ // printf("[*] IPv4 PROTOCOL TYPE OTHER: %d\n",ip4->ip_p);
+ cx_track(ip_src, ip4->ip_p, ip_dst, ip4->ip_p, ip4->ip_p, p_bytes, 0, tstamp, AF_INET);
+ inpacket = 0;
+ return;
+ }
+ }
+
+ else if ( eth_type == ETHERNET_TYPE_IPV6) {
+ // printf("[*] Got IPv6 Packet...\n");
+ ip6_header *ip6;
+ ip6 = (ip6_header *) (packet + eth_header_len);
+ if ( ip6->next == IP_PROTO_TCP ) {
+ tcp_header *tcph;
+ tcph = (tcp_header *) (packet + eth_header_len + IP6_HEADER_LEN);
+ // printf("[*] IPv6 PROTOCOL TYPE TCP:\n");
+ cx_track(ip6->ip_src, tcph->src_port, ip6->ip_dst, tcph->dst_port, ip6->next, ip6->len, tcph->t_flags, tstamp, AF_INET6);
+ inpacket = 0;
+ return;
+ }
+ else if (ip6->next == IP_PROTO_UDP) {
+ udp_header *udph;
+ udph = (udp_header *) (packet + eth_header_len + IP6_HEADER_LEN);
+ // printf("[*] IPv6 PROTOCOL TYPE UDP:\n");
+ cx_track(ip6->ip_src, udph->src_port, ip6->ip_dst, udph->dst_port, ip6->next, ip6->len, 0, tstamp, AF_INET6);
+ inpacket = 0;
+ return;
+ }
+ else if (ip6->next == IP6_PROTO_ICMP) {
+ icmp6_header *icmph;
+ icmph = (icmp6_header *) (packet + eth_header_len + IP6_HEADER_LEN);
+ // printf("[*] IPv6 PROTOCOL TYPE ICMP\n");
+ cx_track(ip6->ip_src, ip6->hop_lmt, ip6->ip_dst, ip6->hop_lmt, ip6->next, ip6->len, 0, tstamp, AF_INET6);
+ inpacket = 0;
+ return;
+ }
+ else {
+ // printf("[*] IPv6 PROTOCOL TYPE OTHER: %d\n",ip6->next);
+ cx_track(ip6->ip_src, ip6->next, ip6->ip_dst, ip6->next, ip6->next, ip6->len, 0, tstamp, AF_INET6);
+ inpacket = 0;
+ return;
+ }
+ }
+ */
+ inpacket = 0;
+ return;
+}
+static void usage() {
+ printf("edd: Entropy DDoS Detection\n\n");
+ printf("USAGE:\n");
+ printf(" $ %s [options]\n", BIN_NAME);
+ printf("\n");
+ printf(" OPTIONS:\n");
+ printf("\n");
+ printf(" -i : network device (default: eth0)\n");
+ printf(" -b : berkeley packet filter\n");
+ printf(" -d : directory to dump sessions files in\n");
+ printf(" -u : user\n");
+ printf(" -g : group\n");
+ printf(" -D : enables daemon mode\n");
+ printf(" -T : dir to chroot into\n");
+ printf(" -h : this help message\n");
+ printf(" -v : verbose\n\n");
+}
+
+static int set_chroot(void) {
+ char *absdir;
+ char *logdir;
+ int abslen;
+
+ /* logdir = get_abs_path(logpath); */
+
+ /* change to the directory */
+ if ( chdir(chroot_dir) != 0 ) {
+ printf("set_chroot: Can not chdir to \"%s\": %s\n",chroot_dir,strerror(errno));
+ }
+
+ /* always returns an absolute pathname */
+ absdir = getcwd(NULL, 0);
+ abslen = strlen(absdir);
+
+ /* make the chroot call */
+ if ( chroot(absdir) < 0 ) {
+ printf("Can not chroot to \"%s\": absolute: %s: %s\n",chroot_dir,absdir,strerror(errno));
+ }
+
+ if ( chdir("/") < 0 ) {
+ printf("Can not chdir to \"/\" after chroot: %s\n",strerror(errno));
+ }
+
+ return 0;
+}
+
+static int drop_privs(void) {
+ struct group *gr;
+ struct passwd *pw;
+ char *endptr;
+ int i;
+ int do_setuid = 0;
+ int do_setgid = 0;
+ unsigned long groupid = 0;
+ unsigned long userid = 0;
+
+ if ( group_name != NULL ) {
+ do_setgid = 1;
+ if( isdigit(group_name[0]) == 0 ) {
+ gr = getgrnam(group_name);
+ groupid = gr->gr_gid;
+ }
+ else {
+ groupid = strtoul(group_name, &endptr, 10);
+ }
+ }
+
+ if ( user_name != NULL ) {
+ do_setuid = 1;
+ do_setgid = 1;
+ if ( isdigit(user_name[0]) == 0 ) {
+ pw = getpwnam(user_name);
+ userid = pw->pw_uid;
+ } else {
+ userid = strtoul(user_name, &endptr, 10);
+ pw = getpwuid(userid);
+ }
+
+ if ( group_name == NULL ) {
+ groupid = pw->pw_gid;
+ }
+ }
+
+ if ( do_setgid ) {
+ if ( (i = setgid(groupid)) < 0 ) {
+ printf("Unable to set group ID: %s", strerror(i));
+ }
+ }
+
+ endgrent();
+ endpwent();
+
+ if ( do_setuid ) {
+ if (getuid() == 0 && initgroups(user_name, groupid) < 0 ) {
+ printf("Unable to init group names (%s/%lu)", user_name, groupid);
+ }
+ if ( (i = setuid(userid)) < 0 ) {
+ printf("Unable to set user ID: %s\n", strerror(i));
+ }
+ }
+ return 0;
+}
+
+static int is_valid_path(char *path) {
+ struct stat st;
+
+ if ( path == NULL ) {
+ return 0;
+ }
+ if ( stat(path, &st) != 0 ) {
+ return 0;
+ }
+ if ( !S_ISDIR(st.st_mode) || access(path, W_OK) == -1 ) {
+ return 0;
+ }
+ return 1;
+}
+
+static int create_pid_file(char *path, char *filename) {
+ char filepath[STDBUF];
+ char *fp = NULL;
+ char *fn = NULL;
+ char pid_buffer[12];
+ struct flock lock;
+ int rval;
+ int fd;
+
+ memset(filepath, 0, STDBUF);
+
+ if ( !filename ) {
+ fn = pidfile;
+ }
+ else {
+ fn = filename;
+ }
+
+ if ( !path ) {
+ fp = pidpath;
+ }
+ else {
+ fp = path;
+ }
+
+ if ( is_valid_path(fp) ) {
+ snprintf(filepath, STDBUF-1, "%s/%s", fp, fn);
+ }
+ else {
+ printf("PID path \"%s\" isn't a writeable directory!", fp);
+ }
+
+ true_pid_name = strdup(filename);
+
+ if ( (fd = open(filepath, O_CREAT | O_WRONLY,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1 ) {
+ return ERROR;
+ }
+
+ /* pid file locking */
+ lock.l_type = F_WRLCK;
+ lock.l_start = 0;
+ lock.l_whence = SEEK_SET;
+ lock.l_len = 0;
+
+ if ( fcntl(fd, F_SETLK, &lock) == -1 ) {
+ if ( errno == EACCES || errno == EAGAIN ) {
+ rval = ERROR;
+ }
+ else {
+ rval = ERROR;
+ }
+ close(fd);
+ return rval;
+ }
+
+ snprintf(pid_buffer, sizeof(pid_buffer), "%d\n", (int) getpid());
+ if ( ftruncate(fd, 0) != 0 ) { return ERROR; }
+ if ( write(fd, pid_buffer, strlen(pid_buffer)) != 0 ) { return ERROR; }
+ return SUCCESS;
+}
+int daemonize() {
+ pid_t pid;
+ int fd;
+
+ pid = fork();
+
+ if ( pid > 0 ) {
+ exit(0); /* parent */
+ }
+
+ use_syslog = 1;
+ if ( pid < 0 ) {
+ return ERROR;
+ }
+
+ /* new process group */
+ setsid();
+
+ /* close file handles */
+ if ( (fd = open("/dev/null", O_RDWR)) >= 0 ) {
+ dup2(fd, 0);
+ dup2(fd, 1);
+ dup2(fd, 2);
+ if ( fd > 2 ) {
+ close(fd);
+ }
+ }
+
+ if ( pidfile ) {
+ return create_pid_file(pidpath, pidfile);
+ }
+
+ return SUCCESS;
+}
+
+int main(int argc, char *argv[]) {
+
+ int ch, fromfile, setfilter, version, drop_privs_flag, daemon_flag, chroot_flag;
+ int use_syslog = 0;
+ struct in_addr addr;
+ struct bpf_program cfilter;
+ char *bpff, errbuf[PCAP_ERRBUF_SIZE], *user_filter;
+ char *net_ip_string;
+ bpf_u_int32 net_mask;
+ ch = fromfile = setfilter = version = drop_privs_flag = daemon_flag = 0;
+ dev = "eth0";
+ bpff = "";
+ chroot_dir = "/tmp/";
+ dpath = "./";
+ inpacket = intr_flag = chroot_flag = 0;
+ timecnt = time(NULL);
+
+ /* test it! */
+ uint8_t b[18];
+ memset((void*) b, 1, 17);
+ b[17]= 0x11; // the faulty bits
+
+ printf("KnR %lu\n", count_bits(b,17));
+ printf("KaW %lu\n", count_bits_kw(b,17));
+ printf("PaP %lu\n", count_bits_pp(b,17));
+ printf("JaP %lu\n", count_bits_p(b,17));
+ printf("P64 %lu\n", count_bits_64(b,17));
+ printf("T 1 %lu\n", count_bits_t1(b,17));
+ printf("T 2 %lu\n", count_bits_t2(b,17));
+
+ printf("weirdness test: %lu %lu %lu %lu %lu %lu\n",
+ count_bits_pp(b,17),
+ count_bits_pp(b,17),
+ count_bits_pp(b,17),
+ count_bits_pp(b,17),
+ count_bits_pp(b,17),
+ count_bits_pp(b,17));
+
+ signal(SIGTERM, game_over);
+ signal(SIGINT, game_over);
+ signal(SIGQUIT, game_over);
+ //signal(SIGHUP, dump_active);
+ //signal(SIGALRM, set_end_sessions);
+
+ while ((ch = getopt(argc, argv, "b:d:DT:g:hi:p:P:u:v")) != -1)
+ switch (ch) {
+ case 'i':
+ dev = strdup(optarg);
+ break;
+ case 'b':
+ bpff = strdup(optarg);
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case 'd':
+ dpath = strdup(optarg);
+ break;
+ case 'h':
+ usage();
+ exit(0);
+ break;
+ case 'D':
+ daemon_flag = 1;
+ break;
+ case 'T':
+ chroot_flag = 1;
+ break;
+ case 'u':
+ user_name = strdup(optarg);
+ drop_privs_flag = 1;
+ break;
+ case 'g':
+ group_name = strdup(optarg);
+ drop_privs_flag = 1;
+ break;
+ case 'p':
+ pidfile = strdup(optarg);
+ break;
+ case 'P':
+ pidpath = strdup(optarg);
+ break;
+ default:
+ exit(1);
+ break;
+ }
+
+ printf("[*] Running %s v %s\n", BIN_NAME, VERSION);
+
+
+ if (getuid()) {
+ printf("[*] You must be root..\n");
+ return (1);
+ }
+
+ errbuf[0] = '\0';
+ /* look up an availible device if non specified */
+ if (dev == 0x0) dev = pcap_lookupdev(errbuf);
+ printf("[*] Device: %s\n", dev);
+
+ if ((handle = pcap_open_live(dev, SNAPLENGTH, 1, 500, errbuf)) == NULL) {
+ printf("[*] Error pcap_open_live: %s \n", errbuf);
+ pcap_close(handle);
+ exit(1);
+ }
+ else if ((pcap_compile(handle, &cfilter, bpff, 1 ,net_mask)) == -1) {
+ printf("[*] Error pcap_compile user_filter: %s\n", pcap_geterr(handle));
+ pcap_close(handle);
+ exit(1);
+ }
+
+ pcap_setfilter(handle, &cfilter);
+ pcap_freecode(&cfilter); // filter code not needed after setfilter
+
+ /* B0rk if we see an error... */
+ if (strlen(errbuf) > 0) {
+ printf("[*] Error errbuf: %s \n", errbuf);
+ pcap_close(handle);
+ exit(1);
+ }
+
+ if ( chroot_flag == 1 ) {
+ set_chroot();
+ }
+
+ if(daemon_flag) {
+ if(!is_valid_path(pidpath)){
+ printf("[*] PID path \"%s\" is bad, check privilege.",pidpath);
+ exit(1);
+ }
+ openlog("ppacket", LOG_PID | LOG_CONS, LOG_DAEMON);
+ printf("[*] Daemonizing...\n\n");
+ daemonize(NULL);
+ }
+
+ if(drop_privs_flag) {
+ printf("[*] Dropping privs...\n\n");
+ drop_privs();
+ }
+
+ //alarm(TIMEOUT);
+ printf("[*] Sniffing... need %lu packets for operation\n\n", P_WINDOW);
+ pcap_loop(handle,-1,got_packet,NULL);
+
+ pcap_close(handle);
+ return(0);
+}
diff --git a/edd.h b/edd.h
new file mode 100644
index 0000000..7eb928d
--- /dev/null
+++ b/edd.h
@@ -0,0 +1,293 @@
+/*
+** This file is a part of edd.
+**
+** Copyright (C) 2009, Kacper Wysocki <kacper.wysocki@redpill-linpro.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+*/
+
+/* D E F I N E S *****************************************************/
+#define BIN_NAME "edd"
+#define VERSION "0.0.1"
+#define SNAPLENGTH 1600
+
+#define ETHERNET_TYPE_IP 0x0800
+#define ETHERNET_TYPE_ARP 0x0806
+#define ETHERNET_TYPE_IPV6 0x86dd
+#define ETHERNET_TYPE_8021Q 0x8100
+#define ETHERNET_TYPE_802Q1MT 0x9100
+#define ETHERNET_TYPE_802Q1MT2 0x9200
+#define ETHERNET_TYPE_802Q1MT3 0x9300
+#define ETHERNET_TYPE_8021AD 0x88a8
+
+#define IP_PROTO_TCP 6
+#define IP_PROTO_UDP 17
+#define IP_PROTO_ICMP 1
+#define IP6_PROTO_ICMP 58
+
+#define IP4_HEADER_LEN 20
+#define IP6_HEADER_LEN 40
+#define TCP_HEADER_LEN 20
+#define UDP_HEADER_LEN 8
+#define ICMP_HEADER_LEN 4
+#define ETHERNET_HEADER_LEN 14
+#define ETHERNET_8021Q_HEADER_LEN 18
+#define ETHERNET_802Q1MT_HEADER_LEN 22
+
+#define TF_FIN 0x01
+#define TF_SYN 0x02
+#define TF_RST 0x04
+#define TF_PUSH 0x08
+#define TF_ACK 0x10
+#define TF_URG 0x20
+#define TF_ECE 0x40
+#define TF_CWR 0x80
+#define TF_SYNACK 0x12
+#define TF_NORESERVED (TF_FIN|TF_SYN|TF_RST|TF_PUSH|TF_ACK|TF_URG)
+#define TF_FLAGS (TF_FIN|TF_SYN|TF_RST|TF_ACK|TF_URG|TF_ECE|TF_CWR)
+
+#define SUCCESS 0
+#define ERROR 1
+#define STDBUF 1024
+
+/* D A T A S T R U C T U R E S *********************************************/
+
+/*
+ * Ethernet header
+ */
+
+typedef struct _ether_header {
+ u_char ether_dst[6]; /* destination MAC */
+ u_char ether_src[6]; /* source MAC */
+
+ union
+ {
+ struct etht
+ {
+ u_short ether_type; /* ethernet type (normal) */
+ } etht;
+
+ struct qt
+ {
+ u_short eth_t_8021; /* ethernet type/802.1Q tag */
+ u_short eth_t_8_vid;
+ u_short eth_t_8_type;
+ } qt;
+
+ struct qot
+ {
+ u_short eth_t_80212; /* ethernet type/802.1QinQ */
+ u_short eth_t_82_mvid;
+ u_short eth_t_82_8021;
+ u_short eth_t_82_vid;
+ u_short eth_t_82_type;
+ } qot;
+ } vlantag;
+
+ #define eth_ip_type vlantag.etht.ether_type
+
+ #define eth_8_type vlantag.qt.eth_t_8021
+ #define eth_8_vid vlantag.qt.eth_t_8_vid
+ #define eth_8_ip_type vlantag.qt.eth_t_8_type
+
+ #define eth_82_type vlantag.qot.eth_t_80212
+ #define eth_82_mvid vlantag.qot.eth_t_82_mvid
+ #define eth_82_8021 vlantag.qot.eth_t_82_8021
+ #define eth_82_vid vlantag.qot.eth_t_82_vid
+ #define eth_82_ip_type vlantag.qot.eth_t_82_type
+
+} ether_header;
+
+/*
+ * IPv4 header
+ */
+
+typedef struct _ip4_header {
+ uint8_t ip_vhl; /* version << 4 | header length >> 2 */
+ uint8_t ip_tos; /* type of service */
+ uint16_t ip_len; /* total length */
+ uint16_t ip_id; /* identification */
+ uint16_t ip_off; /* fragment offset field */
+ uint8_t ip_ttl; /* time to live */
+ uint8_t ip_p; /* protocol */
+ uint16_t ip_csum; /* checksum */
+ uint32_t ip_src; /* source address */
+ uint32_t ip_dst; /* dest address */
+} ip4_header;
+
+#define IP_RF 0x8000 /* reserved fragment flag */
+#define IP_DF 0x4000 /* dont fragment flag */
+#define IP_MF 0x2000 /* more fragments flag */
+#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
+#define IP_HL(ip4_header) (((ip4_header)->ip_vhl) & 0x0f)
+#define IP_V(ip4_header) (((ip4_header)->ip_vhl) >> 4)
+
+/*
+ * IPv6 header
+ */
+
+typedef struct _ip6_header {
+ uint32_t vcl; /* version, class, and label */
+ uint16_t len; /* length of the payload */
+ uint8_t next; /* next header
+ * Uses the same flags as
+ * the IPv4 protocol field */
+ uint8_t hop_lmt; /* hop limit */
+ struct in6_addr ip_src; /* source address */
+ struct in6_addr ip_dst; /* dest address */
+} ip6_header;
+
+/*
+ * TCP header
+ */
+
+typedef struct _tcp_header {
+ uint16_t src_port; /* source port */
+ uint16_t dst_port; /* destination port */
+ uint32_t t_seq; /* sequence number */
+ uint32_t t_ack; /* acknowledgement number */
+ uint8_t t_offx2; /* data offset, rsvd */
+ uint8_t t_flags; /* tcp flags */
+ uint16_t t_win; /* window */
+ uint16_t t_csum; /* checksum */
+ uint16_t t_urgp; /* urgent pointer */
+} tcp_header;
+
+#define TCP_OFFSET(tcp_header) (((tcp_header)->t_offx2 & 0xf0) >> 4)
+#define TCP_X2(tcp_header) ((tcp_header)->t_offx2 & 0x0f)
+#define TCP_ISFLAGSET(tcp_header, flags) (((tcp_header)->t_flags & (flags)) == (flags))
+
+/*
+ * UDP header
+ */
+
+typedef struct _udp_header {
+ uint16_t src_port; /* source port */
+ uint16_t dst_port; /* destination port */
+ uint16_t len; /* length of the payload */
+ uint16_t csum; /* checksum */
+} udp_header;
+
+/*
+ * ICMP header
+ */
+
+typedef struct _icmp_header {
+ uint8_t type;
+ uint8_t code;
+ uint16_t csum;
+ union
+ {
+ uint8_t pptr;
+
+ struct in_addr gwaddr;
+
+ struct idseq
+ {
+ uint16_t id;
+ uint16_t seq;
+ } idseq;
+
+ int sih_void;
+
+ struct pmtu
+ {
+ uint16_t ipm_void;
+ uint16_t nextmtu;
+ } pmtu;
+
+ struct rtradv
+ {
+ uint8_t num_addrs;
+ uint8_t wpa;
+ uint16_t lifetime;
+ } rtradv;
+ } icmp_hun;
+
+#define s_icmp_pptr icmp_hun.pptr
+#define s_icmp_gwaddr icmp_hun.gwaddr
+#define s_icmp_id icmp_hun.idseq.id
+#define s_icmp_seq icmp_hun.idseq.seq
+#define s_icmp_void icmp_hun.sih_void
+#define s_icmp_pmvoid icmp_hun.pmtu.ipm_void
+#define s_icmp_nextmtu icmp_hun.pmtu.nextmtu
+#define s_icmp_num_addrs icmp_hun.rtradv.num_addrs
+#define s_icmp_wpa icmp_hun.rtradv.wpa
+#define s_icmp_lifetime icmp_hun.rtradv.lifetime
+
+ union
+ {
+ /* timestamp */
+ struct ts
+ {
+ uint32_t otime;
+ uint32_t rtime;
+ uint32_t ttime;
+ } ts;
+
+ /* IP header for unreach */
+ struct ih_ip
+ {
+ ip4_header *ip;
+ /* options and then 64 bits of data */
+ } ip;
+
+ struct ra_addr
+ {
+ uint32_t addr;
+ uint32_t preference;
+ } radv;
+
+ uint32_t mask;
+
+ char data[1];
+
+ } icmp_dun;
+#define s_icmp_otime icmp_dun.ts.otime
+#define s_icmp_rtime icmp_dun.ts.rtime
+#define s_icmp_ttime icmp_dun.ts.ttime
+#define s_icmp_ip icmp_dun.ih_ip
+#define s_icmp_radv icmp_dun.radv
+#define s_icmp_mask icmp_dun.mask
+#define s_icmp_data icmp_dun.data
+} icmp_header;
+
+typedef struct _icmp6_header {
+ uint8_t type; /* type field */
+ uint8_t code; /* code field */
+ uint16_t csum; /* checksum field */
+ union
+ {
+ uint32_t icmp6_data32[1]; /* type-specific field */
+ uint16_t icmp6_data16[2]; /* type-specific field */
+ uint8_t icmp6_data8[4]; /* type-specific field */
+ } icmp6_data;
+ #define icmp6_id icmp6_data.icmp6_data16[0] /* echo request/reply */
+ #define icmp6_seq icmp6_data.icmp6_data16[1] /* echo request/reply */
+} icmp6_header;
+
+#define ICMP6_UNREACH 1
+#define ICMP6_BIG 2
+#define ICMP6_TIME 3
+#define ICMP6_PARAMS 4
+#define ICMP6_ECHO 128
+#define ICMP6_REPLY 129
+
+/* Minus 1 due to the 'body' field */
+#define ICMP6_MIN_HEADER_LEN (sizeof(ICMP6Hdr) )
+
+/* P R O T O T Y P E S ******************************************************/
+
|
lordxist/groupable_attributes
|
729a62fe95dd4454db594bf15e799a3fb41d14ba
|
severe find bugfix
|
diff --git a/lib/active_record/groupable_attributes.rb b/lib/active_record/groupable_attributes.rb
index 9ad0583..f6102ad 100644
--- a/lib/active_record/groupable_attributes.rb
+++ b/lib/active_record/groupable_attributes.rb
@@ -1,81 +1,83 @@
module ActiveRecord
module GroupableAttributes
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
class << self
alias_method_chain :find, :collection_selection
end
end
end
# Useful for grouping together some of your model's attributes.
#
# class Comment < ActiveRecord::Base
# attribute_collection :restricted, [:name, :email]
# end
#
# comment = Comment.new(:name => "Paul", :email => "paul@example.com", :content => "blub")
# comment.restricted #=> { :name => "Paul", :email => "paul@example.com" }
#
# You can also select only a given collection using the find option :select_collection.
# This is a wrapper for :select.
#
# Comment.create(:name => "Paul", :email => "paul@example.com", :content => "blub")
# comment = Comment.first(:select_collection => :restricted)
# comment.attributes #=> { "name" => "Paul", "email" => "paul@example.com" }
#
# This will raise an exception if the collection doesn't exist.
#
module ClassMethods
# Use this method to group together some of your model's attributes.
#
# ==== Parameters
#
# * +name+ - The collection's name.
# * +attribute_name+ - The names of the attributes to be collected.
#
def attribute_collection(name, attribute_names)
name = name.to_sym
if respond_to?(name, true)
logger.warn "Creating attribute collection :#{name}. " \
"Overwriting existing method #{self.name}.#{name}."
end
attribute_collections[name] = attribute_names
define_method name do
collection = {}
attribute_names.each do |attribute_name|
attribute_name = attribute_name.to_sym
collection[attribute_name] = self[attribute_name]
end
collection
end
end
def attribute_collections
read_inheritable_attribute(:attribute_collections) || write_inheritable_attribute(:attribute_collections, {})
end
private
def find_with_collection_selection(*args)
options = args.extract_options!
- raise "No attribute collection named #{options[:select_collection]}" unless attribute_collections[options[:select_collection]]
- attribute_collections[options[:select_collection]].each do |attribute_name|
- unless options[:select]
- options[:select] = attribute_name.to_s
- else
- options[:select] += ", " + attribute_name.to_s
+ if options[:select_collection]
+ raise "No attribute collection named #{options[:select_collection]}" unless attribute_collections[options[:select_collection]]
+ attribute_collections[options[:select_collection]].each do |attribute_name|
+ unless options[:select]
+ options[:select] = attribute_name.to_s
+ else
+ options[:select] += ", " + attribute_name.to_s
+ end
end
+ options.delete(:select_collection)
end
- options.delete(:select_collection)
args << options
find_without_collection_selection(*args)
end
end
end
end
\ No newline at end of file
|
lordxist/groupable_attributes
|
7134996508af6ea1265ca613427cc71a4d444b4c
|
added exception at select when collection doesn't exist
|
diff --git a/lib/active_record/groupable_attributes.rb b/lib/active_record/groupable_attributes.rb
index 3337a35..9ad0583 100644
--- a/lib/active_record/groupable_attributes.rb
+++ b/lib/active_record/groupable_attributes.rb
@@ -1,78 +1,81 @@
module ActiveRecord
module GroupableAttributes
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
class << self
alias_method_chain :find, :collection_selection
end
end
end
# Useful for grouping together some of your model's attributes.
#
# class Comment < ActiveRecord::Base
# attribute_collection :restricted, [:name, :email]
# end
#
# comment = Comment.new(:name => "Paul", :email => "paul@example.com", :content => "blub")
# comment.restricted #=> { :name => "Paul", :email => "paul@example.com" }
#
# You can also select only a given collection using the find option :select_collection.
# This is a wrapper for :select.
#
# Comment.create(:name => "Paul", :email => "paul@example.com", :content => "blub")
# comment = Comment.first(:select_collection => :restricted)
# comment.attributes #=> { "name" => "Paul", "email" => "paul@example.com" }
#
+ # This will raise an exception if the collection doesn't exist.
+ #
module ClassMethods
# Use this method to group together some of your model's attributes.
#
# ==== Parameters
#
# * +name+ - The collection's name.
# * +attribute_name+ - The names of the attributes to be collected.
#
def attribute_collection(name, attribute_names)
name = name.to_sym
if respond_to?(name, true)
logger.warn "Creating attribute collection :#{name}. " \
"Overwriting existing method #{self.name}.#{name}."
end
attribute_collections[name] = attribute_names
define_method name do
collection = {}
attribute_names.each do |attribute_name|
attribute_name = attribute_name.to_sym
collection[attribute_name] = self[attribute_name]
end
collection
end
end
def attribute_collections
read_inheritable_attribute(:attribute_collections) || write_inheritable_attribute(:attribute_collections, {})
end
private
def find_with_collection_selection(*args)
options = args.extract_options!
+ raise "No attribute collection named #{options[:select_collection]}" unless attribute_collections[options[:select_collection]]
attribute_collections[options[:select_collection]].each do |attribute_name|
unless options[:select]
options[:select] = attribute_name.to_s
else
options[:select] += ", " + attribute_name.to_s
end
end
options.delete(:select_collection)
args << options
find_without_collection_selection(*args)
end
end
end
end
\ No newline at end of file
|
lordxist/groupable_attributes
|
c2eadf79fa2a4f0e19792f96b67113d8d82612b4
|
added find option for collection selection
|
diff --git a/lib/active_record/groupable_attributes.rb b/lib/active_record/groupable_attributes.rb
index fd74e94..3337a35 100644
--- a/lib/active_record/groupable_attributes.rb
+++ b/lib/active_record/groupable_attributes.rb
@@ -1,44 +1,78 @@
module ActiveRecord
module GroupableAttributes
def self.included(base)
base.extend(ClassMethods)
+ base.class_eval do
+ class << self
+ alias_method_chain :find, :collection_selection
+ end
+ end
end
+ # Useful for grouping together some of your model's attributes.
+ #
+ # class Comment < ActiveRecord::Base
+ # attribute_collection :restricted, [:name, :email]
+ # end
+ #
+ # comment = Comment.new(:name => "Paul", :email => "paul@example.com", :content => "blub")
+ # comment.restricted #=> { :name => "Paul", :email => "paul@example.com" }
+ #
+ # You can also select only a given collection using the find option :select_collection.
+ # This is a wrapper for :select.
+ #
+ # Comment.create(:name => "Paul", :email => "paul@example.com", :content => "blub")
+ # comment = Comment.first(:select_collection => :restricted)
+ # comment.attributes #=> { "name" => "Paul", "email" => "paul@example.com" }
+ #
module ClassMethods
# Use this method to group together some of your model's attributes.
#
# ==== Parameters
#
# * +name+ - The collection's name.
# * +attribute_name+ - The names of the attributes to be collected.
#
- # ==== Examples
- #
- # class Comment < ActiveRecord::Base
- # attribute_collection :restricted, [:name, :email]
- # end
- #
- # comment = Comment.new(:name => "Paul", :email => "paul@example.com", :content => "blub")
- # comment.restricted #=> { :name => "Paul", :email => "paul@example.com" }
- #
def attribute_collection(name, attribute_names)
name = name.to_sym
if respond_to?(name, true)
logger.warn "Creating attribute collection :#{name}. " \
"Overwriting existing method #{self.name}.#{name}."
end
+ attribute_collections[name] = attribute_names
+
define_method name do
collection = {}
attribute_names.each do |attribute_name|
attribute_name = attribute_name.to_sym
collection[attribute_name] = self[attribute_name]
end
collection
end
end
+ def attribute_collections
+ read_inheritable_attribute(:attribute_collections) || write_inheritable_attribute(:attribute_collections, {})
+ end
+
+ private
+ def find_with_collection_selection(*args)
+ options = args.extract_options!
+ attribute_collections[options[:select_collection]].each do |attribute_name|
+ unless options[:select]
+ options[:select] = attribute_name.to_s
+ else
+ options[:select] += ", " + attribute_name.to_s
+ end
+ end
+ options.delete(:select_collection)
+ args << options
+
+ find_without_collection_selection(*args)
+ end
+
end
end
end
\ No newline at end of file
diff --git a/rdoc/classes/ActiveRecord/GroupableAttributes.html b/rdoc/classes/ActiveRecord/GroupableAttributes.html
index 547d6de..0169558 100644
--- a/rdoc/classes/ActiveRecord/GroupableAttributes.html
+++ b/rdoc/classes/ActiveRecord/GroupableAttributes.html
@@ -1,146 +1,151 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActiveRecord::GroupableAttributes</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActiveRecord::GroupableAttributes</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/lib/active_record/groupable_attributes_rb.html">
lib/active_record/groupable_attributes.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000001">included</a>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="GroupableAttributes/ClassMethods.html" class="link">ActiveRecord::GroupableAttributes::ClassMethods</a><br />
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000001" class="method-detail">
<a name="M000001"></a>
<div class="method-heading">
<a href="#M000001" class="method-signature">
<span class="method-name">included</span><span class="method-args">(base)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000001-source">
<pre>
- <span class="ruby-comment cmt"># File lib/active_record/groupable_attributes.rb, line 3</span>
-3: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
-4: <span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">ClassMethods</span>)
-5: <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># File lib/active_record/groupable_attributes.rb, line 3</span>
+ 3: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
+ 4: <span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">ClassMethods</span>)
+ 5: <span class="ruby-identifier">base</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
+ 6: <span class="ruby-keyword kw">class</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span>
+ 7: <span class="ruby-identifier">alias_method_chain</span> <span class="ruby-identifier">:find</span>, <span class="ruby-identifier">:collection_selection</span>
+ 8: <span class="ruby-keyword kw">end</span>
+ 9: <span class="ruby-keyword kw">end</span>
+10: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>
\ No newline at end of file
diff --git a/rdoc/classes/ActiveRecord/GroupableAttributes/ClassMethods.html b/rdoc/classes/ActiveRecord/GroupableAttributes/ClassMethods.html
index 8f5cd7f..0b52150 100644
--- a/rdoc/classes/ActiveRecord/GroupableAttributes/ClassMethods.html
+++ b/rdoc/classes/ActiveRecord/GroupableAttributes/ClassMethods.html
@@ -1,175 +1,215 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActiveRecord::GroupableAttributes::ClassMethods</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActiveRecord::GroupableAttributes::ClassMethods</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/active_record/groupable_attributes_rb.html">
lib/active_record/groupable_attributes.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
+ <div id="description">
+ <p>
+Useful for grouping together some of your model‘s attributes.
+</p>
+<pre>
+ class Comment < ActiveRecord::Base
+ attribute_collection :restricted, [:name, :email]
+ end
+
+ comment = Comment.new(:name => "Paul", :email => "paul@example.com", :content => "blub")
+ comment.restricted #=> { :name => "Paul", :email => "paul@example.com" }
+</pre>
+<p>
+You can also select only a given collection using the find option
+:select_collection. This is a wrapper for :select.
+</p>
+<pre>
+ Comment.create(:name => "Paul", :email => "paul@example.com", :content => "blub")
+ comment = Comment.first(:select_collection => :restricted)
+ comment.attributes #=> { "name" => "Paul", "email" => "paul@example.com" }
+</pre>
+
+ </div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000002">attribute_collection</a>
+ <a href="#M000003">attribute_collections</a>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000002" class="method-detail">
<a name="M000002"></a>
<div class="method-heading">
<a href="#M000002" class="method-signature">
<span class="method-name">attribute_collection</span><span class="method-args">(name, attribute_names)</span>
</a>
</div>
<div class="method-description">
<p>
Use this method to group together some of your model‘s attributes.
</p>
<h4>Parameters</h4>
<ul>
<li><tt>name</tt> - The collection‘s name.
</li>
<li><tt>attribute_name</tt> - The names of the attributes to be collected.
</li>
</ul>
-<h4>Examples</h4>
-<pre>
- class Comment < ActiveRecord::Base
- attribute_collection :restricted, [:name, :email]
- end
-
- comment = Comment.new(:name => "Paul", :email => "paul@example.com", :content => "blub")
- comment.restricted #=> { :name => "Paul", :email => "paul@example.com" }
-</pre>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000002-source">
<pre>
- <span class="ruby-comment cmt"># File lib/active_record/groupable_attributes.rb, line 24</span>
-24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attribute_collection</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">attribute_names</span>)
-25: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>
-26:
-27: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">name</span>, <span class="ruby-keyword kw">true</span>)
-28: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span> <span class="ruby-node">"Creating attribute collection :#{name}. "</span> \
-29: <span class="ruby-node">"Overwriting existing method #{self.name}.#{name}."</span>
-30: <span class="ruby-keyword kw">end</span>
-31:
-32: <span class="ruby-identifier">define_method</span> <span class="ruby-identifier">name</span> <span class="ruby-keyword kw">do</span>
-33: <span class="ruby-identifier">collection</span> = {}
-34: <span class="ruby-identifier">attribute_names</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attribute_name</span><span class="ruby-operator">|</span>
-35: <span class="ruby-identifier">attribute_name</span> = <span class="ruby-identifier">attribute_name</span>.<span class="ruby-identifier">to_sym</span>
-36: <span class="ruby-identifier">collection</span>[<span class="ruby-identifier">attribute_name</span>] = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">attribute_name</span>]
-37: <span class="ruby-keyword kw">end</span>
-38: <span class="ruby-identifier">collection</span>
-39: <span class="ruby-keyword kw">end</span>
-40: <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># File lib/active_record/groupable_attributes.rb, line 36</span>
+36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attribute_collection</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">attribute_names</span>)
+37: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>
+38:
+39: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">name</span>, <span class="ruby-keyword kw">true</span>)
+40: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span> <span class="ruby-node">"Creating attribute collection :#{name}. "</span> \
+41: <span class="ruby-node">"Overwriting existing method #{self.name}.#{name}."</span>
+42: <span class="ruby-keyword kw">end</span>
+43:
+44: <span class="ruby-identifier">attribute_collections</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">attribute_names</span>
+45:
+46: <span class="ruby-identifier">define_method</span> <span class="ruby-identifier">name</span> <span class="ruby-keyword kw">do</span>
+47: <span class="ruby-identifier">collection</span> = {}
+48: <span class="ruby-identifier">attribute_names</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attribute_name</span><span class="ruby-operator">|</span>
+49: <span class="ruby-identifier">attribute_name</span> = <span class="ruby-identifier">attribute_name</span>.<span class="ruby-identifier">to_sym</span>
+50: <span class="ruby-identifier">collection</span>[<span class="ruby-identifier">attribute_name</span>] = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">attribute_name</span>]
+51: <span class="ruby-keyword kw">end</span>
+52: <span class="ruby-identifier">collection</span>
+53: <span class="ruby-keyword kw">end</span>
+54: <span class="ruby-keyword kw">end</span>
+</pre>
+ </div>
+ </div>
+ </div>
+
+ <div id="method-M000003" class="method-detail">
+ <a name="M000003"></a>
+
+ <div class="method-heading">
+ <a href="#M000003" class="method-signature">
+ <span class="method-name">attribute_collections</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p><a class="source-toggle" href="#"
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000003-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/active_record/groupable_attributes.rb, line 56</span>
+56: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attribute_collections</span>
+57: <span class="ruby-identifier">read_inheritable_attribute</span>(<span class="ruby-identifier">:attribute_collections</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">write_inheritable_attribute</span>(<span class="ruby-identifier">:attribute_collections</span>, {})
+58: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>
\ No newline at end of file
diff --git a/rdoc/created.rid b/rdoc/created.rid
index 1786f11..f990293 100644
--- a/rdoc/created.rid
+++ b/rdoc/created.rid
@@ -1 +1 @@
-Sat, 29 May 2010 15:17:59 +0200
+Sun, 30 May 2010 22:12:25 +0200
diff --git a/rdoc/files/README.html b/rdoc/files/README.html
index 8556335..51eea81 100644
--- a/rdoc/files/README.html
+++ b/rdoc/files/README.html
@@ -1,133 +1,133 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: README</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>README</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>README
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Sat May 29 15:03:39 +0200 2010</td>
+ <td>Sat May 29 18:04:30 +0200 2010</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
GroupableAttributes
</p>
<h6>=============</h6>
<p>
This plugin for Rails provides a method for grouping attributes.
</p>
<p>
Example
</p>
<h6>=</h6>
<p>
class Comment < ActiveRecord::Base
</p>
<pre>
attribute_collection :restricted, [:name, :email]
</pre>
<p>
end
</p>
<p>
comment = Comment.new(:name => "Paul", :email =>
-"paul@paul.com", :content => "blub")
+"paul@example.com", :content => "blub")
comment.restricted #=> { :name => "Paul", :email =>
-"paul@paul.com" }
+"paul@example.com" }
</p>
<p>
Copyright (c) 2010 Julian Jabs, released under the MIT license
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>
\ No newline at end of file
diff --git a/rdoc/files/lib/active_record/groupable_attributes_rb.html b/rdoc/files/lib/active_record/groupable_attributes_rb.html
index 806b08f..6e6e4db 100644
--- a/rdoc/files/lib/active_record/groupable_attributes_rb.html
+++ b/rdoc/files/lib/active_record/groupable_attributes_rb.html
@@ -1,101 +1,101 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: groupable_attributes.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>groupable_attributes.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/active_record/groupable_attributes.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Sat May 29 15:16:29 +0200 2010</td>
+ <td>Sun May 30 22:12:21 +0200 2010</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>
\ No newline at end of file
diff --git a/rdoc/fr_method_index.html b/rdoc/fr_method_index.html
index 94cb769..05ce9ed 100644
--- a/rdoc/fr_method_index.html
+++ b/rdoc/fr_method_index.html
@@ -1,28 +1,29 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Methods
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Methods</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
<base target="docwin" />
</head>
<body>
<div id="index">
<h1 class="section-bar">Methods</h1>
<div id="index-entries">
<a href="classes/ActiveRecord/GroupableAttributes/ClassMethods.html#M000002">attribute_collection (ActiveRecord::GroupableAttributes::ClassMethods)</a><br />
+ <a href="classes/ActiveRecord/GroupableAttributes/ClassMethods.html#M000003">attribute_collections (ActiveRecord::GroupableAttributes::ClassMethods)</a><br />
<a href="classes/ActiveRecord/GroupableAttributes.html#M000001">included (ActiveRecord::GroupableAttributes)</a><br />
</div>
</div>
</body>
</html>
\ No newline at end of file
diff --git a/spec/groupable_attributes_spec.rb b/spec/groupable_attributes_spec.rb
index 1d5093d..71b4242 100644
--- a/spec/groupable_attributes_spec.rb
+++ b/spec/groupable_attributes_spec.rb
@@ -1,13 +1,22 @@
require File.dirname(__FILE__) + '/spec_helper'
class GroupableAttributesTestModel < ActiveRecord::Base
attribute_collection :restricted, [:name, :email]
end
describe ActiveRecord::Base, "#attribute_collection" do
it "should collect the given attributes and none else" do
restricted = {:name => "Paul", :email => "paul@example.com"}
params = restricted.merge(:content => "blub")
assert GroupableAttributesTestModel.new(params).restricted == restricted
end
+end
+
+describe ActiveRecord::Base, "#find" do
+ it "should select the attributes collected" do
+ restricted = {"name" => "Paul", "email" => "paul@example.com"}
+ params = restricted.merge(:content => "blub")
+ GroupableAttributesTestModel.create(params)
+ assert GroupableAttributesTestModel.first(:select_collection => :restricted).attributes == restricted
+ end
end
\ No newline at end of file
|
lordxist/groupable_attributes
|
50ef0be817704eb0c14fdb96b469015d3ee6540e
|
example.com email in spec, too
|
diff --git a/spec/groupable_attributes_spec.rb b/spec/groupable_attributes_spec.rb
index bf5c693..1d5093d 100644
--- a/spec/groupable_attributes_spec.rb
+++ b/spec/groupable_attributes_spec.rb
@@ -1,13 +1,13 @@
require File.dirname(__FILE__) + '/spec_helper'
class GroupableAttributesTestModel < ActiveRecord::Base
attribute_collection :restricted, [:name, :email]
end
describe ActiveRecord::Base, "#attribute_collection" do
it "should collect the given attributes and none else" do
- restricted = {:name => "Paul", :email => "paul@paul.com"}
+ restricted = {:name => "Paul", :email => "paul@example.com"}
params = restricted.merge(:content => "blub")
assert GroupableAttributesTestModel.new(params).restricted == restricted
end
end
\ No newline at end of file
|
lordxist/groupable_attributes
|
bd3167cc5dd42f9c721299fc0e1be193f91bfcba
|
changed example email to something unproblematic (example.com)
|
diff --git a/README b/README
index 233aec3..e648da1 100644
--- a/README
+++ b/README
@@ -1,18 +1,18 @@
GroupableAttributes
===================
This plugin for Rails provides a method for grouping attributes.
Example
=======
class Comment < ActiveRecord::Base
attribute_collection :restricted, [:name, :email]
end
-comment = Comment.new(:name => "Paul", :email => "paul@paul.com", :content => "blub")
-comment.restricted #=> { :name => "Paul", :email => "paul@paul.com" }
+comment = Comment.new(:name => "Paul", :email => "paul@example.com", :content => "blub")
+comment.restricted #=> { :name => "Paul", :email => "paul@example.com" }
Copyright (c) 2010 Julian Jabs, released under the MIT license
diff --git a/lib/active_record/groupable_attributes.rb b/lib/active_record/groupable_attributes.rb
index 11867b1..fd74e94 100644
--- a/lib/active_record/groupable_attributes.rb
+++ b/lib/active_record/groupable_attributes.rb
@@ -1,44 +1,44 @@
module ActiveRecord
module GroupableAttributes
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
# Use this method to group together some of your model's attributes.
#
# ==== Parameters
#
# * +name+ - The collection's name.
# * +attribute_name+ - The names of the attributes to be collected.
#
# ==== Examples
#
# class Comment < ActiveRecord::Base
# attribute_collection :restricted, [:name, :email]
# end
#
- # comment = Comment.new(:name => "Paul", :email => "paul@paul.com", :content => "blub")
- # comment.restricted #=> { :name => "Paul", :email => "paul@paul.com" }
+ # comment = Comment.new(:name => "Paul", :email => "paul@example.com", :content => "blub")
+ # comment.restricted #=> { :name => "Paul", :email => "paul@example.com" }
#
def attribute_collection(name, attribute_names)
name = name.to_sym
if respond_to?(name, true)
logger.warn "Creating attribute collection :#{name}. " \
"Overwriting existing method #{self.name}.#{name}."
end
define_method name do
collection = {}
attribute_names.each do |attribute_name|
attribute_name = attribute_name.to_sym
collection[attribute_name] = self[attribute_name]
end
collection
end
end
end
end
end
\ No newline at end of file
diff --git a/rdoc/classes/ActiveRecord/GroupableAttributes/ClassMethods.html b/rdoc/classes/ActiveRecord/GroupableAttributes/ClassMethods.html
index aa4824c..8f5cd7f 100644
--- a/rdoc/classes/ActiveRecord/GroupableAttributes/ClassMethods.html
+++ b/rdoc/classes/ActiveRecord/GroupableAttributes/ClassMethods.html
@@ -1,175 +1,175 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActiveRecord::GroupableAttributes::ClassMethods</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActiveRecord::GroupableAttributes::ClassMethods</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/lib/active_record/groupable_attributes_rb.html">
lib/active_record/groupable_attributes.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000002">attribute_collection</a>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000002" class="method-detail">
<a name="M000002"></a>
<div class="method-heading">
<a href="#M000002" class="method-signature">
<span class="method-name">attribute_collection</span><span class="method-args">(name, attribute_names)</span>
</a>
</div>
<div class="method-description">
<p>
Use this method to group together some of your model‘s attributes.
</p>
<h4>Parameters</h4>
<ul>
<li><tt>name</tt> - The collection‘s name.
</li>
<li><tt>attribute_name</tt> - The names of the attributes to be collected.
</li>
</ul>
<h4>Examples</h4>
<pre>
class Comment < ActiveRecord::Base
attribute_collection :restricted, [:name, :email]
end
- comment = Comment.new(:name => "Paul", :email => "paul@paul.com", :content => "blub")
- comment.restricted #=> { :name => "Paul", :email => "paul@paul.com" }
+ comment = Comment.new(:name => "Paul", :email => "paul@example.com", :content => "blub")
+ comment.restricted #=> { :name => "Paul", :email => "paul@example.com" }
</pre>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000002-source">
<pre>
<span class="ruby-comment cmt"># File lib/active_record/groupable_attributes.rb, line 24</span>
24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attribute_collection</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">attribute_names</span>)
25: <span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>
26:
27: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">name</span>, <span class="ruby-keyword kw">true</span>)
28: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span> <span class="ruby-node">"Creating attribute collection :#{name}. "</span> \
29: <span class="ruby-node">"Overwriting existing method #{self.name}.#{name}."</span>
30: <span class="ruby-keyword kw">end</span>
31:
32: <span class="ruby-identifier">define_method</span> <span class="ruby-identifier">name</span> <span class="ruby-keyword kw">do</span>
33: <span class="ruby-identifier">collection</span> = {}
34: <span class="ruby-identifier">attribute_names</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attribute_name</span><span class="ruby-operator">|</span>
35: <span class="ruby-identifier">attribute_name</span> = <span class="ruby-identifier">attribute_name</span>.<span class="ruby-identifier">to_sym</span>
36: <span class="ruby-identifier">collection</span>[<span class="ruby-identifier">attribute_name</span>] = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">attribute_name</span>]
37: <span class="ruby-keyword kw">end</span>
38: <span class="ruby-identifier">collection</span>
39: <span class="ruby-keyword kw">end</span>
40: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>
\ No newline at end of file
|
rickclare/apache2-conf
|
9d99d35636300893f7ed8a6751d29088fc0930ec
|
updating conf
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index 67406e8..12915b9 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,338 +1,339 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
- ServerName dev.tools.drinkaware.co.uk
- ServerAlias localhost.tools.drinkaware.co.uk
+ ServerName localhost.my.drinkaware.co.uk
+ ServerAlias unbranded.localhost.my.drinkaware.co.uk
+ ServerAlias tesco.localhost.my.drinkaware.co.uk
DocumentRoot "/Users/Shared/Dev/workspace/Enable/tools-drinkaware/public"
<Directory "/Users/Shared/Dev/workspace/Enable/tools-drinkaware/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Options -MultiViews
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
RailsEnv development
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript application/x-shockwave-flash application/xml
# enable expirations
ExpiresActive On
FileETag none
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|svg|woff|otf|ttf|eot)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
# Caching config
+ RewriteMap uri_escape int:escape
RewriteEngine On
## Set to log level to 1-9, to enable logging
RewriteLogLevel 0
RewriteLog /opt/local/apache2/logs/tools_drinkaware_rewrite.log
- # IMAGES CACHING
- RewriteCond %{REQUEST_FILENAME} !-s
- RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI} -s
- RewriteRule ^(.*)$ /cache/$1 [L]
-
- # PAGE CACHING
- RewriteCond %{REQUEST_FILENAME} !-s
- RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI}.html -s
- RewriteRule ^(.*)$ /cache/$1 [L]
+ # Rewrite to check for Rails non-html cached pages (i.e. xml, json, atom, etc)
+ RewriteCond %{THE_REQUEST} ^(GET|HEAD)
+ RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}%{REQUEST_URI} -f
+ RewriteRule ^(.*)$ /cache/%{HTTP_HOST}$1 [QSA,L]
+
+ RewriteCond %{THE_REQUEST} ^(GET|HEAD)
+ RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}%{REQUEST_URI}%{QUERY_STRING}.html -f
+ RewriteRule ^(.*)$ /cache/%{HTTP_HOST}$1${uri_escape:%{QUERY_STRING}}.html [QSA,L]
- # FRONT PAGE CACHING
- RewriteCond %{REQUEST_URI} "/"
- RewriteCond %{REQUEST_FILENAME} !-s
- RewriteCond %{DOCUMENT_ROOT}/cache/index.html -s
- RewriteRule ^$ /cache/index.html [L]
+ # Rewrite to check for Rails cached html page
+ RewriteCond %{THE_REQUEST} ^(GET|HEAD)
+ RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}%{REQUEST_URI}index.html -f
+ RewriteRule ^(.*)$ /cache/%{HTTP_HOST}$1index.html [QSA,L]
+
</VirtualHost>
## Resolutions-Drinkaware (Rails Passenger, Ruby1.8.7)
# <VirtualHost *:80>
# ServerName resolutions.tools.drinkaware.co.uk
#
# DocumentRoot "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public"
# <Directory "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public">
# AllowOverride All
# Allow from All
# </Directory>
#
# ErrorLog /opt/local/apache2/logs/resolutions_rails_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/resolutions_rails_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
# Drinkaware Matrix Sandbox
# <VirtualHost *:80>
# ServerName drinkaware-matrix.localhost
# ServerAlias www.drinkaware.co.uk
# ServerAlias drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/Old/drinkaware-matrix"
#
# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
# php_flag display_errors on
#
# <Directory /Users/Shared/Dev/workspace/Old/drinkaware-matrix>
# Order deny,allow
# Deny from all
# </Directory>
# <DirectoryMatch "^/Users/Shared/Dev/workspace/Old/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
# Order allow,deny
# Allow from all
# </DirectoryMatch>
#
# <FilesMatch "\.inc$">
# Order allow,deny
# Deny from all
# </FilesMatch>
# <LocationMatch "/(CVS|\.FFV)/">
# Order allow,deny
# Deny from all
# </LocationMatch>
#
# Alias /__fudge /Users/Shared/Dev/workspace/Old/drinkaware-matrix/fudge
# Alias /__data /Users/Shared/Dev/workspace/Old/drinkaware-matrix/data/public
# Alias /__lib /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/lib
# Alias / /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/web/index.php/
#
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
#Magento Sandbox local
# <VirtualHost *:80>
# ServerName magento.localhost
# ServerAlias magento.rickclare
# DocumentRoot "/Users/Shared/Dev/workspace/magento"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/magento">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/magento_error.log
# CustomLog /opt/local/apache2/logs/magento_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/magento_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
# Mysource Matrix Sandbox local
# <VirtualHost *:80>
# ServerName drinkaware-matrix.localhost
# ServerAlias www.drinkaware.co.uk
# ServerAlias drinkaware.co.uk
# DirectoryIndex index.php
# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# #php_value error_reporting 6135
#
# DocumentRoot /Users/Shared/Dev/workspace/drinkaware-matrix/core/web
#
# Options -Indexes FollowSymLinks
#
# <Directory /Users/Shared/Dev/workspace/drinkaware-matrix>
# AllowOverride All
# Allow from All
# </Directory>
#
# <DirectoryMatch "^/Users/Shared/Dev/workspace/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
# AllowOverride All
# Allow from All
# </DirectoryMatch>
#
# <FilesMatch "\.inc$">
# Allow from All
# </FilesMatch>
# <LocationMatch "/(CVS|\.FFV)/">
# Allow from All
# </LocationMatch>
#
# Alias /__fudge /Users/Shared/Dev/workspace/drinkaware-matrix/fudge
# Alias /__data /Users/Shared/Dev/workspace/drinkaware-matrix/data/public
# Alias /__lib /Users/Shared/Dev/workspace/drinkaware-matrix/core/lib
# Alias / /Users/Shared/Dev/workspace/drinkaware-matrix/core/web/index.php/
# </VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
diff --git a/httpd.conf b/httpd.conf
index 6ccf319..c9bcf75 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,507 +1,507 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
#LoadModule xsendfile_module modules/mod_xsendfile.so
## DEV ENV
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p180@global/gems/passenger-3.0.6/ext/apache2/mod_passenger.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p180@global/gems/passenger-3.0.6
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p180@global/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p180@global/gems/passenger-3.0.7
PassengerRuby /Users/rick/.rvm/wrappers/ruby-1.9.2-p180@tools-drinkaware/ruby
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
f2371df1c18180a3148073ea5782e0b813df3dd8
|
updating to be in line with production
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index e280702..67406e8 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,377 +1,338 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
-#Unit-calc-review Sandbox local
-# <VirtualHost *:80>
-# ServerName unit-calc-review.localhost
-# DocumentRoot "/Users/Shared/Dev/workspace/Enable/unit_calc_review"
-# DirectoryIndex index.php
-# <Directory "/Users/Shared/Dev/workspace/Enable/unit_calc_review">
-# AllowOverride All
-# Allow from All
-# </Directory>
-# ErrorLog /opt/local/apache2/logs/unit_calc_review_error.log
-# CustomLog /opt/local/apache2/logs/unit_calc_review_access.log combined
-# php_flag log_errors on
-# php_value error_log /opt/local/apache2/logs/unit_calc_review_php_error.log
-# php_flag display_errors on
-#
-# # E_ALL & ~E_NOTICE
-# php_value error_reporting 6135
-# </VirtualHost>
-
-
# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName dev.tools.drinkaware.co.uk
ServerAlias localhost.tools.drinkaware.co.uk
DocumentRoot "/Users/Shared/Dev/workspace/Enable/tools-drinkaware/public"
<Directory "/Users/Shared/Dev/workspace/Enable/tools-drinkaware/public">
- AllowOverride all
- Allow from All
- Options -MultiViews
+ Options FollowSymLinks
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+ Options -MultiViews
</Directory>
- # Allows sending files above Request path
- ##XSendFile on
- ##XSendFileAllowAbove on
-
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
+
RailsBaseURI /
RailsEnv development
- # Enable ETag
- #FileETag MTime Size
-
# Enable Compression (GZIP) of shown content-types
- AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript application/x-shockwave-flash application/xml
# enable expirations
ExpiresActive On
+ FileETag none
# far future expires headers
- <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|svg)$">
+ <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|svg|woff|otf|ttf|eot)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
-
- <FilesMatch "\.(js|css)$">
- ExpiresDefault "now"
- </FilesMatch>
-
- <Location />
- # enable tracking uploads in /
- TrackUploads On
- </Location>
- <Location /progress>
- # enable upload progress reports in /progress
- ReportUploads On
- </Location>
-
# Caching config
RewriteEngine On
-
+
## Set to log level to 1-9, to enable logging
RewriteLogLevel 0
RewriteLog /opt/local/apache2/logs/tools_drinkaware_rewrite.log
# IMAGES CACHING
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI} -s
RewriteRule ^(.*)$ /cache/$1 [L]
# PAGE CACHING
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI}.html -s
RewriteRule ^(.*)$ /cache/$1 [L]
# FRONT PAGE CACHING
RewriteCond %{REQUEST_URI} "/"
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -s
RewriteRule ^$ /cache/index.html [L]
-
-
</VirtualHost>
## Resolutions-Drinkaware (Rails Passenger, Ruby1.8.7)
# <VirtualHost *:80>
# ServerName resolutions.tools.drinkaware.co.uk
#
# DocumentRoot "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public"
# <Directory "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public">
# AllowOverride All
# Allow from All
# </Directory>
#
# ErrorLog /opt/local/apache2/logs/resolutions_rails_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/resolutions_rails_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
# Drinkaware Matrix Sandbox
# <VirtualHost *:80>
# ServerName drinkaware-matrix.localhost
# ServerAlias www.drinkaware.co.uk
# ServerAlias drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/Old/drinkaware-matrix"
#
# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
# php_flag display_errors on
#
# <Directory /Users/Shared/Dev/workspace/Old/drinkaware-matrix>
# Order deny,allow
# Deny from all
# </Directory>
# <DirectoryMatch "^/Users/Shared/Dev/workspace/Old/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
# Order allow,deny
# Allow from all
# </DirectoryMatch>
#
# <FilesMatch "\.inc$">
# Order allow,deny
# Deny from all
# </FilesMatch>
# <LocationMatch "/(CVS|\.FFV)/">
# Order allow,deny
# Deny from all
# </LocationMatch>
#
# Alias /__fudge /Users/Shared/Dev/workspace/Old/drinkaware-matrix/fudge
# Alias /__data /Users/Shared/Dev/workspace/Old/drinkaware-matrix/data/public
# Alias /__lib /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/lib
# Alias / /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/web/index.php/
#
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
#Magento Sandbox local
# <VirtualHost *:80>
# ServerName magento.localhost
# ServerAlias magento.rickclare
# DocumentRoot "/Users/Shared/Dev/workspace/magento"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/magento">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/magento_error.log
# CustomLog /opt/local/apache2/logs/magento_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/magento_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
# Mysource Matrix Sandbox local
# <VirtualHost *:80>
# ServerName drinkaware-matrix.localhost
# ServerAlias www.drinkaware.co.uk
# ServerAlias drinkaware.co.uk
# DirectoryIndex index.php
# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# #php_value error_reporting 6135
#
# DocumentRoot /Users/Shared/Dev/workspace/drinkaware-matrix/core/web
#
# Options -Indexes FollowSymLinks
#
# <Directory /Users/Shared/Dev/workspace/drinkaware-matrix>
# AllowOverride All
# Allow from All
# </Directory>
#
# <DirectoryMatch "^/Users/Shared/Dev/workspace/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
# AllowOverride All
# Allow from All
# </DirectoryMatch>
#
# <FilesMatch "\.inc$">
# Allow from All
# </FilesMatch>
# <LocationMatch "/(CVS|\.FFV)/">
# Allow from All
# </LocationMatch>
#
# Alias /__fudge /Users/Shared/Dev/workspace/drinkaware-matrix/fudge
# Alias /__data /Users/Shared/Dev/workspace/drinkaware-matrix/data/public
# Alias /__lib /Users/Shared/Dev/workspace/drinkaware-matrix/core/lib
# Alias / /Users/Shared/Dev/workspace/drinkaware-matrix/core/web/index.php/
# </VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
|
rickclare/apache2-conf
|
520d11fd0ae98f7084966a42632b59c4e28bb99d
|
updating gemset
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index c1aebe5..e280702 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,354 +1,377 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
+#Unit-calc-review Sandbox local
+# <VirtualHost *:80>
+# ServerName unit-calc-review.localhost
+# DocumentRoot "/Users/Shared/Dev/workspace/Enable/unit_calc_review"
+# DirectoryIndex index.php
+# <Directory "/Users/Shared/Dev/workspace/Enable/unit_calc_review">
+# AllowOverride All
+# Allow from All
+# </Directory>
+# ErrorLog /opt/local/apache2/logs/unit_calc_review_error.log
+# CustomLog /opt/local/apache2/logs/unit_calc_review_access.log combined
+# php_flag log_errors on
+# php_value error_log /opt/local/apache2/logs/unit_calc_review_php_error.log
+# php_flag display_errors on
+#
+# # E_ALL & ~E_NOTICE
+# php_value error_reporting 6135
+# </VirtualHost>
+
+
# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName dev.tools.drinkaware.co.uk
ServerAlias localhost.tools.drinkaware.co.uk
- DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
- <Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
+ DocumentRoot "/Users/Shared/Dev/workspace/Enable/tools-drinkaware/public"
+ <Directory "/Users/Shared/Dev/workspace/Enable/tools-drinkaware/public">
AllowOverride all
Allow from All
Options -MultiViews
</Directory>
# Allows sending files above Request path
##XSendFile on
##XSendFileAllowAbove on
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
RailsEnv development
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|svg)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
- ## Set to log level to 1-9, to enable logging
- ##RewriteLogLevel 0
- ##RewriteLog "/tmp/rewrite.log"
+ # Caching config
+ RewriteEngine On
+ ## Set to log level to 1-9, to enable logging
+ RewriteLogLevel 0
+ RewriteLog /opt/local/apache2/logs/tools_drinkaware_rewrite.log
+
# IMAGES CACHING
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI} -s
RewriteRule ^(.*)$ /cache/$1 [L]
# PAGE CACHING
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI}.html -s
RewriteRule ^(.*)$ /cache/$1 [L]
# FRONT PAGE CACHING
RewriteCond %{REQUEST_URI} "/"
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -s
RewriteRule ^$ /cache/index.html [L]
+
</VirtualHost>
## Resolutions-Drinkaware (Rails Passenger, Ruby1.8.7)
# <VirtualHost *:80>
# ServerName resolutions.tools.drinkaware.co.uk
#
# DocumentRoot "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public"
# <Directory "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public">
# AllowOverride All
# Allow from All
# </Directory>
#
# ErrorLog /opt/local/apache2/logs/resolutions_rails_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/resolutions_rails_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
# Drinkaware Matrix Sandbox
# <VirtualHost *:80>
# ServerName drinkaware-matrix.localhost
# ServerAlias www.drinkaware.co.uk
# ServerAlias drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/Old/drinkaware-matrix"
#
# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
# php_flag display_errors on
#
# <Directory /Users/Shared/Dev/workspace/Old/drinkaware-matrix>
# Order deny,allow
# Deny from all
# </Directory>
# <DirectoryMatch "^/Users/Shared/Dev/workspace/Old/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
# Order allow,deny
# Allow from all
# </DirectoryMatch>
#
# <FilesMatch "\.inc$">
# Order allow,deny
# Deny from all
# </FilesMatch>
# <LocationMatch "/(CVS|\.FFV)/">
# Order allow,deny
# Deny from all
# </LocationMatch>
#
# Alias /__fudge /Users/Shared/Dev/workspace/Old/drinkaware-matrix/fudge
# Alias /__data /Users/Shared/Dev/workspace/Old/drinkaware-matrix/data/public
# Alias /__lib /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/lib
# Alias / /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/web/index.php/
#
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
-
#Magento Sandbox local
-<VirtualHost *:80>
- ServerName magento.localhost
- ServerAlias magento.rickclare
- DocumentRoot "/Users/Shared/Dev/workspace/magento"
- DirectoryIndex index.php
- <Directory "/Users/Shared/Dev/workspace/magento">
- AllowOverride All
- Allow from All
- </Directory>
- ErrorLog /opt/local/apache2/logs/magento_error.log
- CustomLog /opt/local/apache2/logs/magento_access.log combined
- php_flag log_errors on
- php_value error_log /opt/local/apache2/logs/magento_php_error.log
- php_flag display_errors on
-
- # E_ALL & ~E_NOTICE
- php_value error_reporting 6135
-</VirtualHost>
+# <VirtualHost *:80>
+# ServerName magento.localhost
+# ServerAlias magento.rickclare
+# DocumentRoot "/Users/Shared/Dev/workspace/magento"
+# DirectoryIndex index.php
+# <Directory "/Users/Shared/Dev/workspace/magento">
+# AllowOverride All
+# Allow from All
+# </Directory>
+# ErrorLog /opt/local/apache2/logs/magento_error.log
+# CustomLog /opt/local/apache2/logs/magento_access.log combined
+# php_flag log_errors on
+# php_value error_log /opt/local/apache2/logs/magento_php_error.log
+# php_flag display_errors on
+#
+# # E_ALL & ~E_NOTICE
+# php_value error_reporting 6135
+# </VirtualHost>
# Mysource Matrix Sandbox local
# <VirtualHost *:80>
# ServerName drinkaware-matrix.localhost
# ServerAlias www.drinkaware.co.uk
# ServerAlias drinkaware.co.uk
# DirectoryIndex index.php
# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# #php_value error_reporting 6135
#
# DocumentRoot /Users/Shared/Dev/workspace/drinkaware-matrix/core/web
#
# Options -Indexes FollowSymLinks
#
# <Directory /Users/Shared/Dev/workspace/drinkaware-matrix>
# AllowOverride All
# Allow from All
# </Directory>
#
# <DirectoryMatch "^/Users/Shared/Dev/workspace/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
# AllowOverride All
# Allow from All
# </DirectoryMatch>
#
# <FilesMatch "\.inc$">
# Allow from All
# </FilesMatch>
# <LocationMatch "/(CVS|\.FFV)/">
# Allow from All
# </LocationMatch>
#
# Alias /__fudge /Users/Shared/Dev/workspace/drinkaware-matrix/fudge
# Alias /__data /Users/Shared/Dev/workspace/drinkaware-matrix/data/public
# Alias /__lib /Users/Shared/Dev/workspace/drinkaware-matrix/core/lib
# Alias / /Users/Shared/Dev/workspace/drinkaware-matrix/core/web/index.php/
# </VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
diff --git a/httpd.conf b/httpd.conf
index 2c0365d..6ccf319 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,507 +1,507 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
#LoadModule xsendfile_module modules/mod_xsendfile.so
## DEV ENV
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p136/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p136/gems/passenger-3.0.2
-PassengerRuby /Users/rick/.rvm/wrappers/ruby-1.9.2-p136/ruby
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p180@global/gems/passenger-3.0.6/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p180@global/gems/passenger-3.0.6
+PassengerRuby /Users/rick/.rvm/wrappers/ruby-1.9.2-p180@tools-drinkaware/ruby
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
74791f4db70ba1f0556e4217a9ed36977b8316a7
|
updating ruby version
|
diff --git a/httpd.conf b/httpd.conf
index b281f08..2c0365d 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,508 +1,507 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
#LoadModule xsendfile_module modules/mod_xsendfile.so
## DEV ENV
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.2
-PassengerRuby /Users/rick/.rvm/wrappers/ruby-1.9.2-p0/ruby
-
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p136/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p136/gems/passenger-3.0.2
+PassengerRuby /Users/rick/.rvm/wrappers/ruby-1.9.2-p136/ruby
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
c513d4aa7bca90a9c80ca6a1fe83a1c39f885c23
|
updating passenger
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index c479013..c1aebe5 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,424 +1,354 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName dev.tools.drinkaware.co.uk
ServerAlias localhost.tools.drinkaware.co.uk
DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
<Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
AllowOverride all
Allow from All
Options -MultiViews
</Directory>
# Allows sending files above Request path
##XSendFile on
##XSendFileAllowAbove on
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
RailsEnv development
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|svg)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
## Set to log level to 1-9, to enable logging
##RewriteLogLevel 0
##RewriteLog "/tmp/rewrite.log"
# IMAGES CACHING
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI} -s
RewriteRule ^(.*)$ /cache/$1 [L]
# PAGE CACHING
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI}.html -s
RewriteRule ^(.*)$ /cache/$1 [L]
# FRONT PAGE CACHING
RewriteCond %{REQUEST_URI} "/"
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -s
RewriteRule ^$ /cache/index.html [L]
</VirtualHost>
-
-# Tools-Drinkaware-Local-Production (Rails Passenger, Ruby1.9)
-<VirtualHost *:80>
- ServerName local_production.tools.drinkaware.co.uk
-
- DocumentRoot "/var/www/apps/tools-drinkaware/current/public"
- <Directory "/var/www/apps/tools-drinkaware/current/public">
- AllowOverride all
- Allow from All
- Options -MultiViews
- </Directory>
-
- ErrorLog /opt/local/apache2/logs/tools_drinkaware_local_production_error.log
- CustomLog /opt/local/apache2/logs/tools_drinkaware_local_production_access.log combined
- RailsBaseURI /
- RailsEnv local_production
-
- # Enable ETag
- #FileETag MTime Size
-
- # Enable Compression (GZIP) of shown content-types
- AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
-
- # enable expirations
- ExpiresActive On
-
- # far future expires headers
- <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
- ExpiresDefault "access plus 10 years"
- </FilesMatch>
-
- <FilesMatch "\.(js|css)$">
- ExpiresDefault "access plus 10 years"
- </FilesMatch>
-
- <Location />
- # enable tracking uploads in /
- TrackUploads On
- </Location>
-
- <Location /progress>
- # enable upload progress reports in /progress
- ReportUploads On
- </Location>
-
- RewriteEngine On
-
- ## Set to log level to 1-9, to enable logging
- ##RewriteLogLevel 9
- ##RewriteLog "/tmp/rewrite.log"
-
- # IMAGES CACHING
- RewriteCond %{REQUEST_FILENAME} !-s
- RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI} -s
- RewriteRule ^(.*)$ /cache/$1 [L]
-
- # PAGE CACHING
- RewriteCond %{REQUEST_FILENAME} !-s
- RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI}.html -s
- RewriteRule ^(.*)$ /cache/$1 [L]
-
- # FRONT PAGE CACHING
- RewriteCond %{REQUEST_URI} "/"
- RewriteCond %{REQUEST_FILENAME} !-s
- RewriteCond %{DOCUMENT_ROOT}/cache/index.html -s
- RewriteRule ^$ /cache/index.html [L]
-
-</VirtualHost>
-
-
## Resolutions-Drinkaware (Rails Passenger, Ruby1.8.7)
# <VirtualHost *:80>
# ServerName resolutions.tools.drinkaware.co.uk
#
# DocumentRoot "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public"
# <Directory "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public">
# AllowOverride All
# Allow from All
# </Directory>
#
# ErrorLog /opt/local/apache2/logs/resolutions_rails_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/resolutions_rails_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
# Drinkaware Matrix Sandbox
# <VirtualHost *:80>
# ServerName drinkaware-matrix.localhost
# ServerAlias www.drinkaware.co.uk
# ServerAlias drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/Old/drinkaware-matrix"
#
# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
# php_flag display_errors on
#
# <Directory /Users/Shared/Dev/workspace/Old/drinkaware-matrix>
# Order deny,allow
# Deny from all
# </Directory>
# <DirectoryMatch "^/Users/Shared/Dev/workspace/Old/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
# Order allow,deny
# Allow from all
# </DirectoryMatch>
#
# <FilesMatch "\.inc$">
# Order allow,deny
# Deny from all
# </FilesMatch>
# <LocationMatch "/(CVS|\.FFV)/">
# Order allow,deny
# Deny from all
# </LocationMatch>
#
# Alias /__fudge /Users/Shared/Dev/workspace/Old/drinkaware-matrix/fudge
# Alias /__data /Users/Shared/Dev/workspace/Old/drinkaware-matrix/data/public
# Alias /__lib /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/lib
# Alias / /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/web/index.php/
#
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
#Magento Sandbox local
<VirtualHost *:80>
ServerName magento.localhost
ServerAlias magento.rickclare
DocumentRoot "/Users/Shared/Dev/workspace/magento"
DirectoryIndex index.php
<Directory "/Users/Shared/Dev/workspace/magento">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/magento_error.log
CustomLog /opt/local/apache2/logs/magento_access.log combined
php_flag log_errors on
php_value error_log /opt/local/apache2/logs/magento_php_error.log
php_flag display_errors on
# E_ALL & ~E_NOTICE
php_value error_reporting 6135
</VirtualHost>
# Mysource Matrix Sandbox local
# <VirtualHost *:80>
# ServerName drinkaware-matrix.localhost
# ServerAlias www.drinkaware.co.uk
# ServerAlias drinkaware.co.uk
# DirectoryIndex index.php
# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# #php_value error_reporting 6135
#
# DocumentRoot /Users/Shared/Dev/workspace/drinkaware-matrix/core/web
#
# Options -Indexes FollowSymLinks
#
# <Directory /Users/Shared/Dev/workspace/drinkaware-matrix>
# AllowOverride All
# Allow from All
# </Directory>
#
# <DirectoryMatch "^/Users/Shared/Dev/workspace/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
# AllowOverride All
# Allow from All
# </DirectoryMatch>
#
# <FilesMatch "\.inc$">
# Allow from All
# </FilesMatch>
# <LocationMatch "/(CVS|\.FFV)/">
# Allow from All
# </LocationMatch>
#
# Alias /__fudge /Users/Shared/Dev/workspace/drinkaware-matrix/fudge
# Alias /__data /Users/Shared/Dev/workspace/drinkaware-matrix/data/public
# Alias /__lib /Users/Shared/Dev/workspace/drinkaware-matrix/core/lib
# Alias / /Users/Shared/Dev/workspace/drinkaware-matrix/core/web/index.php/
# </VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
diff --git a/httpd.conf b/httpd.conf
index 2b1dfab..b281f08 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,508 +1,508 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
#LoadModule xsendfile_module modules/mod_xsendfile.so
## DEV ENV
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.1/ext/apache2/mod_passenger.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.1
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.2
PassengerRuby /Users/rick/.rvm/wrappers/ruby-1.9.2-p0/ruby
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
df8d35cc279cfb51a9167f11ea69f9fe55e21c01
|
updating passenger gem
|
diff --git a/httpd.conf b/httpd.conf
index bcbaa95..d2ade89 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,507 +1,507 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
#LoadModule xsendfile_module modules/mod_xsendfile.so
## DEV ENV
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.0.pre4/ext/apache2/mod_passenger.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.0.pre4
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.0
PassengerRuby /Users/rick/.rvm/wrappers/ruby-1.9.2-p0/ruby
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
1f4a72de630204706a16cb3ef339d979b4ae87fa
|
adding servername
|
diff --git a/httpd.conf b/httpd.conf
index df81526..bcbaa95 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,507 +1,507 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
#LoadModule xsendfile_module modules/mod_xsendfile.so
## DEV ENV
LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.0.pre4/ext/apache2/mod_passenger.so
PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.0.pre4
-PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
+PassengerRuby /Users/rick/.rvm/wrappers/ruby-1.9.2-p0/ruby
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
-#ServerName www.example.com:80
+ServerName localhost:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
2bd3aa704769d8ad7d7083029cbcb12cd9d80479
|
updating passenger version
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index 06b2c36..4d2834e 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,422 +1,424 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName dev.tools.drinkaware.co.uk
ServerAlias localhost.tools.drinkaware.co.uk
DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
<Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
- AllowOverride All
+ AllowOverride all
Allow from All
+ Options -MultiViews
</Directory>
# Allows sending files above Request path
##XSendFile on
##XSendFileAllowAbove on
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
RailsEnv development
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|svg)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
## Set to log level to 1-9, to enable logging
##RewriteLogLevel 0
##RewriteLog "/tmp/rewrite.log"
# IMAGES CACHING
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI} -s
RewriteRule ^(.*)$ /cache/$1 [L]
# PAGE CACHING
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI}.html -s
RewriteRule ^(.*)$ /cache/$1 [L]
# FRONT PAGE CACHING
RewriteCond %{REQUEST_URI} "/"
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -s
RewriteRule ^$ /cache/index.html [L]
</VirtualHost>
# Tools-Drinkaware-Local-Production (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName local_production.tools.drinkaware.co.uk
DocumentRoot "/var/www/apps/tools-drinkaware/current/public"
<Directory "/var/www/apps/tools-drinkaware/current/public">
- AllowOverride All
+ AllowOverride all
Allow from All
+ Options -MultiViews
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_local_production_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_local_production_access.log combined
RailsBaseURI /
RailsEnv local_production
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
RewriteEngine On
## Set to log level to 1-9, to enable logging
##RewriteLogLevel 9
##RewriteLog "/tmp/rewrite.log"
# IMAGES CACHING
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI} -s
RewriteRule ^(.*)$ /cache/$1 [L]
# PAGE CACHING
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI}.html -s
RewriteRule ^(.*)$ /cache/$1 [L]
# FRONT PAGE CACHING
RewriteCond %{REQUEST_URI} "/"
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -s
RewriteRule ^$ /cache/index.html [L]
</VirtualHost>
## Resolutions-Drinkaware (Rails Passenger, Ruby1.8.7)
# <VirtualHost *:80>
# ServerName resolutions.tools.drinkaware.co.uk
#
# DocumentRoot "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public"
# <Directory "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public">
# AllowOverride All
# Allow from All
# </Directory>
#
# ErrorLog /opt/local/apache2/logs/resolutions_rails_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/resolutions_rails_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
# Drinkaware Matrix Sandbox
-<VirtualHost *:80>
- ServerName drinkaware-matrix.localhost
- ServerAlias www.drinkaware.co.uk
- ServerAlias drinkaware.co.uk
- DocumentRoot "/Users/Shared/Dev/workspace/Old/drinkaware-matrix"
-
- ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
- CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
- php_flag log_errors on
- php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
- php_flag display_errors on
-
- <Directory /Users/Shared/Dev/workspace/Old/drinkaware-matrix>
- Order deny,allow
- Deny from all
- </Directory>
- <DirectoryMatch "^/Users/Shared/Dev/workspace/Old/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
- Order allow,deny
- Allow from all
- </DirectoryMatch>
-
- <FilesMatch "\.inc$">
- Order allow,deny
- Deny from all
- </FilesMatch>
- <LocationMatch "/(CVS|\.FFV)/">
- Order allow,deny
- Deny from all
- </LocationMatch>
-
- Alias /__fudge /Users/Shared/Dev/workspace/Old/drinkaware-matrix/fudge
- Alias /__data /Users/Shared/Dev/workspace/Old/drinkaware-matrix/data/public
- Alias /__lib /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/lib
- Alias / /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/web/index.php/
-
-
- # E_ALL & ~E_NOTICE
- php_value error_reporting 6135
-</VirtualHost>
+# <VirtualHost *:80>
+# ServerName drinkaware-matrix.localhost
+# ServerAlias www.drinkaware.co.uk
+# ServerAlias drinkaware.co.uk
+# DocumentRoot "/Users/Shared/Dev/workspace/Old/drinkaware-matrix"
+#
+# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
+# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
+# php_flag log_errors on
+# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
+# php_flag display_errors on
+#
+# <Directory /Users/Shared/Dev/workspace/Old/drinkaware-matrix>
+# Order deny,allow
+# Deny from all
+# </Directory>
+# <DirectoryMatch "^/Users/Shared/Dev/workspace/Old/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
+# Order allow,deny
+# Allow from all
+# </DirectoryMatch>
+#
+# <FilesMatch "\.inc$">
+# Order allow,deny
+# Deny from all
+# </FilesMatch>
+# <LocationMatch "/(CVS|\.FFV)/">
+# Order allow,deny
+# Deny from all
+# </LocationMatch>
+#
+# Alias /__fudge /Users/Shared/Dev/workspace/Old/drinkaware-matrix/fudge
+# Alias /__data /Users/Shared/Dev/workspace/Old/drinkaware-matrix/data/public
+# Alias /__lib /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/lib
+# Alias / /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/web/index.php/
+#
+#
+# # E_ALL & ~E_NOTICE
+# php_value error_reporting 6135
+# </VirtualHost>
##Magento Sandbox local
-<VirtualHost *:80>
- ServerName magento.localhost
- ServerAlias magento.rickclare
- DocumentRoot "/Users/Shared/Dev/workspace/magento"
- DirectoryIndex index.php
- <Directory "/Users/Shared/Dev/workspace/magento">
- AllowOverride All
- Allow from All
- </Directory>
- ErrorLog /opt/local/apache2/logs/magento_error.log
- CustomLog /opt/local/apache2/logs/magento_access.log combined
- php_flag log_errors on
- php_value error_log /opt/local/apache2/logs/magento_php_error.log
- php_flag display_errors on
-
- # E_ALL & ~E_NOTICE
- php_value error_reporting 6135
-</VirtualHost>
+# <VirtualHost *:80>
+# ServerName magento.localhost
+# ServerAlias magento.rickclare
+# DocumentRoot "/Users/Shared/Dev/workspace/magento"
+# DirectoryIndex index.php
+# <Directory "/Users/Shared/Dev/workspace/magento">
+# AllowOverride All
+# Allow from All
+# </Directory>
+# ErrorLog /opt/local/apache2/logs/magento_error.log
+# CustomLog /opt/local/apache2/logs/magento_access.log combined
+# php_flag log_errors on
+# php_value error_log /opt/local/apache2/logs/magento_php_error.log
+# php_flag display_errors on
+#
+# # E_ALL & ~E_NOTICE
+# php_value error_reporting 6135
+# </VirtualHost>
# Mysource Matrix Sandbox local
# <VirtualHost *:80>
# ServerName drinkaware-matrix.localhost
# ServerAlias www.drinkaware.co.uk
# ServerAlias drinkaware.co.uk
# DirectoryIndex index.php
# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# #php_value error_reporting 6135
#
# DocumentRoot /Users/Shared/Dev/workspace/drinkaware-matrix/core/web
#
# Options -Indexes FollowSymLinks
#
# <Directory /Users/Shared/Dev/workspace/drinkaware-matrix>
# AllowOverride All
# Allow from All
# </Directory>
#
# <DirectoryMatch "^/Users/Shared/Dev/workspace/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
# AllowOverride All
# Allow from All
# </DirectoryMatch>
#
# <FilesMatch "\.inc$">
# Allow from All
# </FilesMatch>
# <LocationMatch "/(CVS|\.FFV)/">
# Allow from All
# </LocationMatch>
#
# Alias /__fudge /Users/Shared/Dev/workspace/drinkaware-matrix/fudge
# Alias /__data /Users/Shared/Dev/workspace/drinkaware-matrix/data/public
# Alias /__lib /Users/Shared/Dev/workspace/drinkaware-matrix/core/lib
# Alias / /Users/Shared/Dev/workspace/drinkaware-matrix/core/web/index.php/
# </VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
diff --git a/httpd.conf b/httpd.conf
index d838f04..df81526 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,512 +1,507 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
#LoadModule xsendfile_module modules/mod_xsendfile.so
## DEV ENV
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-rc2/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-rc2/gems/passenger-2.2.15
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.0.pre4/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.0.pre4
PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
-## LOCAL PRODUCTION
-# LoadModule passenger_module /var/home/www-data/.rvm/gems/ruby-1.9.2-rc2/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
-# PassengerRoot /var/home/www-data/.rvm/gems/ruby-1.9.2-rc2/gems/passenger-2.2.15
-# PassengerRuby /var/home/www-data/.rvm/bin/passenger_ruby
-
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
3cf9f5de0986692450cd065e74e19f9fb2b761bf
|
updating
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index e76f7b2..06b2c36 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,388 +1,422 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName dev.tools.drinkaware.co.uk
ServerAlias localhost.tools.drinkaware.co.uk
DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
<Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
AllowOverride All
Allow from All
</Directory>
# Allows sending files above Request path
##XSendFile on
##XSendFileAllowAbove on
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
RailsEnv development
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|svg)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
-
- RailsAllowModRewrite On
- RewriteEngine On
-
- RewriteCond %{THE_REQUEST} ^(GET|HEAD)
- RewriteCond %{REQUEST_URI} ^/([^.]+)$
- RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f
- RewriteRule ^/[^.]+$ /cache/%1.html [QSA,L]
-
- RewriteCond %{THE_REQUEST} ^(GET|HEAD)
- RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
- RewriteRule ^/$ /cache/index.html [QSA,L]
+ ## Set to log level to 1-9, to enable logging
+ ##RewriteLogLevel 0
+ ##RewriteLog "/tmp/rewrite.log"
+
+ # IMAGES CACHING
+ RewriteCond %{REQUEST_FILENAME} !-s
+ RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI} -s
+ RewriteRule ^(.*)$ /cache/$1 [L]
+
+ # PAGE CACHING
+ RewriteCond %{REQUEST_FILENAME} !-s
+ RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI}.html -s
+ RewriteRule ^(.*)$ /cache/$1 [L]
+
+ # FRONT PAGE CACHING
+ RewriteCond %{REQUEST_URI} "/"
+ RewriteCond %{REQUEST_FILENAME} !-s
+ RewriteCond %{DOCUMENT_ROOT}/cache/index.html -s
+ RewriteRule ^$ /cache/index.html [L]
+
</VirtualHost>
# Tools-Drinkaware-Local-Production (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName local_production.tools.drinkaware.co.uk
DocumentRoot "/var/www/apps/tools-drinkaware/current/public"
<Directory "/var/www/apps/tools-drinkaware/current/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_local_production_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_local_production_access.log combined
RailsBaseURI /
RailsEnv local_production
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
- RailsAllowModRewrite On
RewriteEngine On
-
- RewriteCond %{THE_REQUEST} ^(GET|HEAD)
- RewriteCond %{REQUEST_URI} ^/([^.]+)$
- RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f
- RewriteRule ^/[^.]+$ /cache/%1.html [QSA,L]
-
- RewriteCond %{THE_REQUEST} ^(GET|HEAD)
- RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
- RewriteRule ^/$ /cache/index.html [QSA,L]
+
+ ## Set to log level to 1-9, to enable logging
+ ##RewriteLogLevel 9
+ ##RewriteLog "/tmp/rewrite.log"
+
+ # IMAGES CACHING
+ RewriteCond %{REQUEST_FILENAME} !-s
+ RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI} -s
+ RewriteRule ^(.*)$ /cache/$1 [L]
+
+ # PAGE CACHING
+ RewriteCond %{REQUEST_FILENAME} !-s
+ RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI}.html -s
+ RewriteRule ^(.*)$ /cache/$1 [L]
+
+ # FRONT PAGE CACHING
+ RewriteCond %{REQUEST_URI} "/"
+ RewriteCond %{REQUEST_FILENAME} !-s
+ RewriteCond %{DOCUMENT_ROOT}/cache/index.html -s
+ RewriteRule ^$ /cache/index.html [L]
</VirtualHost>
+## Resolutions-Drinkaware (Rails Passenger, Ruby1.8.7)
+# <VirtualHost *:80>
+# ServerName resolutions.tools.drinkaware.co.uk
+#
+# DocumentRoot "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public"
+# <Directory "/Users/Shared/Dev/workspace/Old/rails-drinkaware.archived.04Feb2010/public">
+# AllowOverride All
+# Allow from All
+# </Directory>
+#
+# ErrorLog /opt/local/apache2/logs/resolutions_rails_drinkaware_error.log
+# CustomLog /opt/local/apache2/logs/resolutions_rails_drinkaware_access.log combined
+# RailsBaseURI /
+# RailsEnv development
+# </VirtualHost>
+
# Drinkaware Matrix Sandbox
<VirtualHost *:80>
ServerName drinkaware-matrix.localhost
ServerAlias www.drinkaware.co.uk
ServerAlias drinkaware.co.uk
DocumentRoot "/Users/Shared/Dev/workspace/Old/drinkaware-matrix"
ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
php_flag log_errors on
php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
php_flag display_errors on
<Directory /Users/Shared/Dev/workspace/Old/drinkaware-matrix>
Order deny,allow
Deny from all
</Directory>
<DirectoryMatch "^/Users/Shared/Dev/workspace/Old/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
Order allow,deny
Allow from all
</DirectoryMatch>
<FilesMatch "\.inc$">
Order allow,deny
Deny from all
</FilesMatch>
<LocationMatch "/(CVS|\.FFV)/">
Order allow,deny
Deny from all
</LocationMatch>
Alias /__fudge /Users/Shared/Dev/workspace/Old/drinkaware-matrix/fudge
Alias /__data /Users/Shared/Dev/workspace/Old/drinkaware-matrix/data/public
Alias /__lib /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/lib
Alias / /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/web/index.php/
# E_ALL & ~E_NOTICE
php_value error_reporting 6135
</VirtualHost>
##Magento Sandbox local
<VirtualHost *:80>
ServerName magento.localhost
ServerAlias magento.rickclare
DocumentRoot "/Users/Shared/Dev/workspace/magento"
DirectoryIndex index.php
<Directory "/Users/Shared/Dev/workspace/magento">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/magento_error.log
CustomLog /opt/local/apache2/logs/magento_access.log combined
php_flag log_errors on
php_value error_log /opt/local/apache2/logs/magento_php_error.log
php_flag display_errors on
# E_ALL & ~E_NOTICE
php_value error_reporting 6135
</VirtualHost>
# Mysource Matrix Sandbox local
# <VirtualHost *:80>
# ServerName drinkaware-matrix.localhost
# ServerAlias www.drinkaware.co.uk
# ServerAlias drinkaware.co.uk
# DirectoryIndex index.php
# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# #php_value error_reporting 6135
#
# DocumentRoot /Users/Shared/Dev/workspace/drinkaware-matrix/core/web
#
# Options -Indexes FollowSymLinks
#
# <Directory /Users/Shared/Dev/workspace/drinkaware-matrix>
# AllowOverride All
# Allow from All
# </Directory>
#
# <DirectoryMatch "^/Users/Shared/Dev/workspace/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
# AllowOverride All
# Allow from All
# </DirectoryMatch>
#
# <FilesMatch "\.inc$">
# Allow from All
# </FilesMatch>
# <LocationMatch "/(CVS|\.FFV)/">
# Allow from All
# </LocationMatch>
#
# Alias /__fudge /Users/Shared/Dev/workspace/drinkaware-matrix/fudge
# Alias /__data /Users/Shared/Dev/workspace/drinkaware-matrix/data/public
# Alias /__lib /Users/Shared/Dev/workspace/drinkaware-matrix/core/lib
# Alias / /Users/Shared/Dev/workspace/drinkaware-matrix/core/web/index.php/
# </VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
diff --git a/httpd.conf b/httpd.conf
index bbac761..d838f04 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,505 +1,512 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
#LoadModule xsendfile_module modules/mod_xsendfile.so
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-preview3/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-preview3/gems/passenger-2.2.15
+
+## DEV ENV
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-rc2/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-rc2/gems/passenger-2.2.15
PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
+## LOCAL PRODUCTION
+# LoadModule passenger_module /var/home/www-data/.rvm/gems/ruby-1.9.2-rc2/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
+# PassengerRoot /var/home/www-data/.rvm/gems/ruby-1.9.2-rc2/gems/passenger-2.2.15
+# PassengerRuby /var/home/www-data/.rvm/bin/passenger_ruby
+
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
901ca15750f157a62610010993c10d9e28f8a864
|
adding svg to expires
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index cf4066d..e76f7b2 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,318 +1,388 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName dev.tools.drinkaware.co.uk
ServerAlias localhost.tools.drinkaware.co.uk
DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
<Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
AllowOverride All
Allow from All
</Directory>
+
+ # Allows sending files above Request path
+ ##XSendFile on
+ ##XSendFileAllowAbove on
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
RailsEnv development
-
+
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
- <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
+ <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|svg)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
+
+ RailsAllowModRewrite On
+ RewriteEngine On
+
+ RewriteCond %{THE_REQUEST} ^(GET|HEAD)
+ RewriteCond %{REQUEST_URI} ^/([^.]+)$
+ RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f
+ RewriteRule ^/[^.]+$ /cache/%1.html [QSA,L]
+
+ RewriteCond %{THE_REQUEST} ^(GET|HEAD)
+ RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
+ RewriteRule ^/$ /cache/index.html [QSA,L]
</VirtualHost>
# Tools-Drinkaware-Local-Production (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName local_production.tools.drinkaware.co.uk
DocumentRoot "/var/www/apps/tools-drinkaware/current/public"
<Directory "/var/www/apps/tools-drinkaware/current/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_local_production_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_local_production_access.log combined
RailsBaseURI /
RailsEnv local_production
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
+
+ RailsAllowModRewrite On
+ RewriteEngine On
+
+ RewriteCond %{THE_REQUEST} ^(GET|HEAD)
+ RewriteCond %{REQUEST_URI} ^/([^.]+)$
+ RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f
+ RewriteRule ^/[^.]+$ /cache/%1.html [QSA,L]
+
+ RewriteCond %{THE_REQUEST} ^(GET|HEAD)
+ RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
+ RewriteRule ^/$ /cache/index.html [QSA,L]
</VirtualHost>
-# Magento Sandbox local
-# <VirtualHost *:80>
-# ServerName magento.localhost
-# ServerAlias magento.rickclare
-# DocumentRoot "/Users/Shared/Dev/workspace/magento"
-# DirectoryIndex index.php
-# <Directory "/Users/Shared/Dev/workspace/magento">
-# AllowOverride All
-# Allow from All
-# </Directory>
-# ErrorLog /opt/local/apache2/logs/magento_error.log
-# CustomLog /opt/local/apache2/logs/magento_access.log combined
-# php_flag log_errors on
-# php_value error_log /opt/local/apache2/logs/magento_php_error.log
-# php_flag display_errors on
-#
-# # E_ALL & ~E_NOTICE
-# php_value error_reporting 6135
-# </VirtualHost>
+# Drinkaware Matrix Sandbox
+<VirtualHost *:80>
+ ServerName drinkaware-matrix.localhost
+ ServerAlias www.drinkaware.co.uk
+ ServerAlias drinkaware.co.uk
+ DocumentRoot "/Users/Shared/Dev/workspace/Old/drinkaware-matrix"
+
+ ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
+ CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
+ php_flag log_errors on
+ php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
+ php_flag display_errors on
+
+ <Directory /Users/Shared/Dev/workspace/Old/drinkaware-matrix>
+ Order deny,allow
+ Deny from all
+ </Directory>
+ <DirectoryMatch "^/Users/Shared/Dev/workspace/Old/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
+ Order allow,deny
+ Allow from all
+ </DirectoryMatch>
+
+ <FilesMatch "\.inc$">
+ Order allow,deny
+ Deny from all
+ </FilesMatch>
+ <LocationMatch "/(CVS|\.FFV)/">
+ Order allow,deny
+ Deny from all
+ </LocationMatch>
+
+ Alias /__fudge /Users/Shared/Dev/workspace/Old/drinkaware-matrix/fudge
+ Alias /__data /Users/Shared/Dev/workspace/Old/drinkaware-matrix/data/public
+ Alias /__lib /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/lib
+ Alias / /Users/Shared/Dev/workspace/Old/drinkaware-matrix/core/web/index.php/
+
+
+ # E_ALL & ~E_NOTICE
+ php_value error_reporting 6135
+</VirtualHost>
+
+
+##Magento Sandbox local
+<VirtualHost *:80>
+ ServerName magento.localhost
+ ServerAlias magento.rickclare
+ DocumentRoot "/Users/Shared/Dev/workspace/magento"
+ DirectoryIndex index.php
+ <Directory "/Users/Shared/Dev/workspace/magento">
+ AllowOverride All
+ Allow from All
+ </Directory>
+ ErrorLog /opt/local/apache2/logs/magento_error.log
+ CustomLog /opt/local/apache2/logs/magento_access.log combined
+ php_flag log_errors on
+ php_value error_log /opt/local/apache2/logs/magento_php_error.log
+ php_flag display_errors on
+
+ # E_ALL & ~E_NOTICE
+ php_value error_reporting 6135
+</VirtualHost>
# Mysource Matrix Sandbox local
# <VirtualHost *:80>
# ServerName drinkaware-matrix.localhost
# ServerAlias www.drinkaware.co.uk
# ServerAlias drinkaware.co.uk
# DirectoryIndex index.php
# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# #php_value error_reporting 6135
#
# DocumentRoot /Users/Shared/Dev/workspace/drinkaware-matrix/core/web
#
# Options -Indexes FollowSymLinks
#
# <Directory /Users/Shared/Dev/workspace/drinkaware-matrix>
# AllowOverride All
# Allow from All
# </Directory>
#
# <DirectoryMatch "^/Users/Shared/Dev/workspace/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
# AllowOverride All
# Allow from All
# </DirectoryMatch>
#
# <FilesMatch "\.inc$">
# Allow from All
# </FilesMatch>
# <LocationMatch "/(CVS|\.FFV)/">
# Allow from All
# </LocationMatch>
#
# Alias /__fudge /Users/Shared/Dev/workspace/drinkaware-matrix/fudge
# Alias /__data /Users/Shared/Dev/workspace/drinkaware-matrix/data/public
# Alias /__lib /Users/Shared/Dev/workspace/drinkaware-matrix/core/lib
# Alias / /Users/Shared/Dev/workspace/drinkaware-matrix/core/web/index.php/
# </VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
diff --git a/httpd.conf b/httpd.conf
index 897e390..bbac761 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,505 +1,505 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-preview3/gems/passenger-2.2.14/ext/apache2/mod_passenger.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-preview3/gems/passenger-2.2.14
+#LoadModule xsendfile_module modules/mod_xsendfile.so
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-preview3/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-preview3/gems/passenger-2.2.15
PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
-PassengerPoolIdleTime 0
-
+PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
diff --git a/httpd.conf.bak b/httpd.conf.bak
index 27d703d..897e390 100644
--- a/httpd.conf.bak
+++ b/httpd.conf.bak
@@ -1,508 +1,505 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
-# LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
-# PassengerRoot /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11
-# PassengerRuby /Users/rick/.rvm/bin/ruby-1.8.7-p249
-LoadModule passenger_module /opt/passenger-2.2.12/ext/apache2/mod_passenger.so
-PassengerRoot /opt/passenger-2.2.12
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-preview3/gems/passenger-2.2.14/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-preview3/gems/passenger-2.2.14
PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
a5dfdbc48190bde24b147b25e472405ed0b50b9f
|
updating gitignore
|
diff --git a/.gitignore b/.gitignore
index 90ec22b..ba9a3fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
.svn
+extra/mod_php.conf.mp_*
|
rickclare/apache2-conf
|
6025c0003a9bcf9b45bafdce767969bc8c06bd69
|
updating passenger
|
diff --git a/httpd.conf b/httpd.conf
index e56fc7f..897e390 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,505 +1,505 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-head/gems/passenger-2.2.14/ext/apache2/mod_passenger.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-head/gems/passenger-2.2.14
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.2-preview3/gems/passenger-2.2.14/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.2-preview3/gems/passenger-2.2.14
PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
dde75b79612d82573e27c1db791c6be0b3d655e1
|
updating passenger
|
diff --git a/httpd.conf b/httpd.conf
index 1acfa13..e56fc7f 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,508 +1,505 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
-# LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
-# PassengerRoot /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11
-# PassengerRuby /Users/rick/.rvm/bin/ruby-1.8.7-p249
-LoadModule passenger_module /opt/passenger-2.2.14/ext/apache2/mod_passenger.so
-PassengerRoot /opt/passenger-2.2.14
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-head/gems/passenger-2.2.14/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-head/gems/passenger-2.2.14
PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
a291d969f315592c8efd9b9e1ef0adfe3ea44cf6
|
updating passenger
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index d9d2ee5..cf4066d 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,275 +1,318 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName dev.tools.drinkaware.co.uk
ServerAlias localhost.tools.drinkaware.co.uk
DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
<Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
RailsEnv development
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
</VirtualHost>
# Tools-Drinkaware-Local-Production (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName local_production.tools.drinkaware.co.uk
DocumentRoot "/var/www/apps/tools-drinkaware/current/public"
<Directory "/var/www/apps/tools-drinkaware/current/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_local_production_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_local_production_access.log combined
RailsBaseURI /
RailsEnv local_production
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
</VirtualHost>
+
# Magento Sandbox local
-<VirtualHost *:80>
- ServerName magento.localhost
- ServerAlias magento.rickclare
- DocumentRoot "/Users/Shared/Dev/workspace/magento"
- DirectoryIndex index.php
- <Directory "/Users/Shared/Dev/workspace/magento">
- AllowOverride All
- Allow from All
- </Directory>
- ErrorLog /opt/local/apache2/logs/magento_error.log
- CustomLog /opt/local/apache2/logs/magento_access.log combined
- php_flag log_errors on
- php_value error_log /opt/local/apache2/logs/magento_php_error.log
- php_flag display_errors on
+# <VirtualHost *:80>
+# ServerName magento.localhost
+# ServerAlias magento.rickclare
+# DocumentRoot "/Users/Shared/Dev/workspace/magento"
+# DirectoryIndex index.php
+# <Directory "/Users/Shared/Dev/workspace/magento">
+# AllowOverride All
+# Allow from All
+# </Directory>
+# ErrorLog /opt/local/apache2/logs/magento_error.log
+# CustomLog /opt/local/apache2/logs/magento_access.log combined
+# php_flag log_errors on
+# php_value error_log /opt/local/apache2/logs/magento_php_error.log
+# php_flag display_errors on
+#
+# # E_ALL & ~E_NOTICE
+# php_value error_reporting 6135
+# </VirtualHost>
- # E_ALL & ~E_NOTICE
- php_value error_reporting 6135
-</VirtualHost>
+# Mysource Matrix Sandbox local
+# <VirtualHost *:80>
+# ServerName drinkaware-matrix.localhost
+# ServerAlias www.drinkaware.co.uk
+# ServerAlias drinkaware.co.uk
+# DirectoryIndex index.php
+# ErrorLog /opt/local/apache2/logs/drinkaware-matrix_error.log
+# CustomLog /opt/local/apache2/logs/drinkaware-matrix_access.log combined
+# php_flag log_errors on
+# php_value error_log /opt/local/apache2/logs/drinkaware-matrix_php_error.log
+# php_flag display_errors on
+#
+# # E_ALL & ~E_NOTICE
+# #php_value error_reporting 6135
+#
+# DocumentRoot /Users/Shared/Dev/workspace/drinkaware-matrix/core/web
+#
+# Options -Indexes FollowSymLinks
+#
+# <Directory /Users/Shared/Dev/workspace/drinkaware-matrix>
+# AllowOverride All
+# Allow from All
+# </Directory>
+#
+# <DirectoryMatch "^/Users/Shared/Dev/workspace/drinkaware-matrix/(core/(web|lib)|data/public|fudge)">
+# AllowOverride All
+# Allow from All
+# </DirectoryMatch>
+#
+# <FilesMatch "\.inc$">
+# Allow from All
+# </FilesMatch>
+# <LocationMatch "/(CVS|\.FFV)/">
+# Allow from All
+# </LocationMatch>
+#
+# Alias /__fudge /Users/Shared/Dev/workspace/drinkaware-matrix/fudge
+# Alias /__data /Users/Shared/Dev/workspace/drinkaware-matrix/data/public
+# Alias /__lib /Users/Shared/Dev/workspace/drinkaware-matrix/core/lib
+# Alias / /Users/Shared/Dev/workspace/drinkaware-matrix/core/web/index.php/
+# </VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
diff --git a/httpd.conf b/httpd.conf
index 27d703d..1acfa13 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,508 +1,508 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
# LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
# PassengerRoot /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11
# PassengerRuby /Users/rick/.rvm/bin/ruby-1.8.7-p249
-LoadModule passenger_module /opt/passenger-2.2.12/ext/apache2/mod_passenger.so
-PassengerRoot /opt/passenger-2.2.12
+LoadModule passenger_module /opt/passenger-2.2.14/ext/apache2/mod_passenger.so
+PassengerRoot /opt/passenger-2.2.14
PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
PassengerPoolIdleTime 0
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
diff --git a/httpd.conf.bak b/httpd.conf.bak
index b18f389..27d703d 100644
--- a/httpd.conf.bak
+++ b/httpd.conf.bak
@@ -1,500 +1,508 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.10/ext/apache2/mod_passenger.so
LoadModule upload_progress_module modules/mod_upload_progress.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.10
-PassengerRuby /Users/rick/.rvm/bin/ruby-1.8.7-p249
+# LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
+# PassengerRoot /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11
+# PassengerRuby /Users/rick/.rvm/bin/ruby-1.8.7-p249
+LoadModule passenger_module /opt/passenger-2.2.12/ext/apache2/mod_passenger.so
+PassengerRoot /opt/passenger-2.2.12
+PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
+
+# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
+# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
+PassengerPoolIdleTime 0
+
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
-User rick
+User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
2ce4c5d50d362329511e76dd7bedded1e5c64a95
|
updating passenger
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index 5cad602..d9d2ee5 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,275 +1,275 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
- ServerName tools.drinkaware.localhost.enableinteractive.co.uk
- ServerAlias tools.drinkaware.dev.enableinteractive.co.uk
+ ServerName dev.tools.drinkaware.co.uk
+ ServerAlias localhost.tools.drinkaware.co.uk
DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
<Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
RailsEnv development
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
</VirtualHost>
# Tools-Drinkaware-Local-Production (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
- ServerName tools.drinkaware.localproduction.enableinteractive.co.uk
+ ServerName local_production.tools.drinkaware.co.uk
DocumentRoot "/var/www/apps/tools-drinkaware/current/public"
<Directory "/var/www/apps/tools-drinkaware/current/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_local_production_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_local_production_access.log combined
RailsBaseURI /
RailsEnv local_production
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
- ExpiresDefault "now"
+ ExpiresDefault "access plus 10 years"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
</VirtualHost>
# Magento Sandbox local
<VirtualHost *:80>
ServerName magento.localhost
ServerAlias magento.rickclare
DocumentRoot "/Users/Shared/Dev/workspace/magento"
DirectoryIndex index.php
<Directory "/Users/Shared/Dev/workspace/magento">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/magento_error.log
CustomLog /opt/local/apache2/logs/magento_access.log combined
php_flag log_errors on
php_value error_log /opt/local/apache2/logs/magento_php_error.log
php_flag display_errors on
# E_ALL & ~E_NOTICE
php_value error_reporting 6135
</VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
diff --git a/httpd.conf b/httpd.conf
index 70f0f63..27d703d 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,504 +1,508 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
# LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
# PassengerRoot /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11
# PassengerRuby /Users/rick/.rvm/bin/ruby-1.8.7-p249
LoadModule passenger_module /opt/passenger-2.2.12/ext/apache2/mod_passenger.so
PassengerRoot /opt/passenger-2.2.12
PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
+# When this value is set to 0, application instances will not be shutdown unless itâs really necessary
+# See http://www.modrails.com/documentation/Users%20guide.html#PassengerPoolIdleTime
+PassengerPoolIdleTime 0
+
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
97c423347cbcfa3c9914e4fccd43625631cb37d4
|
updating
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index 3f7cad8..5cad602 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,274 +1,275 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName tools.drinkaware.localhost.enableinteractive.co.uk
ServerAlias tools.drinkaware.dev.enableinteractive.co.uk
DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
<Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
RailsEnv development
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
</VirtualHost>
# Tools-Drinkaware-Local-Production (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerName tools.drinkaware.localproduction.enableinteractive.co.uk
DocumentRoot "/var/www/apps/tools-drinkaware/current/public"
<Directory "/var/www/apps/tools-drinkaware/current/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_local_production_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_local_production_access.log combined
RailsBaseURI /
RailsEnv local_production
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
</VirtualHost>
# Magento Sandbox local
<VirtualHost *:80>
ServerName magento.localhost
+ ServerAlias magento.rickclare
DocumentRoot "/Users/Shared/Dev/workspace/magento"
DirectoryIndex index.php
<Directory "/Users/Shared/Dev/workspace/magento">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/magento_error.log
CustomLog /opt/local/apache2/logs/magento_access.log combined
php_flag log_errors on
php_value error_log /opt/local/apache2/logs/magento_php_error.log
php_flag display_errors on
# E_ALL & ~E_NOTICE
php_value error_reporting 6135
</VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
diff --git a/httpd.conf b/httpd.conf
index b1ef545..70f0f63 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,504 +1,504 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
# LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
# PassengerRoot /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.11
# PassengerRuby /Users/rick/.rvm/bin/ruby-1.8.7-p249
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.1-p378/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.1-p378/gems/passenger-2.2.11
+LoadModule passenger_module /opt/passenger-2.2.12/ext/apache2/mod_passenger.so
+PassengerRoot /opt/passenger-2.2.12
PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
diff --git a/mime.types b/mime.types
index d20ab01..1ae0097 100644
--- a/mime.types
+++ b/mime.types
@@ -1,1236 +1,1351 @@
# This file maps Internet media types to unique file extension(s).
# Although created for httpd, this file is used by many software systems
# and has been placed in the public domain for unlimited redisribution.
#
# The table below contains both registered and (common) unregistered types.
# A type that has no unique extension can be ignored -- they are listed
# here to guide configurations toward known types and to make it easier to
# identify "new" types. File extensions are also commonly used to indicate
# content languages and encodings, so choose them carefully.
#
# Internet media types should be registered as described in RFC 4288.
# The registry is at <http://www.iana.org/assignments/media-types/>.
#
# MIME type Extensions
-application/activemessage
+# application/3gpp-ims+xml
+# application/activemessage
application/andrew-inset ez
-application/applefile
+# application/applefile
application/applixware aw
application/atom+xml atom
application/atomcat+xml atomcat
-application/atomicmail
+# application/atomicmail
application/atomsvc+xml atomsvc
-application/auth-policy+xml
-application/batch-smtp
-application/beep+xml
-application/cals-1840
+# application/auth-policy+xml
+# application/batch-smtp
+# application/beep+xml
+# application/cals-1840
application/ccxml+xml ccxml
-application/cea-2018+xml
-application/cellml+xml
-application/cnrp+xml
-application/commonground
-application/conference-info+xml
-application/cpl+xml
-application/csta+xml
-application/cstadata+xml
+# application/cea-2018+xml
+# application/cellml+xml
+# application/cnrp+xml
+# application/commonground
+# application/conference-info+xml
+# application/cpl+xml
+# application/csta+xml
+# application/cstadata+xml
application/cu-seeme cu
-application/cybercash
+# application/cybercash
application/davmount+xml davmount
-application/dca-rft
-application/dec-dx
-application/dialog-info+xml
-application/dicom
-application/dns
-application/dvcs
+# application/dca-rft
+# application/dec-dx
+# application/dialog-info+xml
+# application/dicom
+# application/dns
+application/dssc+der dssc
+application/dssc+xml xdssc
+# application/dvcs
application/ecmascript ecma
-application/edi-consent
-application/edi-x12
-application/edifact
+# application/edi-consent
+# application/edi-x12
+# application/edifact
application/emma+xml emma
-application/epp+xml
+# application/epp+xml
application/epub+zip epub
-application/eshop
-application/example
-application/fastinfoset
-application/fastsoap
-application/fits
+# application/eshop
+# application/example
+# application/fastinfoset
+# application/fastsoap
+# application/fits
application/font-tdpfr pfr
-application/h224
-application/http
+# application/h224
+# application/held+xml
+# application/http
application/hyperstudio stk
-application/ibe-key-request+xml
-application/ibe-pkg-reply+xml
-application/ibe-pp-data
-application/iges
-application/im-iscomposing+xml
-application/index
-application/index.cmd
-application/index.obj
-application/index.response
-application/index.vnd
-application/iotp
-application/ipp
-application/isup
+# application/ibe-key-request+xml
+# application/ibe-pkg-reply+xml
+# application/ibe-pp-data
+# application/iges
+# application/im-iscomposing+xml
+# application/index
+# application/index.cmd
+# application/index.obj
+# application/index.response
+# application/index.vnd
+# application/iotp
+application/ipfix ipfix
+# application/ipp
+# application/isup
application/java-archive jar
application/java-serialized-object ser
application/java-vm class
application/javascript js
application/json json
-application/kpml-request+xml
-application/kpml-response+xml
+# application/kpml-request+xml
+# application/kpml-response+xml
application/lost+xml lostxml
application/mac-binhex40 hqx
application/mac-compactpro cpt
-application/macwriteii
+# application/macwriteii
application/marc mrc
application/mathematica ma nb mb
application/mathml+xml mathml
-application/mbms-associated-procedure-description+xml
-application/mbms-deregister+xml
-application/mbms-envelope+xml
-application/mbms-msk+xml
-application/mbms-msk-response+xml
-application/mbms-protection-description+xml
-application/mbms-reception-report+xml
-application/mbms-register+xml
-application/mbms-register-response+xml
-application/mbms-user-service-description+xml
+# application/mbms-associated-procedure-description+xml
+# application/mbms-deregister+xml
+# application/mbms-envelope+xml
+# application/mbms-msk+xml
+# application/mbms-msk-response+xml
+# application/mbms-protection-description+xml
+# application/mbms-reception-report+xml
+# application/mbms-register+xml
+# application/mbms-register-response+xml
+# application/mbms-user-service-description+xml
application/mbox mbox
-application/media_control+xml
+# application/media_control+xml
application/mediaservercontrol+xml mscml
-application/mikey
-application/moss-keys
-application/moss-signature
-application/mosskey-data
-application/mosskey-request
+# application/mikey
+# application/moss-keys
+# application/moss-signature
+# application/mosskey-data
+# application/mosskey-request
application/mp4 mp4s
-application/mpeg4-generic
-application/mpeg4-iod
-application/mpeg4-iod-xmt
+# application/mpeg4-generic
+# application/mpeg4-iod
+# application/mpeg4-iod-xmt
application/msword doc dot
application/mxf mxf
-application/nasdata
-application/news-checkgroups
-application/news-groupinfo
-application/news-transmission
-application/nss
-application/ocsp-request
-application/ocsp-response
-application/octet-stream bin dms lha lrf lzh so iso dmg dist distz pkg bpk dump elc deploy
+# application/nasdata
+# application/news-checkgroups
+# application/news-groupinfo
+# application/news-transmission
+# application/nss
+# application/ocsp-request
+# application/ocsp-response
+application/octet-stream bin dms lha lrf lzh so iso dmg dist distz pkg bpk dump elc deploy
application/oda oda
application/oebps-package+xml opf
application/ogg ogx
application/onenote onetoc onetoc2 onetmp onepkg
-application/parityfec
+# application/parityfec
application/patch-ops-error+xml xer
application/pdf pdf
application/pgp-encrypted pgp
-application/pgp-keys
+# application/pgp-keys
application/pgp-signature asc sig
application/pics-rules prf
-application/pidf+xml
-application/pidf-diff+xml
+# application/pidf+xml
+# application/pidf-diff+xml
application/pkcs10 p10
application/pkcs7-mime p7m p7c
application/pkcs7-signature p7s
application/pkix-cert cer
application/pkix-crl crl
application/pkix-pkipath pkipath
application/pkixcmp pki
application/pls+xml pls
-application/poc-settings+xml
+# application/poc-settings+xml
application/postscript ai eps ps
-application/prs.alvestrand.titrax-sheet
+# application/prs.alvestrand.titrax-sheet
application/prs.cww cww
-application/prs.nprend
-application/prs.plucker
-application/qsig
+# application/prs.nprend
+# application/prs.plucker
+# application/qsig
application/rdf+xml rdf
application/reginfo+xml rif
application/relax-ng-compact-syntax rnc
-application/remote-printing
+# application/remote-printing
application/resource-lists+xml rl
application/resource-lists-diff+xml rld
-application/riscos
-application/rlmi+xml
+# application/riscos
+# application/rlmi+xml
application/rls-services+xml rs
application/rsd+xml rsd
application/rss+xml rss
application/rtf rtf
-application/rtx
-application/samlassertion+xml
-application/samlmetadata+xml
+# application/rtx
+# application/samlassertion+xml
+# application/samlmetadata+xml
application/sbml+xml sbml
application/scvp-cv-request scq
application/scvp-cv-response scs
application/scvp-vp-request spq
application/scvp-vp-response spp
application/sdp sdp
-application/set-payment
+# application/set-payment
application/set-payment-initiation setpay
-application/set-registration
+# application/set-registration
application/set-registration-initiation setreg
-application/sgml
-application/sgml-open-catalog
+# application/sgml
+# application/sgml-open-catalog
application/shf+xml shf
-application/sieve
-application/simple-filter+xml
-application/simple-message-summary
-application/simplesymbolcontainer
-application/slate
-application/smil
+# application/sieve
+# application/simple-filter+xml
+# application/simple-message-summary
+# application/simplesymbolcontainer
+# application/slate
+# application/smil
application/smil+xml smi smil
-application/soap+fastinfoset
-application/soap+xml
+# application/soap+fastinfoset
+# application/soap+xml
application/sparql-query rq
application/sparql-results+xml srx
-application/spirits-event+xml
+# application/spirits-event+xml
application/srgs gram
application/srgs+xml grxml
application/ssml+xml ssml
-application/timestamp-query
-application/timestamp-reply
-application/tve-trigger
-application/ulpfec
-application/vemmi
-application/vividence.scriptfile
-application/vnd.3gpp.bsf+xml
+# application/timestamp-query
+# application/timestamp-reply
+# application/tve-trigger
+# application/ulpfec
+# application/vemmi
+# application/vividence.scriptfile
+# application/vnd.3gpp.bsf+xml
application/vnd.3gpp.pic-bw-large plb
application/vnd.3gpp.pic-bw-small psb
application/vnd.3gpp.pic-bw-var pvb
-application/vnd.3gpp.sms
-application/vnd.3gpp2.bcmcsinfo+xml
-application/vnd.3gpp2.sms
+# application/vnd.3gpp.sms
+# application/vnd.3gpp2.bcmcsinfo+xml
+# application/vnd.3gpp2.sms
application/vnd.3gpp2.tcap tcap
application/vnd.3m.post-it-notes pwn
application/vnd.accpac.simply.aso aso
application/vnd.accpac.simply.imp imp
application/vnd.acucobol acu
application/vnd.acucorp atc acutc
application/vnd.adobe.air-application-installer-package+zip air
+# application/vnd.adobe.partial-upload
application/vnd.adobe.xdp+xml xdp
application/vnd.adobe.xfdf xfdf
-application/vnd.aether.imp
+# application/vnd.aether.imp
application/vnd.airzip.filesecure.azf azf
application/vnd.airzip.filesecure.azs azs
application/vnd.amazon.ebook azw
application/vnd.americandynamics.acc acc
application/vnd.amiga.ami ami
application/vnd.android.package-archive apk
application/vnd.anser-web-certificate-issue-initiation cii
application/vnd.anser-web-funds-transfer-initiation fti
application/vnd.antix.game-component atx
application/vnd.apple.installer+xml mpkg
-application/vnd.arastra.swi swi
+application/vnd.apple.mpegurl m3u8
+# application/vnd.arastra.swi
+application/vnd.aristanetworks.swi swi
application/vnd.audiograph aep
-application/vnd.autopackage
-application/vnd.avistar+xml
+# application/vnd.autopackage
+# application/vnd.avistar+xml
application/vnd.blueice.multipass mpm
-application/vnd.bluetooth.ep.oob
+# application/vnd.bluetooth.ep.oob
application/vnd.bmi bmi
application/vnd.businessobjects rep
-application/vnd.cab-jscript
-application/vnd.canon-cpdl
-application/vnd.canon-lips
-application/vnd.cendio.thinlinc.clientconf
+# application/vnd.cab-jscript
+# application/vnd.canon-cpdl
+# application/vnd.canon-lips
+# application/vnd.cendio.thinlinc.clientconf
application/vnd.chemdraw+xml cdxml
application/vnd.chipnuts.karaoke-mmd mmd
application/vnd.cinderella cdy
-application/vnd.cirpack.isdn-ext
+# application/vnd.cirpack.isdn-ext
application/vnd.claymore cla
+application/vnd.cloanto.rp9 rp9
application/vnd.clonk.c4group c4g c4d c4f c4p c4u
-application/vnd.commerce-battelle
+# application/vnd.commerce-battelle
application/vnd.commonspace csp
application/vnd.contact.cmsg cdbcmsg
application/vnd.cosmocaller cmc
application/vnd.crick.clicker clkx
application/vnd.crick.clicker.keyboard clkk
application/vnd.crick.clicker.palette clkp
application/vnd.crick.clicker.template clkt
application/vnd.crick.clicker.wordbank clkw
application/vnd.criticaltools.wbs+xml wbs
application/vnd.ctc-posml pml
-application/vnd.ctct.ws+xml
-application/vnd.cups-pdf
-application/vnd.cups-postscript
+# application/vnd.ctct.ws+xml
+# application/vnd.cups-pdf
+# application/vnd.cups-postscript
application/vnd.cups-ppd ppd
-application/vnd.cups-raster
-application/vnd.cups-raw
+# application/vnd.cups-raster
+# application/vnd.cups-raw
application/vnd.curl.car car
application/vnd.curl.pcurl pcurl
-application/vnd.cybank
+# application/vnd.cybank
application/vnd.data-vision.rdz rdz
application/vnd.denovo.fcselayout-link fe_launch
-application/vnd.dir-bi.plate-dl-nosuffix
+# application/vnd.dir-bi.plate-dl-nosuffix
application/vnd.dna dna
application/vnd.dolby.mlp mlp
-application/vnd.dolby.mobile.1
-application/vnd.dolby.mobile.2
+# application/vnd.dolby.mobile.1
+# application/vnd.dolby.mobile.2
application/vnd.dpgraph dpg
application/vnd.dreamfactory dfac
-application/vnd.dvb.esgcontainer
-application/vnd.dvb.ipdcdftnotifaccess
-application/vnd.dvb.ipdcesgaccess
-application/vnd.dvb.ipdcroaming
-application/vnd.dvb.iptv.alfec-base
-application/vnd.dvb.iptv.alfec-enhancement
-application/vnd.dvb.notif-aggregate-root+xml
-application/vnd.dvb.notif-container+xml
-application/vnd.dvb.notif-generic+xml
-application/vnd.dvb.notif-ia-msglist+xml
-application/vnd.dvb.notif-ia-registration-request+xml
-application/vnd.dvb.notif-ia-registration-response+xml
-application/vnd.dvb.notif-init+xml
-application/vnd.dxr
+# application/vnd.dvb.esgcontainer
+# application/vnd.dvb.ipdcdftnotifaccess
+# application/vnd.dvb.ipdcesgaccess
+# application/vnd.dvb.ipdcroaming
+# application/vnd.dvb.iptv.alfec-base
+# application/vnd.dvb.iptv.alfec-enhancement
+# application/vnd.dvb.notif-aggregate-root+xml
+# application/vnd.dvb.notif-container+xml
+# application/vnd.dvb.notif-generic+xml
+# application/vnd.dvb.notif-ia-msglist+xml
+# application/vnd.dvb.notif-ia-registration-request+xml
+# application/vnd.dvb.notif-ia-registration-response+xml
+# application/vnd.dvb.notif-init+xml
+# application/vnd.dxr
application/vnd.dynageo geo
-application/vnd.ecdis-update
+# application/vnd.ecdis-update
application/vnd.ecowin.chart mag
-application/vnd.ecowin.filerequest
-application/vnd.ecowin.fileupdate
-application/vnd.ecowin.series
-application/vnd.ecowin.seriesrequest
-application/vnd.ecowin.seriesupdate
-application/vnd.emclient.accessrequest+xml
+# application/vnd.ecowin.filerequest
+# application/vnd.ecowin.fileupdate
+# application/vnd.ecowin.series
+# application/vnd.ecowin.seriesrequest
+# application/vnd.ecowin.seriesupdate
+# application/vnd.emclient.accessrequest+xml
application/vnd.enliven nml
application/vnd.epson.esf esf
application/vnd.epson.msf msf
application/vnd.epson.quickanime qam
application/vnd.epson.salt slt
application/vnd.epson.ssf ssf
-application/vnd.ericsson.quickcall
+# application/vnd.ericsson.quickcall
application/vnd.eszigno3+xml es3 et3
-application/vnd.etsi.aoc+xml
-application/vnd.etsi.cug+xml
-application/vnd.etsi.iptvcommand+xml
-application/vnd.etsi.iptvdiscovery+xml
-application/vnd.etsi.iptvprofile+xml
-application/vnd.etsi.iptvsad-bc+xml
-application/vnd.etsi.iptvsad-cod+xml
-application/vnd.etsi.iptvsad-npvr+xml
-application/vnd.etsi.iptvueprofile+xml
-application/vnd.etsi.mcid+xml
-application/vnd.etsi.sci+xml
-application/vnd.etsi.simservs+xml
-application/vnd.eudora.data
+# application/vnd.etsi.aoc+xml
+# application/vnd.etsi.cug+xml
+# application/vnd.etsi.iptvcommand+xml
+# application/vnd.etsi.iptvdiscovery+xml
+# application/vnd.etsi.iptvprofile+xml
+# application/vnd.etsi.iptvsad-bc+xml
+# application/vnd.etsi.iptvsad-cod+xml
+# application/vnd.etsi.iptvsad-npvr+xml
+# application/vnd.etsi.iptvueprofile+xml
+# application/vnd.etsi.mcid+xml
+# application/vnd.etsi.sci+xml
+# application/vnd.etsi.simservs+xml
+# application/vnd.etsi.tsl+xml
+# application/vnd.etsi.tsl.der
+# application/vnd.eudora.data
application/vnd.ezpix-album ez2
application/vnd.ezpix-package ez3
-application/vnd.f-secure.mobile
+# application/vnd.f-secure.mobile
application/vnd.fdf fdf
application/vnd.fdsn.mseed mseed
application/vnd.fdsn.seed seed dataless
-application/vnd.ffsns
-application/vnd.fints
+# application/vnd.ffsns
+# application/vnd.fints
application/vnd.flographit gph
application/vnd.fluxtime.clip ftc
-application/vnd.font-fontforge-sfd
+# application/vnd.font-fontforge-sfd
application/vnd.framemaker fm frame maker book
application/vnd.frogans.fnc fnc
application/vnd.frogans.ltf ltf
application/vnd.fsc.weblaunch fsc
application/vnd.fujitsu.oasys oas
application/vnd.fujitsu.oasys2 oa2
application/vnd.fujitsu.oasys3 oa3
application/vnd.fujitsu.oasysgp fg5
application/vnd.fujitsu.oasysprs bh2
-application/vnd.fujixerox.art-ex
-application/vnd.fujixerox.art4
-application/vnd.fujixerox.hbpl
+# application/vnd.fujixerox.art-ex
+# application/vnd.fujixerox.art4
+# application/vnd.fujixerox.hbpl
application/vnd.fujixerox.ddd ddd
application/vnd.fujixerox.docuworks xdw
application/vnd.fujixerox.docuworks.binder xbd
-application/vnd.fut-misnet
+# application/vnd.fut-misnet
application/vnd.fuzzysheet fzs
application/vnd.genomatix.tuxedo txd
+# application/vnd.geocube+xml
application/vnd.geogebra.file ggb
application/vnd.geogebra.tool ggt
application/vnd.geometry-explorer gex gre
+application/vnd.geonext gxt
+application/vnd.geoplan g2w
+application/vnd.geospace g3w
+# application/vnd.globalplatform.card-content-mgt
+# application/vnd.globalplatform.card-content-mgt-response
application/vnd.gmx gmx
application/vnd.google-earth.kml+xml kml
application/vnd.google-earth.kmz kmz
application/vnd.grafeq gqf gqs
-application/vnd.gridmp
+# application/vnd.gridmp
application/vnd.groove-account gac
application/vnd.groove-help ghf
application/vnd.groove-identity-message gim
application/vnd.groove-injector grv
application/vnd.groove-tool-message gtm
application/vnd.groove-tool-template tpl
application/vnd.groove-vcard vcg
application/vnd.handheld-entertainment+xml zmm
application/vnd.hbci hbci
-application/vnd.hcl-bireports
+# application/vnd.hcl-bireports
application/vnd.hhe.lesson-player les
application/vnd.hp-hpgl hpgl
application/vnd.hp-hpid hpid
application/vnd.hp-hps hps
application/vnd.hp-jlyt jlt
application/vnd.hp-pcl pcl
application/vnd.hp-pclxl pclxl
-application/vnd.httphone
+# application/vnd.httphone
application/vnd.hydrostatix.sof-data sfd-hdstx
application/vnd.hzn-3d-crossword x3d
-application/vnd.ibm.afplinedata
-application/vnd.ibm.electronic-media
+# application/vnd.ibm.afplinedata
+# application/vnd.ibm.electronic-media
application/vnd.ibm.minipay mpy
application/vnd.ibm.modcap afp listafp list3820
application/vnd.ibm.rights-management irm
application/vnd.ibm.secure-container sc
application/vnd.iccprofile icc icm
application/vnd.igloader igl
application/vnd.immervision-ivp ivp
application/vnd.immervision-ivu ivu
-application/vnd.informedcontrol.rms+xml
-application/vnd.informix-visionary
+# application/vnd.informedcontrol.rms+xml
+# application/vnd.informix-visionary
application/vnd.intercon.formnet xpw xpx
-application/vnd.intertrust.digibox
-application/vnd.intertrust.nncp
+# application/vnd.intertrust.digibox
+# application/vnd.intertrust.nncp
application/vnd.intu.qbo qbo
application/vnd.intu.qfx qfx
-application/vnd.iptc.g2.conceptitem+xml
-application/vnd.iptc.g2.knowledgeitem+xml
-application/vnd.iptc.g2.newsitem+xml
-application/vnd.iptc.g2.packageitem+xml
+# application/vnd.iptc.g2.conceptitem+xml
+# application/vnd.iptc.g2.knowledgeitem+xml
+# application/vnd.iptc.g2.newsitem+xml
+# application/vnd.iptc.g2.packageitem+xml
application/vnd.ipunplugged.rcprofile rcprofile
application/vnd.irepository.package+xml irp
application/vnd.is-xpr xpr
application/vnd.jam jam
-application/vnd.japannet-directory-service
-application/vnd.japannet-jpnstore-wakeup
-application/vnd.japannet-payment-wakeup
-application/vnd.japannet-registration
-application/vnd.japannet-registration-wakeup
-application/vnd.japannet-setstore-wakeup
-application/vnd.japannet-verification
-application/vnd.japannet-verification-wakeup
+# application/vnd.japannet-directory-service
+# application/vnd.japannet-jpnstore-wakeup
+# application/vnd.japannet-payment-wakeup
+# application/vnd.japannet-registration
+# application/vnd.japannet-registration-wakeup
+# application/vnd.japannet-setstore-wakeup
+# application/vnd.japannet-verification
+# application/vnd.japannet-verification-wakeup
application/vnd.jcp.javame.midlet-rms rms
application/vnd.jisp jisp
application/vnd.joost.joda-archive joda
application/vnd.kahootz ktz ktr
application/vnd.kde.karbon karbon
application/vnd.kde.kchart chrt
application/vnd.kde.kformula kfo
application/vnd.kde.kivio flw
application/vnd.kde.kontour kon
application/vnd.kde.kpresenter kpr kpt
application/vnd.kde.kspread ksp
application/vnd.kde.kword kwd kwt
application/vnd.kenameaapp htke
application/vnd.kidspiration kia
application/vnd.kinar kne knp
application/vnd.koan skp skd skt skm
application/vnd.kodak-descriptor sse
-application/vnd.liberty-request+xml
+# application/vnd.liberty-request+xml
application/vnd.llamagraphics.life-balance.desktop lbd
application/vnd.llamagraphics.life-balance.exchange+xml lbe
application/vnd.lotus-1-2-3 123
application/vnd.lotus-approach apr
application/vnd.lotus-freelance pre
application/vnd.lotus-notes nsf
application/vnd.lotus-organizer org
application/vnd.lotus-screencam scm
application/vnd.lotus-wordpro lwp
application/vnd.macports.portpkg portpkg
-application/vnd.marlin.drm.actiontoken+xml
-application/vnd.marlin.drm.conftoken+xml
-application/vnd.marlin.drm.license+xml
-application/vnd.marlin.drm.mdcf
+# application/vnd.marlin.drm.actiontoken+xml
+# application/vnd.marlin.drm.conftoken+xml
+# application/vnd.marlin.drm.license+xml
+# application/vnd.marlin.drm.mdcf
application/vnd.mcd mcd
application/vnd.medcalcdata mc1
application/vnd.mediastation.cdkey cdkey
-application/vnd.meridian-slingshot
+# application/vnd.meridian-slingshot
application/vnd.mfer mwf
application/vnd.mfmp mfm
application/vnd.micrografx.flo flo
application/vnd.micrografx.igx igx
application/vnd.mif mif
-application/vnd.minisoft-hp3000-save
-application/vnd.mitsubishi.misty-guard.trustweb
+# application/vnd.minisoft-hp3000-save
+# application/vnd.mitsubishi.misty-guard.trustweb
application/vnd.mobius.daf daf
application/vnd.mobius.dis dis
application/vnd.mobius.mbk mbk
application/vnd.mobius.mqy mqy
application/vnd.mobius.msl msl
application/vnd.mobius.plc plc
application/vnd.mobius.txf txf
application/vnd.mophun.application mpn
application/vnd.mophun.certificate mpc
-application/vnd.motorola.flexsuite
-application/vnd.motorola.flexsuite.adsi
-application/vnd.motorola.flexsuite.fis
-application/vnd.motorola.flexsuite.gotap
-application/vnd.motorola.flexsuite.kmr
-application/vnd.motorola.flexsuite.ttc
-application/vnd.motorola.flexsuite.wem
-application/vnd.motorola.iprm
+# application/vnd.motorola.flexsuite
+# application/vnd.motorola.flexsuite.adsi
+# application/vnd.motorola.flexsuite.fis
+# application/vnd.motorola.flexsuite.gotap
+# application/vnd.motorola.flexsuite.kmr
+# application/vnd.motorola.flexsuite.ttc
+# application/vnd.motorola.flexsuite.wem
+# application/vnd.motorola.iprm
application/vnd.mozilla.xul+xml xul
application/vnd.ms-artgalry cil
-application/vnd.ms-asf
+# application/vnd.ms-asf
application/vnd.ms-cab-compressed cab
application/vnd.ms-excel xls xlm xla xlc xlt xlw
application/vnd.ms-excel.addin.macroenabled.12 xlam
application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb
application/vnd.ms-excel.sheet.macroenabled.12 xlsm
application/vnd.ms-excel.template.macroenabled.12 xltm
application/vnd.ms-fontobject eot
application/vnd.ms-htmlhelp chm
application/vnd.ms-ims ims
application/vnd.ms-lrm lrm
application/vnd.ms-pki.seccat cat
application/vnd.ms-pki.stl stl
-application/vnd.ms-playready.initiator+xml
+# application/vnd.ms-playready.initiator+xml
application/vnd.ms-powerpoint ppt pps pot
application/vnd.ms-powerpoint.addin.macroenabled.12 ppam
application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm
application/vnd.ms-powerpoint.slide.macroenabled.12 sldm
application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm
application/vnd.ms-powerpoint.template.macroenabled.12 potm
application/vnd.ms-project mpp mpt
-application/vnd.ms-tnef
-application/vnd.ms-wmdrm.lic-chlg-req
-application/vnd.ms-wmdrm.lic-resp
-application/vnd.ms-wmdrm.meter-chlg-req
-application/vnd.ms-wmdrm.meter-resp
+# application/vnd.ms-tnef
+# application/vnd.ms-wmdrm.lic-chlg-req
+# application/vnd.ms-wmdrm.lic-resp
+# application/vnd.ms-wmdrm.meter-chlg-req
+# application/vnd.ms-wmdrm.meter-resp
application/vnd.ms-word.document.macroenabled.12 docm
application/vnd.ms-word.template.macroenabled.12 dotm
application/vnd.ms-works wps wks wcm wdb
application/vnd.ms-wpl wpl
application/vnd.ms-xpsdocument xps
application/vnd.mseq mseq
-application/vnd.msign
-application/vnd.multiad.creator
-application/vnd.multiad.creator.cif
-application/vnd.music-niff
+# application/vnd.msign
+# application/vnd.multiad.creator
+# application/vnd.multiad.creator.cif
+# application/vnd.music-niff
application/vnd.musician mus
application/vnd.muvee.style msty
-application/vnd.ncd.control
-application/vnd.ncd.reference
-application/vnd.nervana
-application/vnd.netfpx
+# application/vnd.ncd.control
+# application/vnd.ncd.reference
+# application/vnd.nervana
+# application/vnd.netfpx
application/vnd.neurolanguage.nlu nlu
application/vnd.noblenet-directory nnd
application/vnd.noblenet-sealer nns
application/vnd.noblenet-web nnw
-application/vnd.nokia.catalogs
-application/vnd.nokia.conml+wbxml
-application/vnd.nokia.conml+xml
-application/vnd.nokia.isds-radio-presets
-application/vnd.nokia.iptv.config+xml
-application/vnd.nokia.landmark+wbxml
-application/vnd.nokia.landmark+xml
-application/vnd.nokia.landmarkcollection+xml
-application/vnd.nokia.n-gage.ac+xml
+# application/vnd.nokia.catalogs
+# application/vnd.nokia.conml+wbxml
+# application/vnd.nokia.conml+xml
+# application/vnd.nokia.isds-radio-presets
+# application/vnd.nokia.iptv.config+xml
+# application/vnd.nokia.landmark+wbxml
+# application/vnd.nokia.landmark+xml
+# application/vnd.nokia.landmarkcollection+xml
+# application/vnd.nokia.n-gage.ac+xml
application/vnd.nokia.n-gage.data ngdat
application/vnd.nokia.n-gage.symbian.install n-gage
-application/vnd.nokia.ncd
-application/vnd.nokia.pcd+wbxml
-application/vnd.nokia.pcd+xml
+# application/vnd.nokia.ncd
+# application/vnd.nokia.pcd+wbxml
+# application/vnd.nokia.pcd+xml
application/vnd.nokia.radio-preset rpst
application/vnd.nokia.radio-presets rpss
application/vnd.novadigm.edm edm
application/vnd.novadigm.edx edx
application/vnd.novadigm.ext ext
+# application/vnd.ntt-local.file-transfer
application/vnd.oasis.opendocument.chart odc
application/vnd.oasis.opendocument.chart-template otc
application/vnd.oasis.opendocument.database odb
application/vnd.oasis.opendocument.formula odf
application/vnd.oasis.opendocument.formula-template odft
application/vnd.oasis.opendocument.graphics odg
application/vnd.oasis.opendocument.graphics-template otg
application/vnd.oasis.opendocument.image odi
application/vnd.oasis.opendocument.image-template oti
application/vnd.oasis.opendocument.presentation odp
-application/vnd.oasis.opendocument.presentation-template otp
+application/vnd.oasis.opendocument.presentation-template otp
application/vnd.oasis.opendocument.spreadsheet ods
application/vnd.oasis.opendocument.spreadsheet-template ots
application/vnd.oasis.opendocument.text odt
application/vnd.oasis.opendocument.text-master otm
application/vnd.oasis.opendocument.text-template ott
application/vnd.oasis.opendocument.text-web oth
-application/vnd.obn
+# application/vnd.obn
application/vnd.olpc-sugar xo
-application/vnd.oma-scws-config
-application/vnd.oma-scws-http-request
-application/vnd.oma-scws-http-response
-application/vnd.oma.bcast.associated-procedure-parameter+xml
-application/vnd.oma.bcast.drm-trigger+xml
-application/vnd.oma.bcast.imd+xml
-application/vnd.oma.bcast.ltkm
-application/vnd.oma.bcast.notification+xml
-application/vnd.oma.bcast.provisioningtrigger
-application/vnd.oma.bcast.sgboot
-application/vnd.oma.bcast.sgdd+xml
-application/vnd.oma.bcast.sgdu
-application/vnd.oma.bcast.simple-symbol-container
-application/vnd.oma.bcast.smartcard-trigger+xml
-application/vnd.oma.bcast.sprov+xml
-application/vnd.oma.bcast.stkm
-application/vnd.oma.dcd
-application/vnd.oma.dcdc
+# application/vnd.oma-scws-config
+# application/vnd.oma-scws-http-request
+# application/vnd.oma-scws-http-response
+# application/vnd.oma.bcast.associated-procedure-parameter+xml
+# application/vnd.oma.bcast.drm-trigger+xml
+# application/vnd.oma.bcast.imd+xml
+# application/vnd.oma.bcast.ltkm
+# application/vnd.oma.bcast.notification+xml
+# application/vnd.oma.bcast.provisioningtrigger
+# application/vnd.oma.bcast.sgboot
+# application/vnd.oma.bcast.sgdd+xml
+# application/vnd.oma.bcast.sgdu
+# application/vnd.oma.bcast.simple-symbol-container
+# application/vnd.oma.bcast.smartcard-trigger+xml
+# application/vnd.oma.bcast.sprov+xml
+# application/vnd.oma.bcast.stkm
+# application/vnd.oma.dcd
+# application/vnd.oma.dcdc
application/vnd.oma.dd2+xml dd2
-application/vnd.oma.drm.risd+xml
-application/vnd.oma.group-usage-list+xml
-application/vnd.oma.poc.detailed-progress-report+xml
-application/vnd.oma.poc.final-report+xml
-application/vnd.oma.poc.groups+xml
-application/vnd.oma.poc.invocation-descriptor+xml
-application/vnd.oma.poc.optimized-progress-report+xml
-application/vnd.oma.xcap-directory+xml
-application/vnd.omads-email+xml
-application/vnd.omads-file+xml
-application/vnd.omads-folder+xml
-application/vnd.omaloc-supl-init
+# application/vnd.oma.drm.risd+xml
+# application/vnd.oma.group-usage-list+xml
+# application/vnd.oma.poc.detailed-progress-report+xml
+# application/vnd.oma.poc.final-report+xml
+# application/vnd.oma.poc.groups+xml
+# application/vnd.oma.poc.invocation-descriptor+xml
+# application/vnd.oma.poc.optimized-progress-report+xml
+# application/vnd.oma.push
+# application/vnd.oma.scidm.messages+xml
+# application/vnd.oma.xcap-directory+xml
+# application/vnd.omads-email+xml
+# application/vnd.omads-file+xml
+# application/vnd.omads-folder+xml
+# application/vnd.omaloc-supl-init
application/vnd.openofficeorg.extension oxt
-application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
+# application/vnd.openxmlformats-officedocument.custom-properties+xml
+# application/vnd.openxmlformats-officedocument.customxmlproperties+xml
+# application/vnd.openxmlformats-officedocument.drawing+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chart+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml
+# application/vnd.openxmlformats-officedocument.extended-properties+xml
+# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml
+# application/vnd.openxmlformats-officedocument.presentationml.comments+xml
+# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml
+application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
+# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml
application/vnd.openxmlformats-officedocument.presentationml.slide sldx
+# application/vnd.openxmlformats-officedocument.presentationml.slide+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml
application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
+# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tags+xml
application/vnd.openxmlformats-officedocument.presentationml.template potx
+# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml
application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml
+# application/vnd.openxmlformats-officedocument.theme+xml
+# application/vnd.openxmlformats-officedocument.themeoverride+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml
application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
-application/vnd.osa.netdeploy
-application/vnd.osgi.bundle
+# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml
+# application/vnd.openxmlformats-package.core-properties+xml
+# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml
+# application/vnd.osa.netdeploy
+# application/vnd.osgi.bundle
application/vnd.osgi.dp dp
-application/vnd.otps.ct-kip+xml
+# application/vnd.otps.ct-kip+xml
application/vnd.palm pdb pqa oprc
-application/vnd.paos.xml
+# application/vnd.paos.xml
+application/vnd.pawaafile paw
application/vnd.pg.format str
application/vnd.pg.osasli ei6
-application/vnd.piaccess.application-licence
+# application/vnd.piaccess.application-licence
application/vnd.picsel efif
-application/vnd.poc.group-advertisement+xml
+application/vnd.pmi.widget wg
+# application/vnd.poc.group-advertisement+xml
application/vnd.pocketlearn plf
application/vnd.powerbuilder6 pbd
-application/vnd.powerbuilder6-s
-application/vnd.powerbuilder7
-application/vnd.powerbuilder7-s
-application/vnd.powerbuilder75
-application/vnd.powerbuilder75-s
-application/vnd.preminet
+# application/vnd.powerbuilder6-s
+# application/vnd.powerbuilder7
+# application/vnd.powerbuilder7-s
+# application/vnd.powerbuilder75
+# application/vnd.powerbuilder75-s
+# application/vnd.preminet
application/vnd.previewsystems.box box
application/vnd.proteus.magazine mgz
application/vnd.publishare-delta-tree qps
application/vnd.pvi.ptid1 ptid
-application/vnd.pwg-multiplexed
-application/vnd.pwg-xhtml-print+xml
-application/vnd.qualcomm.brew-app-res
+# application/vnd.pwg-multiplexed
+# application/vnd.pwg-xhtml-print+xml
+# application/vnd.qualcomm.brew-app-res
application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb
-application/vnd.rapid
+# application/vnd.radisys.moml+xml
+# application/vnd.radisys.msml+xml
+# application/vnd.radisys.msml-audit+xml
+# application/vnd.radisys.msml-audit-conf+xml
+# application/vnd.radisys.msml-audit-conn+xml
+# application/vnd.radisys.msml-audit-dialog+xml
+# application/vnd.radisys.msml-audit-stream+xml
+# application/vnd.radisys.msml-conf+xml
+# application/vnd.radisys.msml-dialog+xml
+# application/vnd.radisys.msml-dialog-base+xml
+# application/vnd.radisys.msml-dialog-fax-detect+xml
+# application/vnd.radisys.msml-dialog-fax-sendrecv+xml
+# application/vnd.radisys.msml-dialog-group+xml
+# application/vnd.radisys.msml-dialog-speech+xml
+# application/vnd.radisys.msml-dialog-transform+xml
+# application/vnd.rapid
+application/vnd.realvnc.bed bed
application/vnd.recordare.musicxml mxl
application/vnd.recordare.musicxml+xml musicxml
-application/vnd.renlearn.rlprint
+# application/vnd.renlearn.rlprint
application/vnd.rim.cod cod
application/vnd.rn-realmedia rm
application/vnd.route66.link66+xml link66
-application/vnd.ruckus.download
-application/vnd.s3sms
-application/vnd.sbm.cid
-application/vnd.sbm.mid2
-application/vnd.scribus
-application/vnd.sealed.3df
-application/vnd.sealed.csf
-application/vnd.sealed.doc
-application/vnd.sealed.eml
-application/vnd.sealed.mht
-application/vnd.sealed.net
-application/vnd.sealed.ppt
-application/vnd.sealed.tiff
-application/vnd.sealed.xls
-application/vnd.sealedmedia.softseal.html
-application/vnd.sealedmedia.softseal.pdf
+# application/vnd.ruckus.download
+# application/vnd.s3sms
+application/vnd.sailingtracker.track st
+# application/vnd.sbm.cid
+# application/vnd.sbm.mid2
+# application/vnd.scribus
+# application/vnd.sealed.3df
+# application/vnd.sealed.csf
+# application/vnd.sealed.doc
+# application/vnd.sealed.eml
+# application/vnd.sealed.mht
+# application/vnd.sealed.net
+# application/vnd.sealed.ppt
+# application/vnd.sealed.tiff
+# application/vnd.sealed.xls
+# application/vnd.sealedmedia.softseal.html
+# application/vnd.sealedmedia.softseal.pdf
application/vnd.seemail see
application/vnd.sema sema
application/vnd.semd semd
application/vnd.semf semf
application/vnd.shana.informed.formdata ifm
application/vnd.shana.informed.formtemplate itp
application/vnd.shana.informed.interchange iif
application/vnd.shana.informed.package ipk
application/vnd.simtech-mindmapper twd twds
application/vnd.smaf mmf
+# application/vnd.smart.notebook
application/vnd.smart.teacher teacher
-application/vnd.software602.filler.form+xml
-application/vnd.software602.filler.form-xml-zip
+# application/vnd.software602.filler.form+xml
+# application/vnd.software602.filler.form-xml-zip
application/vnd.solent.sdkm+xml sdkm sdkd
application/vnd.spotfire.dxp dxp
application/vnd.spotfire.sfs sfs
-application/vnd.sss-cod
-application/vnd.sss-dtf
-application/vnd.sss-ntf
+# application/vnd.sss-cod
+# application/vnd.sss-dtf
+# application/vnd.sss-ntf
application/vnd.stardivision.calc sdc
application/vnd.stardivision.draw sda
application/vnd.stardivision.impress sdd
application/vnd.stardivision.math smf
application/vnd.stardivision.writer sdw
application/vnd.stardivision.writer vor
application/vnd.stardivision.writer-global sgl
-application/vnd.street-stream
+# application/vnd.street-stream
application/vnd.sun.xml.calc sxc
application/vnd.sun.xml.calc.template stc
application/vnd.sun.xml.draw sxd
application/vnd.sun.xml.draw.template std
application/vnd.sun.xml.impress sxi
application/vnd.sun.xml.impress.template sti
application/vnd.sun.xml.math sxm
application/vnd.sun.xml.writer sxw
application/vnd.sun.xml.writer.global sxg
application/vnd.sun.xml.writer.template stw
-application/vnd.sun.wadl+xml
+# application/vnd.sun.wadl+xml
application/vnd.sus-calendar sus susp
application/vnd.svd svd
-application/vnd.swiftview-ics
+# application/vnd.swiftview-ics
application/vnd.symbian.install sis sisx
application/vnd.syncml+xml xsm
application/vnd.syncml.dm+wbxml bdm
application/vnd.syncml.dm+xml xdm
-application/vnd.syncml.dm.notification
-application/vnd.syncml.ds.notification
+# application/vnd.syncml.dm.notification
+# application/vnd.syncml.ds.notification
application/vnd.tao.intent-module-archive tao
application/vnd.tmobile-livetv tmo
application/vnd.trid.tpt tpt
application/vnd.triscape.mxs mxs
application/vnd.trueapp tra
-application/vnd.truedoc
+# application/vnd.truedoc
application/vnd.ufdl ufd ufdl
application/vnd.uiq.theme utz
application/vnd.umajin umj
application/vnd.unity unityweb
application/vnd.uoml+xml uoml
-application/vnd.uplanet.alert
-application/vnd.uplanet.alert-wbxml
-application/vnd.uplanet.bearer-choice
-application/vnd.uplanet.bearer-choice-wbxml
-application/vnd.uplanet.cacheop
-application/vnd.uplanet.cacheop-wbxml
-application/vnd.uplanet.channel
-application/vnd.uplanet.channel-wbxml
-application/vnd.uplanet.list
-application/vnd.uplanet.list-wbxml
-application/vnd.uplanet.listcmd
-application/vnd.uplanet.listcmd-wbxml
-application/vnd.uplanet.signal
+# application/vnd.uplanet.alert
+# application/vnd.uplanet.alert-wbxml
+# application/vnd.uplanet.bearer-choice
+# application/vnd.uplanet.bearer-choice-wbxml
+# application/vnd.uplanet.cacheop
+# application/vnd.uplanet.cacheop-wbxml
+# application/vnd.uplanet.channel
+# application/vnd.uplanet.channel-wbxml
+# application/vnd.uplanet.list
+# application/vnd.uplanet.list-wbxml
+# application/vnd.uplanet.listcmd
+# application/vnd.uplanet.listcmd-wbxml
+# application/vnd.uplanet.signal
application/vnd.vcx vcx
-application/vnd.vd-study
-application/vnd.vectorworks
-application/vnd.vidsoft.vidconference
+# application/vnd.vd-study
+# application/vnd.vectorworks
+# application/vnd.vidsoft.vidconference
application/vnd.visio vsd vst vss vsw
application/vnd.visionary vis
-application/vnd.vividence.scriptfile
+# application/vnd.vividence.scriptfile
application/vnd.vsf vsf
-application/vnd.wap.sic
-application/vnd.wap.slc
+# application/vnd.wap.sic
+# application/vnd.wap.slc
application/vnd.wap.wbxml wbxml
application/vnd.wap.wmlc wmlc
application/vnd.wap.wmlscriptc wmlsc
application/vnd.webturbo wtb
-application/vnd.wfa.wsc
-application/vnd.wmc
-application/vnd.wmf.bootstrap
+# application/vnd.wfa.wsc
+# application/vnd.wmc
+# application/vnd.wmf.bootstrap
+# application/vnd.wolfram.mathematica
+# application/vnd.wolfram.mathematica.package
+application/vnd.wolfram.player nbp
application/vnd.wordperfect wpd
application/vnd.wqd wqd
-application/vnd.wrq-hp3000-labelled
+# application/vnd.wrq-hp3000-labelled
application/vnd.wt.stf stf
-application/vnd.wv.csp+wbxml
-application/vnd.wv.csp+xml
-application/vnd.wv.ssp+xml
+# application/vnd.wv.csp+wbxml
+# application/vnd.wv.csp+xml
+# application/vnd.wv.ssp+xml
application/vnd.xara xar
application/vnd.xfdl xfdl
-application/vnd.xfdl.webform
-application/vnd.xmi+xml
-application/vnd.xmpie.cpkg
-application/vnd.xmpie.dpkg
-application/vnd.xmpie.plan
-application/vnd.xmpie.ppkg
-application/vnd.xmpie.xlim
+# application/vnd.xfdl.webform
+# application/vnd.xmi+xml
+# application/vnd.xmpie.cpkg
+# application/vnd.xmpie.dpkg
+# application/vnd.xmpie.plan
+# application/vnd.xmpie.ppkg
+# application/vnd.xmpie.xlim
application/vnd.yamaha.hv-dic hvd
application/vnd.yamaha.hv-script hvs
application/vnd.yamaha.hv-voice hvp
application/vnd.yamaha.openscoreformat osf
application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg
application/vnd.yamaha.smaf-audio saf
application/vnd.yamaha.smaf-phrase spf
application/vnd.yellowriver-custom-menu cmp
application/vnd.zul zir zirz
application/vnd.zzazz.deck+xml zaz
application/voicexml+xml vxml
-application/watcherinfo+xml
-application/whoispp-query
-application/whoispp-response
+# application/watcherinfo+xml
+# application/whoispp-query
+# application/whoispp-response
application/winhlp hlp
-application/wita
-application/wordperfect5.1
+# application/wita
+# application/wordperfect5.1
application/wsdl+xml wsdl
application/wspolicy+xml wspolicy
application/x-abiword abw
application/x-ace-compressed ace
application/x-authorware-bin aab x32 u32 vox
application/x-authorware-map aam
application/x-authorware-seg aas
application/x-bcpio bcpio
application/x-bittorrent torrent
application/x-bzip bz
application/x-bzip2 bz2 boz
application/x-cdlink vcd
application/x-chat chat
application/x-chess-pgn pgn
-application/x-compress
+# application/x-compress
application/x-cpio cpio
application/x-csh csh
application/x-debian-package deb udeb
application/x-director dir dcr dxr cst cct cxt w3d fgd swa
application/x-doom wad
application/x-dtbncx+xml ncx
application/x-dtbook+xml dtb
application/x-dtbresource+xml res
application/x-dvi dvi
application/x-font-bdf bdf
-application/x-font-dos
-application/x-font-framemaker
+# application/x-font-dos
+# application/x-font-framemaker
application/x-font-ghostscript gsf
-application/x-font-libgrx
+# application/x-font-libgrx
application/x-font-linux-psf psf
application/x-font-otf otf
application/x-font-pcf pcf
application/x-font-snf snf
-application/x-font-speedo
-application/x-font-sunos-news
+# application/x-font-speedo
+# application/x-font-sunos-news
application/x-font-ttf ttf ttc
application/x-font-type1 pfa pfb pfm afm
-application/x-font-vfont
+# application/x-font-vfont
application/x-futuresplash spl
application/x-gnumeric gnumeric
application/x-gtar gtar
-application/x-gzip
+# application/x-gzip
application/x-hdf hdf
application/x-java-jnlp-file jnlp
application/x-latex latex
application/x-mobipocket-ebook prc mobi
application/x-ms-application application
application/x-ms-wmd wmd
application/x-ms-wmz wmz
application/x-ms-xbap xbap
application/x-msaccess mdb
application/x-msbinder obd
application/x-mscardfile crd
application/x-msclip clp
application/x-msdownload exe dll com bat msi
application/x-msmediaview mvb m13 m14
application/x-msmetafile wmf
application/x-msmoney mny
application/x-mspublisher pub
application/x-msschedule scd
application/x-msterminal trm
application/x-mswrite wri
application/x-netcdf nc cdf
application/x-pkcs12 p12 pfx
application/x-pkcs7-certificates p7b spc
application/x-pkcs7-certreqresp p7r
application/x-rar-compressed rar
application/x-sh sh
application/x-shar shar
application/x-shockwave-flash swf
application/x-silverlight-app xap
application/x-stuffit sit
application/x-stuffitx sitx
application/x-sv4cpio sv4cpio
application/x-sv4crc sv4crc
application/x-tar tar
application/x-tcl tcl
application/x-tex tex
application/x-tex-tfm tfm
application/x-texinfo texinfo texi
application/x-ustar ustar
application/x-wais-source src
application/x-x509-ca-cert der crt
application/x-xfig fig
application/x-xpinstall xpi
-application/x400-bp
-application/xcap-att+xml
-application/xcap-caps+xml
-application/xcap-el+xml
-application/xcap-error+xml
-application/xcap-ns+xml
-application/xcon-conference-info-diff+xml
-application/xcon-conference-info+xml
+# application/x400-bp
+# application/xcap-att+xml
+# application/xcap-caps+xml
+# application/xcap-el+xml
+# application/xcap-error+xml
+# application/xcap-ns+xml
+# application/xcon-conference-info-diff+xml
+# application/xcon-conference-info+xml
application/xenc+xml xenc
application/xhtml+xml xhtml xht
-application/xhtml-voice+xml
+# application/xhtml-voice+xml
application/xml xml xsl
application/xml-dtd dtd
-application/xml-external-parsed-entity
-application/xmpp+xml
+# application/xml-external-parsed-entity
+# application/xmpp+xml
application/xop+xml xop
application/xslt+xml xslt
application/xspf+xml xspf
application/xv+xml mxml xhvml xvml xvm
application/zip zip
-audio/32kadpcm
-audio/3gpp
-audio/3gpp2
-audio/ac3
+# audio/32kadpcm
+# audio/3gpp
+# audio/3gpp2
+# audio/ac3
audio/adpcm adp
-audio/amr
-audio/amr-wb
-audio/amr-wb+
-audio/asc
+# audio/amr
+# audio/amr-wb
+# audio/amr-wb+
+# audio/asc
+# audio/atrac-advanced-lossless
+# audio/atrac-x
+# audio/atrac3
audio/basic au snd
-audio/bv16
-audio/bv32
-audio/clearmode
-audio/cn
-audio/dat12
-audio/dls
-audio/dsr-es201108
-audio/dsr-es202050
-audio/dsr-es202211
-audio/dsr-es202212
-audio/dvi4
-audio/eac3
-audio/evrc
-audio/evrc-qcp
-audio/evrc0
-audio/evrc1
-audio/evrcb
-audio/evrcb0
-audio/evrcb1
-audio/evrcwb
-audio/evrcwb0
-audio/evrcwb1
-audio/example
-audio/g719
-audio/g722
-audio/g7221
-audio/g723
-audio/g726-16
-audio/g726-24
-audio/g726-32
-audio/g726-40
-audio/g728
-audio/g729
-audio/g7291
-audio/g729d
-audio/g729e
-audio/gsm
-audio/gsm-efr
-audio/ilbc
-audio/l16
-audio/l20
-audio/l24
-audio/l8
-audio/lpc
+# audio/bv16
+# audio/bv32
+# audio/clearmode
+# audio/cn
+# audio/dat12
+# audio/dls
+# audio/dsr-es201108
+# audio/dsr-es202050
+# audio/dsr-es202211
+# audio/dsr-es202212
+# audio/dvi4
+# audio/eac3
+# audio/evrc
+# audio/evrc-qcp
+# audio/evrc0
+# audio/evrc1
+# audio/evrcb
+# audio/evrcb0
+# audio/evrcb1
+# audio/evrcwb
+# audio/evrcwb0
+# audio/evrcwb1
+# audio/example
+# audio/g719
+# audio/g722
+# audio/g7221
+# audio/g723
+# audio/g726-16
+# audio/g726-24
+# audio/g726-32
+# audio/g726-40
+# audio/g728
+# audio/g729
+# audio/g7291
+# audio/g729d
+# audio/g729e
+# audio/gsm
+# audio/gsm-efr
+# audio/ilbc
+# audio/l16
+# audio/l20
+# audio/l24
+# audio/l8
+# audio/lpc
audio/midi mid midi kar rmi
-audio/mobile-xmf
+# audio/mobile-xmf
audio/mp4 mp4a
-audio/mp4a-latm
-audio/mpa
-audio/mpa-robust
+# audio/mp4a-latm
+# audio/mpa
+# audio/mpa-robust
audio/mpeg mpga mp2 mp2a mp3 m2a m3a
-audio/mpeg4-generic
+# audio/mpeg4-generic
audio/ogg oga ogg spx
-audio/parityfec
-audio/pcma
-audio/pcma-wb
-audio/pcmu-wb
-audio/pcmu
-audio/prs.sid
-audio/qcelp
-audio/red
-audio/rtp-enc-aescm128
-audio/rtp-midi
-audio/rtx
-audio/smv
-audio/smv0
-audio/smv-qcp
-audio/sp-midi
-audio/t140c
-audio/t38
-audio/telephone-event
-audio/tone
-audio/ulpfec
-audio/vdvi
-audio/vmr-wb
-audio/vnd.3gpp.iufp
-audio/vnd.4sb
-audio/vnd.audiokoz
-audio/vnd.celp
-audio/vnd.cisco.nse
-audio/vnd.cmles.radio-events
-audio/vnd.cns.anp1
-audio/vnd.cns.inf1
+# audio/parityfec
+# audio/pcma
+# audio/pcma-wb
+# audio/pcmu-wb
+# audio/pcmu
+# audio/prs.sid
+# audio/qcelp
+# audio/red
+# audio/rtp-enc-aescm128
+# audio/rtp-midi
+# audio/rtx
+# audio/smv
+# audio/smv0
+# audio/smv-qcp
+# audio/sp-midi
+# audio/speex
+# audio/t140c
+# audio/t38
+# audio/telephone-event
+# audio/tone
+# audio/uemclip
+# audio/ulpfec
+# audio/vdvi
+# audio/vmr-wb
+# audio/vnd.3gpp.iufp
+# audio/vnd.4sb
+# audio/vnd.audiokoz
+# audio/vnd.celp
+# audio/vnd.cisco.nse
+# audio/vnd.cmles.radio-events
+# audio/vnd.cns.anp1
+# audio/vnd.cns.inf1
audio/vnd.digital-winds eol
-audio/vnd.dlna.adts
-audio/vnd.dolby.heaac.1
-audio/vnd.dolby.heaac.2
-audio/vnd.dolby.mlp
-audio/vnd.dolby.mps
-audio/vnd.dolby.pl2
-audio/vnd.dolby.pl2x
-audio/vnd.dolby.pl2z
+# audio/vnd.dlna.adts
+# audio/vnd.dolby.heaac.1
+# audio/vnd.dolby.heaac.2
+# audio/vnd.dolby.mlp
+# audio/vnd.dolby.mps
+# audio/vnd.dolby.pl2
+# audio/vnd.dolby.pl2x
+# audio/vnd.dolby.pl2z
+# audio/vnd.dolby.pulse.1
+audio/vnd.dra dra
audio/vnd.dts dts
audio/vnd.dts.hd dtshd
-audio/vnd.everad.plj
-audio/vnd.hns.audio
+# audio/vnd.everad.plj
+# audio/vnd.hns.audio
audio/vnd.lucent.voice lvp
audio/vnd.ms-playready.media.pya pya
-audio/vnd.nokia.mobile-xmf
-audio/vnd.nortel.vbk
+# audio/vnd.nokia.mobile-xmf
+# audio/vnd.nortel.vbk
audio/vnd.nuera.ecelp4800 ecelp4800
audio/vnd.nuera.ecelp7470 ecelp7470
audio/vnd.nuera.ecelp9600 ecelp9600
-audio/vnd.octel.sbc
-audio/vnd.qcelp
-audio/vnd.rhetorex.32kadpcm
-audio/vnd.sealedmedia.softseal.mpeg
-audio/vnd.vmx.cvsd
-audio/vorbis
-audio/vorbis-config
+# audio/vnd.octel.sbc
+# audio/vnd.qcelp
+# audio/vnd.rhetorex.32kadpcm
+# audio/vnd.sealedmedia.softseal.mpeg
+# audio/vnd.vmx.cvsd
+# audio/vorbis
+# audio/vorbis-config
audio/x-aac aac
audio/x-aiff aif aiff aifc
audio/x-mpegurl m3u
audio/x-ms-wax wax
audio/x-ms-wma wma
audio/x-pn-realaudio ram ra
audio/x-pn-realaudio-plugin rmp
audio/x-wav wav
chemical/x-cdx cdx
chemical/x-cif cif
chemical/x-cmdf cmdf
chemical/x-cml cml
chemical/x-csml csml
-chemical/x-pdb
+# chemical/x-pdb
chemical/x-xyz xyz
image/bmp bmp
image/cgm cgm
-image/example
-image/fits
+# image/example
+# image/fits
image/g3fax g3
image/gif gif
image/ief ief
-image/jp2
+# image/jp2
image/jpeg jpeg jpg jpe
-image/jpm
-image/jpx
-image/naplps
+# image/jpm
+# image/jpx
+# image/naplps
image/png png
image/prs.btif btif
-image/prs.pti
+# image/prs.pti
image/svg+xml svg svgz
-image/t38
+# image/t38
image/tiff tiff tif
-image/tiff-fx
+# image/tiff-fx
image/vnd.adobe.photoshop psd
-image/vnd.cns.inf2
+# image/vnd.cns.inf2
image/vnd.djvu djvu djv
image/vnd.dwg dwg
image/vnd.dxf dxf
image/vnd.fastbidsheet fbs
image/vnd.fpx fpx
image/vnd.fst fst
image/vnd.fujixerox.edmics-mmr mmr
image/vnd.fujixerox.edmics-rlc rlc
-image/vnd.globalgraphics.pgb
-image/vnd.microsoft.icon
-image/vnd.mix
+# image/vnd.globalgraphics.pgb
+# image/vnd.microsoft.icon
+# image/vnd.mix
image/vnd.ms-modi mdi
image/vnd.net-fpx npx
-image/vnd.radiance
-image/vnd.sealed.png
-image/vnd.sealedmedia.softseal.gif
-image/vnd.sealedmedia.softseal.jpg
-image/vnd.svf
+# image/vnd.radiance
+# image/vnd.sealed.png
+# image/vnd.sealedmedia.softseal.gif
+# image/vnd.sealedmedia.softseal.jpg
+# image/vnd.svf
image/vnd.wap.wbmp wbmp
image/vnd.xiff xif
image/x-cmu-raster ras
image/x-cmx cmx
image/x-freehand fh fhc fh4 fh5 fh7
image/x-icon ico
image/x-pcx pcx
image/x-pict pic pct
image/x-portable-anymap pnm
image/x-portable-bitmap pbm
image/x-portable-graymap pgm
image/x-portable-pixmap ppm
image/x-rgb rgb
image/x-xbitmap xbm
image/x-xpixmap xpm
image/x-xwindowdump xwd
-message/cpim
-message/delivery-status
-message/disposition-notification
-message/example
-message/external-body
-message/global
-message/global-delivery-status
-message/global-disposition-notification
-message/global-headers
-message/http
-message/imdn+xml
-message/news
-message/partial
+# message/cpim
+# message/delivery-status
+# message/disposition-notification
+# message/example
+# message/external-body
+# message/global
+# message/global-delivery-status
+# message/global-disposition-notification
+# message/global-headers
+# message/http
+# message/imdn+xml
+# message/news
+# message/partial
message/rfc822 eml mime
-message/s-http
-message/sip
-message/sipfrag
-message/tracking-status
-message/vnd.si.simp
-model/example
+# message/s-http
+# message/sip
+# message/sipfrag
+# message/tracking-status
+# message/vnd.si.simp
+# model/example
model/iges igs iges
model/mesh msh mesh silo
model/vnd.dwf dwf
-model/vnd.flatland.3dml
+# model/vnd.flatland.3dml
model/vnd.gdl gdl
-model/vnd.gs-gdl
-model/vnd.gs.gdl
+# model/vnd.gs-gdl
+# model/vnd.gs.gdl
model/vnd.gtw gtw
-model/vnd.moml+xml
+# model/vnd.moml+xml
model/vnd.mts mts
-model/vnd.parasolid.transmit.binary
-model/vnd.parasolid.transmit.text
+# model/vnd.parasolid.transmit.binary
+# model/vnd.parasolid.transmit.text
model/vnd.vtu vtu
model/vrml wrl vrml
-multipart/alternative
-multipart/appledouble
-multipart/byteranges
-multipart/digest
-multipart/encrypted
-multipart/example
-multipart/form-data
-multipart/header-set
-multipart/mixed
-multipart/parallel
-multipart/related
-multipart/report
-multipart/signed
-multipart/voice-message
+# multipart/alternative
+# multipart/appledouble
+# multipart/byteranges
+# multipart/digest
+# multipart/encrypted
+# multipart/example
+# multipart/form-data
+# multipart/header-set
+# multipart/mixed
+# multipart/parallel
+# multipart/related
+# multipart/report
+# multipart/signed
+# multipart/voice-message
text/calendar ics ifb
text/css css
text/csv csv
-text/directory
-text/dns
-text/ecmascript
-text/enriched
-text/example
+# text/directory
+# text/dns
+# text/ecmascript
+# text/enriched
+# text/example
text/html html htm
-text/javascript
-text/parityfec
+# text/javascript
+# text/parityfec
text/plain txt text conf def list log in
-text/prs.fallenstein.rst
+# text/prs.fallenstein.rst
text/prs.lines.tag dsc
-text/red
-text/rfc822-headers
+# text/vnd.radisys.msml-basic-layout
+# text/red
+# text/rfc822-headers
text/richtext rtx
-text/rtf
-text/rtp-enc-aescm128
-text/rtx
+# text/rtf
+# text/rtp-enc-aescm128
+# text/rtx
text/sgml sgml sgm
-text/t140
+# text/t140
text/tab-separated-values tsv
text/troff t tr roff man me ms
-text/ulpfec
+# text/ulpfec
text/uri-list uri uris urls
-text/vnd.abc
+# text/vnd.abc
text/vnd.curl curl
text/vnd.curl.dcurl dcurl
text/vnd.curl.scurl scurl
text/vnd.curl.mcurl mcurl
-text/vnd.dmclientscript
-text/vnd.esmertec.theme-descriptor
+# text/vnd.dmclientscript
+# text/vnd.esmertec.theme-descriptor
text/vnd.fly fly
text/vnd.fmi.flexstor flx
text/vnd.graphviz gv
text/vnd.in3d.3dml 3dml
text/vnd.in3d.spot spot
-text/vnd.iptc.newsml
-text/vnd.iptc.nitf
-text/vnd.latex-z
-text/vnd.motorola.reflex
-text/vnd.ms-mediapackage
-text/vnd.net2phone.commcenter.command
-text/vnd.si.uricatalogue
+# text/vnd.iptc.newsml
+# text/vnd.iptc.nitf
+# text/vnd.latex-z
+# text/vnd.motorola.reflex
+# text/vnd.ms-mediapackage
+# text/vnd.net2phone.commcenter.command
+# text/vnd.si.uricatalogue
text/vnd.sun.j2me.app-descriptor jad
-text/vnd.trolltech.linguist
-text/vnd.wap.si
-text/vnd.wap.sl
+# text/vnd.trolltech.linguist
+# text/vnd.wap.si
+# text/vnd.wap.sl
text/vnd.wap.wml wml
text/vnd.wap.wmlscript wmls
text/x-asm s asm
text/x-c c cc cxx cpp h hh dic
text/x-fortran f for f77 f90
text/x-pascal p pas
text/x-java-source java
text/x-setext etx
text/x-uuencode uu
text/x-vcalendar vcs
text/x-vcard vcf
-text/xml
-text/xml-external-parsed-entity
+# text/xml
+# text/xml-external-parsed-entity
video/3gpp 3gp
-video/3gpp-tt
+# video/3gpp-tt
video/3gpp2 3g2
-video/bmpeg
-video/bt656
-video/celb
-video/dv
-video/example
+# video/bmpeg
+# video/bt656
+# video/celb
+# video/dv
+# video/example
video/h261 h261
video/h263 h263
-video/h263-1998
-video/h263-2000
+# video/h263-1998
+# video/h263-2000
video/h264 h264
video/jpeg jpgv
-video/jpeg2000
+# video/jpeg2000
video/jpm jpm jpgm
video/mj2 mj2 mjp2
-video/mp1s
-video/mp2p
-video/mp2t
+# video/mp1s
+# video/mp2p
+# video/mp2t
video/mp4 mp4 mp4v mpg4
-video/mp4v-es
+# video/mp4v-es
video/mpeg mpeg mpg mpe m1v m2v
-video/mpeg4-generic
-video/mpv
-video/nv
+# video/mpeg4-generic
+# video/mpv
+# video/nv
video/ogg ogv
-video/parityfec
-video/pointer
+# video/parityfec
+# video/pointer
video/quicktime qt mov
-video/raw
-video/rtp-enc-aescm128
-video/rtx
-video/smpte292m
-video/ulpfec
-video/vc1
-video/vnd.cctv
-video/vnd.dlna.mpeg-tts
+# video/raw
+# video/rtp-enc-aescm128
+# video/rtx
+# video/smpte292m
+# video/ulpfec
+# video/vc1
+# video/vnd.cctv
+# video/vnd.dlna.mpeg-tts
video/vnd.fvt fvt
-video/vnd.hns.video
-video/vnd.iptvforum.1dparityfec-1010
-video/vnd.iptvforum.1dparityfec-2005
-video/vnd.iptvforum.2dparityfec-1010
-video/vnd.iptvforum.2dparityfec-2005
-video/vnd.iptvforum.ttsavc
-video/vnd.iptvforum.ttsmpeg2
-video/vnd.motorola.video
-video/vnd.motorola.videop
+# video/vnd.hns.video
+# video/vnd.iptvforum.1dparityfec-1010
+# video/vnd.iptvforum.1dparityfec-2005
+# video/vnd.iptvforum.2dparityfec-1010
+# video/vnd.iptvforum.2dparityfec-2005
+# video/vnd.iptvforum.ttsavc
+# video/vnd.iptvforum.ttsmpeg2
+# video/vnd.motorola.video
+# video/vnd.motorola.videop
video/vnd.mpegurl mxu m4u
video/vnd.ms-playready.media.pyv pyv
-video/vnd.nokia.interleaved-multimedia
-video/vnd.nokia.videovoip
-video/vnd.objectvideo
-video/vnd.sealed.mpeg1
-video/vnd.sealed.mpeg4
-video/vnd.sealed.swf
-video/vnd.sealedmedia.softseal.mov
+# video/vnd.nokia.interleaved-multimedia
+# video/vnd.nokia.videovoip
+# video/vnd.objectvideo
+# video/vnd.sealed.mpeg1
+# video/vnd.sealed.mpeg4
+# video/vnd.sealed.swf
+# video/vnd.sealedmedia.softseal.mov
video/vnd.vivo viv
video/x-f4v f4v
video/x-fli fli
video/x-flv flv
video/x-m4v m4v
video/x-ms-asf asf asx
video/x-ms-wm wm
video/x-ms-wmv wmv
video/x-ms-wmx wmx
video/x-ms-wvx wvx
video/x-msvideo avi
video/x-sgi-movie movie
x-conference/x-cooltalk ice
diff --git a/original/httpd.conf b/original/httpd.conf
index d6d6236..7f1908f 100644
--- a/original/httpd.conf
+++ b/original/httpd.conf
@@ -1,481 +1,482 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
+LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www
Group www
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
#
# The following lines prevent .htaccess, .htpasswd and .DS_Store files and
# Mac resource forks and named forks from being viewed by Web clients.
#
<Files ~ "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<DirectoryMatch ".*\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</DirectoryMatch>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
rickclare/apache2-conf
|
87816b6e9a643e432b9c80b1b84015ac973d4813
|
updating vhosts
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index 0826b49..3f7cad8 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,274 +1,274 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
- ServerAlias tools.drinkaware.localhost.enableinteractive.co.uk
+ ServerName tools.drinkaware.localhost.enableinteractive.co.uk
ServerAlias tools.drinkaware.dev.enableinteractive.co.uk
DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
<Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
RailsEnv development
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
</VirtualHost>
# Tools-Drinkaware-Local-Production (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
- ServerAlias tools.drinkaware.localproduction.enableinteractive.co.uk
+ ServerName tools.drinkaware.localproduction.enableinteractive.co.uk
DocumentRoot "/var/www/apps/tools-drinkaware/current/public"
<Directory "/var/www/apps/tools-drinkaware/current/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_local_production_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_local_production_access.log combined
RailsBaseURI /
RailsEnv local_production
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
</VirtualHost>
# Magento Sandbox local
<VirtualHost *:80>
ServerName magento.localhost
DocumentRoot "/Users/Shared/Dev/workspace/magento"
DirectoryIndex index.php
<Directory "/Users/Shared/Dev/workspace/magento">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/magento_error.log
CustomLog /opt/local/apache2/logs/magento_access.log combined
php_flag log_errors on
php_value error_log /opt/local/apache2/logs/magento_php_error.log
php_flag display_errors on
# E_ALL & ~E_NOTICE
php_value error_reporting 6135
</VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
|
rickclare/apache2-conf
|
e4a7724c1cbd6fa67919095be95ebdebb5700f47
|
adding tools.drinkaware.localproduction.enableinteractive.co.uk
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index 4a63256..0826b49 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,233 +1,274 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
-# Tools-Drinkaware (Rails Passenger, Ruby1.8)
+# Tools-Drinkaware (Rails Passenger, Ruby1.9)
<VirtualHost *:80>
ServerAlias tools.drinkaware.localhost.enableinteractive.co.uk
ServerAlias tools.drinkaware.dev.enableinteractive.co.uk
- DocumentRoot "/var/www/apps/tools-drinkaware/current/public"
- <Directory "/var/www/apps/tools-drinkaware/current/public">
-
- # DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
- # <Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
+ DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
+ <Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
- PassengerDefaultUser www-data
- # RailsEnv development
+ RailsEnv development
+
+ # Enable ETag
+ #FileETag MTime Size
+
+ # Enable Compression (GZIP) of shown content-types
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
+
+ # enable expirations
+ ExpiresActive On
+
+ # far future expires headers
+ <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
+ ExpiresDefault "access plus 10 years"
+ </FilesMatch>
+
+ <FilesMatch "\.(js|css)$">
+ ExpiresDefault "now"
+ </FilesMatch>
+
+ <Location />
+ # enable tracking uploads in /
+ TrackUploads On
+ </Location>
+
+ <Location /progress>
+ # enable upload progress reports in /progress
+ ReportUploads On
+ </Location>
+
+</VirtualHost>
+
+
+# Tools-Drinkaware-Local-Production (Rails Passenger, Ruby1.9)
+<VirtualHost *:80>
+ ServerAlias tools.drinkaware.localproduction.enableinteractive.co.uk
+
+ DocumentRoot "/var/www/apps/tools-drinkaware/current/public"
+ <Directory "/var/www/apps/tools-drinkaware/current/public">
+ AllowOverride All
+ Allow from All
+ </Directory>
+
+ ErrorLog /opt/local/apache2/logs/tools_drinkaware_local_production_error.log
+ CustomLog /opt/local/apache2/logs/tools_drinkaware_local_production_access.log combined
+ RailsBaseURI /
RailsEnv local_production
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
</VirtualHost>
# Magento Sandbox local
<VirtualHost *:80>
ServerName magento.localhost
DocumentRoot "/Users/Shared/Dev/workspace/magento"
DirectoryIndex index.php
<Directory "/Users/Shared/Dev/workspace/magento">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/magento_error.log
CustomLog /opt/local/apache2/logs/magento_access.log combined
php_flag log_errors on
php_value error_log /opt/local/apache2/logs/magento_php_error.log
php_flag display_errors on
# E_ALL & ~E_NOTICE
php_value error_reporting 6135
</VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
|
rickclare/apache2-conf
|
a8087849ff532244dc069f705fe84f4732901b77
|
updating vhosts
|
diff --git a/extra/httpd-vhosts.conf b/extra/httpd-vhosts.conf
index 8272231..0afe1b2 100644
--- a/extra/httpd-vhosts.conf
+++ b/extra/httpd-vhosts.conf
@@ -1,227 +1,233 @@
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Tools-Drinkaware (Rails Passenger, Ruby1.8)
<VirtualHost *:80>
ServerAlias tools.drinkaware.localhost.enableinteractive.co.uk
ServerAlias tools.drinkaware.dev.enableinteractive.co.uk
- DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
- <Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
+
+ DocumentRoot "/var/www/apps/tools-drinkaware/current/public"
+ <Directory "/var/www/apps/tools-drinkaware/current/public">
+
+ # DocumentRoot "/Users/Shared/Dev/workspace/tools-drinkaware/public"
+ # <Directory "/Users/Shared/Dev/workspace/tools-drinkaware/public">
AllowOverride All
Allow from All
</Directory>
+
ErrorLog /opt/local/apache2/logs/tools_drinkaware_error.log
CustomLog /opt/local/apache2/logs/tools_drinkaware_access.log combined
RailsBaseURI /
- PassengerDefaultUser root
- RailsEnv development
-
+ PassengerDefaultUser www-data
+ # RailsEnv development
+ RailsEnv local_production
+
# Enable ETag
#FileETag MTime Size
# Enable Compression (GZIP) of shown content-types
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xhtml+xml application/javascript
# enable expirations
ExpiresActive On
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
<FilesMatch "\.(js|css)$">
ExpiresDefault "now"
</FilesMatch>
<Location />
# enable tracking uploads in /
TrackUploads On
</Location>
<Location /progress>
# enable upload progress reports in /progress
ReportUploads On
</Location>
</VirtualHost>
# Magento Sandbox local
<VirtualHost *:80>
ServerName magento.localhost
DocumentRoot "/Users/Shared/Dev/workspace/magento"
DirectoryIndex index.php
<Directory "/Users/Shared/Dev/workspace/magento">
AllowOverride All
Allow from All
</Directory>
ErrorLog /opt/local/apache2/logs/magento_error.log
CustomLog /opt/local/apache2/logs/magento_access.log combined
php_flag log_errors on
php_value error_log /opt/local/apache2/logs/magento_php_error.log
php_flag display_errors on
# E_ALL & ~E_NOTICE
php_value error_reporting 6135
</VirtualHost>
## Because it's Good (Rails Passenger)
# <VirtualHost *:80>
# ServerName because-enable.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/because-enable/public"
# <Directory "/Users/Shared/Dev/workspace/because-enable/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/because-enable_error.log
# CustomLog /opt/local/apache2/logs/because-enable_access.log combined
# RailsBaseURI /
# RailsEnv staging
# </VirtualHost>
## Football Prototype (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName fans.drinkaware.co.uk
# ServerAlias wvvw.drinkaware.co.uk
# DocumentRoot "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public"
# <Directory "/Users/Shared/Dev/workspace/football_prototype.drinkaware/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/football_prototype_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/football_prototype_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Redmine (Rails Passenger)
# <VirtualHost *:80>
# ServerName redmine.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/redmine/public"
# <Directory "/Users/Shared/Dev/workspace/redmine/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/redmine_error.log
# CustomLog /opt/local/apache2/logs/redmine_access.log combined
# RailsBaseURI /
# RailsEnv development
# </VirtualHost>
## Ultimate Day (Drinkaware) (Rails Passenger)
# <VirtualHost *:80>
# ServerName ultimateday.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/ultimateday/public"
# <Directory "/Users/Shared/Dev/workspace/ultimateday/public">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/ultimateday_drinkaware_error.log
# CustomLog /opt/local/apache2/logs/ultimateday_drinkaware_access.log combined
# RailsBaseURI /
# RailsEnv development_mysql
# </VirtualHost>
############################
## YanleyFarm (Joomla) local
# <VirtualHost *:80>
# ServerName yanleyFarm.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/yanleyFarm"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/yanleyFarm">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/yanleyFarm_error.log
# CustomLog /opt/local/apache2/logs/yanleyFarm_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/yanleyFarm_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
# Drinkdiary local (PHP, Flash)
# <VirtualHost *:80>
# ServerName drinkdiary.localhost
# DocumentRoot "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug"
#
# DirectoryIndex index.php
# <Directory "/Users/rick/Documents/Flex Builder 3/DrinkDiary/bin-debug">
# AllowOverride All
# Allow from All
# #AuthType Basic
# #AuthName "Restricted Files"
# #AuthUserFile /usr/local/apache/passwd/passwords
# #Require user rick
# </Directory>
# ErrorLog /opt/local/apache2/logs/drinkdiary_error.log
# CustomLog /opt/local/apache2/logs/drinkdiary_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/drinkdiary_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
############################
## Homelesslink (Drupal) local
# <VirtualHost *:80>
# ServerName homelesslink.mbp
# DocumentRoot "/Users/Shared/Dev/workspace/homelesslink"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/homelesslink">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/homelesslink_error.log
# CustomLog /opt/local/apache2/logs/homelesslink_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/homelesslink_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# # php_value error_reporting 6135
# </VirtualHost>
############################
## Joomla Sandbox local
# <VirtualHost *:80>
# ServerName joomlaSandbox.localhost
# DocumentRoot "/Users/Shared/Dev/workspace/joomlaSandbox"
# DirectoryIndex index.php
# <Directory "/Users/Shared/Dev/workspace/joomlaSandbox">
# AllowOverride All
# Allow from All
# </Directory>
# ErrorLog /opt/local/apache2/logs/joomlaSandbox_error.log
# CustomLog /opt/local/apache2/logs/joomlaSandbox_access.log combined
# php_flag log_errors on
# php_value error_log /opt/local/apache2/logs/joomlaSandbox_php_error.log
# php_flag display_errors on
#
# # E_ALL & ~E_NOTICE
# php_value error_reporting 6135
# </VirtualHost>
diff --git a/httpd.conf b/httpd.conf
index 369e640..b7d1a53 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -1,503 +1,503 @@
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/opt/local/apache2" will be interpreted by the
# server as "/opt/local/apache2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/opt/local/apache2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule upload_progress_module modules/mod_upload_progress.so
# LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.10/ext/apache2/mod_passenger.so
# PassengerRoot /Users/rick/.rvm/gems/ruby-1.8.7-p249/gems/passenger-2.2.10
# PassengerRuby /Users/rick/.rvm/bin/ruby-1.8.7-p249
-LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.1-p378/gems/passenger-2.2.10/ext/apache2/mod_passenger.so
-PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.1-p378/gems/passenger-2.2.10
+LoadModule passenger_module /Users/rick/.rvm/gems/ruby-1.9.1-p378/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
+PassengerRoot /Users/rick/.rvm/gems/ruby-1.9.1-p378/gems/passenger-2.2.11
PassengerRuby /Users/rick/.rvm/bin/passenger_ruby
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
-User rick
+User www-data
Group wheel
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/opt/local/apache2/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/opt/local/apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#
# The following lines prevent .htaccess files from being viewed by
# Web clients. Since .htaccess files often contain authorization
# information, access is disallowed for security reasons. Comment
# these lines out if you want Web visitors to see the contents of
# .htaccess files.
#
# Also, folks tend to use names such as .htpasswd for password
# files, so this will protect those as well.
#
<Files ~ "^<.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Directory ~ ".\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</Directory>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/opt/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/opt/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/opt/local/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.