Commit f98f842f authored by Sergio Costas's avatar Sergio Costas

Merge branch 'devel'

parents 6773f137 e2ca86d4
......@@ -14,3 +14,5 @@ WHAT EMULATES RIGHT IN FBZX?
-Emulation of Interface I and Microdrive (only one drive).
-Memory contention
-Emulates Spanish 128K from Investronica/Sinclair
-Allows to insert POKE values in memory (inmunity, infinite lives...)
-Can load and save SCR snapshots
cargador.d cargador.o: ../cargador.c ../z80free/Z80free.h ../computer.h \
../emulator.h ../cargador.h
../z80free/Z80free.h:
../computer.h:
../emulator.h:
../cargador.h:
characters.d characters.o: ../characters.c ../characters.h ../emulator.h \
../z80free/Z80free.h ../computer.h
../characters.h:
../emulator.h:
../z80free/Z80free.h:
../computer.h:
computer.d computer.o: ../computer.c ../z80free/Z80free.h ../computer.h \
../emulator.h ../menus.h ../characters.h ../sound.h ../tape.h \
../microdrive.h
../z80free/Z80free.h:
../computer.h:
../emulator.h:
../menus.h:
../characters.h:
../sound.h:
../tape.h:
../microdrive.h:
emulator.d emulator.o: ../emulator.c ../z80free/Z80free.h ../computer.h \
../emulator.h ../cargador.h ../characters.h ../menus.h ../sound.h \
../tape.h ../microdrive.h
../z80free/Z80free.h:
../computer.h:
../emulator.h:
../cargador.h:
../characters.h:
../menus.h:
../sound.h:
../tape.h:
../microdrive.h:
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include z80free/subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: fbzx
# Tool invocations
fbzx: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C Linker'
gcc -o"fbzx" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) fbzx
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets
menus.d menus.o: ../menus.c ../z80free/Z80free.h ../computer.h \
../emulator.h ../cargador.h ../characters.h ../menus.h ../tape.h
../z80free/Z80free.h:
../computer.h:
../emulator.h:
../cargador.h:
../characters.h:
../menus.h:
../tape.h:
microdrive.d microdrive.o: ../microdrive.c ../microdrive.h \
../z80free/Z80free.h ../computer.h ../emulator.h
../microdrive.h:
../z80free/Z80free.h:
../computer.h:
../emulator.h:
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
USER_OBJS :=
LIBS :=
sound.d sound.o: ../sound.c ../z80free/Z80free.h ../computer.h \
../emulator.h ../sound.h
../z80free/Z80free.h:
../computer.h:
../emulator.h:
../sound.h:
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
O_SRCS :=
C_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
OBJS :=
C_DEPS :=
EXECUTABLES :=
# Every subdirectory with source files must be described here
SUBDIRS := \
z80free \
. \
spk_ay.d spk_ay.o: ../spk_ay.c ../emulator.h ../z80free/Z80free.h \
../computer.h ../sound.h
../emulator.h:
../z80free/Z80free.h:
../computer.h:
../sound.h:
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../cargador.c \
../characters.c \
../computer.c \
../emulator.c \
../menus.c \
../microdrive.c \
../sound.c \
../spk_ay.c \
../tape.c
OBJS += \
./cargador.o \
./characters.o \
./computer.o \
./emulator.o \
./menus.o \
./microdrive.o \
./sound.o \
./spk_ay.o \
./tape.o
C_DEPS += \
./cargador.d \
./characters.d \
./computer.d \
./emulator.d \
./menus.d \
./microdrive.d \
./sound.d \
./spk_ay.d \
./tape.d
# Each subdirectory must supply rules for building sources it contributes
%.o: ../%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
tape.d tape.o: ../tape.c ../z80free/Z80free.h ../computer.h ../emulator.h \
../menus.h ../tape.h
../z80free/Z80free.h:
../computer.h:
../emulator.h:
../menus.h:
../tape.h:
z80free/Z80free.d z80free/Z80free.o: ../z80free/Z80free.c \
../z80free/Z80free.h
../z80free/Z80free.h:
z80free/Z80free_codes.d z80free/Z80free_codes.o: \
../z80free/Z80free_codes.c ../z80free/Z80free.h
../z80free/Z80free.h:
z80free/Z80free_codesCB.d z80free/Z80free_codesCB.o: \
../z80free/Z80free_codesCB.c ../z80free/Z80free.h
../z80free/Z80free.h:
z80free/Z80free_codesDD.d z80free/Z80free_codesDD.o: \
../z80free/Z80free_codesDD.c ../z80free/Z80free.h
../z80free/Z80free.h:
z80free/Z80free_codesDDCB.d z80free/Z80free_codesDDCB.o: \
../z80free/Z80free_codesDDCB.c ../z80free/Z80free.h
../z80free/Z80free.h:
z80free/Z80free_codesED.d z80free/Z80free_codesED.o: \
../z80free/Z80free_codesED.c ../z80free/Z80free.h
../z80free/Z80free.h:
z80free/Z80free_codesFD.d z80free/Z80free_codesFD.o: \
../z80free/Z80free_codesFD.c ../z80free/Z80free.h
../z80free/Z80free.h:
z80free/Z80free_codesFDCB.d z80free/Z80free_codesFDCB.o: \
../z80free/Z80free_codesFDCB.c ../z80free/Z80free.h
../z80free/Z80free.h:
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../z80free/Z80free.c \
../z80free/Z80free_codes.c \
../z80free/Z80free_codesCB.c \
../z80free/Z80free_codesDD.c \
../z80free/Z80free_codesDDCB.c \
../z80free/Z80free_codesED.c \
../z80free/Z80free_codesFD.c \
../z80free/Z80free_codesFDCB.c \
../z80free/z80free_tester.c
OBJS += \
./z80free/Z80free.o \
./z80free/Z80free_codes.o \
./z80free/Z80free_codesCB.o \
./z80free/Z80free_codesDD.o \
./z80free/Z80free_codesDDCB.o \
./z80free/Z80free_codesED.o \
./z80free/Z80free_codesFD.o \
./z80free/Z80free_codesFDCB.o \
./z80free/z80free_tester.o
C_DEPS += \
./z80free/Z80free.d \
./z80free/Z80free_codes.d \
./z80free/Z80free_codesCB.d \
./z80free/Z80free_codesDD.d \
./z80free/Z80free_codesDDCB.d \
./z80free/Z80free_codesED.d \
./z80free/Z80free_codesFD.d \
./z80free/Z80free_codesFDCB.d \
./z80free/z80free_tester.d
# Each subdirectory must supply rules for building sources it contributes
z80free/%.o: ../z80free/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
z80free/z80free_tester.d z80free/z80free_tester.o: \
../z80free/z80free_tester.c ../z80free/Z80free.h
../z80free/Z80free.h:
......@@ -150,7 +150,7 @@ nothing.
F7 allows to choose a MDR file (microdrive), protect and unprotect it,
and create a new (and empty) one.
F8 shows a picture with the keyboard layout
F8 allows to shows a picture with the keyboard layout, or insert POKE values
F9 toggles between fullscreen/windowed mode
......
2.5.0
*Allows to set POKEs
*Emulates B&W sets
*Allows to load and save SCR snapshots
2.4.3
*Fixed a bug with the double-scan flag
......
This diff is collapsed.
......@@ -20,4 +20,4 @@
extern unsigned char characters[96][32];
void printchar(unsigned char *,unsigned char,int,int,unsigned char,unsigned char,int);
void printstring(unsigned char *,char*,int,int,unsigned char,unsigned char,int);
void print_string(unsigned char *,char*,int,int,unsigned char,unsigned char,int);
......@@ -116,6 +116,206 @@ void computer_init () {
ordenador.tape_loop_counter = 0;
}
void computer_set_palete() {
SDL_Color colores[16];
if (ordenador.bw==0) {
// Color mode
colores[0].r = 0;
colores[0].g = 0;
colores[0].b = 0;
colores[1].r = 0;
colores[1].g = 0;
colores[1].b = 192;
colores[2].r = 192;
colores[2].g = 0;
colores[2].b = 0;
colores[3].r = 192;
colores[3].g = 0;
colores[3].b = 192;
colores[4].r = 0;
colores[4].g = 192;
colores[4].b = 0;
colores[5].r = 0;
colores[5].g = 192;
colores[5].b = 192;
colores[6].r = 192;
colores[6].g = 192;
colores[6].b = 0;
colores[7].r = 192;
colores[7].g = 192;
colores[7].b = 192;
colores[8].r = 0;
colores[8].g = 0;
colores[8].b = 0;
colores[9].r = 0;
colores[9].g = 0;
colores[9].b = 255;
colores[10].r = 255;
colores[10].g = 0;
colores[10].b = 0;
colores[11].r = 255;
colores[11].g = 0;
colores[11].b = 255;
colores[12].r = 0;
colores[12].g = 255;
colores[12].b = 0;
colores[13].r = 0;
colores[13].g = 255;
colores[13].b = 255;
colores[14].r = 255;
colores[14].g = 255;
colores[14].b = 0;
colores[15].r = 255;
colores[15].g = 255;
colores[15].b = 255;
SDL_SetColors (ordenador.screen, colores, 16, 16); // set 16 colors from the 16th
if (ordenador.bpp==1) {
colors[0]=0x00000000;
colors[1]=0x11111111;
colors[2]=0x12121212;
colors[3]=0x13131313;
colors[4]=0x14141414;
colors[5]=0x15151515;
colors[6]=0x16161616;
colors[7]=0x17171717;
colors[8]=0x18181818;
colors[9]=0x19191919;
colors[10]=0x1A1A1A1A;
colors[11]=0x1B1B1B1B;
colors[12]=0x1C1C1C1C;
colors[13]=0x1D1D1D1D;
colors[14]=0x1E1E1E1E;
colors[15]=0x1F1F1F1F;
} else {
colors[0]=SDL_MapRGB(screen->format,0,0,0);
colors[1]=SDL_MapRGB(screen->format,0,0,192);
colors[2]=SDL_MapRGB(screen->format,192,0,0);
colors[3]=SDL_MapRGB(screen->format,192,0,192);
colors[4]=SDL_MapRGB(screen->format,0,192,0);
colors[5]=SDL_MapRGB(screen->format,0,192,192);
colors[6]=SDL_MapRGB(screen->format,192,192,0);
colors[7]=SDL_MapRGB(screen->format,192,192,192);
colors[8]=SDL_MapRGB(screen->format,0,0,0);
colors[9]=SDL_MapRGB(screen->format,0,0,255);
colors[10]=SDL_MapRGB(screen->format,255,0,0);
colors[11]=SDL_MapRGB(screen->format,255,0,255);
colors[12]=SDL_MapRGB(screen->format,0,255,0);
colors[13]=SDL_MapRGB(screen->format,0,255,255);
colors[14]=SDL_MapRGB(screen->format,255,255,0);
colors[15]=SDL_MapRGB(screen->format,255,255,255);
}
} else {
// B&W mode
colores[0].r = 0;
colores[0].g = 0;
colores[0].b = 0;
colores[1].r = 22;
colores[1].g = 22;
colores[1].b = 22;
colores[2].r = 57;
colores[2].g = 57;
colores[2].b = 57;
colores[3].r = 79;
colores[3].g = 79;
colores[3].b = 79;
colores[4].r = 113;
colores[4].g = 113;
colores[4].b = 113;
colores[5].r = 135;
colores[5].g = 135;
colores[5].b = 135;
colores[6].r = 160;
colores[6].g = 160;
colores[6].b = 160;
colores[7].r = 192;
colores[7].g = 192;
colores[7].b = 192;
colores[8].r = 0;
colores[8].g = 0;
colores[8].b = 0;
colores[9].r = 29;
colores[9].g = 29;
colores[9].b = 29;
colores[10].r = 76;
colores[10].g = 76;
colores[10].b = 76;
colores[11].r = 105;
colores[11].g = 105;
colores[11].b = 105;
colores[12].r = 150;
colores[12].g = 150;
colores[12].b = 150;
colores[13].r = 179;
colores[13].g = 179;
colores[13].b = 179;
colores[14].r = 226;
colores[14].g = 226;
colores[14].b = 226;
colores[15].r = 255;
colores[15].g = 255;
colores[15].b = 255;
SDL_SetColors (ordenador.screen, colores, 16, 16); // set 16 colors from the 16th
if (ordenador.bpp==1) {
colors[0]=0x00000000;
colors[1]=0x11111111;
colors[2]=0x12121212;
colors[3]=0x13131313;
colors[4]=0x14141414;
colors[5]=0x15151515;
colors[6]=0x16161616;
colors[7]=0x17171717;
colors[8]=0x18181818;
colors[9]=0x19191919;
colors[10]=0x1A1A1A1A;
colors[11]=0x1B1B1B1B;
colors[12]=0x1C1C1C1C;
colors[13]=0x1D1D1D1D;
colors[14]=0x1E1E1E1E;
colors[15]=0x1F1F1F1F;
} else {
colors[0]=SDL_MapRGB(screen->format,0,0,0);
colors[1]=SDL_MapRGB(screen->format,22,22,22);
colors[2]=SDL_MapRGB(screen->format,57,57,57);
colors[3]=SDL_MapRGB(screen->format,79,79,79);
colors[4]=SDL_MapRGB(screen->format,113,113,113);
colors[5]=SDL_MapRGB(screen->format,135,135,135);
colors[6]=SDL_MapRGB(screen->format,160,160,160);
colors[7]=SDL_MapRGB(screen->format,192,192,192);
colors[8]=SDL_MapRGB(screen->format,0,0,0);
colors[9]=SDL_MapRGB(screen->format,29,29,29);
colors[10]=SDL_MapRGB(screen->format,76,76,76);
colors[11]=SDL_MapRGB(screen->format,105,105,105);
colors[12]=SDL_MapRGB(screen->format,150,150,150);
colors[13]=SDL_MapRGB(screen->format,179,179,179);
colors[14]=SDL_MapRGB(screen->format,226,226,226);
colors[15]=SDL_MapRGB(screen->format,255,255,255);
}
}
}
/* Registers the screen surface where the Spectrum will put the picture,
prepares the palette and creates two arrays (translate and translate2)
......@@ -124,7 +324,6 @@ that gives the memory address for each scan */
void register_screen (SDL_Surface * pantalla) {
int resx, resy, bucle, bucle2, bucle3, bucle4, bucle5;
SDL_Color colores[16];
// we prepare the scanline transform arrays
......@@ -146,57 +345,6 @@ void register_screen (SDL_Surface * pantalla) {
ordenador.screen = pantalla;
colores[0].r = 0;
colores[0].g = 0;
colores[0].b = 0;
colores[1].r = 0;
colores[1].g = 0;
colores[1].b = 192;
colores[2].r = 192;
colores[2].g = 0;
colores[2].b = 0;
colores[3].r = 192;
colores[3].g = 0;
colores[3].b = 192;
colores[4].r = 0;
colores[4].g = 192;
colores[4].b = 0;
colores[5].r = 0;
colores[5].g = 192;
colores[5].b = 192;
colores[6].r = 192;
colores[6].g = 192;
colores[6].b = 0;
colores[7].r = 192;
colores[7].g = 192;
colores[7].b = 192;
colores[8].r = 0;
colores[8].g = 0;
colores[8].b = 0;
colores[9].r = 0;
colores[9].g = 0;
colores[9].b = 255;
colores[10].r = 255;
colores[10].g = 0;
colores[10].b = 0;
colores[11].r = 255;
colores[11].g = 0;
colores[11].b = 255;
colores[12].r = 0;
colores[12].g = 255;
colores[12].b = 0;
colores[13].r = 0;
colores[13].g = 255;
colores[13].b = 255;
colores[14].r = 255;
colores[14].g = 255;
colores[14].b = 0;
colores[15].r = 255;
colores[15].g = 255;
colores[15].b = 255;
SDL_SetColors (ordenador.screen, colores, 16, 16); // set 16 colors from the 16th
ordenador.border = 0;
ordenador.currline = 0;
ordenador.currpix = 0;
......@@ -247,43 +395,7 @@ void register_screen (SDL_Surface * pantalla) {
ordenador.next_pixel*=ordenador.bpp;
ordenador.jump_pixel*=ordenador.bpp;
switch(ordenador.bpp) {
case 1:
colors[0]=0x00000000;
colors[1]=0x11111111;
colors[2]=0x12121212;
colors[3]=0x13131313;
colors[4]=0x14141414;
colors[5]=0x15151515;
colors[6]=0x16161616;
colors[7]=0x17171717;
colors[8]=0x18181818;
colors[9]=0x19191919;
colors[10]=0x1A1A1A1A;
colors[11]=0x1B1B1B1B;
colors[12]=0x1C1C1C1C;
colors[13]=0x1D1D1D1D;
colors[14]=0x1E1E1E1E;
colors[15]=0x1F1F1F1F;
break;
default:
colors[0]=SDL_MapRGB(screen->format,0,0,0);
colors[1]=SDL_MapRGB(screen->format,0,0,192);
colors[2]=SDL_MapRGB(screen->format,192,0,0);
colors[3]=SDL_MapRGB(screen->format,192,0,192);
colors[4]=SDL_MapRGB(screen->format,0,192,0);
colors[5]=SDL_MapRGB(screen->format,0,192,192);
colors[6]=SDL_MapRGB(screen->format,192,192,0);
colors[7]=SDL_MapRGB(screen->format,192,192,192);
colors[8]=SDL_MapRGB(screen->format,0,0,0);
colors[9]=SDL_MapRGB(screen->format,0,0,255);
colors[10]=SDL_MapRGB(screen->format,255,0,0);
colors[11]=SDL_MapRGB(screen