get it compiling again

This commit is contained in:
Aaron Culliney 2013-06-19 00:07:41 -07:00
parent 6eef91baf7
commit bfa84b1f65
14 changed files with 64 additions and 41 deletions

View File

@ -103,7 +103,9 @@ void pre_compact(void)
};
unlink(filename);
ftruncate(compaction_file,TSIZE); /* might not be 100% portable */
if (ftruncate(compaction_file,TSIZE) == -1) { /* might not be 100% portable */
// ERROR ...
}
/* If the ftruncate doesn't work (Single Unix does not require it
* to work for the extending case), try this instead:
@ -159,6 +161,9 @@ void compact(void)
MAP_FIXED|MAP_FILE|MAP_SHARED,
compaction_file,
j*PSIZE);
if (x == MAP_FAILED) {
// ERROR
}
if (work == MAP_FAILED)
{

View File

@ -15,6 +15,7 @@
*/
#include <string.h>
#include <stdlib.h>
#include "cpu.h"

View File

@ -486,7 +486,7 @@ ADDRS [0-9a-fA-F]+
/* step until PC == next instruction. good for finishing backward
loops */
unsigned char op;
int delta;
int delta=0;
op = get_current_opcode();
switch (opcodes[op].mode)

View File

@ -38,7 +38,7 @@ int breakpoints[MAX_BRKPTS]; /* memory breakpoints */
int watchpoints[MAX_BRKPTS]; /* memory watchpoints */
/* debugger globals */
static unsigned char screen[SCREEN_Y][SCREEN_X] =
static char screen[SCREEN_Y][SCREEN_X] =
{ "||||||||||||||||||||||||||||||||||||||||",
"| |",
"| |",
@ -361,7 +361,7 @@ void bload(FILE *f, char *name, int addrs) {
}
while ((len = fread(temp, 1, TEMPSIZE, f))) {
hexstr = temp;
hexstr = (unsigned char*)temp;
for (; len > 0; len--) {
data = *hexstr;
@ -1029,7 +1029,7 @@ void do_debug_command() {
for (i = 0, j = 0; i < PROMPT_Y - num_buffer_lines; i++, j = 0) {
memcpy(command_buf[i], command_buf[num_buffer_lines+1+i], BUF_X);
while ((j < BUF_X) && (command_buf[i][j] != '\0')) j++;
memset (command_buf[i] + j, ' ', BUF_X - j);
memset (command_buf[i] + j, ' ', BUF_X - j - 1);
command_buf[i][BUF_X - 1] = '\0';
}
}
@ -1040,7 +1040,7 @@ void do_debug_command() {
j = 0;
memcpy(command_buf[i], second_buf[k++], BUF_X);
while ((j < BUF_X) && (command_buf[i][j] != '\0')) ++j;
memset(command_buf[i] + j, ' ', BUF_X - j);
memset(command_buf[i] + j, ' ', BUF_X - j - 1);
command_buf[i++][BUF_X - 1] = '\0';
}

View File

@ -16,6 +16,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
@ -137,6 +138,7 @@ int c_new_diskette_6(int drive, char *file_name, int cmpr, int nib, int force) {
struct stat buf;
strcpy(disk6.disk[drive].file_name, file_name);
disk6.disk[drive].file_name[1023]='\0';
disk6.disk[drive].compressed = cmpr;
disk6.disk[drive].nibblized = nib;
if (disk6.disk[drive].fp) {
@ -193,7 +195,8 @@ unsigned char c_read_nibblized_6_6()
fseek(disk6.disk[disk6.drive].fp, PHASE_BYTES * disk6.disk[disk6.drive].phase, SEEK_SET);
disk6.disk[disk6.drive].phase_change = 0;
}
ch = (unsigned char) disk6.disk_byte = fgetc(disk6.disk[disk6.drive].fp);
disk6.disk_byte = fgetc(disk6.disk[disk6.drive].fp);
ch = disk6.disk_byte;
/* track revolves... */
if (ftell(disk6.disk[disk6.drive].fp) == (PHASE_BYTES * (disk6.disk[disk6.drive].phase + 2)))
fseek(disk6.disk[disk6.drive].fp, -2 * PHASE_BYTES, SEEK_CUR);
@ -309,7 +312,9 @@ unsigned char c_read_normal_6()
fseek( disk6.disk[disk6.drive].fp, disk6.disk[disk6.drive].file_pos, SEEK_SET );
/* Read sector */
fread( disk6.disk_data, 1, 256, disk6.disk[disk6.drive].fp );
if (fread( disk6.disk_data, 1, 256, disk6.disk[disk6.drive].fp ) != 256) {
// error
}
disk6.disk_data[ 256 ] = disk6.disk_data[ 257 ] = 0;
value = 0xAD;
break;
@ -629,7 +634,9 @@ void disk_install(int slot)
printf("Cannot find file '%s'.\n",temp);
exit( 0 );
}
fread(slot6_rom, 0x100, 1, f);
if (fread(slot6_rom, 0x100, 1, f) != 0x100) {
// error
}
fclose(f);
slot6_rom_loaded = 1;
}

View File

@ -19,7 +19,7 @@
struct diskette
{
unsigned char file_name[1024];
char file_name[1024];
int compressed;
int nibblized;
int protected;
@ -50,6 +50,7 @@ extern struct drive disk6;
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(),

View File

@ -42,7 +42,7 @@ int main(void)
char *line = 0;
size_t line_size = 0;
int i,mx;
int i,mx=0;
printf("/* Apple II text font data\n"
" * \n"
@ -80,7 +80,9 @@ int main(void)
{
int k;
getline(&line,&line_size,stdin);
if (getline(&line,&line_size,stdin) == -1) {
// ERROR ...
}
k = 8;
byte = 0;
while (k--)

View File

@ -94,7 +94,7 @@ void c_load_interface_font()
/* -------------------------------------------------------------------------
c_interface_print()
------------------------------------------------------------------------- */
void c_interface_print( int x, int y, int cs, unsigned char *s )
void c_interface_print( int x, int y, int cs, char *s )
{
int i;
@ -137,7 +137,7 @@ void c_interface_redo_diskette_bottom() {
#define IsGraphic(c) ((c) == '|' || ((c) >= 0x80 && (c) <= 0x8A))
#define IsInside(x,y) ((x) >= 0 && (x) <= 39 && (y) >= 0 && (y) <= 23)
void c_interface_translate_screen( unsigned char screen[24][41] )
void c_interface_translate_screen( char screen[24][41] )
{
static char map[11][3][4] ={ { "...",
".||",
@ -286,8 +286,8 @@ int c_interface_disk_select(const struct dirent *e)
const char *p;
strncpy( cmp, disk_path, DISKSIZE );
strncat( cmp, "/", DISKSIZE );
strncat( cmp, e -> d_name, DISKSIZE );
strncat( cmp, "/", DISKSIZE-1 );
strncat( cmp, e -> d_name, DISKSIZE-1 );
/* don't show disk in alternate drive */
if (!strcmp(cmp, disk6.disk[altdrive].file_name))
@ -332,7 +332,7 @@ void c_interface_exit()
void c_interface_select_diskette( int drive )
{
static unsigned char screen[24][41] =
static char screen[24][41] =
{ "||||||||||||||||||||||||||||||||||||||||",
"| Insert diskette into Drive _, Slot 6 |",
"||||||||||||||||||||||||||||||||||||||||",
@ -416,13 +416,13 @@ void c_interface_select_diskette( int drive )
snprintf(temp, TEMPSIZE, " %s",
namelist[ ent_no ] -> d_name );
if (c_interface_cut_name(temp)) {
strncat(temp, " <gz>", TEMPSIZE);
strncat(temp, " <gz>", TEMPSIZE-1);
}
/* write protected disk in drive? */
else if ((in_drive) && (disk6.disk[drive].protected))
strncat(temp, (drive == 0) ? " <r1>" : " <r2>", TEMPSIZE);
strncat(temp, (drive == 0) ? " <r1>" : " <r2>", TEMPSIZE-1);
else if (in_drive)
strncat(temp, (drive == 0) ? " <rw1>" : " <rw2>", TEMPSIZE);
strncat(temp, (drive == 0) ? " <rw1>" : " <rw2>", TEMPSIZE-1);
}
slen = strlen( temp );
@ -659,7 +659,7 @@ void c_interface_select_diskette( int drive )
void c_interface_parameters()
{
static unsigned char screen[24][41] =
static char screen[24][41] =
{ "||||||||||||||||||||||||||||||||||||||||",
"| Apple II Emulator for Linux |",
"| Originally by |",
@ -1107,7 +1107,7 @@ void c_interface_parameters()
void c_interface_words()
{
static unsigned char screen[24][41] =
static char screen[24][41] =
{ "||||||||||||||||||||||||||||||||||||||||",
"| Apple II+ Emulator Version 0.01 |",
"||||||||||||||||||||||||||||||||||||||||",
@ -1153,7 +1153,7 @@ void c_interface_words()
void c_interface_keyboard_layout()
{
static unsigned char screen1[24][41] =
static char screen1[24][41] =
{ "||||||||||||||||||||||||||||||||||||||||",
"| Apple II+ US Keyboard Layout |",
"||||||||||||||||||||||||||||||||||||||||",
@ -1180,7 +1180,7 @@ void c_interface_keyboard_layout()
"||||||||||||||||||||||||||||||||||||||||" };
#ifdef APPLE_IIE
static unsigned char screen2[24][41] =
static char screen2[24][41] =
{ "||||||||||||||||||||||||||||||||||||||||",
"| Apple //e US Keyboard Layout |",
"||||||||||||||||||||||||||||||||||||||||",

View File

@ -17,12 +17,12 @@
#ifndef A2_INTERFACE_H
#define A2_INTERFACE_H
void c_interface_print( int x, int y, int cs, unsigned char *s );
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(unsigned char screen[24][41]);
void c_interface_translate_screen(char screen[24][41]);
void c_interface_select_diskette(int);
#endif

View File

@ -309,7 +309,9 @@ void c_periodic_update(int dummysig) {
}
#ifdef PC_JOYSTICK
else if ((joy_mode == JOY_PCJOY) && !(js_fd < 0)) {
read(js_fd, &js, JS_RETURN);
if (read(js_fd, &js, JS_RETURN) == -1) {
// error
}
x_val = (js.x < js_center_x)
? (js.x - js_offset_x) * js_adjustlow_x

View File

@ -18,10 +18,10 @@
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/io.h>
#include "misc.h"
#include "video.h"
@ -497,7 +497,7 @@ void c_initialize_tables() {
#endif
video_set(0); /* must be done here, between pre_compact & compact */
disk_install(6); /* Put a Disk ][ Controller in slot 6 */
compact(); /* Compress memory so that identical pages share storage */
@ -534,7 +534,9 @@ void c_initialize_apple_ii_memory()
printf("Cannot find file '%s'.\n",temp);
exit(0);
}
fread(apple_ii_rom, 0x3000, 1, f);
if (fread(apple_ii_rom, 0x3000, 1, f) != 0x3000) {
// ERROR ...
}
fclose(f);
ii_rom_loaded = 1;
}
@ -546,7 +548,9 @@ void c_initialize_apple_ii_memory()
printf("Cannot find file '%s'.\n",temp);
exit(0);
}
fread(apple_iie_rom, 32768, 1, f);
if (fread(apple_iie_rom, 32768, 1, f) != 32768) {
// ERROR ...
}
fclose(f);
iie_rom_loaded = 1;
}

View File

@ -62,7 +62,7 @@ int argc;
/* misc arrays */
#define TEMPSIZE 4096
unsigned char temp[ TEMPSIZE ];/* should be >=4096 (stuff depends on this) */
char temp[ TEMPSIZE ];/* should be >=4096 (stuff depends on this) */
#ifdef APPLE_IIE
/* memory offsets from softswitches */

View File

@ -438,7 +438,7 @@ static void c_initialize_row_col_tables(void)
/* hires page offsets. initialize to invalid values. */
for (i = 0; i < 8192; i++) {
(long)(video__screen_addresses[i]) = -1;
video__screen_addresses[i] = -1;
}
for (y = 0; y < 24; y++) {

View File

@ -26,6 +26,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XShm.h>/* MITSHM! */
@ -209,7 +210,7 @@ static void getshm(int size) {
/* attach to the shared memory segment */
image->data = xshminfo.shmaddr = shmat(id, 0, 0);
if (image->data == -1) {
if ((int)(image->data) == -1) {
perror("shmat");
printf("Could not attach to shared memory\n");
exit(1);
@ -353,7 +354,7 @@ static void c_initialize_colors() {
static int keysym_to_scancode(void) {
static int rc = 0xFF;
switch(rc = XKeycodeToKeysym(display, xevent.xkey.keycode, 0))
switch(rc = XkbKeycodeToKeysym(display, xevent.xkey.keycode, 0, 0))
{
case XK_F1:
rc = 59; break;
@ -588,7 +589,7 @@ void video_init() {
unsigned long attribmask;
int x, y; /* window position */
int drawingok;
unsigned int display_width, display_height;
//unsigned int display_width, display_height;
XGCValues xgcvalues;
int valuemask;
char *window_name = "Apple ][";
@ -597,7 +598,7 @@ void video_init() {
XWMHints *wm_hints;
XClassHint *class_hints;
XTextProperty windowName, iconName;
GC gc;
//GC gc;
char *progname;/* name this program was invoked by */
char *displayname = NULL;
@ -640,8 +641,8 @@ void video_init() {
exit(1);
}
visual = visualinfo.visual;
display_width = DisplayWidth(display, screen_num);
display_height = DisplayHeight(display, screen_num);
//display_width = DisplayWidth(display, screen_num);
//display_height = DisplayHeight(display, screen_num);
/* Note that in a real application, x and y would default to 0
* but would be settable from the command line or resource database.
@ -747,7 +748,7 @@ void video_init() {
/* create the GC */
valuemask = GCGraphicsExposures;
xgcvalues.graphics_exposures = False;
gc = XCreateGC(
/*gc = */XCreateGC(
display,
win,
valuemask,
@ -822,7 +823,7 @@ void video_init() {
}
svga_GM = video__fb1 = image->data;
svga_GM = video__fb1 = (unsigned char*)image->data;
video__fb2 = vga_mem_page_1;
memset(video__fb1,0,SCANWIDTH*SCANHEIGHT);