mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-06-26 00:29:27 +00:00
Updates to support testing
This commit is contained in:
parent
6864dbe3fc
commit
17440949bf
|
@ -30,7 +30,7 @@
|
|||
#define DebugCurrByte SN(cpu65_debug)+2
|
||||
#define DebugCurrRW SN(cpu65_debug)+3
|
||||
#define DebugCurrOpcode SN(cpu65_debug)+4
|
||||
#define DebugCycleCount SN(cpu65_debug)+5 // TODO FIXME : need a better name here and possibly in the .h file too (reflecting the fact that this is an xtra cycles counter
|
||||
#define DebugCycleCount SN(cpu65_debug)+5
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
CPU (6502) Helper Routines
|
||||
|
@ -57,6 +57,7 @@
|
|||
GetFromPC_B \
|
||||
movb %al, DebugCurrOpcode; \
|
||||
movb $0, DebugCycleCount; \
|
||||
movb $0, DebugCurrRW; \
|
||||
jmp *cpu65__opcodes(,%eax,4);
|
||||
|
||||
#define GetFromEA_B \
|
||||
|
@ -75,7 +76,7 @@
|
|||
|
||||
#define PutToEA_B \
|
||||
orb $2, DebugCurrRW; \
|
||||
orb %al, DebugCurrByte; \
|
||||
movb %al, DebugCurrByte; \
|
||||
call *SN(cpu65_vmem)+4 \
|
||||
(,EffectiveAddr_E,8);
|
||||
#define GetFromMem_B(x) \
|
||||
|
@ -2692,10 +2693,11 @@ continue:
|
|||
movb DebugCurrOpcode, %al
|
||||
movb SN(cpu65__opcycles)(,%eax,1), %al
|
||||
addb DebugCycleCount, %al
|
||||
addw %ax, SN(cpu65_cycle_count) // TODO: cycle counting is slightly incorrect, it should be done earlier per instruction ...
|
||||
movb %al, DebugCycleCount
|
||||
addw %ax, SN(cpu65_cycle_count)
|
||||
subl %eax, SN(gc_cycles_timer_0)
|
||||
subl %eax, SN(gc_cycles_timer_1)
|
||||
subw %ax, SN(cpu65_cycles_to_execute) // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ orly?
|
||||
subw %ax, SN(cpu65_cycles_to_execute)
|
||||
jle exit_cpu65_run
|
||||
xorl %eax, %eax
|
||||
orb SN(cpu65__signal), %al
|
||||
|
|
29
src/misc.c
29
src/misc.c
|
@ -105,7 +105,6 @@ void c_initialize_font()
|
|||
video_loadfont(0x80,0x40,ucase_glyphs,0);
|
||||
video_loadfont(0xC0,0x20,ucase_glyphs,0);
|
||||
video_loadfont(0xE0,0x20,lcase_glyphs,0);
|
||||
|
||||
video_redraw();
|
||||
}
|
||||
|
||||
|
@ -533,19 +532,17 @@ void c_initialize_apple_ii_memory()
|
|||
if (!ii_rom_loaded)
|
||||
{
|
||||
snprintf(temp, TEMPSIZE, "%s/apple_II.rom", system_path);
|
||||
if ((f = fopen(temp, "r")) == NULL)
|
||||
{
|
||||
if ((f = fopen(temp, "r")) == NULL) {
|
||||
printf("OOPS!\n");
|
||||
printf("Cannot find file '%s'.\n",temp);
|
||||
exit(0);
|
||||
//exit(0);
|
||||
} else {
|
||||
if (fread(apple_ii_rom, 0x3000, 1, f) != 0x3000)
|
||||
{
|
||||
// ERROR ...
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
if (fread(apple_ii_rom, 0x3000, 1, f) != 0x3000)
|
||||
{
|
||||
// ERROR ...
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
ii_rom_loaded = 1;
|
||||
}
|
||||
|
||||
|
@ -678,12 +675,7 @@ void c_initialize_vm() {
|
|||
c_initialize_tables(); /* read/write memory jump tables */
|
||||
c_initialize_sound_hooks(); /* sound system */
|
||||
c_init_6(); /* drive ][, slot 6 */
|
||||
|
||||
c_initialize_iie_switches(); /* set the //e softswitches */
|
||||
|
||||
#ifdef MOUSE_EMULATION
|
||||
c_initialize_mouse();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
|
@ -736,7 +728,7 @@ void reinitialize(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void c_initialize_firsttime()
|
||||
void c_initialize_firsttime()
|
||||
{
|
||||
/* read in system files and calculate system defaults */
|
||||
c_load_interface_font();
|
||||
|
@ -808,6 +800,7 @@ void c_read_random() {
|
|||
random_value = (unsigned char)random();
|
||||
}
|
||||
|
||||
#if !defined(TESTING)
|
||||
static void main_thread(void *dummyptr) {
|
||||
struct timespec sleeptime = { .tv_sec=0, .tv_nsec=8333333 }; // 120Hz
|
||||
|
||||
|
@ -836,3 +829,5 @@ int main(int sargc, char *sargv[])
|
|||
// continue with main render thread
|
||||
main_thread(NULL);
|
||||
}
|
||||
#endif // TESTING
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@ extern int32_t softswitches;
|
|||
misc.c functions
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void c_initialize_firsttime();
|
||||
void c_initialize_sound_hooks();
|
||||
void c_disable_sound_hooks();
|
||||
void c_initialize_font();
|
||||
|
|
|
@ -171,18 +171,18 @@ void video_set_mode(a2_video_mode_t mode);
|
|||
/* Pointers to framebuffer (can be VGA memory or host buffer)
|
||||
*/
|
||||
|
||||
extern unsigned char *video__fb1,*video__fb2;
|
||||
extern uint8_t *video__fb1,*video__fb2;
|
||||
|
||||
#ifdef _640x400
|
||||
extern unsigned char video__wider_hires_even[0x1000];
|
||||
extern unsigned char video__wider_hires_odd[0x1000];
|
||||
extern uint8_t video__wider_hires_even[0x1000];
|
||||
extern uint8_t video__wider_hires_odd[0x1000];
|
||||
#endif /* _640x400 */
|
||||
|
||||
extern unsigned char video__hires_even[0x800];
|
||||
extern unsigned char video__hires_odd[0x800];
|
||||
extern uint8_t video__hires_even[0x800];
|
||||
extern uint8_t video__hires_odd[0x800];
|
||||
|
||||
extern unsigned char video__dhires1[256];
|
||||
extern unsigned char video__dhires2[256];
|
||||
extern uint8_t video__dhires1[256];
|
||||
extern uint8_t video__dhires2[256];
|
||||
|
||||
extern int video__current_page; /* Current visual page */
|
||||
|
||||
|
@ -190,10 +190,10 @@ extern int video__strictcolors;
|
|||
|
||||
/* --- Precalculated hi-res page offsets given addr --- */
|
||||
extern unsigned int video__screen_addresses[8192];
|
||||
extern unsigned char video__columns[8192];
|
||||
extern uint8_t video__columns[8192];
|
||||
|
||||
extern unsigned char video__odd_colors[2];
|
||||
extern unsigned char video__even_colors[2];
|
||||
extern uint8_t video__odd_colors[2];
|
||||
extern uint8_t video__even_colors[2];
|
||||
|
||||
/* Hooks */
|
||||
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
#include <X11/extensions/XShm.h> /* MITSHM! */
|
||||
#endif
|
||||
|
||||
static unsigned char vga_mem_page_0[SCANWIDTH*SCANHEIGHT]; /* page0 framebuffer */
|
||||
static unsigned char vga_mem_page_1[SCANWIDTH*SCANHEIGHT]; /* page1 framebuffer */
|
||||
|
||||
static Display *display;
|
||||
static Window win;
|
||||
static GC gc;
|
||||
|
@ -795,7 +792,7 @@ void video_set_mode(a2_video_mode_t mode) {
|
|||
_size_hints_set_fixed();
|
||||
}
|
||||
|
||||
void video_init() {
|
||||
void _video_init() {
|
||||
XSetWindowAttributes attribs;
|
||||
unsigned long attribmask;
|
||||
int x, y; /* window position */
|
||||
|
@ -809,11 +806,12 @@ void video_init() {
|
|||
char *progname; /* name this program was invoked by */
|
||||
char *displayname = NULL;
|
||||
|
||||
progname = argv[0];
|
||||
if (argv == NULL) {
|
||||
LOG("No command line arguments, won't initialize xvideo ...");
|
||||
return;
|
||||
}
|
||||
|
||||
/* give up root privileges. equivalent of vga_init() */
|
||||
//setegid(getgid());
|
||||
//seteuid(getuid());
|
||||
progname = argv[0];
|
||||
|
||||
parseArgs();
|
||||
|
||||
|
@ -1021,13 +1019,6 @@ void video_init() {
|
|||
|
||||
_create_image();
|
||||
|
||||
video__fb1 = vga_mem_page_0;
|
||||
video__fb2 = vga_mem_page_1;
|
||||
|
||||
// reset Apple2 softframebuffers
|
||||
memset(video__fb1,0,SCANWIDTH*SCANHEIGHT);
|
||||
memset(video__fb2,0,SCANWIDTH*SCANHEIGHT);
|
||||
|
||||
#ifdef KEYPAD_JOYSTICK
|
||||
int autorepeat_supported = 0;
|
||||
XkbGetDetectableAutoRepeat(display, &autorepeat_supported);
|
||||
|
|
49
src/vidsup.c
49
src/vidsup.c
|
@ -16,30 +16,33 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
static uint8_t vga_mem_page_0[SCANWIDTH*SCANHEIGHT]; /* page0 framebuffer */
|
||||
static uint8_t vga_mem_page_1[SCANWIDTH*SCANHEIGHT]; /* page1 framebuffer */
|
||||
|
||||
#ifdef _640x400
|
||||
unsigned char video__wider_font[0x8000];
|
||||
uint8_t video__wider_font[0x8000];
|
||||
#endif /* _640x400 */
|
||||
|
||||
unsigned char video__font[0x4000];
|
||||
uint8_t video__font[0x4000];
|
||||
|
||||
/* --- Precalculated hi-res page offsets given addr --- */
|
||||
unsigned int video__screen_addresses[8192];
|
||||
unsigned char video__columns[8192];
|
||||
uint8_t video__columns[8192];
|
||||
|
||||
unsigned char *video__fb1,*video__fb2;
|
||||
uint8_t *video__fb1,*video__fb2;
|
||||
|
||||
#ifdef _640x400
|
||||
unsigned char video__wider_hires_even[0x1000];
|
||||
unsigned char video__wider_hires_odd[0x1000];
|
||||
uint8_t video__wider_hires_even[0x1000];
|
||||
uint8_t video__wider_hires_odd[0x1000];
|
||||
#endif
|
||||
unsigned char video__hires_even[0x800];
|
||||
unsigned char video__hires_odd[0x800];
|
||||
uint8_t video__hires_even[0x800];
|
||||
uint8_t video__hires_odd[0x800];
|
||||
|
||||
unsigned char video__dhires1[256];
|
||||
unsigned char video__dhires2[256];
|
||||
uint8_t video__dhires1[256];
|
||||
uint8_t video__dhires2[256];
|
||||
|
||||
// Interface font
|
||||
static unsigned char video__int_font[3][0x4000];
|
||||
static uint8_t video__int_font[3][0x4000];
|
||||
|
||||
int video__current_page; /* Current visual page */
|
||||
|
||||
|
@ -83,8 +86,8 @@ void video_loadfont(int first,
|
|||
}
|
||||
}
|
||||
|
||||
unsigned char video__odd_colors[2] = { COLOR_LIGHT_PURPLE, COLOR_LIGHT_BLUE };
|
||||
unsigned char video__even_colors[2] = { COLOR_LIGHT_GREEN, COLOR_LIGHT_RED };
|
||||
uint8_t video__odd_colors[2] = { COLOR_LIGHT_PURPLE, COLOR_LIGHT_BLUE };
|
||||
uint8_t video__even_colors[2] = { COLOR_LIGHT_GREEN, COLOR_LIGHT_RED };
|
||||
|
||||
/* 40col/80col/lores/hires/dhires line offsets */
|
||||
unsigned short video__line_offset[24] =
|
||||
|
@ -92,7 +95,7 @@ unsigned short video__line_offset[24] =
|
|||
0x028, 0x0A8, 0x128, 0x1A8, 0x228, 0x2A8, 0x328, 0x3A8,
|
||||
0x050, 0x0D0, 0x150, 0x1D0, 0x250, 0x2D0, 0x350, 0x3D0 };
|
||||
|
||||
unsigned char video__dhires1[256] = {
|
||||
uint8_t video__dhires1[256] = {
|
||||
0x0,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0xa,0xb,0xc,0xd,0xe,0xf,
|
||||
0x0,0x1,0x3,0x3,0x5,0x5,0x7,0x7,0x9,0x9,0xb,0xb,0xd,0xd,0xf,0xf,
|
||||
0x0,0x1,0x2,0x3,0x6,0x5,0x6,0x7,0xa,0x9,0xa,0xb,0xe,0xd,0xe,0xf,
|
||||
|
@ -103,7 +106,7 @@ unsigned char video__dhires1[256] = {
|
|||
0x0,0x1,0x7,0x3,0x7,0x5,0x7,0x7,0xf,0x9,0xb,0xb,0xf,0xd,0xf,0xf,
|
||||
};
|
||||
|
||||
unsigned char video__dhires2[256] = {
|
||||
uint8_t video__dhires2[256] = {
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x8,0x0,0xb,0x8,0xd,0x0,0x0,
|
||||
0x1,0x1,0x1,0x1,0x0,0x5,0x1,0x1,0x0,0x9,0xb,0xb,0x0,0xd,0xf,0xf,
|
||||
0x0,0x1,0x2,0x2,0x2,0x5,0x2,0x2,0x0,0xa,0xa,0xa,0xe,0xd,0x2,0x2,
|
||||
|
@ -518,7 +521,7 @@ static void c_initialize_row_col_tables(void)
|
|||
(y*8 + off + 4) * 320 + x*7 + 20;
|
||||
#endif
|
||||
video__columns[video__line_offset[y] + 0x400*off + x] =
|
||||
(unsigned char)x;
|
||||
(uint8_t)x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -695,3 +698,17 @@ void video_plotchar( int x, int y, int scheme, unsigned char c )
|
|||
c_interface_print_char80_line(&d,&s);
|
||||
c_interface_print_char80_line(&d,&s);
|
||||
}
|
||||
|
||||
extern void _video_init();
|
||||
void video_init() {
|
||||
|
||||
video__fb1 = vga_mem_page_0;
|
||||
video__fb2 = vga_mem_page_1;
|
||||
|
||||
// reset Apple2 softframebuffers
|
||||
memset(video__fb1,0,SCANWIDTH*SCANHEIGHT);
|
||||
memset(video__fb2,0,SCANWIDTH*SCANHEIGHT);
|
||||
|
||||
_video_init();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user