an uncrustify pass and uncrustify config file

This commit is contained in:
Aaron Culliney 2013-07-05 21:37:13 -07:00
parent 18c3f5f698
commit e919718b73
24 changed files with 6550 additions and 4943 deletions

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Common definitions
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,32 +7,32 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
#ifndef A2_H
#define A2_H
#define BANK2 0x10000
#define BANK2 0x10000
/* Code alignment */
#if defined(__i486__) || defined(__i586__)
#define ALIGN .balign 16
#define ALIGN .balign 16
#else /* !(__i486__ || __i586__) */
#define ALIGN .balign 4
#define ALIGN .balign 4
#endif /* !(__i486__ || __i586__) */
/* Symbol naming issues */
#ifdef NO_UNDERSCORES
#define SN(foo) foo
#define E(foo) .globl foo ; ALIGN ; foo##:
#define SN(foo) foo
#define E(foo) .globl foo; ALIGN; foo##:
#else /* !NO_UNDERSCORES */
#define SN(foo) _##foo
#define E(foo) .globl _##foo ; ALIGN ; _##foo##:
#define SN(foo) _##foo
#define E(foo) .globl _##foo; ALIGN; _##foo##:
#endif /* !NO_UNDERSCORES */
#endif/* A2_H */
#endif /* A2_H */

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: C support for 6502 on i386
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,10 +7,10 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
@ -20,66 +20,94 @@
#include "cpu.h"
/* different than in defs.h! */
#define C_Flag_6502 0x1
#define X_Flag_6502 0x20
#define I_Flag_6502 0x4
#define V_Flag_6502 0x40
#define B_Flag_6502 0x10
#define D_Flag_6502 0x8
#define Z_Flag_6502 0x2
#define N_Flag_6502 0x80
#define C_Flag_6502 0x1
#define X_Flag_6502 0x20
#define I_Flag_6502 0x4
#define V_Flag_6502 0x40
#define B_Flag_6502 0x10
#define D_Flag_6502 0x8
#define Z_Flag_6502 0x2
#define N_Flag_6502 0x80
static void initialize_code_tables(void)
{
int i;
int i;
for (i = 0; i < 256; i++)
{
unsigned char val = 0;
unsigned char val = 0;
if (i & C_Flag)
val |= C_Flag_6502;
if (i & X_Flag)
val |= X_Flag_6502;
if (i & I_Flag)
val |= I_Flag_6502;
if (i & V_Flag)
val |= V_Flag_6502;
if (i & B_Flag)
val |= B_Flag_6502;
if (i & D_Flag)
val |= D_Flag_6502;
if (i & Z_Flag)
val |= Z_Flag_6502;
if (i & N_Flag)
val |= N_Flag_6502;
if (i & C_Flag)
{
val |= C_Flag_6502;
}
cpu65_flags_encode[ i ] = val | 0x20;
cpu65_flags_decode[ val ] = i;
if (i & X_Flag)
{
val |= X_Flag_6502;
}
if (i & I_Flag)
{
val |= I_Flag_6502;
}
if (i & V_Flag)
{
val |= V_Flag_6502;
}
if (i & B_Flag)
{
val |= B_Flag_6502;
}
if (i & D_Flag)
{
val |= D_Flag_6502;
}
if (i & Z_Flag)
{
val |= Z_Flag_6502;
}
if (i & N_Flag)
{
val |= N_Flag_6502;
}
cpu65_flags_encode[ i ] = val | 0x20;
cpu65_flags_decode[ val ] = i;
}
}
void cpu65_set(int flags)
{
initialize_code_tables();
initialize_code_tables();
switch (flags & 0xf)
{
case CPU65_NMOS:
if (flags & CPU65_FAULT)
memcpy(cpu65__opcodes,cpu65__nmosbrk,1024);
switch (flags & 0xf)
{
case CPU65_NMOS:
if (flags & CPU65_FAULT)
{
memcpy(cpu65__opcodes,cpu65__nmosbrk,1024);
}
else
memcpy(cpu65__opcodes,cpu65__nmos,1024);
break;
case CPU65_C02:
{
memcpy(cpu65__opcodes,cpu65__nmos,1024);
}
break;
case CPU65_C02:
memcpy(cpu65__opcodes,cpu65__cmos,1024);
break;
default:
default:
abort();
}
cpu65__signal = 0;
}
cpu65__signal = 0;
}
void cpu65_interrupt(int reason)

112
src/cpu.h
View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Virtual 6502/65C02 interface
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,10 +7,10 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
@ -24,32 +24,32 @@ typedef void *RMEM;
struct memory_vector
{
RMEM r;
WMEM w;
RMEM r;
WMEM w;
};
struct cpu65_state
{
u_int16_t pc; /* Program counter */
u_int8_t a; /* Accumulator */
u_int8_t f; /* Flags (order not same as in real 6502) */
u_int8_t x,y; /* Index register */
u_int8_t sp; /* Stack Pointer */
u_int16_t pc; /* Program counter */
u_int8_t a; /* Accumulator */
u_int8_t f; /* Flags (order not same as in real 6502) */
u_int8_t x,y; /* Index register */
u_int8_t sp; /* Stack Pointer */
};
struct cpu65_extra /* for debugging */
struct cpu65_extra /* for debugging */
{
u_int16_t ea; /* Last effective address */
u_int8_t d; /* Last data byte written */
u_int8_t op; /* 1 = read occured, 2 = write, 3 = both */
u_int16_t ea; /* Last effective address */
u_int8_t d; /* Last data byte written */
u_int8_t op; /* 1 = read occured, 2 = write, 3 = both */
};
/* 6502 CPU models */
#define CPU65_NMOS 0x0
#define CPU65_C02 0x1
#define CPU65_FAULT 0x100 /* Undoc. opcodes are BRK */
#define CPU65_SYNCHRO 0x200 /* Synchronize speed, not imp. */
/* 6502 CPU models */
#define CPU65_NMOS 0x0
#define CPU65_C02 0x1
#define CPU65_FAULT 0x100 /* Undoc. opcodes are BRK */
#define CPU65_SYNCHRO 0x200 /* Synchronize speed, not imp. */
/* Set up the processor for a new run. Sets up opcode table.
*/
@ -75,49 +75,49 @@ extern unsigned int cpu65_delay;
#endif /* !__ASSEMBLER__ */
#define RebootSig 0x01
#define ResetSig 0x02
#define DebugStepSig 0x04
#define EnterDebugSig 0x08
#define RebootSig 0x01
#define ResetSig 0x02
#define DebugStepSig 0x04
#define EnterDebugSig 0x08
/* Note: These are *not* the bit positions used for the flags in the P
* register of a real 6502. Rather, they have been distorted so that C,
* N and Z match the analogous flags in the _80386_ flags register.
/* Note: These are *not* the bit positions used for the flags in the P
* register of a real 6502. Rather, they have been distorted so that C,
* N and Z match the analogous flags in the _80386_ flags register.
*
* Additionally, V matches the position of the overflow flag in the high byte
* of the 80386 register.
*
*/
#define C_Flag 0x1 /* 6502 Carry */
#define X_Flag 0x2 /* 6502 Xtra */
#define I_Flag 0x4 /* 6502 Interrupt disable */
#define V_Flag 0x8 /* 6502 Overflow */
#define B_Flag 0x10 /* 6502 Break */
#define D_Flag 0x20 /* 6502 Decimal mode */
#define Z_Flag 0x40 /* 6502 Zero */
#define N_Flag 0x80 /* 6502 Neg */
#define C_Flag 0x1 /* 6502 Carry */
#define X_Flag 0x2 /* 6502 Xtra */
#define I_Flag 0x4 /* 6502 Interrupt disable */
#define V_Flag 0x8 /* 6502 Overflow */
#define B_Flag 0x10 /* 6502 Break */
#define D_Flag 0x20 /* 6502 Decimal mode */
#define Z_Flag 0x40 /* 6502 Zero */
#define N_Flag 0x80 /* 6502 Neg */
#define C_Flag_Bit 8 /* 6502 Carry */
#define X_Flag_Bit 9 /* 6502 Xtra */
#define I_Flag_Bit 10 /* 6502 Interrupt disable */
#define V_Flag_Bit 11 /* 6502 Overflow */
#define B_Flag_Bit 12 /* 6502 Break */
#define D_Flag_Bit 13 /* 6502 Decimal mode */
#define Z_Flag_Bit 14 /* 6502 Zero */
#define N_Flag_Bit 15 /* 6502 Neg */
#define C_Flag_Bit 8 /* 6502 Carry */
#define X_Flag_Bit 9 /* 6502 Xtra */
#define I_Flag_Bit 10 /* 6502 Interrupt disable */
#define V_Flag_Bit 11 /* 6502 Overflow */
#define B_Flag_Bit 12 /* 6502 Break */
#define D_Flag_Bit 13 /* 6502 Decimal mode */
#define Z_Flag_Bit 14 /* 6502 Zero */
#define N_Flag_Bit 15 /* 6502 Neg */
#define X_Reg %bl /* 6502 X register in %bl */
#define Y_Reg %bh /* 6502 Y register in %bh */
#define A_Reg %cl /* 6502 A register in %cl */
#define F_Reg %ch /* 6502 flags in %ch */
#define FF_Reg %ecx /* 6502 flags for bt */
#define SP_Reg %edx /* 6502 Stack pointer */
#define SP_Reg_L %dl /* 6502 Stack pointer low */
#define SP_Reg_H %dh /* 6502 Stack pointer high */
#define PC_Reg %si /* 6502 Program Counter */
#define PC_Reg_E %esi /* 6502 Program Counter */
#define EffectiveAddr %di /* Effective address */
#define EffectiveAddr_E %edi /* Effective address */
#define X_Reg %bl /* 6502 X register in %bl */
#define Y_Reg %bh /* 6502 Y register in %bh */
#define A_Reg %cl /* 6502 A register in %cl */
#define F_Reg %ch /* 6502 flags in %ch */
#define FF_Reg %ecx /* 6502 flags for bt */
#define SP_Reg %edx /* 6502 Stack pointer */
#define SP_Reg_L %dl /* 6502 Stack pointer low */
#define SP_Reg_H %dh /* 6502 Stack pointer high */
#define PC_Reg %si /* 6502 Program Counter */
#define PC_Reg_E %esi /* 6502 Program Counter */
#define EffectiveAddr %di /* Effective address */
#define EffectiveAddr_E %edi /* Effective address */
#ifndef __ASSEMBLER__
/* Private data. */
@ -128,4 +128,4 @@ extern void *const cpu65__cmos[256];
extern unsigned char cpu65__signal;
#endif /* !__ASSEMBLER__ */

412
src/crusty.cfg Normal file
View File

@ -0,0 +1,412 @@
# Uncrustify 0.59
newlines = auto
input_tab_size = 8
output_tab_size = 8
string_escape_char = 92
string_escape_char2 = 0
tok_split_gte = false
utf8_bom = ignore
utf8_byte = false
utf8_force = false
indent_columns = 4
indent_continue = 0
indent_with_tabs = 0
indent_cmt_with_tabs = false
indent_align_string = false
indent_xml_string = 0
indent_brace = 0
indent_braces = false
indent_braces_no_func = false
indent_braces_no_class = false
indent_braces_no_struct = false
indent_brace_parent = false
indent_namespace = true
indent_namespace_level = 4
indent_namespace_limit = 0
indent_extern = false
indent_class = true
indent_class_colon = false
indent_ctor_init = 0
indent_else_if = false
indent_var_def_blk = 0
indent_var_def_cont = false
indent_func_call_param = false
indent_func_def_param = false
indent_func_proto_param = false
indent_func_class_param = false
indent_func_ctor_var_param = false
indent_template_param = false
indent_func_param_double = false
indent_func_const = 0
indent_func_throw = 0
indent_member = 0
indent_sing_line_comments = 0
indent_relative_single_line_comments = false
indent_switch_case = 0
indent_case_shift = 0
indent_case_brace = 0
indent_col1_comment = false
indent_label = 1
indent_access_spec = 1
indent_access_spec_body = false
indent_paren_nl = false
indent_paren_close = 0
indent_comma_paren = false
indent_bool_paren = false
indent_first_bool_expr = false
indent_square_nl = false
indent_preserve_sql = false
indent_align_assign = true
sp_arith = ignore
sp_assign = ignore
sp_assign_default = ignore
sp_before_assign = ignore
sp_after_assign = ignore
sp_enum_assign = ignore
sp_enum_before_assign = ignore
sp_enum_after_assign = ignore
sp_pp_concat = add
sp_pp_stringify = add
sp_bool = ignore
sp_compare = ignore
sp_inside_paren = ignore
sp_paren_paren = ignore
sp_balance_nested_parens = false
sp_paren_brace = add
sp_before_ptr_star = ignore
sp_before_unnamed_ptr_star = ignore
sp_between_ptr_star = ignore
sp_after_ptr_star = ignore
sp_after_ptr_star_func = ignore
sp_before_ptr_star_func = ignore
sp_before_byref = ignore
sp_before_unnamed_byref = ignore
sp_after_byref = ignore
sp_after_byref_func = ignore
sp_before_byref_func = ignore
sp_after_type = force
sp_template_angle = ignore
sp_before_angle = ignore
sp_inside_angle = ignore
sp_after_angle = ignore
sp_angle_paren = ignore
sp_angle_word = ignore
sp_angle_shift = add
sp_before_sparen = add
sp_inside_sparen = ignore
sp_inside_sparen_close = ignore
sp_after_sparen = ignore
sp_sparen_brace = add
sp_invariant_paren = ignore
sp_after_invariant_paren = ignore
sp_special_semi = ignore
sp_before_semi = remove
sp_before_semi_for = ignore
sp_before_semi_for_empty = ignore
sp_after_semi = add
sp_after_semi_for = force
sp_after_semi_for_empty = ignore
sp_before_square = ignore
sp_before_squares = ignore
sp_inside_square = ignore
sp_after_comma = ignore
sp_before_comma = remove
sp_paren_comma = force
sp_before_ellipsis = ignore
sp_after_class_colon = ignore
sp_before_class_colon = ignore
sp_before_case_colon = remove
sp_after_operator = ignore
sp_after_operator_sym = ignore
sp_after_cast = ignore
sp_inside_paren_cast = ignore
sp_cpp_cast_paren = ignore
sp_sizeof_paren = ignore
sp_after_tag = ignore
sp_inside_braces_enum = add
sp_inside_braces_struct = add
sp_inside_braces = add
sp_inside_braces_empty = ignore
sp_type_func = ignore
sp_func_proto_paren = remove
sp_func_def_paren = remove
sp_inside_fparens = ignore
sp_inside_fparen = ignore
sp_square_fparen = ignore
sp_fparen_brace = add
sp_func_call_paren = remove
sp_func_call_paren_empty = remove
sp_func_call_user_paren = ignore
sp_func_class_paren = ignore
sp_return_paren = ignore
sp_attribute_paren = ignore
sp_defined_paren = ignore
sp_throw_paren = ignore
sp_catch_paren = ignore
sp_version_paren = ignore
sp_scope_paren = ignore
sp_macro = ignore
sp_macro_func = ignore
sp_else_brace = add
sp_brace_else = add
sp_brace_typedef = ignore
sp_catch_brace = ignore
sp_brace_catch = ignore
sp_finally_brace = ignore
sp_brace_finally = ignore
sp_try_brace = ignore
sp_getset_brace = ignore
sp_before_dc = ignore
sp_after_dc = ignore
sp_d_array_colon = ignore
sp_not = remove
sp_inv = remove
sp_addr = remove
sp_member = remove
sp_deref = remove
sp_sign = remove
sp_incdec = remove
sp_before_nl_cont = add
sp_after_oc_scope = ignore
sp_after_oc_colon = ignore
sp_before_oc_colon = ignore
sp_after_send_oc_colon = ignore
sp_before_send_oc_colon = ignore
sp_after_oc_type = ignore
sp_after_oc_return_type = ignore
sp_after_oc_at_sel = ignore
sp_after_oc_at_sel_parens = ignore
sp_inside_oc_at_sel_parens = ignore
sp_before_oc_block_caret = ignore
sp_after_oc_block_caret = ignore
sp_cond_colon = ignore
sp_cond_question = ignore
sp_case_label = ignore
sp_range = ignore
sp_cmt_cpp_start = ignore
sp_endif_cmt = ignore
sp_after_new = ignore
sp_before_tr_emb_cmt = ignore
sp_num_before_tr_emb_cmt = 0
align_keep_tabs = false
align_with_tabs = false
align_on_tabstop = false
align_number_left = false
align_func_params = false
align_same_func_call_params = false
align_var_def_span = 0
align_var_def_star_style = 0
align_var_def_amp_style = 0
align_var_def_thresh = 0
align_var_def_gap = 0
align_var_def_colon = false
align_var_def_attribute = false
align_var_def_inline = false
align_assign_span = 0
align_assign_thresh = 0
align_enum_equ_span = 0
align_enum_equ_thresh = 0
align_var_struct_span = 0
align_var_struct_thresh = 0
align_var_struct_gap = 0
align_struct_init_span = 0
align_typedef_gap = 0
align_typedef_span = 0
align_typedef_func = 0
align_typedef_star_style = 0
align_typedef_amp_style = 0
align_right_cmt_span = 0
align_right_cmt_mix = false
align_right_cmt_gap = 0
align_right_cmt_at_col = 0
align_func_proto_span = 0
align_func_proto_gap = 0
align_on_operator = false
align_mix_var_proto = false
align_single_line_func = false
align_single_line_brace = false
align_single_line_brace_gap = 0
align_oc_msg_spec_span = 0
align_nl_cont = false
align_pp_define_gap = 0
align_pp_define_span = 0
align_left_shift = true
align_oc_msg_colon_span = 0
align_oc_decl_colon = false
nl_collapse_empty_body = false
nl_assign_leave_one_liners = false
nl_class_leave_one_liners = false
nl_enum_leave_one_liners = false
nl_getset_leave_one_liners = false
nl_func_leave_one_liners = false
nl_if_leave_one_liners = false
nl_start_of_file = ignore
nl_start_of_file_min = 0
nl_end_of_file = ignore
nl_end_of_file_min = 0
nl_assign_brace = ignore
nl_assign_square = ignore
nl_after_square_assign = ignore
nl_func_var_def_blk = 0
nl_fcall_brace = ignore
nl_enum_brace = ignore
nl_struct_brace = ignore
nl_union_brace = ignore
nl_if_brace = add
nl_brace_else = add
nl_elseif_brace = add
nl_else_brace = add
nl_else_if = add
nl_brace_finally = add
nl_finally_brace = add
nl_try_brace = add
nl_getset_brace = ignore
nl_for_brace = add
nl_catch_brace = add
nl_brace_catch = ignore
nl_while_brace = add
nl_using_brace = ignore
nl_brace_brace = ignore
nl_do_brace = add
nl_brace_while = ignore
nl_switch_brace = add
nl_multi_line_cond = false
nl_multi_line_define = false
nl_before_case = false
nl_before_throw = ignore
nl_after_case = false
nl_case_colon_brace = ignore
nl_namespace_brace = ignore
nl_template_class = ignore
nl_class_brace = ignore
nl_class_init_args = ignore
nl_func_type_name = ignore
nl_func_type_name_class = ignore
nl_func_scope_name = ignore
nl_func_proto_type_name = ignore
nl_func_paren = ignore
nl_func_def_paren = ignore
nl_func_decl_start = ignore
nl_func_def_start = ignore
nl_func_decl_start_single = ignore
nl_func_def_start_single = ignore
nl_func_decl_args = ignore
nl_func_def_args = ignore
nl_func_decl_end = ignore
nl_func_def_end = ignore
nl_func_decl_end_single = ignore
nl_func_def_end_single = ignore
nl_func_decl_empty = ignore
nl_func_def_empty = ignore
nl_fdef_brace = ignore
nl_after_return = false
nl_return_expr = ignore
nl_after_semicolon = false
nl_after_brace_open = false
nl_after_brace_open_cmt = false
nl_after_vbrace_open = false
nl_after_vbrace_open_empty = false
nl_after_brace_close = false
nl_after_vbrace_close = false
nl_define_macro = false
nl_squeeze_ifdef = false
nl_before_if = ignore
nl_after_if = ignore
nl_before_for = ignore
nl_after_for = ignore
nl_before_while = ignore
nl_after_while = ignore
nl_before_switch = ignore
nl_after_switch = ignore
nl_before_do = ignore
nl_after_do = ignore
nl_ds_struct_enum_cmt = false
nl_ds_struct_enum_close_brace = false
nl_class_colon = ignore
nl_create_if_one_liner = false
nl_create_for_one_liner = false
nl_create_while_one_liner = false
pos_arith = ignore
pos_assign = ignore
pos_bool = ignore
pos_compare = ignore
pos_conditional = ignore
pos_comma = ignore
pos_class_comma = ignore
pos_class_colon = ignore
code_width = 0
ls_for_split_full = false
ls_func_split_full = false
nl_max = 0
nl_after_func_proto = 0
nl_after_func_proto_group = 0
nl_after_func_body = 0
nl_after_func_body_class = 0
nl_after_func_body_one_liner = 0
nl_before_block_comment = 0
nl_before_c_comment = 0
nl_before_cpp_comment = 0
nl_after_multiline_comment = false
nl_after_struct = 0
nl_after_class = 0
nl_before_access_spec = 0
nl_after_access_spec = 0
nl_comment_func_def = 0
nl_after_try_catch_finally = 0
nl_around_cs_property = 0
nl_between_get_set = 0
nl_property_brace = ignore
eat_blanks_after_open_brace = false
eat_blanks_before_close_brace = false
mod_full_brace_do = add
mod_full_brace_for = add
mod_full_brace_function = add
mod_full_brace_if = add
mod_full_brace_if_chain = add
mod_full_brace_nl = 0
mod_full_brace_while = add
mod_full_brace_using = add
mod_paren_on_return = ignore
mod_pawn_semicolon = false
mod_full_paren_if_bool = false
mod_remove_extra_semicolon = true
mod_add_long_function_closebrace_comment = 0
mod_add_long_switch_closebrace_comment = 0
mod_add_long_ifdef_endif_comment = true
mod_add_long_ifdef_else_comment = true
mod_sort_import = false
mod_sort_using = false
mod_sort_include = false
mod_move_case_break = false
mod_case_brace = ignore
mod_remove_empty_return = false
cmt_width = 0
cmt_reflow_mode = 0
cmt_indent_multi = true
cmt_c_group = false
cmt_c_nl_start = false
cmt_c_nl_end = false
cmt_cpp_group = false
cmt_cpp_nl_start = false
cmt_cpp_nl_end = false
cmt_cpp_to_c = false
cmt_star_cont = false
cmt_sp_before_star_cont = 0
cmt_sp_after_star_cont = 0
cmt_multi_check_last = true
cmt_insert_file_header = ""
cmt_insert_file_footer = ""
cmt_insert_func_header = ""
cmt_insert_class_header = ""
cmt_insert_oc_msg_header = ""
cmt_insert_before_preproc = false
pp_indent = ignore
pp_indent_at_level = false
pp_indent_count = 1
pp_space = ignore
pp_space_count = 0
pp_indent_region = 0
pp_region_indent_code = false
pp_indent_if = 0
pp_if_indent_code = false
pp_define_at_level = false

View File

@ -1,5 +1,5 @@
/*
* Apple // emulator for Linux: Definitions for debugger
/*
* Apple // emulator for Linux: Definitions for debugger
*
* Copyright 1994 Alexander Jean-Claude Bottema
* Copyright 1995 Stephen Lee
@ -7,10 +7,10 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
@ -21,21 +21,21 @@
#include <stdio.h>
/* debugger defines */
#define BUF_X 39
#define BUF_Y 22
#define MAX_BRKPTS 16
#define SCREEN_X 41
#define SCREEN_Y 24
#define PROMPT_X 2
#define PROMPT_Y BUF_Y - 1
#define PROMPT_END_X BUF_X - 2
#define command_line command_buf[PROMPT_Y]
#define uchar unsigned char
#define BUF_X 39
#define BUF_Y 22
#define MAX_BRKPTS 16
#define SCREEN_X 41
#define SCREEN_Y 24
#define PROMPT_X 2
#define PROMPT_Y BUF_Y - 1
#define PROMPT_END_X BUF_X - 2
#define command_line command_buf[PROMPT_Y]
#define uchar unsigned char
/* debugger commands */
enum token_type { MEM, DIS, REGS, SETMEM, STEP, FINISH, UNTIL, GO, VM,
BREAK, WATCH, CLEAR, IGNORE, STATUS, OPCODES, LC, DRIVE,
SEARCH, HELP, LOG, BSAVE, BLOAD, SAVE, UNKNOWN };
BREAK, WATCH, CLEAR, IGNORE, STATUS, OPCODES, LC, DRIVE,
SEARCH, HELP, LOG, BSAVE, BLOAD, SAVE, UNKNOWN };
enum addressing_mode
{
@ -51,7 +51,7 @@ enum addressing_mode
addr_indirect,
addr_indirect_x,
addr_indirect_y,
addr_j_indirect, /* non-zeropage indirects, used in JMP only */
addr_j_indirect, /* non-zeropage indirects, used in JMP only */
addr_j_indirect_x,
addr_relative
};
@ -64,12 +64,12 @@ struct opcode_struct
extern const struct opcode_struct *opcodes;
extern int step_next; /* stepping over instructions */
extern char second_buf[BUF_Y][BUF_X]; /* scratch buffer for output */
extern int num_buffer_lines; /* num lines of output */
extern int arg1, arg2, arg3; /* command arguments */
extern int breakpoints[MAX_BRKPTS]; /* memory breakpoints */
extern int watchpoints[MAX_BRKPTS]; /* memory watchpoints */
extern int step_next; /* stepping over instructions */
extern char second_buf[BUF_Y][BUF_X]; /* scratch buffer for output */
extern int num_buffer_lines; /* num lines of output */
extern int arg1, arg2, arg3; /* command arguments */
extern int breakpoints[MAX_BRKPTS]; /* memory breakpoints */
extern int watchpoints[MAX_BRKPTS]; /* memory watchpoints */
void clear_debugger_screen();
void bload(FILE*, char*, int);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Defines for Disk ][ emulation
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,10 +7,10 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
@ -27,7 +27,7 @@ struct diskette
int sector;
long file_size;
int phase;
int run_byte;
int run_byte;
FILE *fp;
int file_pos;
};
@ -47,22 +47,22 @@ struct drive
extern struct drive disk6;
void c_init_6();
int c_new_diskette_6(int, char*, int, int, int);
void c_eject_6(int);
void c_init_6();
int c_new_diskette_6(int, char*, int, int, int);
void c_eject_6(int);
void disk_install(int slot);
void disk_read_nop(),
disk_read_phase(),
disk_read_motor_off(),
disk_read_motor_on(),
disk_read_select_a(),
disk_read_select_b(),
disk_read_byte(),
disk_read_latch(),
disk_write_latch(),
disk_read_prepare_in(),
disk_read_prepare_out();
void disk_read_nop(),
disk_read_phase(),
disk_read_motor_off(),
disk_read_motor_on(),
disk_read_select_a(),
disk_read_select_b(),
disk_read_byte(),
disk_read_latch(),
disk_write_latch(),
disk_read_prepare_in(),
disk_read_prepare_out();
#define A2_DISK_H
#endif

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Font compiler
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,10 +7,10 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
@ -20,10 +20,10 @@
/* I'm not sure if this is the correct way to detect libc 5/4. I long
* since removed it from my system.
*/
#ifdef __GLIBC__
#ifdef __GLIBC__
#if __GLIBC__ == 1
/* Older Linux C libraries had getline removed (to humor programs that
/* Older Linux C libraries had getline removed (to humor programs that
* used that name for their own functions), but kept getdelim */
#define getline(l,s,f) getdelim(l,s,'\n',f)
@ -39,7 +39,7 @@ int main(void)
{
unsigned char byte;
char *line = 0;
char *line = 0;
size_t line_size = 0;
int i,mx=0;
@ -48,28 +48,35 @@ int main(void)
" * \n"
" * THIS FILE IS AUTOMATICALLY GENERATED --- DO NOT EDIT\n"
" */\n");
i = 0x100;
while (getline(&line,&line_size,stdin) != -1)
{
if (line[0] == ';') continue;
if (line[0] == ';')
{
continue;
}
if (line[0] == '=')
if (line[0] == '=')
{
char *name,*size;
name = line + 1;
while (isspace(*name)) name++;
size = strchr(name,',');
name = line + 1;
while (isspace(*name))
{
name++;
}
size = strchr(name,',');
*size++ = 0;
mx = i = strtol(size,0,0);
mx = i = strtol(size,0,0);
printf("\nconst unsigned char %s[%d] =\n{\n ",name,i*8);
continue;
}
continue;
}
i--;
if (line[0] == ':')
@ -80,9 +87,11 @@ int main(void)
{
int k;
if (getline(&line,&line_size,stdin) == -1) {
if (getline(&line,&line_size,stdin) == -1)
{
// ERROR ...
}
k = 8;
byte = 0;
while (k--)
@ -90,21 +99,31 @@ int main(void)
byte <<= 1;
byte += (line[k] == '#');
}
if (j)
printf("0x%02x, ",byte);
else if (i)
printf("0x%02x,\n ",byte); /* last byte in glyph */
else
printf("0x%02x\n};\n",byte); /* last item in array */
if (j)
{
printf("0x%02x, ",byte);
}
else
if (i)
{
printf("0x%02x,\n ",byte); /* last byte in glyph */
}
else
{
printf("0x%02x\n};\n",byte); /* last item in array */
}
}
}
else break;
else
{
break;
}
}
if (i)
{
{
fprintf(stderr,
"Trouble with font file at character 0x%02x\n",
mx-i-1);

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Exported menu routines
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,22 +7,22 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
#ifndef A2_INTERFACE_H
#define A2_INTERFACE_H
void c_interface_print( int x, int y, int cs, char *s );
void c_interface_redo_bottom();/* bit of a HACK? */
void c_load_interface_font();
void c_interface_keyboard_layout();
void c_interface_parameters();
void c_interface_exit();
void c_interface_translate_screen(char screen[24][41]);
void c_interface_select_diskette(int);
void c_interface_print( int x, int y, int cs, char *s );
void c_interface_redo_bottom(); /* bit of a HACK? */
void c_load_interface_font();
void c_interface_keyboard_layout();
void c_interface_parameters();
void c_interface_exit();
void c_interface_translate_screen(char screen[24][41]);
void c_interface_select_diskette(int);
#endif

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Joystick calibration routines
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,10 +7,10 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
@ -28,8 +28,8 @@
#include "misc.h"
#include "prefs.h"
int js_fd = -1; /* joystick file descriptor */
struct JS_DATA_TYPE js; /* joystick data struct */
int js_fd = -1; /* joystick file descriptor */
struct JS_DATA_TYPE js; /* joystick data struct */
int js_lowerrange_x,
js_upperrange_x,
@ -49,18 +49,26 @@ float
c_open_joystick() - opens joystick device and sets timelimit value
------------------------------------------------------------------------- */
int c_open_joystick() {
if (js_fd < 0) {
if ((js_fd = open("/dev/js0", O_RDONLY)) < 0) {
if (js_fd < 0)
{
if ((js_fd = open("/dev/js0", O_RDONLY)) < 0)
{
/* try again with another name */
if ((js_fd = open("/dev/joystick", O_RDONLY)) < 0)
return 1;/* problem */
}
/* set timelimit value */
if (ioctl(js_fd, JS_SET_TIMELIMIT, &js_timelimit) == -1)
return 1;/* problem */
/* try again with another name */
if ((js_fd = open("/dev/joystick", O_RDONLY)) < 0)
{
return 1; /* problem */
}
}
/* set timelimit value */
if (ioctl(js_fd, JS_SET_TIMELIMIT, &js_timelimit) == -1)
{
return 1; /* problem */
}
}
return 0;/* no problem */
return 0; /* no problem */
}
/* -------------------------------------------------------------------------
@ -68,7 +76,10 @@ int c_open_joystick() {
------------------------------------------------------------------------- */
void c_close_joystick() {
if (js_fd < 0)
return;
{
return;
}
close(js_fd);
js_fd = -1;
}
@ -99,7 +110,7 @@ void c_calculate_joystick_parms() {
and center coordinates. assumes that it can write to the interface
screen.
------------------------------------------------------------------------- */
void c_calibrate_joystick () {
void c_calibrate_joystick() {
int almost_done, done;
unsigned char x_val, y_val;
@ -110,50 +121,67 @@ void c_calibrate_joystick () {
js_min_y = MAXINT;
/* open joystick device if not open */
if (js_fd < 0) {
if (c_open_joystick()) { /* problem opening device */
c_interface_print(
1, 21, 0, " " );
c_interface_print(
1, 22, 0, " cannot open joystick device. " );
video_sync(0);
usleep(1500000);
c_interface_redo_bottom();
return;/* problem */
}
if (js_fd < 0)
{
if (c_open_joystick()) /* problem opening device */
{
c_interface_print(
1, 21, 0, " " );
c_interface_print(
1, 22, 0, " cannot open joystick device. " );
video_sync(0);
usleep(1500000);
c_interface_redo_bottom();
return; /* problem */
}
}
c_interface_print(
1, 21, 0, " Move joystick to all extremes then " );
1, 21, 0, " Move joystick to all extremes then " );
c_interface_print(
1, 22, 0, " center it and press a button. " );
1, 22, 0, " center it and press a button. " );
video_sync(0);
usleep(1500000);
c_interface_print(
1, 21, 0, " " );
1, 21, 0, " " );
c_interface_print(
1, 22, 0, " " );
1, 22, 0, " " );
almost_done = done = 0; /* not done calibrating */
almost_done = done = 0; /* not done calibrating */
while ((read(js_fd, &js, JS_RETURN) > 0) && (!done))
{
sprintf (temp, " x = %04x, y = %04x", js.x, js.y);
c_interface_print(1, 22, 0, temp);
video_sync(0);
if (js_max_x < js.x)
js_max_x = js.x;
if (js_max_y < js.y)
js_max_y = js.y;
sprintf(temp, " x = %04x, y = %04x", js.x, js.y);
c_interface_print(1, 22, 0, temp);
video_sync(0);
if (js_max_x < js.x)
{
js_max_x = js.x;
}
if (js_min_x > js.x)
js_min_x = js.x;
if (js_min_y > js.y)
js_min_y = js.y;
if (js_max_y < js.y)
{
js_max_y = js.y;
}
if (js.buttons != 0x00) /* press */
almost_done = 1;
if (almost_done && (js.buttons == 0x00)) /* release */
done = 1;
if (js_min_x > js.x)
{
js_min_x = js.x;
}
if (js_min_y > js.y)
{
js_min_y = js.y;
}
if (js.buttons != 0x00) /* press */
{
almost_done = 1;
}
if (almost_done && (js.buttons == 0x00)) /* release */
{
done = 1;
}
}
js_center_x = js.x;
@ -167,7 +195,7 @@ void c_calibrate_joystick () {
printf("js_center_y = %d\n", js_center_y);
printf("\n");
c_calculate_joystick_parms(); /* determine the parms */
c_calculate_joystick_parms(); /* determine the parms */
printf("js_lowerrange_x = %d\n", js_lowerrange_x);
printf("js_lowerrange_y = %d\n", js_lowerrange_y);
@ -184,24 +212,26 @@ void c_calibrate_joystick () {
printf("\n");
c_interface_print(
1, 21, 0, " Press a button to continue. " );
1, 21, 0, " Press a button to continue. " );
video_sync(0);
/* show the normalized values until user presses button */
while ((read(js_fd, &js, JS_RETURN) > 0) && js.buttons == 0x00) {
x_val = (js.x < js_center_x)
? (js.x - js_offset_x) * js_adjustlow_x
: (js.x - (js_center_x/*+js_offset_x*/)) * js_adjusthigh_x +
half_joy_range;
while ((read(js_fd, &js, JS_RETURN) > 0) && js.buttons == 0x00)
{
x_val = (js.x < js_center_x)
? (js.x - js_offset_x) * js_adjustlow_x
: (js.x - (js_center_x /*+js_offset_x*/)) * js_adjusthigh_x +
half_joy_range;
y_val = (js.y < js_center_y)
? (js.y - js_offset_y) * js_adjustlow_y
: (js.y - (js_center_y/*+js_offset_y*/)) * js_adjusthigh_y +
half_joy_range;
sprintf(temp, " x = %02x, y = %02x", x_val, y_val);
c_interface_print(1, 22, 0, temp);
video_sync(0);
y_val = (js.y < js_center_y)
? (js.y - js_offset_y) * js_adjustlow_y
: (js.y - (js_center_y /*+js_offset_y*/)) * js_adjusthigh_y +
half_joy_range;
sprintf(temp, " x = %02x, y = %02x", x_val, y_val);
c_interface_print(1, 22, 0, temp);
video_sync(0);
}
c_interface_redo_bottom();
video_sync(0);
}

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Keyboard handler
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,10 +7,10 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
@ -34,175 +34,175 @@ extern uid_t user, privileged;
extern void c_do_debugging();
/* parameters for generic and keyboard-simulated joysticks */
short joy_x = 127;
short joy_y = 127;
unsigned char joy_button0 = 0;
unsigned char joy_button1 = 0;
unsigned char joy_button2 = 0;
short joy_x = 127;
short joy_y = 127;
unsigned char joy_button0 = 0;
unsigned char joy_button1 = 0;
unsigned char joy_button2 = 0;
#ifdef PC_JOYSTICK
#include <linux/joystick.h>
int x_val, y_val;
#endif
static int next_key = -1;
static char caps_lock = 1; /* is enabled */
static int in_mygetch = 0;
static int next_key = -1;
static char caps_lock = 1; /* is enabled */
static int in_mygetch = 0;
/* ----------------------------------------------------
Keymap. Mapping scancodes to Apple II+ US Keyboard
---------------------------------------------------- */
static int apple_ii_keymap_plain[128] =
{ -1 , 27 , '1', '2', '3', '4', '5', '6', /* 00-07 */
'7', '8', '9', '0', ':', '-', 8 , 27 , /* 08-15 */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* 16-23 */
'O', 'P', -1 , 8 , 13 , -1 , 'A', 'S', /* 24-31 */
'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', /* 32-39 */
8 , -1 , -1 , 21 , 'Z', 'X', 'C', 'V', /* 40-47 */
'B', 'N', 'M', ',', '.', '/', -1 , -1 , /* 48-55 */
JB0 , ' ', -1 , kF1 , kF2 , kF3 , kF4 , kF5 , /* 56-63 */
kF6 , kF7 , kF8 , kF9 , kF10, -1 , -1 , JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1 , -1 , -1 , kF11, kF12, -1 , /* 80-87 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , /* 88-95 */
-1 , -1 , -1 , -1, JB1 , RST , kHOME , -1 , /* 96-103 */
kPGUP , 8 , 21 , kEND , -1 , kPGDN, JB2 , -1, /* 104-111 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , kF4 /* (pause) */, /* 112-119 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }; /* 120-127 */
{ -1, 27, '1', '2', '3', '4', '5', '6', /* 00-07 */
'7', '8', '9', '0', ':', '-', 8, 27, /* 08-15 */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* 16-23 */
'O', 'P', -1, 8, 13, -1, 'A', 'S', /* 24-31 */
'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', /* 32-39 */
8, -1, -1, 21, 'Z', 'X', 'C', 'V', /* 40-47 */
'B', 'N', 'M', ',', '.', '/', -1, -1, /* 48-55 */
JB0, ' ', -1, kF1, kF2, kF3, kF4, kF5, /* 56-63 */
kF6, kF7, kF8, kF9, kF10, -1, -1, JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1, -1, -1, kF11, kF12, -1, /* 80-87 */
-1, -1, -1, -1, -1, -1, -1, -1, /* 88-95 */
-1, -1, -1, -1, JB1, RST, kHOME, -1, /* 96-103 */
kPGUP, 8, 21, kEND, -1, kPGDN, JB2, -1, /* 104-111 */
-1, -1, -1, -1, -1, -1, -1, kF4 /* (pause) */, /* 112-119 */
-1, -1, -1, -1, -1, -1, -1, -1 }; /* 120-127 */
static int apple_ii_keymap_ctrl[128] =
{ -1 , 027, '1', '2', '3', '4', '5', '6', /* 00-07 */
'7', '8', '9', '0', ':', '-', 8 , 27 , /* 08-15 */
17 , 23 , 5 , 18 , 20 , 25 , 21 , 9 , /* 16-23 */
15 , 16 , -1 , 8 , 13 , -1 , 1 , 19 , /* 24-31 */
4 , 6 , 7 , 8 , 10 , 11 , 12 , ';', /* 32-39 */
8 , -1 , -1 , 21 , 26 , 24 , 3 , 22 , /* 40-47 */
2 , 14 , 13 , ',', '.', '/', -1 , -1 , /* 48-55 */
JB0 , ' ', -1 , kF1 , kF2 , kF3 , kF4 , kF5 , /* 56-63 */
kF6 , kF7 , kF8 , kF9 , kF10, -1 , -1 , JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1 , -1 , -1 , kF11, kF12, -1 , /* 80-87 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , /* 88-95 */
-1 , -1 , -1 , BOT, JB1 , RST , kHOME , -1 , /* 96-103 */
kPGUP , 8 , 21 , kEND, -1 , kPGDN, JB2 , -1, /* 104-111 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , kF4 /* pause */, /* 112-119 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }; /* 120-127 */
{ -1, 027, '1', '2', '3', '4', '5', '6', /* 00-07 */
'7', '8', '9', '0', ':', '-', 8, 27, /* 08-15 */
17, 23, 5, 18, 20, 25, 21, 9, /* 16-23 */
15, 16, -1, 8, 13, -1, 1, 19, /* 24-31 */
4, 6, 7, 8, 10, 11, 12, ';', /* 32-39 */
8, -1, -1, 21, 26, 24, 3, 22, /* 40-47 */
2, 14, 13, ',', '.', '/', -1, -1, /* 48-55 */
JB0, ' ', -1, kF1, kF2, kF3, kF4, kF5, /* 56-63 */
kF6, kF7, kF8, kF9, kF10, -1, -1, JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1, -1, -1, kF11, kF12, -1, /* 80-87 */
-1, -1, -1, -1, -1, -1, -1, -1, /* 88-95 */
-1, -1, -1, BOT, JB1, RST, kHOME, -1, /* 96-103 */
kPGUP, 8, 21, kEND, -1, kPGDN, JB2, -1, /* 104-111 */
-1, -1, -1, -1, -1, -1, -1, kF4 /* pause */, /* 112-119 */
-1, -1, -1, -1, -1, -1, -1, -1 }; /* 120-127 */
static int apple_ii_keymap_shifted[128] =
{ -1 , 27 , '!', '"', '#', '$', '%', '&', /* 00-07 */
39 , '(', ')', '0', '*', '=', 8 , 27 , /* 08-15 */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* 16-23 */
'O', '@', -1 , 8 , 13 , -1 , 'A', 'S', /* 24-31 */
'D', 'F', 'G', 'H', 'J', 'K', 'L', '+', /* 32-39 */
8 , -1 , -1 , 21 , 'Z', 'X', 'C', 'V', /* 40-47 */
'B', '^', 'M', '<', '>', '?', -1 , -1 , /* 48-55 */
JB0 , ' ', -1 , kF1 , kF2 , kF3 , kF4 , kF5 , /* 56-63 */
kF6 , kF7 , kF8 , kF9 , kF10, -1 , -1 , JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1 , -1 , -1 , kF11, kF12, -1 , /* 80-87 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , /* 88-95 */
-1 , -1 , -1 , -1 , JB1 , RST , kHOME , -1 , /* 96-103 */
kPGUP , 8 , 21 , kEND, -1 , kPGDN, JB2 , -1, /* 104-111 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , kF4 /* pause */, /* 112-119 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }; /* 120-127 */
{ -1, 27, '!', '"', '#', '$', '%', '&', /* 00-07 */
39, '(', ')', '0', '*', '=', 8, 27, /* 08-15 */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* 16-23 */
'O', '@', -1, 8, 13, -1, 'A', 'S', /* 24-31 */
'D', 'F', 'G', 'H', 'J', 'K', 'L', '+', /* 32-39 */
8, -1, -1, 21, 'Z', 'X', 'C', 'V', /* 40-47 */
'B', '^', 'M', '<', '>', '?', -1, -1, /* 48-55 */
JB0, ' ', -1, kF1, kF2, kF3, kF4, kF5, /* 56-63 */
kF6, kF7, kF8, kF9, kF10, -1, -1, JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1, -1, -1, kF11, kF12, -1, /* 80-87 */
-1, -1, -1, -1, -1, -1, -1, -1, /* 88-95 */
-1, -1, -1, -1, JB1, RST, kHOME, -1, /* 96-103 */
kPGUP, 8, 21, kEND, -1, kPGDN, JB2, -1, /* 104-111 */
-1, -1, -1, -1, -1, -1, -1, kF4 /* pause */, /* 112-119 */
-1, -1, -1, -1, -1, -1, -1, -1 }; /* 120-127 */
#ifdef APPLE_IIE
/* ----------------------------------------------------
//e Keymap. Mapping scancodes to Apple //e US Keyboard
---------------------------------------------------- */
static int apple_iie_keymap_plain[128] =
{ -1 , 27 , '1', '2', '3', '4', '5', '6', /* 00-07 */
'7', '8', '9', '0', '-', '=', 8 , 9 , /* 08-15 */
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', /* 16-23 */
'o', 'p', '[', ']', 13 , -1 , 'a', 's', /* 24-31 */
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', /* 32-39 */
'\'', '`', -1 ,'\\', 'z', 'x', 'c', 'v', /* 40-47 */
'b', 'n', 'm', ',', '.', '/', -1 , -1 , /* 48-55 */
JB0 , ' ', -1 , kF1 , kF2 , kF3 , kF4 , kF5 , /* 56-63 */
kF6 , kF7 , kF8 , kF9 , kF10, -1 , -1 , JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1 , -1 , -1 , kF11, kF12, -1 , /* 80-87 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , /* 88-95 */
-1 , -1 , -1 , -1, JB1 , RST , kHOME , 11 , /* 96-103 */
kPGUP , 8 , 21 , kEND, 10 , kPGDN, JB2, 127, /* 104-111 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , kF4 /* pause */, /* 112-119 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }; /* 120-127 */
{ -1, 27, '1', '2', '3', '4', '5', '6', /* 00-07 */
'7', '8', '9', '0', '-', '=', 8, 9, /* 08-15 */
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', /* 16-23 */
'o', 'p', '[', ']', 13, -1, 'a', 's', /* 24-31 */
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', /* 32-39 */
'\'', '`', -1,'\\', 'z', 'x', 'c', 'v', /* 40-47 */
'b', 'n', 'm', ',', '.', '/', -1, -1, /* 48-55 */
JB0, ' ', -1, kF1, kF2, kF3, kF4, kF5, /* 56-63 */
kF6, kF7, kF8, kF9, kF10, -1, -1, JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1, -1, -1, kF11, kF12, -1, /* 80-87 */
-1, -1, -1, -1, -1, -1, -1, -1, /* 88-95 */
-1, -1, -1, -1, JB1, RST, kHOME, 11, /* 96-103 */
kPGUP, 8, 21, kEND, 10, kPGDN, JB2, 127, /* 104-111 */
-1, -1, -1, -1, -1, -1, -1, kF4 /* pause */, /* 112-119 */
-1, -1, -1, -1, -1, -1, -1, -1 }; /* 120-127 */
static int apple_iie_keymap_ctrl[128] =
{ -1 , 27 , '1', '2', '3', '4', '5', '6', /* 00-07 */
'7', '8', '9', '0', '-', '=', 8 , 9 , /* 08-15 */
17 , 23 , 5 , 18 , 20 , 25 , 21 , 9 , /* 16-23 */
15 , 16 , 27 , 29 , 13 , -1 , 1 , 19 , /* 24-31 */
4 , 6 , 7 , 8 , 10 , 11 , 12 , ';', /* 32-39 */
'\'', '`', -1 ,'\\', 26 , 24 , 3 , 22 , /* 40-47 */
2 , 14 , 13 , ',', '.', '/', -1 , -1 , /* 48-55 */
JB0 , ' ', -1 , kF1 , kF2 , kF3 , kF4 , kF5 , /* 56-63 */
kF6 , kF7 , kF8 , kF9 , kF10, -1 , -1 , JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1 , -1 , -1 , kF11, kF12, -1 , /* 80-87 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , /* 88-95 */
-1 , -1 , -1 , BOT, JB1 , RST , kHOME , 11 , /* 96-103 */
kPGUP , 8 , 21 , kEND, 10 , kPGDN, JB2, 127, /* 104-111 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , kF4 /* pause */, /* 112-119 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }; /* 120-127 */
{ -1, 27, '1', '2', '3', '4', '5', '6', /* 00-07 */
'7', '8', '9', '0', '-', '=', 8, 9, /* 08-15 */
17, 23, 5, 18, 20, 25, 21, 9, /* 16-23 */
15, 16, 27, 29, 13, -1, 1, 19, /* 24-31 */
4, 6, 7, 8, 10, 11, 12, ';', /* 32-39 */
'\'', '`', -1,'\\', 26, 24, 3, 22, /* 40-47 */
2, 14, 13, ',', '.', '/', -1, -1, /* 48-55 */
JB0, ' ', -1, kF1, kF2, kF3, kF4, kF5, /* 56-63 */
kF6, kF7, kF8, kF9, kF10, -1, -1, JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1, -1, -1, kF11, kF12, -1, /* 80-87 */
-1, -1, -1, -1, -1, -1, -1, -1, /* 88-95 */
-1, -1, -1, BOT, JB1, RST, kHOME, 11, /* 96-103 */
kPGUP, 8, 21, kEND, 10, kPGDN, JB2, 127, /* 104-111 */
-1, -1, -1, -1, -1, -1, -1, kF4 /* pause */, /* 112-119 */
-1, -1, -1, -1, -1, -1, -1, -1 }; /* 120-127 */
static int apple_iie_keymap_shifted[128] =
{ -1 , 27 , '!', '@', '#', '$', '%', '^', /* 00-07 */
'&', '*', '(', ')', '_', '+', 8 , 9 , /* 08-15 */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* 16-23 */
'O', 'P', '{', '}', 13 , -1 , 'A', 'S', /* 24-31 */
'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', /* 32-39 */
'"', '~', -1 , '|', 'Z', 'X', 'C', 'V', /* 40-47 */
'B', 'N', 'M', '<', '>', '?', -1 , -1 , /* 48-55 */
JB0 , ' ', -1 , kF1 , kF2 , kF3 , kF4 , kF5 , /* 56-63 */
kF6 , kF7 , kF8 , kF9 , kF10, -1 , -1 , JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1 , -1 , -1 , kF11, kF12, -1 , /* 80-87 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , /* 88-95 */
-1 , -1 , -1 , -1 , JB1 , RST , kHOME , 11 , /* 96-103 */
kPGUP , 8 , 21 , kEND, 10 , kPGDN, JB2, 127, /* 104-111 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , kF4 /* pause */, /* 112-119 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }; /* 120-127 */
{ -1, 27, '!', '@', '#', '$', '%', '^', /* 00-07 */
'&', '*', '(', ')', '_', '+', 8, 9, /* 08-15 */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* 16-23 */
'O', 'P', '{', '}', 13, -1, 'A', 'S', /* 24-31 */
'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', /* 32-39 */
'"', '~', -1, '|', 'Z', 'X', 'C', 'V', /* 40-47 */
'B', 'N', 'M', '<', '>', '?', -1, -1, /* 48-55 */
JB0, ' ', -1, kF1, kF2, kF3, kF4, kF5, /* 56-63 */
kF6, kF7, kF8, kF9, kF10, -1, -1, JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1, -1, -1, kF11, kF12, -1, /* 80-87 */
-1, -1, -1, -1, -1, -1, -1, -1, /* 88-95 */
-1, -1, -1, -1, JB1, RST, kHOME, 11, /* 96-103 */
kPGUP, 8, 21, kEND, 10, kPGDN, JB2, 127, /* 104-111 */
-1, -1, -1, -1, -1, -1, -1, kF4 /* pause */, /* 112-119 */
-1, -1, -1, -1, -1, -1, -1, -1 }; /* 120-127 */
static int apple_iie_keymap_caps[128] =
{ -1 , 27 , '1', '2', '3', '4', '5', '6', /* 00-07 */
'7', '8', '9', '0', '-', '=', 8 , 9 , /* 08-15 */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* 16-23 */
'O', 'P', '[', ']', 13 , -1 , 'A', 'S', /* 24-31 */
'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', /* 32-39 */
'\'', '`', -1 ,'\\', 'Z', 'X', 'C', 'V', /* 40-47 */
'B', 'N', 'M', ',', '.', '/', -1 , -1 , /* 48-55 */
JB0 , ' ', -1 , kF1 , kF2 , kF3 , kF4 , kF5 , /* 56-63 */
kF6 , kF7 , kF8 , kF9 , kF10, -1 , -1 , JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1 , -1 , -1 , kF11, kF12, -1 , /* 80-87 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , /* 88-95 */
-1 , -1 , -1 , -1, JB1 , RST , kHOME , 11 , /* 96-103 */
kPGUP , 8 , 21 , kEND, 10 , kPGDN, JB2, 127, /* 104-111 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , kF4 /* pause */, /* 112-119 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }; /* 120-127 */
{ -1, 27, '1', '2', '3', '4', '5', '6', /* 00-07 */
'7', '8', '9', '0', '-', '=', 8, 9, /* 08-15 */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* 16-23 */
'O', 'P', '[', ']', 13, -1, 'A', 'S', /* 24-31 */
'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', /* 32-39 */
'\'', '`', -1,'\\', 'Z', 'X', 'C', 'V', /* 40-47 */
'B', 'N', 'M', ',', '.', '/', -1, -1, /* 48-55 */
JB0, ' ', -1, kF1, kF2, kF3, kF4, kF5, /* 56-63 */
kF6, kF7, kF8, kF9, kF10, -1, -1, JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1, -1, -1, kF11, kF12, -1, /* 80-87 */
-1, -1, -1, -1, -1, -1, -1, -1, /* 88-95 */
-1, -1, -1, -1, JB1, RST, kHOME, 11, /* 96-103 */
kPGUP, 8, 21, kEND, 10, kPGDN, JB2, 127, /* 104-111 */
-1, -1, -1, -1, -1, -1, -1, kF4 /* pause */, /* 112-119 */
-1, -1, -1, -1, -1, -1, -1, -1 }; /* 120-127 */
static int apple_iie_keymap_shift_ctrl[128] =
{ -1 , 27 , '1', 0 , '3', '4', '5', 30 , /* 00-07 */
'7', '8', '9', '0', 31 , '=', 8 , 9 , /* 08-15 */
17 , 23 , 5 , 18 , 20 , 25 , 21 , 9 , /* 16-23 */
15 , 16 , 27 , 29 , 13 , -1 , 1 , 19 , /* 24-31 */
4 , 6 , 7 , 8 , 10 , 11 , 12 , ';', /* 32-39 */
'\'', '`', 28 , -1 , 26 , 24 , 3 , 22 , /* 40-47 */
2 , 14 , 13 , ',', '.', '/', -1 , -1 , /* 48-55 */
JB0 , ' ', -1 , kF1 , kF2 , kF3 , kF4 , kF5 , /* 56-63 */
kF6 , kF7 , kF8 , kF9 , kF10, -1 , -1 , JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1 , -1 , -1 , kF11, kF12, -1 , /* 80-87 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , /* 88-95 */
-1 , -1 , -1 , BOT, JB1 , RST , kHOME , 11 , /* 96-103 */
kPGUP , 8 , 21 , kEND, 10 , kPGDN, JB2, 127, /* 104-111 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , kF4 /* pause */, /* 112-119 */
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }; /* 120-127 */
{ -1, 27, '1', 0, '3', '4', '5', 30, /* 00-07 */
'7', '8', '9', '0', 31, '=', 8, 9, /* 08-15 */
17, 23, 5, 18, 20, 25, 21, 9, /* 16-23 */
15, 16, 27, 29, 13, -1, 1, 19, /* 24-31 */
4, 6, 7, 8, 10, 11, 12, ';', /* 32-39 */
'\'', '`', 28, -1, 26, 24, 3, 22, /* 40-47 */
2, 14, 13, ',', '.', '/', -1, -1, /* 48-55 */
JB0, ' ', -1, kF1, kF2, kF3, kF4, kF5, /* 56-63 */
kF6, kF7, kF8, kF9, kF10, -1, -1, JUL, /* 64-71 */
J_U, JUR, S_D, J_L, J_C, J_R, S_I, JDL, /* 72-79 */
J_D, JDR, -1, -1, -1, kF11, kF12, -1, /* 80-87 */
-1, -1, -1, -1, -1, -1, -1, -1, /* 88-95 */
-1, -1, -1, BOT, JB1, RST, kHOME, 11, /* 96-103 */
kPGUP, 8, 21, kEND, 10, kPGDN, JB2, 127, /* 104-111 */
-1, -1, -1, -1, -1, -1, -1, kF4 /* pause */, /* 112-119 */
-1, -1, -1, -1, -1, -1, -1, -1 }; /* 120-127 */
#endif
static unsigned short max_speed = 0;
static char key_pressed[ 256 ];
static unsigned short max_speed = 0;
static char key_pressed[ 256 ];
/* ----------------------------------------------------
@ -211,9 +211,9 @@ static char key_pressed[ 256 ];
/* -------------------------------------------------------------------------
* This routine is called periodically to update the state of the emulator.
* -handles switching to menus
* -polls PC Joystick
* -update palette for flashing text
* -handles switching to menus
* -polls PC Joystick
* -update palette for flashing text
* ------------------------------------------------------------------------- */
void c_periodic_update(int dummysig) {
int current_key;
@ -221,138 +221,187 @@ void c_periodic_update(int dummysig) {
video_sync(0);
if (next_key >= 0)
{
current_key = next_key;
next_key = -1;
{
current_key = next_key;
next_key = -1;
if (current_key < 128) {
apple_ii_64k[0][0xC000] = current_key | 0x80;
apple_ii_64k[1][0xC000] = current_key | 0x80;
} else switch (current_key) {
case RST:
cpu65_interrupt(ResetSig);
break;
case BOT:
cpu65_interrupt(RebootSig);
break;
case J_C:
joy_x = joy_center_x;
joy_y = joy_center_y;
break;
case kF1:
c_interface_select_diskette( 0 );
break;
case kF2:
c_interface_select_diskette( 1 );
break;
case kF4:
while (c_mygetch(1) == -1) { }/*busy loop*/
break;
case kF5:
c_interface_keyboard_layout();
break;
case kF7:
cpu65_interrupt(EnterDebugSig);
break;
if (current_key < 128)
{
apple_ii_64k[0][0xC000] = current_key | 0x80;
apple_ii_64k[1][0xC000] = current_key | 0x80;
}
else
{
switch (current_key)
{
case RST:
cpu65_interrupt(ResetSig);
break;
case BOT:
cpu65_interrupt(RebootSig);
break;
case J_C:
joy_x = joy_center_x;
joy_y = joy_center_y;
break;
case kF1:
c_interface_select_diskette( 0 );
break;
case kF2:
c_interface_select_diskette( 1 );
break;
case kF4:
while (c_mygetch(1) == -1)
{
} /*busy loop*/
break;
case kF5:
c_interface_keyboard_layout();
break;
case kF7:
cpu65_interrupt(EnterDebugSig);
break;
#if 0
case kF8:
c_interface_words();
break;
case kF8:
c_interface_words();
break;
#endif
case kF9:
if (max_speed != 0)
cpu65_delay = max_speed, max_speed = 0;
else
max_speed = cpu65_delay, cpu65_delay = 1;
break;
case kF10:
if (max_speed != 0)
cpu65_delay = max_speed, max_speed = 0;
c_interface_parameters();
break;
}
case kF9:
if (max_speed != 0)
{
cpu65_delay = max_speed, max_speed = 0;
}
else
{
max_speed = cpu65_delay, cpu65_delay = 1;
}
break;
case kF10:
if (max_speed != 0)
{
cpu65_delay = max_speed, max_speed = 0;
}
c_interface_parameters();
break;
}
}
}
/* simulated joystick */
if (joy_mode == JOY_KYBD) {
if (key_pressed[ SCODE_J_U ])
{
if (joy_y > joy_step)
joy_y -= joy_step;
else
joy_y = 0;
}
if (joy_mode == JOY_KYBD)
{
if (key_pressed[ SCODE_J_U ])
{
if (joy_y > joy_step)
{
joy_y -= joy_step;
}
else
{
joy_y = 0;
}
}
if (key_pressed[ SCODE_J_D ])
{
if (joy_y < joy_range - joy_step)
joy_y += joy_step;
else
joy_y = joy_range-1;
}
if (key_pressed[ SCODE_J_D ])
{
if (joy_y < joy_range - joy_step)
{
joy_y += joy_step;
}
else
{
joy_y = joy_range-1;
}
}
if (key_pressed[ SCODE_J_L ])
{
if (joy_x > joy_step)
joy_x -= joy_step;
else
joy_x = 0;
}
if (key_pressed[ SCODE_J_L ])
{
if (joy_x > joy_step)
{
joy_x -= joy_step;
}
else
{
joy_x = 0;
}
}
if (key_pressed[ SCODE_J_R ])
{
if (joy_x < joy_range - joy_step)
joy_x += joy_step;
else
joy_x = joy_range-1;
}
if (key_pressed[ SCODE_J_R ])
{
if (joy_x < joy_range - joy_step)
{
joy_x += joy_step;
}
else
{
joy_x = joy_range-1;
}
}
}
#ifdef PC_JOYSTICK
else if ((joy_mode == JOY_PCJOY) && !(js_fd < 0)) {
if (read(js_fd, &js, JS_RETURN) == -1) {
else
if ((joy_mode == JOY_PCJOY) && !(js_fd < 0))
{
if (read(js_fd, &js, JS_RETURN) == -1)
{
// error
}
x_val = (js.x < js_center_x)
? (js.x - js_offset_x) * js_adjustlow_x
: (js.x - js_center_x) * js_adjusthigh_x + half_joy_range;
x_val = (js.x < js_center_x)
? (js.x - js_offset_x) * js_adjustlow_x
: (js.x - js_center_x) * js_adjusthigh_x + half_joy_range;
y_val = (js.y < js_center_y)
? (js.y - js_offset_y) * js_adjustlow_y
: (js.y - js_center_y) * js_adjusthigh_y + half_joy_range;
y_val = (js.y < js_center_y)
? (js.y - js_offset_y) * js_adjustlow_y
: (js.y - js_center_y) * js_adjusthigh_y + half_joy_range;
joy_y = (y_val > 0xff) ? 0xff : (y_val < 0) ? 0 : y_val;
joy_x = (x_val > 0xff) ? 0xff : (x_val < 0) ? 0 : x_val;
joy_y = (y_val > 0xff) ? 0xff : (y_val < 0) ? 0 : y_val;
joy_x = (x_val > 0xff) ? 0xff : (x_val < 0) ? 0 : x_val;
/* almost_x = (x_val > 0xff) ? 0xff : (x_val < 0) ? 0 : x_val; */
/* adj_x = (3-(joy_y/0x40)) + 10; */
/* turnpt_x = joy_y + adj_x; */
/* almost_x = (almost_x < turnpt_x) */
/* ? almost_x */
/* : (almost_x - turnpt_x) * adjusthigh_x; */
/* almost_x = (x_val > 0xff) ? 0xff : (x_val < 0) ? 0 : x_val; */
/* adj_x = (3-(joy_y/0x40)) + 10; */
/* turnpt_x = joy_y + adj_x; */
/* almost_x = (almost_x < turnpt_x) */
/* ? almost_x */
/* : (almost_x - turnpt_x) * adjusthigh_x; */
/* joy_x = (almost_x > 0xff) ? 0xff : (almost_x < 0) ? 0 : almost_x; */
/* joy_x = (almost_x > 0xff) ? 0xff : (almost_x < 0) ? 0 : almost_x; */
/* sample buttons only if apple keys aren't pressed. keys get set to
* 0xff, and js buttons are set to 0x80. */
if (!(joy_button0 & 0x7f))
joy_button0 = (js.buttons & 0x01) ? 0x80 : 0x0;
if (!(joy_button1 & 0x7f))
joy_button1 = (js.buttons & 0x02) ? 0x80 : 0x0;
if (!(joy_button2 & 0x7f))
joy_button2 = (js.buttons & 0x03) ? 0x80 : 0x0;
/* sample buttons only if apple keys aren't pressed. keys get set to
* 0xff, and js buttons are set to 0x80. */
if (!(joy_button0 & 0x7f))
{
joy_button0 = (js.buttons & 0x01) ? 0x80 : 0x0;
}
if (!(joy_button1 & 0x7f))
{
joy_button1 = (js.buttons & 0x02) ? 0x80 : 0x0;
}
if (!(joy_button2 & 0x7f))
{
joy_button2 = (js.buttons & 0x03) ? 0x80 : 0x0;
}
}
#endif
else if (joy_mode == JOY_OFF)
else
if (joy_mode == JOY_OFF)
{
joy_x = joy_y = 256;
}
}
/* Called from cpu code. Perhaps should be moved to misc.c, but was
/* Called from cpu code. Perhaps should be moved to misc.c, but was
* abstracted from function above...
*/
void enter_debugger(void)
{
c_do_debugging();
c_do_debugging();
}
/* -------------------------------------------------------------------------
@ -363,74 +412,101 @@ void c_read_raw_key(int scancode, int pressed) {
/* determine which key mapping to use */
#ifdef APPLE_IIE
if (apple_mode == IIE_MODE || in_mygetch) {
/* set/reset caps lock */
if (key_pressed[ SCODE_CAPS ])
caps_lock = !caps_lock;
if (apple_mode == IIE_MODE || in_mygetch)
{
/* set/reset caps lock */
if (key_pressed[ SCODE_CAPS ])
{
caps_lock = !caps_lock;
}
if ((key_pressed[ SCODE_L_SHIFT ] || /* shift-ctrl */
key_pressed[ SCODE_R_SHIFT ]) &&
(key_pressed[ SCODE_L_CTRL ] ||
key_pressed[ SCODE_R_CTRL ]))
keymap = apple_iie_keymap_shift_ctrl;
else if (key_pressed[ SCODE_L_CTRL ] || /* ctrl */
key_pressed[ SCODE_R_CTRL ])
keymap = apple_iie_keymap_ctrl;
else if (key_pressed[ SCODE_L_SHIFT ] || /* shift */
key_pressed[ SCODE_R_SHIFT ])
keymap = apple_iie_keymap_shifted;
else if (caps_lock) /* caps lock */
keymap = apple_iie_keymap_caps;
else /* plain */
keymap = apple_iie_keymap_plain;
} else
if ((key_pressed[ SCODE_L_SHIFT ] || /* shift-ctrl */
key_pressed[ SCODE_R_SHIFT ]) &&
(key_pressed[ SCODE_L_CTRL ] ||
key_pressed[ SCODE_R_CTRL ]))
{
keymap = apple_iie_keymap_shift_ctrl;
}
else
if (key_pressed[ SCODE_L_CTRL ] || /* ctrl */
key_pressed[ SCODE_R_CTRL ])
{
keymap = apple_iie_keymap_ctrl;
}
else
if (key_pressed[ SCODE_L_SHIFT ] || /* shift */
key_pressed[ SCODE_R_SHIFT ])
{
keymap = apple_iie_keymap_shifted;
}
else
if (caps_lock) /* caps lock */
{
keymap = apple_iie_keymap_caps;
}
else /* plain */
{
keymap = apple_iie_keymap_plain;
}
}
else
#endif
{
if (key_pressed[ SCODE_L_CTRL ] ||
key_pressed[ SCODE_R_CTRL ])
keymap = apple_ii_keymap_ctrl;
else if (key_pressed[ SCODE_L_SHIFT ] ||
key_pressed[ SCODE_R_SHIFT ])
keymap = apple_ii_keymap_shifted;
else
keymap = apple_ii_keymap_plain;
if (key_pressed[ SCODE_L_CTRL ] ||
key_pressed[ SCODE_R_CTRL ])
{
keymap = apple_ii_keymap_ctrl;
}
else
if (key_pressed[ SCODE_L_SHIFT ] ||
key_pressed[ SCODE_R_SHIFT ])
{
keymap = apple_ii_keymap_shifted;
}
else
{
keymap = apple_ii_keymap_plain;
}
}
/* key is pressed */
if (pressed) {
if (pressed)
{
key_pressed[ scancode ] = 1;
key_pressed[ scancode ] = 1;
switch (keymap[ scancode ]) {
case JB0:
joy_button0 = 0xff;/* open apple */
break;
case JB1:
joy_button1 = 0xff;/* closed apple */
break;
case JB2:
joy_button2 = 0xff;/* unused? */
break;
default:
next_key = keymap[scancode];
break;
}
switch (keymap[ scancode ])
{
case JB0:
joy_button0 = 0xff; /* open apple */
break;
case JB1:
joy_button1 = 0xff; /* closed apple */
break;
case JB2:
joy_button2 = 0xff; /* unused? */
break;
default:
next_key = keymap[scancode];
break;
}
}
/* key is released */
else {
else
{
key_pressed[ scancode ] = 0;
switch (keymap[ scancode ]) {
case JB0:
joy_button0 = 0x00;
break;
case JB1:
joy_button1 = 0x00;
break;
case JB2:
joy_button2 = 0x00;
break;
}
switch (keymap[ scancode ])
{
case JB0:
joy_button0 = 0x00;
break;
case JB1:
joy_button1 = 0x00;
break;
case JB2:
joy_button2 = 0x00;
break;
}
}
}
@ -440,10 +516,17 @@ int c_mygetch(int block)
in_mygetch = 1;
if (block) while (next_key == -1)
video_sync(1);
if (block)
{
while (next_key == -1)
{
video_sync(1);
}
}
else
{
video_sync(0);
}
in_mygetch = 0;

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Keyboard definitions
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,71 +7,71 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
#ifndef A2_KEYS_H
#define A2_KEYS_H
#define SCODE_L_CTRL 29
#define SCODE_R_CTRL 97
#define SCODE_L_SHIFT 42
#define SCODE_R_SHIFT 54
#define SCODE_CAPS 58
#define SCODE_J_U 72
#define SCODE_J_D 80
#define SCODE_J_L 75
#define SCODE_J_R 77
#define SCODE_J_C 76
#define SCODE_L_CTRL 29
#define SCODE_R_CTRL 97
#define SCODE_L_SHIFT 42
#define SCODE_R_SHIFT 54
#define SCODE_CAPS 58
#define SCODE_J_U 72
#define SCODE_J_D 80
#define SCODE_J_L 75
#define SCODE_J_R 77
#define SCODE_J_C 76
#define kF1 128
#define kF2 129
#define kF3 130
#define kF4 131
#define kF5 132
#define kF6 133
#define kF7 134
#define kF8 135
#define kF9 136
#define kF10 137
#define kF11 138
#define kF12 139
#define kPRNT 140
#define RST kPRNT
#define kF1 128
#define kF2 129
#define kF3 130
#define kF4 131
#define kF5 132
#define kF6 133
#define kF7 134
#define kF8 135
#define kF9 136
#define kF10 137
#define kF11 138
#define kF12 139
#define kPRNT 140
#define RST kPRNT
#define J_U 141
#define J_D 142
#define J_L 143
#define J_R 144
#define JUL 145
#define JUR 146
#define JDL 147
#define JDR 148
#define J_U 141
#define J_D 142
#define J_L 143
#define J_R 144
#define JUL 145
#define JUR 146
#define JDL 147
#define JDR 148
#define JB0 149
#define JB1 150
#define JB2 151
#define JB0 149
#define JB1 150
#define JB2 151
#define S_D 152
#define S_I 153
#define J_C 154
#define kPAUSE 155
#define S_D 152
#define S_I 153
#define J_C 154
#define kPAUSE 155
#define BOT kPAUSE
#define kLEFT 8 /* 157 */
#define kRIGHT 21 /* 158 */
#define kUP 11 /* 159 */
#define kDOWN 10 /* 160 */
#define kLEFT 8 /* 157 */
#define kRIGHT 21 /* 158 */
#define kUP 11 /* 159 */
#define kDOWN 10 /* 160 */
#define kESC 27 /* 161 */
#define kPGUP 162
#define kHOME 163
#define kPGDN 164
#define kEND 165
#define kESC 27 /* 161 */
#define kPGUP 162
#define kHOME 163
#define kPGDN 164
#define kEND 165
#ifdef PC_JOYSTICK

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Miscellaneous defines
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,10 +7,10 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
@ -33,7 +33,7 @@
#define SW_ALTZP 0xC008
#define SW_80COL 0xC00C
#define SW_ALTCHAR 0xC00E
#define SW_SLOTC3ROM 0xC00B /* anomaly */
#define SW_SLOTC3ROM 0xC00B /* anomaly */
#define SW_SLOTCXROM 0xC006
#define SW_DHIRES 0xC05E
#define SW_IOUDIS 0xC07E
@ -51,16 +51,16 @@ unsigned char apple_ii_64k[2][65536]; /* 128k memory */
unsigned char language_card[2][8192], language_banks[2][8192];
/* misc stuff */
int soundAllowed;
unsigned char random_value;
int soundAllowed;
unsigned char random_value;
/* global ref to commandline args */
char **argv;
int argc;
char **argv;
int argc;
/* misc arrays */
#define TEMPSIZE 4096
char temp[ TEMPSIZE ];/* should be >=4096 (stuff depends on this) */
#define TEMPSIZE 4096
char temp[ TEMPSIZE ]; /* should be >=4096 (stuff depends on this) */
#ifdef APPLE_IIE
/* memory offsets from softswitches */
@ -90,38 +90,38 @@ extern int softswitches;
#endif /* !__ASSEMBLER__ */
#define SS_TEXT 0x00000001
#define SS_MIXED 0x00000002
#define SS_HIRES 0x00000004
#define SS_PAGE2 0x00000008
#define SS_BANK2 0x00000010
#define SS_LCRAM 0x00000020
#define SS_LCSEC 0x00000040 /* check for double read */
#define SS_LCWRT 0x00000080 /* LC write enable */
#define SS_80STORE 0x00000100
#define SS_80COL 0x00000200
#define SS_RAMRD 0x00000400
#define SS_RAMWRT 0x00000800
#define SS_ALTZP 0x00001000
#define SS_DHIRES 0x00002000
#define SS_IOUDIS 0x00004000
#define SS_CXROM 0x00008000
#define SS_C3ROM 0x00010000
#define SS_ALTCHAR 0x00020000
#define SS_TEXT 0x00000001
#define SS_MIXED 0x00000002
#define SS_HIRES 0x00000004
#define SS_PAGE2 0x00000008
#define SS_BANK2 0x00000010
#define SS_LCRAM 0x00000020
#define SS_LCSEC 0x00000040 /* check for double read */
#define SS_LCWRT 0x00000080 /* LC write enable */
#define SS_80STORE 0x00000100
#define SS_80COL 0x00000200
#define SS_RAMRD 0x00000400
#define SS_RAMWRT 0x00000800
#define SS_ALTZP 0x00001000
#define SS_DHIRES 0x00002000
#define SS_IOUDIS 0x00004000
#define SS_CXROM 0x00008000
#define SS_C3ROM 0x00010000
#define SS_ALTCHAR 0x00020000
/* Pseudo soft switches. These are actually functions of other SSes, but are
* tiresome to calculate as needed.
* tiresome to calculate as needed.
*
*/
#define SS_SCREEN 0x00040000 /* PAGE2 && !80STORE */
#define SS_TEXTRD 0x00080000 /* (PAGE2 && 80STORE) ||
(RAMRD && !80STORE) */
#define SS_TEXTWRT 0x00100000 /* (PAGE2 && 80STORE) ||
(RAMWRT && !80STORE) */
#define SS_HGRRD 0x00200000 /* (PAGE2 && 80STORE && HIRES) ||
(RAMRD && !(80STORE && HIRES) */
#define SS_HGRWRT 0x00400000 /* (PAGE2 && 80STORE && HIRES) ||
(RAMWRT && !(80STORE && HIRES)) */
#define SS_SCREEN 0x00040000 /* PAGE2 && !80STORE */
#define SS_TEXTRD 0x00080000 /* (PAGE2 && 80STORE) ||
(RAMRD && !80STORE) */
#define SS_TEXTWRT 0x00100000 /* (PAGE2 && 80STORE) ||
(RAMWRT && !80STORE) */
#define SS_HGRRD 0x00200000 /* (PAGE2 && 80STORE && HIRES) ||
(RAMRD && !(80STORE && HIRES) */
#define SS_HGRWRT 0x00400000 /* (PAGE2 && 80STORE && HIRES) ||
(RAMWRT && !(80STORE && HIRES)) */
#ifndef __ASSEMBLER__
/* -------------------------------------------------------------------------
@ -140,119 +140,119 @@ void compact(void);
/* vm hooks */
void ram_nop(),
void ram_nop(),
write_ram_default(),
write_unmapped_softswitch(),
write_ram_default(),
write_unmapped_softswitch(),
read_ram_default(),
read_random(),
read_unmapped_softswitch(),
read_keyboard(),
read_keyboard_strobe(),
read_speaker_toggle_pc(),
read_switch_primary_page(),
read_switch_secondary_page(),
read_switch_graphics(),
read_switch_text(),
read_switch_no_mixed(),
read_switch_mixed(),
read_switch_lores(),
read_switch_hires(),
read_ram_default(),
read_random(),
read_unmapped_softswitch(),
read_keyboard(),
read_keyboard_strobe(),
read_speaker_toggle_pc(),
read_switch_primary_page(),
read_switch_secondary_page(),
read_switch_graphics(),
read_switch_text(),
read_switch_no_mixed(),
read_switch_mixed(),
read_switch_lores(),
read_switch_hires(),
read_button0(),
read_button1(),
read_button2(),
read_gc0(),
read_gc1(),
read_gc_strobe(),
lc_c080(),
lc_c081(),
lc_c082(),
lc_c083(),
lc_c088(),
lc_c089(),
lc_c08a(),
lc_c08b(),
write_ram_bank(),
read_ram_bank(),
write_ram_lc(),
read_ram_lc();
read_button0(),
read_button1(),
read_button2(),
read_gc0(),
read_gc1(),
read_gc_strobe(),
lc_c080(),
lc_c081(),
lc_c082(),
lc_c083(),
lc_c088(),
lc_c089(),
lc_c08a(),
lc_c08b(),
write_ram_bank(),
read_ram_bank(),
write_ram_lc(),
read_ram_lc();
#ifdef APPLE_IIE
void iie_write_ram_default(),
iie_read_ram_default(),
void iie_write_ram_default(),
iie_read_ram_default(),
/* //e text pages */
iie_read_ram_text_page0(),
iie_write_screen_hole_text_page0(),
/* //e text pages */
iie_read_ram_text_page0(),
iie_write_screen_hole_text_page0(),
/* //e hires page 0 */
iie_read_ram_hires_page0(),
iie_write_screen_hole_hires_page0(),
/* //e hires page 0 */
iie_read_ram_hires_page0(),
iie_write_screen_hole_hires_page0(),
/* //e zpage,stack, ram banks */
iie_read_ram_zpage_and_stack(),
iie_write_ram_zpage_and_stack(),
iie_read_slot3(),
iie_read_slotx(),
iie_read_slot_expansion(),
iie_disable_slot_expansion(),
iie_read_gc2(),
iie_read_gc3(),
/* //e zpage,stack, ram banks */
iie_read_ram_zpage_and_stack(),
iie_write_ram_zpage_and_stack(),
iie_read_slot3(),
iie_read_slotx(),
iie_read_slot_expansion(),
iie_disable_slot_expansion(),
iie_read_gc2(),
iie_read_gc3(),
iie_c080(),
iie_c081(),
iie_c083(),
iie_c088(),
iie_c089(),
iie_c08b(),
iie_c080(),
iie_c081(),
iie_c083(),
iie_c088(),
iie_c089(),
iie_c08b(),
/* //e toggle softswitches */
iie_ramrd_main(),
iie_ramrd_aux(),
iie_ramwrt_main(),
iie_ramwrt_aux(),
iie_80store_off(),
iie_80store_on(),
iie_altzp_main(),
iie_altzp_aux(),
iie_80col_off(),
iie_80col_on(),
iie_altchar_off(),
iie_altchar_on(),
iie_c3rom_peripheral(),
iie_c3rom_internal(),
iie_cxrom_peripheral(),
iie_cxrom_internal(),
iie_ioudis_on(),
iie_ioudis_off(),
iie_dhires_on(),
iie_dhires_off(),
iie_hires_off(),
iie_hires_on(),
iie_page2_on(),
iie_page2_off(),
/* //e toggle softswitches */
iie_ramrd_main(),
iie_ramrd_aux(),
iie_ramwrt_main(),
iie_ramwrt_aux(),
iie_80store_off(),
iie_80store_on(),
iie_altzp_main(),
iie_altzp_aux(),
iie_80col_off(),
iie_80col_on(),
iie_altchar_off(),
iie_altchar_on(),
iie_c3rom_peripheral(),
iie_c3rom_internal(),
iie_cxrom_peripheral(),
iie_cxrom_internal(),
iie_ioudis_on(),
iie_ioudis_off(),
iie_dhires_on(),
iie_dhires_off(),
iie_hires_off(),
iie_hires_on(),
iie_page2_on(),
iie_page2_off(),
/* //e check softswitche settings */
iie_check_80store(),
iie_check_bank(),
iie_check_lcram(),
iie_check_ramrd(),
iie_check_ramwrt(),
iie_check_altzp(),
iie_check_c3rom(),
iie_check_cxrom(),
iie_check_80col(),
iie_check_altchar(),
iie_check_text(),
iie_check_mixed(),
iie_check_hires(),
iie_check_page2(),
iie_check_ioudis(),
iie_check_dhires(),
iie_check_vbl();
/* //e check softswitche settings */
iie_check_80store(),
iie_check_bank(),
iie_check_lcram(),
iie_check_ramrd(),
iie_check_ramwrt(),
iie_check_altzp(),
iie_check_c3rom(),
iie_check_cxrom(),
iie_check_80col(),
iie_check_altchar(),
iie_check_text(),
iie_check_mixed(),
iie_check_hires(),
iie_check_page2(),
iie_check_ioudis(),
iie_check_dhires(),
iie_check_vbl();
#endif /* APPLE_IIE */
#endif /* !__ASSEMBLER__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Preferences file maintenance
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,10 +7,10 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
@ -27,19 +27,19 @@
#include "interface.h"
#include "cpu.h"
#define PRM_NONE 0
#define PRM_SPEED 1
#define PRM_MODE 2
#define PRM_DISK_PATH 3
#define PRM_HIRES_COLOR 4
#define PRM_SOUND 5
#define PRM_JOY_INPUT 6
#define PRM_JOY_RANGE 7
#define PRM_JOY_OX 8
#define PRM_JOY_OY 9
#define PRM_JOY_PC_CALIBRATE 10
#define PRM_JOY_KYBD_SENSITIVITY 11
#define PRM_ROM_PATH 12
#define PRM_NONE 0
#define PRM_SPEED 1
#define PRM_MODE 2
#define PRM_DISK_PATH 3
#define PRM_HIRES_COLOR 4
#define PRM_SOUND 5
#define PRM_JOY_INPUT 6
#define PRM_JOY_RANGE 7
#define PRM_JOY_OX 8
#define PRM_JOY_OY 9
#define PRM_JOY_PC_CALIBRATE 10
#define PRM_JOY_KYBD_SENSITIVITY 11
#define PRM_ROM_PATH 12
char system_path[SYSSIZE];
@ -68,345 +68,408 @@ int js_min_y;
static char *config_filename;
struct match_table
{
{
const char *tag;
int value;
};
};
static const struct match_table prefs_table[] =
{
{"speed", PRM_SPEED},
{"mode", PRM_MODE},
{"path", PRM_DISK_PATH},
{"disk path", PRM_DISK_PATH},
{"disk_path", PRM_DISK_PATH},
{"path", PRM_DISK_PATH},
{"color", PRM_HIRES_COLOR},
{"sound", PRM_SOUND},
{"joystick", PRM_JOY_INPUT},
{"joy range", PRM_JOY_RANGE},
{"joystick range", PRM_JOY_RANGE},
{"joy_range", PRM_JOY_RANGE},
{"origin_x", PRM_JOY_OX},
{"origin_y", PRM_JOY_OY},
{"pc joystick parms", PRM_JOY_PC_CALIBRATE},
{"pc_joystick_parms", PRM_JOY_PC_CALIBRATE},
{"sensitivity", PRM_JOY_KYBD_SENSITIVITY},
{"system path", PRM_ROM_PATH},
{"system_path", PRM_ROM_PATH},
{0, PRM_NONE}
{ "speed", PRM_SPEED },
{ "mode", PRM_MODE },
{ "path", PRM_DISK_PATH },
{ "disk path", PRM_DISK_PATH },
{ "disk_path", PRM_DISK_PATH },
{ "path", PRM_DISK_PATH },
{ "color", PRM_HIRES_COLOR },
{ "sound", PRM_SOUND },
{ "joystick", PRM_JOY_INPUT },
{ "joy range", PRM_JOY_RANGE },
{ "joystick range", PRM_JOY_RANGE },
{ "joy_range", PRM_JOY_RANGE },
{ "origin_x", PRM_JOY_OX },
{ "origin_y", PRM_JOY_OY },
{ "pc joystick parms", PRM_JOY_PC_CALIBRATE },
{ "pc_joystick_parms", PRM_JOY_PC_CALIBRATE },
{ "sensitivity", PRM_JOY_KYBD_SENSITIVITY },
{ "system path", PRM_ROM_PATH },
{ "system_path", PRM_ROM_PATH },
{ 0, PRM_NONE }
};
static const struct match_table modes_table[] =
{
{"][+", II_MODE},
{"][+ undocumented", IIU_MODE},
{ "][+", II_MODE },
{ "][+ undocumented", IIU_MODE },
#ifdef APPLE_IIE
{"//e", IIE_MODE},
{0, IIE_MODE}
{ "//e", IIE_MODE },
{ 0, IIE_MODE }
#else /* !APPLE_IIE */
{0, IIU_MODE}
{ 0, IIU_MODE }
#endif /* !APPLE_IIE */
};
static const struct match_table color_table[] =
{
{"black/white", NO_COLOR},
{"lazy color", LAZY_COLOR},
{"color", COLOR},
{"lazy interpolated", LAZY_INTERP},
{"interpolated", INTERP},
{"off", 0},
{"on", COLOR},
{0, COLOR}
{ "black/white", NO_COLOR },
{ "lazy color", LAZY_COLOR },
{ "color", COLOR },
{ "lazy interpolated", LAZY_INTERP },
{ "interpolated", INTERP },
{ "off", 0 },
{ "on", COLOR },
{ 0, COLOR }
};
static const struct match_table sound_table[] =
{
{"off", 0},
{"pc_speaker", 1},
{"on", 1},
{0, 1},
{ "off", 0 },
{ "pc_speaker", 1 },
{ "on", 1 },
{ 0, 1 },
};
static const struct match_table joy_input_table[] =
{
{"off", JOY_OFF},
{"keyboard", JOY_KYBD},
{"linear", JOY_KYBD},
{ "off", JOY_OFF },
{ "keyboard", JOY_KYBD },
{ "linear", JOY_KYBD },
#ifdef PC_JOYSTICK
{"pc joystick", JOY_PCJOY},
{"pc_joystick", JOY_PCJOY},
#endif /* PC_JOYSTICK */
{ "pc joystick", JOY_PCJOY },
{ "pc_joystick", JOY_PCJOY },
#endif /* PC_JOYSTICK */
#if 0
{"digital", JOY_DIGITAL},
#endif /* 0 */
{0, JOY_KYBD}
{ "digital", JOY_DIGITAL },
#endif /* 0 */
{ 0, JOY_KYBD }
};
/* Find the number assigned to KEYWORD in a match table PARADIGM. If no match,
* then the value associated with the terminating entry is used as a
* then the value associated with the terminating entry is used as a
* default. */
static int
match (const struct match_table *paradigm, const char *keyword)
static int
match(const struct match_table *paradigm, const char *keyword)
{
while (paradigm->tag && strcasecmp (paradigm->tag, keyword))
paradigm++;
return paradigm->value;
while (paradigm->tag && strcasecmp(paradigm->tag, keyword))
{
paradigm++;
}
return paradigm->value;
}
/* Reverse match -- find a keyword associated with number KEY in
* PARADIGM. The first match is used -- synonym keywords appearing later
/* Reverse match -- find a keyword associated with number KEY in
* PARADIGM. The first match is used -- synonym keywords appearing later
* in the table are not chosen.
*
* A null is returned for no match.
* A null is returned for no match.
*/
static const char *reverse_match (const struct match_table *paradigm, int key)
static const char *reverse_match(const struct match_table *paradigm, int key)
{
while (paradigm->tag && key != paradigm->value)
paradigm++;
return paradigm->tag;
while (paradigm->tag && key != paradigm->value)
{
paradigm++;
}
return paradigm->tag;
}
/* Eat leading and trailing whitespace of string X. The old string is
* overwritten and a new pointer is returned.
/* Eat leading and trailing whitespace of string X. The old string is
* overwritten and a new pointer is returned.
*/
static char *
clean_string (char *x)
clean_string(char *x)
{
size_t y;
size_t y;
/* Leading white space */
while (isspace (*x)) x++;
/* Leading white space */
while (isspace(*x))
{
x++;
}
/* Trailing white space */
y = strlen (x);
while (y && x[y--] == ' ');
x[y] = 0;
/* Trailing white space */
y = strlen(x);
while (y && x[y--] == ' ')
{
}
return x;
x[y] = 0;
return x;
}
/* Load the configuration. Must be called *once* at start. */
void
load_settings (void)
load_settings(void)
{
/* set system defaults before user defaults. */
strcpy (disk_path, "./disks");
strcpy (system_path, "./rom");
/* set system defaults before user defaults. */
strcpy(disk_path, "./disks");
strcpy(system_path, "./rom");
{
const char *homedir;
{
const char *homedir;
homedir = getenv ("HOME");
config_filename = malloc (strlen (homedir) + 9);
strcpy (config_filename, homedir);
strcat (config_filename, "/.apple2");
homedir = getenv("HOME");
config_filename = malloc(strlen(homedir) + 9);
strcpy(config_filename, homedir);
strcat(config_filename, "/.apple2");
/* config_filename is left allocated for convinence in
* save_settings */
}
/* config_filename is left allocated for convinence in
* save_settings */
}
{
FILE *config_file;
char *buffer = 0;
size_t size = 0;
{
FILE *config_file;
char *buffer = 0;
size_t size = 0;
config_file = fopen (config_filename, "r");
if (config_file == NULL)
{
printf (
"Warning. Cannot open the .apple2 system defaults file.\n"
"Make sure it's readable in your home directory.");
printf ("Press RETURN to continue...");
getchar ();
return;
}
config_file = fopen(config_filename, "r");
if (config_file == NULL)
{
printf(
"Warning. Cannot open the .apple2 system defaults file.\n"
"Make sure it's readable in your home directory.");
printf("Press RETURN to continue...");
getchar();
return;
}
while (getline (&buffer, &size, config_file) != -1)
{
char *parameter;
char *argument;
while (getline(&buffer, &size, config_file) != -1)
{
char *parameter;
char *argument;
/* Split line between parameter and argument */
/* Split line between parameter and argument */
parameter = buffer;
argument = strchr (buffer, '=');
argument[0] = 0;
argument++;
parameter = buffer;
argument = strchr(buffer, '=');
argument[0] = 0;
argument++;
parameter = clean_string (parameter);
argument = clean_string (argument);
parameter = clean_string(parameter);
argument = clean_string(argument);
switch (match (prefs_table, parameter))
{
case PRM_NONE:
fprintf (stderr, "Unrecognized config parameter `%s'", parameter);
break;
switch (match(prefs_table, parameter))
{
case PRM_NONE:
fprintf(stderr, "Unrecognized config parameter `%s'", parameter);
break;
case PRM_SPEED:
{
int x;
case PRM_SPEED:
{
int x;
x = strtol (argument, 0, 0);
x = strtol(argument, 0, 0);
if (x < 0)
x = 0;
if (x < 0)
{
x = 0;
}
cpu65_delay = MAX_APPLE_DELAY - x + 1;
if (cpu65_delay < 1)
cpu65_delay = 1;
}
break;
cpu65_delay = MAX_APPLE_DELAY - x + 1;
if (cpu65_delay < 1)
{
cpu65_delay = 1;
}
}
break;
case PRM_MODE:
apple_mode = match (modes_table, argument);
break;
case PRM_MODE:
apple_mode = match(modes_table, argument);
break;
case PRM_DISK_PATH:
strncpy (disk_path, argument, DISKSIZE);
break;
case PRM_DISK_PATH:
strncpy(disk_path, argument, DISKSIZE);
break;
case PRM_HIRES_COLOR:
color_mode = match (color_table, argument);
break;
case PRM_HIRES_COLOR:
color_mode = match(color_table, argument);
break;
case PRM_SOUND:
sound_mode = match (sound_table, argument);
break;
case PRM_SOUND:
sound_mode = match(sound_table, argument);
break;
case PRM_JOY_INPUT:
joy_mode = match (joy_input_table, argument);
break;
case PRM_JOY_INPUT:
joy_mode = match(joy_input_table, argument);
break;
case PRM_JOY_RANGE:
joy_range = strtol (argument, 0, 0);
if (joy_range < 10)
joy_range = 10;
else if (joy_range > 256)
joy_range = 256;
half_joy_range = joy_range / 2;
case PRM_JOY_RANGE:
joy_range = strtol(argument, 0, 0);
if (joy_range < 10)
{
joy_range = 10;
}
else
if (joy_range > 256)
{
joy_range = 256;
}
if (joy_center_x > joy_range)
joy_center_x = half_joy_range;
if (joy_center_y > joy_range)
joy_center_y = half_joy_range;
break;
half_joy_range = joy_range / 2;
case PRM_JOY_OX:
joy_center_x = strtol (argument, 0, 0);
if (joy_center_x < 0)
joy_center_x = 0;
else if (joy_center_x > 255)
joy_center_x = 255;
if (joy_center_x > joy_range)
{
joy_center_x = half_joy_range;
}
if (joy_center_x > joy_range)
joy_center_x = half_joy_range;
break;
if (joy_center_y > joy_range)
{
joy_center_y = half_joy_range;
}
case PRM_JOY_OY:
joy_center_y = strtol (argument, 0, 0);
if (joy_center_y < 0)
joy_center_y = 0;
else if (joy_center_y > 255)
joy_center_y = 255;
break;
if (joy_center_y > joy_range)
joy_center_y = half_joy_range;
break;
case PRM_JOY_OX:
joy_center_x = strtol(argument, 0, 0);
if (joy_center_x < 0)
{
joy_center_x = 0;
}
else
if (joy_center_x > 255)
{
joy_center_x = 255;
}
case PRM_JOY_PC_CALIBRATE:
if (joy_center_x > joy_range)
{
joy_center_x = half_joy_range;
}
break;
case PRM_JOY_OY:
joy_center_y = strtol(argument, 0, 0);
if (joy_center_y < 0)
{
joy_center_y = 0;
}
else
if (joy_center_y > 255)
{
joy_center_y = 255;
}
if (joy_center_y > joy_range)
{
joy_center_y = half_joy_range;
}
break;
case PRM_JOY_PC_CALIBRATE:
#ifdef PC_JOYSTICK
/* pc joystick parms generated by the calibration routine
(shouldn't need to hand tweak these) = origin_x origin_y max_x
min_x max_y min_y js_timelimit */
js_center_x = strtol (argument, &argument, 10);
js_center_y = strtol (argument, &argument, 10);
js_max_x = strtol (argument, &argument, 10);
if (js_max_x < 0)
js_max_x = 0;
js_min_x = strtol (argument, &argument, 10);
if (js_min_x < 0)
js_min_x = 0;
/* pc joystick parms generated by the calibration routine
(shouldn't need to hand tweak these) = origin_x origin_y max_x
min_x max_y min_y js_timelimit */
js_center_x = strtol(argument, &argument, 10);
js_center_y = strtol(argument, &argument, 10);
js_max_x = strtol(argument, &argument, 10);
if (js_max_x < 0)
{
js_max_x = 0;
}
js_max_y = strtol (argument, &argument, 10);
if (js_max_y < 0)
js_max_y = 0;
js_min_y = strtol (argument, &argument, 10);
if (js_min_y < 0)
js_min_y = 0;
js_min_x = strtol(argument, &argument, 10);
if (js_min_x < 0)
{
js_min_x = 0;
}
js_timelimit = strtol (argument, &argument, 10);
if (js_timelimit < 2)
js_timelimit = 2;
js_max_y = strtol(argument, &argument, 10);
if (js_max_y < 0)
{
js_max_y = 0;
}
c_open_joystick ();
c_calculate_joystick_parms (); /* calculate the associated parms */
js_min_y = strtol(argument, &argument, 10);
if (js_min_y < 0)
{
js_min_y = 0;
}
js_timelimit = strtol(argument, &argument, 10);
if (js_timelimit < 2)
{
js_timelimit = 2;
}
c_open_joystick();
c_calculate_joystick_parms(); /* calculate the associated parms */
#endif
case PRM_JOY_KYBD_SENSITIVITY:
joy_step = strtol (argument, 0, 0);
if (joy_step < 1)
joy_step = 1;
else if (joy_step > 100)
joy_step = 100;
break;
case PRM_JOY_KYBD_SENSITIVITY:
joy_step = strtol(argument, 0, 0);
if (joy_step < 1)
{
joy_step = 1;
}
else
if (joy_step > 100)
{
joy_step = 100;
}
case PRM_ROM_PATH:
strncpy (system_path, argument, SYSSIZE);
break;
}
}
fclose (config_file);
}
break;
case PRM_ROM_PATH:
strncpy(system_path, argument, SYSSIZE);
break;
}
}
fclose(config_file);
}
}
/* Save the configuration */
void
save_settings (void)
void
save_settings(void)
{
FILE *config_file;
FILE *config_file;
config_file = fopen (config_filename, "w");
if (config_file == NULL)
config_file = fopen(config_filename, "w");
if (config_file == NULL)
{
printf (
"Cannot open the .apple2 system defaults file for writing.\n"
"Make sure it has rw permission in your home directory.");
return;
printf(
"Cannot open the .apple2 system defaults file for writing.\n"
"Make sure it has rw permission in your home directory.");
return;
}
fprintf (config_file,
"speed = %d\n"
"mode = %s\n"
"disk path = %s\n"
"color = %s\n"
"sound = %s\n"
"joystick = %s\n"
"joystick range = %d\n"
"origin_x = %d\n"
"origin_y = %d\n"
"sensitivity = %d%%\n"
"system path = %s\n",
MAX_APPLE_DELAY + 1 - cpu65_delay,
reverse_match (modes_table, apple_mode),
disk_path,
reverse_match (color_table, color_mode),
reverse_match (sound_table, sound_mode),
reverse_match (joy_input_table, joy_mode),
joy_range,
joy_center_x,
joy_center_y,
joy_step,
system_path);
fprintf(config_file,
"speed = %d\n"
"mode = %s\n"
"disk path = %s\n"
"color = %s\n"
"sound = %s\n"
"joystick = %s\n"
"joystick range = %d\n"
"origin_x = %d\n"
"origin_y = %d\n"
"sensitivity = %d%%\n"
"system path = %s\n",
MAX_APPLE_DELAY + 1 - cpu65_delay,
reverse_match(modes_table, apple_mode),
disk_path,
reverse_match(color_table, color_mode),
reverse_match(sound_table, sound_mode),
reverse_match(joy_input_table, joy_mode),
joy_range,
joy_center_x,
joy_center_y,
joy_step,
system_path);
#ifdef PC_JOYSTICK
fprintf (config_file,
"pc joystick parms = %d %d %d %d %d %d %ld\n",
js_center_x, js_center_y, js_max_x, js_min_x,
js_max_y, js_min_y, js_timelimit);
fprintf(config_file,
"pc joystick parms = %d %d %d %d %d %d %ld\n",
js_center_x, js_center_y, js_max_x, js_min_x,
js_max_y, js_min_y, js_timelimit);
#endif
fclose (config_file);
fclose(config_file);
}

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Configuration defines
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,10 +7,10 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
@ -19,9 +19,9 @@
#ifndef __ASSEMBLER__
#define SYSSIZE 4096
#define SYSSIZE 4096
extern char system_path[SYSSIZE];
#define DISKSIZE 4096
#define DISKSIZE 4096
extern char disk_path[DISKSIZE];
extern int apple_mode; /* undocumented instructions or //e mode */

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux
*
* CPU Timing Support.
@ -7,7 +7,7 @@
* match a 1.02MHz Apple //e.
*
* Added 2013 by Aaron Culliney
*
*
*/
#include "timing.h"
@ -35,14 +35,17 @@ extern pthread_cond_t cond;
// -----------------------------------------------------------------------------
// assuming end > start, returns end - start
static inline struct timespec timespec_diff (struct timespec start, struct timespec end) {
static inline struct timespec timespec_diff(struct timespec start, struct timespec end) {
struct timespec t;
// assuming time_t is signed ...
if (end.tv_nsec < start.tv_nsec) {
if (end.tv_nsec < start.tv_nsec)
{
t.tv_sec = end.tv_sec - start.tv_sec - 1;
t.tv_nsec = NANOSECONDS + end.tv_nsec - start.tv_nsec;
} else {
}
else
{
t.tv_sec = end.tv_sec - start.tv_sec;
t.tv_nsec = end.tv_nsec - start.tv_nsec;
}
@ -50,20 +53,20 @@ static inline struct timespec timespec_diff (struct timespec start, struct times
return t;
}
static inline long timespec_nsecs (struct timespec t) {
static inline long timespec_nsecs(struct timespec t) {
return t.tv_sec*NANOSECONDS + t.tv_nsec;
}
void timing_initialize () {
void timing_initialize() {
clock_gettime(CLOCK_MONOTONIC, &t0);
ti=t0;
}
void timing_set_cpu_target_hz (unsigned long hz) {
void timing_set_cpu_target_hz(unsigned long hz) {
cpu_target_hz = hz;
}
void timing_set_sleep_hz (unsigned int hz) {
void timing_set_sleep_hz(unsigned int hz) {
sleep_hz = hz;
}
@ -73,12 +76,13 @@ void timing_set_sleep_hz (unsigned int hz) {
*
* This is called from cpu65_run() on the cpu-thread
*/
void timing_throttle () {
void timing_throttle() {
++cycle;
static time_t severe_lag=0;
if ((cycle%cycles_interval) == 0) {
if ((cycle%cycles_interval) == 0)
{
// wake render thread as we go to sleep
pthread_mutex_lock(&mutex);
@ -88,27 +92,32 @@ void timing_throttle () {
clock_gettime(CLOCK_MONOTONIC, &tj);
deltat = timespec_diff(ti, tj);
ti=tj;
if (deltat.tv_sec != 0) {
if (deltat.tv_sec != 0)
{
// severely lagging, don't bother sleeping ...
if (severe_lag < time(NULL)) {
if (severe_lag < time(NULL))
{
severe_lag = time(NULL)+2;
fprintf(stderr, "Severe lag detected...\n");
}
} else {
}
else
{
deltat.tv_nsec = processing_interval - deltat.tv_nsec + sleep_adjust_inc;
nanosleep(&deltat, NULL); // NOTE: spec says will return right away if deltat.tv_nsec value < 0 ...
ti.tv_nsec += deltat.tv_nsec;
}
if ((cycle%cpu_target_hz) == 0) {
if ((cycle%cpu_target_hz) == 0)
{
clock_gettime(CLOCK_MONOTONIC, &tj);
deltat = timespec_diff(t0, tj);
struct timespec t = (struct timespec){.tv_sec=1, .tv_nsec=0};
struct timespec t = (struct timespec) {.tv_sec=1, .tv_nsec=0 };
long adj = (deltat.tv_sec == 0)
? timespec_nsecs(timespec_diff(deltat, t))
: -1 * timespec_nsecs(timespec_diff(t, deltat));
? timespec_nsecs(timespec_diff(deltat, t))
: -1 * timespec_nsecs(timespec_diff(t, deltat));
sleep_adjust += adj;
sleep_adjust_inc = sleep_adjust/sleep_hz;

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux
*
* CPU Timing Support.
@ -7,7 +7,7 @@
* match a 1.02MHz Apple //e.
*
* Added 2013 by Aaron Culliney
*
*
*/
#ifndef _TIMING_H_
@ -16,12 +16,12 @@
#define APPLE2_HZ 1020000
#define NANOSECONDS 1000000000
void timing_set_cpu_target_hz (unsigned long hz);
void timing_set_cpu_target_hz(unsigned long hz);
void timing_set_sleep_hz (unsigned int hz);
void timing_set_sleep_hz(unsigned int hz);
void timing_initialize ();
void timing_initialize();
void timing_throttle ();
void timing_throttle();
#endif // whole file

View File

@ -1,4 +1,4 @@
/*
/*
* Apple // emulator for Linux: Video definitions
*
* Copyright 1994 Alexander Jean-Claude Bottema
@ -7,10 +7,10 @@
* Copyright 1998, 1999, 2000 Michael Deutschmann
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
@ -19,35 +19,35 @@
#ifndef __ASSEMBLER__
/* Prepare the video system, converting console to graphics mode, or
* opening X window, or whatever. This is called only once when the
/* Prepare the video system, converting console to graphics mode, or
* opening X window, or whatever. This is called only once when the
* emulator is run
*/
void video_init(void);
/* Undo anything done by video_init. This is called before exiting the
/* Undo anything done by video_init. This is called before exiting the
* emulator.
*/
void video_shutdown(void);
/* Setup the display. This may be called multiple times in a run, and is
/* Setup the display. This may be called multiple times in a run, and is
* used when graphics parameters (II+ vs //e, hires color representation) may
* have changed.
*
* In future, all relevant information will be communicated through
* FLAGS. For now, however, it is ignored and global variables are used
* In future, all relevant information will be communicated through
* FLAGS. For now, however, it is ignored and global variables are used
* instead.
*
* This function is responsible for inserting any needed video-specific hooks
* into the 6502 memory indirection table. It should *not* hook the
* soft-switches.
* This function is responsible for inserting any needed video-specific hooks
* into the 6502 memory indirection table. It should *not* hook the
* soft-switches.
*
*/
void video_set(int flags);
/* Set the font used by the display. QTY characters are loaded starting
* with FIRST, from DATA. DATA contains 8 bytes for each character, each
* byte representing a row (top-to-bottom). The row byte contains 7
/* Set the font used by the display. QTY characters are loaded starting
* with FIRST, from DATA. DATA contains 8 bytes for each character, each
* byte representing a row (top-to-bottom). The row byte contains 7
* pixels in little-endian format.
*
* MODE selects the colors to use
@ -57,16 +57,16 @@ void video_set(int flags);
* 2 - Inverse
* 3 - Flash
*
* The extra MouseText mode is in case we want to emulate certain RGB
* adaptors which color normal text and MouseText differently. I had one
* The extra MouseText mode is in case we want to emulate certain RGB
* adaptors which color normal text and MouseText differently. I had one
* once for a //c.
*/
void video_loadfont(int first,
int qty,
void video_loadfont(int first,
int qty,
const unsigned char *data,
int mode);
/* Redraw the display. This is called after exiting an interface display,
/* Redraw the display. This is called after exiting an interface display,
* when changes have been made to the Apple's emulated framebuffer that
* bypass the driver's hooks, or when the video mode has changed.
*/
@ -83,10 +83,10 @@ void video_setpage(int page);
*/
void video_loadfont_int(int first, int qty, const unsigned char *data);
/* Plot a character to the text mode screen, *not* writing to apple
/* Plot a character to the text mode screen, *not* writing to apple
* memory. This is used by the interface screens.
*
* ROW, COL, and CODE are self-expanatory. COLOR gives the color scheme
* ROW, COL, and CODE are self-expanatory. COLOR gives the color scheme
* to use:
*
* 0 - Green text on Black background
@ -95,11 +95,11 @@ void video_loadfont_int(int first, int qty, const unsigned char *data);
*/
void video_plotchar(int row, int col, int color, unsigned char code);
/* Called at about 30Hz (this may change in future), and when waiting in
* the interface screens.
*
* Should flush any video data to the real screen (if any kind of caching
* is in use), check for keyboard input (presently reported via
/* Called at about 30Hz (this may change in future), and when waiting in
* the interface screens.
*
* Should flush any video data to the real screen (if any kind of caching
* is in use), check for keyboard input (presently reported via
* c_read_raw_key), and handle flashing text characters.
*/
void video_sync(int block);
@ -123,40 +123,40 @@ void video_sync(int block);
#define SCANSTEP SCANWIDTH-6
#endif /* !_640x400 */
#define COLOR_BLACK 0
#define COLOR_BLACK 0
#define COLOR_DARK_RED 35
#define COLOR_MEDIUM_RED 36
#define COLOR_LIGHT_RED 37 /* hgr used */
#define COLOR_DARK_RED 35
#define COLOR_MEDIUM_RED 36
#define COLOR_LIGHT_RED 37 /* hgr used */
#define COLOR_DARK_GREEN 38
#define COLOR_MEDIUM_GREEN 39
#define COLOR_LIGHT_GREEN 40 /* hgr used */
#define COLOR_DARK_GREEN 38
#define COLOR_MEDIUM_GREEN 39
#define COLOR_LIGHT_GREEN 40 /* hgr used */
#define COLOR_DARK_YELLOW 41
#define COLOR_MEDIUM_YELLOW 42
#define COLOR_LIGHT_YELLOW 43
#define COLOR_DARK_YELLOW 41
#define COLOR_MEDIUM_YELLOW 42
#define COLOR_LIGHT_YELLOW 43
#define COLOR_DARK_BLUE 44
#define COLOR_MEDIUM_BLUE 45
#define COLOR_LIGHT_BLUE 46 /* hgr used */
#define COLOR_DARK_BLUE 44
#define COLOR_MEDIUM_BLUE 45
#define COLOR_LIGHT_BLUE 46 /* hgr used */
#define COLOR_DARK_PURPLE 47
#define COLOR_MEDIUM_PURPLE 48
#define COLOR_LIGHT_PURPLE 49 /* hgr used */
#define COLOR_DARK_PURPLE 47
#define COLOR_MEDIUM_PURPLE 48
#define COLOR_LIGHT_PURPLE 49 /* hgr used */
#define COLOR_DARK_CYAN 50
#define COLOR_MEDIUM_CYAN 51
#define COLOR_LIGHT_CYAN 52
#define COLOR_DARK_CYAN 50
#define COLOR_MEDIUM_CYAN 51
#define COLOR_LIGHT_CYAN 52
#define COLOR_DARK_WHITE 53
#define COLOR_MEDIUM_WHITE 54
#define COLOR_LIGHT_WHITE 55
#define COLOR_DARK_WHITE 53
#define COLOR_MEDIUM_WHITE 54
#define COLOR_LIGHT_WHITE 55
#define COLOR_FLASHING_BLACK 56
#define COLOR_FLASHING_WHITE 57
#define COLOR_FLASHING_UNGREEN 58
#define COLOR_FLASHING_GREEN 59
#define COLOR_FLASHING_BLACK 56
#define COLOR_FLASHING_WHITE 57
#define COLOR_FLASHING_UNGREEN 58
#define COLOR_FLASHING_GREEN 59
#ifndef __ASSEMBLER__
@ -164,67 +164,67 @@ void video_sync(int block);
generic graphics globals
---------------------------------- */
/* Pointers to framebuffer (can be VGA memory or host buffer)
/* Pointers to framebuffer (can be VGA memory or host buffer)
*/
extern unsigned char *video__fb1,*video__fb2;
extern unsigned char *video__fb1,*video__fb2;
#ifdef _640x400
extern unsigned char video__wider_hires_even[0x1000];
extern unsigned char video__wider_hires_odd[0x1000];
extern unsigned char video__wider_hires_even[0x1000];
extern unsigned char video__wider_hires_odd[0x1000];
#endif /* _640x400 */
extern unsigned char video__hires_even[0x800];
extern unsigned char video__hires_odd[0x800];
extern unsigned char video__hires_even[0x800];
extern unsigned char video__hires_odd[0x800];
extern unsigned char video__dhires1[256];
extern unsigned char video__dhires2[256];
extern unsigned char video__dhires1[256];
extern unsigned char video__dhires2[256];
extern int video__current_page; /* Current visual page */
extern int video__current_page; /* Current visual page */
extern int video__strictcolors;
#ifdef _640x400
extern unsigned char video__wider_int_font[3][0x8000];
extern unsigned char video__wider_int_font[3][0x8000];
#else /* _640x400 */
extern unsigned char video__int_font[3][0x4000];
extern unsigned char video__int_font[3][0x4000];
#endif /* _640x400 */
/* --- Precalculated hi-res page offsets given addr --- */
extern unsigned int video__screen_addresses[8192];
extern unsigned char video__columns[8192];
extern unsigned int video__screen_addresses[8192];
extern unsigned char video__columns[8192];
extern unsigned char video__odd_colors[2];
extern unsigned char video__even_colors[2];
extern unsigned char video__odd_colors[2];
extern unsigned char video__even_colors[2];
/* Hooks */
void video__write_text0(),
video__write_text0_mixed(),
video__write_text1(),
video__write_text1_mixed(),
video__write_even0(),
video__write_odd0(),
video__write_even0_mixed(),
video__write_odd0_mixed(),
video__write_even1(),
video__write_odd1(),
video__write_even1_mixed(),
video__write_odd1_mixed();
void video__write_text0(),
video__write_text0_mixed(),
video__write_text1(),
video__write_text1_mixed(),
video__write_even0(),
video__write_odd0(),
video__write_even0_mixed(),
video__write_odd0_mixed(),
video__write_even1(),
video__write_odd1(),
video__write_even1_mixed(),
video__write_odd1_mixed();
#ifdef APPLE_IIE
void video__write_2e_text0(),
video__write_2e_text0_mixed(),
video__write_2e_text1(),
video__write_2e_text1_mixed(),
video__write_2e_odd0(),
video__write_2e_even0(),
video__write_2e_odd0_mixed(),
video__write_2e_even0_mixed(),
video__write_2e_odd1(),
video__write_2e_even1(),
video__write_2e_odd1_mixed(),
video__write_2e_even1_mixed();
#ifdef APPLE_IIE
void video__write_2e_text0(),
video__write_2e_text0_mixed(),
video__write_2e_text1(),
video__write_2e_text1_mixed(),
video__write_2e_odd0(),
video__write_2e_even0(),
video__write_2e_odd0_mixed(),
video__write_2e_even0_mixed(),
video__write_2e_odd1(),
video__write_2e_even1(),
video__write_2e_odd1_mixed(),
video__write_2e_even1_mixed();
#endif /* APPLE_IIE */
#endif /* !__ASSEMBLER__ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff