Commit de4aa7fd authored by Sergio Costas's avatar Sergio Costas

Merge branch 'sdl2'

parents 52b99b08 33fb0536
# VERSIONS #
* Version 4.0.0 (2018-08-11)
* Now fullscreen works fine with Wayland (ported to SDL2)
* Version 3.9.1 (2018-05-01)
* Removed unused printfs
* Version 3.9.0 (2018-05-01)
......
......@@ -25,23 +25,7 @@ architectures. Please, read the file PORTS to know more details about this.
FBZX is based in Z80FREE, which you can find into the folder z80free.
To work with FBZX you need:
* A FrameBuffer-capable graphic card (or compatible with X-windows)
* A Linux system with FrameBuffer configured (can use X too)
* Sound Card with ALSA or OSS drivers (optional)
In order to get the maximum performance, your FrameBuffer driver must allow to
change to 640x480 or 480x640 resolution in 8 bits. Only the old VESAFB driver can
have problems with this fact, so if you use this driver, be sure to boot your
Linux box in 640x480 in 8 bits. If you don't do this, SDL will emulate that
mode, resulting in a high performance penalty. If you use an specific Framebuffer
driver, or the VESAFB driver from kernels 2.6, just don't worry: FBZX will
automagically change the graphic mode when starts.
Of course, currently that is no problem thanks to the high speed of computers.
## WHAT CAPABILITIES HAVE FBZX?
## WHAT CAPABILITIES HAVE FBZX
FBZX can emulate the original 48K spectrum (issue 2 and issue 3), the original
128K, the Amstrad +2, the Amstrad +2A and the Spanish 128K.
......@@ -69,7 +53,7 @@ with the cursor keys (fire is emulated with the right ALT key, ALT-GR
key, WINDOWS MENU key or WINDOWS SYSTEM right key), or with a real
JoyStick.
## HOW DO I USE FBZX?
## HOW DO I USE FBZX
To run FBZX just type
......@@ -117,9 +101,17 @@ You can change the order with
That way it will try firts with OSS, then with ALSA.
FBZX works in X too, but it would run slower due to the penalty of the X
FBZX works in X and Wayland too, but it would run slower due to the penalty of the X
Window System. Fortunately this only applies to old systems. Current
computers can run FBZX under X without problem.
computers can run FBZX under X or Wayland without problem.
Anyway, there is a command line option to get the maximum performance. This
is -setres. Using it, when switching to fullscreen it will try to change the
screen resolution to the right one. But it only works in Xwindows; in
Wayland, or when not using that option, FBZX will keep the current resolution
and scale the picture. If you have a graphics driver with hardware acceleration,
you won't have performance problems anyway, so this mode is better than changing
the resolution.
The PC keyboard works exactly like the Spectrum keyboard (but only numbers and
letters). ENTER key is Return, CAPS SHIFT is in both Shift keys, and SYMBOL
......@@ -165,7 +157,7 @@ F12 is volume up.
If your system doesn't have function keys, you can use TAB plus keys 0 to 9
to emulate them (F11 is TAB and O, and F12 is TAB and P).
## HOW DO I CHOOSE A FILE WITH THE TAP/TZX OR Z80/SNA SELECTOR?
## HOW TO CHOOSE A FILE WITH THE TAP/TZX OR Z80/SNA SELECTOR
You can choose a file just by moving the white bar with the cursor keys. You
can use also the RePag and AvPag to jump over 12 positions.
......@@ -182,7 +174,7 @@ to save from programs that use them (it can save programs without header, too,
since the emulator intercepts the call to SA-BYTES). Each new block is added at
the end of the file, but only if the SAVE operation is enabled for this file.
## HOW DOES WORK THE FAST SPEED LOAD FOR TAP/TZX FILES?
## HOW DOES WORK THE FAST SPEED LOAD FOR TAP/TZX FILES
Just type LOAD "" in the emulator (or choose the TAPE LOADER option in the 128K
menu) and the tape will automagically load. This only works with programs that
......@@ -206,7 +198,7 @@ change the TURBO WHILE PLAYING mode to ENABLED, so the computer (and the tape)
will run faster when the tape is playing (F6 key), but will return to normal
speed when the tape is paused (F5 key or end-of-tape).
## HOW DOES WORK THE FAST SPEED SAVE FOR TAP/TZX FILES?
## HOW DOES WORK THE FAST SPEED SAVE FOR TAP/TZX FILES
If write is enabled, using the SAVE command will add blocks to the currently
selected tape file, no matter if FAST-LOAD is enabled or not. By default,
......@@ -215,7 +207,7 @@ new TAP/TZX file is created from scratch. This functionality works with any
program that uses the SA-BYTES ROM routine, no matter if enters at 04C2 (like
the classic spectrum 48K rom) or at 04C6 (like the Spectrum +3).
## HOW DOES WORK THE INTERFACE I AND MICRODRIVE EMULATION?
## HOW DOES WORK THE INTERFACE I AND MICRODRIVE EMULATION
FBZX can emulate an Interface I with one microdrive attached, but only when
working as Spectrum 48K, 128K or +2, never as +2A/+3 since it's incompatible.
......
CC=g++ -c -O2 -g
CPP=g++ -c -O2 -g
LN=g++ -O2 -g
FLAGS = -O2
CFLAGS += `pkg-config --cflags sdl libpulse-simple alsa` -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
CPPFLAGS += `pkg-config --cflags sdl libpulse-simple alsa` -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
LDFLAGS += `pkg-config --libs sdl libpulse-simple alsa`
CC=g++ -c $(FLAGS)
CPP=g++ -c $(FLAGS)
LN=g++
CFLAGS += `pkg-config --cflags sdl2 libpulse-simple alsa` -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
CPPFLAGS += `pkg-config --cflags sdl2 libpulse-simple alsa` -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
LDFLAGS += `pkg-config --libs sdl2 libpulse-simple alsa`
fbzx: cargador.o cmdline.o computer.o emulator.o keyboard.o llscreen.o llsound.o menus.o microdrive.o mouse.o osd.o screen.o signals.o spk_ay.o tape.o Z80free.o Z80free_codes.o Z80free_codesCB.o Z80free_codesED.o Z80free_codesDD.o Z80free_codesFD.o Z80free_codesDDCB.o Z80free_codesFDCB.o
......@@ -15,22 +17,22 @@ Z80free.o: z80free/Z80free.c z80free/Z80free.h
Z80free_codes.o: z80free/Z80free_codes.c z80free/Z80free.h
$(CC) -o Z80free_codes.o z80free/Z80free_codes.c
Z80free_codesCB.o: z80free/Z80free_codesCB.c z80free/Z80free.h
$(CC) -o Z80free_codesCB.o z80free/Z80free_codesCB.c
Z80free_codesED.o: z80free/Z80free_codesED.c z80free/Z80free.h
$(CC) -o Z80free_codesED.o z80free/Z80free_codesED.c
Z80free_codesDD.o: z80free/Z80free_codesDD.c z80free/Z80free.h
$(CC) -o Z80free_codesDD.o z80free/Z80free_codesDD.c
Z80free_codesFD.o: z80free/Z80free_codesFD.c z80free/Z80free.h
$(CC) -o Z80free_codesFD.o z80free/Z80free_codesFD.c
Z80free_codesDDCB.o: z80free/Z80free_codesDDCB.c z80free/Z80free.h
$(CC) -o Z80free_codesDDCB.o z80free/Z80free_codesDDCB.c
Z80free_codesFDCB.o: z80free/Z80free_codesFDCB.c z80free/Z80free.h
$(CC) -o Z80free_codesFDCB.o z80free/Z80free_codesFDCB.c
......@@ -78,3 +80,4 @@ spk_ay.o: spk_ay.cpp spk_ay.hh llsound.hh computer.hh screen.hh signals.hh llscr
tape.o: tape.cpp z80free/Z80free.h tape.hh signals.hh emulator.hh screen.hh osd.hh computer.hh llscreen.hh
$(CPP) $(CPPFLAGS) -o tape.o tape.cpp
CC=g++ -c -O2
CPP=g++ -c -O2
LN=g++ -O2
FLAGS = -O2
CFLAGS += `pkg-config --cflags sdl libpulse-simple alsa` -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
CPPFLAGS += `pkg-config --cflags sdl libpulse-simple alsa` -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
LDFLAGS += `pkg-config --libs sdl libpulse-simple alsa`
CC=g++ -c $(FLAGS)
CPP=g++ -c $(FLAGS)
LN=g++
CFLAGS += `pkg-config --cflags sdl2 libpulse-simple alsa` -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
CPPFLAGS += `pkg-config --cflags sdl2 libpulse-simple alsa` -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
LDFLAGS += `pkg-config --libs sdl2 libpulse-simple alsa`
#basecmd $(CPP) $(CPPFLAGS)
#extra_obj Z80free.o Z80free_codes.o Z80free_codesCB.o Z80free_codesED.o Z80free_codesDD.o Z80free_codesFD.o Z80free_codesDDCB.o Z80free_codesFDCB.o
......@@ -17,21 +19,21 @@ Z80free.o: z80free/Z80free.c z80free/Z80free.h
Z80free_codes.o: z80free/Z80free_codes.c z80free/Z80free.h
$(CC) -o Z80free_codes.o z80free/Z80free_codes.c
Z80free_codesCB.o: z80free/Z80free_codesCB.c z80free/Z80free.h
$(CC) -o Z80free_codesCB.o z80free/Z80free_codesCB.c
Z80free_codesED.o: z80free/Z80free_codesED.c z80free/Z80free.h
$(CC) -o Z80free_codesED.o z80free/Z80free_codesED.c
Z80free_codesDD.o: z80free/Z80free_codesDD.c z80free/Z80free.h
$(CC) -o Z80free_codesDD.o z80free/Z80free_codesDD.c
Z80free_codesFD.o: z80free/Z80free_codesFD.c z80free/Z80free.h
$(CC) -o Z80free_codesFD.o z80free/Z80free_codesFD.c
Z80free_codesDDCB.o: z80free/Z80free_codesDDCB.c z80free/Z80free.h
$(CC) -o Z80free_codesDDCB.o z80free/Z80free_codesDDCB.c
Z80free_codesFDCB.o: z80free/Z80free_codesFDCB.c z80free/Z80free.h
$(CC) -o Z80free_codesFDCB.o z80free/Z80free_codesFDCB.c
\ No newline at end of file
This diff is collapsed.
......@@ -22,23 +22,21 @@
#include "z80free/Z80free.h"
struct z80snapshot {
byte A,F,B,C,D,E,H,L,AA,FF,BB,CC,DD,EE,HH,LL,R,I,IFF1,IFF2,Imode;
bool issue_3;
word PC,IX,IY,SP;
byte type; // bit 0/1: 48K/128K/+3
byte border; // border color
byte pager; // content of pagination register in 128K mode
unsigned char page[12][16384];
unsigned int found_pages; // bit=1: page exists. bit=0: page don't exists.
unsigned char ay_regs[16];
unsigned char ay_latch;
unsigned char joystick;
byte A, F, B, C, D, E, H, L, AA, FF, BB, CC, DD, EE, HH, LL, R, I, IFF1, IFF2, Imode;
bool issue_3;
word PC, IX, IY, SP;
byte type; // bit 0/1: 48K/128K/+3
byte border; // border color
byte pager; // content of pagination register in 128K mode
unsigned char page[12][16384];
unsigned int found_pages; // bit=1: page exists. bit=0: page don't exists.
unsigned char ay_regs[16];
unsigned char ay_latch;
unsigned char joystick;
};
int save_z80(char *);
int load_z80(const char *);
int load_sna(const char *);
void load_snap(struct z80snapshot *);
void uncompress_z80(FILE *,int,unsigned char *);
void uncompress_z80(FILE *, int, unsigned char *);
......@@ -12,30 +12,30 @@ using namespace std;
#include <stdlib.h>
#include "cmdline.hh"
CMDLine::CMDLine(int argc,char **argv) {
CMDLine::CMDLine(int argc, char **argv) {
int argumento;
this->nosound = false;
this->mini = false;
this->pulse = false;
this->alsa = false;
this->oss = false;
this->rotate = false;
this->fs = false;
this->hw = false;
this->db = false;
this->ds = false;
this->bw = false;
this->color = false;
this->ss = false;
this->jump = 0;
this->nosound = false;
this->mini = false;
this->pulse = false;
this->alsa = false;
this->oss = false;
this->rotate = false;
this->fs = false;
this->hw = false;
this->db = false;
this->ds = false;
this->bw = false;
this->color = false;
this->ss = false;
this->jump = 0;
this->setres = false;
this->gamefile = "";
argumento = 0;
while(argumento<argc) {
if ((0==strcmp(argv[argumento],"-h"))||(0==strcmp(argv[argumento],"--help"))) {
while (argumento < argc) {
if ((0 == strcmp(argv[argumento], "-h")) || (0 == strcmp(argv[argumento], "--help"))) {
printf("\nUsage: fbzx [-nosound] ");
#ifdef D_SOUND_ALSA
printf("[-alsa] ");
......@@ -69,64 +69,67 @@ CMDLine::CMDLine(int argc,char **argv) {
printf(" -bw: emulate black&white TV set\n");
printf(" -color: emulate a color TV set\n");
printf(" -jump N: show one TV refresh and jump over N refreshes (for slow systems)\n");
printf(" -setres: when setting fullscreen mode, try to change the screen resolution\n");
printf(" gamefile: an optional .Z80 snapshot or .TAP/.TZX tape file\n\n");
exit(0);
} else if(0==strcmp(argv[argumento],"-nosound")) {
} else if (0 == strcmp(argv[argumento], "-nosound")) {
this->nosound = true;
argumento++;
} else if(0==strcmp(argv[argumento],"-mini")) {
} else if (0 == strcmp(argv[argumento], "-mini")) {
this->mini = true;
argumento++;
#ifdef D_SOUND_PULSE
} else if(0==strcmp(argv[argumento],"-pulse")) {
} else if (0 == strcmp(argv[argumento], "-pulse")) {
this->pulse = true;
argumento++;
#endif
#ifdef D_SOUND_ALSA
} else if(0==strcmp(argv[argumento],"-alsa")) {
} else if (0 == strcmp(argv[argumento], "-alsa")) {
this->alsa = true;
argumento++;
#endif
#ifdef D_SOUND_OSS
} else if(0==strcmp(argv[argumento],"-oss")) {
} else if (0 == strcmp(argv[argumento], "-oss")) {
this->oss = true;
argumento++;
#endif
} else if(0==strcmp(argv[argumento],"-rotate")) {
} else if (0 == strcmp(argv[argumento], "-rotate")) {
this->rotate = true;
argumento++;
} else if(0==strcmp(argv[argumento],"-fs")) {
} else if (0 == strcmp(argv[argumento], "-fs")) {
this->fs = true;
argumento++;
} else if(0==strcmp(argv[argumento],"-hw")) {
} else if (0 == strcmp(argv[argumento], "-setres")) {
this->setres = true;
argumento++;
} else if (0 == strcmp(argv[argumento], "-hw")) {
this->hw = true;
argumento++;
} else if(0==strcmp(argv[argumento],"-db")) {
} else if (0 == strcmp(argv[argumento], "-db")) {
this->db = true;
argumento++;
} else if(0==strcmp(argv[argumento],"-ds")) {
} else if (0 == strcmp(argv[argumento], "-ds")) {
this->ds = true;
argumento++;
} else if(0==strcmp(argv[argumento],"-bw")) {
} else if (0 == strcmp(argv[argumento], "-bw")) {
this->bw = true;
argumento++;
} else if(0==strcmp(argv[argumento],"-color")) {
} else if (0 == strcmp(argv[argumento], "-color")) {
this->color = true;
argumento++;
} else if(0==strcmp(argv[argumento],"-ss")) {
} else if (0 == strcmp(argv[argumento], "-ss")) {
this->ss = true;
argumento++;
} else if(0==strncmp(argv[argumento],"-jump",5)) {
} else if (0 == strncmp(argv[argumento], "-jump", 5)) {
/*jump_frames=(int)(argv[argumento][5]);
jump_frames-=48;*/
this->jump = (int)(argv[argumento][5]);
* jump_frames-=48;*/
this->jump = (int) (argv[argumento][5]);
this->jump -= '0';
argumento++;
} else {
this->gamefile = argv[argumento];
//strcpy(this->gamefile,argv[argumento]);
// strcpy(this->gamefile,argv[argumento]);
argumento++;
}
}
}
......@@ -9,9 +9,7 @@
#define SRC_CMDLINE_HH_
class CMDLine {
public:
bool nosound;
bool mini;
bool pulse;
......@@ -25,14 +23,11 @@ public:
bool bw;
bool color;
bool ss;
bool setres;
int jump;
string gamefile;
CMDLine(int argc,char **argv);
CMDLine(int argc, char **argv);
};
#endif /* SRC_CMDLINE_HH_ */
This diff is collapsed.
......@@ -20,8 +20,8 @@
#ifndef computer_h
#define computer_h
#include <SDL/SDL.h>
#include <SDL/SDL_thread.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_thread.h>
#include "tape.hh"
#include "z80free/Z80free.h"
......@@ -31,21 +31,40 @@
// #define MUT
#define CONTENTION_RD 3
#define CONTENTION_WR 3
#define CONTENTION_IN 3
#define CONTENTION_OUT 3
#define CONTENTION_RD 3
#define CONTENTION_WR 3
#define CONTENTION_IN 3
#define CONTENTION_OUT 3
extern char salir;
extern class computer *ordenador;
enum tapmodes {TAP_GUIDE, TAP_DATA, TAP_PAUSE, TAP_TRASH, TAP_STOP, TAP_PAUSE2, TZX_PURE_TONE,
TZX_SEQ_PULSES, TAP_FINAL_BIT, TAP_PAUSE3};
enum tapmodes {
TAP_GUIDE,
TAP_DATA,
TAP_PAUSE,
TAP_TRASH,
TAP_STOP,
TAP_PAUSE2,
TZX_PURE_TONE,
TZX_SEQ_PULSES,
TAP_FINAL_BIT,
TAP_PAUSE3
};
enum taptypes {TAP_TAP, TAP_TZX};
enum taptypes {
TAP_TAP,
TAP_TZX
};
enum CurrentMode {MODE_48K, MODE_128K, MODE_P2, MODE_P3, MODE_128K_SPA};
enum CurrentMode {
MODE_48K,
MODE_128K,
MODE_P2,
MODE_P3,
MODE_128K_SPA
};
class computer : public Signals {
public:
......@@ -56,12 +75,12 @@ public:
bool bw;
int memcontended_zone; // memory contended tstates from this instant up to the next non-contended block
int cicles_counter; // counts how many pixel clock cicles passed since las interrupt
int contended_cicles; // cicles used during contention (must not be counted after ending the execution of an instruction)
int cicles_counter; // counts how many pixel clock cicles passed since las interrupt
int contended_cicles; // cicles used during contention (must not be counted after ending the execution of an instruction)
// Linux joystick private global variables
unsigned char updown,leftright;
unsigned char updown, leftright;
// Sound variables
unsigned char sound_bit;
......@@ -75,26 +94,25 @@ public:
enum CurrentMode current_mode;
unsigned char port254;
// tape global variables
string current_tap;
bool tape_write; // FALSE can't write; TRUE can write
bool tape_write; // FALSE can't write; TRUE can write
bool tape_fast_load; // FALSE normal load; TRUE fast load
// pagination global variables
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 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
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 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
unsigned char memoria[196608]; // memory (12 pages of 16K each one). 4 for ROM, and 8 for RAM
unsigned char shadowrom[8192]; // space for Interface I's ROMs
unsigned char interr;
unsigned char other_ret; // 0=no change; 1=memory returns RET (201)
unsigned char other_ret; // 0=no change; 1=memory returns RET (201)
bool turbo;
bool turbo_play;
......@@ -106,10 +124,10 @@ public:
void emulate(int);
void do_contention(bool io, word addr);
uint8_t read_memory(uint16_t Addr);
void write_memory (uint16_t Addr, uint8_t Value);
void write_memory(uint16_t Addr, uint8_t Value);
};
void fill_audio(void *udata,Uint8 *,int);
void fill_audio(void *udata, Uint8 *, int);
void ResetComputer();
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -9,15 +9,19 @@
#define SRC_KEYBOARD_HH_
#include <inttypes.h>
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
enum JOYSTICK_TYPE { JOYSTICK_CURSOR, JOYSTICK_KEMPSTON, JOYSTICK_SINCLAIR1, JOYSTICK_SINCLAIR2};
enum JOYSTICK_TYPE {
JOYSTICK_CURSOR,
JOYSTICK_KEMPSTON,
JOYSTICK_SINCLAIR1,
JOYSTICK_SINCLAIR2
};
class Keyboard {
// keyboard private global variables
uint8_t k8,k9,k10,k11,k12,k13,k14,k15;
uint8_t k8, k9, k10, k11, k12, k13, k14, k15;
uint8_t readed;
// kempston joystick private global variables
......@@ -29,7 +33,7 @@ public:
void reset();
void read_keyboard(SDL_Event *);
uint8_t s8,s9,s10,s11,s12,s13,s14,s15;
uint8_t s8, s9, s10, s11, s12, s13, s14, s15;
uint8_t js;
enum JOYSTICK_TYPE joystick; // 0=cursor, 1=kempston, 2=sinclair1, 3=sinclair2
int32_t mouse_x;
......@@ -43,5 +47,4 @@ public:
extern class Keyboard *keyboard;
#endif /* SRC_KEYBOARD_HH_ */
This diff is collapsed.
......@@ -24,38 +24,41 @@ using namespace std;
#include <inttypes.h>
#include <string>
#include <SDL/SDL.h>
#include <SDL/SDL_thread.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_thread.h>
#include <iostream>
#include <fstream>
extern struct Charset charset;
#define MIN_WIDTH 4
#define MIN_WIDTH 4
class LLScreen {
uint8_t *memory;
uint32_t width;
uint32_t height;
uint8_t ulaplus_palete[64]; // contains the current palete
uint32_t colors[80];
bool setres;
uint8_t printchar(uint8_t character, int16_t x, int16_t y, uint8_t color, uint8_t back);
public:
uint32_t *memory;
bool joystick;
bool mustlock;
bool rotate;
uint32_t bpp;
SDL_Surface *llscreen;
SDL_Window *sdlwindow;
SDL_Renderer *sdlrenderer;
SDL_Texture *llscreen;
uint32_t cheight;
uint32_t lines_in_screen;
bool fullscreen;
LLScreen(int16_t resx, int16_t resy, uint8_t depth, bool fullscreen, bool dblbuffer, bool hwsurface);
LLScreen(int16_t resx, int16_t resy, uint8_t depth, bool fullscreen, bool dblbuffer, bool hwsurface, bool setres);
~LLScreen();
ifstream *myfopen(string,ios_base::openmode);
ifstream *myfopen(string, ios_base::openmode);
void print_string(string message, int16_t x, float y, uint8_t ink, uint8_t paper);
void set_paletes(bool);
void paint_one_pixel(uint8_t value,unsigned char *address);
void paint_one_pixel(uint8_t value, uint32_t *address);
void fullscreen_switch();
void set_mouse();
void set_palete_entry(uint8_t entry, uint8_t Value, bool bw);
......
This diff is collapsed.
......@@ -20,7 +20,7 @@
#ifndef SOUND_H
#define SOUND_H
#include <inttypes.h>
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
#if 0
#define D_SOUND_PULSE
......@@ -28,15 +28,20 @@
#define D_SOUND_OSS
#endif
#define FILTER_SAMPLES 8
#define FILTER_SAMPLES 8
enum e_soundtype {SOUND_NO, SOUND_OSS, SOUND_ALSA, SOUND_PULSEAUDIO, SOUND_AUTOMATIC};
enum e_soundtype {
SOUND_NO,
SOUND_OSS,
SOUND_ALSA,
SOUND_PULSEAUDIO,
SOUND_AUTOMATIC
};
extern class LLSound *llsound;
class LLSound {
uint8_t format; // 0: 8 bits, 1: 16 bits LSB, 2: 16 bits MSB
uint8_t format; // 0: 8 bits, 1: 16 bits LSB, 2: 16 bits MSB
uint8_t channels; // number of channels
#ifdef D_SOUND_OSS
......@@ -48,20 +53,20 @@ class LLSound {
#ifdef D_SOUND_PULSE
int init_pulse();
#endif
void remove_dc(unsigned char *sound_buffer,int size);
void remove_dc(unsigned char *sound_buffer, int size);
int init_sound();
void show_volume();
public:
uint32_t freq; // frequency for reproduction
uint32_t freq; // frequency for reproduction
uint32_t tst_sample; // number of tstates per sample
int8_t sign; // 0: unsigned; 1: signed
int8_t sign; // 0: unsigned; 1: signed
bool sound_aborted;
unsigned char *sound;
unsigned char *current_buffer;
uint32_t buffer_len; // sound buffer length (in samples)
uint32_t increment; // cuantity to add to jump to the next sample
uint8_t volume; // volume
uint32_t increment; // cuantity to add to jump to the next sample
uint8_t volume; // volume
enum e_soundtype sound_type;
LLSound(enum e_soundtype);
......@@ -69,6 +74,7 @@ public:
void play();
void increase_volume();
void decrease_volume();
void set_volume(uint8_t);
void set_speed(bool);
};
......
This diff is collapsed.
......@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
using namespace std;
......@@ -24,23 +24,30 @@ using namespace std;
class fichero {
public:
string nombre; // filename (for files and directories)
string nombre; // filename (for files and directories)
string nombrepath; // filename with path
int tipo; // file type (0=file, 1=directory, 2=parent directory)
int tipo; // file type (0=file, 1=directory, 2=parent directory)
struct fichero *next;
struct fichero *prev;
};
#define CURSOR_ELEMENT '_'
#define CURSOR_ELEMENT '_'
enum LOAD_FILE_TYPES {FILETYPE_Z80, FILETYPE_TAP_TZX, FILETYPE_MDR, FILETYPE_SCR};
enum LOAD_FILE_TYPES {
FILETYPE_Z80,
FILETYPE_TAP_TZX,
FILETYPE_MDR,
FILETYPE_SCR
};
void help_menu();
void load_z80file();
char *select_file(string,char *,enum LOAD_FILE_TYPES);
class fichero *read_directory(char *,enum LOAD_FILE_TYPES);
char * select_file(string, char *, enum LOAD_FILE_TYPES);
class fichero *read_directory(char *, enum LOAD_FILE_TYPES);
unsigned int wait_key();
void print_files(class fichero *,int,int);
void print_files(class fichero *, int, int);
void delete_filelist(class fichero *);
void select_tapfile();
void save_z80file();
......@@ -53,9 +60,9 @@ void create_mdrfile();
void microdrive_menu();
void keyboard_menu();
void load_scrfile();
int ask_filename(char *nombre,int y_coord,string extension, char*path);
int ask_filename(char *nombre, int y_coord, string extension, char *path);
void create_scrfile();
void do_poke();
int ask_value(int *final_value,int y_coord,int max_value);
int ask_value(int *final_value, int y_coord, int max_value);
void tools_menu();