Commit 3e0a4ae4 authored by Sergio Costas's avatar Sergio Costas

Moved code to SRC folder

First try to use C++

First incomplete version of the TAPE class
parent ad7b4b56
...@@ -4,31 +4,27 @@ else ...@@ -4,31 +4,27 @@ else
PREFIX2=/usr/local PREFIX2=/usr/local
endif endif
CFLAGS += `pkg-config --cflags sdl libpulse-simple alsa` -O2 -Wno-pointer-sign -Wall -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS all:
LDFLAGS += `pkg-config --libs sdl libpulse-simple alsa` cd src && $(MAKE)
fbzx: computer.o Z80free.o Z80free_codes.o Z80free_codesCB.o Z80free_codesED.o Z80free_codesDD.o Z80free_codesFD.o Z80free_codesDDCB.o Z80free_codesFDCB.o emulator.o cargador.o characters.o menus.o sound.o tape.o spk_ay.o microdrive.o
$(CC) -o fbzx computer.o Z80free.o Z80free_codes.o Z80free_codesCB.o Z80free_codesED.o Z80free_codesDD.o Z80free_codesFD.o Z80free_codesDDCB.o Z80free_codesFDCB.o emulator.o cargador.o characters.o menus.o sound.o tape.o spk_ay.o microdrive.o $(LDFLAGS)
clean: clean:
rm -f fbzx *.o *~ rm -f src/fbzx src/*.o src/*~
install: install:
rm -f $(PREFIX2)/bin/fbzx rm -f $(PREFIX2)/bin/fbzx
cp fbzx $(PREFIX2)/bin cp src/fbzx $(PREFIX2)/bin
mkdir -p $(PREFIX2)/share/fbzx mkdir -p $(PREFIX2)/share/fbzx
mkdir -p $(PREFIX2)/share/spectrum-roms mkdir -p $(PREFIX2)/share/spectrum-roms
mkdir -p $(PREFIX2)/share/applications mkdir -p $(PREFIX2)/share/applications
mkdir -p $(PREFIX2)/share/pixmaps mkdir -p $(PREFIX2)/share/pixmaps
mkdir -p $(PREFIX2)/share/doc/fbzx mkdir -p $(PREFIX2)/share/doc/fbzx
mkdir -p $(PREFIX2)/share/appdata mkdir -p $(PREFIX2)/share/appdata
cp spectrum-roms/* $(PREFIX2)/share/spectrum-roms cp data/spectrum-roms/* $(PREFIX2)/share/spectrum-roms
cp keymap.bmp $(PREFIX2)/share/fbzx cp data/keymap.bmp $(PREFIX2)/share/fbzx
cp fbzx.desktop $(PREFIX2)/share/applications cp data/fbzx.desktop $(PREFIX2)/share/applications
cp fbzx.svg $(PREFIX2)/share/pixmaps cp data/fbzx.svg $(PREFIX2)/share/pixmaps
cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS $(PREFIX2)/share/doc/fbzx/ cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS $(PREFIX2)/share/doc/fbzx/
cp fbzx.appdata.xml $(PREFIX2)/share/appdata/ cp data/fbzx.appdata.xml $(PREFIX2)/share/appdata/
chmod 644 $(PREFIX2)/share/fbzx/* chmod 644 $(PREFIX2)/share/fbzx/*
chmod 644 $(PREFIX2)/share/spectrum-roms/* chmod 644 $(PREFIX2)/share/spectrum-roms/*
chmod 644 $(PREFIX2)/share/doc/fbzx/* chmod 644 $(PREFIX2)/share/doc/fbzx/*
...@@ -41,55 +37,3 @@ uninstall: ...@@ -41,55 +37,3 @@ uninstall:
rm -rf $(PREFIX2)/share/doc/fbzx rm -rf $(PREFIX2)/share/doc/fbzx
rm -rf $(PREFIX2)/share/spectrum-roms rm -rf $(PREFIX2)/share/spectrum-roms
rm -f $(PREFIX2)/share/appdata/fbzx.appdata.xml rm -f $(PREFIX2)/share/appdata/fbzx.appdata.xml
\ No newline at end of file
spk_ay.o: spk_ay.c spk_ay.h emulator.h sound.h computer.h z80free/Z80free.h
$(CC) $(CFLAGS) -c -o spk_ay.o spk_ay.c
microdrive.o: microdrive.c microdrive.h z80free/Z80free.h computer.h emulator.h z80free/Z80free.h
$(CC) $(CFLAGS) -c -o microdrive.o microdrive.c
sound.o: sound.c sound.h computer.h emulator.h z80free/Z80free.h
$(CC) $(CFLAGS) -c -o sound.o sound.c
emulator.o: emulator.c z80free/Z80free.h computer.h emulator.h characters.h menus.h cargador.h sound.h tape.h microdrive.h
$(CC) $(CFLAGS) -c -o emulator.o emulator.c
computer.o: computer.c z80free/Z80free.h computer.h emulator.h characters.h menus.h cargador.h sound.h tape.h spk_ay.h microdrive.h
$(CC) $(CFLAGS) -c -o computer.o computer.c
tape.o: tape.c z80free/Z80free.h computer.h emulator.h menus.h tape.h computer.h
$(CC) $(CFLAGS) -c -o tape.o tape.c
cargador.o: cargador.c cargador.h computer.h emulator.h z80free/Z80free.h characters.h menus.h computer.h
$(CC) $(CFLAGS) -c -o cargador.o cargador.c
characters.o: characters.c characters.h emulator.h computer.h
$(CC) $(CFLAGS) -c -o characters.o characters.c
menus.o: menus.c menus.h characters.h computer.h emulator.h z80free/Z80free.h cargador.h tape.h
$(CC) $(CFLAGS) -c -o menus.o menus.c
Z80free.o: z80free/Z80free.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free.o z80free/Z80free.c
Z80free_codes.o: z80free/Z80free_codes.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codes.o z80free/Z80free_codes.c
Z80free_codesCB.o: z80free/Z80free_codesCB.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesCB.o z80free/Z80free_codesCB.c
Z80free_codesED.o: z80free/Z80free_codesED.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesED.o z80free/Z80free_codesED.c
Z80free_codesDD.o: z80free/Z80free_codesDD.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesDD.o z80free/Z80free_codesDD.c
Z80free_codesFD.o: z80free/Z80free_codesFD.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesFD.o z80free/Z80free_codesFD.c
Z80free_codesDDCB.o: z80free/Z80free_codesDDCB.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesDDCB.o z80free/Z80free_codesDDCB.c
Z80free_codesFDCB.o: z80free/Z80free_codesFDCB.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesFDCB.o z80free/Z80free_codesFDCB.c
CC=g++
CPP=g++
CFLAGS += `pkg-config --cflags sdl libpulse-simple alsa` -O2 -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
CPPFLAGS += `pkg-config --cflags sdl libpulse-simple alsa` -O2 -Wall -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
LDFLAGS += `pkg-config --libs sdl libpulse-simple alsa`
fbzx: tapep.o computer.o Z80free.o Z80free_codes.o Z80free_codesCB.o Z80free_codesED.o Z80free_codesDD.o Z80free_codesFD.o Z80free_codesDDCB.o Z80free_codesFDCB.o emulator.o cargador.o characters.o menus.o sound.o tape.o spk_ay.o microdrive.o
$(CC) -o fbzx tapep.o computer.o Z80free.o Z80free_codes.o Z80free_codesCB.o Z80free_codesED.o Z80free_codesDD.o Z80free_codesFD.o Z80free_codesDDCB.o Z80free_codesFDCB.o emulator.o cargador.o characters.o menus.o sound.o tape.o spk_ay.o microdrive.o $(LDFLAGS)
spk_ay.o: spk_ay.c spk_ay.h emulator.h sound.h computer.h z80free/Z80free.h
$(CC) $(CFLAGS) -c -o spk_ay.o spk_ay.c
microdrive.o: microdrive.c microdrive.h z80free/Z80free.h computer.h emulator.h z80free/Z80free.h
$(CC) $(CFLAGS) -c -o microdrive.o microdrive.c
sound.o: sound.c sound.h computer.h emulator.h z80free/Z80free.h
$(CC) $(CFLAGS) -c -o sound.o sound.c
emulator.o: emulator.c z80free/Z80free.h computer.h emulator.h characters.h menus.h cargador.h sound.h tape.h microdrive.h
$(CC) $(CFLAGS) -c -o emulator.o emulator.c
computer.o: computer.c z80free/Z80free.h computer.h emulator.h characters.h menus.h cargador.h sound.h tape.h spk_ay.h microdrive.h
$(CC) $(CFLAGS) -c -o computer.o computer.c
tapep.o: tape.cpp z80free/Z80free.h computer.h emulator.h menus.h tape.hpp computer.h
$(CPP) $(CPPFLAGS) -c -o tapep.o tape.cpp
tape.o: tape.c z80free/Z80free.h computer.h emulator.h menus.h tape.h computer.h
$(CC) $(CFLAGS) -c -o tape.o tape.c
cargador.o: cargador.c cargador.h computer.h emulator.h z80free/Z80free.h characters.h menus.h computer.h
$(CC) $(CFLAGS) -c -o cargador.o cargador.c
characters.o: characters.c characters.h emulator.h computer.h
$(CC) $(CFLAGS) -c -o characters.o characters.c
menus.o: menus.c menus.h characters.h computer.h emulator.h z80free/Z80free.h cargador.h tape.h
$(CC) $(CFLAGS) -c -o menus.o menus.c
Z80free.o: z80free/Z80free.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free.o z80free/Z80free.c
Z80free_codes.o: z80free/Z80free_codes.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codes.o z80free/Z80free_codes.c
Z80free_codesCB.o: z80free/Z80free_codesCB.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesCB.o z80free/Z80free_codesCB.c
Z80free_codesED.o: z80free/Z80free_codesED.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesED.o z80free/Z80free_codesED.c
Z80free_codesDD.o: z80free/Z80free_codesDD.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesDD.o z80free/Z80free_codesDD.c
Z80free_codesFD.o: z80free/Z80free_codesFD.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesFD.o z80free/Z80free_codesFD.c
Z80free_codesDDCB.o: z80free/Z80free_codesDDCB.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesDDCB.o z80free/Z80free_codesDDCB.c
Z80free_codesFDCB.o: z80free/Z80free_codesFDCB.c z80free/Z80free.h
$(CC) $(CFLAGS) -c -o Z80free_codesFDCB.o z80free/Z80free_codesFDCB.c
...@@ -37,10 +37,10 @@ void printchar(unsigned char *memo, unsigned char carac, int x, int y, unsigned ...@@ -37,10 +37,10 @@ void printchar(unsigned char *memo, unsigned char carac, int x, int y, unsigned
lugar2=lugar; lugar2=lugar;
for (bucle2=0;bucle2 < 16;bucle2++) { for (bucle2=0;bucle2 < 16;bucle2++) {
if ((characters[carac-32][pos]) & bit_rot) if ((characters[carac-32][pos]) & bit_rot)
paint_one_pixel (colors + (int) (color), lugar2); paint_one_pixel ((unsigned char*)(colors + (int) (color)), lugar2);
//*((unsigned int *)lugar2)=*(colors+(int)(color-16)); //*((unsigned int *)lugar2)=*(colors+(int)(color-16));
else if ((ordenador.text_mini==0)||((bucle1%2==0)&&(bucle2%2==0))) else if ((ordenador.text_mini==0)||((bucle1%2==0)&&(bucle2%2==0)))
paint_one_pixel (colors + (int) (back), lugar2); paint_one_pixel ((unsigned char*)(colors + (int) (back)), lugar2);
//*((unsigned int *)lugar2)=*(colors+(int)(back-16)); //*((unsigned int *)lugar2)=*(colors+(int)(back-16));
if ((ordenador.text_mini==0)||(bucle2%2==1)) { if ((ordenador.text_mini==0)||(bucle2%2==1)) {
lugar2+=ordenador.bpp; lugar2+=ordenador.bpp;
...@@ -64,7 +64,7 @@ void print_string(unsigned char *memo, char *cadena, int x, int y, unsigned char ...@@ -64,7 +64,7 @@ void print_string(unsigned char *memo, char *cadena, int x, int y, unsigned char
int length, ncarac, bucle, xx; int length, ncarac, bucle, xx;
int xxx, yyy; int xxx, yyy;
int w,h; int w,h;
unsigned char *str2; char *str2;
if (ordenador.text_mini==1) { if (ordenador.text_mini==1) {
if (x!=-1) if (x!=-1)
......
...@@ -28,12 +28,13 @@ ...@@ -28,12 +28,13 @@
#include <sys/types.h> #include <sys/types.h>
#include <signal.h> #include <signal.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "tape.h"
#include "microdrive.h" #include "microdrive.h"
#include "tape.h"
#include "spk_ay.h"
/* Returns the bus value when reading a port without a periferial */ /* Returns the bus value when reading a port without a periferial */
inline byte bus_empty () { byte bus_empty () {
if (ordenador.mode128k != 3) if (ordenador.mode128k != 3)
return (ordenador.bus_value); return (ordenador.bus_value);
...@@ -44,7 +45,7 @@ inline byte bus_empty () { ...@@ -44,7 +45,7 @@ inline byte bus_empty () {
/* calls all the routines that emulates the computer, runing them for 'tstados' /* calls all the routines that emulates the computer, runing them for 'tstados'
tstates */ tstates */
inline void emulate (int tstados) { void emulate (int tstados) {
if((procesador.I>=0x40)&&(procesador.I<=0x7F)) { if((procesador.I>=0x40)&&(procesador.I<=0x7F)) {
ordenador.screen_snow=1; ordenador.screen_snow=1;
...@@ -67,6 +68,7 @@ void computer_init () { ...@@ -67,6 +68,7 @@ void computer_init () {
int bucle; int bucle;
ordenador.page48k = 0;
ordenador.bus_counter = 0; ordenador.bus_counter = 0;
ordenador.port254 = 0; ordenador.port254 = 0;
ordenador.issue = 3; ordenador.issue = 3;
...@@ -416,6 +418,7 @@ void register_screen (SDL_Surface * pantalla) { ...@@ -416,6 +418,7 @@ void register_screen (SDL_Surface * pantalla) {
void set_memory_pointers () { void set_memory_pointers () {
static unsigned int rom, ram; static unsigned int rom, ram;
static char last_st=-1;
// assign the offset for video page // assign the offset for video page
...@@ -428,6 +431,7 @@ void set_memory_pointers () { ...@@ -428,6 +431,7 @@ void set_memory_pointers () {
if ((ordenador.mode128k == 3)) { if ((ordenador.mode128k == 3)) {
if (ordenador.mport2 & 0x01) { // +2A/+3 special mode if (ordenador.mport2 & 0x01) { // +2A/+3 special mode
ordenador.page48k = 0; // no 48K ROM paged in
ram = (unsigned int) (ordenador.mport1 & 0x06); // bits 1&2 ram = (unsigned int) (ordenador.mport1 & 0x06); // bits 1&2
switch (ram) { switch (ram) {
case 0: case 0:
...@@ -435,25 +439,43 @@ void set_memory_pointers () { ...@@ -435,25 +439,43 @@ void set_memory_pointers () {
ordenador.block1 = ordenador.memoria + 65536; ordenador.block1 = ordenador.memoria + 65536;
ordenador.block2 = ordenador.memoria + 65536; ordenador.block2 = ordenador.memoria + 65536;
ordenador.block3 = ordenador.memoria + 65536; ordenador.block3 = ordenador.memoria + 65536;
if (last_st != 0) {
printf("FullRAM 0\n");
last_st = 0;
}
break; break;
case 2: case 2:
ordenador.block0 = ordenador.memoria + 131072; ordenador.block0 = ordenador.memoria + 131072;
ordenador.block1 = ordenador.memoria + 131072; ordenador.block1 = ordenador.memoria + 131072;
ordenador.block2 = ordenador.memoria + 131072; ordenador.block2 = ordenador.memoria + 131072;
ordenador.block3 = ordenador.memoria + 131072; ordenador.block3 = ordenador.memoria + 131072;
if (last_st != 1) {
printf("FullRAM 1\n");
last_st = 1;
}
break; break;
case 4: case 4:
ordenador.block0 = ordenador.memoria + 131072; ordenador.block0 = ordenador.memoria + 131072;
ordenador.block1 = ordenador.memoria + 131072; ordenador.block1 = ordenador.memoria + 131072;
ordenador.block2 = ordenador.memoria + 131072; ordenador.block2 = ordenador.memoria + 131072;
ordenador.block3 = ordenador.memoria + 65536; ordenador.block3 = ordenador.memoria + 65536;
if (last_st != 2) {
printf("FullRAM 2\n");
last_st = 2;
}
break; break;
case 6: case 6:
ordenador.block0 = ordenador.memoria + 131072; ordenador.block0 = ordenador.memoria + 131072;
ordenador.block1 = ordenador.memoria + 163840; ordenador.block1 = ordenador.memoria + 163840;
ordenador.block2 = ordenador.memoria + 131072; ordenador.block2 = ordenador.memoria + 131072;
ordenador.block3 = ordenador.memoria + 65536; ordenador.block3 = ordenador.memoria + 65536;
if (last_st != 3) {
printf("FullRAM 3\n");
last_st = 3;
}
break; break;
default:
printf("FullRAM desconocido\n");
} }
return; return;
} else { // ROMs for +2A/+3 normal mode } else { // ROMs for +2A/+3 normal mode
...@@ -464,12 +486,16 @@ void set_memory_pointers () { ...@@ -464,12 +486,16 @@ void set_memory_pointers () {
rom += 2; rom += 2;
// assign the first block pointer to the right block bank // assign the first block pointer to the right block bank
ordenador.block0 = ordenador.memoria + (16384 * rom); ordenador.block0 = ordenador.memoria + (16384 * rom);
ordenador.page48k = (rom==3) ? 1 : 0; // 48K ROM is in ROM page 3
} }
} else { // ROMs for 128K/+2 mode } else { // ROMs for 128K/+2 mode
if (ordenador.mport1 & 0x10) if (ordenador.mport1 & 0x10) {
ordenador.block0 = ordenador.memoria + 16384; ordenador.block0 = ordenador.memoria + 16384;
else ordenador.page48k = 1;
} else {
ordenador.block0 = ordenador.memoria; ordenador.block0 = ordenador.memoria;
ordenador.page48k = 0;
}
} }
// RAMs for 128K/+2 mode, and +2A/+3 in normal mode // RAMs for 128K/+2 mode, and +2A/+3 in normal mode
...@@ -479,12 +505,16 @@ void set_memory_pointers () { ...@@ -479,12 +505,16 @@ void set_memory_pointers () {
ram = 1 + ((unsigned int) (ordenador.mport1 & 0x07)); // RAM page for block3 plus 1 ram = 1 + ((unsigned int) (ordenador.mport1 & 0x07)); // RAM page for block3 plus 1
ordenador.block3 = ordenador.memoria + (16384 * ram); // page n minus 49152 ordenador.block3 = ordenador.memoria + (16384 * ram); // page n minus 49152
if (last_st != ram+3) {
printf("Pagina superior %d\n",ram-1);
last_st = ram+3;
}
} }
/* Paints the spectrum screen during the TSTADOS tstates that the Z80 used /* Paints the spectrum screen during the TSTADOS tstates that the Z80 used
to execute last instruction */ to execute last instruction */
inline void show_screen (int tstados) { void show_screen (int tstados) {
static unsigned char temporal, ink, paper, fflash, tmp2; static unsigned char temporal, ink, paper, fflash, tmp2;
...@@ -613,9 +643,10 @@ inline void show_screen (int tstados) { ...@@ -613,9 +643,10 @@ inline void show_screen (int tstados) {
/* PAINT_PIXELS paints one byte with INK color for 1 bits and PAPER color /* PAINT_PIXELS paints one byte with INK color for 1 bits and PAPER color
for 0 bits, and increment acordingly the pointer PIXEL */ for 0 bits, and increment acordingly the pointer PIXEL */
inline void paint_pixels (unsigned char octet,unsigned char ink, unsigned char paper) { void paint_pixels (unsigned char octet,unsigned char ink, unsigned char paper) {
static int bucle,valor,*p; static int bucle,valor;
static unsigned int *p;
static unsigned char mask; static unsigned char mask;
if ((ordenador.currpix < 16) || (ordenador.currpix >= 336) if ((ordenador.currpix < 16) || (ordenador.currpix >= 336)
...@@ -642,7 +673,7 @@ inline void paint_pixels (unsigned char octet,unsigned char ink, unsigned char p ...@@ -642,7 +673,7 @@ inline void paint_pixels (unsigned char octet,unsigned char ink, unsigned char p
} }
} }
inline void paint_one_pixel(unsigned char *colour,unsigned char *address) { void paint_one_pixel(unsigned char *colour,unsigned char *address) {
#if __BYTE_ORDER == __LITTLE_ENDIAN #if __BYTE_ORDER == __LITTLE_ENDIAN
switch(ordenador.bpp) { switch(ordenador.bpp) {
...@@ -679,7 +710,7 @@ inline void paint_one_pixel(unsigned char *colour,unsigned char *address) { ...@@ -679,7 +710,7 @@ inline void paint_one_pixel(unsigned char *colour,unsigned char *address) {
// Read the keyboard and stores the flags // Read the keyboard and stores the flags
inline void read_keyboard (SDL_Event *pevento2) { void read_keyboard (SDL_Event *pevento2) {
unsigned int temporal_io; unsigned int temporal_io;
SDL_Event evento,evento2,*pevento; SDL_Event evento,evento2,*pevento;
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include <SDL/SDL_thread.h> #include <SDL/SDL_thread.h>
#include "z80free/Z80free.h"
#include "tape.hpp"
// #define MUT // #define MUT
...@@ -144,7 +146,7 @@ struct computer { ...@@ -144,7 +146,7 @@ struct computer {
unsigned int tape_pause_at_end; unsigned int tape_pause_at_end;
FILE *tap_file; FILE *tap_file;
unsigned char tape_fast_load; // 0 normal load; 1 fast load unsigned char tape_fast_load; // 0 normal load; 1 fast load
unsigned char current_tap[2049]; char current_tap[2049];
unsigned char tape_current_bit; unsigned char tape_current_bit;
unsigned int tape_block_level; unsigned int tape_block_level;
...@@ -160,7 +162,7 @@ struct computer { ...@@ -160,7 +162,7 @@ struct computer {
// Microdrive global variables // Microdrive global variables
FILE *mdr_file; // Current microdrive file FILE *mdr_file; // Current microdrive file
unsigned char mdr_current_mdr[2049]; // current path and name for microdrive file char mdr_current_mdr[2049]; // current path and name for microdrive file
unsigned char mdr_active; // 0: not installed; 1: installed unsigned char mdr_active; // 0: not installed; 1: installed
unsigned char mdr_paged; // 0: not pagined; 1: pagined unsigned char mdr_paged; // 0: not pagined; 1: pagined
unsigned int mdr_tapehead; // current position in the tape unsigned int mdr_tapehead; // current position in the tape
...@@ -175,7 +177,7 @@ struct computer { ...@@ -175,7 +177,7 @@ struct computer {
// OSD global variables // OSD global variables
unsigned char osd_text[200]; char osd_text[200];
unsigned int osd_time; unsigned int osd_time;
// pagination global variables // pagination global variables
...@@ -183,6 +185,7 @@ struct computer { ...@@ -183,6 +185,7 @@ struct computer {
unsigned char mport1,mport2; // ports for memory management (128K and +3) unsigned char mport1,mport2; // ports for memory management (128K and +3)
unsigned int video_offset; // 0 for page 5, and 32768 for page 7 unsigned int video_offset; // 0 for page 5, and 32768 for page 7
unsigned char *block0,*block1,*block2,*block3; // pointers for memory access (one for each 16K block). unsigned char *block0,*block1,*block2,*block3; // pointers for memory access (one for each 16K block).
unsigned char page48k; // 1 if the 48K ROM page is currently paged into
// public // public
...@@ -193,22 +196,23 @@ struct computer { ...@@ -193,22 +196,23 @@ struct computer {
unsigned char other_ret; // 0=no change; 1=memory returns RET (201) unsigned char other_ret; // 0=no change; 1=memory returns RET (201)
unsigned char turbo; unsigned char turbo;
Tape OOTape;
}; };
void computer_init(); void computer_init();
void register_screen(SDL_Surface *); void register_screen(SDL_Surface *);
inline void show_screen(int); void show_screen(int);
inline void paint_pixels(unsigned char, unsigned char, unsigned char); void paint_pixels(unsigned char, unsigned char, unsigned char);
inline void read_keyboard(); void read_keyboard(SDL_Event *pevento2);
void fill_audio(void *udata,Uint8 *,int); void fill_audio(void *udata,Uint8 *,int);
void set_volume(unsigned char); void set_volume(unsigned char);
inline void play_sound(unsigned int); void play_sound(unsigned int);
inline void emulate(int); void emulate(int);
void ResetComputer(); void ResetComputer();
inline byte bus_empty(); byte bus_empty();
void set_memory_pointers(); void set_memory_pointers();
inline void play_ay(); void paint_one_pixel(unsigned char *colour,unsigned char *address);
inline void paint_one_pixel(unsigned char *colour,unsigned char *address);
void computer_set_palete(); void computer_set_palete();
void set_palete_entry(unsigned char entry, byte Value); void set_palete_entry(unsigned char entry, byte Value);
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include <SDL/SDL_thread.h> #include <SDL/SDL_thread.h>
#include "sound.h" #include "sound.h"
#include "tape.h"
#include "microdrive.h" #include "microdrive.h"
#include "tape.h"
char debug_var=1; char debug_var=1;
...@@ -255,16 +255,12 @@ void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hw ...@@ -255,16 +255,12 @@ void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hw
// sound initialization // sound initialization
if (sound_type==SOUND_AUTOMATIC) { ret2=sound_init(); // check all sound systems
ret2=sound_init(1); // check all sound systems
} else {
ret2=sound_init(0); // try with the one specified in command line
}
if(ret2==0) { if(ret2==0) {
sound_aborted=0; sound_aborted=0;
} else { // if fails, run without sound } else { // if fails, run without sound
sound_type=SOUND_NO; sound_type=SOUND_NO;
sound_init(0); sound_init();
sound_aborted=1; sound_aborted=1;
} }
printf("Init sound\n"); printf("Init sound\n");
...@@ -619,7 +615,7 @@ int main(int argc,char *argv[]) { ...@@ -619,7 +615,7 @@ int main(int argc,char *argv[]) {
SDL_WM_SetCaption("FBZX",""); SDL_WM_SetCaption("FBZX","");
ordenador.interr=0; ordenador.interr=0;
ordenador.screenbuffer=ordenador.screen->pixels; ordenador.screenbuffer=(unsigned char *)ordenador.screen->pixels;
ordenador.screen_width=ordenador.screen->w; ordenador.screen_width=ordenador.screen->w;
// assign initial values for PATH variables // assign initial values for PATH variables
...@@ -703,7 +699,7 @@ int main(int argc,char *argv[]) { ...@@ -703,7 +699,7 @@ int main(int argc,char *argv[]) {
/* if PC is 0x0556, a call to LD_BYTES has been made, so if /* if PC is 0x0556, a call to LD_BYTES has been made, so if
FAST_LOAD is 1, we must load the block in memory and return */ FAST_LOAD is 1, we must load the block in memory and return */
if((!ordenador.mdr_paged)&&(PC==0x0556) && (ordenador.tape_fast_load==1)&&(ordenador.tape_file_type==TAP_TAP)) { if((!ordenador.mdr_paged) && (PC==0x0556) && (ordenador.tape_fast_load==1) && (ordenador.tape_file_type==TAP_TAP) && (ordenador.page48k == 1)) {
if(ordenador.tap_file!=NULL) if(ordenador.tap_file!=NULL)
fastload_block(ordenador.tap_file); fastload_block(ordenador.tap_file);
else { else {
......
...@@ -30,9 +30,10 @@ ...@@ -30,9 +30,10 @@
#include <string.h> #include <string.h>
#include "characters.h" #include "characters.h"
#include "menus.h" #include "menus.h"
#include "tape.h"
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include "tape.h"
// shows the settings menu // shows the settings menu
...@@ -50,7 +51,7 @@ void help_menu() { ...@@ -50,7 +51,7 @@ void help_menu() {
unsigned char *fbuffer,fin; unsigned char *fbuffer,fin;
int ancho=screen->w; int ancho=screen->w;
fbuffer=screen->pixels; fbuffer=(unsigned char *)screen->pixels;
clean_screen(); clean_screen();
...@@ -154,10 +155,10 @@ int launch_menu(unsigned int key_pressed) { ...@@ -154,10 +155,10 @@ int launch_menu(unsigned int key_pressed) {
void settings_menu() { void settings_menu() {
unsigned char *fbuffer,fin; unsigned char *fbuffer,fin;
unsigned char texto[41]; char texto[41];
int ancho=screen->w; int ancho=screen->w;
fbuffer=screen->pixels; fbuffer=(unsigned char *)screen->pixels;
fin=1; fin=1;
...@@ -375,10 +376,11 @@ void settings_menu() { ...@@ -375,10 +376,11 @@ void settings_menu() {
void do_poke() { void do_poke() {
unsigned char *videomem,string[80]; unsigned char *videomem;
char string[80];
int ancho,retorno,address,old_value,new_value; int ancho,retorno,address,old_value,new_value;
videomem=screen->pixels; videomem=(unsigned char *)screen->pixels;
ancho=screen->w; ancho=screen->w;
clean_screen(); clean_screen();
...@@ -467,7 +469,7 @@ void tools_menu() { ...@@ -467,7 +469,7 @@ void tools_menu() {
unsigned char *fbuffer,fin; unsigned char *fbuffer,fin;
int ancho=screen->w; int ancho=screen->w;
fbuffer=screen->pixels; fbuffer=(unsigned char *)screen->pixels;