# Unified Makefile for Apple 2 SDL
#
# by James Hammons
-# (C) 2005 Underground Software
+# (C) 2005-17 Underground Software
# This software is licensed under the GPL v3
#
obj/font14pt.o \
obj/gui.o \
\
- obj/apple2-icon-64x64.o \
+ obj/apple2-icon-64x64.o \
obj/applevideo.o \
obj/ay8910.o \
obj/charset.o \
obj/textedit.o \
obj/window.o \
-all: checkenv message obj $(TARGET)$(EXESUFFIX)
+all: message obj $(TARGET)$(EXESUFFIX)
@echo
@echo -e "\033[01;33m***\033[00;32m Looks like it compiled OK... Give it a whirl!\033[00m"
# Check the compilation environment, barf if not appropriate
-checkenv:
- @echo
- @echo -en "\033[01;33m***\033[00;32m Checking compilation environment... \033[00m"
ifeq "$(FINDSDL2)" ""
- @echo
- @echo
- @echo -e "\033[01;33mIt seems that you don't have the SDL 2 development libraries installed. If you"
- @echo -e "have installed them, make sure that the sdl2-config file is somewhere in your"
- @echo -e "path and is executable.\033[00m"
- @echo
-#Is there a better way to break out of the makefile?
- @false;
-# @break
-# YES! But ignores all the echo's above... :-/
-#$(error SDL2 MISSING)
-
-else
- @echo -e "\033[01;37mOK\033[00m"
+ $(info )
+ $(info It seems that you don't have the SDL 2 development libraries installed. If you)
+ $(info have installed them, make sure that the sdl2-config file is somewhere in your)
+ $(info path and is executable.)
+ $(info )
+ $(error SDL2 MISSING)
endif
message:
obj:
@mkdir obj
-# This is only done for Win32 at the moment...
-
+# Icon creation is only done for Win32 at the moment...
ifneq "" "$(ICON)"
$(ICON): res/$(TARGET).rc res/$(TARGET).ico
@echo -e "\033[01;33m***\033[00;32m Processing icon...\033[00m"
@$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
#GUI compilation...
-obj/%.o: src/gui/%.cpp
- @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
- @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
+#obj/%.o: src/gui/%.cpp
+# @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
+# @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
$(TARGET)$(EXESUFFIX): $(OBJS)
@echo -e "\033[01;33m***\033[00;32m Linking it all together...\033[00m"
@$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
-# strip --strip-all vj$(EXESUFFIX)
-# upx -9 vj$(EXESUFFIX)
+# strip --strip-all $(TARGET)$(EXESUFFIX)
+# upx -9 $(TARGET)$(EXESUFFIX)
statistics:
@echo -n "Lines in source files: "
#This is the default--we don't advertise it just yet... ;-)
#autoStateFilename = ./apple2auto.state
-# TEMPORARY disk image load paths
-
-#floppyImage1 = ./disks/dos33.dsk
-#floppyImage1 = ./disks/prodos.dsk
-#floppyImage1 = ./disks/temp.nib
-#floppyImage1 = ./disks/temp.dsk
-# Yes
-#floppyImage1 = ./disks/sneakers.do
-# Yes
-#floppyImage1 = ./disks/Gumball (Mr. Krac-Man and The Disk Jockey crack).dsk
-# Yes
-#floppyImage1 = ./disks/prince_of_persia_boot.dsk
-#floppyImage2 = ./disks/prince_of_persia_a.dsk
-#floppyImage1 = ./disks/prince_of_persia_b.dsk
-# Yes
-#floppyImage1 = ./disks/Oregon Trail (Disk 1 of 2).dsk
-#floppyImage2 = ./disks/Oregon Trail (Disk 2 of 2).dsk
-# Yes
-floppyImage1 = ./disks/bt1_boot.dsk
-# Yes
-#floppyImage1 = ./disks/bt2_boot.dsk
-# Yes
-#floppyImage1 = ./disks/bt3_boot_fixed.dsk
-#floppyImage2 = ./disks/bt3_character_fixed.dsk
-# Yes
-#floppyImage1 = ./disks/Sabotage.dsk
-# Yes
-#floppyImage1 = ./disks/airheart.dsk
-# Yes
-#floppyImage1 = ./disks/drol.dsk
-# Yes
-#floppyImage1 = ./disks/skyfox.dsk
-# Yes
-#floppyImage1 = ./disks/karateka.dsk
-# Yes
-#floppyImage1 = ./disks/wolfenstein_dos32.nib
-# Yes, keys??? (joystick only)
-#floppyImage1 = ./disks/MidnightMagic_etc.dsk
-# Yes
-#floppyImage1 = ./disks/battle_chess_1.dsk
-#floppyImage2 = ./disks/battle_chess_2.dsk
-# Yes
-#floppyImage1 = ./disks/MoebiusI-1.dsk
-#floppyImage2 = ./disks/MoebiusI-2.dsk
-# Yes, but crashes on the attract mode (does the same in AppleWin)
-# Also, write problems
-#floppyImage1 = ./disks/moebiusiia.dsk
-#floppyImage1 = ./disks/MoebiusIIA.dsk
-#floppyImage2 = ./disks/MoebiusIIB.dsk
-# Yes
-#floppyImage1 = ./disks/wind_walker_1.dsk
-#floppyImage2 = ./disks/wind_walker_2.dsk
-# Yes
-#floppyImage1 = ./disks/dino_eggs.dsk
-# ??? 1, yes; 2, no
-#floppyImage1 = ./disks/mockingboard1.dsk
-#floppyImage2 = ./disks/mockingboard2.dsk
-# Yes, but have to load manually
-#floppyImage1 = ./disks/ultima_ii-1.dsk
-#floppyImage2 = ./disks/ultima_ii-2.dsk
-# Yes, autoloads!
-#floppyImage1 = ./disks/u2prog.dsk
-#floppyImage2 = ./disks/u2master-jlh.dsk
-#floppyImage2 = ./disks/u2player-jlh.dsk
-# Yes
-#floppyImage1 = ./disks/Ultima_II_-_Program_Disk.dsk
-#floppyImage2 = ./disks/Ultima_II_-_Player_Disk-jlh.dsk
-# Yes
-#floppyImage1 = ./disks/TheHeist.dsk
-# Yes
-#floppyImage1 = ./disks/ult31snd.dsk
-#floppyImage2 = ./disks/ult32snd.dsk
-# Yes (key repeat is too high)
-#floppyImage1 = ./disks/bandits.dsk
-# Yes
-#floppyImage1 = ./disks/SpareChange.dsk
-# Yes
-#floppyImage1 = ./disks/lode_runner.dsk
-# Yes
-#floppyImage1 = ./disks/championship_lode_runner.dsk
-# Yes
-#floppyImage1 = ./disks/championship_lode_runner.bin
-
-
# OpenGL filtering type: 1 - blurry, 0 - sharp
glFilterType = 0
joyport = 0
-# Jaguar joypad key assignments
-# Note: It would be nicer to be able to have a single left side to store all this in...
-# E.g. p1keys = 34, 32, 22, etc. instead of what we have here...
-
-p1k_up = 273 # SDLK_UP
-p1k_down = 274 # SDLK_DOWN
-p1k_left = 276 # SDLK_LEFT
-p1k_right = 275 # SDLK_RIGHT
-p1k_c = 122 # SDLK_z
-p1k_b = 120 # SDLK_x
-p1k_a = 99 # SDLK_c
-p1k_option = 39 # SDLK_QUOTE
-p1k_pause = 13 # SDLK_RETURN
-p1k_0 = 256 # SDLK_KP0
-p1k_1 = 257 # SDLK_KP1
-p1k_2 = 258 # SDLK_KP2
-p1k_3 = 259 # SDLK_KP3
-p1k_4 = 260 # SDLK_KP4
-p1k_5 = 261 # SDLK_KP5
-p1k_6 = 262 # SDLK_KP6
-p1k_7 = 263 # SDLK_KP7
-p1k_8 = 264 # SDLK_KP8
-p1k_9 = 265 # SDLK_KP9
-p1k_pound = 267 # SDLK_KP_DIVIDE
-p1k_star = 268 # SDLK_KP_MULTIPLY
-
-p2k_up = 273 # SDLK_UP
-p2k_down = 274 # SDLK_DOWN
-p2k_left = 276 # SDLK_LEFT
-p2k_right = 275 # SDLK_RIGHT
-p2k_c = 122 # SDLK_z
-p2k_b = 120 # SDLK_x
-p2k_a = 99 # SDLK_c
-p2k_option = 39 # SDLK_QUOTE
-p2k_pause = 13 # SDLK_RETURN
-p2k_0 = 256 # SDLK_KP0
-p2k_1 = 257 # SDLK_KP1
-p2k_2 = 258 # SDLK_KP2
-p2k_3 = 259 # SDLK_KP3
-p2k_4 = 260 # SDLK_KP4
-p2k_5 = 261 # SDLK_KP5
-p2k_6 = 262 # SDLK_KP6
-p2k_7 = 263 # SDLK_KP7
-p2k_8 = 264 # SDLK_KP8
-p2k_9 = 265 # SDLK_KP9
-p2k_pound = 267 # SDLK_KP_DIVIDE
-p2k_star = 268 # SDLK_KP_MULTIPLY
# (C) 2012 Underground Software
#
export PATH=/opt/mxe/usr/bin:$PATH
-make CROSS=i686-pc-mingw32- clean && make CROSS=i686-pc-mingw32-
+#make CROSS=i686-pc-mingw32- clean && make CROSS=i686-pc-mingw32-
+make CROSS=x86_64-w64-mingw32- clean && make CROSS=x86_64-w64-mingw32.static-
upx -9v apple2.exe
#TARGET = apple2
#endif
//let's wait, then signal...
-//works longer, but then still falls behind...
+//works longer, but then still falls behind... [FIXED, see above]
#ifdef THREADED_65C02
if (!pauseMode)
SDL_CondSignal(cpuCond);//OK, let the CPU go another frame...
#define MAX_PATH _POSIX_PATH_MAX
#else
#include <stdlib.h> // for MAX_PATH on MinGW/Darwin
+// Kludge for Win64
+#ifndef MAX_PATH
+#define MAX_PATH _MAX_PATH
+#endif
#endif
#include <stdint.h>
#include <stdio.h>
enum { AM_RAM, AM_ROM, AM_BANKED, AM_READ, AM_WRITE, AM_READ_WRITE, AM_END_OF_LIST };
// Macros for function pointers
-// The typedef would be something like:
-//typedef ReadFunc (uint8_t (*)(uint16_t));
-//typedef WriteFunc (void (*)(uint16_t, uint8_t));
#define READFUNC(x) uint8_t (* x)(uint16_t)
#define WRITEFUNC(x) void (* x)(uint16_t, uint8_t)
WRITEFUNC(write);
};
+#define ADDRESS_MAP_END { 0x0000, 0x0000, AM_END_OF_LIST, 0, 0, 0, 0 }
// Dunno if I like this approach or not...
//ADDRESS_MAP_START()
{ 0xD000, 0xDFFF, AM_BANKED, &lcBankMemoryR, &lcBankMemoryW, 0, 0 },
{ 0xE000, 0xFFFF, AM_BANKED, &upperMemoryR, &upperMemoryW, 0, 0 },
- { 0x0000, 0x0000, AM_END_OF_LIST, 0, 0, 0, 0 }
+// { 0x0000, 0x0000, AM_END_OF_LIST, 0, 0, 0, 0 }
+ ADDRESS_MAP_END
};
void WriteMemory(uint16_t address, uint8_t byte)
{
- // We can write protect memory this way, but it adds a branch to the mix. :-/
- // (this can be avoided by setting up another bank of memory which we
+ // We can write protect memory this way, but it adds a branch to the mix.
+ // :-/ (this can be avoided by setting up another bank of memory which we
// ignore... hmm...)
if ((*addrPtrWrite[address]) == 0)
return;
{
mainMemoryTextR = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryTextW = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
-// mainMemoryHGRR = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
-// mainMemoryHGRW = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
}
else
{
mainMemoryTextR = (ramwrt ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryTextW = (ramwrt ? &ram2[0x0400] : &ram[0x0400]);
-// mainMemoryHGRR = (ramwrt ? &ram2[0x2000] : &ram[0x2000]);
-// mainMemoryHGRW = (ramwrt ? &ram2[0x2000] : &ram[0x2000]);
}
}
{
mainMemoryTextR = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryTextW = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
-// mainMemoryHGRR = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
-// mainMemoryHGRW = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
}
return 0;
{
mainMemoryTextR = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryTextW = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
-// mainMemoryHGRR = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
-// mainMemoryHGRW = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
}
}
#define MAX_PATH _POSIX_PATH_MAX
#else
#include <stdlib.h> // for MAX_PATH on MinGW/Darwin
+// Win64 kludge
+#ifndef MAX_PATH
+#define MAX_PATH _MAX_PATH // Ugh.
+#endif
#endif
#include <stdint.h>
#define SAMPLES_PER_FRAME (SAMPLE_RATE / 60.0)
#define CYCLES_PER_SAMPLE (1024000.0 / SAMPLE_RATE)
//#define SOUND_BUFFER_SIZE (8192)
+// 32K ought to be enough for anybody
#define SOUND_BUFFER_SIZE (32768)
// Global variables
{
// Not sure about this...
regs.sp = 0xFF;
- regs.cc = FLAG_B | FLAG_I; // Reset the CC register
- regs.pc = RdMemW(0xFFFC); // And load PC with the RESET vector
+ regs.cc = FLAG_B | FLAG_I; // Reset the CC register
+ regs.pc = RdMemW(0xFFFC); // And load PC with the RESET vector
- context->cpuFlags &= ~V65C02_ASSERT_LINE_RESET;
- regs.cpuFlags &= ~V65C02_ASSERT_LINE_RESET;
+// context->cpuFlags &= ~V65C02_ASSERT_LINE_RESET;
+// regs.cpuFlags &= ~V65C02_ASSERT_LINE_RESET;
+ context->cpuFlags = 0; // Clear CPU flags...
+ regs.cpuFlags = 0;
#ifdef __DEBUG__
WriteLog("\n*** RESET *** (PC = $%04X)\n\n", regs.pc);
#endif
#include "video.h"
#include <string.h> // Why??? (for memset, etc... Lazy!) Dunno why, but this just strikes me as wrong...
#include <malloc.h>
-#include "gui/gui.h"
+//#include "gui/gui.h"
#include "apple2-icon-64x64.h"
#include "log.h"
#include "settings.h"